computability.partrec_codeMathlib.Computability.PartrecCode

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -70,7 +70,7 @@ theorem rfind' {f} (hf : Nat.Partrec f) :
               (primrec₂.mkpair.comp (primrec.fst.comp <| primrec.unpair.comp Primrec.fst)
                   (primrec.nat_add.comp Primrec.snd
                     (primrec.snd.comp <| primrec.unpair.comp Primrec.fst))).to_comp).to₂)
-    simp at this ; exact this
+    simp at this; exact this
 #align nat.partrec.rfind' Nat.Partrec.rfind'
 -/
 
@@ -113,7 +113,7 @@ protected def const : ℕ → Code
 theorem const_inj : ∀ {n₁ n₂}, Nat.Partrec.Code.const n₁ = Nat.Partrec.Code.const n₂ → n₁ = n₂
   | 0, 0, h => by simp
   | n₁ + 1, n₂ + 1, h => by
-    dsimp [Nat.Partrec.Code.const] at h 
+    dsimp [Nat.Partrec.Code.const] at h
     injection h with h₁ h₂
     simp only [const_inj h₂]
 #align nat.partrec.code.const_inj Nat.Partrec.Code.const_inj
@@ -222,7 +222,7 @@ theorem encode_lt_pair (cf cg) :
   by
   simp [encode_code_eq, encode_code, -add_comm]
   have := Nat.mul_le_mul_right _ (by decide : 1 ≤ 2 * 2)
-  rw [one_mul, mul_assoc, ← bit0_eq_two_mul, ← bit0_eq_two_mul] at this 
+  rw [one_mul, mul_assoc, ← bit0_eq_two_mul, ← bit0_eq_two_mul] at this
   have := lt_of_le_of_lt this (lt_add_of_pos_right _ (by decide : 0 < 4))
   exact ⟨lt_of_le_of_lt (Nat.left_le_pair _ _) this, lt_of_le_of_lt (Nat.right_le_pair _ _) this⟩
 #align nat.partrec.code.encode_lt_pair Nat.Partrec.Code.encode_lt_pair
@@ -251,7 +251,7 @@ theorem encode_lt_rfind' (cf) : encode cf < encode (rfind' cf) :=
   by
   simp [encode_code_eq, encode_code, -add_comm]
   have := Nat.mul_le_mul_right _ (by decide : 1 ≤ 2 * 2)
-  rw [one_mul, mul_assoc, ← bit0_eq_two_mul, ← bit0_eq_two_mul] at this 
+  rw [one_mul, mul_assoc, ← bit0_eq_two_mul, ← bit0_eq_two_mul] at this
   refine' lt_of_le_of_lt (le_trans this _) (lt_add_of_pos_right _ (by decide : 0 < 4))
   exact le_of_lt (Nat.bit0_lt_bit1 <| le_of_lt <| Nat.bit0_lt_bit1 <| le_rfl)
 #align nat.partrec.code.encode_lt_rfind' Nat.Partrec.Code.encode_lt_rfind'
@@ -797,18 +797,18 @@ def evaln : ∀ k : ℕ, Code → ℕ → Option ℕ
 
 #print Nat.Partrec.Code.evaln_bound /-
 theorem evaln_bound : ∀ {k c n x}, x ∈ evaln k c n → n < k
-  | 0, c, n, x, h => by simp [evaln] at h  <;> cases h
+  | 0, c, n, x, h => by simp [evaln] at h <;> cases h
   | k + 1, c, n, x, h =>
     by
     suffices ∀ {o : Option ℕ}, x ∈ guard (n ≤ k) >> o → n < k + 1 by
-      cases c <;> rw [evaln] at h  <;> exact this h
+      cases c <;> rw [evaln] at h <;> exact this h
     simpa [(· >> ·)] using Nat.lt_succ_of_le
 #align nat.partrec.code.evaln_bound Nat.Partrec.Code.evaln_bound
 -/
 
 #print Nat.Partrec.Code.evaln_mono /-
 theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c n → x ∈ evaln k₂ c n
-  | 0, k₂, c, n, x, hl, h => by simp [evaln] at h  <;> cases h
+  | 0, k₂, c, n, x, hl, h => by simp [evaln] at h <;> cases h
   | k + 1, k₂ + 1, c, n, x, hl, h =>
     by
     have hl' := Nat.le_of_succ_le_succ hl
@@ -842,7 +842,7 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
 
 #print Nat.Partrec.Code.evaln_sound /-
 theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
-  | 0, _, n, x, h => by simp [evaln] at h  <;> cases h
+  | 0, _, n, x, h => by simp [evaln] at h <;> cases h
   | k + 1, c, n, x, h =>
     by
     induction' c with cf cg hf hg cf cg hf hg cf cg hf hg cf hf generalizing x n <;>
@@ -861,17 +861,17 @@ theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
       · apply hf
       · refine' fun y h₁ h₂ => ⟨y, IH _ _, _⟩
         · have := evaln_mono k.le_succ h₁
-          simp [evaln, (· >> ·)] at this 
+          simp [evaln, (· >> ·)] at this
           exact this.2
         · exact hg _ _ h₂
     · -- rfind' cf
       rcases h with ⟨m, h₁, h₂⟩
-      by_cases m0 : m = 0 <;> simp [m0] at h₂ 
+      by_cases m0 : m = 0 <;> simp [m0] at h₂
       ·
         exact
           ⟨0, ⟨by simpa [m0] using hf _ _ h₁, fun m => (Nat.not_lt_zero _).elim⟩, by
             injection h₂ with h₂ <;> simp [h₂]⟩
-      · have := evaln_sound h₂; simp [eval] at this 
+      · have := evaln_sound h₂; simp [eval] at this
         rcases this with ⟨y, ⟨hy₁, hy₂⟩, rfl⟩
         refine'
           ⟨y + 1, ⟨by simpa [add_comm, add_left_comm] using hy₁, fun i im => _⟩, by
@@ -927,7 +927,7 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
         simpa [evaln, (· >> ·)]
       revert hy₁ hy₂; generalize n.unpair.2 = m; intros
       induction' y with y IH generalizing m <;> simp [evaln, (· >> ·)]
-      · simp at hy₁ ; rcases hf hy₁ with ⟨k, hk⟩
+      · simp at hy₁; rcases hf hy₁ with ⟨k, hk⟩
         exact ⟨_, Nat.le_of_lt_succ <| evaln_bound hk, _, hk, by simp <;> rfl⟩
       · rcases hy₂ (Nat.succ_pos _) with ⟨a, ha, a0⟩
         rcases hf ha with ⟨k₁, hk₁⟩
@@ -937,7 +937,7 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
               hy₂ (Nat.succ_lt_succ hi) with
           ⟨k₂, hk₂⟩
         use(max k₁ k₂).succ
-        rw [zero_add] at hk₁ 
+        rw [zero_add] at hk₁
         use Nat.le_succ_of_le <| le_max_of_le_left <| Nat.le_of_lt_succ <| evaln_bound hk₁
         use a
         use evaln_mono (Nat.succ_le_succ <| Nat.le_succ_of_le <| le_max_left _ _) hk₁
@@ -1085,7 +1085,7 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
       intro nk
       cases' k with k'; · simp [evaln]
       let k := k' + 1; change k'.succ with k
-      simp [Nat.lt_succ_iff] at nk 
+      simp [Nat.lt_succ_iff] at nk
       have hg :
         ∀ {k' c' n},
           mkpair k' (encode c') < mkpair k (encode c) →
Diff
@@ -3,7 +3,7 @@ Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 -/
-import Mathbin.Computability.Partrec
+import Computability.Partrec
 
 #align_import computability.partrec_code from "leanprover-community/mathlib"@"781cb2eed038c4caf53bdbd8d20a95e5822d77df"
 
Diff
@@ -936,7 +936,7 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
             simpa [Nat.succ_eq_add_one, add_comm, add_left_comm] using
               hy₂ (Nat.succ_lt_succ hi) with
           ⟨k₂, hk₂⟩
-        use (max k₁ k₂).succ
+        use(max k₁ k₂).succ
         rw [zero_add] at hk₁ 
         use Nat.le_succ_of_le <| le_max_of_le_left <| Nat.le_of_lt_succ <| evaln_bound hk₁
         use a
Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module computability.partrec_code
-! leanprover-community/mathlib commit 781cb2eed038c4caf53bdbd8d20a95e5822d77df
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Computability.Partrec
 
+#align_import computability.partrec_code from "leanprover-community/mathlib"@"781cb2eed038c4caf53bdbd8d20a95e5822d77df"
+
 /-!
 # Gödel Numbering for Partial Recursive Functions.
 
Diff
@@ -53,6 +53,7 @@ namespace Nat.Partrec
 
 open Nat (pair)
 
+#print Nat.Partrec.rfind' /-
 theorem rfind' {f} (hf : Nat.Partrec f) :
     Nat.Partrec
       (Nat.unpaired fun a m =>
@@ -74,6 +75,7 @@ theorem rfind' {f} (hf : Nat.Partrec f) :
                     (primrec.snd.comp <| primrec.unpair.comp Primrec.fst))).to_comp).to₂)
     simp at this ; exact this
 #align nat.partrec.rfind' Nat.Partrec.rfind'
+-/
 
 #print Nat.Partrec.Code /-
 /-- Code for partial recursive functions from ℕ to ℕ.
@@ -311,6 +313,7 @@ theorem rfind_prim : Primrec rfind' :=
 #align nat.partrec.code.rfind_prim Nat.Partrec.Code.rfind_prim
 -/
 
+#print Nat.Partrec.Code.rec_prim' /-
 theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Primrec c) {z : α → σ}
     (hz : Primrec z) {s : α → σ} (hs : Primrec s) {l : α → σ} (hl : Primrec l) {r : α → σ}
     (hr : Primrec r) {pr : α → Code × Code × σ × σ → σ} (hpr : Primrec₂ pr)
@@ -405,7 +408,9 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
   simp [of_nat_code]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
 #align nat.partrec.code.rec_prim' Nat.Partrec.Code.rec_prim'
+-/
 
+#print Nat.Partrec.Code.rec_prim /-
 /-- Recursion on `nat.partrec.code` is primitive recursive. -/
 theorem rec_prim {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Primrec c) {z : α → σ}
     (hz : Primrec z) {s : α → σ} (hs : Primrec s) {l : α → σ} (hl : Primrec l) {r : α → σ}
@@ -505,6 +510,7 @@ theorem rec_prim {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc
   simp [of_nat_code]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
 #align nat.partrec.code.rec_prim Nat.Partrec.Code.rec_prim
+-/
 
 end
 
@@ -512,6 +518,7 @@ section
 
 open Computable
 
+#print Nat.Partrec.Code.rec_computable /-
 /-- Recursion on `nat.partrec.code` is computable. -/
 theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Computable c)
     {z : α → σ} (hz : Computable z) {s : α → σ} (hs : Computable s) {l : α → σ} (hl : Computable l)
@@ -611,6 +618,7 @@ theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Cod
   simp [of_nat_code]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
 #align nat.partrec.code.rec_computable Nat.Partrec.Code.rec_computable
+-/
 
 end
 
@@ -655,6 +663,7 @@ theorem eval_prec_zero (cf cg : Code) (a : ℕ) : eval (prec cf cg) (pair a 0) =
 #align nat.partrec.code.eval_prec_zero Nat.Partrec.Code.eval_prec_zero
 -/
 
+#print Nat.Partrec.Code.eval_prec_succ /-
 /-- Helper lemma for the evaluation of `prec` in the recursive case. -/
 theorem eval_prec_succ (cf cg : Code) (a k : ℕ) :
     eval (prec cf cg) (pair a (Nat.succ k)) = do
@@ -664,6 +673,7 @@ theorem eval_prec_succ (cf cg : Code) (a k : ℕ) :
   rw [eval, Nat.unpaired, Part.bind_eq_bind, Nat.unpair_pair, Nat.rec_add_one]
   simp
 #align nat.partrec.code.eval_prec_succ Nat.Partrec.Code.eval_prec_succ
+-/
 
 instance : Membership (ℕ →. ℕ) Code :=
   ⟨fun f c => eval c = f⟩
Diff
@@ -72,7 +72,7 @@ theorem rfind' {f} (hf : Nat.Partrec f) :
               (primrec₂.mkpair.comp (primrec.fst.comp <| primrec.unpair.comp Primrec.fst)
                   (primrec.nat_add.comp Primrec.snd
                     (primrec.snd.comp <| primrec.unpair.comp Primrec.fst))).to_comp).to₂)
-    simp at this; exact this
+    simp at this ; exact this
 #align nat.partrec.rfind' Nat.Partrec.rfind'
 
 #print Nat.Partrec.Code /-
@@ -114,7 +114,7 @@ protected def const : ℕ → Code
 theorem const_inj : ∀ {n₁ n₂}, Nat.Partrec.Code.const n₁ = Nat.Partrec.Code.const n₂ → n₁ = n₂
   | 0, 0, h => by simp
   | n₁ + 1, n₂ + 1, h => by
-    dsimp [Nat.Partrec.Code.const] at h
+    dsimp [Nat.Partrec.Code.const] at h 
     injection h with h₁ h₂
     simp only [const_inj h₂]
 #align nat.partrec.code.const_inj Nat.Partrec.Code.const_inj
@@ -223,7 +223,7 @@ theorem encode_lt_pair (cf cg) :
   by
   simp [encode_code_eq, encode_code, -add_comm]
   have := Nat.mul_le_mul_right _ (by decide : 1 ≤ 2 * 2)
-  rw [one_mul, mul_assoc, ← bit0_eq_two_mul, ← bit0_eq_two_mul] at this
+  rw [one_mul, mul_assoc, ← bit0_eq_two_mul, ← bit0_eq_two_mul] at this 
   have := lt_of_le_of_lt this (lt_add_of_pos_right _ (by decide : 0 < 4))
   exact ⟨lt_of_le_of_lt (Nat.left_le_pair _ _) this, lt_of_le_of_lt (Nat.right_le_pair _ _) this⟩
 #align nat.partrec.code.encode_lt_pair Nat.Partrec.Code.encode_lt_pair
@@ -252,7 +252,7 @@ theorem encode_lt_rfind' (cf) : encode cf < encode (rfind' cf) :=
   by
   simp [encode_code_eq, encode_code, -add_comm]
   have := Nat.mul_le_mul_right _ (by decide : 1 ≤ 2 * 2)
-  rw [one_mul, mul_assoc, ← bit0_eq_two_mul, ← bit0_eq_two_mul] at this
+  rw [one_mul, mul_assoc, ← bit0_eq_two_mul, ← bit0_eq_two_mul] at this 
   refine' lt_of_le_of_lt (le_trans this _) (lt_add_of_pos_right _ (by decide : 0 < 4))
   exact le_of_lt (Nat.bit0_lt_bit1 <| le_of_lt <| Nat.bit0_lt_bit1 <| le_rfl)
 #align nat.partrec.code.encode_lt_rfind' Nat.Partrec.Code.encode_lt_rfind'
@@ -790,18 +790,18 @@ def evaln : ∀ k : ℕ, Code → ℕ → Option ℕ
 
 #print Nat.Partrec.Code.evaln_bound /-
 theorem evaln_bound : ∀ {k c n x}, x ∈ evaln k c n → n < k
-  | 0, c, n, x, h => by simp [evaln] at h <;> cases h
+  | 0, c, n, x, h => by simp [evaln] at h  <;> cases h
   | k + 1, c, n, x, h =>
     by
     suffices ∀ {o : Option ℕ}, x ∈ guard (n ≤ k) >> o → n < k + 1 by
-      cases c <;> rw [evaln] at h <;> exact this h
+      cases c <;> rw [evaln] at h  <;> exact this h
     simpa [(· >> ·)] using Nat.lt_succ_of_le
 #align nat.partrec.code.evaln_bound Nat.Partrec.Code.evaln_bound
 -/
 
 #print Nat.Partrec.Code.evaln_mono /-
 theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c n → x ∈ evaln k₂ c n
-  | 0, k₂, c, n, x, hl, h => by simp [evaln] at h <;> cases h
+  | 0, k₂, c, n, x, hl, h => by simp [evaln] at h  <;> cases h
   | k + 1, k₂ + 1, c, n, x, hl, h =>
     by
     have hl' := Nat.le_of_succ_le_succ hl
@@ -809,16 +809,16 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
       ∀ {k k₂ n x : ℕ} {o₁ o₂ : Option ℕ},
         k ≤ k₂ → (x ∈ o₁ → x ∈ o₂) → x ∈ guard (n ≤ k) >> o₁ → x ∈ guard (n ≤ k₂) >> o₂ :=
       by simp [(· >> ·)]; introv h h₁ h₂ h₃; exact ⟨le_trans h₂ h, h₁ h₃⟩
-    simp at h⊢
+    simp at h ⊢
     induction' c with cf cg hf hg cf cg hf hg cf cg hf hg cf hf generalizing x n <;>
-        rw [evaln] at h⊢ <;>
+        rw [evaln] at h ⊢ <;>
       refine' this hl' (fun h => _) h
     iterate 4 exact h
     · -- pair cf cg
-      simp [(· <*> ·)] at h⊢
+      simp [(· <*> ·)] at h ⊢
       exact h.imp fun a => And.imp (hf _ _) <| Exists.imp fun b => And.imp_left (hg _ _)
     · -- comp cf cg
-      simp at h⊢
+      simp at h ⊢
       exact h.imp fun a => And.imp (hg _ _) (hf _ _)
     · -- prec cf cg
       revert h; simp
@@ -826,7 +826,7 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
       · apply hf
       · exact fun y h₁ h₂ => ⟨y, evaln_mono hl' h₁, hg _ _ h₂⟩
     · -- rfind' cf
-      simp at h⊢
+      simp at h ⊢
       refine' h.imp fun x => And.imp (hf _ _) _
       by_cases x0 : x = 0 <;> simp [x0]
       exact evaln_mono hl'
@@ -835,11 +835,11 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
 
 #print Nat.Partrec.Code.evaln_sound /-
 theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
-  | 0, _, n, x, h => by simp [evaln] at h <;> cases h
+  | 0, _, n, x, h => by simp [evaln] at h  <;> cases h
   | k + 1, c, n, x, h =>
     by
     induction' c with cf cg hf hg cf cg hf hg cf cg hf hg cf hf generalizing x n <;>
-        simp [eval, evaln, (· >> ·), (· <*> ·)] at h⊢ <;>
+        simp [eval, evaln, (· >> ·), (· <*> ·)] at h ⊢ <;>
       cases' h with _ h
     iterate 4 simpa [pure, PFun.pure, eq_comm] using h
     · -- pair cf cg
@@ -854,17 +854,17 @@ theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
       · apply hf
       · refine' fun y h₁ h₂ => ⟨y, IH _ _, _⟩
         · have := evaln_mono k.le_succ h₁
-          simp [evaln, (· >> ·)] at this
+          simp [evaln, (· >> ·)] at this 
           exact this.2
         · exact hg _ _ h₂
     · -- rfind' cf
       rcases h with ⟨m, h₁, h₂⟩
-      by_cases m0 : m = 0 <;> simp [m0] at h₂
+      by_cases m0 : m = 0 <;> simp [m0] at h₂ 
       ·
         exact
           ⟨0, ⟨by simpa [m0] using hf _ _ h₁, fun m => (Nat.not_lt_zero _).elim⟩, by
             injection h₂ with h₂ <;> simp [h₂]⟩
-      · have := evaln_sound h₂; simp [eval] at this
+      · have := evaln_sound h₂; simp [eval] at this 
         rcases this with ⟨y, ⟨hy₁, hy₂⟩, rfl⟩
         refine'
           ⟨y + 1, ⟨by simpa [add_comm, add_left_comm] using hy₁, fun i im => _⟩, by
@@ -881,7 +881,7 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
   ⟨fun h => by
     rsuffices ⟨k, h⟩ : ∃ k, x ∈ evaln (k + 1) c n
     · exact ⟨k + 1, h⟩
-    induction c generalizing n x <;> simp [eval, evaln, pure, PFun.pure, (· <*> ·), (· >> ·)] at h⊢
+    induction c generalizing n x <;> simp [eval, evaln, pure, PFun.pure, (· <*> ·), (· >> ·)] at h ⊢
     iterate 4 exact ⟨⟨_, le_rfl⟩, h.symm⟩
     case pair cf cg hf hg =>
       rcases h with ⟨x, hx, y, hy, rfl⟩
@@ -903,7 +903,7 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
       revert h
       generalize n.unpair.1 = n₁; generalize n.unpair.2 = n₂
       induction' n₂ with m IH generalizing x n <;> simp
-      · intro ; rcases hf h with ⟨k, hk⟩
+      · intro; rcases hf h with ⟨k, hk⟩
         exact ⟨_, le_max_left _ _, evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk⟩
       · intro y hy hx
         rcases IH hy with ⟨k₁, nk₁, hk₁⟩; rcases hg hx with ⟨k₂, hk₂⟩
@@ -920,7 +920,7 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
         simpa [evaln, (· >> ·)]
       revert hy₁ hy₂; generalize n.unpair.2 = m; intros
       induction' y with y IH generalizing m <;> simp [evaln, (· >> ·)]
-      · simp at hy₁; rcases hf hy₁ with ⟨k, hk⟩
+      · simp at hy₁ ; rcases hf hy₁ with ⟨k, hk⟩
         exact ⟨_, Nat.le_of_lt_succ <| evaln_bound hk, _, hk, by simp <;> rfl⟩
       · rcases hy₂ (Nat.succ_pos _) with ⟨a, ha, a0⟩
         rcases hf ha with ⟨k₁, hk₁⟩
@@ -930,7 +930,7 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
               hy₂ (Nat.succ_lt_succ hi) with
           ⟨k₂, hk₂⟩
         use (max k₁ k₂).succ
-        rw [zero_add] at hk₁
+        rw [zero_add] at hk₁ 
         use Nat.le_succ_of_le <| le_max_of_le_left <| Nat.le_of_lt_succ <| evaln_bound hk₁
         use a
         use evaln_mono (Nat.succ_le_succ <| Nat.le_succ_of_le <| le_max_left _ _) hk₁
@@ -1078,7 +1078,7 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
       intro nk
       cases' k with k'; · simp [evaln]
       let k := k' + 1; change k'.succ with k
-      simp [Nat.lt_succ_iff] at nk
+      simp [Nat.lt_succ_iff] at nk 
       have hg :
         ∀ {k' c' n},
           mkpair k' (encode c') < mkpair k (encode c) →
Diff
@@ -53,12 +53,6 @@ namespace Nat.Partrec
 
 open Nat (pair)
 
-/- warning: nat.partrec.rfind' -> Nat.Partrec.rfind' is a dubious translation:
-lean 3 declaration is
-  forall {f : PFun.{0, 0} Nat Nat}, (Nat.Partrec f) -> (Nat.Partrec (Nat.unpaired.{1} (Part.{0} Nat) (fun (a : Nat) (m : Nat) => Part.map.{0, 0} Nat Nat (fun (_x : Nat) => HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) _x m) (Nat.rfind (fun (n : Nat) => Functor.map.{0, 0} Part.{0} (Applicative.toFunctor.{0, 0} Part.{0} (Monad.toApplicative.{0, 0} Part.{0} Part.monad.{0})) Nat Bool (fun (m : Nat) => Decidable.decide (Eq.{1} Nat m (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) (Nat.decidableEq m (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))))) (f (Nat.pair a (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) n m))))))))
-but is expected to have type
-  forall {f : PFun.{0, 0} Nat Nat}, (Nat.Partrec f) -> (Nat.Partrec (Nat.unpaired.{1} (Part.{0} Nat) (fun (a : Nat) (m : Nat) => Part.map.{0, 0} Nat Nat (fun (_x : Nat) => HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) _x m) (Nat.rfind (fun (n : Nat) => Functor.map.{0, 0} Part.{0} (Applicative.toFunctor.{0, 0} Part.{0} (Monad.toApplicative.{0, 0} Part.{0} Part.instMonadPart.{0})) Nat Bool (fun (m : Nat) => Decidable.decide (Eq.{1} Nat m (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (instDecidableEqNat m (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))) (f (Nat.pair a (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n m))))))))
-Case conversion may be inaccurate. Consider using '#align nat.partrec.rfind' Nat.Partrec.rfind'ₓ'. -/
 theorem rfind' {f} (hf : Nat.Partrec f) :
     Nat.Partrec
       (Nat.unpaired fun a m =>
@@ -317,9 +311,6 @@ theorem rfind_prim : Primrec rfind' :=
 #align nat.partrec.code.rfind_prim Nat.Partrec.Code.rfind_prim
 -/
 
-/- warning: nat.partrec.code.rec_prim' -> Nat.Partrec.Code.rec_prim' is a dubious translation:
-<too large>
-Case conversion may be inaccurate. Consider using '#align nat.partrec.code.rec_prim' Nat.Partrec.Code.rec_prim'ₓ'. -/
 theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Primrec c) {z : α → σ}
     (hz : Primrec z) {s : α → σ} (hs : Primrec s) {l : α → σ} (hl : Primrec l) {r : α → σ}
     (hr : Primrec r) {pr : α → Code × Code × σ × σ → σ} (hpr : Primrec₂ pr)
@@ -415,9 +406,6 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
   cases n.bodd <;> cases n.div2.bodd <;> rfl
 #align nat.partrec.code.rec_prim' Nat.Partrec.Code.rec_prim'
 
-/- warning: nat.partrec.code.rec_prim -> Nat.Partrec.Code.rec_prim is a dubious translation:
-<too large>
-Case conversion may be inaccurate. Consider using '#align nat.partrec.code.rec_prim Nat.Partrec.Code.rec_primₓ'. -/
 /-- Recursion on `nat.partrec.code` is primitive recursive. -/
 theorem rec_prim {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Primrec c) {z : α → σ}
     (hz : Primrec z) {s : α → σ} (hs : Primrec s) {l : α → σ} (hl : Primrec l) {r : α → σ}
@@ -524,9 +512,6 @@ section
 
 open Computable
 
-/- warning: nat.partrec.code.rec_computable -> Nat.Partrec.Code.rec_computable is a dubious translation:
-<too large>
-Case conversion may be inaccurate. Consider using '#align nat.partrec.code.rec_computable Nat.Partrec.Code.rec_computableₓ'. -/
 /-- Recursion on `nat.partrec.code` is computable. -/
 theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Computable c)
     {z : α → σ} (hz : Computable z) {s : α → σ} (hs : Computable s) {l : α → σ} (hl : Computable l)
@@ -670,12 +655,6 @@ theorem eval_prec_zero (cf cg : Code) (a : ℕ) : eval (prec cf cg) (pair a 0) =
 #align nat.partrec.code.eval_prec_zero Nat.Partrec.Code.eval_prec_zero
 -/
 
-/- warning: nat.partrec.code.eval_prec_succ -> Nat.Partrec.Code.eval_prec_succ is a dubious translation:
-lean 3 declaration is
-  forall (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (a : Nat) (k : Nat), Eq.{1} (Part.{0} Nat) (Nat.Partrec.Code.eval (Nat.Partrec.Code.prec cf cg) (Nat.pair a (Nat.succ k))) (Bind.bind.{0, 0} Part.{0} (Monad.toHasBind.{0, 0} Part.{0} Part.monad.{0}) Nat Nat (Nat.Partrec.Code.eval (Nat.Partrec.Code.prec cf cg) (Nat.pair a k)) (fun (ih : Nat) => Nat.Partrec.Code.eval cg (Nat.pair a (Nat.pair k ih))))
-but is expected to have type
-  forall (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (a : Nat) (k : Nat), Eq.{1} (Part.{0} Nat) (Nat.Partrec.Code.eval (Nat.Partrec.Code.prec cf cg) (Nat.pair a (Nat.succ k))) (Bind.bind.{0, 0} Part.{0} (Monad.toBind.{0, 0} Part.{0} Part.instMonadPart.{0}) Nat Nat (Nat.Partrec.Code.eval (Nat.Partrec.Code.prec cf cg) (Nat.pair a k)) (fun (ih : Nat) => Nat.Partrec.Code.eval cg (Nat.pair a (Nat.pair k ih))))
-Case conversion may be inaccurate. Consider using '#align nat.partrec.code.eval_prec_succ Nat.Partrec.Code.eval_prec_succₓ'. -/
 /-- Helper lemma for the evaluation of `prec` in the recursive case. -/
 theorem eval_prec_succ (cf cg : Code) (a k : ℕ) :
     eval (prec cf cg) (pair a (Nat.succ k)) = do
Diff
@@ -397,8 +397,7 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
       fun a => by simp
   simp
   iterate 4 cases' n with n; · simp [of_nat_code_eq, of_nat_code] <;> rfl
-  simp [G]
-  rw [List.length_map, List.length_range]
+  simp [G]; rw [List.length_map, List.length_range]
   let m := n.div2.div2
   show
     G₁ ((a, (List.range (n + 4)).map fun n => F a (of_nat code n)), n, m) =
@@ -410,8 +409,7 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
           (Nat.succ_le_succ (Nat.le_add_right _ _))
   have m1 : m.unpair.1 < n + 4 := lt_of_le_of_lt m.unpair_left_le hm
   have m2 : m.unpair.2 < n + 4 := lt_of_le_of_lt m.unpair_right_le hm
-  simp [G₁]
-  simp [List.get?_map, List.get?_range, hm, m1, m2]
+  simp [G₁]; simp [List.get?_map, List.get?_range, hm, m1, m2]
   change of_nat code (n + 4) with of_nat_code (n + 4)
   simp [of_nat_code]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
@@ -502,8 +500,7 @@ theorem rec_prim {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc
       fun a => by simp
   simp
   iterate 4 cases' n with n; · simp [of_nat_code_eq, of_nat_code] <;> rfl
-  simp [G]
-  rw [List.length_map, List.length_range]
+  simp [G]; rw [List.length_map, List.length_range]
   let m := n.div2.div2
   show
     G₁ ((a, (List.range (n + 4)).map fun n => F a (of_nat code n)), n, m) =
@@ -515,8 +512,7 @@ theorem rec_prim {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc
           (Nat.succ_le_succ (Nat.le_add_right _ _))
   have m1 : m.unpair.1 < n + 4 := lt_of_le_of_lt m.unpair_left_le hm
   have m2 : m.unpair.2 < n + 4 := lt_of_le_of_lt m.unpair_right_le hm
-  simp [G₁]
-  simp [List.get?_map, List.get?_range, hm, m1, m2]
+  simp [G₁]; simp [List.get?_map, List.get?_range, hm, m1, m2]
   change of_nat code (n + 4) with of_nat_code (n + 4)
   simp [of_nat_code]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
@@ -613,8 +609,7 @@ theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Cod
       fun a => by simp
   simp
   iterate 4 cases' n with n; · simp [of_nat_code_eq, of_nat_code] <;> rfl
-  simp [G]
-  rw [List.length_map, List.length_range]
+  simp [G]; rw [List.length_map, List.length_range]
   let m := n.div2.div2
   show
     G₁ ((a, (List.range (n + 4)).map fun n => F a (of_nat code n)), n, m) =
@@ -626,8 +621,7 @@ theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Cod
           (Nat.succ_le_succ (Nat.le_add_right _ _))
   have m1 : m.unpair.1 < n + 4 := lt_of_le_of_lt m.unpair_left_le hm
   have m2 : m.unpair.2 < n + 4 := lt_of_le_of_lt m.unpair_right_le hm
-  simp [G₁]
-  simp [List.get?_map, List.get?_range, hm, m1, m2]
+  simp [G₁]; simp [List.get?_map, List.get?_range, hm, m1, m2]
   change of_nat code (n + 4) with of_nat_code (n + 4)
   simp [of_nat_code]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
@@ -835,10 +829,7 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
     have :
       ∀ {k k₂ n x : ℕ} {o₁ o₂ : Option ℕ},
         k ≤ k₂ → (x ∈ o₁ → x ∈ o₂) → x ∈ guard (n ≤ k) >> o₁ → x ∈ guard (n ≤ k₂) >> o₂ :=
-      by
-      simp [(· >> ·)]
-      introv h h₁ h₂ h₃
-      exact ⟨le_trans h₂ h, h₁ h₃⟩
+      by simp [(· >> ·)]; introv h h₁ h₂ h₃; exact ⟨le_trans h₂ h, h₁ h₃⟩
     simp at h⊢
     induction' c with cf cg hf hg cf cg hf hg cf cg hf hg cf hf generalizing x n <;>
         rw [evaln] at h⊢ <;>
@@ -851,8 +842,7 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
       simp at h⊢
       exact h.imp fun a => And.imp (hg _ _) (hf _ _)
     · -- prec cf cg
-      revert h
-      simp
+      revert h; simp
       induction n.unpair.2 <;> simp
       · apply hf
       · exact fun y h₁ h₂ => ⟨y, evaln_mono hl' h₁, hg _ _ h₂⟩
@@ -895,8 +885,7 @@ theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
         exact
           ⟨0, ⟨by simpa [m0] using hf _ _ h₁, fun m => (Nat.not_lt_zero _).elim⟩, by
             injection h₂ with h₂ <;> simp [h₂]⟩
-      · have := evaln_sound h₂
-        simp [eval] at this
+      · have := evaln_sound h₂; simp [eval] at this
         rcases this with ⟨y, ⟨hy₁, hy₂⟩, rfl⟩
         refine'
           ⟨y + 1, ⟨by simpa [add_comm, add_left_comm] using hy₁, fun i im => _⟩, by
@@ -935,12 +924,10 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
       revert h
       generalize n.unpair.1 = n₁; generalize n.unpair.2 = n₂
       induction' n₂ with m IH generalizing x n <;> simp
-      · intro
-        rcases hf h with ⟨k, hk⟩
+      · intro ; rcases hf h with ⟨k, hk⟩
         exact ⟨_, le_max_left _ _, evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk⟩
       · intro y hy hx
-        rcases IH hy with ⟨k₁, nk₁, hk₁⟩
-        rcases hg hx with ⟨k₂, hk₂⟩
+        rcases IH hy with ⟨k₁, nk₁, hk₁⟩; rcases hg hx with ⟨k₂, hk₂⟩
         refine'
           ⟨(max k₁ k₂).succ,
             Nat.le_succ_of_le <| le_max_of_le_left <| le_trans (le_max_left _ (mkpair n₁ m)) nk₁, y,
@@ -952,12 +939,9 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
       rcases h with ⟨y, ⟨hy₁, hy₂⟩, rfl⟩
       suffices ∃ k, y + n.unpair.2 ∈ evaln (k + 1) (rfind' cf) (mkpair n.unpair.1 n.unpair.2) by
         simpa [evaln, (· >> ·)]
-      revert hy₁ hy₂
-      generalize n.unpair.2 = m
-      intros
+      revert hy₁ hy₂; generalize n.unpair.2 = m; intros
       induction' y with y IH generalizing m <;> simp [evaln, (· >> ·)]
-      · simp at hy₁
-        rcases hf hy₁ with ⟨k, hk⟩
+      · simp at hy₁; rcases hf hy₁ with ⟨k, hk⟩
         exact ⟨_, Nat.le_of_lt_succ <| evaln_bound hk, _, hk, by simp <;> rfl⟩
       · rcases hy₂ (Nat.succ_pos _) with ⟨a, ha, a0⟩
         rcases hf ha with ⟨k₁, hk₁⟩
@@ -1035,8 +1019,7 @@ private theorem hG : Primrec g :=
       (option_some.comp (fst.comp <| primrec.unpair.comp n))
       (option_some.comp (snd.comp <| primrec.unpair.comp n))
   · have L := (fst.comp fst).comp fst
-    have k := k.comp fst
-    have n := n.comp fst
+    have k := k.comp fst; have n := n.comp fst
     have cf := fst.comp snd
     have cg := (fst.comp snd).comp snd
     exact
@@ -1044,40 +1027,33 @@ private theorem hG : Primrec g :=
         (option_map ((hlup.comp <| L.pair <| (k.pair cg).pair n).comp fst)
           (primrec₂.mkpair.comp (snd.comp fst) snd))
   · have L := (fst.comp fst).comp fst
-    have k := k.comp fst
-    have n := n.comp fst
+    have k := k.comp fst; have n := n.comp fst
     have cf := fst.comp snd
     have cg := (fst.comp snd).comp snd
     exact
       option_bind (hlup.comp <| L.pair <| (k.pair cg).pair n)
         (hlup.comp ((L.comp fst).pair <| ((k.pair cf).comp fst).pair snd))
   · have L := (fst.comp fst).comp fst
-    have k := k.comp fst
-    have n := n.comp fst
+    have k := k.comp fst; have n := n.comp fst
     have cf := fst.comp snd
     have cg := (fst.comp snd).comp snd
     have z := fst.comp (primrec.unpair.comp n)
     refine'
       nat_cases (snd.comp (primrec.unpair.comp n)) (hlup.comp <| L.pair <| (k.pair cf).pair z)
         (_ : Primrec _)
-    have L := L.comp fst
-    have z := z.comp fst
-    have y := snd
+    have L := L.comp fst; have z := z.comp fst; have y := snd
     refine'
       option_bind
         (hlup.comp <| L.pair <| (((k'.pair c).comp fst).comp fst).pair (primrec₂.mkpair.comp z y))
         (_ : Primrec _)
-    have z := z.comp fst
-    have y := y.comp fst
-    have i := snd
+    have z := z.comp fst; have y := y.comp fst; have i := snd
     exact
       hlup.comp
         ((L.comp fst).pair <|
           ((k.pair cg).comp <| fst.comp fst).pair <|
             primrec₂.mkpair.comp z <| primrec₂.mkpair.comp y i)
   · have L := (fst.comp fst).comp fst
-    have k := k.comp fst
-    have n := n.comp fst
+    have k := k.comp fst; have n := n.comp fst
     have cf := fst.comp snd
     have z := fst.comp (primrec.unpair.comp n)
     have m := snd.comp (primrec.unpair.comp n)
@@ -1099,8 +1075,7 @@ private theorem evaln_map (k c n) :
   by_cases kn : n < k
   · simp [List.get?_range kn]
   · rw [List.get?_len_le]
-    · cases e : evaln k c n
-      · rfl
+    · cases e : evaln k c n; · rfl
       exact kn.elim (evaln_bound e)
     simpa using kn
 
@@ -1115,18 +1090,15 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
       by
       simp [G]
       rw [(_ : (of_nat (ℕ × code) _).snd = of_nat code p.unpair.2)]
-      swap
-      · simp
+      swap; · simp
       apply List.map_congr fun n => _
       rw [(by simp :
           List.range p = List.range (mkpair p.unpair.1 (encode (of_nat code p.unpair.2))))]
       generalize p.unpair.1 = k
       generalize of_nat code p.unpair.2 = c
       intro nk
-      cases' k with k'
-      · simp [evaln]
-      let k := k' + 1
-      change k'.succ with k
+      cases' k with k'; · simp [evaln]
+      let k := k' + 1; change k'.succ with k
       simp [Nat.lt_succ_iff] at nk
       have hg :
         ∀ {k' c' n},
@@ -1143,27 +1115,22 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
         simp [evaln, nk, (· >> ·), (· >>= ·), (· <$> ·), (· <*> ·), pure]
       · cases' encode_lt_pair cf cg with lf lg
         rw [hg (Nat.pair_lt_pair_right _ lf), hg (Nat.pair_lt_pair_right _ lg)]
-        cases evaln k cf n
-        · rfl
+        cases evaln k cf n; · rfl
         cases evaln k cg n <;> rfl
       · cases' encode_lt_comp cf cg with lf lg
         rw [hg (Nat.pair_lt_pair_right _ lg)]
-        cases evaln k cg n
-        · rfl
+        cases evaln k cg n; · rfl
         simp [hg (Nat.pair_lt_pair_right _ lf)]
       · cases' encode_lt_prec cf cg with lf lg
         rw [hg (Nat.pair_lt_pair_right _ lf)]
-        cases n.unpair.2
-        · rfl
+        cases n.unpair.2; · rfl
         simp
         rw [hg (Nat.pair_lt_pair_left _ k'.lt_succ_self)]
-        cases evaln k' _ _
-        · rfl
+        cases evaln k' _ _; · rfl
         simp [hg (Nat.pair_lt_pair_right _ lg)]
       · have lf := encode_lt_rfind' cf
         rw [hg (Nat.pair_lt_pair_right _ lf)]
-        cases' evaln k cf n with x
-        · rfl
+        cases' evaln k cf n with x; · rfl
         simp
         cases x <;> simp [Nat.succ_ne_zero]
         rw [hg (Nat.pair_lt_pair_left _ k'.lt_succ_self)]
Diff
@@ -205,7 +205,6 @@ private theorem encode_of_nat_code : ∀ n, encodeCode (ofNatCode n) = n
     simp [encode_code, of_nat_code, -add_comm]
     cases n.bodd <;> cases n.div2.bodd <;>
       simp [encode_code, of_nat_code, -add_comm, IH, IH1, IH2, m, Nat.bit]
-#align nat.partrec.code.encode_of_nat_code nat.partrec.code.encode_of_nat_code
 
 instance : Denumerable Code :=
   mk'
@@ -319,10 +318,7 @@ theorem rfind_prim : Primrec rfind' :=
 -/
 
 /- warning: nat.partrec.code.rec_prim' -> Nat.Partrec.Code.rec_prim' is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} σ] {c : α -> Nat.Partrec.Code}, (Primrec.{u1, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Primrec₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 pr) -> (forall {co : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Primrec₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 co) -> (forall {pc : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Primrec₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 pc) -> (forall {rf : α -> (Prod.{0, u2} Nat.Partrec.Code σ) -> σ}, (Primrec₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2) _inst_2 rf) -> (let PR : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pr a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let CO : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => co a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let PC : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pc a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let RF : α -> Nat.Partrec.Code -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (hf : σ) => rf a (Prod.mk.{0, u2} Nat.Partrec.Code σ cf hf); let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u2} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (PR a) (CO a) (PC a) (RF a); Primrec.{u1, u2} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} σ] {c : α -> Nat.Partrec.Code}, (Primrec.{u2, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Primrec₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 pr) -> (forall {co : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Primrec₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 co) -> (forall {pc : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Primrec₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 pc) -> (forall {rf : α -> (Prod.{0, u1} Nat.Partrec.Code σ) -> σ}, (Primrec₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2) _inst_2 rf) -> (let PR : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pr a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let CO : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => co a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let PC : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pc a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let RF : α -> Nat.Partrec.Code -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (hf : σ) => rf a (Prod.mk.{0, u1} Nat.Partrec.Code σ cf hf); let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u1} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (PR a) (CO a) (PC a) (RF a); Primrec.{u2, u1} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
+<too large>
 Case conversion may be inaccurate. Consider using '#align nat.partrec.code.rec_prim' Nat.Partrec.Code.rec_prim'ₓ'. -/
 theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Primrec c) {z : α → σ}
     (hz : Primrec z) {s : α → σ} (hs : Primrec s) {l : α → σ} (hl : Primrec l) {r : α → σ}
@@ -422,10 +418,7 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
 #align nat.partrec.code.rec_prim' Nat.Partrec.Code.rec_prim'
 
 /- warning: nat.partrec.code.rec_prim -> Nat.Partrec.Code.rec_prim is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} σ] {c : α -> Nat.Partrec.Code}, (Primrec.{u1, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u1 u2, u2} (Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) σ (Primcodable.prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) => pr (Prod.fst.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a))) (Prod.fst.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))) (Prod.snd.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))))) -> (forall {co : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u1 u2, u2} (Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) σ (Primcodable.prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) => co (Prod.fst.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a))) (Prod.fst.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))) (Prod.snd.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))))) -> (forall {pc : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u1 u2, u2} (Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) σ (Primcodable.prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) => pc (Prod.fst.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a))) (Prod.fst.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))) (Prod.snd.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))))) -> (forall {rf : α -> Nat.Partrec.Code -> σ -> σ}, (Primrec.{max u1 u2, u2} (Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ)) σ (Primcodable.prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2)) _inst_2 (fun (a : Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ)) => rf (Prod.fst.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) a) (Prod.fst.{0, u2} Nat.Partrec.Code σ (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) a)) (Prod.snd.{0, u2} Nat.Partrec.Code σ (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) a)))) -> (let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u2} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (pr a) (co a) (pc a) (rf a); Primrec.{u1, u2} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} σ] {c : α -> Nat.Partrec.Code}, (Primrec.{u2, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u2 u1, u1} (Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) σ (Primcodable.prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) => pr (Prod.fst.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a))) (Prod.fst.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))) (Prod.snd.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))))) -> (forall {co : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u2 u1, u1} (Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) σ (Primcodable.prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) => co (Prod.fst.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a))) (Prod.fst.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))) (Prod.snd.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))))) -> (forall {pc : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u2 u1, u1} (Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) σ (Primcodable.prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) => pc (Prod.fst.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a))) (Prod.fst.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))) (Prod.snd.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))))) -> (forall {rf : α -> Nat.Partrec.Code -> σ -> σ}, (Primrec.{max u2 u1, u1} (Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ)) σ (Primcodable.prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2)) _inst_2 (fun (a : Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ)) => rf (Prod.fst.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) a) (Prod.fst.{0, u1} Nat.Partrec.Code σ (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) a)) (Prod.snd.{0, u1} Nat.Partrec.Code σ (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) a)))) -> (let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u1} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (pr a) (co a) (pc a) (rf a); Primrec.{u2, u1} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
+<too large>
 Case conversion may be inaccurate. Consider using '#align nat.partrec.code.rec_prim Nat.Partrec.Code.rec_primₓ'. -/
 /-- Recursion on `nat.partrec.code` is primitive recursive. -/
 theorem rec_prim {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Primrec c) {z : α → σ}
@@ -536,10 +529,7 @@ section
 open Computable
 
 /- warning: nat.partrec.code.rec_computable -> Nat.Partrec.Code.rec_computable is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} σ] {c : α -> Nat.Partrec.Code}, (Computable.{u1, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Computable.{u1, u2} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Computable.{u1, u2} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Computable.{u1, u2} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Computable.{u1, u2} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Computable₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 pr) -> (forall {co : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Computable₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 co) -> (forall {pc : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Computable₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 pc) -> (forall {rf : α -> (Prod.{0, u2} Nat.Partrec.Code σ) -> σ}, (Computable₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2) _inst_2 rf) -> (let PR : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pr a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let CO : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => co a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let PC : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pc a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let RF : α -> Nat.Partrec.Code -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (hf : σ) => rf a (Prod.mk.{0, u2} Nat.Partrec.Code σ cf hf); let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u2} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (PR a) (CO a) (PC a) (RF a); Computable.{u1, u2} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} σ] {c : α -> Nat.Partrec.Code}, (Computable.{u2, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Computable.{u2, u1} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Computable.{u2, u1} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Computable.{u2, u1} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Computable.{u2, u1} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Computable₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 pr) -> (forall {co : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Computable₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 co) -> (forall {pc : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Computable₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 pc) -> (forall {rf : α -> (Prod.{0, u1} Nat.Partrec.Code σ) -> σ}, (Computable₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2) _inst_2 rf) -> (let PR : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pr a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let CO : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => co a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let PC : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pc a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let RF : α -> Nat.Partrec.Code -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (hf : σ) => rf a (Prod.mk.{0, u1} Nat.Partrec.Code σ cf hf); let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u1} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (PR a) (CO a) (PC a) (RF a); Computable.{u2, u1} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
+<too large>
 Case conversion may be inaccurate. Consider using '#align nat.partrec.code.rec_computable Nat.Partrec.Code.rec_computableₓ'. -/
 /-- Recursion on `nat.partrec.code` is computable. -/
 theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Computable c)
@@ -995,12 +985,10 @@ private def lup (L : List (List (Option ℕ))) (p : ℕ × Code) (n : ℕ) := do
   let l ← L.get? (encode p)
   let o ← l.get? n
   o
-#align nat.partrec.code.lup nat.partrec.code.lup
 
 private theorem hlup : Primrec fun p : _ × (_ × _) × _ => lup p.1 p.2.1 p.2.2 :=
   option_bind (list_get?.comp fst (Primrec.encode.comp <| fst.comp snd))
     (option_bind (list_get?.comp snd <| snd.comp <| snd.comp fst) snd)
-#align nat.partrec.code.hlup nat.partrec.code.hlup
 
 private def G (L : List (List (Option ℕ))) : Option (List (Option ℕ)) :=
   Option.some <|
@@ -1032,7 +1020,6 @@ private def G (L : List (List (Option ℕ))) : Option (List (Option ℕ)) :=
           do
           let x ← lup L (k, cf) (pair z m)
           x (some m) fun _ => lup L (k', c) (mkpair z (m + 1))
-#align nat.partrec.code.G nat.partrec.code.G
 
 private theorem hG : Primrec g :=
   by
@@ -1105,7 +1092,6 @@ private theorem hG : Primrec g :=
                 ((k'.pair c).comp <| fst.comp fst).pair
                   (primrec₂.mkpair.comp (z.comp fst) (primrec.succ.comp m)))).comp
           fst)
-#align nat.partrec.code.hG nat.partrec.code.hG
 
 private theorem evaln_map (k c n) :
     ((((List.range k).get? n).map (evaln k c)).bind fun b => b) = evaln k c n :=
@@ -1117,7 +1103,6 @@ private theorem evaln_map (k c n) :
       · rfl
       exact kn.elim (evaln_bound e)
     simpa using kn
-#align nat.partrec.code.evaln_map nat.partrec.code.evaln_map
 
 #print Nat.Partrec.Code.evaln_prim /-
 /-- The `nat.partrec.code.evaln` function is primitive recursive. -/
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 
 ! This file was ported from Lean 3 source module computability.partrec_code
-! leanprover-community/mathlib commit 6155d4351090a6fad236e3d2e4e0e4e7342668e8
+! leanprover-community/mathlib commit 781cb2eed038c4caf53bdbd8d20a95e5822d77df
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,6 +13,9 @@ import Mathbin.Computability.Partrec
 /-!
 # Gödel Numbering for Partial Recursive Functions.
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file defines `nat.partrec.code`, an inductive datatype describing code for partial
 recursive functions on ℕ. It defines an encoding for these codes, and proves that the constructors
 are primitive recursive with respect to the encoding.
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 
 ! This file was ported from Lean 3 source module computability.partrec_code
-! leanprover-community/mathlib commit 781cb2eed038c4caf53bdbd8d20a95e5822d77df
+! leanprover-community/mathlib commit 6155d4351090a6fad236e3d2e4e0e4e7342668e8
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,9 +13,6 @@ import Mathbin.Computability.Partrec
 /-!
 # Gödel Numbering for Partial Recursive Functions.
 
-> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
-> Any changes to this file require a corresponding PR to mathlib4.
-
 This file defines `nat.partrec.code`, an inductive datatype describing code for partial
 recursive functions on ℕ. It defines an encoding for these codes, and proves that the constructors
 are primitive recursive with respect to the encoding.
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 
 ! This file was ported from Lean 3 source module computability.partrec_code
-! leanprover-community/mathlib commit 6155d4351090a6fad236e3d2e4e0e4e7342668e8
+! leanprover-community/mathlib commit 781cb2eed038c4caf53bdbd8d20a95e5822d77df
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -13,6 +13,9 @@ import Mathbin.Computability.Partrec
 /-!
 # Gödel Numbering for Partial Recursive Functions.
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 This file defines `nat.partrec.code`, an inductive datatype describing code for partial
 recursive functions on ℕ. It defines an encoding for these codes, and proves that the constructors
 are primitive recursive with respect to the encoding.
Diff
@@ -50,6 +50,12 @@ namespace Nat.Partrec
 
 open Nat (pair)
 
+/- warning: nat.partrec.rfind' -> Nat.Partrec.rfind' is a dubious translation:
+lean 3 declaration is
+  forall {f : PFun.{0, 0} Nat Nat}, (Nat.Partrec f) -> (Nat.Partrec (Nat.unpaired.{1} (Part.{0} Nat) (fun (a : Nat) (m : Nat) => Part.map.{0, 0} Nat Nat (fun (_x : Nat) => HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) _x m) (Nat.rfind (fun (n : Nat) => Functor.map.{0, 0} Part.{0} (Applicative.toFunctor.{0, 0} Part.{0} (Monad.toApplicative.{0, 0} Part.{0} Part.monad.{0})) Nat Bool (fun (m : Nat) => Decidable.decide (Eq.{1} Nat m (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) (Nat.decidableEq m (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero))))) (f (Nat.pair a (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) n m))))))))
+but is expected to have type
+  forall {f : PFun.{0, 0} Nat Nat}, (Nat.Partrec f) -> (Nat.Partrec (Nat.unpaired.{1} (Part.{0} Nat) (fun (a : Nat) (m : Nat) => Part.map.{0, 0} Nat Nat (fun (_x : Nat) => HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) _x m) (Nat.rfind (fun (n : Nat) => Functor.map.{0, 0} Part.{0} (Applicative.toFunctor.{0, 0} Part.{0} (Monad.toApplicative.{0, 0} Part.{0} Part.instMonadPart.{0})) Nat Bool (fun (m : Nat) => Decidable.decide (Eq.{1} Nat m (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (instDecidableEqNat m (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))) (f (Nat.pair a (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n m))))))))
+Case conversion may be inaccurate. Consider using '#align nat.partrec.rfind' Nat.Partrec.rfind'ₓ'. -/
 theorem rfind' {f} (hf : Nat.Partrec f) :
     Nat.Partrec
       (Nat.unpaired fun a m =>
@@ -72,6 +78,7 @@ theorem rfind' {f} (hf : Nat.Partrec f) :
     simp at this; exact this
 #align nat.partrec.rfind' Nat.Partrec.rfind'
 
+#print Nat.Partrec.Code /-
 /-- Code for partial recursive functions from ℕ to ℕ.
 See `nat.partrec.code.eval` for the interpretation of these constructors.
 -/
@@ -85,6 +92,7 @@ inductive Code : Type
   | prec : code → code → code
   | rfind' : code → code
 #align nat.partrec.code Nat.Partrec.Code
+-/
 
 end Nat.Partrec
 
@@ -97,12 +105,15 @@ open Nat.Partrec (code)
 instance : Inhabited Code :=
   ⟨zero⟩
 
+#print Nat.Partrec.Code.const /-
 /-- Returns a code for the constant function outputting a particular natural. -/
 protected def const : ℕ → Code
   | 0 => zero
   | n + 1 => comp succ (const n)
 #align nat.partrec.code.const Nat.Partrec.Code.const
+-/
 
+#print Nat.Partrec.Code.const_inj /-
 theorem const_inj : ∀ {n₁ n₂}, Nat.Partrec.Code.const n₁ = Nat.Partrec.Code.const n₂ → n₁ = n₂
   | 0, 0, h => by simp
   | n₁ + 1, n₂ + 1, h => by
@@ -110,18 +121,24 @@ theorem const_inj : ∀ {n₁ n₂}, Nat.Partrec.Code.const n₁ = Nat.Partrec.C
     injection h with h₁ h₂
     simp only [const_inj h₂]
 #align nat.partrec.code.const_inj Nat.Partrec.Code.const_inj
+-/
 
+#print Nat.Partrec.Code.id /-
 /-- A code for the identity function. -/
 protected def id : Code :=
   pair left right
 #align nat.partrec.code.id Nat.Partrec.Code.id
+-/
 
+#print Nat.Partrec.Code.curry /-
 /-- Given a code `c` taking a pair as input, returns a code using `n` as the first argument to `c`.
 -/
 def curry (c : Code) (n : ℕ) : Code :=
   comp c (pair (Code.const n) Code.id)
 #align nat.partrec.code.curry Nat.Partrec.Code.curry
+-/
 
+#print Nat.Partrec.Code.encodeCode /-
 /-- An encoding of a `nat.partrec.code` as a ℕ. -/
 def encodeCode : Code → ℕ
   | zero => 0
@@ -133,7 +150,9 @@ def encodeCode : Code → ℕ
   | prec cf cg => bit1 (bit0 <| pair (encode_code cf) (encode_code cg)) + 4
   | rfind' cf => bit1 (bit1 <| encode_code cf) + 4
 #align nat.partrec.code.encode_code Nat.Partrec.Code.encodeCode
+-/
 
+#print Nat.Partrec.Code.ofNatCode /-
 /--
 A decoder for `nat.partrec.code.encode_code`, taking any ℕ to the `nat.partrec.code` it represents.
 -/
@@ -157,6 +176,7 @@ def ofNatCode : ℕ → Code
     | tt, ff => prec (of_nat_code m.unpair.1) (of_nat_code m.unpair.2)
     | tt, tt => rfind' (of_nat_code m)
 #align nat.partrec.code.of_nat_code Nat.Partrec.Code.ofNatCode
+-/
 
 /-- Proof that `nat.partrec.code.of_nat_code` is the inverse of `nat.partrec.code.encode_code`-/
 private theorem encode_of_nat_code : ∀ n, encodeCode (ofNatCode n) = n
@@ -189,14 +209,19 @@ instance : Denumerable Code :=
     ⟨encodeCode, ofNatCode, fun c => by
       induction c <;> try rfl <;> simp [encode_code, of_nat_code, -add_comm, *], encode_ofNatCode⟩
 
+#print Nat.Partrec.Code.encodeCode_eq /-
 theorem encodeCode_eq : encode = encodeCode :=
   rfl
 #align nat.partrec.code.encode_code_eq Nat.Partrec.Code.encodeCode_eq
+-/
 
+#print Nat.Partrec.Code.ofNatCode_eq /-
 theorem ofNatCode_eq : ofNat Code = ofNatCode :=
   rfl
 #align nat.partrec.code.of_nat_code_eq Nat.Partrec.Code.ofNatCode_eq
+-/
 
+#print Nat.Partrec.Code.encode_lt_pair /-
 theorem encode_lt_pair (cf cg) :
     encode cf < encode (pair cf cg) ∧ encode cg < encode (pair cf cg) :=
   by
@@ -206,21 +231,27 @@ theorem encode_lt_pair (cf cg) :
   have := lt_of_le_of_lt this (lt_add_of_pos_right _ (by decide : 0 < 4))
   exact ⟨lt_of_le_of_lt (Nat.left_le_pair _ _) this, lt_of_le_of_lt (Nat.right_le_pair _ _) this⟩
 #align nat.partrec.code.encode_lt_pair Nat.Partrec.Code.encode_lt_pair
+-/
 
+#print Nat.Partrec.Code.encode_lt_comp /-
 theorem encode_lt_comp (cf cg) :
     encode cf < encode (comp cf cg) ∧ encode cg < encode (comp cf cg) :=
   by
   suffices; exact (encode_lt_pair cf cg).imp (fun h => lt_trans h this) fun h => lt_trans h this
   change _; simp [encode_code_eq, encode_code]
 #align nat.partrec.code.encode_lt_comp Nat.Partrec.Code.encode_lt_comp
+-/
 
+#print Nat.Partrec.Code.encode_lt_prec /-
 theorem encode_lt_prec (cf cg) :
     encode cf < encode (prec cf cg) ∧ encode cg < encode (prec cf cg) :=
   by
   suffices; exact (encode_lt_pair cf cg).imp (fun h => lt_trans h this) fun h => lt_trans h this
   change _; simp [encode_code_eq, encode_code]
 #align nat.partrec.code.encode_lt_prec Nat.Partrec.Code.encode_lt_prec
+-/
 
+#print Nat.Partrec.Code.encode_lt_rfind' /-
 theorem encode_lt_rfind' (cf) : encode cf < encode (rfind' cf) :=
   by
   simp [encode_code_eq, encode_code, -add_comm]
@@ -229,11 +260,13 @@ theorem encode_lt_rfind' (cf) : encode cf < encode (rfind' cf) :=
   refine' lt_of_le_of_lt (le_trans this _) (lt_add_of_pos_right _ (by decide : 0 < 4))
   exact le_of_lt (Nat.bit0_lt_bit1 <| le_of_lt <| Nat.bit0_lt_bit1 <| le_rfl)
 #align nat.partrec.code.encode_lt_rfind' Nat.Partrec.Code.encode_lt_rfind'
+-/
 
 section
 
 open Primrec
 
+#print Nat.Partrec.Code.pair_prim /-
 theorem pair_prim : Primrec₂ pair :=
   Primrec₂.ofNat_iff.2 <|
     Primrec₂.encode_iff.1 <|
@@ -244,7 +277,9 @@ theorem pair_prim : Primrec₂ pair :=
               (encode_iff.2 <| (Primrec.ofNat Code).comp snd))
         (Primrec₂.const 4)
 #align nat.partrec.code.pair_prim Nat.Partrec.Code.pair_prim
+-/
 
+#print Nat.Partrec.Code.comp_prim /-
 theorem comp_prim : Primrec₂ comp :=
   Primrec₂.ofNat_iff.2 <|
     Primrec₂.encode_iff.1 <|
@@ -255,7 +290,9 @@ theorem comp_prim : Primrec₂ comp :=
               (encode_iff.2 <| (Primrec.ofNat Code).comp snd))
         (Primrec₂.const 4)
 #align nat.partrec.code.comp_prim Nat.Partrec.Code.comp_prim
+-/
 
+#print Nat.Partrec.Code.prec_prim /-
 theorem prec_prim : Primrec₂ prec :=
   Primrec₂.ofNat_iff.2 <|
     Primrec₂.encode_iff.1 <|
@@ -266,7 +303,9 @@ theorem prec_prim : Primrec₂ prec :=
               (encode_iff.2 <| (Primrec.ofNat Code).comp snd))
         (Primrec₂.const 4)
 #align nat.partrec.code.prec_prim Nat.Partrec.Code.prec_prim
+-/
 
+#print Nat.Partrec.Code.rfind_prim /-
 theorem rfind_prim : Primrec rfind' :=
   ofNat_iff.2 <|
     encode_iff.1 <|
@@ -274,7 +313,14 @@ theorem rfind_prim : Primrec rfind' :=
         (nat_double_succ.comp <| nat_double_succ.comp <| encode_iff.2 <| Primrec.ofNat Code)
         (const 4)
 #align nat.partrec.code.rfind_prim Nat.Partrec.Code.rfind_prim
+-/
 
+/- warning: nat.partrec.code.rec_prim' -> Nat.Partrec.Code.rec_prim' is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} σ] {c : α -> Nat.Partrec.Code}, (Primrec.{u1, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Primrec₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 pr) -> (forall {co : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Primrec₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 co) -> (forall {pc : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Primrec₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 pc) -> (forall {rf : α -> (Prod.{0, u2} Nat.Partrec.Code σ) -> σ}, (Primrec₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2) _inst_2 rf) -> (let PR : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pr a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let CO : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => co a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let PC : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pc a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let RF : α -> Nat.Partrec.Code -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (hf : σ) => rf a (Prod.mk.{0, u2} Nat.Partrec.Code σ cf hf); let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u2} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (PR a) (CO a) (PC a) (RF a); Primrec.{u1, u2} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} σ] {c : α -> Nat.Partrec.Code}, (Primrec.{u2, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Primrec₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 pr) -> (forall {co : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Primrec₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 co) -> (forall {pc : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Primrec₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 pc) -> (forall {rf : α -> (Prod.{0, u1} Nat.Partrec.Code σ) -> σ}, (Primrec₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2) _inst_2 rf) -> (let PR : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pr a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let CO : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => co a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let PC : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pc a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let RF : α -> Nat.Partrec.Code -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (hf : σ) => rf a (Prod.mk.{0, u1} Nat.Partrec.Code σ cf hf); let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u1} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (PR a) (CO a) (PC a) (RF a); Primrec.{u2, u1} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
+Case conversion may be inaccurate. Consider using '#align nat.partrec.code.rec_prim' Nat.Partrec.Code.rec_prim'ₓ'. -/
 theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Primrec c) {z : α → σ}
     (hz : Primrec z) {s : α → σ} (hs : Primrec s) {l : α → σ} (hl : Primrec l) {r : α → σ}
     (hr : Primrec r) {pr : α → Code × Code × σ × σ → σ} (hpr : Primrec₂ pr)
@@ -372,6 +418,12 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
   cases n.bodd <;> cases n.div2.bodd <;> rfl
 #align nat.partrec.code.rec_prim' Nat.Partrec.Code.rec_prim'
 
+/- warning: nat.partrec.code.rec_prim -> Nat.Partrec.Code.rec_prim is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} σ] {c : α -> Nat.Partrec.Code}, (Primrec.{u1, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u1 u2, u2} (Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) σ (Primcodable.prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) => pr (Prod.fst.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a))) (Prod.fst.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))) (Prod.snd.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))))) -> (forall {co : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u1 u2, u2} (Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) σ (Primcodable.prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) => co (Prod.fst.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a))) (Prod.fst.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))) (Prod.snd.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))))) -> (forall {pc : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u1 u2, u2} (Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) σ (Primcodable.prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)))) => pc (Prod.fst.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)) (Prod.fst.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a))) (Prod.fst.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))) (Prod.snd.{u2, u2} σ σ (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Prod.snd.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) a)))))) -> (forall {rf : α -> Nat.Partrec.Code -> σ -> σ}, (Primrec.{max u1 u2, u2} (Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ)) σ (Primcodable.prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2)) _inst_2 (fun (a : Prod.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ)) => rf (Prod.fst.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) a) (Prod.fst.{0, u2} Nat.Partrec.Code σ (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) a)) (Prod.snd.{0, u2} Nat.Partrec.Code σ (Prod.snd.{u1, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) a)))) -> (let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u2} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (pr a) (co a) (pc a) (rf a); Primrec.{u1, u2} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} σ] {c : α -> Nat.Partrec.Code}, (Primrec.{u2, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u2 u1, u1} (Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) σ (Primcodable.prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) => pr (Prod.fst.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a))) (Prod.fst.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))) (Prod.snd.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))))) -> (forall {co : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u2 u1, u1} (Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) σ (Primcodable.prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) => co (Prod.fst.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a))) (Prod.fst.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))) (Prod.snd.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))))) -> (forall {pc : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ}, (Primrec.{max u2 u1, u1} (Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) σ (Primcodable.prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2)))) _inst_2 (fun (a : Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)))) => pc (Prod.fst.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)) (Prod.fst.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a))) (Prod.fst.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))) (Prod.snd.{u1, u1} σ σ (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Prod.snd.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) a)))))) -> (forall {rf : α -> Nat.Partrec.Code -> σ -> σ}, (Primrec.{max u2 u1, u1} (Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ)) σ (Primcodable.prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2)) _inst_2 (fun (a : Prod.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ)) => rf (Prod.fst.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) a) (Prod.fst.{0, u1} Nat.Partrec.Code σ (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) a)) (Prod.snd.{0, u1} Nat.Partrec.Code σ (Prod.snd.{u2, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) a)))) -> (let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u1} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (pr a) (co a) (pc a) (rf a); Primrec.{u2, u1} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
+Case conversion may be inaccurate. Consider using '#align nat.partrec.code.rec_prim Nat.Partrec.Code.rec_primₓ'. -/
 /-- Recursion on `nat.partrec.code` is primitive recursive. -/
 theorem rec_prim {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Primrec c) {z : α → σ}
     (hz : Primrec z) {s : α → σ} (hs : Primrec s) {l : α → σ} (hl : Primrec l) {r : α → σ}
@@ -480,6 +532,12 @@ section
 
 open Computable
 
+/- warning: nat.partrec.code.rec_computable -> Nat.Partrec.Code.rec_computable is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} σ] {c : α -> Nat.Partrec.Code}, (Computable.{u1, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Computable.{u1, u2} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Computable.{u1, u2} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Computable.{u1, u2} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Computable.{u1, u2} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Computable₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 pr) -> (forall {co : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Computable₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 co) -> (forall {pc : α -> (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) -> σ}, (Computable₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ))) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u2, u2} σ σ _inst_2 _inst_2))) _inst_2 pc) -> (forall {rf : α -> (Prod.{0, u2} Nat.Partrec.Code σ) -> σ}, (Computable₂.{u1, u2, u2} α (Prod.{0, u2} Nat.Partrec.Code σ) σ _inst_1 (Primcodable.prod.{0, u2} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2) _inst_2 rf) -> (let PR : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pr a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let CO : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => co a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let PC : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pc a (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ)) cf (Prod.mk.{0, u2} Nat.Partrec.Code (Prod.{u2, u2} σ σ) cg (Prod.mk.{u2, u2} σ σ hf hg))); let RF : α -> Nat.Partrec.Code -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (hf : σ) => rf a (Prod.mk.{0, u2} Nat.Partrec.Code σ cf hf); let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u2} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (PR a) (CO a) (PC a) (RF a); Computable.{u1, u2} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} σ] {c : α -> Nat.Partrec.Code}, (Computable.{u2, 0} α Nat.Partrec.Code _inst_1 (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) c) -> (forall {z : α -> σ}, (Computable.{u2, u1} α σ _inst_1 _inst_2 z) -> (forall {s : α -> σ}, (Computable.{u2, u1} α σ _inst_1 _inst_2 s) -> (forall {l : α -> σ}, (Computable.{u2, u1} α σ _inst_1 _inst_2 l) -> (forall {r : α -> σ}, (Computable.{u2, u1} α σ _inst_1 _inst_2 r) -> (forall {pr : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Computable₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 pr) -> (forall {co : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Computable₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 co) -> (forall {pc : α -> (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) -> σ}, (Computable₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ))) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) (Primcodable.prod.{u1, u1} σ σ _inst_2 _inst_2))) _inst_2 pc) -> (forall {rf : α -> (Prod.{0, u1} Nat.Partrec.Code σ) -> σ}, (Computable₂.{u2, u1, u1} α (Prod.{0, u1} Nat.Partrec.Code σ) σ _inst_1 (Primcodable.prod.{0, u1} Nat.Partrec.Code σ (Primcodable.ofDenumerable.{0} Nat.Partrec.Code Nat.Partrec.Code.instDenumerable) _inst_2) _inst_2 rf) -> (let PR : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pr a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let CO : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => co a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let PC : α -> Nat.Partrec.Code -> Nat.Partrec.Code -> σ -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (hf : σ) (hg : σ) => pc a (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ)) cf (Prod.mk.{0, u1} Nat.Partrec.Code (Prod.{u1, u1} σ σ) cg (Prod.mk.{u1, u1} σ σ hf hg))); let RF : α -> Nat.Partrec.Code -> σ -> σ := fun (a : α) (cf : Nat.Partrec.Code) (hf : σ) => rf a (Prod.mk.{0, u1} Nat.Partrec.Code σ cf hf); let F : α -> Nat.Partrec.Code -> σ := fun (a : α) (c : Nat.Partrec.Code) => Nat.Partrec.Code.recOn.{succ u1} (fun (_x : Nat.Partrec.Code) => σ) c (z a) (s a) (l a) (r a) (PR a) (CO a) (PC a) (RF a); Computable.{u2, u1} α σ _inst_1 _inst_2 (fun (a : α) => F a (c a)))))))))))
+Case conversion may be inaccurate. Consider using '#align nat.partrec.code.rec_computable Nat.Partrec.Code.rec_computableₓ'. -/
 /-- Recursion on `nat.partrec.code` is computable. -/
 theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Computable c)
     {z : α → σ} (hz : Computable z) {s : α → σ} (hs : Computable s) {l : α → σ} (hl : Computable l)
@@ -584,6 +642,7 @@ theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Cod
 
 end
 
+#print Nat.Partrec.Code.eval /-
 /-- The interpretation of a `nat.partrec.code` as a partial function.
 * `nat.partrec.code.zero`: The constant zero function.
 * `nat.partrec.code.succ`: The successor function.
@@ -614,13 +673,22 @@ def eval : Code → ℕ →. ℕ
     Nat.unpaired fun a m =>
       (Nat.rfind fun n => (fun m => m = 0) <$> eval cf (pair a (n + m))).map (· + m)
 #align nat.partrec.code.eval Nat.Partrec.Code.eval
+-/
 
+#print Nat.Partrec.Code.eval_prec_zero /-
 /-- Helper lemma for the evaluation of `prec` in the base case. -/
 @[simp]
 theorem eval_prec_zero (cf cg : Code) (a : ℕ) : eval (prec cf cg) (pair a 0) = eval cf a := by
   rw [eval, Nat.unpaired, Nat.unpair_pair, Nat.rec_zero]
 #align nat.partrec.code.eval_prec_zero Nat.Partrec.Code.eval_prec_zero
+-/
 
+/- warning: nat.partrec.code.eval_prec_succ -> Nat.Partrec.Code.eval_prec_succ is a dubious translation:
+lean 3 declaration is
+  forall (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (a : Nat) (k : Nat), Eq.{1} (Part.{0} Nat) (Nat.Partrec.Code.eval (Nat.Partrec.Code.prec cf cg) (Nat.pair a (Nat.succ k))) (Bind.bind.{0, 0} Part.{0} (Monad.toHasBind.{0, 0} Part.{0} Part.monad.{0}) Nat Nat (Nat.Partrec.Code.eval (Nat.Partrec.Code.prec cf cg) (Nat.pair a k)) (fun (ih : Nat) => Nat.Partrec.Code.eval cg (Nat.pair a (Nat.pair k ih))))
+but is expected to have type
+  forall (cf : Nat.Partrec.Code) (cg : Nat.Partrec.Code) (a : Nat) (k : Nat), Eq.{1} (Part.{0} Nat) (Nat.Partrec.Code.eval (Nat.Partrec.Code.prec cf cg) (Nat.pair a (Nat.succ k))) (Bind.bind.{0, 0} Part.{0} (Monad.toBind.{0, 0} Part.{0} Part.instMonadPart.{0}) Nat Nat (Nat.Partrec.Code.eval (Nat.Partrec.Code.prec cf cg) (Nat.pair a k)) (fun (ih : Nat) => Nat.Partrec.Code.eval cg (Nat.pair a (Nat.pair k ih))))
+Case conversion may be inaccurate. Consider using '#align nat.partrec.code.eval_prec_succ Nat.Partrec.Code.eval_prec_succₓ'. -/
 /-- Helper lemma for the evaluation of `prec` in the recursive case. -/
 theorem eval_prec_succ (cf cg : Code) (a k : ℕ) :
     eval (prec cf cg) (pair a (Nat.succ k)) = do
@@ -634,30 +702,41 @@ theorem eval_prec_succ (cf cg : Code) (a k : ℕ) :
 instance : Membership (ℕ →. ℕ) Code :=
   ⟨fun f c => eval c = f⟩
 
+#print Nat.Partrec.Code.eval_const /-
 @[simp]
 theorem eval_const : ∀ n m, eval (Code.const n) m = Part.some n
   | 0, m => rfl
   | n + 1, m => by simp! [*]
 #align nat.partrec.code.eval_const Nat.Partrec.Code.eval_const
+-/
 
+#print Nat.Partrec.Code.eval_id /-
 @[simp]
 theorem eval_id (n) : eval Code.id n = Part.some n := by simp! [(· <*> ·)]
 #align nat.partrec.code.eval_id Nat.Partrec.Code.eval_id
+-/
 
+#print Nat.Partrec.Code.eval_curry /-
 @[simp]
 theorem eval_curry (c n x) : eval (curry c n) x = eval c (pair n x) := by simp! [(· <*> ·)]
 #align nat.partrec.code.eval_curry Nat.Partrec.Code.eval_curry
+-/
 
+#print Nat.Partrec.Code.const_prim /-
 theorem const_prim : Primrec Code.const :=
   (Primrec.id.nat_iterate (Primrec.const zero)
         (comp_prim.comp (Primrec.const succ) Primrec.snd).to₂).of_eq
     fun n => by simp <;> induction n <;> simp [*, code.const, Function.iterate_succ']
 #align nat.partrec.code.const_prim Nat.Partrec.Code.const_prim
+-/
 
+#print Nat.Partrec.Code.curry_prim /-
 theorem curry_prim : Primrec₂ curry :=
   comp_prim.comp Primrec.fst <| pair_prim.comp (const_prim.comp Primrec.snd) (Primrec.const Code.id)
 #align nat.partrec.code.curry_prim Nat.Partrec.Code.curry_prim
+-/
 
+#print Nat.Partrec.Code.curry_inj /-
 theorem curry_inj {c₁ c₂ n₁ n₂} (h : curry c₁ n₁ = curry c₂ n₂) : c₁ = c₂ ∧ n₁ = n₂ :=
   ⟨by injection h, by
     injection h
@@ -665,7 +744,9 @@ theorem curry_inj {c₁ c₂ n₁ n₂} (h : curry c₁ n₁ = curry c₂ n₂)
     injection h₂ with h₃ h₄
     exact const_inj h₃⟩
 #align nat.partrec.code.curry_inj Nat.Partrec.Code.curry_inj
+-/
 
+#print Nat.Partrec.Code.smn /-
 /--
 The $S_n^m$ theorem: There is a computable function, namely `nat.partrec.code.curry`, that takes a
 program and a ℕ `n`, and returns a new program using `n` as the first argument.
@@ -673,7 +754,9 @@ program and a ℕ `n`, and returns a new program using `n` as the first argument
 theorem smn : ∃ f : Code → ℕ → Code, Computable₂ f ∧ ∀ c n x, eval (f c n) x = eval c (pair n x) :=
   ⟨curry, Primrec₂.to_comp curry_prim, eval_curry⟩
 #align nat.partrec.code.smn Nat.Partrec.Code.smn
+-/
 
+#print Nat.Partrec.Code.exists_code /-
 /-- A function is partial recursive if and only if there is a code implementing it. -/
 theorem exists_code {f : ℕ →. ℕ} : Nat.Partrec f ↔ ∃ c : Code, eval c = f :=
   ⟨fun h => by
@@ -706,7 +789,9 @@ theorem exists_code {f : ℕ →. ℕ} : Nat.Partrec f ↔ ∃ c : Code, eval c
     case prec cf cg pf pg => exact pf.prec pg
     case rfind' cf pf => exact pf.rfind'⟩
 #align nat.partrec.code.exists_code Nat.Partrec.Code.exists_code
+-/
 
+#print Nat.Partrec.Code.evaln /-
 /-- A modified evaluation for the code which returns an `option ℕ` instead of a `part ℕ`. To avoid
 undecidability, `evaln` takes a parameter `k` and fails if it encounters a number ≥ k in the course
 of its execution. Other than this, the semantics are the same as in `nat.partrec.code.eval`.
@@ -735,7 +820,9 @@ def evaln : ∀ k : ℕ, Code → ℕ → Option ℕ
         let x ← evaln (k + 1) cf (pair a m)
         if x = 0 then pure m else evaln k (rfind' cf) (mkpair a (m + 1))
 #align nat.partrec.code.evaln Nat.Partrec.Code.evaln
+-/
 
+#print Nat.Partrec.Code.evaln_bound /-
 theorem evaln_bound : ∀ {k c n x}, x ∈ evaln k c n → n < k
   | 0, c, n, x, h => by simp [evaln] at h <;> cases h
   | k + 1, c, n, x, h =>
@@ -744,7 +831,9 @@ theorem evaln_bound : ∀ {k c n x}, x ∈ evaln k c n → n < k
       cases c <;> rw [evaln] at h <;> exact this h
     simpa [(· >> ·)] using Nat.lt_succ_of_le
 #align nat.partrec.code.evaln_bound Nat.Partrec.Code.evaln_bound
+-/
 
+#print Nat.Partrec.Code.evaln_mono /-
 theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c n → x ∈ evaln k₂ c n
   | 0, k₂, c, n, x, hl, h => by simp [evaln] at h <;> cases h
   | k + 1, k₂ + 1, c, n, x, hl, h =>
@@ -780,7 +869,9 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
       by_cases x0 : x = 0 <;> simp [x0]
       exact evaln_mono hl'
 #align nat.partrec.code.evaln_mono Nat.Partrec.Code.evaln_mono
+-/
 
+#print Nat.Partrec.Code.evaln_sound /-
 theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
   | 0, _, n, x, h => by simp [evaln] at h <;> cases h
   | k + 1, c, n, x, h =>
@@ -822,7 +913,9 @@ theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
         · rcases hy₂ (Nat.lt_of_succ_lt_succ im) with ⟨z, hz, z0⟩
           exact ⟨z, by simpa [Nat.succ_eq_add_one, add_comm, add_left_comm] using hz, z0⟩
 #align nat.partrec.code.evaln_sound Nat.Partrec.Code.evaln_sound
+-/
 
+#print Nat.Partrec.Code.evaln_complete /-
 theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
   ⟨fun h => by
     rsuffices ⟨k, h⟩ : ∃ k, x ∈ evaln (k + 1) c n
@@ -889,6 +982,7 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
           evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk₂,
     fun ⟨k, h⟩ => evaln_sound h⟩
 #align nat.partrec.code.evaln_complete Nat.Partrec.Code.evaln_complete
+-/
 
 section
 
@@ -1022,6 +1116,7 @@ private theorem evaln_map (k c n) :
     simpa using kn
 #align nat.partrec.code.evaln_map nat.partrec.code.evaln_map
 
+#print Nat.Partrec.Code.evaln_prim /-
 /-- The `nat.partrec.code.evaln` function is primitive recursive. -/
 theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a.2 :=
   have :
@@ -1087,6 +1182,7 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
   (option_bind (list_get?.comp (this.comp (const ()) (encode_iff.2 fst)) snd) snd.to₂).of_eq
     fun ⟨⟨k, c⟩, n⟩ => by simp [evaln_map]
 #align nat.partrec.code.evaln_prim Nat.Partrec.Code.evaln_prim
+-/
 
 end
 
@@ -1094,17 +1190,22 @@ section
 
 open Partrec Computable
 
+#print Nat.Partrec.Code.eval_eq_rfindOpt /-
 theorem eval_eq_rfindOpt (c n) : eval c n = Nat.rfindOpt fun k => evaln k c n :=
   Part.ext fun x => by
     refine' evaln_complete.trans (Nat.rfindOpt_mono _).symm
     intro a m n hl; apply evaln_mono hl
 #align nat.partrec.code.eval_eq_rfind_opt Nat.Partrec.Code.eval_eq_rfindOpt
+-/
 
+#print Nat.Partrec.Code.eval_part /-
 theorem eval_part : Partrec₂ eval :=
   (rfindOpt (evaln_prim.to_comp.comp ((snd.pair (fst.comp fst)).pair (snd.comp fst))).to₂).of_eq
     fun a => by simp [eval_eq_rfind_opt]
 #align nat.partrec.code.eval_part Nat.Partrec.Code.eval_part
+-/
 
+#print Nat.Partrec.Code.fixed_point /-
 /-- Roger's fixed-point theorem: Any total, computable `f` has a fixed point: That is, under the
 interpretation given by `nat.partrec.code.eval`, there is a code `c` such that `c` and `f c` have
 the same evaluation.
@@ -1125,12 +1226,15 @@ theorem fixed_point {f : Code → Code} (hf : Computable f) : ∃ c : Code, eval
       show eval (f (curry cg (encode cF))) n = eval (curry cg (encode cF)) n by
         simp [eg', eF', Part.map_id', g]⟩
 #align nat.partrec.code.fixed_point Nat.Partrec.Code.fixed_point
+-/
 
+#print Nat.Partrec.Code.fixed_point₂ /-
 theorem fixed_point₂ {f : Code → ℕ →. ℕ} (hf : Partrec₂ f) : ∃ c : Code, eval c = f c :=
   let ⟨cf, ef⟩ := exists_code.1 hf
   (fixed_point (curry_prim.comp (Primrec.const cf) Primrec.encode).to_comp).imp fun c e =>
     funext fun n => by simp [e.symm, ef, Part.map_id']
 #align nat.partrec.code.fixed_point₂ Nat.Partrec.Code.fixed_point₂
+-/
 
 end
 
Diff
@@ -48,12 +48,12 @@ open Encodable Denumerable
 
 namespace Nat.Partrec
 
-open Nat (mkpair)
+open Nat (pair)
 
 theorem rfind' {f} (hf : Nat.Partrec f) :
     Nat.Partrec
       (Nat.unpaired fun a m =>
-        (Nat.rfind fun n => (fun m => m = 0) <$> f (mkpair a (n + m))).map (· + m)) :=
+        (Nat.rfind fun n => (fun m => m = 0) <$> f (pair a (n + m))).map (· + m)) :=
   Partrec₂.unpaired'.2 <|
     by
     refine'
@@ -90,7 +90,7 @@ end Nat.Partrec
 
 namespace Nat.Partrec.Code
 
-open Nat (mkpair unpair)
+open Nat (pair unpair)
 
 open Nat.Partrec (code)
 
@@ -128,9 +128,9 @@ def encodeCode : Code → ℕ
   | succ => 1
   | left => 2
   | right => 3
-  | pair cf cg => bit0 (bit0 <| mkpair (encode_code cf) (encode_code cg)) + 4
-  | comp cf cg => bit0 (bit1 <| mkpair (encode_code cf) (encode_code cg)) + 4
-  | prec cf cg => bit1 (bit0 <| mkpair (encode_code cf) (encode_code cg)) + 4
+  | pair cf cg => bit0 (bit0 <| pair (encode_code cf) (encode_code cg)) + 4
+  | comp cf cg => bit0 (bit1 <| pair (encode_code cf) (encode_code cg)) + 4
+  | prec cf cg => bit1 (bit0 <| pair (encode_code cf) (encode_code cg)) + 4
   | rfind' cf => bit1 (bit1 <| encode_code cf) + 4
 #align nat.partrec.code.encode_code Nat.Partrec.Code.encodeCode
 
@@ -204,8 +204,7 @@ theorem encode_lt_pair (cf cg) :
   have := Nat.mul_le_mul_right _ (by decide : 1 ≤ 2 * 2)
   rw [one_mul, mul_assoc, ← bit0_eq_two_mul, ← bit0_eq_two_mul] at this
   have := lt_of_le_of_lt this (lt_add_of_pos_right _ (by decide : 0 < 4))
-  exact
-    ⟨lt_of_le_of_lt (Nat.left_le_mkpair _ _) this, lt_of_le_of_lt (Nat.right_le_mkpair _ _) this⟩
+  exact ⟨lt_of_le_of_lt (Nat.left_le_pair _ _) this, lt_of_le_of_lt (Nat.right_le_pair _ _) this⟩
 #align nat.partrec.code.encode_lt_pair Nat.Partrec.Code.encode_lt_pair
 
 theorem encode_lt_comp (cf cg) :
@@ -241,7 +240,7 @@ theorem pair_prim : Primrec₂ pair :=
       nat_add.comp
         (nat_double.comp <|
           nat_double.comp <|
-            Primrec₂.mkpair.comp (encode_iff.2 <| (Primrec.ofNat Code).comp fst)
+            Primrec₂.natPair.comp (encode_iff.2 <| (Primrec.ofNat Code).comp fst)
               (encode_iff.2 <| (Primrec.ofNat Code).comp snd))
         (Primrec₂.const 4)
 #align nat.partrec.code.pair_prim Nat.Partrec.Code.pair_prim
@@ -252,7 +251,7 @@ theorem comp_prim : Primrec₂ comp :=
       nat_add.comp
         (nat_double.comp <|
           nat_double_succ.comp <|
-            Primrec₂.mkpair.comp (encode_iff.2 <| (Primrec.ofNat Code).comp fst)
+            Primrec₂.natPair.comp (encode_iff.2 <| (Primrec.ofNat Code).comp fst)
               (encode_iff.2 <| (Primrec.ofNat Code).comp snd))
         (Primrec₂.const 4)
 #align nat.partrec.code.comp_prim Nat.Partrec.Code.comp_prim
@@ -263,7 +262,7 @@ theorem prec_prim : Primrec₂ prec :=
       nat_add.comp
         (nat_double_succ.comp <|
           nat_double.comp <|
-            Primrec₂.mkpair.comp (encode_iff.2 <| (Primrec.ofNat Code).comp fst)
+            Primrec₂.natPair.comp (encode_iff.2 <| (Primrec.ofNat Code).comp fst)
               (encode_iff.2 <| (Primrec.ofNat Code).comp snd))
         (Primrec₂.const 4)
 #align nat.partrec.code.prec_prim Nat.Partrec.Code.prec_prim
@@ -604,7 +603,7 @@ def eval : Code → ℕ →. ℕ
   | succ => Nat.succ
   | left => ↑fun n : ℕ => n.unpair.1
   | right => ↑fun n : ℕ => n.unpair.2
-  | pair cf cg => fun n => mkpair <$> eval cf n <*> eval cg n
+  | pair cf cg => fun n => pair <$> eval cf n <*> eval cg n
   | comp cf cg => fun n => eval cg n >>= eval cf
   | prec cf cg =>
     Nat.unpaired fun a n =>
@@ -613,22 +612,22 @@ def eval : Code → ℕ →. ℕ
         eval cg (mkpair a (mkpair y i))
   | rfind' cf =>
     Nat.unpaired fun a m =>
-      (Nat.rfind fun n => (fun m => m = 0) <$> eval cf (mkpair a (n + m))).map (· + m)
+      (Nat.rfind fun n => (fun m => m = 0) <$> eval cf (pair a (n + m))).map (· + m)
 #align nat.partrec.code.eval Nat.Partrec.Code.eval
 
 /-- Helper lemma for the evaluation of `prec` in the base case. -/
 @[simp]
-theorem eval_prec_zero (cf cg : Code) (a : ℕ) : eval (prec cf cg) (mkpair a 0) = eval cf a := by
-  rw [eval, Nat.unpaired, Nat.unpair_mkpair, Nat.rec_zero]
+theorem eval_prec_zero (cf cg : Code) (a : ℕ) : eval (prec cf cg) (pair a 0) = eval cf a := by
+  rw [eval, Nat.unpaired, Nat.unpair_pair, Nat.rec_zero]
 #align nat.partrec.code.eval_prec_zero Nat.Partrec.Code.eval_prec_zero
 
 /-- Helper lemma for the evaluation of `prec` in the recursive case. -/
 theorem eval_prec_succ (cf cg : Code) (a k : ℕ) :
-    eval (prec cf cg) (mkpair a (Nat.succ k)) = do
-      let ih ← eval (prec cf cg) (mkpair a k)
+    eval (prec cf cg) (pair a (Nat.succ k)) = do
+      let ih ← eval (prec cf cg) (pair a k)
       eval cg (mkpair a (mkpair k ih)) :=
   by
-  rw [eval, Nat.unpaired, Part.bind_eq_bind, Nat.unpair_mkpair, Nat.rec_add_one]
+  rw [eval, Nat.unpaired, Part.bind_eq_bind, Nat.unpair_pair, Nat.rec_add_one]
   simp
 #align nat.partrec.code.eval_prec_succ Nat.Partrec.Code.eval_prec_succ
 
@@ -646,7 +645,7 @@ theorem eval_id (n) : eval Code.id n = Part.some n := by simp! [(· <*> ·)]
 #align nat.partrec.code.eval_id Nat.Partrec.Code.eval_id
 
 @[simp]
-theorem eval_curry (c n x) : eval (curry c n) x = eval c (mkpair n x) := by simp! [(· <*> ·)]
+theorem eval_curry (c n x) : eval (curry c n) x = eval c (pair n x) := by simp! [(· <*> ·)]
 #align nat.partrec.code.eval_curry Nat.Partrec.Code.eval_curry
 
 theorem const_prim : Primrec Code.const :=
@@ -671,8 +670,7 @@ theorem curry_inj {c₁ c₂ n₁ n₂} (h : curry c₁ n₁ = curry c₂ n₂)
 The $S_n^m$ theorem: There is a computable function, namely `nat.partrec.code.curry`, that takes a
 program and a ℕ `n`, and returns a new program using `n` as the first argument.
 -/
-theorem smn :
-    ∃ f : Code → ℕ → Code, Computable₂ f ∧ ∀ c n x, eval (f c n) x = eval c (mkpair n x) :=
+theorem smn : ∃ f : Code → ℕ → Code, Computable₂ f ∧ ∀ c n x, eval (f c n) x = eval c (pair n x) :=
   ⟨curry, Primrec₂.to_comp curry_prim, eval_curry⟩
 #align nat.partrec.code.smn Nat.Partrec.Code.smn
 
@@ -720,7 +718,7 @@ def evaln : ∀ k : ℕ, Code → ℕ → Option ℕ
   | k + 1, left => fun n => guard (n ≤ k) >> pure n.unpair.1
   | k + 1, right => fun n => guard (n ≤ k) >> pure n.unpair.2
   | k + 1, pair cf cg => fun n =>
-    guard (n ≤ k) >> mkpair <$> evaln (k + 1) cf n <*> evaln (k + 1) cg n
+    guard (n ≤ k) >> pair <$> evaln (k + 1) cf n <*> evaln (k + 1) cg n
   | k + 1, comp cf cg => fun n =>
     guard (n ≤ k) >> do
       let x ← evaln (k + 1) cg n
@@ -729,12 +727,12 @@ def evaln : ∀ k : ℕ, Code → ℕ → Option ℕ
     guard (n ≤ k) >>
       n.unpaired fun a n =>
         n.cases (evaln (k + 1) cf a) fun y => do
-          let i ← evaln k (prec cf cg) (mkpair a y)
+          let i ← evaln k (prec cf cg) (pair a y)
           evaln (k + 1) cg (mkpair a (mkpair y i))
   | k + 1, rfind' cf => fun n =>
     guard (n ≤ k) >>
       n.unpaired fun a m => do
-        let x ← evaln (k + 1) cf (mkpair a m)
+        let x ← evaln (k + 1) cf (pair a m)
         if x = 0 then pure m else evaln k (rfind' cf) (mkpair a (m + 1))
 #align nat.partrec.code.evaln Nat.Partrec.Code.evaln
 
@@ -929,13 +927,13 @@ private def G (L : List (List (Option ℕ))) : Option (List (Option ℕ)) :=
           (fun cf cg _ _ =>
             let z := n.unpair.1
             n.unpair.2.cases (lup L (k, cf) z) fun y => do
-              let i ← lup L (k', c) (mkpair z y)
+              let i ← lup L (k', c) (pair z y)
               lup L (k, cg) (mkpair z (mkpair y i)))
           fun cf _ =>
           let z := n.unpair.1
           let m := n.unpair.2
           do
-          let x ← lup L (k, cf) (mkpair z m)
+          let x ← lup L (k, cf) (pair z m)
           x (some m) fun _ => lup L (k', c) (mkpair z (m + 1))
 #align nat.partrec.code.G nat.partrec.code.G
 
@@ -1061,31 +1059,31 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
       cases' c with cf cg cf cg cf cg cf <;>
         simp [evaln, nk, (· >> ·), (· >>= ·), (· <$> ·), (· <*> ·), pure]
       · cases' encode_lt_pair cf cg with lf lg
-        rw [hg (Nat.mkpair_lt_mkpair_right _ lf), hg (Nat.mkpair_lt_mkpair_right _ lg)]
+        rw [hg (Nat.pair_lt_pair_right _ lf), hg (Nat.pair_lt_pair_right _ lg)]
         cases evaln k cf n
         · rfl
         cases evaln k cg n <;> rfl
       · cases' encode_lt_comp cf cg with lf lg
-        rw [hg (Nat.mkpair_lt_mkpair_right _ lg)]
+        rw [hg (Nat.pair_lt_pair_right _ lg)]
         cases evaln k cg n
         · rfl
-        simp [hg (Nat.mkpair_lt_mkpair_right _ lf)]
+        simp [hg (Nat.pair_lt_pair_right _ lf)]
       · cases' encode_lt_prec cf cg with lf lg
-        rw [hg (Nat.mkpair_lt_mkpair_right _ lf)]
+        rw [hg (Nat.pair_lt_pair_right _ lf)]
         cases n.unpair.2
         · rfl
         simp
-        rw [hg (Nat.mkpair_lt_mkpair_left _ k'.lt_succ_self)]
+        rw [hg (Nat.pair_lt_pair_left _ k'.lt_succ_self)]
         cases evaln k' _ _
         · rfl
-        simp [hg (Nat.mkpair_lt_mkpair_right _ lg)]
+        simp [hg (Nat.pair_lt_pair_right _ lg)]
       · have lf := encode_lt_rfind' cf
-        rw [hg (Nat.mkpair_lt_mkpair_right _ lf)]
+        rw [hg (Nat.pair_lt_pair_right _ lf)]
         cases' evaln k cf n with x
         · rfl
         simp
         cases x <;> simp [Nat.succ_ne_zero]
-        rw [hg (Nat.mkpair_lt_mkpair_left _ k'.lt_succ_self)]
+        rw [hg (Nat.pair_lt_pair_left _ k'.lt_succ_self)]
   (option_bind (list_get?.comp (this.comp (const ()) (encode_iff.2 fst)) snd) snd.to₂).of_eq
     fun ⟨⟨k, c⟩, n⟩ => by simp [evaln_map]
 #align nat.partrec.code.evaln_prim Nat.Partrec.Code.evaln_prim
@@ -1117,7 +1115,7 @@ theorem fixed_point {f : Code → Code} (hf : Computable f) : ∃ c : Code, eval
     (eval_part.comp ((Computable.ofNat _).comp fst) fst).bind
       (eval_part.comp ((Computable.ofNat _).comp snd) (snd.comp fst)).to₂
   let ⟨cg, eg⟩ := exists_code.1 this
-  have eg' : ∀ a n, eval cg (mkpair a n) = Part.map encode (g a n) := by simp [eg]
+  have eg' : ∀ a n, eval cg (pair a n) = Part.map encode (g a n) := by simp [eg]
   let F (x : ℕ) : Code := f (curry cg x)
   have : Computable F := hf.comp (curry_prim.comp (Primrec.const cg) Primrec.id).to_comp
   let ⟨cF, eF⟩ := exists_code.1 this
Diff
@@ -239,8 +239,8 @@ theorem pair_prim : Primrec₂ pair :=
   Primrec₂.ofNat_iff.2 <|
     Primrec₂.encode_iff.1 <|
       nat_add.comp
-        (nat_bit0.comp <|
-          nat_bit0.comp <|
+        (nat_double.comp <|
+          nat_double.comp <|
             Primrec₂.mkpair.comp (encode_iff.2 <| (Primrec.ofNat Code).comp fst)
               (encode_iff.2 <| (Primrec.ofNat Code).comp snd))
         (Primrec₂.const 4)
@@ -250,8 +250,8 @@ theorem comp_prim : Primrec₂ comp :=
   Primrec₂.ofNat_iff.2 <|
     Primrec₂.encode_iff.1 <|
       nat_add.comp
-        (nat_bit0.comp <|
-          nat_bit1.comp <|
+        (nat_double.comp <|
+          nat_double_succ.comp <|
             Primrec₂.mkpair.comp (encode_iff.2 <| (Primrec.ofNat Code).comp fst)
               (encode_iff.2 <| (Primrec.ofNat Code).comp snd))
         (Primrec₂.const 4)
@@ -261,8 +261,8 @@ theorem prec_prim : Primrec₂ prec :=
   Primrec₂.ofNat_iff.2 <|
     Primrec₂.encode_iff.1 <|
       nat_add.comp
-        (nat_bit1.comp <|
-          nat_bit0.comp <|
+        (nat_double_succ.comp <|
+          nat_double.comp <|
             Primrec₂.mkpair.comp (encode_iff.2 <| (Primrec.ofNat Code).comp fst)
               (encode_iff.2 <| (Primrec.ofNat Code).comp snd))
         (Primrec₂.const 4)
@@ -271,7 +271,9 @@ theorem prec_prim : Primrec₂ prec :=
 theorem rfind_prim : Primrec rfind' :=
   ofNat_iff.2 <|
     encode_iff.1 <|
-      nat_add.comp (nat_bit1.comp <| nat_bit1.comp <| encode_iff.2 <| Primrec.ofNat Code) (const 4)
+      nat_add.comp
+        (nat_double_succ.comp <| nat_double_succ.comp <| encode_iff.2 <| Primrec.ofNat Code)
+        (const 4)
 #align nat.partrec.code.rfind_prim Nat.Partrec.Code.rfind_prim
 
 theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc : Primrec c) {z : α → σ}
@@ -617,7 +619,7 @@ def eval : Code → ℕ →. ℕ
 /-- Helper lemma for the evaluation of `prec` in the base case. -/
 @[simp]
 theorem eval_prec_zero (cf cg : Code) (a : ℕ) : eval (prec cf cg) (mkpair a 0) = eval cf a := by
-  rw [eval, Nat.unpaired, Nat.unpair_mkpair, Nat.elim_zero]
+  rw [eval, Nat.unpaired, Nat.unpair_mkpair, Nat.rec_zero]
 #align nat.partrec.code.eval_prec_zero Nat.Partrec.Code.eval_prec_zero
 
 /-- Helper lemma for the evaluation of `prec` in the recursive case. -/
@@ -626,7 +628,7 @@ theorem eval_prec_succ (cf cg : Code) (a k : ℕ) :
       let ih ← eval (prec cf cg) (mkpair a k)
       eval cg (mkpair a (mkpair k ih)) :=
   by
-  rw [eval, Nat.unpaired, Part.bind_eq_bind, Nat.unpair_mkpair, Nat.elim_succ]
+  rw [eval, Nat.unpaired, Part.bind_eq_bind, Nat.unpair_mkpair, Nat.rec_add_one]
   simp
 #align nat.partrec.code.eval_prec_succ Nat.Partrec.Code.eval_prec_succ
 

Changes in mathlib4

mathlib3
mathlib4
chore: remove unneeded decreasing_by and termination_by (#11386)

The termination checker has been getting more capable, and many of the termination_by or decreasing_by clauses in Mathlib are no longer needed.

(Note that termination_by? will show the automatically derived termination expression, so no information is being lost by removing these.)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -643,8 +643,6 @@ def evaln : ℕ → Code → ℕ → Option ℕ
         pure m
       else
         evaln k (rfind' cf) (Nat.pair a (m + 1))
-  termination_by k c => (k, c)
-  decreasing_by all_goals { decreasing_with (dsimp; omega) }
 #align nat.partrec.code.evaln Nat.Partrec.Code.evaln
 
 theorem evaln_bound : ∀ {k c n x}, x ∈ evaln k c n → n < k
chore: move Mathlib to v4.7.0-rc1 (#11162)

This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0 branch as we update to intermediate nightlies.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>

Diff
@@ -343,8 +343,8 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
       snd.pair <| nat_div2.comp <| nat_div2.comp snd
   refine (nat_strong_rec (fun a n => F a (ofNat Code n)) this.to₂ fun a n => ?_)
     |>.comp .id (encode_iff.2 hc) |>.of_eq fun a => by simp
-  simp (config := { zeta := false })
-  iterate 4 cases' n with n; · simp (config := { zeta := false }) [ofNatCode_eq, ofNatCode]; rfl
+  simp
+  iterate 4 cases' n with n; · simp [ofNatCode_eq, ofNatCode]; rfl
   simp only [G]; rw [List.length_map, List.length_range]
   let m := n.div2.div2
   show G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m)
@@ -356,8 +356,7 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
       (Nat.succ_le_succ (Nat.le_add_right ..))
   have m1 : m.unpair.1 < n + 4 := lt_of_le_of_lt m.unpair_left_le hm
   have m2 : m.unpair.2 < n + 4 := lt_of_le_of_lt m.unpair_right_le hm
-  simp (config := { zeta := false }) [G₁]
-  simp (config := { zeta := false }) [m, List.get?_map, List.get?_range, hm, m1, m2]
+  simp [G₁]; simp [m, List.get?_map, List.get?_range, hm, m1, m2]
   rw [show ofNat Code (n + 4) = ofNatCode (n + 4) from rfl]
   simp [ofNatCode]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
@@ -457,8 +456,8 @@ theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Cod
       snd.pair <| nat_div2.comp <| nat_div2.comp snd
   refine (nat_strong_rec (fun a n => F a (ofNat Code n)) this.to₂ fun a n => ?_)
     |>.comp .id (encode_iff.2 hc) |>.of_eq fun a => by simp
-  simp (config := { zeta := false })
-  iterate 4 cases' n with n; · simp (config := { zeta := false }) [ofNatCode_eq, ofNatCode]; rfl
+  simp
+  iterate 4 cases' n with n; · simp [ofNatCode_eq, ofNatCode]; rfl
   simp only [G]; rw [List.length_map, List.length_range]
   let m := n.div2.div2
   show G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m)
@@ -470,8 +469,7 @@ theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Cod
       (Nat.succ_le_succ (Nat.le_add_right ..))
   have m1 : m.unpair.1 < n + 4 := lt_of_le_of_lt m.unpair_left_le hm
   have m2 : m.unpair.2 < n + 4 := lt_of_le_of_lt m.unpair_right_le hm
-  simp (config := { zeta := false }) [G₁]
-  simp (config := { zeta := false }) [m, List.get?_map, List.get?_range, hm, m1, m2]
+  simp [G₁]; simp [m, List.get?_map, List.get?_range, hm, m1, m2]
   rw [show ofNat Code (n + 4) = ofNatCode (n + 4) from rfl]
   simp [ofNatCode]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
chore: prepare Lean version bump with explicit simp (#10999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -149,7 +149,7 @@ def ofNatCode : ℕ → Code
   | n + 4 =>
     let m := n.div2.div2
     have hm : m < n + 4 := by
-      simp only [div2_val]
+      simp only [m, div2_val]
       exact
         lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
           (Nat.succ_le_succ (Nat.le_add_right _ _))
@@ -171,7 +171,7 @@ private theorem encode_ofNatCode : ∀ n, encodeCode (ofNatCode n) = n
   | n + 4 => by
     let m := n.div2.div2
     have hm : m < n + 4 := by
-      simp only [div2_val]
+      simp only [m, div2_val]
       exact
         lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
           (Nat.succ_le_succ (Nat.le_add_right _ _))
@@ -1061,7 +1061,7 @@ theorem fixed_point {f : Code → Code} (hf : Computable f) : ∃ c : Code, eval
   ⟨curry cg (encode cF),
     funext fun n =>
       show eval (f (curry cg (encode cF))) n = eval (curry cg (encode cF)) n by
-        simp [eg', eF', Part.map_id']⟩
+        simp [g, eg', eF', Part.map_id']⟩
 #align nat.partrec.code.fixed_point Nat.Partrec.Code.fixed_point
 
 theorem fixed_point₂ {f : Code → ℕ →. ℕ} (hf : Partrec₂ f) : ∃ c : Code, eval c = f c :=
chore: cleanup proof of Nat.Partrec.Code.rec_prim (#10978)

This is in preparation for a fix to be performed on nightly-testing. It restores the proof structure to something more similar to the original lean 3 proof.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -42,7 +42,7 @@ of some code.
 -/
 
 
-open Encodable Denumerable Primrec
+open Encodable Denumerable
 
 namespace Nat.Partrec
 
@@ -230,7 +230,13 @@ theorem encode_lt_rfind' (cf) : encode cf < encode (rfind' cf) := by
     Nat.lt_succ_of_le <| Nat.mul_le_mul_left _ <| le_rfl)
 #align nat.partrec.code.encode_lt_rfind' Nat.Partrec.Code.encode_lt_rfind'
 
+end Nat.Partrec.Code
+
+-- Porting note: Opening `Primrec` inside `namespace Nat.Partrec.Code` causes it to resolve
+-- to `Nat.Partrec`. Needs `open _root_.Partrec` support
 section
+open Primrec
+namespace Nat.Partrec.Code
 
 theorem pair_prim : Primrec₂ pair :=
   Primrec₂.ofNat_iff.2 <|
@@ -288,96 +294,70 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
     Primrec (fun a => F a (c a) : α → σ) := by
   intros _ _ _ _ F
   let G₁ : (α × List σ) × ℕ × ℕ → Option σ := fun p =>
-    let a := p.1.1
-    let IH := p.1.2
-    let n := p.2.1
-    let m := p.2.2
+    letI a := p.1.1; letI IH := p.1.2; letI n := p.2.1; letI m := p.2.2
     (IH.get? m).bind fun s =>
-      (IH.get? m.unpair.1).bind fun s₁ =>
-        (IH.get? m.unpair.2).map fun s₂ =>
-          cond n.bodd
-            (cond n.div2.bodd (rf a (ofNat Code m, s))
-              (pc a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂)))
-            (cond n.div2.bodd (co a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂))
-              (pr a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂)))
-  have : Primrec G₁ := by
-    refine' option_bind (list_get?.comp (snd.comp fst) (snd.comp snd)) _
-    unfold Primrec₂
-    refine'
-      option_bind
-        ((list_get?.comp (snd.comp fst)
-          (fst.comp <| Primrec.unpair.comp (snd.comp snd))).comp fst) _
-    unfold Primrec₂
-    refine'
-      option_map
-        ((list_get?.comp (snd.comp fst)
-          (snd.comp <| Primrec.unpair.comp (snd.comp snd))).comp <| fst.comp fst) _
-    have a : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.1.1.1) :=
-      fst.comp (fst.comp <| fst.comp <| fst.comp fst)
-    have n : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.1.2.1) :=
-      fst.comp (snd.comp <| fst.comp <| fst.comp fst)
-    have m : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.1.2.2) :=
-      snd.comp (snd.comp <| fst.comp <| fst.comp fst)
+    (IH.get? m.unpair.1).bind fun s₁ =>
+    (IH.get? m.unpair.2).map fun s₂ =>
+    cond n.bodd
+      (cond n.div2.bodd (rf a (ofNat Code m, s))
+        (pc a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂)))
+      (cond n.div2.bodd (co a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂))
+        (pr a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂)))
+  have : Primrec G₁ :=
+    option_bind (list_get?.comp (snd.comp fst) (snd.comp snd)) <| .mk <|
+    option_bind ((list_get?.comp (snd.comp fst)
+      (fst.comp <| Primrec.unpair.comp (snd.comp snd))).comp fst) <| .mk <|
+    option_map ((list_get?.comp (snd.comp fst)
+      (snd.comp <| Primrec.unpair.comp (snd.comp snd))).comp <| fst.comp fst) <| .mk <|
+    have a := fst.comp (fst.comp <| fst.comp <| fst.comp fst)
+    have n := fst.comp (snd.comp <| fst.comp <| fst.comp fst)
+    have m := snd.comp (snd.comp <| fst.comp <| fst.comp fst)
     have m₁ := fst.comp (Primrec.unpair.comp m)
     have m₂ := snd.comp (Primrec.unpair.comp m)
-    have s : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.2) :=
-      snd.comp (fst.comp fst)
-    have s₁ : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.2) :=
-      snd.comp fst
-    have s₂ : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.2) :=
-      snd
-    unfold Primrec₂
-    exact
-      (nat_bodd.comp n).cond
-        ((nat_bodd.comp <| nat_div2.comp n).cond (hrf.comp a (((Primrec.ofNat Code).comp m).pair s))
-          (hpc.comp a
-            (((Primrec.ofNat Code).comp m₁).pair <|
-              ((Primrec.ofNat Code).comp m₂).pair <| s₁.pair s₂)))
-        (Primrec.cond (nat_bodd.comp <| nat_div2.comp n)
-          (hco.comp a
-            (((Primrec.ofNat Code).comp m₁).pair <|
-              ((Primrec.ofNat Code).comp m₂).pair <| s₁.pair s₂))
-          (hpr.comp a
-            (((Primrec.ofNat Code).comp m₁).pair <|
-              ((Primrec.ofNat Code).comp m₂).pair <| s₁.pair s₂)))
+    have s := snd.comp (fst.comp fst)
+    have s₁ := snd.comp fst
+    have s₂ := snd
+    (nat_bodd.comp n).cond
+      ((nat_bodd.comp <| nat_div2.comp n).cond
+        (hrf.comp a (((Primrec.ofNat Code).comp m).pair s))
+        (hpc.comp a (((Primrec.ofNat Code).comp m₁).pair <|
+          ((Primrec.ofNat Code).comp m₂).pair <| s₁.pair s₂)))
+      (Primrec.cond (nat_bodd.comp <| nat_div2.comp n)
+        (hco.comp a (((Primrec.ofNat Code).comp m₁).pair <|
+          ((Primrec.ofNat Code).comp m₂).pair <| s₁.pair s₂))
+        (hpr.comp a (((Primrec.ofNat Code).comp m₁).pair <|
+          ((Primrec.ofNat Code).comp m₂).pair <| s₁.pair s₂)))
   let G : α → List σ → Option σ := fun a IH =>
     IH.length.casesOn (some (z a)) fun n =>
-      n.casesOn (some (s a)) fun n =>
-        n.casesOn (some (l a)) fun n =>
-          n.casesOn (some (r a)) fun n => G₁ ((a, IH), n, n.div2.div2)
-  have : Primrec₂ G := by
-    unfold Primrec₂
-    refine nat_casesOn
-      (list_length.comp snd) (option_some_iff.2 (hz.comp fst)) ?_
-    unfold Primrec₂
-    refine nat_casesOn snd (option_some_iff.2 (hs.comp (fst.comp fst))) ?_
-    unfold Primrec₂
-    refine nat_casesOn snd (option_some_iff.2 (hl.comp (fst.comp <| fst.comp fst))) ?_
-    unfold Primrec₂
-    refine nat_casesOn snd (option_some_iff.2 (hr.comp (fst.comp <| fst.comp <| fst.comp fst))) ?_
-    unfold Primrec₂
-    exact this.comp <|
+    n.casesOn (some (s a)) fun n =>
+    n.casesOn (some (l a)) fun n =>
+    n.casesOn (some (r a)) fun n =>
+    G₁ ((a, IH), n, n.div2.div2)
+  have : Primrec₂ G := .mk <|
+    nat_casesOn (list_length.comp snd) (option_some_iff.2 (hz.comp fst)) <| .mk <|
+    nat_casesOn snd (option_some_iff.2 (hs.comp (fst.comp fst))) <| .mk <|
+    nat_casesOn snd (option_some_iff.2 (hl.comp (fst.comp <| fst.comp fst))) <| .mk <|
+    nat_casesOn snd (option_some_iff.2 (hr.comp (fst.comp <| fst.comp <| fst.comp fst))) <| .mk <|
+    this.comp <|
       ((fst.pair snd).comp <| fst.comp <| fst.comp <| fst.comp <| fst).pair <|
-        snd.pair <| nat_div2.comp <| nat_div2.comp snd
-  refine'
-    ((nat_strong_rec (fun a n => F a (ofNat Code n)) this.to₂ fun a n => _).comp
-      _root_.Primrec.id <| encode_iff.2 hc).of_eq fun a => by simp
+      snd.pair <| nat_div2.comp <| nat_div2.comp snd
+  refine (nat_strong_rec (fun a n => F a (ofNat Code n)) this.to₂ fun a n => ?_)
+    |>.comp .id (encode_iff.2 hc) |>.of_eq fun a => by simp
   simp (config := { zeta := false })
   iterate 4 cases' n with n; · simp (config := { zeta := false }) [ofNatCode_eq, ofNatCode]; rfl
-  simp only []
-  rw [List.length_map, List.length_range]
+  simp only [G]; rw [List.length_map, List.length_range]
   let m := n.div2.div2
-  show
-    G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m) =
-      some (F a (ofNat Code (n + 4)))
+  show G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m)
+    = some (F a (ofNat Code (n + 4)))
   have hm : m < n + 4 := by
-    simp only [div2_val]
-    exact
-      lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
-        (Nat.succ_le_succ (Nat.le_add_right _ _))
+    simp only [m, div2_val]
+    exact lt_of_le_of_lt
+      (le_trans (Nat.div_le_self ..) (Nat.div_le_self ..))
+      (Nat.succ_le_succ (Nat.le_add_right ..))
   have m1 : m.unpair.1 < n + 4 := lt_of_le_of_lt m.unpair_left_le hm
   have m2 : m.unpair.2 < n + 4 := lt_of_le_of_lt m.unpair_right_le hm
-  simp [List.get?_map, List.get?_range, hm, m1, m2]
+  simp (config := { zeta := false }) [G₁]
+  simp (config := { zeta := false }) [m, List.get?_map, List.get?_range, hm, m1, m2]
   rw [show ofNat Code (n + 4) = ofNatCode (n + 4) from rfl]
   simp [ofNatCode]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
@@ -395,103 +375,18 @@ theorem rec_prim {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc
     {rf : α → Code → σ → σ} (hrf : Primrec fun a : α × Code × σ => rf a.1 a.2.1 a.2.2) :
     let F (a : α) (c : Code) : σ :=
       Nat.Partrec.Code.recOn c (z a) (s a) (l a) (r a) (pr a) (co a) (pc a) (rf a)
-    Primrec fun a => F a (c a) := by
-  intros F
-  let G₁ : (α × List σ) × ℕ × ℕ → Option σ := fun p =>
-    let a := p.1.1
-    let IH := p.1.2
-    let n := p.2.1
-    let m := p.2.2
-    (IH.get? m).bind fun s =>
-      (IH.get? m.unpair.1).bind fun s₁ =>
-        (IH.get? m.unpair.2).map fun s₂ =>
-          cond n.bodd
-            (cond n.div2.bodd (rf a (ofNat Code m) s)
-              (pc a (ofNat Code m.unpair.1) (ofNat Code m.unpair.2) s₁ s₂))
-            (cond n.div2.bodd (co a (ofNat Code m.unpair.1) (ofNat Code m.unpair.2) s₁ s₂)
-              (pr a (ofNat Code m.unpair.1) (ofNat Code m.unpair.2) s₁ s₂))
-  have : Primrec G₁ := by
-    refine' option_bind (list_get?.comp (snd.comp fst) (snd.comp snd)) _
-    unfold Primrec₂
-    refine' option_bind ((list_get?.comp (snd.comp fst) (fst.comp <| Primrec.unpair.comp
-            (snd.comp snd))).comp fst) _
-    unfold Primrec₂
-    refine'
-      option_map
-        ((list_get?.comp (snd.comp fst) (snd.comp <| Primrec.unpair.comp (snd.comp snd))).comp <|
-          fst.comp fst)
-        _
-    have a : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.1.1.1) :=
-      fst.comp (fst.comp <| fst.comp <| fst.comp fst)
-    have n : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.1.2.1) :=
-      fst.comp (snd.comp <| fst.comp <| fst.comp fst)
-    have m : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.1.2.2) :=
-      snd.comp (snd.comp <| fst.comp <| fst.comp fst)
-    have m₁ := fst.comp (Primrec.unpair.comp m)
-    have m₂ := snd.comp (Primrec.unpair.comp m)
-    have s : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.2) :=
-      snd.comp (fst.comp fst)
-    have s₁ : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.2) :=
-      snd.comp fst
-    have s₂ : Primrec (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.2) :=
-      snd
-    have h₁ := hrf.comp <| a.pair (((Primrec.ofNat Code).comp m).pair s)
-    have h₂ := hpc.comp <| a.pair (((Primrec.ofNat Code).comp m₁).pair <|
-      ((Primrec.ofNat Code).comp m₂).pair <| s₁.pair s₂)
-    have h₃ := hco.comp <| a.pair
-      (((Primrec.ofNat Code).comp m₁).pair <| ((Primrec.ofNat Code).comp m₂).pair <| s₁.pair s₂)
-    have h₄ := hpr.comp <| a.pair
-      (((Primrec.ofNat Code).comp m₁).pair <| ((Primrec.ofNat Code).comp m₂).pair <| s₁.pair s₂)
-    unfold Primrec₂
-    exact
-      (nat_bodd.comp n).cond
-        ((nat_bodd.comp <| nat_div2.comp n).cond h₁ h₂)
-        (cond (nat_bodd.comp <| nat_div2.comp n) h₃ h₄)
-  let G : α → List σ → Option σ := fun a IH =>
-    IH.length.casesOn (some (z a)) fun n =>
-      n.casesOn (some (s a)) fun n =>
-        n.casesOn (some (l a)) fun n =>
-          n.casesOn (some (r a)) fun n => G₁ ((a, IH), n, n.div2.div2)
-  have : Primrec₂ G := by
-    unfold Primrec₂
-    refine nat_casesOn (list_length.comp snd) (option_some_iff.2 (hz.comp fst)) ?_
-    unfold Primrec₂
-    refine nat_casesOn snd (option_some_iff.2 (hs.comp (fst.comp fst))) ?_
-    unfold Primrec₂
-    refine nat_casesOn snd (option_some_iff.2 (hl.comp (fst.comp <| fst.comp fst))) ?_
-    unfold Primrec₂
-    refine nat_casesOn snd (option_some_iff.2 (hr.comp (fst.comp <| fst.comp <| fst.comp fst))) ?_
-    unfold Primrec₂
-    exact this.comp <|
-      ((fst.pair snd).comp <| fst.comp <| fst.comp <| fst.comp <| fst).pair <|
-          snd.pair <| nat_div2.comp <| nat_div2.comp snd
-  refine'
-    ((nat_strong_rec (fun a n => F a (ofNat Code n)) this.to₂ fun a n => _).comp
-      _root_.Primrec.id <| encode_iff.2 hc).of_eq
-      fun a => by simp
-  simp (config := { zeta := false })
-  iterate 4 cases' n with n; · simp (config := { zeta := false }) [ofNatCode_eq, ofNatCode]; rfl
-  simp only []
-  rw [List.length_map, List.length_range]
-  let m := n.div2.div2
-  show
-    G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m) =
-      some (F a (ofNat Code (n + 4)))
-  have hm : m < n + 4 := by
-    simp only [div2_val]
-    exact
-      lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
-        (Nat.succ_le_succ (Nat.le_add_right _ _))
-  have m1 : m.unpair.1 < n + 4 := lt_of_le_of_lt m.unpair_left_le hm
-  have m2 : m.unpair.2 < n + 4 := lt_of_le_of_lt m.unpair_right_le hm
-  simp [List.get?_map, List.get?_range, hm, m1, m2]
-  rw [show ofNat Code (n + 4) = ofNatCode (n + 4) from rfl]
-  simp [ofNatCode]
-  cases n.bodd <;> cases n.div2.bodd <;> rfl
+    Primrec fun a => F a (c a) :=
+  rec_prim' hc hz hs hl hr
+    (pr := fun a b => pr a b.1 b.2.1 b.2.2.1 b.2.2.2) (.mk hpr)
+    (co := fun a b => co a b.1 b.2.1 b.2.2.1 b.2.2.2) (.mk hco)
+    (pc := fun a b => pc a b.1 b.2.1 b.2.2.1 b.2.2.2) (.mk hpc)
+    (rf := fun a b => rf a b.1 b.2) (.mk hrf)
 #align nat.partrec.code.rec_prim Nat.Partrec.Code.rec_prim
 
+end Nat.Partrec.Code
 end
 
+namespace Nat.Partrec.Code
 section
 
 open Computable
@@ -512,91 +407,71 @@ theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Cod
   -- TODO(Mario): less copy-paste from previous proof
   intros _ _ _ _ F
   let G₁ : (α × List σ) × ℕ × ℕ → Option σ := fun p =>
-    let a := p.1.1
-    let IH := p.1.2
-    let n := p.2.1
-    let m := p.2.2
+    letI a := p.1.1; letI IH := p.1.2; letI n := p.2.1; letI m := p.2.2
     (IH.get? m).bind fun s =>
-      (IH.get? m.unpair.1).bind fun s₁ =>
-        (IH.get? m.unpair.2).map fun s₂ =>
-          cond n.bodd
-            (cond n.div2.bodd (rf a (ofNat Code m, s))
-              (pc a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂)))
-            (cond n.div2.bodd (co a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂))
-              (pr a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂)))
+    (IH.get? m.unpair.1).bind fun s₁ =>
+    (IH.get? m.unpair.2).map fun s₂ =>
+    cond n.bodd
+      (cond n.div2.bodd (rf a (ofNat Code m, s))
+        (pc a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂)))
+      (cond n.div2.bodd (co a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂))
+        (pr a (ofNat Code m.unpair.1, ofNat Code m.unpair.2, s₁, s₂)))
   have : Computable G₁ := by
-    refine' option_bind (list_get?.comp (snd.comp fst) (snd.comp snd)) _
-    unfold Computable₂
-    refine'
-      option_bind
-        ((list_get?.comp (snd.comp fst)
-          (fst.comp <| Computable.unpair.comp (snd.comp snd))).comp fst) _
-    unfold Computable₂
-    refine'
-      option_map
-        ((list_get?.comp (snd.comp fst)
-          (snd.comp <| Computable.unpair.comp (snd.comp snd))).comp <| fst.comp fst) _
-    have a : Computable (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.1.1.1) :=
-      fst.comp (fst.comp <| fst.comp <| fst.comp fst)
-    have n : Computable (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.1.2.1) :=
-      fst.comp (snd.comp <| fst.comp <| fst.comp fst)
-    have m : Computable (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.1.2.2) :=
-      snd.comp (snd.comp <| fst.comp <| fst.comp fst)
-    have m₁ := fst.comp (Computable.unpair.comp m)
-    have m₂ := snd.comp (Computable.unpair.comp m)
-    have s : Computable (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.1.2) :=
-      snd.comp (fst.comp fst)
-    have s₁ : Computable (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.1.2) :=
-      snd.comp fst
-    have s₂ : Computable (fun p : ((((α × List σ) × ℕ × ℕ) × σ) × σ) × σ => p.2) :=
-      snd
+    refine option_bind (list_get?.comp (snd.comp fst) (snd.comp snd)) <| .mk ?_
+    refine option_bind ((list_get?.comp (snd.comp fst)
+      (fst.comp <| Computable.unpair.comp (snd.comp snd))).comp fst) <| .mk ?_
+    refine option_map ((list_get?.comp (snd.comp fst)
+      (snd.comp <| Computable.unpair.comp (snd.comp snd))).comp <| fst.comp fst) <| .mk ?_
     exact
+      have a := fst.comp (fst.comp <| fst.comp <| fst.comp fst)
+      have n := fst.comp (snd.comp <| fst.comp <| fst.comp fst)
+      have m := snd.comp (snd.comp <| fst.comp <| fst.comp fst)
+      have m₁ := fst.comp (Computable.unpair.comp m)
+      have m₂ := snd.comp (Computable.unpair.comp m)
+      have s := snd.comp (fst.comp fst)
+      have s₁ := snd.comp fst
+      have s₂ := snd
       (nat_bodd.comp n).cond
         ((nat_bodd.comp <| nat_div2.comp n).cond
           (hrf.comp a (((Computable.ofNat Code).comp m).pair s))
-          (hpc.comp a
-            (((Computable.ofNat Code).comp m₁).pair <|
-              ((Computable.ofNat Code).comp m₂).pair <| s₁.pair s₂)))
+          (hpc.comp a (((Computable.ofNat Code).comp m₁).pair <|
+            ((Computable.ofNat Code).comp m₂).pair <| s₁.pair s₂)))
         (Computable.cond (nat_bodd.comp <| nat_div2.comp n)
-          (hco.comp a
-            (((Computable.ofNat Code).comp m₁).pair <|
-              ((Computable.ofNat Code).comp m₂).pair <| s₁.pair s₂))
-          (hpr.comp a
-            (((Computable.ofNat Code).comp m₁).pair <|
-              ((Computable.ofNat Code).comp m₂).pair <| s₁.pair s₂)))
+          (hco.comp a (((Computable.ofNat Code).comp m₁).pair <|
+            ((Computable.ofNat Code).comp m₂).pair <| s₁.pair s₂))
+          (hpr.comp a (((Computable.ofNat Code).comp m₁).pair <|
+            ((Computable.ofNat Code).comp m₂).pair <| s₁.pair s₂)))
   let G : α → List σ → Option σ := fun a IH =>
     IH.length.casesOn (some (z a)) fun n =>
-      n.casesOn (some (s a)) fun n =>
-        n.casesOn (some (l a)) fun n =>
-          n.casesOn (some (r a)) fun n => G₁ ((a, IH), n, n.div2.div2)
-  have : Computable₂ G :=
-    Computable.nat_casesOn (list_length.comp snd) (option_some_iff.2 (hz.comp fst)) <|
-      Computable.nat_casesOn snd (option_some_iff.2 (hs.comp (fst.comp fst))) <|
-        Computable.nat_casesOn snd (option_some_iff.2 (hl.comp (fst.comp <| fst.comp fst))) <|
-          Computable.nat_casesOn snd
-            (option_some_iff.2 (hr.comp (fst.comp <| fst.comp <| fst.comp fst)))
-            (this.comp <|
-              ((Computable.fst.pair snd).comp <| fst.comp <| fst.comp <| fst.comp <| fst).pair <|
-                snd.pair <| nat_div2.comp <| nat_div2.comp snd)
-  refine'
-    ((nat_strong_rec (fun a n => F a (ofNat Code n)) this.to₂ fun a n => _).comp Computable.id <|
-      encode_iff.2 hc).of_eq fun a => by simp
+    n.casesOn (some (s a)) fun n =>
+    n.casesOn (some (l a)) fun n =>
+    n.casesOn (some (r a)) fun n =>
+    G₁ ((a, IH), n, n.div2.div2)
+  have : Computable₂ G := .mk <|
+    nat_casesOn (list_length.comp snd) (option_some_iff.2 (hz.comp fst)) <| .mk <|
+    nat_casesOn snd (option_some_iff.2 (hs.comp (fst.comp fst))) <| .mk <|
+    nat_casesOn snd (option_some_iff.2 (hl.comp (fst.comp <| fst.comp fst))) <| .mk <|
+    nat_casesOn snd (option_some_iff.2 (hr.comp (fst.comp <| fst.comp <| fst.comp fst))) <| .mk <|
+    this.comp <|
+      ((fst.pair snd).comp <| fst.comp <| fst.comp <| fst.comp <| fst).pair <|
+      snd.pair <| nat_div2.comp <| nat_div2.comp snd
+  refine (nat_strong_rec (fun a n => F a (ofNat Code n)) this.to₂ fun a n => ?_)
+    |>.comp .id (encode_iff.2 hc) |>.of_eq fun a => by simp
   simp (config := { zeta := false })
   iterate 4 cases' n with n; · simp (config := { zeta := false }) [ofNatCode_eq, ofNatCode]; rfl
-  simp only []
-  rw [List.length_map, List.length_range]
+  simp only [G]; rw [List.length_map, List.length_range]
   let m := n.div2.div2
-  show
-    G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m) =
-      some (F a (ofNat Code (n + 4)))
+  show G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m)
+    = some (F a (ofNat Code (n + 4)))
   have hm : m < n + 4 := by
-    simp only [div2_val]
-    exact
-      lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
-        (Nat.succ_le_succ (Nat.le_add_right _ _))
+    simp only [m, div2_val]
+    exact lt_of_le_of_lt
+      (le_trans (Nat.div_le_self ..) (Nat.div_le_self ..))
+      (Nat.succ_le_succ (Nat.le_add_right ..))
   have m1 : m.unpair.1 < n + 4 := lt_of_le_of_lt m.unpair_left_le hm
   have m2 : m.unpair.2 < n + 4 := lt_of_le_of_lt m.unpair_right_le hm
-  simp [List.get?_map, List.get?_range, hm, m1, m2]
+  simp (config := { zeta := false }) [G₁]
+  simp (config := { zeta := false }) [m, List.get?_map, List.get?_range, hm, m1, m2]
   rw [show ofNat Code (n + 4) = ofNatCode (n + 4) from rfl]
   simp [ofNatCode]
   cases n.bodd <;> cases n.div2.bodd <;> rfl
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

No changes to tactic file, it's just boring fixes throughout the library.

This follows on from #6964.

Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -211,14 +211,14 @@ theorem encode_lt_pair (cf cg) :
 
 theorem encode_lt_comp (cf cg) :
     encode cf < encode (comp cf cg) ∧ encode cg < encode (comp cf cg) := by
-  suffices; exact (encode_lt_pair cf cg).imp (fun h => lt_trans h this) fun h => lt_trans h this
-  change _; simp [encodeCode_eq, encodeCode]
+  have : encode (pair cf cg) < encode (comp cf cg) := by simp [encodeCode_eq, encodeCode]
+  exact (encode_lt_pair cf cg).imp (fun h => lt_trans h this) fun h => lt_trans h this
 #align nat.partrec.code.encode_lt_comp Nat.Partrec.Code.encode_lt_comp
 
 theorem encode_lt_prec (cf cg) :
     encode cf < encode (prec cf cg) ∧ encode cg < encode (prec cf cg) := by
-  suffices; exact (encode_lt_pair cf cg).imp (fun h => lt_trans h this) fun h => lt_trans h this
-  change _; simp [encodeCode_eq, encodeCode]
+  have : encode (pair cf cg) < encode (prec cf cg) := by simp [encodeCode_eq, encodeCode]
+  exact (encode_lt_pair cf cg).imp (fun h => lt_trans h this) fun h => lt_trans h this
 #align nat.partrec.code.encode_lt_prec Nat.Partrec.Code.encode_lt_prec
 
 theorem encode_lt_rfind' (cf) : encode cf < encode (rfind' cf) := by
chore: bump dependencies (#10315)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -1106,7 +1106,7 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
       · simp [evaln]
       let k := k' + 1
       simp only [show k'.succ = k from rfl]
-      simp? [Nat.lt_succ_iff] at nk says simp only [List.mem_range, lt_succ_iff] at nk
+      simp? [Nat.lt_succ_iff] at nk says simp only [List.mem_range, Nat.lt_succ_iff] at nk
       have hg :
         ∀ {k' c' n},
           Nat.pair k' (encode c') < Nat.pair k (encode c) →
chore: move to v4.6.0-rc1, merging adaptations from bump/v4.6.0 (#10176)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>

Diff
@@ -770,8 +770,8 @@ def evaln : ℕ → Code → ℕ → Option ℕ
         pure m
       else
         evaln k (rfind' cf) (Nat.pair a (m + 1))
-  termination_by evaln k c => (k, c)
-  decreasing_by { decreasing_with (dsimp; omega) }
+  termination_by k c => (k, c)
+  decreasing_by all_goals { decreasing_with (dsimp; omega) }
 #align nat.partrec.code.evaln Nat.Partrec.Code.evaln
 
 theorem evaln_bound : ∀ {k c n x}, x ∈ evaln k c n → n < k
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 -/
 import Mathlib.Computability.Partrec
+import Mathlib.Data.Option.Basic
 
 #align_import computability.partrec_code from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8"
 
doc: eval is a universal partial recursive function (#9703)
Diff
@@ -695,7 +695,8 @@ theorem smn :
   ⟨curry, Primrec₂.to_comp curry_prim, eval_curry⟩
 #align nat.partrec.code.smn Nat.Partrec.Code.smn
 
-/-- A function is partial recursive if and only if there is a code implementing it. -/
+/-- A function is partial recursive if and only if there is a code implementing it. Therefore,
+`eval` is a **universal partial recursive function**. -/
 theorem exists_code {f : ℕ →. ℕ} : Nat.Partrec f ↔ ∃ c : Code, eval c = f := by
   refine ⟨fun h => ?_, ?_⟩
   · induction h with
chore: use omega in decreasing_by proofs (#9688)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -769,7 +769,7 @@ def evaln : ℕ → Code → ℕ → Option ℕ
       else
         evaln k (rfind' cf) (Nat.pair a (m + 1))
   termination_by evaln k c => (k, c)
-  decreasing_by { decreasing_with simp (config := { arith := true }) [Zero.zero]; done }
+  decreasing_by { decreasing_with (dsimp; omega) }
 #align nat.partrec.code.evaln Nat.Partrec.Code.evaln
 
 theorem evaln_bound : ∀ {k c n x}, x ∈ evaln k c n → n < k
chore: bump std4 dependency (#9426)

This is quite a substantial bump as Nondet / backtrack / solve_by_elim have all moved to Std.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -812,7 +812,8 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
       · exact fun y h₁ h₂ => ⟨y, evaln_mono hl' h₁, hg _ _ h₂⟩
     · -- rfind' cf
       simp? [Bind.bind] at h ⊢ says
-        simp only [unpaired, bind, pair_unpair, Option.mem_def, Option.bind_eq_some] at h ⊢
+        simp only [unpaired, bind, pair_unpair, Option.pure_def, Option.mem_def,
+          Option.bind_eq_some] at h ⊢
       refine' h.imp fun x => And.imp (hf _ _) _
       by_cases x0 : x = 0 <;> simp [x0]
       exact evaln_mono hl'
@@ -844,8 +845,7 @@ theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
       rcases h with ⟨m, h₁, h₂⟩
       by_cases m0 : m = 0 <;> simp [m0] at h₂
       · exact
-          ⟨0, ⟨by simpa [m0] using hf _ _ h₁, fun {m} => (Nat.not_lt_zero _).elim⟩, by
-            injection h₂ with h₂; simp [h₂]⟩
+          ⟨0, ⟨by simpa [m0] using hf _ _ h₁, fun {m} => (Nat.not_lt_zero _).elim⟩, by simp [h₂]⟩
       · have := evaln_sound h₂
         simp [eval] at this
         rcases this with ⟨y, ⟨hy₁, hy₂⟩, rfl⟩
@@ -908,7 +908,7 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
     induction' y with y IH generalizing m <;> simp [evaln, Bind.bind]
     · simp at hy₁
       rcases hf hy₁ with ⟨k, hk⟩
-      exact ⟨_, Nat.le_of_lt_succ <| evaln_bound hk, _, hk, by simp; rfl⟩
+      exact ⟨_, Nat.le_of_lt_succ <| evaln_bound hk, _, hk, by simp⟩
     · rcases hy₂ (Nat.succ_pos _) with ⟨a, ha, a0⟩
       rcases hf ha with ⟨k₁, hk₁⟩
       rcases IH m.succ (by simpa [Nat.succ_eq_add_one, add_comm, add_left_comm] using hy₁)
style: use cases x with | ... instead of cases x; case => ... (#9321)

This converts usages of the pattern

cases h
case inl h' => ...
case inr h' => ...

which derive from mathported code, to the "structured cases" syntax:

cases h with
| inl h' => ...
| inr h' => ...

The case where the subgoals are handled with · instead of case is more contentious (and much more numerous) so I left those alone. This pattern also appears with cases', induction, induction', and rcases. Furthermore, there is a similar transformation for by_cases:

by_cases h : cond
case pos => ...
case neg => ...

is replaced by:

if h : cond then
  ...
else
  ...

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -696,36 +696,36 @@ theorem smn :
 #align nat.partrec.code.smn Nat.Partrec.Code.smn
 
 /-- A function is partial recursive if and only if there is a code implementing it. -/
-theorem exists_code {f : ℕ →. ℕ} : Nat.Partrec f ↔ ∃ c : Code, eval c = f :=
-  ⟨fun h => by
-    induction h
-    case zero => exact ⟨zero, rfl⟩
-    case succ => exact ⟨succ, rfl⟩
-    case left => exact ⟨left, rfl⟩
-    case right => exact ⟨right, rfl⟩
-    case pair f g pf pg hf hg =>
+theorem exists_code {f : ℕ →. ℕ} : Nat.Partrec f ↔ ∃ c : Code, eval c = f := by
+  refine ⟨fun h => ?_, ?_⟩
+  · induction h with
+    | zero => exact ⟨zero, rfl⟩
+    | succ => exact ⟨succ, rfl⟩
+    | left => exact ⟨left, rfl⟩
+    | right => exact ⟨right, rfl⟩
+    | pair pf pg hf hg =>
       rcases hf with ⟨cf, rfl⟩; rcases hg with ⟨cg, rfl⟩
       exact ⟨pair cf cg, rfl⟩
-    case comp f g pf pg hf hg =>
+    | comp pf pg hf hg =>
       rcases hf with ⟨cf, rfl⟩; rcases hg with ⟨cg, rfl⟩
       exact ⟨comp cf cg, rfl⟩
-    case prec f g pf pg hf hg =>
+    | prec pf pg hf hg =>
       rcases hf with ⟨cf, rfl⟩; rcases hg with ⟨cg, rfl⟩
       exact ⟨prec cf cg, rfl⟩
-    case rfind f pf hf =>
+    | rfind pf hf =>
       rcases hf with ⟨cf, rfl⟩
       refine' ⟨comp (rfind' cf) (pair Code.id zero), _⟩
-      simp [eval, Seq.seq, pure, PFun.pure, Part.map_id'],
-    fun h => by
-    rcases h with ⟨c, rfl⟩; induction c
-    case zero => exact Nat.Partrec.zero
-    case succ => exact Nat.Partrec.succ
-    case left => exact Nat.Partrec.left
-    case right => exact Nat.Partrec.right
-    case pair cf cg pf pg => exact pf.pair pg
-    case comp cf cg pf pg => exact pf.comp pg
-    case prec cf cg pf pg => exact pf.prec pg
-    case rfind' cf pf => exact pf.rfind'⟩
+      simp [eval, Seq.seq, pure, PFun.pure, Part.map_id']
+  · rintro ⟨c, rfl⟩
+    induction c with
+    | zero => exact Nat.Partrec.zero
+    | succ => exact Nat.Partrec.succ
+    | left => exact Nat.Partrec.left
+    | right => exact Nat.Partrec.right
+    | pair cf cg pf pg => exact pf.pair pg
+    | comp cf cg pf pg => exact pf.comp pg
+    | prec cf cg pf pg => exact pf.prec pg
+    | rfind' cf pf => exact pf.rfind'
 #align nat.partrec.code.exists_code Nat.Partrec.Code.exists_code
 
 -- Porting note: `>>`s in `evaln` are now `>>=` because `>>`s are not elaborated well in Lean4.
@@ -858,73 +858,72 @@ theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
           exact ⟨z, by simpa [Nat.succ_eq_add_one, add_comm, add_left_comm] using hz, z0⟩
 #align nat.partrec.code.evaln_sound Nat.Partrec.Code.evaln_sound
 
-theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
-  ⟨fun h => by
-    rsuffices ⟨k, h⟩ : ∃ k, x ∈ evaln (k + 1) c n
-    · exact ⟨k + 1, h⟩
-    induction c generalizing n x <;> simp [eval, evaln, pure, PFun.pure, Seq.seq, Bind.bind] at h ⊢
-    iterate 4 exact ⟨⟨_, le_rfl⟩, h.symm⟩
-    case pair cf cg hf hg =>
-      rcases h with ⟨x, hx, y, hy, rfl⟩
-      rcases hf hx with ⟨k₁, hk₁⟩; rcases hg hy with ⟨k₂, hk₂⟩
-      refine' ⟨max k₁ k₂, _⟩
+theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n := by
+  refine ⟨fun h => ?_, fun ⟨k, h⟩ => evaln_sound h⟩
+  rsuffices ⟨k, h⟩ : ∃ k, x ∈ evaln (k + 1) c n
+  · exact ⟨k + 1, h⟩
+  induction c generalizing n x with simp [eval, evaln, pure, PFun.pure, Seq.seq, Bind.bind] at h ⊢
+  | pair cf cg hf hg =>
+    rcases h with ⟨x, hx, y, hy, rfl⟩
+    rcases hf hx with ⟨k₁, hk₁⟩; rcases hg hy with ⟨k₂, hk₂⟩
+    refine' ⟨max k₁ k₂, _⟩
+    refine'
+      ⟨le_max_of_le_left <| Nat.le_of_lt_succ <| evaln_bound hk₁, _,
+        evaln_mono (Nat.succ_le_succ <| le_max_left _ _) hk₁, _,
+        evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk₂, rfl⟩
+  | comp cf cg hf hg =>
+    rcases h with ⟨y, hy, hx⟩
+    rcases hg hy with ⟨k₁, hk₁⟩; rcases hf hx with ⟨k₂, hk₂⟩
+    refine' ⟨max k₁ k₂, _⟩
+    exact
+      ⟨le_max_of_le_left <| Nat.le_of_lt_succ <| evaln_bound hk₁, _,
+        evaln_mono (Nat.succ_le_succ <| le_max_left _ _) hk₁,
+        evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk₂⟩
+  | prec cf cg hf hg =>
+    revert h
+    generalize n.unpair.1 = n₁; generalize n.unpair.2 = n₂
+    induction' n₂ with m IH generalizing x n <;> simp
+    · intro h
+      rcases hf h with ⟨k, hk⟩
+      exact ⟨_, le_max_left _ _, evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk⟩
+    · intro y hy hx
+      rcases IH hy with ⟨k₁, nk₁, hk₁⟩
+      rcases hg hx with ⟨k₂, hk₂⟩
       refine'
-        ⟨le_max_of_le_left <| Nat.le_of_lt_succ <| evaln_bound hk₁, _,
-          evaln_mono (Nat.succ_le_succ <| le_max_left _ _) hk₁, _,
-          evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk₂, rfl⟩
-    case comp cf cg hf hg =>
-      rcases h with ⟨y, hy, hx⟩
-      rcases hg hy with ⟨k₁, hk₁⟩; rcases hf hx with ⟨k₂, hk₂⟩
-      refine' ⟨max k₁ k₂, _⟩
-      exact
-        ⟨le_max_of_le_left <| Nat.le_of_lt_succ <| evaln_bound hk₁, _,
-          evaln_mono (Nat.succ_le_succ <| le_max_left _ _) hk₁,
-          evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk₂⟩
-    case prec cf cg hf hg =>
-      revert h
-      generalize n.unpair.1 = n₁; generalize n.unpair.2 = n₂
-      induction' n₂ with m IH generalizing x n <;> simp
-      · intro h
-        rcases hf h with ⟨k, hk⟩
-        exact ⟨_, le_max_left _ _, evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk⟩
-      · intro y hy hx
-        rcases IH hy with ⟨k₁, nk₁, hk₁⟩
-        rcases hg hx with ⟨k₂, hk₂⟩
-        refine'
-          ⟨(max k₁ k₂).succ,
-            Nat.le_succ_of_le <| le_max_of_le_left <|
-              le_trans (le_max_left _ (Nat.pair n₁ m)) nk₁, y,
-            evaln_mono (Nat.succ_le_succ <| le_max_left _ _) _,
-            evaln_mono (Nat.succ_le_succ <| Nat.le_succ_of_le <| le_max_right _ _) hk₂⟩
-        simp only [evaln._eq_8, bind, unpaired, unpair_pair, Option.mem_def, Option.bind_eq_some,
-          Option.guard_eq_some', exists_and_left, exists_const]
-        exact ⟨le_trans (le_max_right _ _) nk₁, hk₁⟩
-    case rfind' cf hf =>
-      rcases h with ⟨y, ⟨hy₁, hy₂⟩, rfl⟩
-      suffices ∃ k, y + n.unpair.2 ∈ evaln (k + 1) (rfind' cf) (Nat.pair n.unpair.1 n.unpair.2) by
-        simpa [evaln, Bind.bind]
-      revert hy₁ hy₂
-      generalize n.unpair.2 = m
-      intro hy₁ hy₂
-      induction' y with y IH generalizing m <;> simp [evaln, Bind.bind]
-      · simp at hy₁
-        rcases hf hy₁ with ⟨k, hk⟩
-        exact ⟨_, Nat.le_of_lt_succ <| evaln_bound hk, _, hk, by simp; rfl⟩
-      · rcases hy₂ (Nat.succ_pos _) with ⟨a, ha, a0⟩
-        rcases hf ha with ⟨k₁, hk₁⟩
-        rcases IH m.succ (by simpa [Nat.succ_eq_add_one, add_comm, add_left_comm] using hy₁)
-            fun {i} hi => by
-            simpa [Nat.succ_eq_add_one, add_comm, add_left_comm] using
-              hy₂ (Nat.succ_lt_succ hi) with
-          ⟨k₂, hk₂⟩
-        use (max k₁ k₂).succ
-        rw [zero_add] at hk₁
-        use Nat.le_succ_of_le <| le_max_of_le_left <| Nat.le_of_lt_succ <| evaln_bound hk₁
-        use a
-        use evaln_mono (Nat.succ_le_succ <| Nat.le_succ_of_le <| le_max_left _ _) hk₁
-        simpa [Nat.succ_eq_add_one, a0, -max_eq_left, -max_eq_right, add_comm, add_left_comm] using
-          evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk₂,
-    fun ⟨k, h⟩ => evaln_sound h⟩
+        ⟨(max k₁ k₂).succ,
+          Nat.le_succ_of_le <| le_max_of_le_left <|
+            le_trans (le_max_left _ (Nat.pair n₁ m)) nk₁, y,
+          evaln_mono (Nat.succ_le_succ <| le_max_left _ _) _,
+          evaln_mono (Nat.succ_le_succ <| Nat.le_succ_of_le <| le_max_right _ _) hk₂⟩
+      simp only [evaln._eq_8, bind, unpaired, unpair_pair, Option.mem_def, Option.bind_eq_some,
+        Option.guard_eq_some', exists_and_left, exists_const]
+      exact ⟨le_trans (le_max_right _ _) nk₁, hk₁⟩
+  | rfind' cf hf =>
+    rcases h with ⟨y, ⟨hy₁, hy₂⟩, rfl⟩
+    suffices ∃ k, y + n.unpair.2 ∈ evaln (k + 1) (rfind' cf) (Nat.pair n.unpair.1 n.unpair.2) by
+      simpa [evaln, Bind.bind]
+    revert hy₁ hy₂
+    generalize n.unpair.2 = m
+    intro hy₁ hy₂
+    induction' y with y IH generalizing m <;> simp [evaln, Bind.bind]
+    · simp at hy₁
+      rcases hf hy₁ with ⟨k, hk⟩
+      exact ⟨_, Nat.le_of_lt_succ <| evaln_bound hk, _, hk, by simp; rfl⟩
+    · rcases hy₂ (Nat.succ_pos _) with ⟨a, ha, a0⟩
+      rcases hf ha with ⟨k₁, hk₁⟩
+      rcases IH m.succ (by simpa [Nat.succ_eq_add_one, add_comm, add_left_comm] using hy₁)
+          fun {i} hi => by
+          simpa [Nat.succ_eq_add_one, add_comm, add_left_comm] using
+            hy₂ (Nat.succ_lt_succ hi) with
+        ⟨k₂, hk₂⟩
+      use (max k₁ k₂).succ
+      rw [zero_add] at hk₁
+      use Nat.le_succ_of_le <| le_max_of_le_left <| Nat.le_of_lt_succ <| evaln_bound hk₁
+      use a
+      use evaln_mono (Nat.succ_le_succ <| Nat.le_succ_of_le <| le_max_left _ _) hk₁
+      simpa [Nat.succ_eq_add_one, a0, -max_eq_left, -max_eq_right, add_comm, add_left_comm] using
+        evaln_mono (Nat.succ_le_succ <| le_max_right _ _) hk₂
+  | _ => exact ⟨⟨_, le_rfl⟩, h.symm⟩
 #align nat.partrec.code.evaln_complete Nat.Partrec.Code.evaln_complete
 
 section
chore: Remove nonterminal simp at (#7795)

Removes nonterminal uses of simp at. Replaces most of these with instances of simp? ... says.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -792,15 +792,17 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
         exists_const, and_imp]
       introv h h₁ h₂ h₃
       exact ⟨le_trans h₂ h, h₁ h₃⟩
-    simp at h ⊢
+    simp? at h ⊢ says simp only [Option.mem_def] at h ⊢
     induction' c with cf cg hf hg cf cg hf hg cf cg hf hg cf hf generalizing x n <;>
       rw [evaln] at h ⊢ <;> refine' this hl' (fun h => _) h
     iterate 4 exact h
     · -- pair cf cg
-      simp [Seq.seq] at h ⊢
+      simp? [Seq.seq] at h ⊢ says
+        simp only [Seq.seq, Option.map_eq_map, Option.mem_def, Option.bind_eq_some,
+          Option.map_eq_some', exists_exists_and_eq_and] at h ⊢
       exact h.imp fun a => And.imp (hf _ _) <| Exists.imp fun b => And.imp_left (hg _ _)
     · -- comp cf cg
-      simp [Bind.bind] at h ⊢
+      simp? [Bind.bind] at h ⊢ says simp only [bind, Option.mem_def, Option.bind_eq_some] at h ⊢
       exact h.imp fun a => And.imp (hg _ _) (hf _ _)
     · -- prec cf cg
       revert h
@@ -809,7 +811,8 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
       · apply hf
       · exact fun y h₁ h₂ => ⟨y, evaln_mono hl' h₁, hg _ _ h₂⟩
     · -- rfind' cf
-      simp [Bind.bind] at h ⊢
+      simp? [Bind.bind] at h ⊢ says
+        simp only [unpaired, bind, pair_unpair, Option.mem_def, Option.bind_eq_some] at h ⊢
       refine' h.imp fun x => And.imp (hf _ _) _
       by_cases x0 : x = 0 <;> simp [x0]
       exact evaln_mono hl'
@@ -1102,7 +1105,7 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
       · simp [evaln]
       let k := k' + 1
       simp only [show k'.succ = k from rfl]
-      simp [Nat.lt_succ_iff] at nk
+      simp? [Nat.lt_succ_iff] at nk says simp only [List.mem_range, lt_succ_iff] at nk
       have hg :
         ∀ {k' c' n},
           Nat.pair k' (encode c') < Nat.pair k (encode c) →
chore: remove nonterminal simp (#7580)

Removes nonterminal simps on lines looking like simp [...]

Diff
@@ -148,7 +148,7 @@ def ofNatCode : ℕ → Code
   | n + 4 =>
     let m := n.div2.div2
     have hm : m < n + 4 := by
-      simp [Nat.div2_val]
+      simp only [div2_val]
       exact
         lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
           (Nat.succ_le_succ (Nat.le_add_right _ _))
@@ -170,7 +170,7 @@ private theorem encode_ofNatCode : ∀ n, encodeCode (ofNatCode n) = n
   | n + 4 => by
     let m := n.div2.div2
     have hm : m < n + 4 := by
-      simp [Nat.div2_val]
+      simp only [div2_val]
       exact
         lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
           (Nat.succ_le_succ (Nat.le_add_right _ _))
@@ -180,7 +180,7 @@ private theorem encode_ofNatCode : ∀ n, encodeCode (ofNatCode n) = n
     have IH1 := encode_ofNatCode m.unpair.1
     have IH2 := encode_ofNatCode m.unpair.2
     conv_rhs => rw [← Nat.bit_decomp n, ← Nat.bit_decomp n.div2]
-    simp [encodeCode, ofNatCode]
+    simp only [ofNatCode._eq_5]
     cases n.bodd <;> cases n.div2.bodd <;>
       simp [encodeCode, ofNatCode, IH, IH1, IH2, Nat.bit_val]
 
@@ -201,7 +201,7 @@ theorem ofNatCode_eq : ofNat Code = ofNatCode :=
 
 theorem encode_lt_pair (cf cg) :
     encode cf < encode (pair cf cg) ∧ encode cg < encode (pair cf cg) := by
-  simp [encodeCode_eq, encodeCode]
+  simp only [encodeCode_eq, encodeCode]
   have := Nat.mul_le_mul_right (Nat.pair cf.encodeCode cg.encodeCode) (by decide : 1 ≤ 2 * 2)
   rw [one_mul, mul_assoc] at this
   have := lt_of_le_of_lt this (lt_add_of_pos_right _ (by decide : 0 < 4))
@@ -221,7 +221,7 @@ theorem encode_lt_prec (cf cg) :
 #align nat.partrec.code.encode_lt_prec Nat.Partrec.Code.encode_lt_prec
 
 theorem encode_lt_rfind' (cf) : encode cf < encode (rfind' cf) := by
-  simp [encodeCode_eq, encodeCode]
+  simp only [encodeCode_eq, encodeCode]
   have := Nat.mul_le_mul_right cf.encodeCode (by decide : 1 ≤ 2 * 2)
   rw [one_mul, mul_assoc] at this
   refine' lt_of_le_of_lt (le_trans this _) (lt_add_of_pos_right _ (by decide : 0 < 4))
@@ -370,7 +370,7 @@ theorem rec_prim' {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (h
     G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m) =
       some (F a (ofNat Code (n + 4)))
   have hm : m < n + 4 := by
-    simp [Nat.div2_val]
+    simp only [div2_val]
     exact
       lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
         (Nat.succ_le_succ (Nat.le_add_right _ _))
@@ -477,7 +477,7 @@ theorem rec_prim {α σ} [Primcodable α] [Primcodable σ] {c : α → Code} (hc
     G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m) =
       some (F a (ofNat Code (n + 4)))
   have hm : m < n + 4 := by
-    simp [Nat.div2_val]
+    simp only [div2_val]
     exact
       lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
         (Nat.succ_le_succ (Nat.le_add_right _ _))
@@ -589,7 +589,7 @@ theorem rec_computable {α σ} [Primcodable α] [Primcodable σ] {c : α → Cod
     G₁ ((a, (List.range (n + 4)).map fun n => F a (ofNat Code n)), n, m) =
       some (F a (ofNat Code (n + 4)))
   have hm : m < n + 4 := by
-    simp [Nat.div2_val]
+    simp only [div2_val]
     exact
       lt_of_le_of_lt (le_trans (Nat.div_le_self _ _) (Nat.div_le_self _ _))
         (Nat.succ_le_succ (Nat.le_add_right _ _))
@@ -788,7 +788,8 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
       ∀ {k k₂ n x : ℕ} {o₁ o₂ : Option ℕ},
         k ≤ k₂ → (x ∈ o₁ → x ∈ o₂) →
           x ∈ do { guard (n ≤ k); o₁ } → x ∈ do { guard (n ≤ k₂); o₂ } := by
-      simp [Bind.bind]
+      simp only [Option.mem_def, bind, Option.bind_eq_some, Option.guard_eq_some', exists_and_left,
+        exists_const, and_imp]
       introv h h₁ h₂ h₃
       exact ⟨le_trans h₂ h, h₁ h₃⟩
     simp at h ⊢
@@ -803,7 +804,7 @@ theorem evaln_mono : ∀ {k₁ k₂ c n x}, k₁ ≤ k₂ → x ∈ evaln k₁ c
       exact h.imp fun a => And.imp (hg _ _) (hf _ _)
     · -- prec cf cg
       revert h
-      simp [Bind.bind]
+      simp only [unpaired, bind, Option.mem_def]
       induction n.unpair.2 <;> simp
       · apply hf
       · exact fun y h₁ h₂ => ⟨y, evaln_mono hl' h₁, hg _ _ h₂⟩
@@ -892,7 +893,8 @@ theorem evaln_complete {c n x} : x ∈ eval c n ↔ ∃ k, x ∈ evaln k c n :=
               le_trans (le_max_left _ (Nat.pair n₁ m)) nk₁, y,
             evaln_mono (Nat.succ_le_succ <| le_max_left _ _) _,
             evaln_mono (Nat.succ_le_succ <| Nat.le_succ_of_le <| le_max_right _ _) hk₂⟩
-        simp [evaln, Bind.bind]
+        simp only [evaln._eq_8, bind, unpaired, unpair_pair, Option.mem_def, Option.bind_eq_some,
+          Option.guard_eq_some', exists_and_left, exists_const]
         exact ⟨le_trans (le_max_right _ _) nk₁, hk₁⟩
     case rfind' cf hf =>
       rcases h with ⟨y, ⟨hy₁, hy₂⟩, rfl⟩
chore: fix nonterminal simps (#7497)

Fixes the nonterminal simps identified by #7496

Diff
@@ -1125,7 +1125,7 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
         rw [hg (Nat.pair_lt_pair_right _ lf)]
         cases n.unpair.2
         · rfl
-        simp
+        simp only [decode_eq_ofNat, Option.some.injEq]
         rw [hg (Nat.pair_lt_pair_left _ k'.lt_succ_self)]
         cases evaln k' _ _
         · rfl
@@ -1134,7 +1134,7 @@ theorem evaln_prim : Primrec fun a : (ℕ × Code) × ℕ => evaln a.1.1 a.1.2 a
         rw [hg (Nat.pair_lt_pair_right _ lf)]
         cases' evaln k cf n with x
         · rfl
-        simp
+        simp only [decode_eq_ofNat, Option.some.injEq, Option.some_bind]
         cases x <;> simp [Nat.succ_ne_zero]
         rw [hg (Nat.pair_lt_pair_left _ k'.lt_succ_self)]
   (Primrec.option_bind
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,14 +2,11 @@
 Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module computability.partrec_code
-! leanprover-community/mathlib commit 6155d4351090a6fad236e3d2e4e0e4e7342668e8
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Computability.Partrec
 
+#align_import computability.partrec_code from "leanprover-community/mathlib"@"6155d4351090a6fad236e3d2e4e0e4e7342668e8"
+
 /-!
 # Gödel Numbering for Partial Recursive Functions.
 
chore: clean up spacing around at and goals (#5387)

Changes are of the form

  • some_tactic at h⊢ -> some_tactic at h ⊢
  • some_tactic at h -> some_tactic at h
Diff
@@ -821,7 +821,7 @@ theorem evaln_sound : ∀ {k c n x}, x ∈ evaln k c n → x ∈ eval c n
   | 0, _, n, x, h => by simp [evaln] at h
   | k + 1, c, n, x, h => by
     induction' c with cf cg hf hg cf cg hf hg cf cg hf hg cf hf generalizing x n <;>
-        simp [eval, evaln, Bind.bind, Seq.seq] at h⊢ <;>
+        simp [eval, evaln, Bind.bind, Seq.seq] at h ⊢ <;>
       cases' h with _ h
     iterate 4 simpa [pure, PFun.pure, eq_comm] using h
     · -- pair cf cg
chore: fix typos (#4518)

I ran codespell Mathlib and got tired halfway through the suggestions.

Diff
@@ -17,7 +17,7 @@ This file defines `Nat.Partrec.Code`, an inductive datatype describing code for
 recursive functions on ℕ. It defines an encoding for these codes, and proves that the constructors
 are primitive recursive with respect to the encoding.
 
-It also defines the evalution of these codes as partial functions using `PFun`, and proves that a
+It also defines the evaluation of these codes as partial functions using `PFun`, and proves that a
 function is partially recursive (as defined by `Nat.Partrec`) if and only if it is the evaluation
 of some code.
 
feat: add compile_inductive% and compile_def% commands (#4097)

Add a #compile inductive command to compile the recursors of an inductive type, which works by creating a recursive definition and using @[csimp].

Co-authored-by: Parth Shastri <31370288+cppio@users.noreply.github.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -88,59 +88,7 @@ inductive Code : Type
 #align nat.partrec.code Nat.Partrec.Code
 
 -- Porting note: `Nat.Partrec.Code.recOn` is noncomputable in Lean4, so we make it computable.
-
-/-- A computable version of `Nat.Partrec.Code.rec`.
-Workaround until Lean has native support for this. -/
-@[elab_as_elim] private abbrev Code.recC.{u} {motive : Code → Sort u}
-    (zero : motive .zero) (succ : motive .succ)
-    (left : motive .left) (right : motive .right)
-    (pair : (a a_1 : Code) → motive a → motive a_1 → motive (.pair a a_1))
-    (comp : (a a_1 : Code) → motive a → motive a_1 → motive (.comp a a_1))
-    (prec : (a a_1 : Code) → motive a → motive a_1 → motive (.prec a a_1))
-    (rfind' : (a : Code) → motive a → motive (.rfind' a)) :
-    (t : Code) → motive t
-  | .zero => zero
-  | .succ => succ
-  | .left => left
-  | .right => right
-  | .pair a a_1 => pair a a_1
-    (Code.recC zero succ left right pair comp prec rfind' a)
-    (Code.recC zero succ left right pair comp prec rfind' a_1)
-  | .comp a a_1 => comp a a_1
-    (Code.recC zero succ left right pair comp prec rfind' a)
-    (Code.recC zero succ left right pair comp prec rfind' a_1)
-  | .prec a a_1 => prec a a_1
-    (Code.recC zero succ left right pair comp prec rfind' a)
-    (Code.recC zero succ left right pair comp prec rfind' a_1)
-  | .rfind' a => rfind' a
-    (Code.recC zero succ left right pair comp prec rfind' a)
-
-@[csimp] private theorem Code.rec_eq_recC : @Code.rec = @Code.recC := by
-  funext motive zero succ left right pair comp prec rfind' t
-  induction t with
-  | zero => rfl
-  | succ => rfl
-  | left => rfl
-  | right => rfl
-  | pair a a_1 ia ia_1 => rw [Code.recC, ← ia, ← ia_1]
-  | comp a a_1 ia ia_1 => rw [Code.recC, ← ia, ← ia_1]
-  | prec a a_1 ia ia_1 => rw [Code.recC, ← ia, ← ia_1]
-  | rfind' a ia => rw [Code.recC, ← ia]
-
-/-- A computable version of `Nat.Partrec.Code.recOn`.
-Workaround until Lean has native support for this. -/
-@[elab_as_elim] private abbrev Code.recOnC.{u} {motive : Code → Sort u} (t : Code)
-    (zero : motive .zero) (succ : motive .succ)
-    (left : motive .left) (right : motive .right)
-    (pair : (a a_1 : Code) → motive a → motive a_1 → motive (.pair a a_1))
-    (comp : (a a_1 : Code) → motive a → motive a_1 → motive (.comp a a_1))
-    (prec : (a a_1 : Code) → motive a → motive a_1 → motive (.prec a a_1))
-    (rfind' : (a : Code) → motive a → motive (.rfind' a)) : motive t :=
-  Code.recC (motive := motive) zero succ left right pair comp prec rfind' t
-
-@[csimp] private theorem Code.recOn_eq_recOnC : @Code.recOn = @Code.recOnC := by
-  funext motive t zero succ left right pair comp prec rfind'
-  rw [Code.recOn, Code.rec_eq_recC, Code.recOnC]
+compile_inductive% Code
 
 end Nat.Partrec
 
feat: add Mathlib.Tactic.Common, and import (#4056)

This makes a mathlib4 version of mathlib3's tactic.basic, now called Mathlib.Tactic.Common, which imports all tactics which do not have significant theory requirements, and then is imported all across the base of the hierarchy.

This ensures that all common tactics are available nearly everywhere in the library, rather than having to be imported one-by-one as you need them.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -9,7 +9,6 @@ Authors: Mario Carneiro
 ! if you have ported upstream changes.
 -/
 import Mathlib.Computability.Partrec
-import Mathlib.Tactic.RSuffices
 
 /-!
 # Gödel Numbering for Partial Recursive Functions.
feat: port Computability.PartrecCode (#3833)

This PR also renames some decls in Computability.Primrec.

Co-authored-by: Johan Commelin <johan@commelin.net>

Dependencies 6 + 219

220 files ported (97.3%)
98262 lines ported (97.9%)
Show graph

The unported dependencies are