computability.primrecMathlib.Computability.Primrec

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -1014,7 +1014,7 @@ protected theorem decode₂ : Primrec (decode₂ α) :=
 
 #print Primrec.list_findIdx₁ /-
 theorem list_findIdx₁ {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hp : PrimrecRel p) :
-    ∀ l : List β, Primrec fun a => l.findIndex (p a)
+    ∀ l : List β, Primrec fun a => l.findIdx (p a)
   | [] => const 0
   | a :: l => ite (hp.comp Primrec.id (const a)) (const 0) (succ.comp (list_find_index₁ l))
 #align primrec.list_find_index₁ Primrec.list_findIdx₁
@@ -1446,10 +1446,10 @@ theorem list_length : Primrec (@List.length α) :=
 
 #print Primrec.list_findIdx /-
 theorem list_findIdx {f : α → List β} {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hf : Primrec f)
-    (hp : PrimrecRel p) : Primrec fun a => (f a).findIndex (p a) :=
+    (hp : PrimrecRel p) : Primrec fun a => (f a).findIdx (p a) :=
   (list_foldr hf (const 0) <|
         to₂ <| ite (hp.comp fst <| fst.comp snd) (const 0) (succ.comp <| snd.comp snd)).of_eq
-    fun a => Eq.symm <| by dsimp <;> induction' f a with b l <;> [rfl; simp [*, List.findIndex]]
+    fun a => Eq.symm <| by dsimp <;> induction' f a with b l <;> [rfl; simp [*, List.findIdx]]
 #align primrec.list_find_index Primrec.list_findIdx
 -/
 
Diff
@@ -193,7 +193,7 @@ theorem mul : Primrec (unpaired (· * ·)) :=
 #print Nat.Primrec.pow /-
 theorem pow : Primrec (unpaired (· ^ ·)) :=
   (prec (const 1) (mul.comp (pair (right.comp right) left))).of_eq fun p => by
-    simp <;> induction p.unpair.2 <;> simp [*, pow_succ']
+    simp <;> induction p.unpair.2 <;> simp [*, pow_succ]
 #align nat.primrec.pow Nat.Primrec.pow
 -/
 
Diff
@@ -1102,7 +1102,7 @@ theorem nat_div_mod : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
     by_cases h : (f (n, k)).2.succ = k <;> simp [h]
     · have := congr_arg Nat.succ IH.1
       refine' ⟨_, fun k0 => Nat.noConfusion (h.trans k0)⟩
-      rwa [← Nat.succ_add, h, add_comm, ← Nat.mul_succ] at this 
+      rwa [← Nat.succ_add, h, add_comm, ← Nat.mul_succ] at this
     · exact ⟨by rw [Nat.succ_add, IH.1], fun k0 => lt_of_le_of_ne (IH.2.1 k0) h, IH.2.2⟩
   revert this; cases' f (n, k) with D M
   simp; intro h₁ h₂ h₃
Diff
@@ -202,7 +202,7 @@ end Primrec
 end Nat
 
 #print Primcodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:404:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:400:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
 /-- A `primcodable` type is an `encodable` type for which
   the encode/decode functions are primitive recursive. -/
 class Primcodable (α : Type _) extends Encodable α where
@@ -1761,7 +1761,7 @@ open Nat (Primrec')
 
 open Nat.Primrec'
 
-/- ./././Mathport/Syntax/Translate/Command.lean:709:6: unsupported: hide command -/
+/- ./././Mathport/Syntax/Translate/Command.lean:705:6: unsupported: hide command -/
 #print Nat.Primrec'.to_prim /-
 theorem to_prim {n f} (pf : @Primrec' n f) : Primrec f :=
   by
Diff
@@ -202,7 +202,7 @@ end Primrec
 end Nat
 
 #print Primcodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:404:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
 /-- A `primcodable` type is an `encodable` type for which
   the encode/decode functions are primitive recursive. -/
 class Primcodable (α : Type _) extends Encodable α where
@@ -1761,7 +1761,7 @@ open Nat (Primrec')
 
 open Nat.Primrec'
 
-/- ./././Mathport/Syntax/Translate/Command.lean:699:6: unsupported: hide command -/
+/- ./././Mathport/Syntax/Translate/Command.lean:709:6: unsupported: hide command -/
 #print Nat.Primrec'.to_prim /-
 theorem to_prim {n f} (pf : @Primrec' n f) : Primrec f :=
   by
Diff
@@ -3,9 +3,9 @@ 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.Logic.Equiv.Array
-import Mathbin.Logic.Equiv.List
-import Mathbin.Logic.Function.Iterate
+import Logic.Equiv.Array
+import Logic.Equiv.List
+import Logic.Function.Iterate
 
 #align_import computability.primrec from "leanprover-community/mathlib"@"31ca6f9cf5f90a6206092cd7f84b359dcb6d52e0"
 
@@ -202,7 +202,7 @@ end Primrec
 end Nat
 
 #print Primcodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
 /-- A `primcodable` type is an `encodable` type for which
   the encode/decode functions are primitive recursive. -/
 class Primcodable (α : Type _) extends Encodable α where
@@ -1761,7 +1761,7 @@ open Nat (Primrec')
 
 open Nat.Primrec'
 
-/- ./././Mathport/Syntax/Translate/Command.lean:698:6: unsupported: hide command -/
+/- ./././Mathport/Syntax/Translate/Command.lean:699:6: unsupported: hide command -/
 #print Nat.Primrec'.to_prim /-
 theorem to_prim {n f} (pf : @Primrec' n f) : Primrec f :=
   by
Diff
@@ -2,16 +2,13 @@
 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.primrec
-! leanprover-community/mathlib commit 31ca6f9cf5f90a6206092cd7f84b359dcb6d52e0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Logic.Equiv.Array
 import Mathbin.Logic.Equiv.List
 import Mathbin.Logic.Function.Iterate
 
+#align_import computability.primrec from "leanprover-community/mathlib"@"31ca6f9cf5f90a6206092cd7f84b359dcb6d52e0"
+
 /-!
 # The primitive recursive functions
 
Diff
@@ -40,43 +40,55 @@ open Denumerable Encodable Function
 
 namespace Nat
 
+#print Nat.rec /-
 /-- The non-dependent recursor on naturals. -/
 def rec {C : Sort _} : C → (ℕ → C → C) → ℕ → C :=
   @Nat.rec fun _ => C
 #align nat.elim Nat.rec
+-/
 
 /- warning: nat.elim_zero clashes with nat.rec_zero -> Nat.rec_zero
 Case conversion may be inaccurate. Consider using '#align nat.elim_zero Nat.rec_zeroₓ'. -/
+#print Nat.rec_zero /-
 @[simp]
 theorem rec_zero {C} (a f) : @Nat.rec C a f 0 = a :=
   rfl
 #align nat.elim_zero Nat.rec_zero
+-/
 
 /- warning: nat.elim_succ clashes with nat.rec_add_one -> Nat.rec_add_one
 Case conversion may be inaccurate. Consider using '#align nat.elim_succ Nat.rec_add_oneₓ'. -/
+#print Nat.rec_add_one /-
 @[simp]
 theorem rec_add_one {C} (a f n) : @Nat.rec C a f (succ n) = f n (Nat.rec a f n) :=
   rfl
 #align nat.elim_succ Nat.rec_add_one
+-/
 
+#print Nat.casesOn /-
 /-- Cases on whether the input is 0 or a successor. -/
 def casesOn {C : Sort _} (a : C) (f : ℕ → C) : ℕ → C :=
   Nat.rec a fun n _ => f n
 #align nat.cases Nat.casesOn
+-/
 
 /- warning: nat.cases_zero clashes with nat.rec_zero -> Nat.rec_zero
 Case conversion may be inaccurate. Consider using '#align nat.cases_zero Nat.rec_zeroₓ'. -/
+#print Nat.rec_zero /-
 @[simp]
 theorem rec_zero {C} (a f) : @Nat.casesOn C a f 0 = a :=
   rfl
 #align nat.cases_zero Nat.rec_zero
+-/
 
 /- warning: nat.cases_succ clashes with nat.rec_add_one -> Nat.rec_add_one
 Case conversion may be inaccurate. Consider using '#align nat.cases_succ Nat.rec_add_oneₓ'. -/
+#print Nat.rec_add_one /-
 @[simp]
 theorem rec_add_one {C} (a f n) : @Nat.casesOn C a f (succ n) = f n :=
   rfl
 #align nat.cases_succ Nat.rec_add_one
+-/
 
 #print Nat.unpaired /-
 /-- Calls the given function on a pair of entries `n`, encoded via the pairing function. -/
@@ -193,7 +205,7 @@ end Primrec
 end Nat
 
 #print Primcodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
 /-- A `primcodable` type is an `encodable` type for which
   the encode/decode functions are primitive recursive. -/
 class Primcodable (α : Type _) extends Encodable α where
@@ -283,11 +295,13 @@ protected theorem decode : Primrec (decode α) :=
 #align primrec.decode Primrec.decode
 -/
 
+#print Primrec.dom_denumerable /-
 theorem dom_denumerable {α β} [Denumerable α] [Primcodable β] {f : α → β} :
     Primrec f ↔ Nat.Primrec fun n => encode (f (ofNat α n)) :=
   ⟨fun h => (pred.comp h).of_eq fun n => by simp <;> rfl, fun h =>
     (succ.comp h).of_eq fun n => by simp <;> rfl⟩
 #align primrec.dom_denumerable Primrec.dom_denumerable
+-/
 
 #print Primrec.nat_iff /-
 theorem nat_iff {f : ℕ → ℕ} : Primrec f ↔ Nat.Primrec f :=
@@ -308,14 +322,18 @@ theorem option_some : Primrec (@some α) :=
 #align primrec.option_some Primrec.option_some
 -/
 
+#print Primrec.of_eq /-
 theorem of_eq {f g : α → σ} (hf : Primrec f) (H : ∀ n, f n = g n) : Primrec g :=
   (funext H : f = g) ▸ hf
 #align primrec.of_eq Primrec.of_eq
+-/
 
+#print Primrec.const /-
 theorem const (x : σ) : Primrec fun a : α => x :=
   ((casesOn1 0 (const (encode x).succ)).comp (Primcodable.prim α)).of_eq fun n => by
     cases decode α n <;> rfl
 #align primrec.const Primrec.const
+-/
 
 #print Primrec.id /-
 protected theorem id : Primrec (@id α) :=
@@ -323,12 +341,14 @@ protected theorem id : Primrec (@id α) :=
 #align primrec.id Primrec.id
 -/
 
+#print Primrec.comp /-
 theorem comp {f : β → σ} {g : α → β} (hf : Primrec f) (hg : Primrec g) : Primrec fun a => f (g a) :=
   ((casesOn1 0 (hf.comp <| pred.comp hg)).comp (Primcodable.prim α)).of_eq fun n =>
     by
     cases decode α n; · rfl
     simp [encodek]
 #align primrec.comp Primrec.comp
+-/
 
 #print Primrec.succ /-
 theorem succ : Primrec Nat.succ :=
@@ -342,14 +362,18 @@ theorem pred : Primrec Nat.pred :=
 #align primrec.pred Primrec.pred
 -/
 
+#print Primrec.encode_iff /-
 theorem encode_iff {f : α → σ} : (Primrec fun a => encode (f a)) ↔ Primrec f :=
   ⟨fun h => Nat.Primrec.of_eq h fun n => by cases decode α n <;> rfl, Primrec.encode.comp⟩
 #align primrec.encode_iff Primrec.encode_iff
+-/
 
+#print Primrec.ofNat_iff /-
 theorem ofNat_iff {α β} [Denumerable α] [Primcodable β] {f : α → β} :
     Primrec f ↔ Primrec fun n => f (ofNat α n) :=
   dom_denumerable.trans <| nat_iff.symm.trans encode_iff
 #align primrec.of_nat_iff Primrec.ofNat_iff
+-/
 
 #print Primrec.ofNat /-
 protected theorem ofNat (α) [Denumerable α] : Primrec (ofNat α) :=
@@ -357,9 +381,11 @@ protected theorem ofNat (α) [Denumerable α] : Primrec (ofNat α) :=
 #align primrec.of_nat Primrec.ofNat
 -/
 
+#print Primrec.option_some_iff /-
 theorem option_some_iff {f : α → σ} : (Primrec fun a => some (f a)) ↔ Primrec f :=
   ⟨fun h => encode_iff.1 <| pred.comp <| encode_iff.2 h, option_some.comp⟩
 #align primrec.option_some_iff Primrec.option_some_iff
+-/
 
 #print Primrec.of_equiv /-
 theorem of_equiv {β} {e : β ≃ α} :
@@ -379,19 +405,23 @@ theorem of_equiv_symm {β} {e : β ≃ α} :
 #align primrec.of_equiv_symm Primrec.of_equiv_symm
 -/
 
+#print Primrec.of_equiv_iff /-
 theorem of_equiv_iff {β} (e : β ≃ α) {f : σ → β} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e (f a)) ↔ Primrec f :=
   letI := Primcodable.ofEquiv α e
   ⟨fun h => (of_equiv_symm.comp h).of_eq fun a => by simp, of_equiv.comp⟩
 #align primrec.of_equiv_iff Primrec.of_equiv_iff
+-/
 
+#print Primrec.of_equiv_symm_iff /-
 theorem of_equiv_symm_iff {β} (e : β ≃ α) {f : σ → α} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e.symm (f a)) ↔ Primrec f :=
   letI := Primcodable.ofEquiv α e
   ⟨fun h => (of_equiv.comp h).of_eq fun a => by simp, of_equiv_symm.comp⟩
 #align primrec.of_equiv_symm_iff Primrec.of_equiv_symm_iff
+-/
 
 end Primrec
 
@@ -418,6 +448,7 @@ variable {α : Type _} {σ : Type _} [Primcodable α] [Primcodable σ]
 
 open Nat.Primrec
 
+#print Primrec.fst /-
 theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β) :=
   ((casesOn' zero
             ((casesOn' zero (Nat.Primrec.succ.comp left)).comp
@@ -428,7 +459,9 @@ theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β
     cases decode α n.unpair.1 <;> simp
     cases decode β n.unpair.2 <;> simp
 #align primrec.fst Primrec.fst
+-/
 
+#print Primrec.snd /-
 theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β) :=
   ((casesOn' zero
             ((casesOn' zero (Nat.Primrec.succ.comp right)).comp
@@ -439,7 +472,9 @@ theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β
     cases decode α n.unpair.1 <;> simp
     cases decode β n.unpair.2 <;> simp
 #align primrec.snd Primrec.snd
+-/
 
+#print Primrec.pair /-
 theorem pair {α β γ} [Primcodable α] [Primcodable β] [Primcodable γ] {f : α → β} {g : α → γ}
     (hf : Primrec f) (hg : Primrec g) : Primrec fun a => (f a, g a) :=
   ((casesOn1 0
@@ -448,6 +483,7 @@ theorem pair {α β γ} [Primcodable α] [Primcodable β] [Primcodable γ] {f :
         (Primcodable.prim α)).of_eq
     fun n => by cases decode α n <;> simp [encodek] <;> rfl
 #align primrec.pair Primrec.pair
+-/
 
 #print Primrec.unpair /-
 theorem unpair : Primrec Nat.unpair :=
@@ -502,25 +538,35 @@ variable {α : Type _} {β : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
+#print Primrec₂.of_eq /-
 theorem of_eq {f g : α → β → σ} (hg : Primrec₂ f) (H : ∀ a b, f a b = g a b) : Primrec₂ g :=
   (by funext a b <;> apply H : f = g) ▸ hg
 #align primrec₂.of_eq Primrec₂.of_eq
+-/
 
+#print Primrec₂.const /-
 theorem const (x : σ) : Primrec₂ fun (a : α) (b : β) => x :=
   Primrec.const _
 #align primrec₂.const Primrec₂.const
+-/
 
+#print Primrec₂.pair /-
 protected theorem pair : Primrec₂ (@Prod.mk α β) :=
   Primrec.pair Primrec.fst Primrec.snd
 #align primrec₂.pair Primrec₂.pair
+-/
 
+#print Primrec₂.left /-
 theorem left : Primrec₂ fun (a : α) (b : β) => a :=
   Primrec.fst
 #align primrec₂.left Primrec₂.left
+-/
 
+#print Primrec₂.right /-
 theorem right : Primrec₂ fun (a : α) (b : β) => b :=
   Primrec.snd
 #align primrec₂.right Primrec₂.right
+-/
 
 #print Primrec₂.natPair /-
 theorem natPair : Primrec₂ Nat.pair := by simp [Primrec₂, Primrec] <;> constructor
@@ -539,26 +585,36 @@ theorem unpaired' {f : ℕ → ℕ → ℕ} : Nat.Primrec (Nat.unpaired f) ↔ P
 #align primrec₂.unpaired' Primrec₂.unpaired'
 -/
 
+#print Primrec₂.encode_iff /-
 theorem encode_iff {f : α → β → σ} : (Primrec₂ fun a b => encode (f a b)) ↔ Primrec₂ f :=
   Primrec.encode_iff
 #align primrec₂.encode_iff Primrec₂.encode_iff
+-/
 
+#print Primrec₂.option_some_iff /-
 theorem option_some_iff {f : α → β → σ} : (Primrec₂ fun a b => some (f a b)) ↔ Primrec₂ f :=
   Primrec.option_some_iff
 #align primrec₂.option_some_iff Primrec₂.option_some_iff
+-/
 
+#print Primrec₂.ofNat_iff /-
 theorem ofNat_iff {α β σ} [Denumerable α] [Denumerable β] [Primcodable σ] {f : α → β → σ} :
     Primrec₂ f ↔ Primrec₂ fun m n : ℕ => f (ofNat α m) (ofNat β n) :=
   (Primrec.ofNat_iff.trans <| by simp).trans unpaired
 #align primrec₂.of_nat_iff Primrec₂.ofNat_iff
+-/
 
+#print Primrec₂.uncurry /-
 theorem uncurry {f : α → β → σ} : Primrec (Function.uncurry f) ↔ Primrec₂ f := by
   rw [show Function.uncurry f = fun p : α × β => f p.1 p.2 from funext fun ⟨a, b⟩ => rfl] <;> rfl
 #align primrec₂.uncurry Primrec₂.uncurry
+-/
 
+#print Primrec₂.curry /-
 theorem curry {f : α × β → σ} : Primrec₂ (Function.curry f) ↔ Primrec f := by
   rw [← uncurry, Function.uncurry_curry]
 #align primrec₂.curry Primrec₂.curry
+-/
 
 end Primrec₂
 
@@ -568,20 +624,26 @@ variable {α : Type _} {β : Type _} {γ : Type _} {δ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
+#print Primrec.comp₂ /-
 theorem Primrec.comp₂ {f : γ → σ} {g : α → β → γ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a b => f (g a b) :=
   hf.comp hg
 #align primrec.comp₂ Primrec.comp₂
+-/
 
+#print Primrec₂.comp /-
 theorem Primrec₂.comp {f : β → γ → σ} {g : α → β} {h : α → γ} (hf : Primrec₂ f) (hg : Primrec g)
     (hh : Primrec h) : Primrec fun a => f (g a) (h a) :=
   hf.comp (hg.pair hh)
 #align primrec₂.comp Primrec₂.comp
+-/
 
+#print Primrec₂.comp₂ /-
 theorem Primrec₂.comp₂ {f : γ → δ → σ} {g : α → β → γ} {h : α → β → δ} (hf : Primrec₂ f)
     (hg : Primrec₂ g) (hh : Primrec₂ h) : Primrec₂ fun a b => f (g a b) (h a b) :=
   hf.comp hg hh
 #align primrec₂.comp₂ Primrec₂.comp₂
+-/
 
 #print PrimrecPred.comp /-
 theorem PrimrecPred.comp {p : β → Prop} [DecidablePred p] {f : α → β} :
@@ -590,16 +652,20 @@ theorem PrimrecPred.comp {p : β → Prop} [DecidablePred p] {f : α → β} :
 #align primrec_pred.comp PrimrecPred.comp
 -/
 
+#print PrimrecRel.comp /-
 theorem PrimrecRel.comp {R : β → γ → Prop} [∀ a b, Decidable (R a b)] {f : α → β} {g : α → γ} :
     PrimrecRel R → Primrec f → Primrec g → PrimrecPred fun a => R (f a) (g a) :=
   Primrec₂.comp
 #align primrec_rel.comp PrimrecRel.comp
+-/
 
+#print PrimrecRel.comp₂ /-
 theorem PrimrecRel.comp₂ {R : γ → δ → Prop} [∀ a b, Decidable (R a b)] {f : α → β → γ}
     {g : α → β → δ} :
     PrimrecRel R → Primrec₂ f → Primrec₂ g → PrimrecRel fun a b => R (f a b) (g a b) :=
   PrimrecRel.comp
 #align primrec_rel.comp₂ PrimrecRel.comp₂
+-/
 
 end Comp
 
@@ -610,11 +676,13 @@ theorem PrimrecPred.of_eq {α} [Primcodable α] {p q : α → Prop} [DecidablePr
 #align primrec_pred.of_eq PrimrecPred.of_eq
 -/
 
+#print PrimrecRel.of_eq /-
 theorem PrimrecRel.of_eq {α β} [Primcodable α] [Primcodable β] {r s : α → β → Prop}
     [∀ a b, Decidable (r a b)] [∀ a b, Decidable (s a b)] (hr : PrimrecRel r)
     (H : ∀ a b, r a b ↔ s a b) : PrimrecRel s :=
   Primrec₂.of_eq hr fun a b => Bool.decide_congr (H a b)
 #align primrec_rel.of_eq PrimrecRel.of_eq
+-/
 
 namespace Primrec₂
 
@@ -624,10 +692,13 @@ variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
 open Nat.Primrec
 
+#print Primrec₂.swap /-
 theorem swap {f : α → β → σ} (h : Primrec₂ f) : Primrec₂ (swap f) :=
   h.comp₂ Primrec₂.right Primrec₂.left
 #align primrec₂.swap Primrec₂.swap
+-/
 
+#print Primrec₂.nat_iff /-
 theorem nat_iff {f : α → β → σ} :
     Primrec₂ f ↔
       Nat.Primrec
@@ -641,12 +712,15 @@ theorem nat_iff {f : α → β → σ} :
     by intros <;> cases a <;> [rfl; · cases b <;> rfl]
   simp [Primrec₂, Primrec, this]
 #align primrec₂.nat_iff Primrec₂.nat_iff
+-/
 
+#print Primrec₂.nat_iff' /-
 theorem nat_iff' {f : α → β → σ} :
     Primrec₂ f ↔
       Primrec₂ fun m n : ℕ => Option.bind (decode α m) fun a => Option.map (f a) (decode β n) :=
   nat_iff.trans <| unpaired'.trans encode_iff
 #align primrec₂.nat_iff' Primrec₂.nat_iff'
+-/
 
 end Primrec₂
 
@@ -656,9 +730,11 @@ variable {α : Type _} {β : Type _} {γ : Type _} {δ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
+#print Primrec.to₂ /-
 theorem to₂ {f : α × β → σ} (hf : Primrec f) : Primrec₂ fun a b => f (a, b) :=
   hf.of_eq fun ⟨a, b⟩ => rfl
 #align primrec.to₂ Primrec.to₂
+-/
 
 #print Primrec.nat_rec /-
 theorem nat_rec {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f) (hg : Primrec₂ g) :
@@ -694,15 +770,19 @@ theorem nat_rec₁ {f : ℕ → α → α} (a : α) (hf : Primrec₂ f) : Primre
 #align primrec.nat_elim₁ Primrec.nat_rec₁
 -/
 
+#print Primrec.nat_casesOn' /-
 theorem nat_casesOn' {f : α → β} {g : α → ℕ → β} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a => Nat.casesOn (f a) (g a) :=
   nat_rec hf <| hg.comp₂ Primrec₂.left <| comp₂ fst Primrec₂.right
 #align primrec.nat_cases' Primrec.nat_casesOn'
+-/
 
+#print Primrec.nat_casesOn /-
 theorem nat_casesOn {f : α → ℕ} {g : α → β} {h : α → ℕ → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (f a).cases (g a) (h a) :=
   (nat_casesOn' hg hh).comp Primrec.id hf
 #align primrec.nat_cases Primrec.nat_casesOn
+-/
 
 #print Primrec.nat_casesOn₁ /-
 theorem nat_casesOn₁ {f : ℕ → α} (a : α) (hf : Primrec f) : Primrec (Nat.casesOn a f) :=
@@ -710,12 +790,15 @@ theorem nat_casesOn₁ {f : ℕ → α} (a : α) (hf : Primrec f) : Primrec (Nat
 #align primrec.nat_cases₁ Primrec.nat_casesOn₁
 -/
 
+#print Primrec.nat_iterate /-
 theorem nat_iterate {f : α → ℕ} {g : α → β} {h : α → β → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (h a^[f a]) (g a) :=
   (nat_rec' hf hg (hh.comp₂ Primrec₂.left <| snd.comp₂ Primrec₂.right)).of_eq fun a => by
     induction f a <;> simp [*, Function.iterate_succ']
 #align primrec.nat_iterate Primrec.nat_iterate
+-/
 
+#print Primrec.option_casesOn /-
 theorem option_casesOn {o : α → Option β} {f : α → σ} {g : α → β → σ} (ho : Primrec o)
     (hf : Primrec f) (hg : Primrec₂ g) :
     @Primrec _ σ _ _ fun a => Option.casesOn (o a) (f a) (g a) :=
@@ -727,11 +810,14 @@ theorem option_casesOn {o : α → Option β} {f : α → σ} {g : α → β →
                 Primrec₂.right).of_eq
       fun a => by cases' o a with b <;> simp [encodek] <;> rfl
 #align primrec.option_cases Primrec.option_casesOn
+-/
 
+#print Primrec.option_bind /-
 theorem option_bind {f : α → Option β} {g : α → β → Option σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).bind (g a) :=
   (option_casesOn hf (const none) hg).of_eq fun a => by cases f a <;> rfl
 #align primrec.option_bind Primrec.option_bind
+-/
 
 #print Primrec.option_bind₁ /-
 theorem option_bind₁ {f : α → Option σ} (hf : Primrec f) : Primrec fun o => Option.bind o f :=
@@ -739,14 +825,18 @@ theorem option_bind₁ {f : α → Option σ} (hf : Primrec f) : Primrec fun o =
 #align primrec.option_bind₁ Primrec.option_bind₁
 -/
 
+#print Primrec.option_map /-
 theorem option_map {f : α → Option β} {g : α → β → σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).map (g a) :=
   option_bind hf (option_some.comp₂ hg)
 #align primrec.option_map Primrec.option_map
+-/
 
+#print Primrec.option_map₁ /-
 theorem option_map₁ {f : α → σ} (hf : Primrec f) : Primrec (Option.map f) :=
   option_map Primrec.id (hf.comp snd).to₂
 #align primrec.option_map₁ Primrec.option_map₁
+-/
 
 #print Primrec.option_iget /-
 theorem option_iget [Inhabited α] : Primrec (@Option.iget α _) :=
@@ -768,16 +858,20 @@ theorem option_getD : Primrec₂ (@Option.getD α) :=
 #align primrec.option_get_or_else Primrec.option_getD
 -/
 
+#print Primrec.bind_decode_iff /-
 theorem bind_decode_iff {f : α → β → Option σ} :
     (Primrec₂ fun a n => (decode β n).bind (f a)) ↔ Primrec₂ f :=
   ⟨fun h => by simpa [encodek] using h.comp fst ((@Primrec.encode β _).comp snd), fun h =>
     option_bind (Primrec.decode.comp snd) <| h.comp (fst.comp fst) snd⟩
 #align primrec.bind_decode_iff Primrec.bind_decode_iff
+-/
 
+#print Primrec.map_decode_iff /-
 theorem map_decode_iff {f : α → β → σ} :
     (Primrec₂ fun a n => (decode β n).map (f a)) ↔ Primrec₂ f :=
   bind_decode_iff.trans Primrec₂.option_some_iff
 #align primrec.map_decode_iff Primrec.map_decode_iff
+-/
 
 #print Primrec.nat_add /-
 theorem nat_add : Primrec₂ ((· + ·) : ℕ → ℕ → ℕ) :=
@@ -797,16 +891,21 @@ theorem nat_mul : Primrec₂ ((· * ·) : ℕ → ℕ → ℕ) :=
 #align primrec.nat_mul Primrec.nat_mul
 -/
 
+#print Primrec.cond /-
 theorem cond {c : α → Bool} {f : α → σ} {g : α → σ} (hc : Primrec c) (hf : Primrec f)
     (hg : Primrec g) : Primrec fun a => cond (c a) (f a) (g a) :=
   (nat_casesOn (encode_iff.2 hc) hg (hf.comp fst).to₂).of_eq fun a => by cases c a <;> rfl
 #align primrec.cond Primrec.cond
+-/
 
+#print Primrec.ite /-
 theorem ite {c : α → Prop} [DecidablePred c] {f : α → σ} {g : α → σ} (hc : PrimrecPred c)
     (hf : Primrec f) (hg : Primrec g) : Primrec fun a => if c a then f a else g a := by
   simpa using cond hc hf hg
 #align primrec.ite Primrec.ite
+-/
 
+#print Primrec.nat_le /-
 theorem nat_le : PrimrecRel ((· ≤ ·) : ℕ → ℕ → Prop) :=
   (nat_casesOn nat_sub (const true) (const false).to₂).of_eq fun p =>
     by
@@ -815,14 +914,19 @@ theorem nat_le : PrimrecRel ((· ≤ ·) : ℕ → ℕ → Prop) :=
     · simp [tsub_eq_zero_iff_le.1 e]
     · simp [not_le.2 (Nat.lt_of_sub_eq_succ e)]
 #align primrec.nat_le Primrec.nat_le
+-/
 
+#print Primrec.nat_min /-
 theorem nat_min : Primrec₂ (@min ℕ _) :=
   ite nat_le fst snd
 #align primrec.nat_min Primrec.nat_min
+-/
 
+#print Primrec.nat_max /-
 theorem nat_max : Primrec₂ (@max ℕ _) :=
   ite (nat_le.comp Primrec.fst Primrec.snd) snd fst
 #align primrec.nat_max Primrec.nat_max
+-/
 
 #print Primrec.dom_bool /-
 theorem dom_bool (f : Bool → α) : Primrec f :=
@@ -885,18 +989,24 @@ protected theorem eq [DecidableEq α] : PrimrecRel (@Eq α) :=
 #align primrec.eq Primrec.eq
 -/
 
+#print Primrec.nat_lt /-
 theorem nat_lt : PrimrecRel ((· < ·) : ℕ → ℕ → Prop) :=
   (nat_le.comp snd fst).Not.of_eq fun p => by simp
 #align primrec.nat_lt Primrec.nat_lt
+-/
 
+#print Primrec.option_guard /-
 theorem option_guard {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hp : PrimrecRel p) {f : α → β}
     (hf : Primrec f) : Primrec fun a => Option.guard (p a) (f a) :=
   ite (hp.comp Primrec.id hf) (option_some_iff.2 hf) (const none)
 #align primrec.option_guard Primrec.option_guard
+-/
 
+#print Primrec.option_orElse /-
 theorem option_orElse : Primrec₂ ((· <|> ·) : Option α → Option α → Option α) :=
   (option_casesOn fst snd (fst.comp fst).to₂).of_eq fun ⟨o₁, o₂⟩ => by cases o₁ <;> cases o₂ <;> rfl
 #align primrec.option_orelse Primrec.option_orElse
+-/
 
 #print Primrec.decode₂ /-
 protected theorem decode₂ : Primrec (decode₂ α) :=
@@ -905,11 +1015,13 @@ protected theorem decode₂ : Primrec (decode₂ α) :=
 #align primrec.decode₂ Primrec.decode₂
 -/
 
+#print Primrec.list_findIdx₁ /-
 theorem list_findIdx₁ {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hp : PrimrecRel p) :
     ∀ l : List β, Primrec fun a => l.findIndex (p a)
   | [] => const 0
   | a :: l => ite (hp.comp Primrec.id (const a)) (const 0) (succ.comp (list_find_index₁ l))
 #align primrec.list_find_index₁ Primrec.list_findIdx₁
+-/
 
 #print Primrec.list_indexOf₁ /-
 theorem list_indexOf₁ [DecidableEq α] (l : List α) : Primrec fun a => l.indexOfₓ a :=
@@ -917,6 +1029,7 @@ theorem list_indexOf₁ [DecidableEq α] (l : List α) : Primrec fun a => l.inde
 #align primrec.list_index_of₁ Primrec.list_indexOf₁
 -/
 
+#print Primrec.dom_fintype /-
 theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
   let ⟨l, nd, m⟩ := Finite.exists_univ_list α
   option_some_iff.1 <| by
@@ -924,6 +1037,7 @@ theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
     refine' ((list_nth₁ (l.map f)).comp (list_index_of₁ l)).of_eq fun a => _
     rw [List.get?_map, List.nthLe_get? (List.indexOf_lt_length.2 (m _)), List.indexOf_nthLe] <;> rfl
 #align primrec.dom_fintype Primrec.dom_fintype
+-/
 
 theorem nat_boddDiv2 : Primrec Nat.boddDiv2 :=
   (nat_rec' Primrec.id (const (false, 0))
@@ -948,13 +1062,17 @@ theorem nat_div2 : Primrec Nat.div2 :=
 #align primrec.nat_div2 Primrec.nat_div2
 -/
 
+#print Primrec.nat_double /-
 theorem nat_double : Primrec (@bit0 ℕ _) :=
   nat_add.comp Primrec.id Primrec.id
 #align primrec.nat_bit0 Primrec.nat_double
+-/
 
+#print Primrec.nat_double_succ /-
 theorem nat_double_succ : Primrec (@bit1 ℕ _ _) :=
   nat_add.comp nat_double (const 1)
 #align primrec.nat_bit1 Primrec.nat_double_succ
+-/
 
 theorem nat_bit : Primrec₂ Nat.bit :=
   (cond Primrec.fst (nat_double_succ.comp Primrec.snd) (nat_double.comp Primrec.snd)).of_eq fun n =>
@@ -1018,8 +1136,6 @@ variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
 variable (H : Nat.Primrec fun n => Encodable.encode (decode (List β) n))
 
-include H
-
 open Primrec
 
 private def prim : Primcodable (List β) :=
@@ -1153,9 +1269,11 @@ variable {α : Type _} {β : Type _} {γ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable σ]
 
+#print Primrec.sum_inl /-
 theorem sum_inl : Primrec (@Sum.inl α β) :=
   encode_iff.1 <| nat_double.comp Primrec.encode
 #align primrec.sum_inl Primrec.sum_inl
+-/
 
 #print Primrec.sum_inr /-
 theorem sum_inr : Primrec (@Sum.inr α β) :=
@@ -1163,6 +1281,7 @@ theorem sum_inr : Primrec (@Sum.inr α β) :=
 #align primrec.sum_inr Primrec.sum_inr
 -/
 
+#print Primrec.sum_casesOn /-
 theorem sum_casesOn {f : α → Sum β γ} {g : α → β → σ} {h : α → γ → σ} (hf : Primrec f)
     (hg : Primrec₂ g) (hh : Primrec₂ h) : @Primrec _ σ _ _ fun a => Sum.casesOn (f a) (g a) (h a) :=
   option_some_iff.1 <|
@@ -1171,6 +1290,7 @@ theorem sum_casesOn {f : α → Sum β γ} {g : α → β → σ} {h : α → γ
           (option_map (Primrec.decode.comp <| nat_div2.comp <| encode_iff.2 hf) hg)).of_eq
       fun a => by cases' f a with b c <;> simp [Nat.div2_bit, Nat.bodd_bit, encodek] <;> rfl
 #align primrec.sum_cases Primrec.sum_casesOn
+-/
 
 #print Primrec.list_cons /-
 theorem list_cons : Primrec₂ (@List.cons α) :=
@@ -1178,18 +1298,22 @@ theorem list_cons : Primrec₂ (@List.cons α) :=
 #align primrec.list_cons Primrec.list_cons
 -/
 
+#print Primrec.list_casesOn /-
 theorem list_casesOn {f : α → List β} {g : α → σ} {h : α → β × List β → σ} :
     Primrec f →
       Primrec g →
         Primrec₂ h → @Primrec _ σ _ _ fun a => List.casesOn (f a) (g a) fun b l => h a (b, l) :=
   list_cases' (Primcodable.prim _)
 #align primrec.list_cases Primrec.list_casesOn
+-/
 
+#print Primrec.list_foldl /-
 theorem list_foldl {f : α → List β} {g : α → σ} {h : α → σ × β → σ} :
     Primrec f →
       Primrec g → Primrec₂ h → Primrec fun a => (f a).foldl (fun s b => h a (s, b)) (g a) :=
   list_foldl' (Primcodable.prim _)
 #align primrec.list_foldl Primrec.list_foldl
+-/
 
 #print Primrec.list_reverse /-
 theorem list_reverse : Primrec (@List.reverse α) :=
@@ -1197,12 +1321,14 @@ theorem list_reverse : Primrec (@List.reverse α) :=
 #align primrec.list_reverse Primrec.list_reverse
 -/
 
+#print Primrec.list_foldr /-
 theorem list_foldr {f : α → List β} {g : α → σ} {h : α → β × σ → σ} (hf : Primrec f)
     (hg : Primrec g) (hh : Primrec₂ h) :
     Primrec fun a => (f a).foldr (fun b s => h a (b, s)) (g a) :=
   (list_foldl (list_reverse.comp hf) hg <| to₂ <| hh.comp fst <| (pair snd fst).comp snd).of_eq
     fun a => by simp [List.foldl_reverse]
 #align primrec.list_foldr Primrec.list_foldr
+-/
 
 #print Primrec.list_head? /-
 theorem list_head? : Primrec (@List.head? α) :=
@@ -1223,6 +1349,7 @@ theorem list_tail : Primrec (@List.tail α) :=
 #align primrec.list_tail Primrec.list_tail
 -/
 
+#print Primrec.list_rec /-
 theorem list_rec {f : α → List β} {g : α → σ} {h : α → β × List β × σ → σ} (hf : Primrec f)
     (hg : Primrec g) (hh : Primrec₂ h) :
     @Primrec _ σ _ _ fun a => List.recOn (f a) (g a) fun b l IH => h a (b, l, IH) :=
@@ -1235,6 +1362,7 @@ theorem list_rec {f : α → List β} {g : α → σ} {h : α → β × List β
     suffices F a = (f a, List.recOn (f a) (g a) fun b l IH => h a (b, l, IH)) by rw [this]
     simp [F]; induction' f a with b l IH <;> simp [*]
 #align primrec.list_rec Primrec.list_rec
+-/
 
 #print Primrec.list_get? /-
 theorem list_get? : Primrec₂ (@List.get? α) :=
@@ -1289,12 +1417,14 @@ theorem list_concat : Primrec₂ fun l (a : α) => l ++ [a] :=
 #align primrec.list_concat Primrec.list_concat
 -/
 
+#print Primrec.list_map /-
 theorem list_map {f : α → List β} {g : α → β → σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).map (g a) :=
   (list_foldr hf (const []) <|
         to₂ <| list_cons.comp (hg.comp fst (fst.comp snd)) (snd.comp snd)).of_eq
     fun a => by induction f a <;> simp [*]
 #align primrec.list_map Primrec.list_map
+-/
 
 #print Primrec.list_range /-
 theorem list_range : Primrec List.range :=
@@ -1317,12 +1447,14 @@ theorem list_length : Primrec (@List.length α) :=
 #align primrec.list_length Primrec.list_length
 -/
 
+#print Primrec.list_findIdx /-
 theorem list_findIdx {f : α → List β} {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hf : Primrec f)
     (hp : PrimrecRel p) : Primrec fun a => (f a).findIndex (p a) :=
   (list_foldr hf (const 0) <|
         to₂ <| ite (hp.comp fst <| fst.comp snd) (const 0) (succ.comp <| snd.comp snd)).of_eq
     fun a => Eq.symm <| by dsimp <;> induction' f a with b l <;> [rfl; simp [*, List.findIndex]]
 #align primrec.list_find_index Primrec.list_findIdx
+-/
 
 theorem list_indexOf [DecidableEq α] : Primrec₂ (@List.indexOf α _) :=
   to₂ <| list_findIdx snd <| Primrec.eq.comp₂ (fst.comp fst).to₂ snd.to₂
@@ -1544,17 +1676,21 @@ theorem vector_get {n} : Primrec₂ (@Vector.get α n) :=
 #align primrec.vector_nth Primrec.vector_get
 -/
 
+#print Primrec.list_ofFn /-
 theorem list_ofFn :
     ∀ {n} {f : Fin n → α → σ}, (∀ i, Primrec (f i)) → Primrec fun a => List.ofFn fun i => f i a
   | 0, f, hf => const []
   | n + 1, f, hf => by
     simp [List.ofFn_succ] <;> exact list_cons.comp (hf 0) (list_of_fn fun i => hf i.succ)
 #align primrec.list_of_fn Primrec.list_ofFn
+-/
 
+#print Primrec.vector_ofFn /-
 theorem vector_ofFn {n} {f : Fin n → α → σ} (hf : ∀ i, Primrec (f i)) :
     Primrec fun a => Vector.ofFn fun i => f i a :=
   vector_toList_iff.1 <| by simp [list_of_fn hf]
 #align primrec.vector_of_fn Primrec.vector_ofFn
+-/
 
 #print Primrec.vector_get' /-
 theorem vector_get' {n} : Primrec (@Vector.get α n) :=
@@ -1574,17 +1710,21 @@ theorem fin_app {n} : Primrec₂ (@id (Fin n → σ)) :=
 #align primrec.fin_app Primrec.fin_app
 -/
 
+#print Primrec.fin_curry₁ /-
 theorem fin_curry₁ {n} {f : Fin n → α → σ} : Primrec₂ f ↔ ∀ i, Primrec (f i) :=
   ⟨fun h i => h.comp (const i) Primrec.id, fun h =>
     (vector_get.comp ((vector_ofFn h).comp snd) fst).of_eq fun a => by simp⟩
 #align primrec.fin_curry₁ Primrec.fin_curry₁
+-/
 
+#print Primrec.fin_curry /-
 theorem fin_curry {n} {f : α → Fin n → σ} : Primrec f ↔ Primrec₂ f :=
   ⟨fun h => fin_app.comp (h.comp fst) snd, fun h =>
     (vector_get'.comp
           (vector_ofFn fun i => show Primrec fun a => f a i from h.comp Primrec.id (const i))).of_eq
       fun a => by funext i <;> simp⟩
 #align primrec.fin_curry Primrec.fin_curry
+-/
 
 end Primrec
 
@@ -1624,7 +1764,7 @@ open Nat (Primrec')
 
 open Nat.Primrec'
 
-/- ./././Mathport/Syntax/Translate/Command.lean:699:6: unsupported: hide command -/
+/- ./././Mathport/Syntax/Translate/Command.lean:698:6: unsupported: hide command -/
 #print Nat.Primrec'.to_prim /-
 theorem to_prim {n f} (pf : @Primrec' n f) : Primrec f :=
   by
@@ -1748,6 +1888,7 @@ theorem mul : @Primrec' 2 fun v => v.headI * v.tail.headI :=
 #align nat.primrec'.mul Nat.Primrec'.mul
 -/
 
+#print Nat.Primrec'.if_lt /-
 theorem if_lt {n a b f g} (ha : @Primrec' n a) (hb : @Primrec' n b) (hf : @Primrec' n f)
     (hg : @Primrec' n g) : @Primrec' n fun v => if a v < b v then f v else g v :=
   (prec' (sub.comp₂ _ hb ha) hg (tail <| tail hf)).of_eq fun v =>
@@ -1756,6 +1897,7 @@ theorem if_lt {n a b f g} (ha : @Primrec' n a) (hb : @Primrec' n b) (hf : @Primr
     · simp [not_lt.2 (tsub_eq_zero_iff_le.mp e)]
     · simp [Nat.lt_of_sub_eq_succ e]
 #align nat.primrec'.if_lt Nat.Primrec'.if_lt
+-/
 
 #print Nat.Primrec'.natPair /-
 theorem natPair : @Primrec' 2 fun v => v.headI.pair v.tail.headI :=
Diff
@@ -1624,7 +1624,7 @@ open Nat (Primrec')
 
 open Nat.Primrec'
 
-/- ./././Mathport/Syntax/Translate/Command.lean:697:6: unsupported: hide command -/
+/- ./././Mathport/Syntax/Translate/Command.lean:699:6: unsupported: hide command -/
 #print Nat.Primrec'.to_prim /-
 theorem to_prim {n f} (pf : @Primrec' n f) : Primrec f :=
   by
Diff
@@ -193,7 +193,7 @@ end Primrec
 end Nat
 
 #print Primcodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
 /-- A `primcodable` type is an `encodable` type for which
   the encode/decode functions are primitive recursive. -/
 class Primcodable (α : Type _) extends Encodable α where
@@ -1624,7 +1624,7 @@ open Nat (Primrec')
 
 open Nat.Primrec'
 
-/- ./././Mathport/Syntax/Translate/Command.lean:696:6: unsupported: hide command -/
+/- ./././Mathport/Syntax/Translate/Command.lean:697:6: unsupported: hide command -/
 #print Nat.Primrec'.to_prim /-
 theorem to_prim {n f} (pf : @Primrec' n f) : Primrec f :=
   by
Diff
@@ -638,7 +638,7 @@ theorem nat_iff {f : α → β → σ} :
       Option.map (fun p : α × β => f p.1 p.2)
           (Option.bind a fun a : α => Option.map (Prod.mk a) b) =
         Option.bind a fun a => Option.map (f a) b :=
-    by intros <;> cases a <;> [rfl;· cases b <;> rfl]
+    by intros <;> cases a <;> [rfl; · cases b <;> rfl]
   simp [Primrec₂, Primrec, this]
 #align primrec₂.nat_iff Primrec₂.nat_iff
 
@@ -987,12 +987,12 @@ theorem nat_div_mod : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
     by_cases h : (f (n, k)).2.succ = k <;> simp [h]
     · have := congr_arg Nat.succ IH.1
       refine' ⟨_, fun k0 => Nat.noConfusion (h.trans k0)⟩
-      rwa [← Nat.succ_add, h, add_comm, ← Nat.mul_succ] at this
+      rwa [← Nat.succ_add, h, add_comm, ← Nat.mul_succ] at this 
     · exact ⟨by rw [Nat.succ_add, IH.1], fun k0 => lt_of_le_of_ne (IH.2.1 k0) h, IH.2.2⟩
   revert this; cases' f (n, k) with D M
   simp; intro h₁ h₂ h₃
   cases Nat.eq_zero_or_pos k
-  · simp [h, h₃ h] at h₁⊢; simp [h₁]
+  · simp [h, h₃ h] at h₁ ⊢; simp [h₁]
   · exact (Nat.div_mod_unique h).2 ⟨h₁, h₂ h⟩
 #align primrec.nat_div_mod Primrec.nat_div_mod
 
@@ -1068,7 +1068,7 @@ private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ
     have :
       ∀ n, F a n = ((List.take n (f a)).foldl (fun s b => h a (s, b)) (g a), List.drop n (f a)) :=
       by
-      intro ; simp [F]
+      intro; simp [F]
       generalize f a = l; generalize g a = x
       induction' n with n IH generalizing l x; · rfl
       simp; cases' l with b l <;> simp [IH]
@@ -1321,7 +1321,7 @@ theorem list_findIdx {f : α → List β} {p : α → β → Prop} [∀ a b, Dec
     (hp : PrimrecRel p) : Primrec fun a => (f a).findIndex (p a) :=
   (list_foldr hf (const 0) <|
         to₂ <| ite (hp.comp fst <| fst.comp snd) (const 0) (succ.comp <| snd.comp snd)).of_eq
-    fun a => Eq.symm <| by dsimp <;> induction' f a with b l <;> [rfl;simp [*, List.findIndex]]
+    fun a => Eq.symm <| by dsimp <;> induction' f a with b l <;> [rfl; simp [*, List.findIndex]]
 #align primrec.list_find_index Primrec.list_findIdx
 
 theorem list_indexOf [DecidableEq α] : Primrec₂ (@List.indexOf α _) :=
@@ -1782,11 +1782,11 @@ theorem sqrt : @Primrec' 1 fun v => v.headI.sqrt :=
           have x := v.head <;> have y := v.tail.head <;>
             exact if x.succ < y.succ * y.succ then y else y.succ)
         head (const 0) _
-    · convert this; funext; congr ; funext x y; congr <;> simp
+    · convert this; funext; congr; funext x y; congr <;> simp
     have x1 := succ.comp₁ _ head
     have y1 := succ.comp₁ _ (tail head)
     exact if_lt x1 (mul.comp₂ _ y1 y1) (tail head) y1
-  intro ; symm
+  intro; symm
   induction' n with n IH; · simp
   dsimp; rw [IH]; split_ifs
   · exact le_antisymm (Nat.sqrt_le_sqrt (Nat.le_succ _)) (Nat.lt_succ_iff.1 <| Nat.sqrt_lt.2 h)
Diff
@@ -925,9 +925,7 @@ theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
     rw [List.get?_map, List.nthLe_get? (List.indexOf_lt_length.2 (m _)), List.indexOf_nthLe] <;> rfl
 #align primrec.dom_fintype Primrec.dom_fintype
 
-/- warning: primrec.nat_bodd_div2 clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align primrec.nat_bodd_div2 [anonymous]ₓ'. -/
-theorem [anonymous] : Primrec Nat.boddDiv2 :=
+theorem nat_boddDiv2 : Primrec Nat.boddDiv2 :=
   (nat_rec' Primrec.id (const (false, 0))
         (((cond fst (pair (const false) (succ.comp snd)) (pair (const true) snd)).comp snd).comp
             snd).to₂).of_eq
@@ -936,17 +934,17 @@ theorem [anonymous] : Primrec Nat.boddDiv2 :=
     induction' n with n IH; · rfl
     simp [-Nat.boddDiv2_eq, Nat.boddDiv2, *]
     rcases Nat.boddDiv2 n with ⟨_ | _, m⟩ <;> simp [Nat.boddDiv2]
-#align primrec.nat_bodd_div2 [anonymous]
+#align primrec.nat_bodd_div2 Primrec.nat_boddDiv2
 
 #print Primrec.nat_bodd /-
 theorem nat_bodd : Primrec Nat.bodd :=
-  fst.comp [anonymous]
+  fst.comp nat_boddDiv2
 #align primrec.nat_bodd Primrec.nat_bodd
 -/
 
 #print Primrec.nat_div2 /-
 theorem nat_div2 : Primrec Nat.div2 :=
-  snd.comp [anonymous]
+  snd.comp nat_boddDiv2
 #align primrec.nat_div2 Primrec.nat_div2
 -/
 
@@ -963,9 +961,7 @@ theorem nat_bit : Primrec₂ Nat.bit :=
     by cases n.1 <;> rfl
 #align primrec.nat_bit Primrec.nat_bit
 
-/- warning: primrec.nat_div_mod clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align primrec.nat_div_mod [anonymous]ₓ'. -/
-theorem [anonymous] : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
+theorem nat_div_mod : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
   let f (a : ℕ × ℕ) : ℕ × ℕ :=
     a.1.elim (0, 0) fun _ IH =>
       if Nat.succ IH.2 = a.2 then (Nat.succ IH.1, 0) else (IH.1, Nat.succ IH.2)
@@ -998,17 +994,17 @@ theorem [anonymous] : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
   cases Nat.eq_zero_or_pos k
   · simp [h, h₃ h] at h₁⊢; simp [h₁]
   · exact (Nat.div_mod_unique h).2 ⟨h₁, h₂ h⟩
-#align primrec.nat_div_mod [anonymous]
+#align primrec.nat_div_mod Primrec.nat_div_mod
 
 #print Primrec.nat_div /-
 theorem nat_div : Primrec₂ ((· / ·) : ℕ → ℕ → ℕ) :=
-  fst.comp₂ [anonymous]
+  fst.comp₂ nat_div_mod
 #align primrec.nat_div Primrec.nat_div
 -/
 
 #print Primrec.nat_mod /-
 theorem nat_mod : Primrec₂ ((· % ·) : ℕ → ℕ → ℕ) :=
-  snd.comp₂ [anonymous]
+  snd.comp₂ nat_div_mod
 #align primrec.nat_mod Primrec.nat_mod
 -/
 
Diff
@@ -1399,12 +1399,12 @@ instance array {n} : Primcodable (Array' n α) :=
   ofEquiv _ (Equiv.arrayEquivFin _ _)
 #align primcodable.array Primcodable.array
 
-section Ulower
+section ULower
 
 attribute [local instance 100] Encodable.decidableRangeEncode Encodable.decidableEqOfEncodable
 
 #print Primcodable.ulower /-
-instance ulower : Primcodable (Ulower α) :=
+instance ulower : Primcodable (ULower α) :=
   have : PrimrecPred fun n => Encodable.decode₂ α n ≠ none :=
     PrimrecPred.not
       (Primrec.eq.comp
@@ -1416,7 +1416,7 @@ instance ulower : Primcodable (Ulower α) :=
 #align primcodable.ulower Primcodable.ulower
 -/
 
-end Ulower
+end ULower
 
 end Primcodable
 
@@ -1471,14 +1471,14 @@ theorem option_get {f : α → Option β} {h : ∀ a, (f a).isSome} :
 -/
 
 #print Primrec.ulower_down /-
-theorem ulower_down : Primrec (Ulower.down : α → Ulower α) :=
+theorem ulower_down : Primrec (ULower.down : α → ULower α) :=
   letI : ∀ a, Decidable (a ∈ Set.range (encode : α → ℕ)) := decidable_range_encode _
   subtype_mk Primrec.encode
 #align primrec.ulower_down Primrec.ulower_down
 -/
 
 #print Primrec.ulower_up /-
-theorem ulower_up : Primrec (Ulower.up : Ulower α → α) :=
+theorem ulower_up : Primrec (ULower.up : ULower α → α) :=
   letI : ∀ a, Decidable (a ∈ Set.range (encode : α → ℕ)) := decidable_range_encode _
   option_get (primrec.decode₂.comp subtype_val)
 #align primrec.ulower_up Primrec.ulower_up
Diff
@@ -40,23 +40,12 @@ open Denumerable Encodable Function
 
 namespace Nat
 
-/- warning: nat.elim -> Nat.rec is a dubious translation:
-lean 3 declaration is
-  forall {C : Sort.{u1}}, C -> (Nat -> C -> C) -> Nat -> C
-but is expected to have type
-  forall {C : Nat -> Sort.{u1}}, (C Nat.zero) -> (forall (ᾰ : Nat), (C ᾰ) -> (C (Nat.succ ᾰ))) -> (forall (ᾰ : Nat), C ᾰ)
-Case conversion may be inaccurate. Consider using '#align nat.elim Nat.recₓ'. -/
 /-- The non-dependent recursor on naturals. -/
 def rec {C : Sort _} : C → (ℕ → C → C) → ℕ → C :=
   @Nat.rec fun _ => C
 #align nat.elim Nat.rec
 
 /- warning: nat.elim_zero clashes with nat.rec_zero -> Nat.rec_zero
-warning: nat.elim_zero -> Nat.rec_zero is a dubious translation:
-lean 3 declaration is
-  forall {C : Sort.{u1}} (a : C) (f : Nat -> C -> C), Eq.{u1} C (Nat.rec.{u1} C a f (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) a
-but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2994 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2994) a f (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
 Case conversion may be inaccurate. Consider using '#align nat.elim_zero Nat.rec_zeroₓ'. -/
 @[simp]
 theorem rec_zero {C} (a f) : @Nat.rec C a f 0 = a :=
@@ -64,34 +53,18 @@ theorem rec_zero {C} (a f) : @Nat.rec C a f 0 = a :=
 #align nat.elim_zero Nat.rec_zero
 
 /- warning: nat.elim_succ clashes with nat.rec_add_one -> Nat.rec_add_one
-warning: nat.elim_succ -> Nat.rec_add_one is a dubious translation:
-lean 3 declaration is
-  forall {C : Sort.{u1}} (a : C) (f : Nat -> C -> C) (n : Nat), Eq.{u1} C (Nat.rec.{u1} C a f (Nat.succ n)) (f n (Nat.rec.{u1} C a f n))
-but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Nat.rec.{u1} C a f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3044 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3044) a f n))
 Case conversion may be inaccurate. Consider using '#align nat.elim_succ Nat.rec_add_oneₓ'. -/
 @[simp]
 theorem rec_add_one {C} (a f n) : @Nat.rec C a f (succ n) = f n (Nat.rec a f n) :=
   rfl
 #align nat.elim_succ Nat.rec_add_one
 
-/- warning: nat.cases -> Nat.casesOn is a dubious translation:
-lean 3 declaration is
-  forall {C : Sort.{u1}}, C -> (Nat -> C) -> Nat -> C
-but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : Nat), (C Nat.zero) -> (forall (n : Nat), C (Nat.succ n)) -> (C a)
-Case conversion may be inaccurate. Consider using '#align nat.cases Nat.casesOnₓ'. -/
 /-- Cases on whether the input is 0 or a successor. -/
 def casesOn {C : Sort _} (a : C) (f : ℕ → C) : ℕ → C :=
   Nat.rec a fun n _ => f n
 #align nat.cases Nat.casesOn
 
 /- warning: nat.cases_zero clashes with nat.rec_zero -> Nat.rec_zero
-warning: nat.cases_zero -> Nat.rec_zero is a dubious translation:
-lean 3 declaration is
-  forall {C : Sort.{u1}} (a : C) (f : Nat -> C), Eq.{u1} C (Nat.casesOn.{u1} C a f (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) a
-but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2994 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2994) a f (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
 Case conversion may be inaccurate. Consider using '#align nat.cases_zero Nat.rec_zeroₓ'. -/
 @[simp]
 theorem rec_zero {C} (a f) : @Nat.casesOn C a f 0 = a :=
@@ -99,11 +72,6 @@ theorem rec_zero {C} (a f) : @Nat.casesOn C a f 0 = a :=
 #align nat.cases_zero Nat.rec_zero
 
 /- warning: nat.cases_succ clashes with nat.rec_add_one -> Nat.rec_add_one
-warning: nat.cases_succ -> Nat.rec_add_one is a dubious translation:
-lean 3 declaration is
-  forall {C : Sort.{u1}} (a : C) (f : Nat -> C) (n : Nat), Eq.{u1} C (Nat.casesOn.{u1} C a f (Nat.succ n)) (f n)
-but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Nat.rec.{u1} C a f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3044 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3044) a f n))
 Case conversion may be inaccurate. Consider using '#align nat.cases_succ Nat.rec_add_oneₓ'. -/
 @[simp]
 theorem rec_add_one {C} (a f n) : @Nat.casesOn C a f (succ n) = f n :=
@@ -315,12 +283,6 @@ protected theorem decode : Primrec (decode α) :=
 #align primrec.decode Primrec.decode
 -/
 
-/- warning: primrec.dom_denumerable -> Primrec.dom_denumerable is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_4 : Denumerable.{u1} α] [_inst_5 : Primcodable.{u2} β] {f : α -> β}, Iff (Primrec.{u1, u2} α β (Primcodable.ofDenumerable.{u1} α _inst_4) _inst_5 f) (Nat.Primrec (fun (n : Nat) => Encodable.encode.{u2} β (Primcodable.toEncodable.{u2} β _inst_5) (f (Denumerable.ofNat.{u1} α _inst_4 n))))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_4 : Denumerable.{u2} α] [_inst_5 : Primcodable.{u1} β] {f : α -> β}, Iff (Primrec.{u2, u1} α β (Primcodable.ofDenumerable.{u2} α _inst_4) _inst_5 f) (Nat.Primrec (fun (n : Nat) => Encodable.encode.{u1} β (Primcodable.toEncodable.{u1} β _inst_5) (f (Denumerable.ofNat.{u2} α _inst_4 n))))
-Case conversion may be inaccurate. Consider using '#align primrec.dom_denumerable Primrec.dom_denumerableₓ'. -/
 theorem dom_denumerable {α β} [Denumerable α] [Primcodable β] {f : α → β} :
     Primrec f ↔ Nat.Primrec fun n => encode (f (ofNat α n)) :=
   ⟨fun h => (pred.comp h).of_eq fun n => by simp <;> rfl, fun h =>
@@ -346,22 +308,10 @@ theorem option_some : Primrec (@some α) :=
 #align primrec.option_some Primrec.option_some
 -/
 
-/- warning: primrec.of_eq -> Primrec.of_eq is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {f : α -> σ} {g : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_3 f) -> (forall (n : α), Eq.{succ u2} σ (f n) (g n)) -> (Primrec.{u1, u2} α σ _inst_1 _inst_3 g)
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {f : α -> σ} {g : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_3 f) -> (forall (n : α), Eq.{succ u1} σ (f n) (g n)) -> (Primrec.{u2, u1} α σ _inst_1 _inst_3 g)
-Case conversion may be inaccurate. Consider using '#align primrec.of_eq Primrec.of_eqₓ'. -/
 theorem of_eq {f g : α → σ} (hf : Primrec f) (H : ∀ n, f n = g n) : Primrec g :=
   (funext H : f = g) ▸ hf
 #align primrec.of_eq Primrec.of_eq
 
-/- warning: primrec.const -> Primrec.const is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] (x : σ), Primrec.{u1, u2} α σ _inst_1 _inst_3 (fun (a : α) => x)
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] (x : σ), Primrec.{u2, u1} α σ _inst_1 _inst_3 (fun (a : α) => x)
-Case conversion may be inaccurate. Consider using '#align primrec.const Primrec.constₓ'. -/
 theorem const (x : σ) : Primrec fun a : α => x :=
   ((casesOn1 0 (const (encode x).succ)).comp (Primcodable.prim α)).of_eq fun n => by
     cases decode α n <;> rfl
@@ -373,12 +323,6 @@ protected theorem id : Primrec (@id α) :=
 #align primrec.id Primrec.id
 -/
 
-/- warning: primrec.comp -> Primrec.comp is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : β -> σ} {g : α -> β}, (Primrec.{u2, u3} β σ _inst_2 _inst_3 f) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 g) -> (Primrec.{u1, u3} α σ _inst_1 _inst_3 (fun (a : α) => f (g a)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_3 : Primcodable.{u2} σ] {f : β -> σ} {g : α -> β}, (Primrec.{u3, u2} β σ _inst_2 _inst_3 f) -> (Primrec.{u1, u3} α β _inst_1 _inst_2 g) -> (Primrec.{u1, u2} α σ _inst_1 _inst_3 (fun (a : α) => f (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.comp Primrec.compₓ'. -/
 theorem comp {f : β → σ} {g : α → β} (hf : Primrec f) (hg : Primrec g) : Primrec fun a => f (g a) :=
   ((casesOn1 0 (hf.comp <| pred.comp hg)).comp (Primcodable.prim α)).of_eq fun n =>
     by
@@ -398,22 +342,10 @@ theorem pred : Primrec Nat.pred :=
 #align primrec.pred Primrec.pred
 -/
 
-/- warning: primrec.encode_iff -> Primrec.encode_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {f : α -> σ}, Iff (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => Encodable.encode.{u2} σ (Primcodable.toEncodable.{u2} σ _inst_3) (f a))) (Primrec.{u1, u2} α σ _inst_1 _inst_3 f)
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {f : α -> σ}, Iff (Primrec.{u2, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => Encodable.encode.{u1} σ (Primcodable.toEncodable.{u1} σ _inst_3) (f a))) (Primrec.{u2, u1} α σ _inst_1 _inst_3 f)
-Case conversion may be inaccurate. Consider using '#align primrec.encode_iff Primrec.encode_iffₓ'. -/
 theorem encode_iff {f : α → σ} : (Primrec fun a => encode (f a)) ↔ Primrec f :=
   ⟨fun h => Nat.Primrec.of_eq h fun n => by cases decode α n <;> rfl, Primrec.encode.comp⟩
 #align primrec.encode_iff Primrec.encode_iff
 
-/- warning: primrec.of_nat_iff -> Primrec.ofNat_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_4 : Denumerable.{u1} α] [_inst_5 : Primcodable.{u2} β] {f : α -> β}, Iff (Primrec.{u1, u2} α β (Primcodable.ofDenumerable.{u1} α _inst_4) _inst_5 f) (Primrec.{0, u2} Nat β (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_5 (fun (n : Nat) => f (Denumerable.ofNat.{u1} α _inst_4 n)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_4 : Denumerable.{u2} α] [_inst_5 : Primcodable.{u1} β] {f : α -> β}, Iff (Primrec.{u2, u1} α β (Primcodable.ofDenumerable.{u2} α _inst_4) _inst_5 f) (Primrec.{0, u1} Nat β (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_5 (fun (n : Nat) => f (Denumerable.ofNat.{u2} α _inst_4 n)))
-Case conversion may be inaccurate. Consider using '#align primrec.of_nat_iff Primrec.ofNat_iffₓ'. -/
 theorem ofNat_iff {α β} [Denumerable α] [Primcodable β] {f : α → β} :
     Primrec f ↔ Primrec fun n => f (ofNat α n) :=
   dom_denumerable.trans <| nat_iff.symm.trans encode_iff
@@ -425,12 +357,6 @@ protected theorem ofNat (α) [Denumerable α] : Primrec (ofNat α) :=
 #align primrec.of_nat Primrec.ofNat
 -/
 
-/- warning: primrec.option_some_iff -> Primrec.option_some_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {f : α -> σ}, Iff (Primrec.{u1, u2} α (Option.{u2} σ) _inst_1 (Primcodable.option.{u2} σ _inst_3) (fun (a : α) => Option.some.{u2} σ (f a))) (Primrec.{u1, u2} α σ _inst_1 _inst_3 f)
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {f : α -> σ}, Iff (Primrec.{u2, u1} α (Option.{u1} σ) _inst_1 (Primcodable.option.{u1} σ _inst_3) (fun (a : α) => Option.some.{u1} σ (f a))) (Primrec.{u2, u1} α σ _inst_1 _inst_3 f)
-Case conversion may be inaccurate. Consider using '#align primrec.option_some_iff Primrec.option_some_iffₓ'. -/
 theorem option_some_iff {f : α → σ} : (Primrec fun a => some (f a)) ↔ Primrec f :=
   ⟨fun h => encode_iff.1 <| pred.comp <| encode_iff.2 h, option_some.comp⟩
 #align primrec.option_some_iff Primrec.option_some_iff
@@ -453,12 +379,6 @@ theorem of_equiv_symm {β} {e : β ≃ α} :
 #align primrec.of_equiv_symm Primrec.of_equiv_symm
 -/
 
-/- warning: primrec.of_equiv_iff -> Primrec.of_equiv_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u1} β α) {f : σ -> β}, Iff (Primrec.{u2, u1} σ α _inst_3 _inst_1 (fun (a : σ) => coeFn.{max 1 (max (succ u3) (succ u1)) (succ u1) (succ u3), max (succ u3) (succ u1)} (Equiv.{succ u3, succ u1} β α) (fun (_x : Equiv.{succ u3, succ u1} β α) => β -> α) (Equiv.hasCoeToFun.{succ u3, succ u1} β α) e (f a))) (Primrec.{u2, u3} σ β _inst_3 (Primcodable.ofEquiv.{u1, u3} α β _inst_1 e) f)
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> β}, Iff (Primrec.{u1, u2} σ α _inst_3 _inst_1 (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u3, succ u2} (Equiv.{succ u3, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u3, succ u2} β α) e (f a))) (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) f)
-Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_iff Primrec.of_equiv_iffₓ'. -/
 theorem of_equiv_iff {β} (e : β ≃ α) {f : σ → β} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e (f a)) ↔ Primrec f :=
@@ -466,12 +386,6 @@ theorem of_equiv_iff {β} (e : β ≃ α) {f : σ → β} :
   ⟨fun h => (of_equiv_symm.comp h).of_eq fun a => by simp, of_equiv.comp⟩
 #align primrec.of_equiv_iff Primrec.of_equiv_iff
 
-/- warning: primrec.of_equiv_symm_iff -> Primrec.of_equiv_symm_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u1} β α) {f : σ -> α}, Iff (Primrec.{u2, u3} σ β _inst_3 (Primcodable.ofEquiv.{u1, u3} α β _inst_1 e) (fun (a : σ) => coeFn.{max 1 (max (succ u1) (succ u3)) (succ u3) (succ u1), max (succ u1) (succ u3)} (Equiv.{succ u1, succ u3} α β) (fun (_x : Equiv.{succ u1, succ u3} α β) => α -> β) (Equiv.hasCoeToFun.{succ u1, succ u3} α β) (Equiv.symm.{succ u3, succ u1} β α e) (f a))) (Primrec.{u2, u1} σ α _inst_3 _inst_1 f)
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> α}, Iff (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (Equiv.{succ u2, succ u3} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u3} α β) (Equiv.symm.{succ u3, succ u2} β α e) (f a))) (Primrec.{u1, u2} σ α _inst_3 _inst_1 f)
-Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_symm_iff Primrec.of_equiv_symm_iffₓ'. -/
 theorem of_equiv_symm_iff {β} (e : β ≃ α) {f : σ → α} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e.symm (f a)) ↔ Primrec f :=
@@ -504,12 +418,6 @@ variable {α : Type _} {σ : Type _} [Primcodable α] [Primcodable σ]
 
 open Nat.Primrec
 
-/- warning: primrec.fst -> Primrec.fst is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_3 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} β], Primrec.{max u1 u2, u1} (Prod.{u1, u2} α β) α (Primcodable.prod.{u1, u2} α β _inst_3 _inst_4) _inst_3 (Prod.fst.{u1, u2} α β)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_3 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} β], Primrec.{max u2 u1, u2} (Prod.{u2, u1} α β) α (Primcodable.prod.{u2, u1} α β _inst_3 _inst_4) _inst_3 (Prod.fst.{u2, u1} α β)
-Case conversion may be inaccurate. Consider using '#align primrec.fst Primrec.fstₓ'. -/
 theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β) :=
   ((casesOn' zero
             ((casesOn' zero (Nat.Primrec.succ.comp left)).comp
@@ -521,12 +429,6 @@ theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β
     cases decode β n.unpair.2 <;> simp
 #align primrec.fst Primrec.fst
 
-/- warning: primrec.snd -> Primrec.snd is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_3 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} β], Primrec.{max u1 u2, u2} (Prod.{u1, u2} α β) β (Primcodable.prod.{u1, u2} α β _inst_3 _inst_4) _inst_4 (Prod.snd.{u1, u2} α β)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_3 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} β], Primrec.{max u2 u1, u1} (Prod.{u2, u1} α β) β (Primcodable.prod.{u2, u1} α β _inst_3 _inst_4) _inst_4 (Prod.snd.{u2, u1} α β)
-Case conversion may be inaccurate. Consider using '#align primrec.snd Primrec.sndₓ'. -/
 theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β) :=
   ((casesOn' zero
             ((casesOn' zero (Nat.Primrec.succ.comp right)).comp
@@ -538,12 +440,6 @@ theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β
     cases decode β n.unpair.2 <;> simp
 #align primrec.snd Primrec.snd
 
-/- warning: primrec.pair -> Primrec.pair is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_3 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} γ] {f : α -> β} {g : α -> γ}, (Primrec.{u1, u2} α β _inst_3 _inst_4 f) -> (Primrec.{u1, u3} α γ _inst_3 _inst_5 g) -> (Primrec.{u1, max u2 u3} α (Prod.{u2, u3} β γ) _inst_3 (Primcodable.prod.{u2, u3} β γ _inst_4 _inst_5) (fun (a : α) => Prod.mk.{u2, u3} β γ (f a) (g a)))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_3 : Primcodable.{u3} α] [_inst_4 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u1} γ] {f : α -> β} {g : α -> γ}, (Primrec.{u3, u2} α β _inst_3 _inst_4 f) -> (Primrec.{u3, u1} α γ _inst_3 _inst_5 g) -> (Primrec.{u3, max u1 u2} α (Prod.{u2, u1} β γ) _inst_3 (Primcodable.prod.{u2, u1} β γ _inst_4 _inst_5) (fun (a : α) => Prod.mk.{u2, u1} β γ (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.pair Primrec.pairₓ'. -/
 theorem pair {α β γ} [Primcodable α] [Primcodable β] [Primcodable γ] {f : α → β} {g : α → γ}
     (hf : Primrec f) (hg : Primrec g) : Primrec fun a => (f a, g a) :=
   ((casesOn1 0
@@ -606,52 +502,22 @@ variable {α : Type _} {β : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
-/- warning: primrec₂.of_eq -> Primrec₂.of_eq is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ} {g : α -> β -> σ}, (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f) -> (forall (a : α) (b : β), Eq.{succ u3} σ (f a b) (g a b)) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 g)
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ} {g : α -> β -> σ}, (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f) -> (forall (a : α) (b : β), Eq.{succ u1} σ (f a b) (g a b)) -> (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 g)
-Case conversion may be inaccurate. Consider using '#align primrec₂.of_eq Primrec₂.of_eqₓ'. -/
 theorem of_eq {f g : α → β → σ} (hg : Primrec₂ f) (H : ∀ a b, f a b = g a b) : Primrec₂ g :=
   (by funext a b <;> apply H : f = g) ▸ hg
 #align primrec₂.of_eq Primrec₂.of_eq
 
-/- warning: primrec₂.const -> Primrec₂.const is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] (x : σ), Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 (fun (a : α) (b : β) => x)
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] (x : σ), Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 (fun (a : α) (b : β) => x)
-Case conversion may be inaccurate. Consider using '#align primrec₂.const Primrec₂.constₓ'. -/
 theorem const (x : σ) : Primrec₂ fun (a : α) (b : β) => x :=
   Primrec.const _
 #align primrec₂.const Primrec₂.const
 
-/- warning: primrec₂.pair -> Primrec₂.pair is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β], Primrec₂.{u1, u2, max u1 u2} α β (Prod.{u1, u2} α β) _inst_1 _inst_2 (Primcodable.prod.{u1, u2} α β _inst_1 _inst_2) (Prod.mk.{u1, u2} α β)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β], Primrec₂.{u2, u1, max u2 u1} α β (Prod.{u2, u1} α β) _inst_1 _inst_2 (Primcodable.prod.{u2, u1} α β _inst_1 _inst_2) (Prod.mk.{u2, u1} α β)
-Case conversion may be inaccurate. Consider using '#align primrec₂.pair Primrec₂.pairₓ'. -/
 protected theorem pair : Primrec₂ (@Prod.mk α β) :=
   Primrec.pair Primrec.fst Primrec.snd
 #align primrec₂.pair Primrec₂.pair
 
-/- warning: primrec₂.left -> Primrec₂.left is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β], Primrec₂.{u1, u2, u1} α β α _inst_1 _inst_2 _inst_1 (fun (a : α) (b : β) => a)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β], Primrec₂.{u2, u1, u2} α β α _inst_1 _inst_2 _inst_1 (fun (a : α) (b : β) => a)
-Case conversion may be inaccurate. Consider using '#align primrec₂.left Primrec₂.leftₓ'. -/
 theorem left : Primrec₂ fun (a : α) (b : β) => a :=
   Primrec.fst
 #align primrec₂.left Primrec₂.left
 
-/- warning: primrec₂.right -> Primrec₂.right is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β], Primrec₂.{u1, u2, u2} α β β _inst_1 _inst_2 _inst_2 (fun (a : α) (b : β) => b)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β], Primrec₂.{u2, u1, u1} α β β _inst_1 _inst_2 _inst_2 (fun (a : α) (b : β) => b)
-Case conversion may be inaccurate. Consider using '#align primrec₂.right Primrec₂.rightₓ'. -/
 theorem right : Primrec₂ fun (a : α) (b : β) => b :=
   Primrec.snd
 #align primrec₂.right Primrec₂.right
@@ -673,53 +539,23 @@ theorem unpaired' {f : ℕ → ℕ → ℕ} : Nat.Primrec (Nat.unpaired f) ↔ P
 #align primrec₂.unpaired' Primrec₂.unpaired'
 -/
 
-/- warning: primrec₂.encode_iff -> Primrec₂.encode_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, 0} α β Nat _inst_1 _inst_2 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) (b : β) => Encodable.encode.{u3} σ (Primcodable.toEncodable.{u3} σ _inst_3) (f a b))) (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f)
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, 0} α β Nat _inst_1 _inst_2 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) (b : β) => Encodable.encode.{u1} σ (Primcodable.toEncodable.{u1} σ _inst_3) (f a b))) (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f)
-Case conversion may be inaccurate. Consider using '#align primrec₂.encode_iff Primrec₂.encode_iffₓ'. -/
 theorem encode_iff {f : α → β → σ} : (Primrec₂ fun a b => encode (f a b)) ↔ Primrec₂ f :=
   Primrec.encode_iff
 #align primrec₂.encode_iff Primrec₂.encode_iff
 
-/- warning: primrec₂.option_some_iff -> Primrec₂.option_some_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, u3} α β (Option.{u3} σ) _inst_1 _inst_2 (Primcodable.option.{u3} σ _inst_3) (fun (a : α) (b : β) => Option.some.{u3} σ (f a b))) (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f)
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, u1} α β (Option.{u1} σ) _inst_1 _inst_2 (Primcodable.option.{u1} σ _inst_3) (fun (a : α) (b : β) => Option.some.{u1} σ (f a b))) (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f)
-Case conversion may be inaccurate. Consider using '#align primrec₂.option_some_iff Primrec₂.option_some_iffₓ'. -/
 theorem option_some_iff {f : α → β → σ} : (Primrec₂ fun a b => some (f a b)) ↔ Primrec₂ f :=
   Primrec.option_some_iff
 #align primrec₂.option_some_iff Primrec₂.option_some_iff
 
-/- warning: primrec₂.of_nat_iff -> Primrec₂.ofNat_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_4 : Denumerable.{u1} α] [_inst_5 : Denumerable.{u2} β] [_inst_6 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, u3} α β σ (Primcodable.ofDenumerable.{u1} α _inst_4) (Primcodable.ofDenumerable.{u2} β _inst_5) _inst_6 f) (Primrec₂.{0, 0, u3} Nat Nat σ (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_6 (fun (m : Nat) (n : Nat) => f (Denumerable.ofNat.{u1} α _inst_4 m) (Denumerable.ofNat.{u2} β _inst_5 n)))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_4 : Denumerable.{u3} α] [_inst_5 : Denumerable.{u2} β] [_inst_6 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, u1} α β σ (Primcodable.ofDenumerable.{u3} α _inst_4) (Primcodable.ofDenumerable.{u2} β _inst_5) _inst_6 f) (Primrec₂.{0, 0, u1} Nat Nat σ (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_6 (fun (m : Nat) (n : Nat) => f (Denumerable.ofNat.{u3} α _inst_4 m) (Denumerable.ofNat.{u2} β _inst_5 n)))
-Case conversion may be inaccurate. Consider using '#align primrec₂.of_nat_iff Primrec₂.ofNat_iffₓ'. -/
 theorem ofNat_iff {α β σ} [Denumerable α] [Denumerable β] [Primcodable σ] {f : α → β → σ} :
     Primrec₂ f ↔ Primrec₂ fun m n : ℕ => f (ofNat α m) (ofNat β n) :=
   (Primrec.ofNat_iff.trans <| by simp).trans unpaired
 #align primrec₂.of_nat_iff Primrec₂.ofNat_iff
 
-/- warning: primrec₂.uncurry -> Primrec₂.uncurry is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec.{max u1 u2, u3} (Prod.{u1, u2} α β) σ (Primcodable.prod.{u1, u2} α β _inst_1 _inst_2) _inst_3 (Function.uncurry.{u1, u2, u3} α β σ f)) (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec.{max u3 u2, u1} (Prod.{u2, u3} α β) σ (Primcodable.prod.{u2, u3} α β _inst_1 _inst_2) _inst_3 (Function.uncurry.{u2, u3, u1} α β σ f)) (Primrec₂.{u2, u3, u1} α β σ _inst_1 _inst_2 _inst_3 f)
-Case conversion may be inaccurate. Consider using '#align primrec₂.uncurry Primrec₂.uncurryₓ'. -/
 theorem uncurry {f : α → β → σ} : Primrec (Function.uncurry f) ↔ Primrec₂ f := by
   rw [show Function.uncurry f = fun p : α × β => f p.1 p.2 from funext fun ⟨a, b⟩ => rfl] <;> rfl
 #align primrec₂.uncurry Primrec₂.uncurry
 
-/- warning: primrec₂.curry -> Primrec₂.curry is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : (Prod.{u1, u2} α β) -> σ}, Iff (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 (Function.curry.{u1, u2, u3} α β σ f)) (Primrec.{max u1 u2, u3} (Prod.{u1, u2} α β) σ (Primcodable.prod.{u1, u2} α β _inst_1 _inst_2) _inst_3 f)
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : (Prod.{u3, u2} α β) -> σ}, Iff (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 (Function.curry.{u3, u2, u1} α β σ f)) (Primrec.{max u3 u2, u1} (Prod.{u3, u2} α β) σ (Primcodable.prod.{u3, u2} α β _inst_1 _inst_2) _inst_3 f)
-Case conversion may be inaccurate. Consider using '#align primrec₂.curry Primrec₂.curryₓ'. -/
 theorem curry {f : α × β → σ} : Primrec₂ (Function.curry f) ↔ Primrec f := by
   rw [← uncurry, Function.uncurry_curry]
 #align primrec₂.curry Primrec₂.curry
@@ -732,34 +568,16 @@ variable {α : Type _} {β : Type _} {γ : Type _} {δ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
-/- warning: primrec.comp₂ -> Primrec.comp₂ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {σ : Type.{u4}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_5 : Primcodable.{u4} σ] {f : γ -> σ} {g : α -> β -> γ}, (Primrec.{u3, u4} γ σ _inst_3 _inst_5 f) -> (Primrec₂.{u1, u2, u3} α β γ _inst_1 _inst_2 _inst_3 g) -> (Primrec₂.{u1, u2, u4} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (g a b)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u4}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] [_inst_3 : Primcodable.{u4} γ] [_inst_5 : Primcodable.{u3} σ] {f : γ -> σ} {g : α -> β -> γ}, (Primrec.{u4, u3} γ σ _inst_3 _inst_5 f) -> (Primrec₂.{u2, u1, u4} α β γ _inst_1 _inst_2 _inst_3 g) -> (Primrec₂.{u2, u1, u3} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (g a b)))
-Case conversion may be inaccurate. Consider using '#align primrec.comp₂ Primrec.comp₂ₓ'. -/
 theorem Primrec.comp₂ {f : γ → σ} {g : α → β → γ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a b => f (g a b) :=
   hf.comp hg
 #align primrec.comp₂ Primrec.comp₂
 
-/- warning: primrec₂.comp -> Primrec₂.comp is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {σ : Type.{u4}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_5 : Primcodable.{u4} σ] {f : β -> γ -> σ} {g : α -> β} {h : α -> γ}, (Primrec₂.{u2, u3, u4} β γ σ _inst_2 _inst_3 _inst_5 f) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 g) -> (Primrec.{u1, u3} α γ _inst_1 _inst_3 h) -> (Primrec.{u1, u4} α σ _inst_1 _inst_5 (fun (a : α) => f (g a) (h a)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u4}} {γ : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u4} β] [_inst_3 : Primcodable.{u3} γ] [_inst_5 : Primcodable.{u2} σ] {f : β -> γ -> σ} {g : α -> β} {h : α -> γ}, (Primrec₂.{u4, u3, u2} β γ σ _inst_2 _inst_3 _inst_5 f) -> (Primrec.{u1, u4} α β _inst_1 _inst_2 g) -> (Primrec.{u1, u3} α γ _inst_1 _inst_3 h) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 (fun (a : α) => f (g a) (h a)))
-Case conversion may be inaccurate. Consider using '#align primrec₂.comp Primrec₂.compₓ'. -/
 theorem Primrec₂.comp {f : β → γ → σ} {g : α → β} {h : α → γ} (hf : Primrec₂ f) (hg : Primrec g)
     (hh : Primrec h) : Primrec fun a => f (g a) (h a) :=
   hf.comp (hg.pair hh)
 #align primrec₂.comp Primrec₂.comp
 
-/- warning: primrec₂.comp₂ -> Primrec₂.comp₂ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {δ : Type.{u4}} {σ : Type.{u5}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u4} δ] [_inst_5 : Primcodable.{u5} σ] {f : γ -> δ -> σ} {g : α -> β -> γ} {h : α -> β -> δ}, (Primrec₂.{u3, u4, u5} γ δ σ _inst_3 _inst_4 _inst_5 f) -> (Primrec₂.{u1, u2, u3} α β γ _inst_1 _inst_2 _inst_3 g) -> (Primrec₂.{u1, u2, u4} α β δ _inst_1 _inst_2 _inst_4 h) -> (Primrec₂.{u1, u2, u5} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (g a b) (h a b)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u5}} {δ : Type.{u4}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] [_inst_3 : Primcodable.{u5} γ] [_inst_4 : Primcodable.{u4} δ] [_inst_5 : Primcodable.{u3} σ] {f : γ -> δ -> σ} {g : α -> β -> γ} {h : α -> β -> δ}, (Primrec₂.{u5, u4, u3} γ δ σ _inst_3 _inst_4 _inst_5 f) -> (Primrec₂.{u2, u1, u5} α β γ _inst_1 _inst_2 _inst_3 g) -> (Primrec₂.{u2, u1, u4} α β δ _inst_1 _inst_2 _inst_4 h) -> (Primrec₂.{u2, u1, u3} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (g a b) (h a b)))
-Case conversion may be inaccurate. Consider using '#align primrec₂.comp₂ Primrec₂.comp₂ₓ'. -/
 theorem Primrec₂.comp₂ {f : γ → δ → σ} {g : α → β → γ} {h : α → β → δ} (hf : Primrec₂ f)
     (hg : Primrec₂ g) (hh : Primrec₂ h) : Primrec₂ fun a b => f (g a b) (h a b) :=
   hf.comp hg hh
@@ -772,23 +590,11 @@ theorem PrimrecPred.comp {p : β → Prop} [DecidablePred p] {f : α → β} :
 #align primrec_pred.comp PrimrecPred.comp
 -/
 
-/- warning: primrec_rel.comp -> PrimrecRel.comp is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] {R : β -> γ -> Prop} [_inst_6 : forall (a : β) (b : γ), Decidable (R a b)] {f : α -> β} {g : α -> γ}, (PrimrecRel.{u2, u3} β γ _inst_2 _inst_3 R (fun (a : β) (b : γ) => _inst_6 a b)) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 f) -> (Primrec.{u1, u3} α γ _inst_1 _inst_3 g) -> (PrimrecPred.{u1} α _inst_1 (fun (a : α) => R (f a) (g a)) (fun (a : α) => _inst_6 (f a) (g a)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_3 : Primcodable.{u2} γ] {R : β -> γ -> Prop} [_inst_6 : forall (a : β) (b : γ), Decidable (R a b)] {f : α -> β} {g : α -> γ}, (PrimrecRel.{u3, u2} β γ _inst_2 _inst_3 R (fun (a : β) (b : γ) => _inst_6 a b)) -> (Primrec.{u1, u3} α β _inst_1 _inst_2 f) -> (Primrec.{u1, u2} α γ _inst_1 _inst_3 g) -> (PrimrecPred.{u1} α _inst_1 (fun (a : α) => R (f a) (g a)) (fun (a : α) => _inst_6 (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec_rel.comp PrimrecRel.compₓ'. -/
 theorem PrimrecRel.comp {R : β → γ → Prop} [∀ a b, Decidable (R a b)] {f : α → β} {g : α → γ} :
     PrimrecRel R → Primrec f → Primrec g → PrimrecPred fun a => R (f a) (g a) :=
   Primrec₂.comp
 #align primrec_rel.comp PrimrecRel.comp
 
-/- warning: primrec_rel.comp₂ -> PrimrecRel.comp₂ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {δ : Type.{u4}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u4} δ] {R : γ -> δ -> Prop} [_inst_6 : forall (a : γ) (b : δ), Decidable (R a b)] {f : α -> β -> γ} {g : α -> β -> δ}, (PrimrecRel.{u3, u4} γ δ _inst_3 _inst_4 R (fun (a : γ) (b : δ) => _inst_6 a b)) -> (Primrec₂.{u1, u2, u3} α β γ _inst_1 _inst_2 _inst_3 f) -> (Primrec₂.{u1, u2, u4} α β δ _inst_1 _inst_2 _inst_4 g) -> (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 (fun (a : α) (b : β) => R (f a b) (g a b)) (fun (a : α) (b : β) => _inst_6 (f a b) (g a b)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u4}} {δ : Type.{u3}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] [_inst_3 : Primcodable.{u4} γ] [_inst_4 : Primcodable.{u3} δ] {R : γ -> δ -> Prop} [_inst_6 : forall (a : γ) (b : δ), Decidable (R a b)] {f : α -> β -> γ} {g : α -> β -> δ}, (PrimrecRel.{u4, u3} γ δ _inst_3 _inst_4 R (fun (a : γ) (b : δ) => _inst_6 a b)) -> (Primrec₂.{u2, u1, u4} α β γ _inst_1 _inst_2 _inst_3 f) -> (Primrec₂.{u2, u1, u3} α β δ _inst_1 _inst_2 _inst_4 g) -> (PrimrecRel.{u2, u1} α β _inst_1 _inst_2 (fun (a : α) (b : β) => R (f a b) (g a b)) (fun (a : α) (b : β) => _inst_6 (f a b) (g a b)))
-Case conversion may be inaccurate. Consider using '#align primrec_rel.comp₂ PrimrecRel.comp₂ₓ'. -/
 theorem PrimrecRel.comp₂ {R : γ → δ → Prop} [∀ a b, Decidable (R a b)] {f : α → β → γ}
     {g : α → β → δ} :
     PrimrecRel R → Primrec₂ f → Primrec₂ g → PrimrecRel fun a b => R (f a b) (g a b) :=
@@ -804,12 +610,6 @@ theorem PrimrecPred.of_eq {α} [Primcodable α] {p q : α → Prop} [DecidablePr
 #align primrec_pred.of_eq PrimrecPred.of_eq
 -/
 
-/- warning: primrec_rel.of_eq -> PrimrecRel.of_eq is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {r : α -> β -> Prop} {s : α -> β -> Prop} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)] [_inst_4 : forall (a : α) (b : β), Decidable (s a b)], (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 r (fun (a : α) (b : β) => _inst_3 a b)) -> (forall (a : α) (b : β), Iff (r a b) (s a b)) -> (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 s (fun (a : α) (b : β) => _inst_4 a b))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {r : α -> β -> Prop} {s : α -> β -> Prop} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)] [_inst_4 : forall (a : α) (b : β), Decidable (s a b)], (PrimrecRel.{u2, u1} α β _inst_1 _inst_2 r (fun (a : α) (b : β) => _inst_3 a b)) -> (forall (a : α) (b : β), Iff (r a b) (s a b)) -> (PrimrecRel.{u2, u1} α β _inst_1 _inst_2 s (fun (a : α) (b : β) => _inst_4 a b))
-Case conversion may be inaccurate. Consider using '#align primrec_rel.of_eq PrimrecRel.of_eqₓ'. -/
 theorem PrimrecRel.of_eq {α β} [Primcodable α] [Primcodable β] {r s : α → β → Prop}
     [∀ a b, Decidable (r a b)] [∀ a b, Decidable (s a b)] (hr : PrimrecRel r)
     (H : ∀ a b, r a b ↔ s a b) : PrimrecRel s :=
@@ -824,22 +624,10 @@ variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
 open Nat.Primrec
 
-/- warning: primrec₂.swap -> Primrec₂.swap is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f) -> (Primrec₂.{u2, u1, u3} β α σ _inst_2 _inst_1 _inst_3 (Function.swap.{succ u1, succ u2, succ u3} α β (fun (ᾰ : α) (ᾰ : β) => σ) f))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f) -> (Primrec₂.{u2, u3, u1} β α σ _inst_2 _inst_1 _inst_3 (Function.swap.{succ u3, succ u2, succ u1} α β (fun (ᾰ : α) (ᾰ : β) => σ) f))
-Case conversion may be inaccurate. Consider using '#align primrec₂.swap Primrec₂.swapₓ'. -/
 theorem swap {f : α → β → σ} (h : Primrec₂ f) : Primrec₂ (swap f) :=
   h.comp₂ Primrec₂.right Primrec₂.left
 #align primrec₂.swap Primrec₂.swap
 
-/- warning: primrec₂.nat_iff -> Primrec₂.nat_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f) (Nat.Primrec (Nat.unpaired.{1} Nat (fun (m : Nat) (n : Nat) => Encodable.encode.{u3} (Option.{u3} σ) (Option.encodable.{u3} σ (Primcodable.toEncodable.{u3} σ _inst_3)) (Option.bind.{u1, u3} α σ (Encodable.decode.{u1} α (Primcodable.toEncodable.{u1} α _inst_1) m) (fun (a : α) => Option.map.{u2, u3} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))))))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f) (Nat.Primrec (Nat.unpaired.{1} Nat (fun (m : Nat) (n : Nat) => Encodable.encode.{u1} (Option.{u1} σ) (Option.encodable.{u1} σ (Primcodable.toEncodable.{u1} σ _inst_3)) (Option.bind.{u3, u1} α σ (Encodable.decode.{u3} α (Primcodable.toEncodable.{u3} α _inst_1) m) (fun (a : α) => Option.map.{u2, u1} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))))))
-Case conversion may be inaccurate. Consider using '#align primrec₂.nat_iff Primrec₂.nat_iffₓ'. -/
 theorem nat_iff {f : α → β → σ} :
     Primrec₂ f ↔
       Nat.Primrec
@@ -854,12 +642,6 @@ theorem nat_iff {f : α → β → σ} :
   simp [Primrec₂, Primrec, this]
 #align primrec₂.nat_iff Primrec₂.nat_iff
 
-/- warning: primrec₂.nat_iff' -> Primrec₂.nat_iff' is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f) (Primrec₂.{0, 0, u3} Nat Nat (Option.{u3} σ) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u3} σ _inst_3) (fun (m : Nat) (n : Nat) => Option.bind.{u1, u3} α σ (Encodable.decode.{u1} α (Primcodable.toEncodable.{u1} α _inst_1) m) (fun (a : α) => Option.map.{u2, u3} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f) (Primrec₂.{0, 0, u1} Nat Nat (Option.{u1} σ) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u1} σ _inst_3) (fun (m : Nat) (n : Nat) => Option.bind.{u3, u1} α σ (Encodable.decode.{u3} α (Primcodable.toEncodable.{u3} α _inst_1) m) (fun (a : α) => Option.map.{u2, u1} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))))
-Case conversion may be inaccurate. Consider using '#align primrec₂.nat_iff' Primrec₂.nat_iff'ₓ'. -/
 theorem nat_iff' {f : α → β → σ} :
     Primrec₂ f ↔
       Primrec₂ fun m n : ℕ => Option.bind (decode α m) fun a => Option.map (f a) (decode β n) :=
@@ -874,12 +656,6 @@ variable {α : Type _} {β : Type _} {γ : Type _} {δ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
-/- warning: primrec.to₂ -> Primrec.to₂ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : (Prod.{u1, u2} α β) -> σ}, (Primrec.{max u1 u2, u3} (Prod.{u1, u2} α β) σ (Primcodable.prod.{u1, u2} α β _inst_1 _inst_2) _inst_5 f) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (Prod.mk.{u1, u2} α β a b)))
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u1} σ] {f : (Prod.{u3, u2} α β) -> σ}, (Primrec.{max u3 u2, u1} (Prod.{u3, u2} α β) σ (Primcodable.prod.{u3, u2} α β _inst_1 _inst_2) _inst_5 f) -> (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (Prod.mk.{u3, u2} α β a b)))
-Case conversion may be inaccurate. Consider using '#align primrec.to₂ Primrec.to₂ₓ'. -/
 theorem to₂ {f : α × β → σ} (hf : Primrec f) : Primrec₂ fun a b => f (a, b) :=
   hf.of_eq fun ⟨a, b⟩ => rfl
 #align primrec.to₂ Primrec.to₂
@@ -918,23 +694,11 @@ theorem nat_rec₁ {f : ℕ → α → α} (a : α) (hf : Primrec₂ f) : Primre
 #align primrec.nat_elim₁ Primrec.nat_rec₁
 -/
 
-/- warning: primrec.nat_cases' -> Primrec.nat_casesOn' is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> β} {g : α -> Nat -> β}, (Primrec.{u1, u2} α β _inst_1 _inst_2 f) -> (Primrec₂.{u1, 0, u2} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 g) -> (Primrec₂.{u1, 0, u2} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 (fun (a : α) => Nat.casesOn.{succ u2} β (f a) (g a)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {f : α -> β} {g : α -> Nat -> β}, (Primrec.{u2, u1} α β _inst_1 _inst_2 f) -> (Primrec₂.{u2, 0, u1} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 g) -> (Primrec₂.{u2, 0, u1} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 (fun (a : α) (n : Nat) => Nat.casesOn.{succ u1} (fun (x._@.Mathlib.Computability.Primrec._hyg.4800 : Nat) => β) n (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.nat_cases' Primrec.nat_casesOn'ₓ'. -/
 theorem nat_casesOn' {f : α → β} {g : α → ℕ → β} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a => Nat.casesOn (f a) (g a) :=
   nat_rec hf <| hg.comp₂ Primrec₂.left <| comp₂ fst Primrec₂.right
 #align primrec.nat_cases' Primrec.nat_casesOn'
 
-/- warning: primrec.nat_cases -> Primrec.nat_casesOn is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> Nat} {g : α -> β} {h : α -> Nat -> β}, (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 g) -> (Primrec₂.{u1, 0, u2} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 h) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 (fun (a : α) => Nat.casesOn.{succ u2} β (g a) (h a) (f a)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {f : α -> Nat} {g : α -> β} {h : α -> Nat -> β}, (Primrec.{u2, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 g) -> (Primrec₂.{u2, 0, u1} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 h) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 (fun (a : α) => Nat.casesOn.{succ u1} (fun (x._@.Mathlib.Computability.Primrec._hyg.4875 : Nat) => β) (f a) (g a) (h a)))
-Case conversion may be inaccurate. Consider using '#align primrec.nat_cases Primrec.nat_casesOnₓ'. -/
 theorem nat_casesOn {f : α → ℕ} {g : α → β} {h : α → ℕ → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (f a).cases (g a) (h a) :=
   (nat_casesOn' hg hh).comp Primrec.id hf
@@ -946,24 +710,12 @@ theorem nat_casesOn₁ {f : ℕ → α} (a : α) (hf : Primrec f) : Primrec (Nat
 #align primrec.nat_cases₁ Primrec.nat_casesOn₁
 -/
 
-/- warning: primrec.nat_iterate -> Primrec.nat_iterate is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> Nat} {g : α -> β} {h : α -> β -> β}, (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 g) -> (Primrec₂.{u1, u2, u2} α β β _inst_1 _inst_2 _inst_2 h) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 (fun (a : α) => Nat.iterate.{succ u2} β (h a) (f a) (g a)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {f : α -> Nat} {g : α -> β} {h : α -> β -> β}, (Primrec.{u2, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 g) -> (Primrec₂.{u2, u1, u1} α β β _inst_1 _inst_2 _inst_2 h) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 (fun (a : α) => Nat.iterate.{succ u1} β (h a) (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.nat_iterate Primrec.nat_iterateₓ'. -/
 theorem nat_iterate {f : α → ℕ} {g : α → β} {h : α → β → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (h a^[f a]) (g a) :=
   (nat_rec' hf hg (hh.comp₂ Primrec₂.left <| snd.comp₂ Primrec₂.right)).of_eq fun a => by
     induction f a <;> simp [*, Function.iterate_succ']
 #align primrec.nat_iterate Primrec.nat_iterate
 
-/- warning: primrec.option_cases -> Primrec.option_casesOn is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {o : α -> (Option.{u2} β)} {f : α -> σ} {g : α -> β -> σ}, (Primrec.{u1, u2} α (Option.{u2} β) _inst_1 (Primcodable.option.{u2} β _inst_2) o) -> (Primrec.{u1, u3} α σ _inst_1 _inst_5 f) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u1, u3} α σ _inst_1 _inst_5 (fun (a : α) => Option.casesOn.{succ u3, u2} β (fun (_x : Option.{u2} β) => σ) (o a) (f a) (g a)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_5 : Primcodable.{u1} σ] {o : α -> (Option.{u3} β)} {f : α -> σ} {g : α -> β -> σ}, (Primrec.{u2, u3} α (Option.{u3} β) _inst_1 (Primcodable.option.{u3} β _inst_2) o) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 f) -> (Primrec₂.{u2, u3, u1} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 (fun (a : α) => Option.casesOn.{succ u1, u3} β (fun (_x : Option.{u3} β) => σ) (o a) (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.option_cases Primrec.option_casesOnₓ'. -/
 theorem option_casesOn {o : α → Option β} {f : α → σ} {g : α → β → σ} (ho : Primrec o)
     (hf : Primrec f) (hg : Primrec₂ g) :
     @Primrec _ σ _ _ fun a => Option.casesOn (o a) (f a) (g a) :=
@@ -976,12 +728,6 @@ theorem option_casesOn {o : α → Option β} {f : α → σ} {g : α → β →
       fun a => by cases' o a with b <;> simp [encodek] <;> rfl
 #align primrec.option_cases Primrec.option_casesOn
 
-/- warning: primrec.option_bind -> Primrec.option_bind is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> (Option.{u2} β)} {g : α -> β -> (Option.{u3} σ)}, (Primrec.{u1, u2} α (Option.{u2} β) _inst_1 (Primcodable.option.{u2} β _inst_2) f) -> (Primrec₂.{u1, u2, u3} α β (Option.{u3} σ) _inst_1 _inst_2 (Primcodable.option.{u3} σ _inst_5) g) -> (Primrec.{u1, u3} α (Option.{u3} σ) _inst_1 (Primcodable.option.{u3} σ _inst_5) (fun (a : α) => Option.bind.{u2, u3} β σ (f a) (g a)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_5 : Primcodable.{u2} σ] {f : α -> (Option.{u3} β)} {g : α -> β -> (Option.{u2} σ)}, (Primrec.{u1, u3} α (Option.{u3} β) _inst_1 (Primcodable.option.{u3} β _inst_2) f) -> (Primrec₂.{u1, u3, u2} α β (Option.{u2} σ) _inst_1 _inst_2 (Primcodable.option.{u2} σ _inst_5) g) -> (Primrec.{u1, u2} α (Option.{u2} σ) _inst_1 (Primcodable.option.{u2} σ _inst_5) (fun (a : α) => Option.bind.{u3, u2} β σ (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.option_bind Primrec.option_bindₓ'. -/
 theorem option_bind {f : α → Option β} {g : α → β → Option σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).bind (g a) :=
   (option_casesOn hf (const none) hg).of_eq fun a => by cases f a <;> rfl
@@ -993,23 +739,11 @@ theorem option_bind₁ {f : α → Option σ} (hf : Primrec f) : Primrec fun o =
 #align primrec.option_bind₁ Primrec.option_bind₁
 -/
 
-/- warning: primrec.option_map -> Primrec.option_map is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> (Option.{u2} β)} {g : α -> β -> σ}, (Primrec.{u1, u2} α (Option.{u2} β) _inst_1 (Primcodable.option.{u2} β _inst_2) f) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u1, u3} α (Option.{u3} σ) _inst_1 (Primcodable.option.{u3} σ _inst_5) (fun (a : α) => Option.map.{u2, u3} β σ (g a) (f a)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_5 : Primcodable.{u1} σ] {f : α -> (Option.{u3} β)} {g : α -> β -> σ}, (Primrec.{u2, u3} α (Option.{u3} β) _inst_1 (Primcodable.option.{u3} β _inst_2) f) -> (Primrec₂.{u2, u3, u1} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u2, u1} α (Option.{u1} σ) _inst_1 (Primcodable.option.{u1} σ _inst_5) (fun (a : α) => Option.map.{u3, u1} β σ (g a) (f a)))
-Case conversion may be inaccurate. Consider using '#align primrec.option_map Primrec.option_mapₓ'. -/
 theorem option_map {f : α → Option β} {g : α → β → σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).map (g a) :=
   option_bind hf (option_some.comp₂ hg)
 #align primrec.option_map Primrec.option_map
 
-/- warning: primrec.option_map₁ -> Primrec.option_map₁ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_5 : Primcodable.{u2} σ] {f : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_5 f) -> (Primrec.{u1, u2} (Option.{u1} α) (Option.{u2} σ) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u2} σ _inst_5) (Option.map.{u1, u2} α σ f))
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_5 : Primcodable.{u1} σ] {f : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_5 f) -> (Primrec.{u2, u1} (Option.{u2} α) (Option.{u1} σ) (Primcodable.option.{u2} α _inst_1) (Primcodable.option.{u1} σ _inst_5) (Option.map.{u2, u1} α σ f))
-Case conversion may be inaccurate. Consider using '#align primrec.option_map₁ Primrec.option_map₁ₓ'. -/
 theorem option_map₁ {f : α → σ} (hf : Primrec f) : Primrec (Option.map f) :=
   option_map Primrec.id (hf.comp snd).to₂
 #align primrec.option_map₁ Primrec.option_map₁
@@ -1034,24 +768,12 @@ theorem option_getD : Primrec₂ (@Option.getD α) :=
 #align primrec.option_get_or_else Primrec.option_getD
 -/
 
-/- warning: primrec.bind_decode_iff -> Primrec.bind_decode_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> β -> (Option.{u3} σ)}, Iff (Primrec₂.{u1, 0, u3} α Nat (Option.{u3} σ) _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u3} σ _inst_5) (fun (a : α) (n : Nat) => Option.bind.{u2, u3} β σ (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n) (f a))) (Primrec₂.{u1, u2, u3} α β (Option.{u3} σ) _inst_1 _inst_2 (Primcodable.option.{u3} σ _inst_5) f)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> β -> (Option.{u3} σ)}, Iff (Primrec₂.{u2, 0, u3} α Nat (Option.{u3} σ) _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u3} σ _inst_5) (fun (a : α) (n : Nat) => Option.bind.{u1, u3} β σ (Encodable.decode.{u1} β (Primcodable.toEncodable.{u1} β _inst_2) n) (f a))) (Primrec₂.{u2, u1, u3} α β (Option.{u3} σ) _inst_1 _inst_2 (Primcodable.option.{u3} σ _inst_5) f)
-Case conversion may be inaccurate. Consider using '#align primrec.bind_decode_iff Primrec.bind_decode_iffₓ'. -/
 theorem bind_decode_iff {f : α → β → Option σ} :
     (Primrec₂ fun a n => (decode β n).bind (f a)) ↔ Primrec₂ f :=
   ⟨fun h => by simpa [encodek] using h.comp fst ((@Primrec.encode β _).comp snd), fun h =>
     option_bind (Primrec.decode.comp snd) <| h.comp (fst.comp fst) snd⟩
 #align primrec.bind_decode_iff Primrec.bind_decode_iff
 
-/- warning: primrec.map_decode_iff -> Primrec.map_decode_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, 0, u3} α Nat (Option.{u3} σ) _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u3} σ _inst_5) (fun (a : α) (n : Nat) => Option.map.{u2, u3} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))) (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_5 f)
-but is expected to have type
-  forall {α : Type.{u3}} {β : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u1} β] [_inst_5 : Primcodable.{u2} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, 0, u2} α Nat (Option.{u2} σ) _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u2} σ _inst_5) (fun (a : α) (n : Nat) => Option.map.{u1, u2} β σ (f a) (Encodable.decode.{u1} β (Primcodable.toEncodable.{u1} β _inst_2) n))) (Primrec₂.{u3, u1, u2} α β σ _inst_1 _inst_2 _inst_5 f)
-Case conversion may be inaccurate. Consider using '#align primrec.map_decode_iff Primrec.map_decode_iffₓ'. -/
 theorem map_decode_iff {f : α → β → σ} :
     (Primrec₂ fun a n => (decode β n).map (f a)) ↔ Primrec₂ f :=
   bind_decode_iff.trans Primrec₂.option_some_iff
@@ -1075,34 +797,16 @@ theorem nat_mul : Primrec₂ ((· * ·) : ℕ → ℕ → ℕ) :=
 #align primrec.nat_mul Primrec.nat_mul
 -/
 
-/- warning: primrec.cond -> Primrec.cond is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_5 : Primcodable.{u2} σ] {c : α -> Bool} {f : α -> σ} {g : α -> σ}, (Primrec.{u1, 0} α Bool _inst_1 Primcodable.bool c) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 g) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 (fun (a : α) => cond.{u2} σ (c a) (f a) (g a)))
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_5 : Primcodable.{u1} σ] {c : α -> Bool} {f : α -> σ} {g : α -> σ}, (Primrec.{u2, 0} α Bool _inst_1 Primcodable.bool c) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 f) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 g) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 (fun (a : α) => cond.{u1} σ (c a) (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.cond Primrec.condₓ'. -/
 theorem cond {c : α → Bool} {f : α → σ} {g : α → σ} (hc : Primrec c) (hf : Primrec f)
     (hg : Primrec g) : Primrec fun a => cond (c a) (f a) (g a) :=
   (nat_casesOn (encode_iff.2 hc) hg (hf.comp fst).to₂).of_eq fun a => by cases c a <;> rfl
 #align primrec.cond Primrec.cond
 
-/- warning: primrec.ite -> Primrec.ite is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_5 : Primcodable.{u2} σ] {c : α -> Prop} [_inst_6 : DecidablePred.{succ u1} α c] {f : α -> σ} {g : α -> σ}, (PrimrecPred.{u1} α _inst_1 c (fun (a : α) => _inst_6 a)) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 g) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 (fun (a : α) => ite.{succ u2} σ (c a) (_inst_6 a) (f a) (g a)))
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_5 : Primcodable.{u1} σ] {c : α -> Prop} [_inst_6 : DecidablePred.{succ u2} α c] {f : α -> σ} {g : α -> σ}, (PrimrecPred.{u2} α _inst_1 c (fun (a : α) => _inst_6 a)) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 f) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 g) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 (fun (a : α) => ite.{succ u1} σ (c a) (_inst_6 a) (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.ite Primrec.iteₓ'. -/
 theorem ite {c : α → Prop} [DecidablePred c] {f : α → σ} {g : α → σ} (hc : PrimrecPred c)
     (hf : Primrec f) (hg : Primrec g) : Primrec fun a => if c a then f a else g a := by
   simpa using cond hc hf hg
 #align primrec.ite Primrec.ite
 
-/- warning: primrec.nat_le -> Primrec.nat_le is a dubious translation:
-lean 3 declaration is
-  PrimrecRel.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (LE.le.{0} Nat Nat.hasLe) (fun (a : Nat) (b : Nat) => Nat.decidableLe a b)
-but is expected to have type
-  PrimrecRel.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (x._@.Mathlib.Computability.Primrec._hyg.6194 : Nat) (x._@.Mathlib.Computability.Primrec._hyg.6196 : Nat) => LE.le.{0} Nat instLENat x._@.Mathlib.Computability.Primrec._hyg.6194 x._@.Mathlib.Computability.Primrec._hyg.6196) (fun (a : Nat) (b : Nat) => Nat.decLe a b)
-Case conversion may be inaccurate. Consider using '#align primrec.nat_le Primrec.nat_leₓ'. -/
 theorem nat_le : PrimrecRel ((· ≤ ·) : ℕ → ℕ → Prop) :=
   (nat_casesOn nat_sub (const true) (const false).to₂).of_eq fun p =>
     by
@@ -1112,22 +816,10 @@ theorem nat_le : PrimrecRel ((· ≤ ·) : ℕ → ℕ → Prop) :=
     · simp [not_le.2 (Nat.lt_of_sub_eq_succ e)]
 #align primrec.nat_le Primrec.nat_le
 
-/- warning: primrec.nat_min -> Primrec.nat_min is a dubious translation:
-lean 3 declaration is
-  Primrec₂.{0, 0, 0} Nat Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (LinearOrder.min.{0} Nat Nat.linearOrder)
-but is expected to have type
-  Primrec₂.{0, 0, 0} Nat Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Min.min.{0} Nat instMinNat)
-Case conversion may be inaccurate. Consider using '#align primrec.nat_min Primrec.nat_minₓ'. -/
 theorem nat_min : Primrec₂ (@min ℕ _) :=
   ite nat_le fst snd
 #align primrec.nat_min Primrec.nat_min
 
-/- warning: primrec.nat_max -> Primrec.nat_max is a dubious translation:
-lean 3 declaration is
-  Primrec₂.{0, 0, 0} Nat Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (LinearOrder.max.{0} Nat Nat.linearOrder)
-but is expected to have type
-  Primrec₂.{0, 0, 0} Nat Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Max.max.{0} Nat Nat.instMaxNat)
-Case conversion may be inaccurate. Consider using '#align primrec.nat_max Primrec.nat_maxₓ'. -/
 theorem nat_max : Primrec₂ (@max ℕ _) :=
   ite (nat_le.comp Primrec.fst Primrec.snd) snd fst
 #align primrec.nat_max Primrec.nat_max
@@ -1193,33 +885,15 @@ protected theorem eq [DecidableEq α] : PrimrecRel (@Eq α) :=
 #align primrec.eq Primrec.eq
 -/
 
-/- warning: primrec.nat_lt -> Primrec.nat_lt is a dubious translation:
-lean 3 declaration is
-  PrimrecRel.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (LT.lt.{0} Nat Nat.hasLt) (fun (a : Nat) (b : Nat) => Nat.decidableLt a b)
-but is expected to have type
-  PrimrecRel.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (x._@.Mathlib.Computability.Primrec._hyg.6908 : Nat) (x._@.Mathlib.Computability.Primrec._hyg.6910 : Nat) => LT.lt.{0} Nat instLTNat x._@.Mathlib.Computability.Primrec._hyg.6908 x._@.Mathlib.Computability.Primrec._hyg.6910) (fun (a : Nat) (b : Nat) => Nat.decLt a b)
-Case conversion may be inaccurate. Consider using '#align primrec.nat_lt Primrec.nat_ltₓ'. -/
 theorem nat_lt : PrimrecRel ((· < ·) : ℕ → ℕ → Prop) :=
   (nat_le.comp snd fst).Not.of_eq fun p => by simp
 #align primrec.nat_lt Primrec.nat_lt
 
-/- warning: primrec.option_guard -> Primrec.option_guard is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {p : α -> β -> Prop} [_inst_6 : forall (a : α) (b : β), Decidable (p a b)], (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 p (fun (a : α) (b : β) => _inst_6 a b)) -> (forall {f : α -> β}, (Primrec.{u1, u2} α β _inst_1 _inst_2 f) -> (Primrec.{u1, u2} α (Option.{u2} β) _inst_1 (Primcodable.option.{u2} β _inst_2) (fun (a : α) => Option.guard.{u2} β (p a) (fun (a_1 : β) => _inst_6 a a_1) (f a))))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {p : α -> β -> Prop} [_inst_6 : forall (a : α) (b : β), Decidable (p a b)], (PrimrecRel.{u2, u1} α β _inst_1 _inst_2 p (fun (a : α) (b : β) => _inst_6 a b)) -> (forall {f : α -> β}, (Primrec.{u2, u1} α β _inst_1 _inst_2 f) -> (Primrec.{u2, u1} α (Option.{u1} β) _inst_1 (Primcodable.option.{u1} β _inst_2) (fun (a : α) => Option.guard.{u1} β (p a) (fun (a_1 : β) => _inst_6 a a_1) (f a))))
-Case conversion may be inaccurate. Consider using '#align primrec.option_guard Primrec.option_guardₓ'. -/
 theorem option_guard {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hp : PrimrecRel p) {f : α → β}
     (hf : Primrec f) : Primrec fun a => Option.guard (p a) (f a) :=
   ite (hp.comp Primrec.id hf) (option_some_iff.2 hf) (const none)
 #align primrec.option_guard Primrec.option_guard
 
-/- warning: primrec.option_orelse -> Primrec.option_orElse is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : Primcodable.{u1} α], Primrec₂.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α)
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : Primcodable.{u1} α], Primrec₂.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (fun (x._@.Mathlib.Computability.Primrec._hyg.7041 : Option.{u1} α) (x._@.Mathlib.Computability.Primrec._hyg.7043 : Option.{u1} α) => HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) x._@.Mathlib.Computability.Primrec._hyg.7041 (fun (x._@.Mathlib.Computability.Primrec._hyg.7053 : Unit) => x._@.Mathlib.Computability.Primrec._hyg.7043))
-Case conversion may be inaccurate. Consider using '#align primrec.option_orelse Primrec.option_orElseₓ'. -/
 theorem option_orElse : Primrec₂ ((· <|> ·) : Option α → Option α → Option α) :=
   (option_casesOn fst snd (fst.comp fst).to₂).of_eq fun ⟨o₁, o₂⟩ => by cases o₁ <;> cases o₂ <;> rfl
 #align primrec.option_orelse Primrec.option_orElse
@@ -1231,12 +905,6 @@ protected theorem decode₂ : Primrec (decode₂ α) :=
 #align primrec.decode₂ Primrec.decode₂
 -/
 
-/- warning: primrec.list_find_index₁ -> Primrec.list_findIdx₁ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {p : α -> β -> Prop} [_inst_6 : forall (a : α) (b : β), Decidable (p a b)], (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 p (fun (a : α) (b : β) => _inst_6 a b)) -> (forall (l : List.{u2} β), Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => List.findIndex.{u2} β (p a) (fun (a_1 : β) => _inst_6 a a_1) l))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {p : α -> β -> Bool}, (Primrec₂.{u2, u1, 0} α β Bool _inst_1 _inst_2 Primcodable.bool p) -> (forall (hp : List.{u1} β), Primrec.{u2, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => List.findIdx.{u1} β (p a) hp))
-Case conversion may be inaccurate. Consider using '#align primrec.list_find_index₁ Primrec.list_findIdx₁ₓ'. -/
 theorem list_findIdx₁ {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hp : PrimrecRel p) :
     ∀ l : List β, Primrec fun a => l.findIndex (p a)
   | [] => const 0
@@ -1249,12 +917,6 @@ theorem list_indexOf₁ [DecidableEq α] (l : List α) : Primrec fun a => l.inde
 #align primrec.list_index_of₁ Primrec.list_indexOf₁
 -/
 
-/- warning: primrec.dom_fintype -> Primrec.dom_fintype is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_5 : Primcodable.{u2} σ] [_inst_6 : Fintype.{u1} α] (f : α -> σ), Primrec.{u1, u2} α σ _inst_1 _inst_5 f
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_5 : Primcodable.{u1} σ] [_inst_6 : Fintype.{u2} α] (f : α -> σ), Primrec.{u2, u1} α σ _inst_1 _inst_5 f
-Case conversion may be inaccurate. Consider using '#align primrec.dom_fintype Primrec.dom_fintypeₓ'. -/
 theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
   let ⟨l, nd, m⟩ := Finite.exists_univ_list α
   option_some_iff.1 <| by
@@ -1264,11 +926,6 @@ theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
 #align primrec.dom_fintype Primrec.dom_fintype
 
 /- warning: primrec.nat_bodd_div2 clashes with [anonymous] -> [anonymous]
-warning: primrec.nat_bodd_div2 -> [anonymous] is a dubious translation:
-lean 3 declaration is
-  Primrec.{0, 0} Nat (Prod.{0, 0} Bool Nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.prod.{0, 0} Bool Nat Primcodable.bool (Primcodable.ofDenumerable.{0} Nat Denumerable.nat)) Nat.boddDiv2
-but is expected to have type
-  forall {α : Type.{u}} {β : Type.{v}}, (Nat -> α -> β) -> Nat -> (List.{u} α) -> (List.{v} β)
 Case conversion may be inaccurate. Consider using '#align primrec.nat_bodd_div2 [anonymous]ₓ'. -/
 theorem [anonymous] : Primrec Nat.boddDiv2 :=
   (nat_rec' Primrec.id (const (false, 0))
@@ -1293,22 +950,10 @@ theorem nat_div2 : Primrec Nat.div2 :=
 #align primrec.nat_div2 Primrec.nat_div2
 -/
 
-/- warning: primrec.nat_bit0 -> Primrec.nat_double is a dubious translation:
-lean 3 declaration is
-  Primrec.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (bit0.{0} Nat Nat.hasAdd)
-but is expected to have type
-  Primrec.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (n : Nat) => HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) n)
-Case conversion may be inaccurate. Consider using '#align primrec.nat_bit0 Primrec.nat_doubleₓ'. -/
 theorem nat_double : Primrec (@bit0 ℕ _) :=
   nat_add.comp Primrec.id Primrec.id
 #align primrec.nat_bit0 Primrec.nat_double
 
-/- warning: primrec.nat_bit1 -> Primrec.nat_double_succ is a dubious translation:
-lean 3 declaration is
-  Primrec.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (bit1.{0} Nat Nat.hasOne Nat.hasAdd)
-but is expected to have type
-  Primrec.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (n : Nat) => HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) n) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))
-Case conversion may be inaccurate. Consider using '#align primrec.nat_bit1 Primrec.nat_double_succₓ'. -/
 theorem nat_double_succ : Primrec (@bit1 ℕ _ _) :=
   nat_add.comp nat_double (const 1)
 #align primrec.nat_bit1 Primrec.nat_double_succ
@@ -1319,11 +964,6 @@ theorem nat_bit : Primrec₂ Nat.bit :=
 #align primrec.nat_bit Primrec.nat_bit
 
 /- warning: primrec.nat_div_mod clashes with [anonymous] -> [anonymous]
-warning: primrec.nat_div_mod -> [anonymous] is a dubious translation:
-lean 3 declaration is
-  Primrec₂.{0, 0, 0} Nat Nat (Prod.{0, 0} Nat Nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.prod.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat)) (fun (n : Nat) (k : Nat) => Prod.mk.{0, 0} Nat Nat (HDiv.hDiv.{0, 0, 0} Nat Nat Nat (instHDiv.{0} Nat Nat.hasDiv) n k) (HMod.hMod.{0, 0, 0} Nat Nat Nat (instHMod.{0} Nat Nat.hasMod) n k))
-but is expected to have type
-  forall {α : Type.{u}} {β : Type.{v}}, (Nat -> α -> β) -> Nat -> (List.{u} α) -> (List.{v} β)
 Case conversion may be inaccurate. Consider using '#align primrec.nat_div_mod [anonymous]ₓ'. -/
 theorem [anonymous] : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
   let f (a : ℕ × ℕ) : ℕ × ℕ :=
@@ -1517,12 +1157,6 @@ variable {α : Type _} {β : Type _} {γ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable σ]
 
-/- warning: primrec.sum_inl -> Primrec.sum_inl is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β], Primrec.{u1, max u1 u2} α (Sum.{u1, u2} α β) _inst_1 (Primcodable.sum.{u1, u2} α β _inst_1 _inst_2) (Sum.inl.{u1, u2} α β)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β], Primrec.{u2, max u2 u1} α (Sum.{u2, u1} α β) _inst_1 (Primcodable.sum.{u2, u1} α β _inst_1 _inst_2) (Sum.inl.{u2, u1} α β)
-Case conversion may be inaccurate. Consider using '#align primrec.sum_inl Primrec.sum_inlₓ'. -/
 theorem sum_inl : Primrec (@Sum.inl α β) :=
   encode_iff.1 <| nat_double.comp Primrec.encode
 #align primrec.sum_inl Primrec.sum_inl
@@ -1533,12 +1167,6 @@ theorem sum_inr : Primrec (@Sum.inr α β) :=
 #align primrec.sum_inr Primrec.sum_inr
 -/
 
-/- warning: primrec.sum_cases -> Primrec.sum_casesOn is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {σ : Type.{u4}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u4} σ] {f : α -> (Sum.{u2, u3} β γ)} {g : α -> β -> σ} {h : α -> γ -> σ}, (Primrec.{u1, max u2 u3} α (Sum.{u2, u3} β γ) _inst_1 (Primcodable.sum.{u2, u3} β γ _inst_2 _inst_3) f) -> (Primrec₂.{u1, u2, u4} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec₂.{u1, u3, u4} α γ σ _inst_1 _inst_3 _inst_4 h) -> (Primrec.{u1, u4} α σ _inst_1 _inst_4 (fun (a : α) => Sum.casesOn.{succ u4, u2, u3} β γ (fun (_x : Sum.{u2, u3} β γ) => σ) (f a) (g a) (h a)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u4}} {γ : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u4} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u1} σ] {f : α -> (Sum.{u4, u3} β γ)} {g : α -> β -> σ} {h : α -> γ -> σ}, (Primrec.{u2, max u4 u3} α (Sum.{u4, u3} β γ) _inst_1 (Primcodable.sum.{u4, u3} β γ _inst_2 _inst_3) f) -> (Primrec₂.{u2, u4, u1} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec₂.{u2, u3, u1} α γ σ _inst_1 _inst_3 _inst_4 h) -> (Primrec.{u2, u1} α σ _inst_1 _inst_4 (fun (a : α) => Sum.casesOn.{succ u1, u4, u3} β γ (fun (_x : Sum.{u4, u3} β γ) => σ) (f a) (g a) (h a)))
-Case conversion may be inaccurate. Consider using '#align primrec.sum_cases Primrec.sum_casesOnₓ'. -/
 theorem sum_casesOn {f : α → Sum β γ} {g : α → β → σ} {h : α → γ → σ} (hf : Primrec f)
     (hg : Primrec₂ g) (hh : Primrec₂ h) : @Primrec _ σ _ _ fun a => Sum.casesOn (f a) (g a) (h a) :=
   option_some_iff.1 <|
@@ -1554,12 +1182,6 @@ theorem list_cons : Primrec₂ (@List.cons α) :=
 #align primrec.list_cons Primrec.list_cons
 -/
 
-/- warning: primrec.list_cases -> Primrec.list_casesOn is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> σ} {h : α -> (Prod.{u2, u2} β (List.{u2} β)) -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, u2, u3} α (Prod.{u2, u2} β (List.{u2} β)) σ _inst_1 (Primcodable.prod.{u2, u2} β (List.{u2} β) _inst_2 (Primcodable.list.{u2} β _inst_2)) _inst_4 h) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 (fun (a : α) => List.casesOn.{succ u3, u2} β (fun (_x : List.{u2} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u2} β) => h a (Prod.mk.{u2, u2} β (List.{u2} β) b l))))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u1} σ] {f : α -> (List.{u3} β)} {g : α -> σ} {h : α -> (Prod.{u3, u3} β (List.{u3} β)) -> σ}, (Primrec.{u2, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec.{u2, u1} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u2, u3, u1} α (Prod.{u3, u3} β (List.{u3} β)) σ _inst_1 (Primcodable.prod.{u3, u3} β (List.{u3} β) _inst_2 (Primcodable.list.{u3} β _inst_2)) _inst_4 h) -> (Primrec.{u2, u1} α σ _inst_1 _inst_4 (fun (a : α) => List.casesOn.{succ u1, u3} β (fun (_x : List.{u3} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u3} β) => h a (Prod.mk.{u3, u3} β (List.{u3} β) b l))))
-Case conversion may be inaccurate. Consider using '#align primrec.list_cases Primrec.list_casesOnₓ'. -/
 theorem list_casesOn {f : α → List β} {g : α → σ} {h : α → β × List β → σ} :
     Primrec f →
       Primrec g →
@@ -1567,12 +1189,6 @@ theorem list_casesOn {f : α → List β} {g : α → σ} {h : α → β × List
   list_cases' (Primcodable.prim _)
 #align primrec.list_cases Primrec.list_casesOn
 
-/- warning: primrec.list_foldl -> Primrec.list_foldl is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> σ} {h : α -> (Prod.{u3, u2} σ β) -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u3 u2, u3} α (Prod.{u3, u2} σ β) σ _inst_1 (Primcodable.prod.{u3, u2} σ β _inst_4 _inst_2) _inst_4 h) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 (fun (a : α) => List.foldl.{u3, u2} σ β (fun (s : σ) (b : β) => h a (Prod.mk.{u3, u2} σ β s b)) (g a) (f a)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u2} σ] {f : α -> (List.{u3} β)} {g : α -> σ} {h : α -> (Prod.{u2, u3} σ β) -> σ}, (Primrec.{u1, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u3 u2, u2} α (Prod.{u2, u3} σ β) σ _inst_1 (Primcodable.prod.{u2, u3} σ β _inst_4 _inst_2) _inst_4 h) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 (fun (a : α) => List.foldl.{u2, u3} σ β (fun (s : σ) (b : β) => h a (Prod.mk.{u2, u3} σ β s b)) (g a) (f a)))
-Case conversion may be inaccurate. Consider using '#align primrec.list_foldl Primrec.list_foldlₓ'. -/
 theorem list_foldl {f : α → List β} {g : α → σ} {h : α → σ × β → σ} :
     Primrec f →
       Primrec g → Primrec₂ h → Primrec fun a => (f a).foldl (fun s b => h a (s, b)) (g a) :=
@@ -1585,12 +1201,6 @@ theorem list_reverse : Primrec (@List.reverse α) :=
 #align primrec.list_reverse Primrec.list_reverse
 -/
 
-/- warning: primrec.list_foldr -> Primrec.list_foldr is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> σ} {h : α -> (Prod.{u2, u3} β σ) -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u2 u3, u3} α (Prod.{u2, u3} β σ) σ _inst_1 (Primcodable.prod.{u2, u3} β σ _inst_2 _inst_4) _inst_4 h) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 (fun (a : α) => List.foldr.{u2, u3} β σ (fun (b : β) (s : σ) => h a (Prod.mk.{u2, u3} β σ b s)) (g a) (f a)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u2} σ] {f : α -> (List.{u3} β)} {g : α -> σ} {h : α -> (Prod.{u3, u2} β σ) -> σ}, (Primrec.{u1, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u3 u2, u2} α (Prod.{u3, u2} β σ) σ _inst_1 (Primcodable.prod.{u3, u2} β σ _inst_2 _inst_4) _inst_4 h) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 (fun (a : α) => List.foldr.{u3, u2} β σ (fun (b : β) (s : σ) => h a (Prod.mk.{u3, u2} β σ b s)) (g a) (f a)))
-Case conversion may be inaccurate. Consider using '#align primrec.list_foldr Primrec.list_foldrₓ'. -/
 theorem list_foldr {f : α → List β} {g : α → σ} {h : α → β × σ → σ} (hf : Primrec f)
     (hg : Primrec g) (hh : Primrec₂ h) :
     Primrec fun a => (f a).foldr (fun b s => h a (b, s)) (g a) :=
@@ -1617,12 +1227,6 @@ theorem list_tail : Primrec (@List.tail α) :=
 #align primrec.list_tail Primrec.list_tail
 -/
 
-/- warning: primrec.list_rec -> Primrec.list_rec is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> σ} {h : α -> (Prod.{u2, max u2 u3} β (Prod.{u2, u3} (List.{u2} β) σ)) -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u2 u3, u3} α (Prod.{u2, max u2 u3} β (Prod.{u2, u3} (List.{u2} β) σ)) σ _inst_1 (Primcodable.prod.{u2, max u2 u3} β (Prod.{u2, u3} (List.{u2} β) σ) _inst_2 (Primcodable.prod.{u2, u3} (List.{u2} β) σ (Primcodable.list.{u2} β _inst_2) _inst_4)) _inst_4 h) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 (fun (a : α) => List.recOn.{succ u3, u2} β (fun (_x : List.{u2} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u2} β) (IH : σ) => h a (Prod.mk.{u2, max u2 u3} β (Prod.{u2, u3} (List.{u2} β) σ) b (Prod.mk.{u2, u3} (List.{u2} β) σ l IH)))))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u2} σ] {f : α -> (List.{u3} β)} {g : α -> σ} {h : α -> (Prod.{u3, max u2 u3} β (Prod.{u3, u2} (List.{u3} β) σ)) -> σ}, (Primrec.{u1, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u3 u2, u2} α (Prod.{u3, max u2 u3} β (Prod.{u3, u2} (List.{u3} β) σ)) σ _inst_1 (Primcodable.prod.{u3, max u3 u2} β (Prod.{u3, u2} (List.{u3} β) σ) _inst_2 (Primcodable.prod.{u3, u2} (List.{u3} β) σ (Primcodable.list.{u3} β _inst_2) _inst_4)) _inst_4 h) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 (fun (a : α) => List.recOn.{succ u2, u3} β (fun (_x : List.{u3} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u3} β) (IH : σ) => h a (Prod.mk.{u3, max u3 u2} β (Prod.{u3, u2} (List.{u3} β) σ) b (Prod.mk.{u3, u2} (List.{u3} β) σ l IH)))))
-Case conversion may be inaccurate. Consider using '#align primrec.list_rec Primrec.list_recₓ'. -/
 theorem list_rec {f : α → List β} {g : α → σ} {h : α → β × List β × σ → σ} (hf : Primrec f)
     (hg : Primrec g) (hh : Primrec₂ h) :
     @Primrec _ σ _ _ fun a => List.recOn (f a) (g a) fun b l IH => h a (b, l, IH) :=
@@ -1689,12 +1293,6 @@ theorem list_concat : Primrec₂ fun l (a : α) => l ++ [a] :=
 #align primrec.list_concat Primrec.list_concat
 -/
 
-/- warning: primrec.list_map -> Primrec.list_map is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> β -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec.{u1, u3} α (List.{u3} σ) _inst_1 (Primcodable.list.{u3} σ _inst_4) (fun (a : α) => List.map.{u2, u3} β σ (g a) (f a)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u1} σ] {f : α -> (List.{u3} β)} {g : α -> β -> σ}, (Primrec.{u2, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec₂.{u2, u3, u1} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec.{u2, u1} α (List.{u1} σ) _inst_1 (Primcodable.list.{u1} σ _inst_4) (fun (a : α) => List.map.{u3, u1} β σ (g a) (f a)))
-Case conversion may be inaccurate. Consider using '#align primrec.list_map Primrec.list_mapₓ'. -/
 theorem list_map {f : α → List β} {g : α → β → σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).map (g a) :=
   (list_foldr hf (const []) <|
@@ -1723,12 +1321,6 @@ theorem list_length : Primrec (@List.length α) :=
 #align primrec.list_length Primrec.list_length
 -/
 
-/- warning: primrec.list_find_index -> Primrec.list_findIdx is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> (List.{u2} β)} {p : α -> β -> Prop} [_inst_5 : forall (a : α) (b : β), Decidable (p a b)], (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 p (fun (a : α) (b : β) => _inst_5 a b)) -> (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => List.findIndex.{u2} β (p a) (fun (a_1 : β) => _inst_5 a a_1) (f a)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> (List.{u2} β)} {p : α -> β -> Bool}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec₂.{u1, u2, 0} α β Bool _inst_1 _inst_2 Primcodable.bool p) -> (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => List.findIdx.{u2} β (p a) (f a)))
-Case conversion may be inaccurate. Consider using '#align primrec.list_find_index Primrec.list_findIdxₓ'. -/
 theorem list_findIdx {f : α → List β} {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hf : Primrec f)
     (hp : PrimrecRel p) : Primrec fun a => (f a).findIndex (p a) :=
   (list_foldr hf (const 0) <|
@@ -1956,12 +1548,6 @@ theorem vector_get {n} : Primrec₂ (@Vector.get α n) :=
 #align primrec.vector_nth Primrec.vector_get
 -/
 
-/- warning: primrec.list_of_fn -> Primrec.list_ofFn is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} σ] {n : Nat} {f : (Fin n) -> α -> σ}, (forall (i : Fin n), Primrec.{u1, u2} α σ _inst_1 _inst_4 (f i)) -> (Primrec.{u1, u2} α (List.{u2} σ) _inst_1 (Primcodable.list.{u2} σ _inst_4) (fun (a : α) => List.ofFn.{u2} σ n (fun (i : Fin n) => f i a)))
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} σ] {n : Nat} {f : (Fin n) -> α -> σ}, (forall (i : Fin n), Primrec.{u2, u1} α σ _inst_1 _inst_4 (f i)) -> (Primrec.{u2, u1} α (List.{u1} σ) _inst_1 (Primcodable.list.{u1} σ _inst_4) (fun (a : α) => List.ofFn.{u1} σ n (fun (i : Fin n) => f i a)))
-Case conversion may be inaccurate. Consider using '#align primrec.list_of_fn Primrec.list_ofFnₓ'. -/
 theorem list_ofFn :
     ∀ {n} {f : Fin n → α → σ}, (∀ i, Primrec (f i)) → Primrec fun a => List.ofFn fun i => f i a
   | 0, f, hf => const []
@@ -1969,12 +1555,6 @@ theorem list_ofFn :
     simp [List.ofFn_succ] <;> exact list_cons.comp (hf 0) (list_of_fn fun i => hf i.succ)
 #align primrec.list_of_fn Primrec.list_ofFn
 
-/- warning: primrec.vector_of_fn -> Primrec.vector_ofFn is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} σ] {n : Nat} {f : (Fin n) -> α -> σ}, (forall (i : Fin n), Primrec.{u1, u2} α σ _inst_1 _inst_4 (f i)) -> (Primrec.{u1, u2} α (Vector.{u2} σ n) _inst_1 (Primcodable.vector.{u2} σ _inst_4 n) (fun (a : α) => Vector.ofFn.{u2} σ n (fun (i : Fin n) => f i a)))
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} σ] {n : Nat} {f : (Fin n) -> α -> σ}, (forall (i : Fin n), Primrec.{u2, u1} α σ _inst_1 _inst_4 (f i)) -> (Primrec.{u2, u1} α (Vector.{u1} σ n) _inst_1 (Primcodable.vector.{u1} σ _inst_4 n) (fun (a : α) => Vector.ofFn.{u1} σ n (fun (i : Fin n) => f i a)))
-Case conversion may be inaccurate. Consider using '#align primrec.vector_of_fn Primrec.vector_ofFnₓ'. -/
 theorem vector_ofFn {n} {f : Fin n → α → σ} (hf : ∀ i, Primrec (f i)) :
     Primrec fun a => Vector.ofFn fun i => f i a :=
   vector_toList_iff.1 <| by simp [list_of_fn hf]
@@ -1998,23 +1578,11 @@ theorem fin_app {n} : Primrec₂ (@id (Fin n → σ)) :=
 #align primrec.fin_app Primrec.fin_app
 -/
 
-/- warning: primrec.fin_curry₁ -> Primrec.fin_curry₁ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} σ] {n : Nat} {f : (Fin n) -> α -> σ}, Iff (Primrec₂.{0, u1, u2} (Fin n) α σ (Primcodable.fin n) _inst_1 _inst_4 f) (forall (i : Fin n), Primrec.{u1, u2} α σ _inst_1 _inst_4 (f i))
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} σ] {n : Nat} {f : (Fin n) -> α -> σ}, Iff (Primrec₂.{0, u2, u1} (Fin n) α σ (Primcodable.fin n) _inst_1 _inst_4 f) (forall (i : Fin n), Primrec.{u2, u1} α σ _inst_1 _inst_4 (f i))
-Case conversion may be inaccurate. Consider using '#align primrec.fin_curry₁ Primrec.fin_curry₁ₓ'. -/
 theorem fin_curry₁ {n} {f : Fin n → α → σ} : Primrec₂ f ↔ ∀ i, Primrec (f i) :=
   ⟨fun h i => h.comp (const i) Primrec.id, fun h =>
     (vector_get.comp ((vector_ofFn h).comp snd) fst).of_eq fun a => by simp⟩
 #align primrec.fin_curry₁ Primrec.fin_curry₁
 
-/- warning: primrec.fin_curry -> Primrec.fin_curry is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} σ] {n : Nat} {f : α -> (Fin n) -> σ}, Iff (Primrec.{u1, u2} α ((Fin n) -> σ) _inst_1 (Primcodable.finArrow.{u2} σ _inst_4 n) f) (Primrec₂.{u1, 0, u2} α (Fin n) σ _inst_1 (Primcodable.fin n) _inst_4 f)
-but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} σ] {n : Nat} {f : α -> (Fin n) -> σ}, Iff (Primrec.{u2, u1} α ((Fin n) -> σ) _inst_1 (Primcodable.finArrow.{u1} σ _inst_4 n) f) (Primrec₂.{u2, 0, u1} α (Fin n) σ _inst_1 (Primcodable.fin n) _inst_4 f)
-Case conversion may be inaccurate. Consider using '#align primrec.fin_curry Primrec.fin_curryₓ'. -/
 theorem fin_curry {n} {f : α → Fin n → σ} : Primrec f ↔ Primrec₂ f :=
   ⟨fun h => fin_app.comp (h.comp fst) snd, fun h =>
     (vector_get'.comp
@@ -2184,12 +1752,6 @@ theorem mul : @Primrec' 2 fun v => v.headI * v.tail.headI :=
 #align nat.primrec'.mul Nat.Primrec'.mul
 -/
 
-/- warning: nat.primrec'.if_lt -> Nat.Primrec'.if_lt is a dubious translation:
-lean 3 declaration is
-  forall {n : Nat} {a : (Vector.{0} Nat n) -> Nat} {b : (Vector.{0} Nat n) -> Nat} {f : (Vector.{0} Nat n) -> Nat} {g : (Vector.{0} Nat n) -> Nat}, (Nat.Primrec' n a) -> (Nat.Primrec' n b) -> (Nat.Primrec' n f) -> (Nat.Primrec' n g) -> (Nat.Primrec' n (fun (v : Vector.{0} Nat n) => ite.{1} Nat (LT.lt.{0} Nat Nat.hasLt (a v) (b v)) (Nat.decidableLt (a v) (b v)) (f v) (g v)))
-but is expected to have type
-  forall {n : Nat} {a : (Vector.{0} Nat n) -> Nat} {b : (Vector.{0} Nat n) -> Nat} {f : (Vector.{0} Nat n) -> Nat} {g : (Vector.{0} Nat n) -> Nat}, (Nat.Primrec' n a) -> (Nat.Primrec' n b) -> (Nat.Primrec' n f) -> (Nat.Primrec' n g) -> (Nat.Primrec' n (fun (v : Vector.{0} Nat n) => ite.{1} Nat (LT.lt.{0} Nat instLTNat (a v) (b v)) (Nat.decLt (a v) (b v)) (f v) (g v)))
-Case conversion may be inaccurate. Consider using '#align nat.primrec'.if_lt Nat.Primrec'.if_ltₓ'. -/
 theorem if_lt {n a b f g} (ha : @Primrec' n a) (hb : @Primrec' n b) (hf : @Primrec' n f)
     (hg : @Primrec' n g) : @Primrec' n fun v => if a v < b v then f v else g v :=
   (prec' (sub.comp₂ _ hb ha) hg (tail <| tail hf)).of_eq fun v =>
Diff
@@ -1341,8 +1341,7 @@ theorem [anonymous] : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
   have :
     (f (n, k)).2 + k * (f (n, k)).1 = n ∧ (0 < k → (f (n, k)).2 < k) ∧ (k = 0 → (f (n, k)).1 = 0) :=
     by
-    induction' n with n IH
-    · exact ⟨rfl, id, fun _ => rfl⟩
+    induction' n with n IH; · exact ⟨rfl, id, fun _ => rfl⟩
     rw [fun n : ℕ =>
       show
         f (n.succ, k) =
@@ -1354,13 +1353,10 @@ theorem [anonymous] : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
       refine' ⟨_, fun k0 => Nat.noConfusion (h.trans k0)⟩
       rwa [← Nat.succ_add, h, add_comm, ← Nat.mul_succ] at this
     · exact ⟨by rw [Nat.succ_add, IH.1], fun k0 => lt_of_le_of_ne (IH.2.1 k0) h, IH.2.2⟩
-  revert this
-  cases' f (n, k) with D M
-  simp
-  intro h₁ h₂ h₃
+  revert this; cases' f (n, k) with D M
+  simp; intro h₁ h₂ h₃
   cases Nat.eq_zero_or_pos k
-  · simp [h, h₃ h] at h₁⊢
-    simp [h₁]
+  · simp [h, h₃ h] at h₁⊢; simp [h₁]
   · exact (Nat.div_mod_unique h).2 ⟨h₁, h₂ h⟩
 #align primrec.nat_div_mod [anonymous]
 
@@ -1436,14 +1432,10 @@ private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ
     have :
       ∀ n, F a n = ((List.take n (f a)).foldl (fun s b => h a (s, b)) (g a), List.drop n (f a)) :=
       by
-      intro
-      simp [F]
-      generalize f a = l
-      generalize g a = x
-      induction' n with n IH generalizing l x
-      · rfl
-      simp
-      cases' l with b l <;> simp [IH]
+      intro ; simp [F]
+      generalize f a = l; generalize g a = x
+      induction' n with n IH generalizing l x; · rfl
+      simp; cases' l with b l <;> simp [IH]
     rw [this, List.take_all_of_le (length_le_encode _)]
 
 private theorem list_cons' :
@@ -1641,8 +1633,7 @@ theorem list_rec {f : α → List β} {g : α → σ} {h : α → β × List β
   (snd.comp this).of_eq fun a =>
     by
     suffices F a = (f a, List.recOn (f a) (g a) fun b l IH => h a (b, l, IH)) by rw [this]
-    simp [F]
-    induction' f a with b l IH <;> simp [*]
+    simp [F]; induction' f a with b l IH <;> simp [*]
 #align primrec.list_rec Primrec.list_rec
 
 #print Primrec.list_get? /-
@@ -1664,10 +1655,8 @@ theorem list_get? : Primrec₂ (@List.get? α) :=
     dsimp; symm
     induction' l with a l IH generalizing n; · rfl
     cases' n with n
-    · rw [(_ : F (a :: l) 0 = Sum.inr a)]
-      · rfl
-      clear IH
-      dsimp [F]
+    · rw [(_ : F (a :: l) 0 = Sum.inr a)]; · rfl
+      clear IH; dsimp [F]
       induction' l with b l IH <;> simp [*]
     · apply IH
 #align primrec.list_nth Primrec.list_get?
@@ -2235,11 +2224,7 @@ theorem sqrt : @Primrec' 1 fun v => v.headI.sqrt :=
           have x := v.head <;> have y := v.tail.head <;>
             exact if x.succ < y.succ * y.succ then y else y.succ)
         head (const 0) _
-    · convert this
-      funext
-      congr
-      funext x y
-      congr <;> simp
+    · convert this; funext; congr ; funext x y; congr <;> simp
     have x1 := succ.comp₁ _ head
     have y1 := succ.comp₁ _ (tail head)
     exact if_lt x1 (mul.comp₂ _ y1 y1) (tail head) y1
Diff
@@ -1392,7 +1392,6 @@ open Primrec
 
 private def prim : Primcodable (List β) :=
   ⟨H⟩
-#align prim prim
 
 private theorem list_cases' {f : α → List β} {g : α → σ} {h : α → β × List β → σ}
     (hf :
@@ -1412,7 +1411,6 @@ private theorem list_cases' {f : α → List β} {g : α → σ} {h : α → β
             option_cases snd (hg.comp fst) (hh.comp₂ (fst.comp₂ Primrec₂.left) Primrec₂.right)).comp
       Primrec.id (encode_iff.2 hf)
   option_some_iff.1 <| this.of_eq fun a => by cases' f a with b l <;> simp [encodek] <;> rfl
-#align list_cases' list_cases'
 
 private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ × β → σ}
     (hf :
@@ -1447,14 +1445,12 @@ private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ
       simp
       cases' l with b l <;> simp [IH]
     rw [this, List.take_all_of_le (length_le_encode _)]
-#align list_foldl' list_foldl'
 
 private theorem list_cons' :
     haveI := prim H
     Primrec₂ (@List.cons β) :=
   letI := prim H
   encode_iff.1 (succ.comp <| primrec₂.mkpair.comp (encode_iff.2 fst) (encode_iff.2 snd))
-#align list_cons' list_cons'
 
 private theorem list_reverse' :
     haveI := prim H
@@ -1464,7 +1460,6 @@ private theorem list_reverse' :
     (suffices ∀ l r, List.foldl (fun (s : List β) (b : β) => b :: s) r l = List.reverseAux l r from
       fun l => this l []
     fun l => by induction l <;> simp [*, List.reverseAux])
-#align list_reverse' list_reverse'
 
 end
 
Diff
@@ -850,7 +850,7 @@ theorem nat_iff {f : α → β → σ} :
       Option.map (fun p : α × β => f p.1 p.2)
           (Option.bind a fun a : α => Option.map (Prod.mk a) b) =
         Option.bind a fun a => Option.map (f a) b :=
-    by intros <;> cases a <;> [rfl, · cases b <;> rfl]
+    by intros <;> cases a <;> [rfl;· cases b <;> rfl]
   simp [Primrec₂, Primrec, this]
 #align primrec₂.nat_iff Primrec₂.nat_iff
 
@@ -1749,7 +1749,7 @@ theorem list_findIdx {f : α → List β} {p : α → β → Prop} [∀ a b, Dec
     (hp : PrimrecRel p) : Primrec fun a => (f a).findIndex (p a) :=
   (list_foldr hf (const 0) <|
         to₂ <| ite (hp.comp fst <| fst.comp snd) (const 0) (succ.comp <| snd.comp snd)).of_eq
-    fun a => Eq.symm <| by dsimp <;> induction' f a with b l <;> [rfl, simp [*, List.findIndex]]
+    fun a => Eq.symm <| by dsimp <;> induction' f a with b l <;> [rfl;simp [*, List.findIndex]]
 #align primrec.list_find_index Primrec.list_findIdx
 
 theorem list_indexOf [DecidableEq α] : Primrec₂ (@List.indexOf α _) :=
Diff
@@ -56,7 +56,7 @@ warning: nat.elim_zero -> Nat.rec_zero is a dubious translation:
 lean 3 declaration is
   forall {C : Sort.{u1}} (a : C) (f : Nat -> C -> C), Eq.{u1} C (Nat.rec.{u1} C a f (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) a
 but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2991 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2991) a f (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2994 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2994) a f (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
 Case conversion may be inaccurate. Consider using '#align nat.elim_zero Nat.rec_zeroₓ'. -/
 @[simp]
 theorem rec_zero {C} (a f) : @Nat.rec C a f 0 = a :=
@@ -68,7 +68,7 @@ warning: nat.elim_succ -> Nat.rec_add_one is a dubious translation:
 lean 3 declaration is
   forall {C : Sort.{u1}} (a : C) (f : Nat -> C -> C) (n : Nat), Eq.{u1} C (Nat.rec.{u1} C a f (Nat.succ n)) (f n (Nat.rec.{u1} C a f n))
 but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Nat.rec.{u1} C a f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3041 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3041) a f n))
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Nat.rec.{u1} C a f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3044 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3044) a f n))
 Case conversion may be inaccurate. Consider using '#align nat.elim_succ Nat.rec_add_oneₓ'. -/
 @[simp]
 theorem rec_add_one {C} (a f n) : @Nat.rec C a f (succ n) = f n (Nat.rec a f n) :=
@@ -91,7 +91,7 @@ warning: nat.cases_zero -> Nat.rec_zero is a dubious translation:
 lean 3 declaration is
   forall {C : Sort.{u1}} (a : C) (f : Nat -> C), Eq.{u1} C (Nat.casesOn.{u1} C a f (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) a
 but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2991 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2991) a f (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2994 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2994) a f (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
 Case conversion may be inaccurate. Consider using '#align nat.cases_zero Nat.rec_zeroₓ'. -/
 @[simp]
 theorem rec_zero {C} (a f) : @Nat.casesOn C a f 0 = a :=
@@ -103,7 +103,7 @@ warning: nat.cases_succ -> Nat.rec_add_one is a dubious translation:
 lean 3 declaration is
   forall {C : Sort.{u1}} (a : C) (f : Nat -> C) (n : Nat), Eq.{u1} C (Nat.casesOn.{u1} C a f (Nat.succ n)) (f n)
 but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Nat.rec.{u1} C a f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3041 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3041) a f n))
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Nat.rec.{u1} C a f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3044 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3044) a f n))
 Case conversion may be inaccurate. Consider using '#align nat.cases_succ Nat.rec_add_oneₓ'. -/
 @[simp]
 theorem rec_add_one {C} (a f n) : @Nat.casesOn C a f (succ n) = f n :=
@@ -457,7 +457,7 @@ theorem of_equiv_symm {β} {e : β ≃ α} :
 lean 3 declaration is
   forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u1} β α) {f : σ -> β}, Iff (Primrec.{u2, u1} σ α _inst_3 _inst_1 (fun (a : σ) => coeFn.{max 1 (max (succ u3) (succ u1)) (succ u1) (succ u3), max (succ u3) (succ u1)} (Equiv.{succ u3, succ u1} β α) (fun (_x : Equiv.{succ u3, succ u1} β α) => β -> α) (Equiv.hasCoeToFun.{succ u3, succ u1} β α) e (f a))) (Primrec.{u2, u3} σ β _inst_3 (Primcodable.ofEquiv.{u1, u3} α β _inst_1 e) f)
 but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> β}, Iff (Primrec.{u1, u2} σ α _inst_3 _inst_1 (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u3, succ u2} (Equiv.{succ u3, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u3, succ u2} β α) e (f a))) (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) f)
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> β}, Iff (Primrec.{u1, u2} σ α _inst_3 _inst_1 (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u3, succ u2} (Equiv.{succ u3, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u3, succ u2} β α) e (f a))) (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) f)
 Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_iff Primrec.of_equiv_iffₓ'. -/
 theorem of_equiv_iff {β} (e : β ≃ α) {f : σ → β} :
     haveI := Primcodable.ofEquiv α e
@@ -470,7 +470,7 @@ theorem of_equiv_iff {β} (e : β ≃ α) {f : σ → β} :
 lean 3 declaration is
   forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u1} β α) {f : σ -> α}, Iff (Primrec.{u2, u3} σ β _inst_3 (Primcodable.ofEquiv.{u1, u3} α β _inst_1 e) (fun (a : σ) => coeFn.{max 1 (max (succ u1) (succ u3)) (succ u3) (succ u1), max (succ u1) (succ u3)} (Equiv.{succ u1, succ u3} α β) (fun (_x : Equiv.{succ u1, succ u3} α β) => α -> β) (Equiv.hasCoeToFun.{succ u1, succ u3} α β) (Equiv.symm.{succ u3, succ u1} β α e) (f a))) (Primrec.{u2, u1} σ α _inst_3 _inst_1 f)
 but is expected to have type
-  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> α}, Iff (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (Equiv.{succ u2, succ u3} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u3} α β) (Equiv.symm.{succ u3, succ u2} β α e) (f a))) (Primrec.{u1, u2} σ α _inst_3 _inst_1 f)
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> α}, Iff (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (Equiv.{succ u2, succ u3} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u3} α β) (Equiv.symm.{succ u3, succ u2} β α e) (f a))) (Primrec.{u1, u2} σ α _inst_3 _inst_1 f)
 Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_symm_iff Primrec.of_equiv_symm_iffₓ'. -/
 theorem of_equiv_symm_iff {β} (e : β ≃ α) {f : σ → α} :
     haveI := Primcodable.ofEquiv α e
Diff
@@ -161,17 +161,17 @@ theorem prec1 {f} (m : ℕ) (hf : Primrec f) : Primrec fun n => n.elim m fun y I
 #align nat.primrec.prec1 Nat.Primrec.prec1
 -/
 
-#print Nat.Primrec.cases1 /-
-theorem cases1 {f} (m : ℕ) (hf : Primrec f) : Primrec (Nat.casesOn m f) :=
+#print Nat.Primrec.casesOn1 /-
+theorem casesOn1 {f} (m : ℕ) (hf : Primrec f) : Primrec (Nat.casesOn m f) :=
   (prec1 m (hf.comp left)).of_eq <| by simp [cases]
-#align nat.primrec.cases1 Nat.Primrec.cases1
+#align nat.primrec.cases1 Nat.Primrec.casesOn1
 -/
 
-#print Nat.Primrec.cases /-
-theorem cases {f g} (hf : Primrec f) (hg : Primrec g) :
+#print Nat.Primrec.casesOn' /-
+theorem casesOn' {f g} (hf : Primrec f) (hg : Primrec g) :
     Primrec (unpaired fun z n => n.cases (f z) fun y => g <| pair z y) :=
   (prec hf (hg.comp (pair left (left.comp right)))).of_eq <| by simp [cases]
-#align nat.primrec.cases Nat.Primrec.cases
+#align nat.primrec.cases Nat.Primrec.casesOn'
 -/
 
 #print Nat.Primrec.swap /-
@@ -188,7 +188,7 @@ theorem swap' {f} (hf : Primrec (unpaired f)) : Primrec (unpaired (swap f)) :=
 
 #print Nat.Primrec.pred /-
 theorem pred : Primrec pred :=
-  (cases1 0 Primrec.id).of_eq fun n => by cases n <;> simp [*]
+  (casesOn1 0 Primrec.id).of_eq fun n => by cases n <;> simp [*]
 #align nat.primrec.pred Nat.Primrec.pred
 -/
 
@@ -264,20 +264,21 @@ instance empty : Primcodable Empty :=
 
 #print Primcodable.unit /-
 instance unit : Primcodable PUnit :=
-  ⟨(cases1 1 zero).of_eq fun n => by cases n <;> simp⟩
+  ⟨(casesOn1 1 zero).of_eq fun n => by cases n <;> simp⟩
 #align primcodable.unit Primcodable.unit
 -/
 
 #print Primcodable.option /-
 instance option {α : Type _} [h : Primcodable α] : Primcodable (Option α) :=
-  ⟨(cases1 1 ((cases1 0 (succ.comp succ)).comp (Primcodable.prim α))).of_eq fun n => by
+  ⟨(casesOn1 1 ((casesOn1 0 (succ.comp succ)).comp (Primcodable.prim α))).of_eq fun n => by
       cases n <;> simp <;> cases decode α n <;> rfl⟩
 #align primcodable.option Primcodable.option
 -/
 
 #print Primcodable.bool /-
 instance bool : Primcodable Bool :=
-  ⟨(cases1 1 (cases1 2 zero)).of_eq fun n => by
+  ⟨(casesOn1 1 (casesOn1 2 zero)).of_eq fun n =>
+      by
       cases n; · rfl; cases n; · rfl
       rw [decode_ge_two]; · rfl
       exact by decide⟩
@@ -340,7 +341,7 @@ theorem encdec : Primrec fun n => encode (decode α n) :=
 
 #print Primrec.option_some /-
 theorem option_some : Primrec (@some α) :=
-  ((cases1 0 (succ.comp succ)).comp (Primcodable.prim α)).of_eq fun n => by
+  ((casesOn1 0 (succ.comp succ)).comp (Primcodable.prim α)).of_eq fun n => by
     cases decode α n <;> simp
 #align primrec.option_some Primrec.option_some
 -/
@@ -362,7 +363,7 @@ but is expected to have type
   forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] (x : σ), Primrec.{u2, u1} α σ _inst_1 _inst_3 (fun (a : α) => x)
 Case conversion may be inaccurate. Consider using '#align primrec.const Primrec.constₓ'. -/
 theorem const (x : σ) : Primrec fun a : α => x :=
-  ((cases1 0 (const (encode x).succ)).comp (Primcodable.prim α)).of_eq fun n => by
+  ((casesOn1 0 (const (encode x).succ)).comp (Primcodable.prim α)).of_eq fun n => by
     cases decode α n <;> rfl
 #align primrec.const Primrec.const
 
@@ -379,7 +380,7 @@ but is expected to have type
   forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_3 : Primcodable.{u2} σ] {f : β -> σ} {g : α -> β}, (Primrec.{u3, u2} β σ _inst_2 _inst_3 f) -> (Primrec.{u1, u3} α β _inst_1 _inst_2 g) -> (Primrec.{u1, u2} α σ _inst_1 _inst_3 (fun (a : α) => f (g a)))
 Case conversion may be inaccurate. Consider using '#align primrec.comp Primrec.compₓ'. -/
 theorem comp {f : β → σ} {g : α → β} (hf : Primrec f) (hg : Primrec g) : Primrec fun a => f (g a) :=
-  ((cases1 0 (hf.comp <| pred.comp hg)).comp (Primcodable.prim α)).of_eq fun n =>
+  ((casesOn1 0 (hf.comp <| pred.comp hg)).comp (Primcodable.prim α)).of_eq fun n =>
     by
     cases decode α n; · rfl
     simp [encodek]
@@ -434,49 +435,49 @@ theorem option_some_iff {f : α → σ} : (Primrec fun a => some (f a)) ↔ Prim
   ⟨fun h => encode_iff.1 <| pred.comp <| encode_iff.2 h, option_some.comp⟩
 #align primrec.option_some_iff Primrec.option_some_iff
 
-#print Primrec.ofEquiv /-
-theorem ofEquiv {β} {e : β ≃ α} :
+#print Primrec.of_equiv /-
+theorem of_equiv {β} {e : β ≃ α} :
     haveI := Primcodable.ofEquiv α e
     Primrec e :=
   letI : Primcodable β := Primcodable.ofEquiv α e
   encode_iff.1 Primrec.encode
-#align primrec.of_equiv Primrec.ofEquiv
+#align primrec.of_equiv Primrec.of_equiv
 -/
 
-#print Primrec.ofEquiv_symm /-
-theorem ofEquiv_symm {β} {e : β ≃ α} :
+#print Primrec.of_equiv_symm /-
+theorem of_equiv_symm {β} {e : β ≃ α} :
     haveI := Primcodable.ofEquiv α e
     Primrec e.symm :=
   letI := Primcodable.ofEquiv α e
   encode_iff.1 (show Primrec fun a => encode (e (e.symm a)) by simp [Primrec.encode])
-#align primrec.of_equiv_symm Primrec.ofEquiv_symm
+#align primrec.of_equiv_symm Primrec.of_equiv_symm
 -/
 
-/- warning: primrec.of_equiv_iff -> Primrec.ofEquiv_iff is a dubious translation:
+/- warning: primrec.of_equiv_iff -> Primrec.of_equiv_iff is a dubious translation:
 lean 3 declaration is
   forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u1} β α) {f : σ -> β}, Iff (Primrec.{u2, u1} σ α _inst_3 _inst_1 (fun (a : σ) => coeFn.{max 1 (max (succ u3) (succ u1)) (succ u1) (succ u3), max (succ u3) (succ u1)} (Equiv.{succ u3, succ u1} β α) (fun (_x : Equiv.{succ u3, succ u1} β α) => β -> α) (Equiv.hasCoeToFun.{succ u3, succ u1} β α) e (f a))) (Primrec.{u2, u3} σ β _inst_3 (Primcodable.ofEquiv.{u1, u3} α β _inst_1 e) f)
 but is expected to have type
   forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> β}, Iff (Primrec.{u1, u2} σ α _inst_3 _inst_1 (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u3, succ u2} (Equiv.{succ u3, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u3, succ u2} β α) e (f a))) (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) f)
-Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_iff Primrec.ofEquiv_iffₓ'. -/
-theorem ofEquiv_iff {β} (e : β ≃ α) {f : σ → β} :
+Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_iff Primrec.of_equiv_iffₓ'. -/
+theorem of_equiv_iff {β} (e : β ≃ α) {f : σ → β} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e (f a)) ↔ Primrec f :=
   letI := Primcodable.ofEquiv α e
   ⟨fun h => (of_equiv_symm.comp h).of_eq fun a => by simp, of_equiv.comp⟩
-#align primrec.of_equiv_iff Primrec.ofEquiv_iff
+#align primrec.of_equiv_iff Primrec.of_equiv_iff
 
-/- warning: primrec.of_equiv_symm_iff -> Primrec.ofEquiv_symm_iff is a dubious translation:
+/- warning: primrec.of_equiv_symm_iff -> Primrec.of_equiv_symm_iff is a dubious translation:
 lean 3 declaration is
   forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u1} β α) {f : σ -> α}, Iff (Primrec.{u2, u3} σ β _inst_3 (Primcodable.ofEquiv.{u1, u3} α β _inst_1 e) (fun (a : σ) => coeFn.{max 1 (max (succ u1) (succ u3)) (succ u3) (succ u1), max (succ u1) (succ u3)} (Equiv.{succ u1, succ u3} α β) (fun (_x : Equiv.{succ u1, succ u3} α β) => α -> β) (Equiv.hasCoeToFun.{succ u1, succ u3} α β) (Equiv.symm.{succ u3, succ u1} β α e) (f a))) (Primrec.{u2, u1} σ α _inst_3 _inst_1 f)
 but is expected to have type
   forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> α}, Iff (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (Equiv.{succ u2, succ u3} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u3} α β) (Equiv.symm.{succ u3, succ u2} β α e) (f a))) (Primrec.{u1, u2} σ α _inst_3 _inst_1 f)
-Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_symm_iff Primrec.ofEquiv_symm_iffₓ'. -/
-theorem ofEquiv_symm_iff {β} (e : β ≃ α) {f : σ → α} :
+Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_symm_iff Primrec.of_equiv_symm_iffₓ'. -/
+theorem of_equiv_symm_iff {β} (e : β ≃ α) {f : σ → α} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e.symm (f a)) ↔ Primrec f :=
   letI := Primcodable.ofEquiv α e
   ⟨fun h => (of_equiv.comp h).of_eq fun a => by simp, of_equiv_symm.comp⟩
-#align primrec.of_equiv_symm_iff Primrec.ofEquiv_symm_iff
+#align primrec.of_equiv_symm_iff Primrec.of_equiv_symm_iff
 
 end Primrec
 
@@ -486,7 +487,7 @@ open Nat.Primrec
 
 #print Primcodable.prod /-
 instance prod {α β} [Primcodable α] [Primcodable β] : Primcodable (α × β) :=
-  ⟨((cases zero ((cases zero succ).comp (pair right ((Primcodable.prim β).comp left)))).comp
+  ⟨((casesOn' zero ((casesOn' zero succ).comp (pair right ((Primcodable.prim β).comp left)))).comp
           (pair right ((Primcodable.prim α).comp left))).of_eq
       fun n => by
       simp [Nat.unpaired]
@@ -510,8 +511,8 @@ but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} [_inst_3 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} β], Primrec.{max u2 u1, u2} (Prod.{u2, u1} α β) α (Primcodable.prod.{u2, u1} α β _inst_3 _inst_4) _inst_3 (Prod.fst.{u2, u1} α β)
 Case conversion may be inaccurate. Consider using '#align primrec.fst Primrec.fstₓ'. -/
 theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β) :=
-  ((cases zero
-            ((cases zero (Nat.Primrec.succ.comp left)).comp
+  ((casesOn' zero
+            ((casesOn' zero (Nat.Primrec.succ.comp left)).comp
               (pair right ((Primcodable.prim β).comp left)))).comp
         (pair right ((Primcodable.prim α).comp left))).of_eq
     fun n => by
@@ -527,8 +528,8 @@ but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} [_inst_3 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} β], Primrec.{max u2 u1, u1} (Prod.{u2, u1} α β) β (Primcodable.prod.{u2, u1} α β _inst_3 _inst_4) _inst_4 (Prod.snd.{u2, u1} α β)
 Case conversion may be inaccurate. Consider using '#align primrec.snd Primrec.sndₓ'. -/
 theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β) :=
-  ((cases zero
-            ((cases zero (Nat.Primrec.succ.comp right)).comp
+  ((casesOn' zero
+            ((casesOn' zero (Nat.Primrec.succ.comp right)).comp
               (pair right ((Primcodable.prim β).comp left)))).comp
         (pair right ((Primcodable.prim α).comp left))).of_eq
     fun n => by
@@ -545,7 +546,7 @@ but is expected to have type
 Case conversion may be inaccurate. Consider using '#align primrec.pair Primrec.pairₓ'. -/
 theorem pair {α β γ} [Primcodable α] [Primcodable β] [Primcodable γ] {f : α → β} {g : α → γ}
     (hf : Primrec f) (hg : Primrec g) : Primrec fun a => (f a, g a) :=
-  ((cases1 0
+  ((casesOn1 0
             (Nat.Primrec.succ.comp <|
               pair (Nat.Primrec.pred.comp hf) (Nat.Primrec.pred.comp hg))).comp
         (Primcodable.prim α)).of_eq
@@ -563,7 +564,7 @@ theorem list_get?₁ : ∀ l : List α, Primrec l.get?
   | [] => dom_denumerable.2 zero
   | a :: l =>
     dom_denumerable.2 <|
-      (cases1 (encode a).succ <| dom_denumerable.1 <| list_nth₁ l).of_eq fun n => by
+      (casesOn1 (encode a).succ <| dom_denumerable.1 <| list_nth₁ l).of_eq fun n => by
         cases n <;> simp
 #align primrec.list_nth₁ Primrec.list_get?₁
 -/
@@ -883,11 +884,11 @@ theorem to₂ {f : α × β → σ} (hf : Primrec f) : Primrec₂ fun a b => f (
   hf.of_eq fun ⟨a, b⟩ => rfl
 #align primrec.to₂ Primrec.to₂
 
-#print Primrec.nat_elim /-
-theorem nat_elim {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f) (hg : Primrec₂ g) :
+#print Primrec.nat_rec /-
+theorem nat_rec {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a (n : ℕ) => n.elim (f a) fun n IH => g a (n, IH) :=
   Primrec₂.nat_iff.2 <|
-    ((Nat.Primrec.cases Nat.Primrec.zero <|
+    ((Nat.Primrec.casesOn' Nat.Primrec.zero <|
               (Nat.Primrec.prec hf <|
                     Nat.Primrec.comp hg <|
                       Nat.Primrec.left.pair <|
@@ -901,48 +902,48 @@ theorem nat_elim {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f)
       simp [encodek]
       induction' n.unpair.2 with m <;> simp [encodek]
       simp [ih, encodek]
-#align primrec.nat_elim Primrec.nat_elim
+#align primrec.nat_elim Primrec.nat_rec
 -/
 
-#print Primrec.nat_elim' /-
-theorem nat_elim' {f : α → ℕ} {g : α → β} {h : α → ℕ × β → β} (hf : Primrec f) (hg : Primrec g)
+#print Primrec.nat_rec' /-
+theorem nat_rec' {f : α → ℕ} {g : α → β} {h : α → ℕ × β → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (f a).elim (g a) fun n IH => h a (n, IH) :=
-  (nat_elim hg hh).comp Primrec.id hf
-#align primrec.nat_elim' Primrec.nat_elim'
+  (nat_rec hg hh).comp Primrec.id hf
+#align primrec.nat_elim' Primrec.nat_rec'
 -/
 
-#print Primrec.nat_elim₁ /-
-theorem nat_elim₁ {f : ℕ → α → α} (a : α) (hf : Primrec₂ f) : Primrec (Nat.rec a f) :=
-  nat_elim' Primrec.id (const a) <| comp₂ hf Primrec₂.right
-#align primrec.nat_elim₁ Primrec.nat_elim₁
+#print Primrec.nat_rec₁ /-
+theorem nat_rec₁ {f : ℕ → α → α} (a : α) (hf : Primrec₂ f) : Primrec (Nat.rec a f) :=
+  nat_rec' Primrec.id (const a) <| comp₂ hf Primrec₂.right
+#align primrec.nat_elim₁ Primrec.nat_rec₁
 -/
 
-/- warning: primrec.nat_cases' -> Primrec.nat_cases' is a dubious translation:
+/- warning: primrec.nat_cases' -> Primrec.nat_casesOn' is a dubious translation:
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> β} {g : α -> Nat -> β}, (Primrec.{u1, u2} α β _inst_1 _inst_2 f) -> (Primrec₂.{u1, 0, u2} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 g) -> (Primrec₂.{u1, 0, u2} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 (fun (a : α) => Nat.casesOn.{succ u2} β (f a) (g a)))
 but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {f : α -> β} {g : α -> Nat -> β}, (Primrec.{u2, u1} α β _inst_1 _inst_2 f) -> (Primrec₂.{u2, 0, u1} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 g) -> (Primrec₂.{u2, 0, u1} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 (fun (a : α) (n : Nat) => Nat.casesOn.{succ u1} (fun (x._@.Mathlib.Computability.Primrec._hyg.4800 : Nat) => β) n (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.nat_cases' Primrec.nat_cases'ₓ'. -/
-theorem nat_cases' {f : α → β} {g : α → ℕ → β} (hf : Primrec f) (hg : Primrec₂ g) :
+Case conversion may be inaccurate. Consider using '#align primrec.nat_cases' Primrec.nat_casesOn'ₓ'. -/
+theorem nat_casesOn' {f : α → β} {g : α → ℕ → β} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a => Nat.casesOn (f a) (g a) :=
-  nat_elim hf <| hg.comp₂ Primrec₂.left <| comp₂ fst Primrec₂.right
-#align primrec.nat_cases' Primrec.nat_cases'
+  nat_rec hf <| hg.comp₂ Primrec₂.left <| comp₂ fst Primrec₂.right
+#align primrec.nat_cases' Primrec.nat_casesOn'
 
-/- warning: primrec.nat_cases -> Primrec.nat_cases is a dubious translation:
+/- warning: primrec.nat_cases -> Primrec.nat_casesOn is a dubious translation:
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> Nat} {g : α -> β} {h : α -> Nat -> β}, (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 g) -> (Primrec₂.{u1, 0, u2} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 h) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 (fun (a : α) => Nat.casesOn.{succ u2} β (g a) (h a) (f a)))
 but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {f : α -> Nat} {g : α -> β} {h : α -> Nat -> β}, (Primrec.{u2, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 g) -> (Primrec₂.{u2, 0, u1} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 h) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 (fun (a : α) => Nat.casesOn.{succ u1} (fun (x._@.Mathlib.Computability.Primrec._hyg.4875 : Nat) => β) (f a) (g a) (h a)))
-Case conversion may be inaccurate. Consider using '#align primrec.nat_cases Primrec.nat_casesₓ'. -/
-theorem nat_cases {f : α → ℕ} {g : α → β} {h : α → ℕ → β} (hf : Primrec f) (hg : Primrec g)
+Case conversion may be inaccurate. Consider using '#align primrec.nat_cases Primrec.nat_casesOnₓ'. -/
+theorem nat_casesOn {f : α → ℕ} {g : α → β} {h : α → ℕ → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (f a).cases (g a) (h a) :=
-  (nat_cases' hg hh).comp Primrec.id hf
-#align primrec.nat_cases Primrec.nat_cases
+  (nat_casesOn' hg hh).comp Primrec.id hf
+#align primrec.nat_cases Primrec.nat_casesOn
 
-#print Primrec.nat_cases₁ /-
-theorem nat_cases₁ {f : ℕ → α} (a : α) (hf : Primrec f) : Primrec (Nat.casesOn a f) :=
-  nat_cases Primrec.id (const a) (comp₂ hf Primrec₂.right)
-#align primrec.nat_cases₁ Primrec.nat_cases₁
+#print Primrec.nat_casesOn₁ /-
+theorem nat_casesOn₁ {f : ℕ → α} (a : α) (hf : Primrec f) : Primrec (Nat.casesOn a f) :=
+  nat_casesOn Primrec.id (const a) (comp₂ hf Primrec₂.right)
+#align primrec.nat_cases₁ Primrec.nat_casesOn₁
 -/
 
 /- warning: primrec.nat_iterate -> Primrec.nat_iterate is a dubious translation:
@@ -953,27 +954,27 @@ but is expected to have type
 Case conversion may be inaccurate. Consider using '#align primrec.nat_iterate Primrec.nat_iterateₓ'. -/
 theorem nat_iterate {f : α → ℕ} {g : α → β} {h : α → β → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (h a^[f a]) (g a) :=
-  (nat_elim' hf hg (hh.comp₂ Primrec₂.left <| snd.comp₂ Primrec₂.right)).of_eq fun a => by
+  (nat_rec' hf hg (hh.comp₂ Primrec₂.left <| snd.comp₂ Primrec₂.right)).of_eq fun a => by
     induction f a <;> simp [*, Function.iterate_succ']
 #align primrec.nat_iterate Primrec.nat_iterate
 
-/- warning: primrec.option_cases -> Primrec.option_cases is a dubious translation:
+/- warning: primrec.option_cases -> Primrec.option_casesOn is a dubious translation:
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {o : α -> (Option.{u2} β)} {f : α -> σ} {g : α -> β -> σ}, (Primrec.{u1, u2} α (Option.{u2} β) _inst_1 (Primcodable.option.{u2} β _inst_2) o) -> (Primrec.{u1, u3} α σ _inst_1 _inst_5 f) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u1, u3} α σ _inst_1 _inst_5 (fun (a : α) => Option.casesOn.{succ u3, u2} β (fun (_x : Option.{u2} β) => σ) (o a) (f a) (g a)))
 but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_5 : Primcodable.{u1} σ] {o : α -> (Option.{u3} β)} {f : α -> σ} {g : α -> β -> σ}, (Primrec.{u2, u3} α (Option.{u3} β) _inst_1 (Primcodable.option.{u3} β _inst_2) o) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 f) -> (Primrec₂.{u2, u3, u1} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 (fun (a : α) => Option.casesOn.{succ u1, u3} β (fun (_x : Option.{u3} β) => σ) (o a) (f a) (g a)))
-Case conversion may be inaccurate. Consider using '#align primrec.option_cases Primrec.option_casesₓ'. -/
-theorem option_cases {o : α → Option β} {f : α → σ} {g : α → β → σ} (ho : Primrec o)
+Case conversion may be inaccurate. Consider using '#align primrec.option_cases Primrec.option_casesOnₓ'. -/
+theorem option_casesOn {o : α → Option β} {f : α → σ} {g : α → β → σ} (ho : Primrec o)
     (hf : Primrec f) (hg : Primrec₂ g) :
     @Primrec _ σ _ _ fun a => Option.casesOn (o a) (f a) (g a) :=
   encode_iff.1 <|
-    (nat_cases (encode_iff.2 ho) (encode_iff.2 hf) <|
+    (nat_casesOn (encode_iff.2 ho) (encode_iff.2 hf) <|
           pred.comp₂ <|
             Primrec₂.encode_iff.2 <|
               (Primrec₂.nat_iff'.1 hg).comp₂ ((@Primrec.encode α _).comp fst).to₂
                 Primrec₂.right).of_eq
       fun a => by cases' o a with b <;> simp [encodek] <;> rfl
-#align primrec.option_cases Primrec.option_cases
+#align primrec.option_cases Primrec.option_casesOn
 
 /- warning: primrec.option_bind -> Primrec.option_bind is a dubious translation:
 lean 3 declaration is
@@ -983,7 +984,7 @@ but is expected to have type
 Case conversion may be inaccurate. Consider using '#align primrec.option_bind Primrec.option_bindₓ'. -/
 theorem option_bind {f : α → Option β} {g : α → β → Option σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).bind (g a) :=
-  (option_cases hf (const none) hg).of_eq fun a => by cases f a <;> rfl
+  (option_casesOn hf (const none) hg).of_eq fun a => by cases f a <;> rfl
 #align primrec.option_bind Primrec.option_bind
 
 #print Primrec.option_bind₁ /-
@@ -1015,19 +1016,20 @@ theorem option_map₁ {f : α → σ} (hf : Primrec f) : Primrec (Option.map f)
 
 #print Primrec.option_iget /-
 theorem option_iget [Inhabited α] : Primrec (@Option.iget α _) :=
-  (option_cases Primrec.id (const <| @default α _) Primrec₂.right).of_eq fun o => by cases o <;> rfl
+  (option_casesOn Primrec.id (const <| @default α _) Primrec₂.right).of_eq fun o => by
+    cases o <;> rfl
 #align primrec.option_iget Primrec.option_iget
 -/
 
 #print Primrec.option_isSome /-
 theorem option_isSome : Primrec (@Option.isSome α) :=
-  (option_cases Primrec.id (const false) (const true).to₂).of_eq fun o => by cases o <;> rfl
+  (option_casesOn Primrec.id (const false) (const true).to₂).of_eq fun o => by cases o <;> rfl
 #align primrec.option_is_some Primrec.option_isSome
 -/
 
 #print Primrec.option_getD /-
 theorem option_getD : Primrec₂ (@Option.getD α) :=
-  Primrec.of_eq (option_cases Primrec₂.left Primrec₂.right Primrec₂.right) fun ⟨o, a⟩ => by
+  Primrec.of_eq (option_casesOn Primrec₂.left Primrec₂.right Primrec₂.right) fun ⟨o, a⟩ => by
     cases o <;> rfl
 #align primrec.option_get_or_else Primrec.option_getD
 -/
@@ -1081,7 +1083,7 @@ but is expected to have type
 Case conversion may be inaccurate. Consider using '#align primrec.cond Primrec.condₓ'. -/
 theorem cond {c : α → Bool} {f : α → σ} {g : α → σ} (hc : Primrec c) (hf : Primrec f)
     (hg : Primrec g) : Primrec fun a => cond (c a) (f a) (g a) :=
-  (nat_cases (encode_iff.2 hc) hg (hf.comp fst).to₂).of_eq fun a => by cases c a <;> rfl
+  (nat_casesOn (encode_iff.2 hc) hg (hf.comp fst).to₂).of_eq fun a => by cases c a <;> rfl
 #align primrec.cond Primrec.cond
 
 /- warning: primrec.ite -> Primrec.ite is a dubious translation:
@@ -1102,7 +1104,7 @@ but is expected to have type
   PrimrecRel.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (x._@.Mathlib.Computability.Primrec._hyg.6194 : Nat) (x._@.Mathlib.Computability.Primrec._hyg.6196 : Nat) => LE.le.{0} Nat instLENat x._@.Mathlib.Computability.Primrec._hyg.6194 x._@.Mathlib.Computability.Primrec._hyg.6196) (fun (a : Nat) (b : Nat) => Nat.decLe a b)
 Case conversion may be inaccurate. Consider using '#align primrec.nat_le Primrec.nat_leₓ'. -/
 theorem nat_le : PrimrecRel ((· ≤ ·) : ℕ → ℕ → Prop) :=
-  (nat_cases nat_sub (const true) (const false).to₂).of_eq fun p =>
+  (nat_casesOn nat_sub (const true) (const false).to₂).of_eq fun p =>
     by
     dsimp [swap]
     cases' e : p.1 - p.2 with n
@@ -1219,7 +1221,7 @@ but is expected to have type
   forall {α : Type.{u1}} [_inst_1 : Primcodable.{u1} α], Primrec₂.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (fun (x._@.Mathlib.Computability.Primrec._hyg.7041 : Option.{u1} α) (x._@.Mathlib.Computability.Primrec._hyg.7043 : Option.{u1} α) => HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) x._@.Mathlib.Computability.Primrec._hyg.7041 (fun (x._@.Mathlib.Computability.Primrec._hyg.7053 : Unit) => x._@.Mathlib.Computability.Primrec._hyg.7043))
 Case conversion may be inaccurate. Consider using '#align primrec.option_orelse Primrec.option_orElseₓ'. -/
 theorem option_orElse : Primrec₂ ((· <|> ·) : Option α → Option α → Option α) :=
-  (option_cases fst snd (fst.comp fst).to₂).of_eq fun ⟨o₁, o₂⟩ => by cases o₁ <;> cases o₂ <;> rfl
+  (option_casesOn fst snd (fst.comp fst).to₂).of_eq fun ⟨o₁, o₂⟩ => by cases o₁ <;> cases o₂ <;> rfl
 #align primrec.option_orelse Primrec.option_orElse
 
 #print Primrec.decode₂ /-
@@ -1269,7 +1271,7 @@ but is expected to have type
   forall {α : Type.{u}} {β : Type.{v}}, (Nat -> α -> β) -> Nat -> (List.{u} α) -> (List.{v} β)
 Case conversion may be inaccurate. Consider using '#align primrec.nat_bodd_div2 [anonymous]ₓ'. -/
 theorem [anonymous] : Primrec Nat.boddDiv2 :=
-  (nat_elim' Primrec.id (const (false, 0))
+  (nat_rec' Primrec.id (const (false, 0))
         (((cond fst (pair (const false) (succ.comp snd)) (pair (const true) snd)).comp snd).comp
             snd).to₂).of_eq
     fun n => by
@@ -1328,7 +1330,7 @@ theorem [anonymous] : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
     a.1.elim (0, 0) fun _ IH =>
       if Nat.succ IH.2 = a.2 then (Nat.succ IH.1, 0) else (IH.1, Nat.succ IH.2)
   have hf : Primrec f :=
-    nat_elim' fst (const (0, 0)) <|
+    nat_rec' fst (const (0, 0)) <|
       ((ite ((@Primrec.eq ℕ _ _).comp (succ.comp <| snd.comp snd) fst)
               (pair (succ.comp <| fst.comp snd) (const 0))
               (pair (fst.comp snd) (succ.comp <| snd.comp snd))).comp
@@ -1544,20 +1546,20 @@ theorem sum_inr : Primrec (@Sum.inr α β) :=
 #align primrec.sum_inr Primrec.sum_inr
 -/
 
-/- warning: primrec.sum_cases -> Primrec.sum_cases is a dubious translation:
+/- warning: primrec.sum_cases -> Primrec.sum_casesOn is a dubious translation:
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {σ : Type.{u4}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u4} σ] {f : α -> (Sum.{u2, u3} β γ)} {g : α -> β -> σ} {h : α -> γ -> σ}, (Primrec.{u1, max u2 u3} α (Sum.{u2, u3} β γ) _inst_1 (Primcodable.sum.{u2, u3} β γ _inst_2 _inst_3) f) -> (Primrec₂.{u1, u2, u4} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec₂.{u1, u3, u4} α γ σ _inst_1 _inst_3 _inst_4 h) -> (Primrec.{u1, u4} α σ _inst_1 _inst_4 (fun (a : α) => Sum.casesOn.{succ u4, u2, u3} β γ (fun (_x : Sum.{u2, u3} β γ) => σ) (f a) (g a) (h a)))
 but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u4}} {γ : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u4} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u1} σ] {f : α -> (Sum.{u4, u3} β γ)} {g : α -> β -> σ} {h : α -> γ -> σ}, (Primrec.{u2, max u4 u3} α (Sum.{u4, u3} β γ) _inst_1 (Primcodable.sum.{u4, u3} β γ _inst_2 _inst_3) f) -> (Primrec₂.{u2, u4, u1} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec₂.{u2, u3, u1} α γ σ _inst_1 _inst_3 _inst_4 h) -> (Primrec.{u2, u1} α σ _inst_1 _inst_4 (fun (a : α) => Sum.casesOn.{succ u1, u4, u3} β γ (fun (_x : Sum.{u4, u3} β γ) => σ) (f a) (g a) (h a)))
-Case conversion may be inaccurate. Consider using '#align primrec.sum_cases Primrec.sum_casesₓ'. -/
-theorem sum_cases {f : α → Sum β γ} {g : α → β → σ} {h : α → γ → σ} (hf : Primrec f)
+Case conversion may be inaccurate. Consider using '#align primrec.sum_cases Primrec.sum_casesOnₓ'. -/
+theorem sum_casesOn {f : α → Sum β γ} {g : α → β → σ} {h : α → γ → σ} (hf : Primrec f)
     (hg : Primrec₂ g) (hh : Primrec₂ h) : @Primrec _ σ _ _ fun a => Sum.casesOn (f a) (g a) (h a) :=
   option_some_iff.1 <|
     (cond (nat_bodd.comp <| encode_iff.2 hf)
           (option_map (Primrec.decode.comp <| nat_div2.comp <| encode_iff.2 hf) hh)
           (option_map (Primrec.decode.comp <| nat_div2.comp <| encode_iff.2 hf) hg)).of_eq
       fun a => by cases' f a with b c <;> simp [Nat.div2_bit, Nat.bodd_bit, encodek] <;> rfl
-#align primrec.sum_cases Primrec.sum_cases
+#align primrec.sum_cases Primrec.sum_casesOn
 
 #print Primrec.list_cons /-
 theorem list_cons : Primrec₂ (@List.cons α) :=
@@ -1565,18 +1567,18 @@ theorem list_cons : Primrec₂ (@List.cons α) :=
 #align primrec.list_cons Primrec.list_cons
 -/
 
-/- warning: primrec.list_cases -> Primrec.list_cases is a dubious translation:
+/- warning: primrec.list_cases -> Primrec.list_casesOn is a dubious translation:
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> σ} {h : α -> (Prod.{u2, u2} β (List.{u2} β)) -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, u2, u3} α (Prod.{u2, u2} β (List.{u2} β)) σ _inst_1 (Primcodable.prod.{u2, u2} β (List.{u2} β) _inst_2 (Primcodable.list.{u2} β _inst_2)) _inst_4 h) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 (fun (a : α) => List.casesOn.{succ u3, u2} β (fun (_x : List.{u2} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u2} β) => h a (Prod.mk.{u2, u2} β (List.{u2} β) b l))))
 but is expected to have type
   forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u1} σ] {f : α -> (List.{u3} β)} {g : α -> σ} {h : α -> (Prod.{u3, u3} β (List.{u3} β)) -> σ}, (Primrec.{u2, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec.{u2, u1} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u2, u3, u1} α (Prod.{u3, u3} β (List.{u3} β)) σ _inst_1 (Primcodable.prod.{u3, u3} β (List.{u3} β) _inst_2 (Primcodable.list.{u3} β _inst_2)) _inst_4 h) -> (Primrec.{u2, u1} α σ _inst_1 _inst_4 (fun (a : α) => List.casesOn.{succ u1, u3} β (fun (_x : List.{u3} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u3} β) => h a (Prod.mk.{u3, u3} β (List.{u3} β) b l))))
-Case conversion may be inaccurate. Consider using '#align primrec.list_cases Primrec.list_casesₓ'. -/
-theorem list_cases {f : α → List β} {g : α → σ} {h : α → β × List β → σ} :
+Case conversion may be inaccurate. Consider using '#align primrec.list_cases Primrec.list_casesOnₓ'. -/
+theorem list_casesOn {f : α → List β} {g : α → σ} {h : α → β × List β → σ} :
     Primrec f →
       Primrec g →
         Primrec₂ h → @Primrec _ σ _ _ fun a => List.casesOn (f a) (g a) fun b l => h a (b, l) :=
   list_cases' (Primcodable.prim _)
-#align primrec.list_cases Primrec.list_cases
+#align primrec.list_cases Primrec.list_casesOn
 
 /- warning: primrec.list_foldl -> Primrec.list_foldl is a dubious translation:
 lean 3 declaration is
@@ -1611,7 +1613,7 @@ theorem list_foldr {f : α → List β} {g : α → σ} {h : α → β × σ →
 
 #print Primrec.list_head? /-
 theorem list_head? : Primrec (@List.head? α) :=
-  (list_cases Primrec.id (const none) (option_some_iff.2 <| fst.comp snd).to₂).of_eq fun l => by
+  (list_casesOn Primrec.id (const none) (option_some_iff.2 <| fst.comp snd).to₂).of_eq fun l => by
     cases l <;> rfl
 #align primrec.list_head' Primrec.list_head?
 -/
@@ -1624,7 +1626,7 @@ theorem list_headI [Inhabited α] : Primrec (@List.headI α _) :=
 
 #print Primrec.list_tail /-
 theorem list_tail : Primrec (@List.tail α) :=
-  (list_cases Primrec.id (const []) (snd.comp snd).to₂).of_eq fun l => by cases l <;> rfl
+  (list_casesOn Primrec.id (const []) (snd.comp snd).to₂).of_eq fun l => by cases l <;> rfl
 #align primrec.list_tail Primrec.list_tail
 -/
 
@@ -1657,12 +1659,12 @@ theorem list_get? : Primrec₂ (@List.get? α) :=
       (Sum.inl n)
   have hF : Primrec₂ F :=
     list_foldl fst (sum_inl.comp snd)
-      ((sum_cases fst (nat_cases snd (sum_inr.comp <| snd.comp fst) (sum_inl.comp snd).to₂).to₂
+      ((sum_casesOn fst (nat_casesOn snd (sum_inr.comp <| snd.comp fst) (sum_inl.comp snd).to₂).to₂
               (sum_inr.comp snd).to₂).comp
           snd).to₂
   have :
     @Primrec _ (Option α) _ _ fun p : List α × ℕ => Sum.casesOn (F p.1 p.2) (fun _ => none) some :=
-    sum_cases hF (const none).to₂ (option_some.comp snd).to₂
+    sum_casesOn hF (const none).to₂ (option_some.comp snd).to₂
   this.to₂.of_eq fun l n => by
     dsimp; symm
     induction' l with a l IH generalizing n; · rfl
@@ -1718,7 +1720,7 @@ theorem list_map {f : α → List β} {g : α → β → σ} (hf : Primrec f) (h
 
 #print Primrec.list_range /-
 theorem list_range : Primrec List.range :=
-  (nat_elim' Primrec.id (const []) ((list_concat.comp snd fst).comp snd).to₂).of_eq fun n => by
+  (nat_rec' Primrec.id (const []) ((list_concat.comp snd fst).comp snd).to₂).of_eq fun n => by
     simp <;> induction n <;> simp [*, List.range_succ] <;> rfl
 #align primrec.list_range Primrec.list_range
 -/
@@ -1762,7 +1764,7 @@ theorem nat_strong_rec (f : α → ℕ → σ) {g : α → List σ → Option σ
       (list_get?.comp (this.comp fst (succ.comp snd)) snd).to₂.of_eq fun a n => by
         simp [List.get?_range (Nat.lt_succ_self n)] <;> rfl
   Primrec₂.option_some_iff.1 <|
-    (nat_elim (const (some []))
+    (nat_rec (const (some []))
           (to₂ <|
             option_bind (snd.comp snd) <|
               to₂ <|
@@ -1994,21 +1996,21 @@ theorem vector_ofFn {n} {f : Fin n → α → σ} (hf : ∀ i, Primrec (f i)) :
   vector_toList_iff.1 <| by simp [list_of_fn hf]
 #align primrec.vector_of_fn Primrec.vector_ofFn
 
-#print Primrec.vector_nth' /-
-theorem vector_nth' {n} : Primrec (@Vector.get α n) :=
-  ofEquiv_symm
-#align primrec.vector_nth' Primrec.vector_nth'
+#print Primrec.vector_get' /-
+theorem vector_get' {n} : Primrec (@Vector.get α n) :=
+  of_equiv_symm
+#align primrec.vector_nth' Primrec.vector_get'
 -/
 
-#print Primrec.vector_of_fn' /-
-theorem vector_of_fn' {n} : Primrec (@Vector.ofFn α n) :=
-  ofEquiv
-#align primrec.vector_of_fn' Primrec.vector_of_fn'
+#print Primrec.vector_ofFn' /-
+theorem vector_ofFn' {n} : Primrec (@Vector.ofFn α n) :=
+  of_equiv
+#align primrec.vector_of_fn' Primrec.vector_ofFn'
 -/
 
 #print Primrec.fin_app /-
 theorem fin_app {n} : Primrec₂ (@id (Fin n → σ)) :=
-  (vector_get.comp (vector_of_fn'.comp fst) snd).of_eq fun ⟨v, i⟩ => by simp
+  (vector_get.comp (vector_ofFn'.comp fst) snd).of_eq fun ⟨v, i⟩ => by simp
 #align primrec.fin_app Primrec.fin_app
 -/
 
@@ -2031,7 +2033,7 @@ but is expected to have type
 Case conversion may be inaccurate. Consider using '#align primrec.fin_curry Primrec.fin_curryₓ'. -/
 theorem fin_curry {n} {f : α → Fin n → σ} : Primrec f ↔ Primrec₂ f :=
   ⟨fun h => fin_app.comp (h.comp fst) snd, fun h =>
-    (vector_nth'.comp
+    (vector_get'.comp
           (vector_ofFn fun i => show Primrec fun a => f a i from h.comp Primrec.id (const i))).of_eq
       fun a => by funext i <;> simp⟩
 #align primrec.fin_curry Primrec.fin_curry
Diff
@@ -56,7 +56,7 @@ warning: nat.elim_zero -> Nat.rec_zero is a dubious translation:
 lean 3 declaration is
   forall {C : Sort.{u1}} (a : C) (f : Nat -> C -> C), Eq.{u1} C (Nat.rec.{u1} C a f (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) a
 but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2994 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2994) a f t) (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2991 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2991) a f (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
 Case conversion may be inaccurate. Consider using '#align nat.elim_zero Nat.rec_zeroₓ'. -/
 @[simp]
 theorem rec_zero {C} (a f) : @Nat.rec C a f 0 = a :=
@@ -68,7 +68,7 @@ warning: nat.elim_succ -> Nat.rec_add_one is a dubious translation:
 lean 3 declaration is
   forall {C : Sort.{u1}} (a : C) (f : Nat -> C -> C) (n : Nat), Eq.{u1} C (Nat.rec.{u1} C a f (Nat.succ n)) (f n (Nat.rec.{u1} C a f n))
 but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3047 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3047) a f t) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3070 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3070) a f t) n))
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Nat.rec.{u1} C a f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3041 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3041) a f n))
 Case conversion may be inaccurate. Consider using '#align nat.elim_succ Nat.rec_add_oneₓ'. -/
 @[simp]
 theorem rec_add_one {C} (a f n) : @Nat.rec C a f (succ n) = f n (Nat.rec a f n) :=
@@ -91,7 +91,7 @@ warning: nat.cases_zero -> Nat.rec_zero is a dubious translation:
 lean 3 declaration is
   forall {C : Sort.{u1}} (a : C) (f : Nat -> C), Eq.{u1} C (Nat.casesOn.{u1} C a f (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) a
 but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2994 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2994) a f t) (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2991 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2991) a f (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
 Case conversion may be inaccurate. Consider using '#align nat.cases_zero Nat.rec_zeroₓ'. -/
 @[simp]
 theorem rec_zero {C} (a f) : @Nat.casesOn C a f 0 = a :=
@@ -103,7 +103,7 @@ warning: nat.cases_succ -> Nat.rec_add_one is a dubious translation:
 lean 3 declaration is
   forall {C : Sort.{u1}} (a : C) (f : Nat -> C) (n : Nat), Eq.{u1} C (Nat.casesOn.{u1} C a f (Nat.succ n)) (f n)
 but is expected to have type
-  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3047 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3047) a f t) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3070 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3070) a f t) n))
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (Nat.rec.{u1} C a f (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n (Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3041 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3041) a f n))
 Case conversion may be inaccurate. Consider using '#align nat.cases_succ Nat.rec_add_oneₓ'. -/
 @[simp]
 theorem rec_add_one {C} (a f n) : @Nat.casesOn C a f (succ n) = f n :=
Diff
@@ -225,7 +225,7 @@ end Primrec
 end Nat
 
 #print Primcodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
 /-- A `primcodable` type is an `encodable` type for which
   the encode/decode functions are primitive recursive. -/
 class Primcodable (α : Type _) extends Encodable α where
@@ -1823,7 +1823,7 @@ instance array {n} : Primcodable (Array' n α) :=
 
 section Ulower
 
-attribute [local instance] Encodable.decidableRangeEncode Encodable.decidableEqOfEncodable
+attribute [local instance 100] Encodable.decidableRangeEncode Encodable.decidableEqOfEncodable
 
 #print Primcodable.ulower /-
 instance ulower : Primcodable (Ulower α) :=
@@ -2074,7 +2074,7 @@ open Nat (Primrec')
 
 open Nat.Primrec'
 
-/- ./././Mathport/Syntax/Translate/Command.lean:691:6: unsupported: hide command -/
+/- ./././Mathport/Syntax/Translate/Command.lean:696:6: unsupported: hide command -/
 #print Nat.Primrec'.to_prim /-
 theorem to_prim {n f} (pf : @Primrec' n f) : Primrec f :=
   by
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.primrec
-! leanprover-community/mathlib commit 959c3b69db8a8b404d5813421f2e6ca8660d19e5
+! leanprover-community/mathlib commit 31ca6f9cf5f90a6206092cd7f84b359dcb6d52e0
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.Logic.Function.Iterate
 /-!
 # The primitive recursive functions
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 The primitive recursive functions are the least collection of functions
 `nat → nat` which are closed under projections (using the mkpair
 pairing function), composition, zero, successor, and primitive recursion
Diff
@@ -122,13 +122,12 @@ inductive Primrec : (ℕ → ℕ) → Prop
   | succ : Primrec succ
   | left : Primrec fun n => n.unpair.1
   | right : Primrec fun n => n.unpair.2
-  | pair {f g} : Primrec f → Primrec g → Primrec fun n => mkpair (f n) (g n)
+  | pair {f g} : Primrec f → Primrec g → Primrec fun n => pair (f n) (g n)
   | comp {f g} : Primrec f → Primrec g → Primrec fun n => f (g n)
   |
   prec {f g} :
     Primrec f →
-      Primrec g →
-        Primrec (unpaired fun z n => n.elim (f z) fun y IH => g <| mkpair z <| mkpair y IH)
+      Primrec g → Primrec (unpaired fun z n => n.elim (f z) fun y IH => g <| pair z <| pair y IH)
 #align nat.primrec Nat.Primrec
 -/
 
@@ -154,8 +153,7 @@ protected theorem id : Primrec id :=
 -/
 
 #print Nat.Primrec.prec1 /-
-theorem prec1 {f} (m : ℕ) (hf : Primrec f) :
-    Primrec fun n => n.elim m fun y IH => f <| mkpair y IH :=
+theorem prec1 {f} (m : ℕ) (hf : Primrec f) : Primrec fun n => n.elim m fun y IH => f <| pair y IH :=
   ((prec (const m) (hf.comp right)).comp (zero.pair Primrec.id)).of_eq fun n => by simp
 #align nat.primrec.prec1 Nat.Primrec.prec1
 -/
@@ -168,13 +166,13 @@ theorem cases1 {f} (m : ℕ) (hf : Primrec f) : Primrec (Nat.casesOn m f) :=
 
 #print Nat.Primrec.cases /-
 theorem cases {f g} (hf : Primrec f) (hg : Primrec g) :
-    Primrec (unpaired fun z n => n.cases (f z) fun y => g <| mkpair z y) :=
+    Primrec (unpaired fun z n => n.cases (f z) fun y => g <| pair z y) :=
   (prec hf (hg.comp (pair left (left.comp right)))).of_eq <| by simp [cases]
 #align nat.primrec.cases Nat.Primrec.cases
 -/
 
 #print Nat.Primrec.swap /-
-protected theorem swap : Primrec (unpaired (swap mkpair)) :=
+protected theorem swap : Primrec (unpaired (swap pair)) :=
   (pair right left).of_eq fun n => by simp
 #align nat.primrec.swap Nat.Primrec.swap
 -/
@@ -654,9 +652,9 @@ theorem right : Primrec₂ fun (a : α) (b : β) => b :=
   Primrec.snd
 #align primrec₂.right Primrec₂.right
 
-#print Primrec₂.mkpair /-
-theorem mkpair : Primrec₂ Nat.mkpair := by simp [Primrec₂, Primrec] <;> constructor
-#align primrec₂.mkpair Primrec₂.mkpair
+#print Primrec₂.natPair /-
+theorem natPair : Primrec₂ Nat.pair := by simp [Primrec₂, Primrec] <;> constructor
+#align primrec₂.mkpair Primrec₂.natPair
 -/
 
 #print Primrec₂.unpaired /-
@@ -1515,7 +1513,7 @@ instance list : Primcodable (List α) :=
         exact this _ _ (IH _ (Nat.unpair_right_le n))
         intro o p IH
         cases o <;> cases p <;> injection IH with h
-        exact congr_arg (fun k => (Nat.mkpair (encode a) k).succ.succ) h⟩
+        exact congr_arg (fun k => (Nat.pair (encode a) k).succ.succ) h⟩
 #align primcodable.list Primcodable.list
 -/
 
@@ -2212,17 +2210,17 @@ theorem if_lt {n a b f g} (ha : @Primrec' n a) (hb : @Primrec' n b) (hf : @Primr
     · simp [Nat.lt_of_sub_eq_succ e]
 #align nat.primrec'.if_lt Nat.Primrec'.if_lt
 
-#print Nat.Primrec'.mkpair /-
-theorem mkpair : @Primrec' 2 fun v => v.headI.mkpair v.tail.headI :=
+#print Nat.Primrec'.natPair /-
+theorem natPair : @Primrec' 2 fun v => v.headI.pair v.tail.headI :=
   if_lt head (tail head) (add.comp₂ _ (tail <| mul.comp₂ _ head head) head)
     (add.comp₂ _ (add.comp₂ _ (mul.comp₂ _ head head) head) (tail head))
-#align nat.primrec'.mkpair Nat.Primrec'.mkpair
+#align nat.primrec'.mkpair Nat.Primrec'.natPair
 -/
 
 #print Nat.Primrec'.encode /-
 protected theorem encode : ∀ {n}, @Primrec' n encode
   | 0 => (const 0).of_eq fun v => by rw [v.eq_nil] <;> rfl
-  | n + 1 => (succ.comp₁ _ (mkpair.comp₂ _ head (tail encode))).of_eq fun ⟨a :: l, e⟩ => rfl
+  | n + 1 => (succ.comp₁ _ (natPair.comp₂ _ head (tail encode))).of_eq fun ⟨a :: l, e⟩ => rfl
 #align nat.primrec'.encode Nat.Primrec'.encode
 -/
 
Diff
@@ -37,42 +37,85 @@ open Denumerable Encodable Function
 
 namespace Nat
 
+/- warning: nat.elim -> Nat.rec is a dubious translation:
+lean 3 declaration is
+  forall {C : Sort.{u1}}, C -> (Nat -> C -> C) -> Nat -> C
+but is expected to have type
+  forall {C : Nat -> Sort.{u1}}, (C Nat.zero) -> (forall (ᾰ : Nat), (C ᾰ) -> (C (Nat.succ ᾰ))) -> (forall (ᾰ : Nat), C ᾰ)
+Case conversion may be inaccurate. Consider using '#align nat.elim Nat.recₓ'. -/
 /-- The non-dependent recursor on naturals. -/
-def elim {C : Sort _} : C → (ℕ → C → C) → ℕ → C :=
+def rec {C : Sort _} : C → (ℕ → C → C) → ℕ → C :=
   @Nat.rec fun _ => C
-#align nat.elim Nat.elim
+#align nat.elim Nat.rec
 
+/- warning: nat.elim_zero clashes with nat.rec_zero -> Nat.rec_zero
+warning: nat.elim_zero -> Nat.rec_zero is a dubious translation:
+lean 3 declaration is
+  forall {C : Sort.{u1}} (a : C) (f : Nat -> C -> C), Eq.{u1} C (Nat.rec.{u1} C a f (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) a
+but is expected to have type
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2994 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2994) a f t) (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
+Case conversion may be inaccurate. Consider using '#align nat.elim_zero Nat.rec_zeroₓ'. -/
 @[simp]
-theorem elim_zero {C} (a f) : @Nat.elim C a f 0 = a :=
+theorem rec_zero {C} (a f) : @Nat.rec C a f 0 = a :=
   rfl
-#align nat.elim_zero Nat.elim_zero
+#align nat.elim_zero Nat.rec_zero
 
+/- warning: nat.elim_succ clashes with nat.rec_add_one -> Nat.rec_add_one
+warning: nat.elim_succ -> Nat.rec_add_one is a dubious translation:
+lean 3 declaration is
+  forall {C : Sort.{u1}} (a : C) (f : Nat -> C -> C) (n : Nat), Eq.{u1} C (Nat.rec.{u1} C a f (Nat.succ n)) (f n (Nat.rec.{u1} C a f n))
+but is expected to have type
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3047 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3047) a f t) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3070 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3070) a f t) n))
+Case conversion may be inaccurate. Consider using '#align nat.elim_succ Nat.rec_add_oneₓ'. -/
 @[simp]
-theorem elim_succ {C} (a f n) : @Nat.elim C a f (succ n) = f n (Nat.elim a f n) :=
+theorem rec_add_one {C} (a f n) : @Nat.rec C a f (succ n) = f n (Nat.rec a f n) :=
   rfl
-#align nat.elim_succ Nat.elim_succ
+#align nat.elim_succ Nat.rec_add_one
 
+/- warning: nat.cases -> Nat.casesOn is a dubious translation:
+lean 3 declaration is
+  forall {C : Sort.{u1}}, C -> (Nat -> C) -> Nat -> C
+but is expected to have type
+  forall {C : Nat -> Sort.{u1}} (a : Nat), (C Nat.zero) -> (forall (n : Nat), C (Nat.succ n)) -> (C a)
+Case conversion may be inaccurate. Consider using '#align nat.cases Nat.casesOnₓ'. -/
 /-- Cases on whether the input is 0 or a successor. -/
-def cases {C : Sort _} (a : C) (f : ℕ → C) : ℕ → C :=
-  Nat.elim a fun n _ => f n
-#align nat.cases Nat.cases
+def casesOn {C : Sort _} (a : C) (f : ℕ → C) : ℕ → C :=
+  Nat.rec a fun n _ => f n
+#align nat.cases Nat.casesOn
 
+/- warning: nat.cases_zero clashes with nat.rec_zero -> Nat.rec_zero
+warning: nat.cases_zero -> Nat.rec_zero is a dubious translation:
+lean 3 declaration is
+  forall {C : Sort.{u1}} (a : C) (f : Nat -> C), Eq.{u1} C (Nat.casesOn.{u1} C a f (OfNat.ofNat.{0} Nat 0 (OfNat.mk.{0} Nat 0 (Zero.zero.{0} Nat Nat.hasZero)))) a
+but is expected to have type
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))), Eq.{u1} (C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.2994 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.2994) a f t) (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) a
+Case conversion may be inaccurate. Consider using '#align nat.cases_zero Nat.rec_zeroₓ'. -/
 @[simp]
-theorem cases_zero {C} (a f) : @Nat.cases C a f 0 = a :=
+theorem rec_zero {C} (a f) : @Nat.casesOn C a f 0 = a :=
   rfl
-#align nat.cases_zero Nat.cases_zero
+#align nat.cases_zero Nat.rec_zero
 
+/- warning: nat.cases_succ clashes with nat.rec_add_one -> Nat.rec_add_one
+warning: nat.cases_succ -> Nat.rec_add_one is a dubious translation:
+lean 3 declaration is
+  forall {C : Sort.{u1}} (a : C) (f : Nat -> C) (n : Nat), Eq.{u1} C (Nat.casesOn.{u1} C a f (Nat.succ n)) (f n)
+but is expected to have type
+  forall {C : Nat -> Sort.{u1}} (a : C (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0))) (f : forall (ᾰ : Nat), (C ᾰ) -> (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) ᾰ (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) (n : Nat), Eq.{u1} (C (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3047 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3047) a f t) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (f n ((fun (t : Nat) => Nat.rec.{u1} (fun (x._@.Mathlib.Data.Nat.Basic._hyg.3070 : Nat) => C x._@.Mathlib.Data.Nat.Basic._hyg.3070) a f t) n))
+Case conversion may be inaccurate. Consider using '#align nat.cases_succ Nat.rec_add_oneₓ'. -/
 @[simp]
-theorem cases_succ {C} (a f n) : @Nat.cases C a f (succ n) = f n :=
+theorem rec_add_one {C} (a f n) : @Nat.casesOn C a f (succ n) = f n :=
   rfl
-#align nat.cases_succ Nat.cases_succ
+#align nat.cases_succ Nat.rec_add_one
 
+#print Nat.unpaired /-
 /-- Calls the given function on a pair of entries `n`, encoded via the pairing function. -/
 @[simp, reducible]
 def unpaired {α} (f : ℕ → ℕ → α) (n : ℕ) : α :=
   f n.unpair.1 n.unpair.2
 #align nat.unpaired Nat.unpaired
+-/
 
+#print Nat.Primrec /-
 /-- The primitive recursive functions `ℕ → ℕ`. -/
 inductive Primrec : (ℕ → ℕ) → Prop
   | zero : Primrec fun n => 0
@@ -87,87 +130,119 @@ inductive Primrec : (ℕ → ℕ) → Prop
       Primrec g →
         Primrec (unpaired fun z n => n.elim (f z) fun y IH => g <| mkpair z <| mkpair y IH)
 #align nat.primrec Nat.Primrec
+-/
 
 namespace Primrec
 
+#print Nat.Primrec.of_eq /-
 theorem of_eq {f g : ℕ → ℕ} (hf : Primrec f) (H : ∀ n, f n = g n) : Primrec g :=
   (funext H : f = g) ▸ hf
 #align nat.primrec.of_eq Nat.Primrec.of_eq
+-/
 
+#print Nat.Primrec.const /-
 theorem const : ∀ n : ℕ, Primrec fun _ => n
   | 0 => zero
   | n + 1 => succ.comp (const n)
 #align nat.primrec.const Nat.Primrec.const
+-/
 
+#print Nat.Primrec.id /-
 protected theorem id : Primrec id :=
   (left.pair right).of_eq fun n => by simp
 #align nat.primrec.id Nat.Primrec.id
+-/
 
+#print Nat.Primrec.prec1 /-
 theorem prec1 {f} (m : ℕ) (hf : Primrec f) :
     Primrec fun n => n.elim m fun y IH => f <| mkpair y IH :=
   ((prec (const m) (hf.comp right)).comp (zero.pair Primrec.id)).of_eq fun n => by simp
 #align nat.primrec.prec1 Nat.Primrec.prec1
+-/
 
-theorem cases1 {f} (m : ℕ) (hf : Primrec f) : Primrec (Nat.cases m f) :=
+#print Nat.Primrec.cases1 /-
+theorem cases1 {f} (m : ℕ) (hf : Primrec f) : Primrec (Nat.casesOn m f) :=
   (prec1 m (hf.comp left)).of_eq <| by simp [cases]
 #align nat.primrec.cases1 Nat.Primrec.cases1
+-/
 
+#print Nat.Primrec.cases /-
 theorem cases {f g} (hf : Primrec f) (hg : Primrec g) :
     Primrec (unpaired fun z n => n.cases (f z) fun y => g <| mkpair z y) :=
   (prec hf (hg.comp (pair left (left.comp right)))).of_eq <| by simp [cases]
 #align nat.primrec.cases Nat.Primrec.cases
+-/
 
+#print Nat.Primrec.swap /-
 protected theorem swap : Primrec (unpaired (swap mkpair)) :=
   (pair right left).of_eq fun n => by simp
 #align nat.primrec.swap Nat.Primrec.swap
+-/
 
+#print Nat.Primrec.swap' /-
 theorem swap' {f} (hf : Primrec (unpaired f)) : Primrec (unpaired (swap f)) :=
   (hf.comp Primrec.swap).of_eq fun n => by simp
 #align nat.primrec.swap' Nat.Primrec.swap'
+-/
 
+#print Nat.Primrec.pred /-
 theorem pred : Primrec pred :=
   (cases1 0 Primrec.id).of_eq fun n => by cases n <;> simp [*]
 #align nat.primrec.pred Nat.Primrec.pred
+-/
 
+#print Nat.Primrec.add /-
 theorem add : Primrec (unpaired (· + ·)) :=
   (prec Primrec.id ((succ.comp right).comp right)).of_eq fun p => by
     simp <;> induction p.unpair.2 <;> simp [*, -add_comm, add_succ]
 #align nat.primrec.add Nat.Primrec.add
+-/
 
+#print Nat.Primrec.sub /-
 theorem sub : Primrec (unpaired Sub.sub) :=
   (prec Primrec.id ((pred.comp right).comp right)).of_eq fun p => by
     simp <;> induction p.unpair.2 <;> simp [*, -add_comm, sub_succ]
 #align nat.primrec.sub Nat.Primrec.sub
+-/
 
+#print Nat.Primrec.mul /-
 theorem mul : Primrec (unpaired (· * ·)) :=
   (prec zero (add.comp (pair left (right.comp right)))).of_eq fun p => by
     simp <;> induction p.unpair.2 <;> simp [*, mul_succ, add_comm]
 #align nat.primrec.mul Nat.Primrec.mul
+-/
 
+#print Nat.Primrec.pow /-
 theorem pow : Primrec (unpaired (· ^ ·)) :=
   (prec (const 1) (mul.comp (pair (right.comp right) left))).of_eq fun p => by
     simp <;> induction p.unpair.2 <;> simp [*, pow_succ']
 #align nat.primrec.pow Nat.Primrec.pow
+-/
 
 end Primrec
 
 end Nat
 
+#print Primcodable /-
 /- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`prim] [] -/
 /-- A `primcodable` type is an `encodable` type for which
   the encode/decode functions are primitive recursive. -/
 class Primcodable (α : Type _) extends Encodable α where
   prim : Nat.Primrec fun n => Encodable.encode (decode n)
 #align primcodable Primcodable
+-/
 
 namespace Primcodable
 
 open Nat.Primrec
 
+#print Primcodable.ofDenumerable /-
 instance (priority := 10) ofDenumerable (α) [Denumerable α] : Primcodable α :=
   ⟨succ.of_eq <| by simp⟩
 #align primcodable.of_denumerable Primcodable.ofDenumerable
+-/
 
+#print Primcodable.ofEquiv /-
 /-- Builds a `primcodable` instance from an equivalence to a `primcodable` type. -/
 def ofEquiv (α) {β} [Primcodable α] (e : β ≃ α) : Primcodable β :=
   { Encodable.ofEquiv α e with
@@ -178,34 +253,45 @@ def ofEquiv (α) {β} [Primcodable α] (e : β ≃ α) : Primcodable β :=
             (Option.casesOn (Option.map e.symm (decode α n)) 0 fun a => Nat.succ (encode (e a)) : ℕ)
           by cases decode α n <;> dsimp <;> simp }
 #align primcodable.of_equiv Primcodable.ofEquiv
+-/
 
+#print Primcodable.empty /-
 instance empty : Primcodable Empty :=
   ⟨zero⟩
 #align primcodable.empty Primcodable.empty
+-/
 
+#print Primcodable.unit /-
 instance unit : Primcodable PUnit :=
   ⟨(cases1 1 zero).of_eq fun n => by cases n <;> simp⟩
 #align primcodable.unit Primcodable.unit
+-/
 
+#print Primcodable.option /-
 instance option {α : Type _} [h : Primcodable α] : Primcodable (Option α) :=
   ⟨(cases1 1 ((cases1 0 (succ.comp succ)).comp (Primcodable.prim α))).of_eq fun n => by
       cases n <;> simp <;> cases decode α n <;> rfl⟩
 #align primcodable.option Primcodable.option
+-/
 
+#print Primcodable.bool /-
 instance bool : Primcodable Bool :=
   ⟨(cases1 1 (cases1 2 zero)).of_eq fun n => by
       cases n; · rfl; cases n; · rfl
       rw [decode_ge_two]; · rfl
       exact by decide⟩
 #align primcodable.bool Primcodable.bool
+-/
 
 end Primcodable
 
+#print Primrec /-
 /-- `primrec f` means `f` is primitive recursive (after
   encoding its input and output as natural numbers). -/
 def Primrec {α β} [Primcodable α] [Primcodable β] (f : α → β) : Prop :=
   Nat.Primrec fun n => encode ((decode α n).map f)
 #align primrec Primrec
+-/
 
 namespace Primrec
 
@@ -215,46 +301,82 @@ variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
 open Nat.Primrec
 
+#print Primrec.encode /-
 protected theorem encode : Primrec (@encode α _) :=
   (Primcodable.prim α).of_eq fun n => by cases decode α n <;> rfl
 #align primrec.encode Primrec.encode
+-/
 
+#print Primrec.decode /-
 protected theorem decode : Primrec (decode α) :=
   succ.comp (Primcodable.prim α)
 #align primrec.decode Primrec.decode
+-/
 
+/- warning: primrec.dom_denumerable -> Primrec.dom_denumerable is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_4 : Denumerable.{u1} α] [_inst_5 : Primcodable.{u2} β] {f : α -> β}, Iff (Primrec.{u1, u2} α β (Primcodable.ofDenumerable.{u1} α _inst_4) _inst_5 f) (Nat.Primrec (fun (n : Nat) => Encodable.encode.{u2} β (Primcodable.toEncodable.{u2} β _inst_5) (f (Denumerable.ofNat.{u1} α _inst_4 n))))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_4 : Denumerable.{u2} α] [_inst_5 : Primcodable.{u1} β] {f : α -> β}, Iff (Primrec.{u2, u1} α β (Primcodable.ofDenumerable.{u2} α _inst_4) _inst_5 f) (Nat.Primrec (fun (n : Nat) => Encodable.encode.{u1} β (Primcodable.toEncodable.{u1} β _inst_5) (f (Denumerable.ofNat.{u2} α _inst_4 n))))
+Case conversion may be inaccurate. Consider using '#align primrec.dom_denumerable Primrec.dom_denumerableₓ'. -/
 theorem dom_denumerable {α β} [Denumerable α] [Primcodable β] {f : α → β} :
     Primrec f ↔ Nat.Primrec fun n => encode (f (ofNat α n)) :=
   ⟨fun h => (pred.comp h).of_eq fun n => by simp <;> rfl, fun h =>
     (succ.comp h).of_eq fun n => by simp <;> rfl⟩
 #align primrec.dom_denumerable Primrec.dom_denumerable
 
+#print Primrec.nat_iff /-
 theorem nat_iff {f : ℕ → ℕ} : Primrec f ↔ Nat.Primrec f :=
   dom_denumerable
 #align primrec.nat_iff Primrec.nat_iff
+-/
 
+#print Primrec.encdec /-
 theorem encdec : Primrec fun n => encode (decode α n) :=
   nat_iff.2 (Primcodable.prim α)
 #align primrec.encdec Primrec.encdec
+-/
 
+#print Primrec.option_some /-
 theorem option_some : Primrec (@some α) :=
   ((cases1 0 (succ.comp succ)).comp (Primcodable.prim α)).of_eq fun n => by
     cases decode α n <;> simp
 #align primrec.option_some Primrec.option_some
+-/
 
+/- warning: primrec.of_eq -> Primrec.of_eq is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {f : α -> σ} {g : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_3 f) -> (forall (n : α), Eq.{succ u2} σ (f n) (g n)) -> (Primrec.{u1, u2} α σ _inst_1 _inst_3 g)
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {f : α -> σ} {g : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_3 f) -> (forall (n : α), Eq.{succ u1} σ (f n) (g n)) -> (Primrec.{u2, u1} α σ _inst_1 _inst_3 g)
+Case conversion may be inaccurate. Consider using '#align primrec.of_eq Primrec.of_eqₓ'. -/
 theorem of_eq {f g : α → σ} (hf : Primrec f) (H : ∀ n, f n = g n) : Primrec g :=
   (funext H : f = g) ▸ hf
 #align primrec.of_eq Primrec.of_eq
 
+/- warning: primrec.const -> Primrec.const is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] (x : σ), Primrec.{u1, u2} α σ _inst_1 _inst_3 (fun (a : α) => x)
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] (x : σ), Primrec.{u2, u1} α σ _inst_1 _inst_3 (fun (a : α) => x)
+Case conversion may be inaccurate. Consider using '#align primrec.const Primrec.constₓ'. -/
 theorem const (x : σ) : Primrec fun a : α => x :=
   ((cases1 0 (const (encode x).succ)).comp (Primcodable.prim α)).of_eq fun n => by
     cases decode α n <;> rfl
 #align primrec.const Primrec.const
 
+#print Primrec.id /-
 protected theorem id : Primrec (@id α) :=
   (Primcodable.prim α).of_eq <| by simp
 #align primrec.id Primrec.id
+-/
 
+/- warning: primrec.comp -> Primrec.comp is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : β -> σ} {g : α -> β}, (Primrec.{u2, u3} β σ _inst_2 _inst_3 f) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 g) -> (Primrec.{u1, u3} α σ _inst_1 _inst_3 (fun (a : α) => f (g a)))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_3 : Primcodable.{u2} σ] {f : β -> σ} {g : α -> β}, (Primrec.{u3, u2} β σ _inst_2 _inst_3 f) -> (Primrec.{u1, u3} α β _inst_1 _inst_2 g) -> (Primrec.{u1, u2} α σ _inst_1 _inst_3 (fun (a : α) => f (g a)))
+Case conversion may be inaccurate. Consider using '#align primrec.comp Primrec.compₓ'. -/
 theorem comp {f : β → σ} {g : α → β} (hf : Primrec f) (hg : Primrec g) : Primrec fun a => f (g a) :=
   ((cases1 0 (hf.comp <| pred.comp hg)).comp (Primcodable.prim α)).of_eq fun n =>
     by
@@ -262,45 +384,79 @@ theorem comp {f : β → σ} {g : α → β} (hf : Primrec f) (hg : Primrec g) :
     simp [encodek]
 #align primrec.comp Primrec.comp
 
+#print Primrec.succ /-
 theorem succ : Primrec Nat.succ :=
   nat_iff.2 Nat.Primrec.succ
 #align primrec.succ Primrec.succ
+-/
 
+#print Primrec.pred /-
 theorem pred : Primrec Nat.pred :=
   nat_iff.2 Nat.Primrec.pred
 #align primrec.pred Primrec.pred
+-/
 
+/- warning: primrec.encode_iff -> Primrec.encode_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {f : α -> σ}, Iff (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => Encodable.encode.{u2} σ (Primcodable.toEncodable.{u2} σ _inst_3) (f a))) (Primrec.{u1, u2} α σ _inst_1 _inst_3 f)
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {f : α -> σ}, Iff (Primrec.{u2, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => Encodable.encode.{u1} σ (Primcodable.toEncodable.{u1} σ _inst_3) (f a))) (Primrec.{u2, u1} α σ _inst_1 _inst_3 f)
+Case conversion may be inaccurate. Consider using '#align primrec.encode_iff Primrec.encode_iffₓ'. -/
 theorem encode_iff {f : α → σ} : (Primrec fun a => encode (f a)) ↔ Primrec f :=
   ⟨fun h => Nat.Primrec.of_eq h fun n => by cases decode α n <;> rfl, Primrec.encode.comp⟩
 #align primrec.encode_iff Primrec.encode_iff
 
+/- warning: primrec.of_nat_iff -> Primrec.ofNat_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_4 : Denumerable.{u1} α] [_inst_5 : Primcodable.{u2} β] {f : α -> β}, Iff (Primrec.{u1, u2} α β (Primcodable.ofDenumerable.{u1} α _inst_4) _inst_5 f) (Primrec.{0, u2} Nat β (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_5 (fun (n : Nat) => f (Denumerable.ofNat.{u1} α _inst_4 n)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_4 : Denumerable.{u2} α] [_inst_5 : Primcodable.{u1} β] {f : α -> β}, Iff (Primrec.{u2, u1} α β (Primcodable.ofDenumerable.{u2} α _inst_4) _inst_5 f) (Primrec.{0, u1} Nat β (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_5 (fun (n : Nat) => f (Denumerable.ofNat.{u2} α _inst_4 n)))
+Case conversion may be inaccurate. Consider using '#align primrec.of_nat_iff Primrec.ofNat_iffₓ'. -/
 theorem ofNat_iff {α β} [Denumerable α] [Primcodable β] {f : α → β} :
     Primrec f ↔ Primrec fun n => f (ofNat α n) :=
   dom_denumerable.trans <| nat_iff.symm.trans encode_iff
 #align primrec.of_nat_iff Primrec.ofNat_iff
 
+#print Primrec.ofNat /-
 protected theorem ofNat (α) [Denumerable α] : Primrec (ofNat α) :=
   ofNat_iff.1 Primrec.id
 #align primrec.of_nat Primrec.ofNat
+-/
 
+/- warning: primrec.option_some_iff -> Primrec.option_some_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {f : α -> σ}, Iff (Primrec.{u1, u2} α (Option.{u2} σ) _inst_1 (Primcodable.option.{u2} σ _inst_3) (fun (a : α) => Option.some.{u2} σ (f a))) (Primrec.{u1, u2} α σ _inst_1 _inst_3 f)
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {f : α -> σ}, Iff (Primrec.{u2, u1} α (Option.{u1} σ) _inst_1 (Primcodable.option.{u1} σ _inst_3) (fun (a : α) => Option.some.{u1} σ (f a))) (Primrec.{u2, u1} α σ _inst_1 _inst_3 f)
+Case conversion may be inaccurate. Consider using '#align primrec.option_some_iff Primrec.option_some_iffₓ'. -/
 theorem option_some_iff {f : α → σ} : (Primrec fun a => some (f a)) ↔ Primrec f :=
   ⟨fun h => encode_iff.1 <| pred.comp <| encode_iff.2 h, option_some.comp⟩
 #align primrec.option_some_iff Primrec.option_some_iff
 
+#print Primrec.ofEquiv /-
 theorem ofEquiv {β} {e : β ≃ α} :
     haveI := Primcodable.ofEquiv α e
     Primrec e :=
   letI : Primcodable β := Primcodable.ofEquiv α e
   encode_iff.1 Primrec.encode
 #align primrec.of_equiv Primrec.ofEquiv
+-/
 
+#print Primrec.ofEquiv_symm /-
 theorem ofEquiv_symm {β} {e : β ≃ α} :
     haveI := Primcodable.ofEquiv α e
     Primrec e.symm :=
   letI := Primcodable.ofEquiv α e
   encode_iff.1 (show Primrec fun a => encode (e (e.symm a)) by simp [Primrec.encode])
 #align primrec.of_equiv_symm Primrec.ofEquiv_symm
+-/
 
+/- warning: primrec.of_equiv_iff -> Primrec.ofEquiv_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u1} β α) {f : σ -> β}, Iff (Primrec.{u2, u1} σ α _inst_3 _inst_1 (fun (a : σ) => coeFn.{max 1 (max (succ u3) (succ u1)) (succ u1) (succ u3), max (succ u3) (succ u1)} (Equiv.{succ u3, succ u1} β α) (fun (_x : Equiv.{succ u3, succ u1} β α) => β -> α) (Equiv.hasCoeToFun.{succ u3, succ u1} β α) e (f a))) (Primrec.{u2, u3} σ β _inst_3 (Primcodable.ofEquiv.{u1, u3} α β _inst_1 e) f)
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> β}, Iff (Primrec.{u1, u2} σ α _inst_3 _inst_1 (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u3, succ u2} (Equiv.{succ u3, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u3, succ u2} β α) e (f a))) (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) f)
+Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_iff Primrec.ofEquiv_iffₓ'. -/
 theorem ofEquiv_iff {β} (e : β ≃ α) {f : σ → β} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e (f a)) ↔ Primrec f :=
@@ -308,6 +464,12 @@ theorem ofEquiv_iff {β} (e : β ≃ α) {f : σ → β} :
   ⟨fun h => (of_equiv_symm.comp h).of_eq fun a => by simp, of_equiv.comp⟩
 #align primrec.of_equiv_iff Primrec.ofEquiv_iff
 
+/- warning: primrec.of_equiv_symm_iff -> Primrec.ofEquiv_symm_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_3 : Primcodable.{u2} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u1} β α) {f : σ -> α}, Iff (Primrec.{u2, u3} σ β _inst_3 (Primcodable.ofEquiv.{u1, u3} α β _inst_1 e) (fun (a : σ) => coeFn.{max 1 (max (succ u1) (succ u3)) (succ u3) (succ u1), max (succ u1) (succ u3)} (Equiv.{succ u1, succ u3} α β) (fun (_x : Equiv.{succ u1, succ u3} α β) => α -> β) (Equiv.hasCoeToFun.{succ u1, succ u3} α β) (Equiv.symm.{succ u3, succ u1} β α e) (f a))) (Primrec.{u2, u1} σ α _inst_3 _inst_1 f)
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_3 : Primcodable.{u1} σ] {β : Type.{u3}} (e : Equiv.{succ u3, succ u2} β α) {f : σ -> α}, Iff (Primrec.{u1, u3} σ β _inst_3 (Primcodable.ofEquiv.{u2, u3} α β _inst_1 e) (fun (a : σ) => FunLike.coe.{max (succ u2) (succ u3), succ u2, succ u3} (Equiv.{succ u2, succ u3} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u3} α β) (Equiv.symm.{succ u3, succ u2} β α e) (f a))) (Primrec.{u1, u2} σ α _inst_3 _inst_1 f)
+Case conversion may be inaccurate. Consider using '#align primrec.of_equiv_symm_iff Primrec.ofEquiv_symm_iffₓ'. -/
 theorem ofEquiv_symm_iff {β} (e : β ≃ α) {f : σ → α} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e.symm (f a)) ↔ Primrec f :=
@@ -321,6 +483,7 @@ namespace Primcodable
 
 open Nat.Primrec
 
+#print Primcodable.prod /-
 instance prod {α β} [Primcodable α] [Primcodable β] : Primcodable (α × β) :=
   ⟨((cases zero ((cases zero succ).comp (pair right ((Primcodable.prim β).comp left)))).comp
           (pair right ((Primcodable.prim α).comp left))).of_eq
@@ -329,6 +492,7 @@ instance prod {α β} [Primcodable α] [Primcodable β] : Primcodable (α × β)
       cases decode α n.unpair.1; · simp
       cases decode β n.unpair.2 <;> simp⟩
 #align primcodable.prod Primcodable.prod
+-/
 
 end Primcodable
 
@@ -338,6 +502,12 @@ variable {α : Type _} {σ : Type _} [Primcodable α] [Primcodable σ]
 
 open Nat.Primrec
 
+/- warning: primrec.fst -> Primrec.fst is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_3 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} β], Primrec.{max u1 u2, u1} (Prod.{u1, u2} α β) α (Primcodable.prod.{u1, u2} α β _inst_3 _inst_4) _inst_3 (Prod.fst.{u1, u2} α β)
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_3 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} β], Primrec.{max u2 u1, u2} (Prod.{u2, u1} α β) α (Primcodable.prod.{u2, u1} α β _inst_3 _inst_4) _inst_3 (Prod.fst.{u2, u1} α β)
+Case conversion may be inaccurate. Consider using '#align primrec.fst Primrec.fstₓ'. -/
 theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β) :=
   ((cases zero
             ((cases zero (Nat.Primrec.succ.comp left)).comp
@@ -349,6 +519,12 @@ theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β
     cases decode β n.unpair.2 <;> simp
 #align primrec.fst Primrec.fst
 
+/- warning: primrec.snd -> Primrec.snd is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_3 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} β], Primrec.{max u1 u2, u2} (Prod.{u1, u2} α β) β (Primcodable.prod.{u1, u2} α β _inst_3 _inst_4) _inst_4 (Prod.snd.{u1, u2} α β)
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_3 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} β], Primrec.{max u2 u1, u1} (Prod.{u2, u1} α β) β (Primcodable.prod.{u2, u1} α β _inst_3 _inst_4) _inst_4 (Prod.snd.{u2, u1} α β)
+Case conversion may be inaccurate. Consider using '#align primrec.snd Primrec.sndₓ'. -/
 theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β) :=
   ((cases zero
             ((cases zero (Nat.Primrec.succ.comp right)).comp
@@ -360,6 +536,12 @@ theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β
     cases decode β n.unpair.2 <;> simp
 #align primrec.snd Primrec.snd
 
+/- warning: primrec.pair -> Primrec.pair is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_3 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} γ] {f : α -> β} {g : α -> γ}, (Primrec.{u1, u2} α β _inst_3 _inst_4 f) -> (Primrec.{u1, u3} α γ _inst_3 _inst_5 g) -> (Primrec.{u1, max u2 u3} α (Prod.{u2, u3} β γ) _inst_3 (Primcodable.prod.{u2, u3} β γ _inst_4 _inst_5) (fun (a : α) => Prod.mk.{u2, u3} β γ (f a) (g a)))
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {γ : Type.{u1}} [_inst_3 : Primcodable.{u3} α] [_inst_4 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u1} γ] {f : α -> β} {g : α -> γ}, (Primrec.{u3, u2} α β _inst_3 _inst_4 f) -> (Primrec.{u3, u1} α γ _inst_3 _inst_5 g) -> (Primrec.{u3, max u1 u2} α (Prod.{u2, u1} β γ) _inst_3 (Primcodable.prod.{u2, u1} β γ _inst_4 _inst_5) (fun (a : α) => Prod.mk.{u2, u1} β γ (f a) (g a)))
+Case conversion may be inaccurate. Consider using '#align primrec.pair Primrec.pairₓ'. -/
 theorem pair {α β γ} [Primcodable α] [Primcodable β] [Primcodable γ] {f : α → β} {g : α → γ}
     (hf : Primrec f) (hg : Primrec g) : Primrec fun a => (f a, g a) :=
   ((cases1 0
@@ -369,20 +551,25 @@ theorem pair {α β γ} [Primcodable α] [Primcodable β] [Primcodable γ] {f :
     fun n => by cases decode α n <;> simp [encodek] <;> rfl
 #align primrec.pair Primrec.pair
 
+#print Primrec.unpair /-
 theorem unpair : Primrec Nat.unpair :=
   (pair (nat_iff.2 Nat.Primrec.left) (nat_iff.2 Nat.Primrec.right)).of_eq fun n => by simp
 #align primrec.unpair Primrec.unpair
+-/
 
-theorem list_nth₁ : ∀ l : List α, Primrec l.get?
+#print Primrec.list_get?₁ /-
+theorem list_get?₁ : ∀ l : List α, Primrec l.get?
   | [] => dom_denumerable.2 zero
   | a :: l =>
     dom_denumerable.2 <|
       (cases1 (encode a).succ <| dom_denumerable.1 <| list_nth₁ l).of_eq fun n => by
         cases n <;> simp
-#align primrec.list_nth₁ Primrec.list_nth₁
+#align primrec.list_nth₁ Primrec.list_get?₁
+-/
 
 end Primrec
 
+#print Primrec₂ /-
 /-- `primrec₂ f` means `f` is a binary primitive recursive function.
   This is technically unnecessary since we can always curry all
   the arguments together, but there are enough natural two-arg
@@ -390,14 +577,18 @@ end Primrec
 def Primrec₂ {α β σ} [Primcodable α] [Primcodable β] [Primcodable σ] (f : α → β → σ) :=
   Primrec fun p : α × β => f p.1 p.2
 #align primrec₂ Primrec₂
+-/
 
+#print PrimrecPred /-
 /-- `primrec_pred p` means `p : α → Prop` is a (decidable)
   primitive recursive predicate, which is to say that
   `to_bool ∘ p : α → bool` is primitive recursive. -/
 def PrimrecPred {α} [Primcodable α] (p : α → Prop) [DecidablePred p] :=
   Primrec fun a => decide (p a)
 #align primrec_pred PrimrecPred
+-/
 
+#print PrimrecRel /-
 /-- `primrec_rel p` means `p : α → β → Prop` is a (decidable)
   primitive recursive relation, which is to say that
   `to_bool ∘ p : α → β → bool` is primitive recursive. -/
@@ -405,6 +596,7 @@ def PrimrecRel {α β} [Primcodable α] [Primcodable β] (s : α → β → Prop
     [∀ a b, Decidable (s a b)] :=
   Primrec₂ fun a b => decide (s a b)
 #align primrec_rel PrimrecRel
+-/
 
 namespace Primrec₂
 
@@ -412,54 +604,120 @@ variable {α : Type _} {β : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
+/- warning: primrec₂.of_eq -> Primrec₂.of_eq is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ} {g : α -> β -> σ}, (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f) -> (forall (a : α) (b : β), Eq.{succ u3} σ (f a b) (g a b)) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 g)
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ} {g : α -> β -> σ}, (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f) -> (forall (a : α) (b : β), Eq.{succ u1} σ (f a b) (g a b)) -> (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 g)
+Case conversion may be inaccurate. Consider using '#align primrec₂.of_eq Primrec₂.of_eqₓ'. -/
 theorem of_eq {f g : α → β → σ} (hg : Primrec₂ f) (H : ∀ a b, f a b = g a b) : Primrec₂ g :=
   (by funext a b <;> apply H : f = g) ▸ hg
 #align primrec₂.of_eq Primrec₂.of_eq
 
+/- warning: primrec₂.const -> Primrec₂.const is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] (x : σ), Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 (fun (a : α) (b : β) => x)
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] (x : σ), Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 (fun (a : α) (b : β) => x)
+Case conversion may be inaccurate. Consider using '#align primrec₂.const Primrec₂.constₓ'. -/
 theorem const (x : σ) : Primrec₂ fun (a : α) (b : β) => x :=
   Primrec.const _
 #align primrec₂.const Primrec₂.const
 
+/- warning: primrec₂.pair -> Primrec₂.pair is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β], Primrec₂.{u1, u2, max u1 u2} α β (Prod.{u1, u2} α β) _inst_1 _inst_2 (Primcodable.prod.{u1, u2} α β _inst_1 _inst_2) (Prod.mk.{u1, u2} α β)
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β], Primrec₂.{u2, u1, max u2 u1} α β (Prod.{u2, u1} α β) _inst_1 _inst_2 (Primcodable.prod.{u2, u1} α β _inst_1 _inst_2) (Prod.mk.{u2, u1} α β)
+Case conversion may be inaccurate. Consider using '#align primrec₂.pair Primrec₂.pairₓ'. -/
 protected theorem pair : Primrec₂ (@Prod.mk α β) :=
   Primrec.pair Primrec.fst Primrec.snd
 #align primrec₂.pair Primrec₂.pair
 
+/- warning: primrec₂.left -> Primrec₂.left is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β], Primrec₂.{u1, u2, u1} α β α _inst_1 _inst_2 _inst_1 (fun (a : α) (b : β) => a)
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β], Primrec₂.{u2, u1, u2} α β α _inst_1 _inst_2 _inst_1 (fun (a : α) (b : β) => a)
+Case conversion may be inaccurate. Consider using '#align primrec₂.left Primrec₂.leftₓ'. -/
 theorem left : Primrec₂ fun (a : α) (b : β) => a :=
   Primrec.fst
 #align primrec₂.left Primrec₂.left
 
+/- warning: primrec₂.right -> Primrec₂.right is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β], Primrec₂.{u1, u2, u2} α β β _inst_1 _inst_2 _inst_2 (fun (a : α) (b : β) => b)
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β], Primrec₂.{u2, u1, u1} α β β _inst_1 _inst_2 _inst_2 (fun (a : α) (b : β) => b)
+Case conversion may be inaccurate. Consider using '#align primrec₂.right Primrec₂.rightₓ'. -/
 theorem right : Primrec₂ fun (a : α) (b : β) => b :=
   Primrec.snd
 #align primrec₂.right Primrec₂.right
 
+#print Primrec₂.mkpair /-
 theorem mkpair : Primrec₂ Nat.mkpair := by simp [Primrec₂, Primrec] <;> constructor
 #align primrec₂.mkpair Primrec₂.mkpair
+-/
 
+#print Primrec₂.unpaired /-
 theorem unpaired {f : ℕ → ℕ → α} : Primrec (Nat.unpaired f) ↔ Primrec₂ f :=
   ⟨fun h => by simpa using h.comp mkpair, fun h => h.comp Primrec.unpair⟩
 #align primrec₂.unpaired Primrec₂.unpaired
+-/
 
+#print Primrec₂.unpaired' /-
 theorem unpaired' {f : ℕ → ℕ → ℕ} : Nat.Primrec (Nat.unpaired f) ↔ Primrec₂ f :=
   Primrec.nat_iff.symm.trans unpaired
 #align primrec₂.unpaired' Primrec₂.unpaired'
+-/
 
+/- warning: primrec₂.encode_iff -> Primrec₂.encode_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, 0} α β Nat _inst_1 _inst_2 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) (b : β) => Encodable.encode.{u3} σ (Primcodable.toEncodable.{u3} σ _inst_3) (f a b))) (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f)
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, 0} α β Nat _inst_1 _inst_2 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) (b : β) => Encodable.encode.{u1} σ (Primcodable.toEncodable.{u1} σ _inst_3) (f a b))) (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f)
+Case conversion may be inaccurate. Consider using '#align primrec₂.encode_iff Primrec₂.encode_iffₓ'. -/
 theorem encode_iff {f : α → β → σ} : (Primrec₂ fun a b => encode (f a b)) ↔ Primrec₂ f :=
   Primrec.encode_iff
 #align primrec₂.encode_iff Primrec₂.encode_iff
 
+/- warning: primrec₂.option_some_iff -> Primrec₂.option_some_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, u3} α β (Option.{u3} σ) _inst_1 _inst_2 (Primcodable.option.{u3} σ _inst_3) (fun (a : α) (b : β) => Option.some.{u3} σ (f a b))) (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f)
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, u1} α β (Option.{u1} σ) _inst_1 _inst_2 (Primcodable.option.{u1} σ _inst_3) (fun (a : α) (b : β) => Option.some.{u1} σ (f a b))) (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f)
+Case conversion may be inaccurate. Consider using '#align primrec₂.option_some_iff Primrec₂.option_some_iffₓ'. -/
 theorem option_some_iff {f : α → β → σ} : (Primrec₂ fun a b => some (f a b)) ↔ Primrec₂ f :=
   Primrec.option_some_iff
 #align primrec₂.option_some_iff Primrec₂.option_some_iff
 
+/- warning: primrec₂.of_nat_iff -> Primrec₂.ofNat_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_4 : Denumerable.{u1} α] [_inst_5 : Denumerable.{u2} β] [_inst_6 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, u3} α β σ (Primcodable.ofDenumerable.{u1} α _inst_4) (Primcodable.ofDenumerable.{u2} β _inst_5) _inst_6 f) (Primrec₂.{0, 0, u3} Nat Nat σ (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_6 (fun (m : Nat) (n : Nat) => f (Denumerable.ofNat.{u1} α _inst_4 m) (Denumerable.ofNat.{u2} β _inst_5 n)))
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_4 : Denumerable.{u3} α] [_inst_5 : Denumerable.{u2} β] [_inst_6 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, u1} α β σ (Primcodable.ofDenumerable.{u3} α _inst_4) (Primcodable.ofDenumerable.{u2} β _inst_5) _inst_6 f) (Primrec₂.{0, 0, u1} Nat Nat σ (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_6 (fun (m : Nat) (n : Nat) => f (Denumerable.ofNat.{u3} α _inst_4 m) (Denumerable.ofNat.{u2} β _inst_5 n)))
+Case conversion may be inaccurate. Consider using '#align primrec₂.of_nat_iff Primrec₂.ofNat_iffₓ'. -/
 theorem ofNat_iff {α β σ} [Denumerable α] [Denumerable β] [Primcodable σ] {f : α → β → σ} :
     Primrec₂ f ↔ Primrec₂ fun m n : ℕ => f (ofNat α m) (ofNat β n) :=
   (Primrec.ofNat_iff.trans <| by simp).trans unpaired
 #align primrec₂.of_nat_iff Primrec₂.ofNat_iff
 
+/- warning: primrec₂.uncurry -> Primrec₂.uncurry is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec.{max u1 u2, u3} (Prod.{u1, u2} α β) σ (Primcodable.prod.{u1, u2} α β _inst_1 _inst_2) _inst_3 (Function.uncurry.{u1, u2, u3} α β σ f)) (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f)
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec.{max u3 u2, u1} (Prod.{u2, u3} α β) σ (Primcodable.prod.{u2, u3} α β _inst_1 _inst_2) _inst_3 (Function.uncurry.{u2, u3, u1} α β σ f)) (Primrec₂.{u2, u3, u1} α β σ _inst_1 _inst_2 _inst_3 f)
+Case conversion may be inaccurate. Consider using '#align primrec₂.uncurry Primrec₂.uncurryₓ'. -/
 theorem uncurry {f : α → β → σ} : Primrec (Function.uncurry f) ↔ Primrec₂ f := by
   rw [show Function.uncurry f = fun p : α × β => f p.1 p.2 from funext fun ⟨a, b⟩ => rfl] <;> rfl
 #align primrec₂.uncurry Primrec₂.uncurry
 
+/- warning: primrec₂.curry -> Primrec₂.curry is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : (Prod.{u1, u2} α β) -> σ}, Iff (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 (Function.curry.{u1, u2, u3} α β σ f)) (Primrec.{max u1 u2, u3} (Prod.{u1, u2} α β) σ (Primcodable.prod.{u1, u2} α β _inst_1 _inst_2) _inst_3 f)
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : (Prod.{u3, u2} α β) -> σ}, Iff (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 (Function.curry.{u3, u2, u1} α β σ f)) (Primrec.{max u3 u2, u1} (Prod.{u3, u2} α β) σ (Primcodable.prod.{u3, u2} α β _inst_1 _inst_2) _inst_3 f)
+Case conversion may be inaccurate. Consider using '#align primrec₂.curry Primrec₂.curryₓ'. -/
 theorem curry {f : α × β → σ} : Primrec₂ (Function.curry f) ↔ Primrec f := by
   rw [← uncurry, Function.uncurry_curry]
 #align primrec₂.curry Primrec₂.curry
@@ -472,31 +730,63 @@ variable {α : Type _} {β : Type _} {γ : Type _} {δ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
+/- warning: primrec.comp₂ -> Primrec.comp₂ is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {σ : Type.{u4}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_5 : Primcodable.{u4} σ] {f : γ -> σ} {g : α -> β -> γ}, (Primrec.{u3, u4} γ σ _inst_3 _inst_5 f) -> (Primrec₂.{u1, u2, u3} α β γ _inst_1 _inst_2 _inst_3 g) -> (Primrec₂.{u1, u2, u4} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (g a b)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u4}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] [_inst_3 : Primcodable.{u4} γ] [_inst_5 : Primcodable.{u3} σ] {f : γ -> σ} {g : α -> β -> γ}, (Primrec.{u4, u3} γ σ _inst_3 _inst_5 f) -> (Primrec₂.{u2, u1, u4} α β γ _inst_1 _inst_2 _inst_3 g) -> (Primrec₂.{u2, u1, u3} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (g a b)))
+Case conversion may be inaccurate. Consider using '#align primrec.comp₂ Primrec.comp₂ₓ'. -/
 theorem Primrec.comp₂ {f : γ → σ} {g : α → β → γ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a b => f (g a b) :=
   hf.comp hg
 #align primrec.comp₂ Primrec.comp₂
 
+/- warning: primrec₂.comp -> Primrec₂.comp is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {σ : Type.{u4}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_5 : Primcodable.{u4} σ] {f : β -> γ -> σ} {g : α -> β} {h : α -> γ}, (Primrec₂.{u2, u3, u4} β γ σ _inst_2 _inst_3 _inst_5 f) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 g) -> (Primrec.{u1, u3} α γ _inst_1 _inst_3 h) -> (Primrec.{u1, u4} α σ _inst_1 _inst_5 (fun (a : α) => f (g a) (h a)))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u4}} {γ : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u4} β] [_inst_3 : Primcodable.{u3} γ] [_inst_5 : Primcodable.{u2} σ] {f : β -> γ -> σ} {g : α -> β} {h : α -> γ}, (Primrec₂.{u4, u3, u2} β γ σ _inst_2 _inst_3 _inst_5 f) -> (Primrec.{u1, u4} α β _inst_1 _inst_2 g) -> (Primrec.{u1, u3} α γ _inst_1 _inst_3 h) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 (fun (a : α) => f (g a) (h a)))
+Case conversion may be inaccurate. Consider using '#align primrec₂.comp Primrec₂.compₓ'. -/
 theorem Primrec₂.comp {f : β → γ → σ} {g : α → β} {h : α → γ} (hf : Primrec₂ f) (hg : Primrec g)
     (hh : Primrec h) : Primrec fun a => f (g a) (h a) :=
   hf.comp (hg.pair hh)
 #align primrec₂.comp Primrec₂.comp
 
+/- warning: primrec₂.comp₂ -> Primrec₂.comp₂ is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {δ : Type.{u4}} {σ : Type.{u5}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u4} δ] [_inst_5 : Primcodable.{u5} σ] {f : γ -> δ -> σ} {g : α -> β -> γ} {h : α -> β -> δ}, (Primrec₂.{u3, u4, u5} γ δ σ _inst_3 _inst_4 _inst_5 f) -> (Primrec₂.{u1, u2, u3} α β γ _inst_1 _inst_2 _inst_3 g) -> (Primrec₂.{u1, u2, u4} α β δ _inst_1 _inst_2 _inst_4 h) -> (Primrec₂.{u1, u2, u5} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (g a b) (h a b)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u5}} {δ : Type.{u4}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] [_inst_3 : Primcodable.{u5} γ] [_inst_4 : Primcodable.{u4} δ] [_inst_5 : Primcodable.{u3} σ] {f : γ -> δ -> σ} {g : α -> β -> γ} {h : α -> β -> δ}, (Primrec₂.{u5, u4, u3} γ δ σ _inst_3 _inst_4 _inst_5 f) -> (Primrec₂.{u2, u1, u5} α β γ _inst_1 _inst_2 _inst_3 g) -> (Primrec₂.{u2, u1, u4} α β δ _inst_1 _inst_2 _inst_4 h) -> (Primrec₂.{u2, u1, u3} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (g a b) (h a b)))
+Case conversion may be inaccurate. Consider using '#align primrec₂.comp₂ Primrec₂.comp₂ₓ'. -/
 theorem Primrec₂.comp₂ {f : γ → δ → σ} {g : α → β → γ} {h : α → β → δ} (hf : Primrec₂ f)
     (hg : Primrec₂ g) (hh : Primrec₂ h) : Primrec₂ fun a b => f (g a b) (h a b) :=
   hf.comp hg hh
 #align primrec₂.comp₂ Primrec₂.comp₂
 
+#print PrimrecPred.comp /-
 theorem PrimrecPred.comp {p : β → Prop} [DecidablePred p] {f : α → β} :
     PrimrecPred p → Primrec f → PrimrecPred fun a => p (f a) :=
   Primrec.comp
 #align primrec_pred.comp PrimrecPred.comp
+-/
 
+/- warning: primrec_rel.comp -> PrimrecRel.comp is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] {R : β -> γ -> Prop} [_inst_6 : forall (a : β) (b : γ), Decidable (R a b)] {f : α -> β} {g : α -> γ}, (PrimrecRel.{u2, u3} β γ _inst_2 _inst_3 R (fun (a : β) (b : γ) => _inst_6 a b)) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 f) -> (Primrec.{u1, u3} α γ _inst_1 _inst_3 g) -> (PrimrecPred.{u1} α _inst_1 (fun (a : α) => R (f a) (g a)) (fun (a : α) => _inst_6 (f a) (g a)))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u3}} {γ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_3 : Primcodable.{u2} γ] {R : β -> γ -> Prop} [_inst_6 : forall (a : β) (b : γ), Decidable (R a b)] {f : α -> β} {g : α -> γ}, (PrimrecRel.{u3, u2} β γ _inst_2 _inst_3 R (fun (a : β) (b : γ) => _inst_6 a b)) -> (Primrec.{u1, u3} α β _inst_1 _inst_2 f) -> (Primrec.{u1, u2} α γ _inst_1 _inst_3 g) -> (PrimrecPred.{u1} α _inst_1 (fun (a : α) => R (f a) (g a)) (fun (a : α) => _inst_6 (f a) (g a)))
+Case conversion may be inaccurate. Consider using '#align primrec_rel.comp PrimrecRel.compₓ'. -/
 theorem PrimrecRel.comp {R : β → γ → Prop} [∀ a b, Decidable (R a b)] {f : α → β} {g : α → γ} :
     PrimrecRel R → Primrec f → Primrec g → PrimrecPred fun a => R (f a) (g a) :=
   Primrec₂.comp
 #align primrec_rel.comp PrimrecRel.comp
 
+/- warning: primrec_rel.comp₂ -> PrimrecRel.comp₂ is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {δ : Type.{u4}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u4} δ] {R : γ -> δ -> Prop} [_inst_6 : forall (a : γ) (b : δ), Decidable (R a b)] {f : α -> β -> γ} {g : α -> β -> δ}, (PrimrecRel.{u3, u4} γ δ _inst_3 _inst_4 R (fun (a : γ) (b : δ) => _inst_6 a b)) -> (Primrec₂.{u1, u2, u3} α β γ _inst_1 _inst_2 _inst_3 f) -> (Primrec₂.{u1, u2, u4} α β δ _inst_1 _inst_2 _inst_4 g) -> (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 (fun (a : α) (b : β) => R (f a b) (g a b)) (fun (a : α) (b : β) => _inst_6 (f a b) (g a b)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} {γ : Type.{u4}} {δ : Type.{u3}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] [_inst_3 : Primcodable.{u4} γ] [_inst_4 : Primcodable.{u3} δ] {R : γ -> δ -> Prop} [_inst_6 : forall (a : γ) (b : δ), Decidable (R a b)] {f : α -> β -> γ} {g : α -> β -> δ}, (PrimrecRel.{u4, u3} γ δ _inst_3 _inst_4 R (fun (a : γ) (b : δ) => _inst_6 a b)) -> (Primrec₂.{u2, u1, u4} α β γ _inst_1 _inst_2 _inst_3 f) -> (Primrec₂.{u2, u1, u3} α β δ _inst_1 _inst_2 _inst_4 g) -> (PrimrecRel.{u2, u1} α β _inst_1 _inst_2 (fun (a : α) (b : β) => R (f a b) (g a b)) (fun (a : α) (b : β) => _inst_6 (f a b) (g a b)))
+Case conversion may be inaccurate. Consider using '#align primrec_rel.comp₂ PrimrecRel.comp₂ₓ'. -/
 theorem PrimrecRel.comp₂ {R : γ → δ → Prop} [∀ a b, Decidable (R a b)] {f : α → β → γ}
     {g : α → β → δ} :
     PrimrecRel R → Primrec₂ f → Primrec₂ g → PrimrecRel fun a b => R (f a b) (g a b) :=
@@ -505,11 +795,19 @@ theorem PrimrecRel.comp₂ {R : γ → δ → Prop} [∀ a b, Decidable (R a b)]
 
 end Comp
 
+#print PrimrecPred.of_eq /-
 theorem PrimrecPred.of_eq {α} [Primcodable α] {p q : α → Prop} [DecidablePred p] [DecidablePred q]
     (hp : PrimrecPred p) (H : ∀ a, p a ↔ q a) : PrimrecPred q :=
   Primrec.of_eq hp fun a => Bool.decide_congr (H a)
 #align primrec_pred.of_eq PrimrecPred.of_eq
+-/
 
+/- warning: primrec_rel.of_eq -> PrimrecRel.of_eq is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {r : α -> β -> Prop} {s : α -> β -> Prop} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)] [_inst_4 : forall (a : α) (b : β), Decidable (s a b)], (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 r (fun (a : α) (b : β) => _inst_3 a b)) -> (forall (a : α) (b : β), Iff (r a b) (s a b)) -> (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 s (fun (a : α) (b : β) => _inst_4 a b))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {r : α -> β -> Prop} {s : α -> β -> Prop} [_inst_3 : forall (a : α) (b : β), Decidable (r a b)] [_inst_4 : forall (a : α) (b : β), Decidable (s a b)], (PrimrecRel.{u2, u1} α β _inst_1 _inst_2 r (fun (a : α) (b : β) => _inst_3 a b)) -> (forall (a : α) (b : β), Iff (r a b) (s a b)) -> (PrimrecRel.{u2, u1} α β _inst_1 _inst_2 s (fun (a : α) (b : β) => _inst_4 a b))
+Case conversion may be inaccurate. Consider using '#align primrec_rel.of_eq PrimrecRel.of_eqₓ'. -/
 theorem PrimrecRel.of_eq {α β} [Primcodable α] [Primcodable β] {r s : α → β → Prop}
     [∀ a b, Decidable (r a b)] [∀ a b, Decidable (s a b)] (hr : PrimrecRel r)
     (H : ∀ a b, r a b ↔ s a b) : PrimrecRel s :=
@@ -524,10 +822,22 @@ variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
 open Nat.Primrec
 
+/- warning: primrec₂.swap -> Primrec₂.swap is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f) -> (Primrec₂.{u2, u1, u3} β α σ _inst_2 _inst_1 _inst_3 (Function.swap.{succ u1, succ u2, succ u3} α β (fun (ᾰ : α) (ᾰ : β) => σ) f))
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f) -> (Primrec₂.{u2, u3, u1} β α σ _inst_2 _inst_1 _inst_3 (Function.swap.{succ u3, succ u2, succ u1} α β (fun (ᾰ : α) (ᾰ : β) => σ) f))
+Case conversion may be inaccurate. Consider using '#align primrec₂.swap Primrec₂.swapₓ'. -/
 theorem swap {f : α → β → σ} (h : Primrec₂ f) : Primrec₂ (swap f) :=
   h.comp₂ Primrec₂.right Primrec₂.left
 #align primrec₂.swap Primrec₂.swap
 
+/- warning: primrec₂.nat_iff -> Primrec₂.nat_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f) (Nat.Primrec (Nat.unpaired.{1} Nat (fun (m : Nat) (n : Nat) => Encodable.encode.{u3} (Option.{u3} σ) (Option.encodable.{u3} σ (Primcodable.toEncodable.{u3} σ _inst_3)) (Option.bind.{u1, u3} α σ (Encodable.decode.{u1} α (Primcodable.toEncodable.{u1} α _inst_1) m) (fun (a : α) => Option.map.{u2, u3} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))))))
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f) (Nat.Primrec (Nat.unpaired.{1} Nat (fun (m : Nat) (n : Nat) => Encodable.encode.{u1} (Option.{u1} σ) (Option.encodable.{u1} σ (Primcodable.toEncodable.{u1} σ _inst_3)) (Option.bind.{u3, u1} α σ (Encodable.decode.{u3} α (Primcodable.toEncodable.{u3} α _inst_1) m) (fun (a : α) => Option.map.{u2, u1} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))))))
+Case conversion may be inaccurate. Consider using '#align primrec₂.nat_iff Primrec₂.nat_iffₓ'. -/
 theorem nat_iff {f : α → β → σ} :
     Primrec₂ f ↔
       Nat.Primrec
@@ -542,6 +852,12 @@ theorem nat_iff {f : α → β → σ} :
   simp [Primrec₂, Primrec, this]
 #align primrec₂.nat_iff Primrec₂.nat_iff
 
+/- warning: primrec₂.nat_iff' -> Primrec₂.nat_iff' is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_3 f) (Primrec₂.{0, 0, u3} Nat Nat (Option.{u3} σ) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u3} σ _inst_3) (fun (m : Nat) (n : Nat) => Option.bind.{u1, u3} α σ (Encodable.decode.{u1} α (Primcodable.toEncodable.{u1} α _inst_1) m) (fun (a : α) => Option.map.{u2, u3} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))))
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u1} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_3 f) (Primrec₂.{0, 0, u1} Nat Nat (Option.{u1} σ) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u1} σ _inst_3) (fun (m : Nat) (n : Nat) => Option.bind.{u3, u1} α σ (Encodable.decode.{u3} α (Primcodable.toEncodable.{u3} α _inst_1) m) (fun (a : α) => Option.map.{u2, u1} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))))
+Case conversion may be inaccurate. Consider using '#align primrec₂.nat_iff' Primrec₂.nat_iff'ₓ'. -/
 theorem nat_iff' {f : α → β → σ} :
     Primrec₂ f ↔
       Primrec₂ fun m n : ℕ => Option.bind (decode α m) fun a => Option.map (f a) (decode β n) :=
@@ -556,10 +872,17 @@ variable {α : Type _} {β : Type _} {γ : Type _} {δ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
+/- warning: primrec.to₂ -> Primrec.to₂ is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : (Prod.{u1, u2} α β) -> σ}, (Primrec.{max u1 u2, u3} (Prod.{u1, u2} α β) σ (Primcodable.prod.{u1, u2} α β _inst_1 _inst_2) _inst_5 f) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (Prod.mk.{u1, u2} α β a b)))
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u1} σ] {f : (Prod.{u3, u2} α β) -> σ}, (Primrec.{max u3 u2, u1} (Prod.{u3, u2} α β) σ (Primcodable.prod.{u3, u2} α β _inst_1 _inst_2) _inst_5 f) -> (Primrec₂.{u3, u2, u1} α β σ _inst_1 _inst_2 _inst_5 (fun (a : α) (b : β) => f (Prod.mk.{u3, u2} α β a b)))
+Case conversion may be inaccurate. Consider using '#align primrec.to₂ Primrec.to₂ₓ'. -/
 theorem to₂ {f : α × β → σ} (hf : Primrec f) : Primrec₂ fun a b => f (a, b) :=
   hf.of_eq fun ⟨a, b⟩ => rfl
 #align primrec.to₂ Primrec.to₂
 
+#print Primrec.nat_elim /-
 theorem nat_elim {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a (n : ℕ) => n.elim (f a) fun n IH => g a (n, IH) :=
   Primrec₂.nat_iff.2 <|
@@ -578,36 +901,67 @@ theorem nat_elim {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f)
       induction' n.unpair.2 with m <;> simp [encodek]
       simp [ih, encodek]
 #align primrec.nat_elim Primrec.nat_elim
+-/
 
+#print Primrec.nat_elim' /-
 theorem nat_elim' {f : α → ℕ} {g : α → β} {h : α → ℕ × β → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (f a).elim (g a) fun n IH => h a (n, IH) :=
   (nat_elim hg hh).comp Primrec.id hf
 #align primrec.nat_elim' Primrec.nat_elim'
+-/
 
-theorem nat_elim₁ {f : ℕ → α → α} (a : α) (hf : Primrec₂ f) : Primrec (Nat.elim a f) :=
+#print Primrec.nat_elim₁ /-
+theorem nat_elim₁ {f : ℕ → α → α} (a : α) (hf : Primrec₂ f) : Primrec (Nat.rec a f) :=
   nat_elim' Primrec.id (const a) <| comp₂ hf Primrec₂.right
 #align primrec.nat_elim₁ Primrec.nat_elim₁
+-/
 
+/- warning: primrec.nat_cases' -> Primrec.nat_cases' is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> β} {g : α -> Nat -> β}, (Primrec.{u1, u2} α β _inst_1 _inst_2 f) -> (Primrec₂.{u1, 0, u2} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 g) -> (Primrec₂.{u1, 0, u2} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 (fun (a : α) => Nat.casesOn.{succ u2} β (f a) (g a)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {f : α -> β} {g : α -> Nat -> β}, (Primrec.{u2, u1} α β _inst_1 _inst_2 f) -> (Primrec₂.{u2, 0, u1} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 g) -> (Primrec₂.{u2, 0, u1} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 (fun (a : α) (n : Nat) => Nat.casesOn.{succ u1} (fun (x._@.Mathlib.Computability.Primrec._hyg.4800 : Nat) => β) n (f a) (g a)))
+Case conversion may be inaccurate. Consider using '#align primrec.nat_cases' Primrec.nat_cases'ₓ'. -/
 theorem nat_cases' {f : α → β} {g : α → ℕ → β} (hf : Primrec f) (hg : Primrec₂ g) :
-    Primrec₂ fun a => Nat.cases (f a) (g a) :=
+    Primrec₂ fun a => Nat.casesOn (f a) (g a) :=
   nat_elim hf <| hg.comp₂ Primrec₂.left <| comp₂ fst Primrec₂.right
 #align primrec.nat_cases' Primrec.nat_cases'
 
+/- warning: primrec.nat_cases -> Primrec.nat_cases is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> Nat} {g : α -> β} {h : α -> Nat -> β}, (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 g) -> (Primrec₂.{u1, 0, u2} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 h) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 (fun (a : α) => Nat.casesOn.{succ u2} β (g a) (h a) (f a)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {f : α -> Nat} {g : α -> β} {h : α -> Nat -> β}, (Primrec.{u2, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 g) -> (Primrec₂.{u2, 0, u1} α Nat β _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) _inst_2 h) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 (fun (a : α) => Nat.casesOn.{succ u1} (fun (x._@.Mathlib.Computability.Primrec._hyg.4875 : Nat) => β) (f a) (g a) (h a)))
+Case conversion may be inaccurate. Consider using '#align primrec.nat_cases Primrec.nat_casesₓ'. -/
 theorem nat_cases {f : α → ℕ} {g : α → β} {h : α → ℕ → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (f a).cases (g a) (h a) :=
   (nat_cases' hg hh).comp Primrec.id hf
 #align primrec.nat_cases Primrec.nat_cases
 
-theorem nat_cases₁ {f : ℕ → α} (a : α) (hf : Primrec f) : Primrec (Nat.cases a f) :=
+#print Primrec.nat_cases₁ /-
+theorem nat_cases₁ {f : ℕ → α} (a : α) (hf : Primrec f) : Primrec (Nat.casesOn a f) :=
   nat_cases Primrec.id (const a) (comp₂ hf Primrec₂.right)
 #align primrec.nat_cases₁ Primrec.nat_cases₁
+-/
 
+/- warning: primrec.nat_iterate -> Primrec.nat_iterate is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> Nat} {g : α -> β} {h : α -> β -> β}, (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 g) -> (Primrec₂.{u1, u2, u2} α β β _inst_1 _inst_2 _inst_2 h) -> (Primrec.{u1, u2} α β _inst_1 _inst_2 (fun (a : α) => Nat.iterate.{succ u2} β (h a) (f a) (g a)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {f : α -> Nat} {g : α -> β} {h : α -> β -> β}, (Primrec.{u2, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) f) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 g) -> (Primrec₂.{u2, u1, u1} α β β _inst_1 _inst_2 _inst_2 h) -> (Primrec.{u2, u1} α β _inst_1 _inst_2 (fun (a : α) => Nat.iterate.{succ u1} β (h a) (f a) (g a)))
+Case conversion may be inaccurate. Consider using '#align primrec.nat_iterate Primrec.nat_iterateₓ'. -/
 theorem nat_iterate {f : α → ℕ} {g : α → β} {h : α → β → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (h a^[f a]) (g a) :=
   (nat_elim' hf hg (hh.comp₂ Primrec₂.left <| snd.comp₂ Primrec₂.right)).of_eq fun a => by
     induction f a <;> simp [*, Function.iterate_succ']
 #align primrec.nat_iterate Primrec.nat_iterate
 
+/- warning: primrec.option_cases -> Primrec.option_cases is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {o : α -> (Option.{u2} β)} {f : α -> σ} {g : α -> β -> σ}, (Primrec.{u1, u2} α (Option.{u2} β) _inst_1 (Primcodable.option.{u2} β _inst_2) o) -> (Primrec.{u1, u3} α σ _inst_1 _inst_5 f) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u1, u3} α σ _inst_1 _inst_5 (fun (a : α) => Option.casesOn.{succ u3, u2} β (fun (_x : Option.{u2} β) => σ) (o a) (f a) (g a)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_5 : Primcodable.{u1} σ] {o : α -> (Option.{u3} β)} {f : α -> σ} {g : α -> β -> σ}, (Primrec.{u2, u3} α (Option.{u3} β) _inst_1 (Primcodable.option.{u3} β _inst_2) o) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 f) -> (Primrec₂.{u2, u3, u1} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 (fun (a : α) => Option.casesOn.{succ u1, u3} β (fun (_x : Option.{u3} β) => σ) (o a) (f a) (g a)))
+Case conversion may be inaccurate. Consider using '#align primrec.option_cases Primrec.option_casesₓ'. -/
 theorem option_cases {o : α → Option β} {f : α → σ} {g : α → β → σ} (ho : Primrec o)
     (hf : Primrec f) (hg : Primrec₂ g) :
     @Primrec _ σ _ _ fun a => Option.casesOn (o a) (f a) (g a) :=
@@ -620,70 +974,132 @@ theorem option_cases {o : α → Option β} {f : α → σ} {g : α → β → 
       fun a => by cases' o a with b <;> simp [encodek] <;> rfl
 #align primrec.option_cases Primrec.option_cases
 
+/- warning: primrec.option_bind -> Primrec.option_bind is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> (Option.{u2} β)} {g : α -> β -> (Option.{u3} σ)}, (Primrec.{u1, u2} α (Option.{u2} β) _inst_1 (Primcodable.option.{u2} β _inst_2) f) -> (Primrec₂.{u1, u2, u3} α β (Option.{u3} σ) _inst_1 _inst_2 (Primcodable.option.{u3} σ _inst_5) g) -> (Primrec.{u1, u3} α (Option.{u3} σ) _inst_1 (Primcodable.option.{u3} σ _inst_5) (fun (a : α) => Option.bind.{u2, u3} β σ (f a) (g a)))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_5 : Primcodable.{u2} σ] {f : α -> (Option.{u3} β)} {g : α -> β -> (Option.{u2} σ)}, (Primrec.{u1, u3} α (Option.{u3} β) _inst_1 (Primcodable.option.{u3} β _inst_2) f) -> (Primrec₂.{u1, u3, u2} α β (Option.{u2} σ) _inst_1 _inst_2 (Primcodable.option.{u2} σ _inst_5) g) -> (Primrec.{u1, u2} α (Option.{u2} σ) _inst_1 (Primcodable.option.{u2} σ _inst_5) (fun (a : α) => Option.bind.{u3, u2} β σ (f a) (g a)))
+Case conversion may be inaccurate. Consider using '#align primrec.option_bind Primrec.option_bindₓ'. -/
 theorem option_bind {f : α → Option β} {g : α → β → Option σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).bind (g a) :=
   (option_cases hf (const none) hg).of_eq fun a => by cases f a <;> rfl
 #align primrec.option_bind Primrec.option_bind
 
+#print Primrec.option_bind₁ /-
 theorem option_bind₁ {f : α → Option σ} (hf : Primrec f) : Primrec fun o => Option.bind o f :=
   option_bind Primrec.id (hf.comp snd).to₂
 #align primrec.option_bind₁ Primrec.option_bind₁
+-/
 
+/- warning: primrec.option_map -> Primrec.option_map is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> (Option.{u2} β)} {g : α -> β -> σ}, (Primrec.{u1, u2} α (Option.{u2} β) _inst_1 (Primcodable.option.{u2} β _inst_2) f) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u1, u3} α (Option.{u3} σ) _inst_1 (Primcodable.option.{u3} σ _inst_5) (fun (a : α) => Option.map.{u2, u3} β σ (g a) (f a)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_5 : Primcodable.{u1} σ] {f : α -> (Option.{u3} β)} {g : α -> β -> σ}, (Primrec.{u2, u3} α (Option.{u3} β) _inst_1 (Primcodable.option.{u3} β _inst_2) f) -> (Primrec₂.{u2, u3, u1} α β σ _inst_1 _inst_2 _inst_5 g) -> (Primrec.{u2, u1} α (Option.{u1} σ) _inst_1 (Primcodable.option.{u1} σ _inst_5) (fun (a : α) => Option.map.{u3, u1} β σ (g a) (f a)))
+Case conversion may be inaccurate. Consider using '#align primrec.option_map Primrec.option_mapₓ'. -/
 theorem option_map {f : α → Option β} {g : α → β → σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).map (g a) :=
   option_bind hf (option_some.comp₂ hg)
 #align primrec.option_map Primrec.option_map
 
+/- warning: primrec.option_map₁ -> Primrec.option_map₁ is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_5 : Primcodable.{u2} σ] {f : α -> σ}, (Primrec.{u1, u2} α σ _inst_1 _inst_5 f) -> (Primrec.{u1, u2} (Option.{u1} α) (Option.{u2} σ) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u2} σ _inst_5) (Option.map.{u1, u2} α σ f))
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_5 : Primcodable.{u1} σ] {f : α -> σ}, (Primrec.{u2, u1} α σ _inst_1 _inst_5 f) -> (Primrec.{u2, u1} (Option.{u2} α) (Option.{u1} σ) (Primcodable.option.{u2} α _inst_1) (Primcodable.option.{u1} σ _inst_5) (Option.map.{u2, u1} α σ f))
+Case conversion may be inaccurate. Consider using '#align primrec.option_map₁ Primrec.option_map₁ₓ'. -/
 theorem option_map₁ {f : α → σ} (hf : Primrec f) : Primrec (Option.map f) :=
   option_map Primrec.id (hf.comp snd).to₂
 #align primrec.option_map₁ Primrec.option_map₁
 
+#print Primrec.option_iget /-
 theorem option_iget [Inhabited α] : Primrec (@Option.iget α _) :=
   (option_cases Primrec.id (const <| @default α _) Primrec₂.right).of_eq fun o => by cases o <;> rfl
 #align primrec.option_iget Primrec.option_iget
+-/
 
+#print Primrec.option_isSome /-
 theorem option_isSome : Primrec (@Option.isSome α) :=
   (option_cases Primrec.id (const false) (const true).to₂).of_eq fun o => by cases o <;> rfl
 #align primrec.option_is_some Primrec.option_isSome
+-/
 
+#print Primrec.option_getD /-
 theorem option_getD : Primrec₂ (@Option.getD α) :=
   Primrec.of_eq (option_cases Primrec₂.left Primrec₂.right Primrec₂.right) fun ⟨o, a⟩ => by
     cases o <;> rfl
 #align primrec.option_get_or_else Primrec.option_getD
+-/
 
+/- warning: primrec.bind_decode_iff -> Primrec.bind_decode_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> β -> (Option.{u3} σ)}, Iff (Primrec₂.{u1, 0, u3} α Nat (Option.{u3} σ) _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u3} σ _inst_5) (fun (a : α) (n : Nat) => Option.bind.{u2, u3} β σ (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n) (f a))) (Primrec₂.{u1, u2, u3} α β (Option.{u3} σ) _inst_1 _inst_2 (Primcodable.option.{u3} σ _inst_5) f)
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> β -> (Option.{u3} σ)}, Iff (Primrec₂.{u2, 0, u3} α Nat (Option.{u3} σ) _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u3} σ _inst_5) (fun (a : α) (n : Nat) => Option.bind.{u1, u3} β σ (Encodable.decode.{u1} β (Primcodable.toEncodable.{u1} β _inst_2) n) (f a))) (Primrec₂.{u2, u1, u3} α β (Option.{u3} σ) _inst_1 _inst_2 (Primcodable.option.{u3} σ _inst_5) f)
+Case conversion may be inaccurate. Consider using '#align primrec.bind_decode_iff Primrec.bind_decode_iffₓ'. -/
 theorem bind_decode_iff {f : α → β → Option σ} :
     (Primrec₂ fun a n => (decode β n).bind (f a)) ↔ Primrec₂ f :=
   ⟨fun h => by simpa [encodek] using h.comp fst ((@Primrec.encode β _).comp snd), fun h =>
     option_bind (Primrec.decode.comp snd) <| h.comp (fst.comp fst) snd⟩
 #align primrec.bind_decode_iff Primrec.bind_decode_iff
 
+/- warning: primrec.map_decode_iff -> Primrec.map_decode_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_5 : Primcodable.{u3} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u1, 0, u3} α Nat (Option.{u3} σ) _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u3} σ _inst_5) (fun (a : α) (n : Nat) => Option.map.{u2, u3} β σ (f a) (Encodable.decode.{u2} β (Primcodable.toEncodable.{u2} β _inst_2) n))) (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_5 f)
+but is expected to have type
+  forall {α : Type.{u3}} {β : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u3} α] [_inst_2 : Primcodable.{u1} β] [_inst_5 : Primcodable.{u2} σ] {f : α -> β -> σ}, Iff (Primrec₂.{u3, 0, u2} α Nat (Option.{u2} σ) _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.option.{u2} σ _inst_5) (fun (a : α) (n : Nat) => Option.map.{u1, u2} β σ (f a) (Encodable.decode.{u1} β (Primcodable.toEncodable.{u1} β _inst_2) n))) (Primrec₂.{u3, u1, u2} α β σ _inst_1 _inst_2 _inst_5 f)
+Case conversion may be inaccurate. Consider using '#align primrec.map_decode_iff Primrec.map_decode_iffₓ'. -/
 theorem map_decode_iff {f : α → β → σ} :
     (Primrec₂ fun a n => (decode β n).map (f a)) ↔ Primrec₂ f :=
   bind_decode_iff.trans Primrec₂.option_some_iff
 #align primrec.map_decode_iff Primrec.map_decode_iff
 
+#print Primrec.nat_add /-
 theorem nat_add : Primrec₂ ((· + ·) : ℕ → ℕ → ℕ) :=
   Primrec₂.unpaired'.1 Nat.Primrec.add
 #align primrec.nat_add Primrec.nat_add
+-/
 
+#print Primrec.nat_sub /-
 theorem nat_sub : Primrec₂ (Sub.sub : ℕ → ℕ → ℕ) :=
   Primrec₂.unpaired'.1 Nat.Primrec.sub
 #align primrec.nat_sub Primrec.nat_sub
+-/
 
+#print Primrec.nat_mul /-
 theorem nat_mul : Primrec₂ ((· * ·) : ℕ → ℕ → ℕ) :=
   Primrec₂.unpaired'.1 Nat.Primrec.mul
 #align primrec.nat_mul Primrec.nat_mul
+-/
 
+/- warning: primrec.cond -> Primrec.cond is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_5 : Primcodable.{u2} σ] {c : α -> Bool} {f : α -> σ} {g : α -> σ}, (Primrec.{u1, 0} α Bool _inst_1 Primcodable.bool c) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 g) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 (fun (a : α) => cond.{u2} σ (c a) (f a) (g a)))
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_5 : Primcodable.{u1} σ] {c : α -> Bool} {f : α -> σ} {g : α -> σ}, (Primrec.{u2, 0} α Bool _inst_1 Primcodable.bool c) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 f) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 g) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 (fun (a : α) => cond.{u1} σ (c a) (f a) (g a)))
+Case conversion may be inaccurate. Consider using '#align primrec.cond Primrec.condₓ'. -/
 theorem cond {c : α → Bool} {f : α → σ} {g : α → σ} (hc : Primrec c) (hf : Primrec f)
     (hg : Primrec g) : Primrec fun a => cond (c a) (f a) (g a) :=
   (nat_cases (encode_iff.2 hc) hg (hf.comp fst).to₂).of_eq fun a => by cases c a <;> rfl
 #align primrec.cond Primrec.cond
 
+/- warning: primrec.ite -> Primrec.ite is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_5 : Primcodable.{u2} σ] {c : α -> Prop} [_inst_6 : DecidablePred.{succ u1} α c] {f : α -> σ} {g : α -> σ}, (PrimrecPred.{u1} α _inst_1 c (fun (a : α) => _inst_6 a)) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 g) -> (Primrec.{u1, u2} α σ _inst_1 _inst_5 (fun (a : α) => ite.{succ u2} σ (c a) (_inst_6 a) (f a) (g a)))
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_5 : Primcodable.{u1} σ] {c : α -> Prop} [_inst_6 : DecidablePred.{succ u2} α c] {f : α -> σ} {g : α -> σ}, (PrimrecPred.{u2} α _inst_1 c (fun (a : α) => _inst_6 a)) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 f) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 g) -> (Primrec.{u2, u1} α σ _inst_1 _inst_5 (fun (a : α) => ite.{succ u1} σ (c a) (_inst_6 a) (f a) (g a)))
+Case conversion may be inaccurate. Consider using '#align primrec.ite Primrec.iteₓ'. -/
 theorem ite {c : α → Prop} [DecidablePred c] {f : α → σ} {g : α → σ} (hc : PrimrecPred c)
     (hf : Primrec f) (hg : Primrec g) : Primrec fun a => if c a then f a else g a := by
   simpa using cond hc hf hg
 #align primrec.ite Primrec.ite
 
+/- warning: primrec.nat_le -> Primrec.nat_le is a dubious translation:
+lean 3 declaration is
+  PrimrecRel.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (LE.le.{0} Nat Nat.hasLe) (fun (a : Nat) (b : Nat) => Nat.decidableLe a b)
+but is expected to have type
+  PrimrecRel.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (x._@.Mathlib.Computability.Primrec._hyg.6194 : Nat) (x._@.Mathlib.Computability.Primrec._hyg.6196 : Nat) => LE.le.{0} Nat instLENat x._@.Mathlib.Computability.Primrec._hyg.6194 x._@.Mathlib.Computability.Primrec._hyg.6196) (fun (a : Nat) (b : Nat) => Nat.decLe a b)
+Case conversion may be inaccurate. Consider using '#align primrec.nat_le Primrec.nat_leₓ'. -/
 theorem nat_le : PrimrecRel ((· ≤ ·) : ℕ → ℕ → Prop) :=
   (nat_cases nat_sub (const true) (const false).to₂).of_eq fun p =>
     by
@@ -693,106 +1109,149 @@ theorem nat_le : PrimrecRel ((· ≤ ·) : ℕ → ℕ → Prop) :=
     · simp [not_le.2 (Nat.lt_of_sub_eq_succ e)]
 #align primrec.nat_le Primrec.nat_le
 
+/- warning: primrec.nat_min -> Primrec.nat_min is a dubious translation:
+lean 3 declaration is
+  Primrec₂.{0, 0, 0} Nat Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (LinearOrder.min.{0} Nat Nat.linearOrder)
+but is expected to have type
+  Primrec₂.{0, 0, 0} Nat Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Min.min.{0} Nat instMinNat)
+Case conversion may be inaccurate. Consider using '#align primrec.nat_min Primrec.nat_minₓ'. -/
 theorem nat_min : Primrec₂ (@min ℕ _) :=
   ite nat_le fst snd
 #align primrec.nat_min Primrec.nat_min
 
+/- warning: primrec.nat_max -> Primrec.nat_max is a dubious translation:
+lean 3 declaration is
+  Primrec₂.{0, 0, 0} Nat Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (LinearOrder.max.{0} Nat Nat.linearOrder)
+but is expected to have type
+  Primrec₂.{0, 0, 0} Nat Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Max.max.{0} Nat Nat.instMaxNat)
+Case conversion may be inaccurate. Consider using '#align primrec.nat_max Primrec.nat_maxₓ'. -/
 theorem nat_max : Primrec₂ (@max ℕ _) :=
   ite (nat_le.comp Primrec.fst Primrec.snd) snd fst
 #align primrec.nat_max Primrec.nat_max
 
+#print Primrec.dom_bool /-
 theorem dom_bool (f : Bool → α) : Primrec f :=
   (cond Primrec.id (const (f true)) (const (f false))).of_eq fun b => by cases b <;> rfl
 #align primrec.dom_bool Primrec.dom_bool
+-/
 
+#print Primrec.dom_bool₂ /-
 theorem dom_bool₂ (f : Bool → Bool → α) : Primrec₂ f :=
   (cond fst ((dom_bool (f true)).comp snd) ((dom_bool (f false)).comp snd)).of_eq fun ⟨a, b⟩ => by
     cases a <;> rfl
 #align primrec.dom_bool₂ Primrec.dom_bool₂
+-/
 
+#print Primrec.not /-
 protected theorem not : Primrec not :=
   dom_bool _
 #align primrec.bnot Primrec.not
+-/
 
+#print Primrec.and /-
 protected theorem and : Primrec₂ and :=
   dom_bool₂ _
 #align primrec.band Primrec.and
+-/
 
+#print Primrec.or /-
 protected theorem or : Primrec₂ or :=
   dom_bool₂ _
 #align primrec.bor Primrec.or
+-/
 
-/- warning: primrec.not clashes with primrec.bnot -> Primrec.not
-warning: primrec.not -> Primrec.not is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u_1}} [_inst_1 : Primcodable.{u_1} α] {p : α -> Prop} [_inst_6 : DecidablePred.{succ u_1} α p], (PrimrecPred.{u_1} α _inst_1 p (fun (a : α) => _inst_6 a)) -> (PrimrecPred.{u_1} α _inst_1 (fun (a : α) => Not (p a)) (fun (a : α) => Not.decidable (p a) (_inst_6 a)))
-but is expected to have type
-  Primrec.{0, 0} Bool Bool Primcodable.bool Primcodable.bool not
-Case conversion may be inaccurate. Consider using '#align primrec.not Primrec.notₓ'. -/
+#print PrimrecPred.not /-
 protected theorem not {p : α → Prop} [DecidablePred p] (hp : PrimrecPred p) :
     PrimrecPred fun a => ¬p a :=
   (Primrec.not.comp hp).of_eq fun n => by simp
-#align primrec.not Primrec.not
+#align primrec.not PrimrecPred.not
+-/
 
-/- warning: primrec.and clashes with primrec.band -> Primrec.and
-warning: primrec.and -> Primrec.and is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u_1}} [_inst_1 : Primcodable.{u_1} α] {p : α -> Prop} {q : α -> Prop} [_inst_6 : DecidablePred.{succ u_1} α p] [_inst_7 : DecidablePred.{succ u_1} α q], (PrimrecPred.{u_1} α _inst_1 p (fun (a : α) => _inst_6 a)) -> (PrimrecPred.{u_1} α _inst_1 q (fun (a : α) => _inst_7 a)) -> (PrimrecPred.{u_1} α _inst_1 (fun (a : α) => And (p a) (q a)) (fun (a : α) => And.decidable (p a) (q a) (_inst_6 a) (_inst_7 a)))
-but is expected to have type
-  Primrec₂.{0, 0, 0} Bool Bool Bool Primcodable.bool Primcodable.bool Primcodable.bool and
-Case conversion may be inaccurate. Consider using '#align primrec.and Primrec.andₓ'. -/
+#print PrimrecPred.and /-
 protected theorem and {p q : α → Prop} [DecidablePred p] [DecidablePred q] (hp : PrimrecPred p)
     (hq : PrimrecPred q) : PrimrecPred fun a => p a ∧ q a :=
   (Primrec.and.comp hp hq).of_eq fun n => by simp
-#align primrec.and Primrec.and
+#align primrec.and PrimrecPred.and
+-/
 
-/- warning: primrec.or clashes with primrec.bor -> Primrec.or
-warning: primrec.or -> Primrec.or is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u_1}} [_inst_1 : Primcodable.{u_1} α] {p : α -> Prop} {q : α -> Prop} [_inst_6 : DecidablePred.{succ u_1} α p] [_inst_7 : DecidablePred.{succ u_1} α q], (PrimrecPred.{u_1} α _inst_1 p (fun (a : α) => _inst_6 a)) -> (PrimrecPred.{u_1} α _inst_1 q (fun (a : α) => _inst_7 a)) -> (PrimrecPred.{u_1} α _inst_1 (fun (a : α) => Or (p a) (q a)) (fun (a : α) => Or.decidable (p a) (q a) (_inst_6 a) (_inst_7 a)))
-but is expected to have type
-  Primrec₂.{0, 0, 0} Bool Bool Bool Primcodable.bool Primcodable.bool Primcodable.bool or
-Case conversion may be inaccurate. Consider using '#align primrec.or Primrec.orₓ'. -/
+#print PrimrecPred.or /-
 protected theorem or {p q : α → Prop} [DecidablePred p] [DecidablePred q] (hp : PrimrecPred p)
     (hq : PrimrecPred q) : PrimrecPred fun a => p a ∨ q a :=
   (Primrec.or.comp hp hq).of_eq fun n => by simp
-#align primrec.or Primrec.or
+#align primrec.or PrimrecPred.or
+-/
 
+#print Primrec.eq /-
 protected theorem eq [DecidableEq α] : PrimrecRel (@Eq α) :=
   have : PrimrecRel fun a b : ℕ => a = b :=
-    (Primrec.and nat_le nat_le.symm).of_eq fun a => by simp [le_antisymm_iff]
+    (PrimrecPred.and nat_le nat_le.symm).of_eq fun a => by simp [le_antisymm_iff]
   (this.comp₂ (Primrec.encode.comp₂ Primrec₂.left) (Primrec.encode.comp₂ Primrec₂.right)).of_eq
     fun a b => encode_injective.eq_iff
 #align primrec.eq Primrec.eq
+-/
 
+/- warning: primrec.nat_lt -> Primrec.nat_lt is a dubious translation:
+lean 3 declaration is
+  PrimrecRel.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (LT.lt.{0} Nat Nat.hasLt) (fun (a : Nat) (b : Nat) => Nat.decidableLt a b)
+but is expected to have type
+  PrimrecRel.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (x._@.Mathlib.Computability.Primrec._hyg.6908 : Nat) (x._@.Mathlib.Computability.Primrec._hyg.6910 : Nat) => LT.lt.{0} Nat instLTNat x._@.Mathlib.Computability.Primrec._hyg.6908 x._@.Mathlib.Computability.Primrec._hyg.6910) (fun (a : Nat) (b : Nat) => Nat.decLt a b)
+Case conversion may be inaccurate. Consider using '#align primrec.nat_lt Primrec.nat_ltₓ'. -/
 theorem nat_lt : PrimrecRel ((· < ·) : ℕ → ℕ → Prop) :=
   (nat_le.comp snd fst).Not.of_eq fun p => by simp
 #align primrec.nat_lt Primrec.nat_lt
 
+/- warning: primrec.option_guard -> Primrec.option_guard is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {p : α -> β -> Prop} [_inst_6 : forall (a : α) (b : β), Decidable (p a b)], (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 p (fun (a : α) (b : β) => _inst_6 a b)) -> (forall {f : α -> β}, (Primrec.{u1, u2} α β _inst_1 _inst_2 f) -> (Primrec.{u1, u2} α (Option.{u2} β) _inst_1 (Primcodable.option.{u2} β _inst_2) (fun (a : α) => Option.guard.{u2} β (p a) (fun (a_1 : β) => _inst_6 a a_1) (f a))))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {p : α -> β -> Prop} [_inst_6 : forall (a : α) (b : β), Decidable (p a b)], (PrimrecRel.{u2, u1} α β _inst_1 _inst_2 p (fun (a : α) (b : β) => _inst_6 a b)) -> (forall {f : α -> β}, (Primrec.{u2, u1} α β _inst_1 _inst_2 f) -> (Primrec.{u2, u1} α (Option.{u1} β) _inst_1 (Primcodable.option.{u1} β _inst_2) (fun (a : α) => Option.guard.{u1} β (p a) (fun (a_1 : β) => _inst_6 a a_1) (f a))))
+Case conversion may be inaccurate. Consider using '#align primrec.option_guard Primrec.option_guardₓ'. -/
 theorem option_guard {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hp : PrimrecRel p) {f : α → β}
     (hf : Primrec f) : Primrec fun a => Option.guard (p a) (f a) :=
   ite (hp.comp Primrec.id hf) (option_some_iff.2 hf) (const none)
 #align primrec.option_guard Primrec.option_guard
 
-theorem option_orelse : Primrec₂ ((· <|> ·) : Option α → Option α → Option α) :=
+/- warning: primrec.option_orelse -> Primrec.option_orElse is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : Primcodable.{u1} α], Primrec₂.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (HasOrelse.orelse.{u1, u1} Option.{u1} (Alternative.toHasOrelse.{u1, u1} Option.{u1} Option.alternative.{u1}) α)
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : Primcodable.{u1} α], Primrec₂.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (Primcodable.option.{u1} α _inst_1) (fun (x._@.Mathlib.Computability.Primrec._hyg.7041 : Option.{u1} α) (x._@.Mathlib.Computability.Primrec._hyg.7043 : Option.{u1} α) => HOrElse.hOrElse.{u1, u1, u1} (Option.{u1} α) (Option.{u1} α) (Option.{u1} α) (instHOrElse.{u1} (Option.{u1} α) (Option.instOrElseOption.{u1} α)) x._@.Mathlib.Computability.Primrec._hyg.7041 (fun (x._@.Mathlib.Computability.Primrec._hyg.7053 : Unit) => x._@.Mathlib.Computability.Primrec._hyg.7043))
+Case conversion may be inaccurate. Consider using '#align primrec.option_orelse Primrec.option_orElseₓ'. -/
+theorem option_orElse : Primrec₂ ((· <|> ·) : Option α → Option α → Option α) :=
   (option_cases fst snd (fst.comp fst).to₂).of_eq fun ⟨o₁, o₂⟩ => by cases o₁ <;> cases o₂ <;> rfl
-#align primrec.option_orelse Primrec.option_orelse
+#align primrec.option_orelse Primrec.option_orElse
 
+#print Primrec.decode₂ /-
 protected theorem decode₂ : Primrec (decode₂ α) :=
   option_bind Primrec.decode <|
     option_guard ((@Primrec.eq _ _ Nat.decidableEq).comp (encode_iff.2 snd) (fst.comp fst)) snd
 #align primrec.decode₂ Primrec.decode₂
+-/
 
-theorem list_find_index₁ {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hp : PrimrecRel p) :
+/- warning: primrec.list_find_index₁ -> Primrec.list_findIdx₁ is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {p : α -> β -> Prop} [_inst_6 : forall (a : α) (b : β), Decidable (p a b)], (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 p (fun (a : α) (b : β) => _inst_6 a b)) -> (forall (l : List.{u2} β), Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => List.findIndex.{u2} β (p a) (fun (a_1 : β) => _inst_6 a a_1) l))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β] {p : α -> β -> Bool}, (Primrec₂.{u2, u1, 0} α β Bool _inst_1 _inst_2 Primcodable.bool p) -> (forall (hp : List.{u1} β), Primrec.{u2, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => List.findIdx.{u1} β (p a) hp))
+Case conversion may be inaccurate. Consider using '#align primrec.list_find_index₁ Primrec.list_findIdx₁ₓ'. -/
+theorem list_findIdx₁ {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hp : PrimrecRel p) :
     ∀ l : List β, Primrec fun a => l.findIndex (p a)
   | [] => const 0
   | a :: l => ite (hp.comp Primrec.id (const a)) (const 0) (succ.comp (list_find_index₁ l))
-#align primrec.list_find_index₁ Primrec.list_find_index₁
+#align primrec.list_find_index₁ Primrec.list_findIdx₁
 
-theorem list_index_of₁ [DecidableEq α] (l : List α) : Primrec fun a => l.indexOfₓ a :=
-  list_find_index₁ Primrec.eq l
-#align primrec.list_index_of₁ Primrec.list_index_of₁
+#print Primrec.list_indexOf₁ /-
+theorem list_indexOf₁ [DecidableEq α] (l : List α) : Primrec fun a => l.indexOfₓ a :=
+  list_findIdx₁ Primrec.eq l
+#align primrec.list_index_of₁ Primrec.list_indexOf₁
+-/
 
+/- warning: primrec.dom_fintype -> Primrec.dom_fintype is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_5 : Primcodable.{u2} σ] [_inst_6 : Fintype.{u1} α] (f : α -> σ), Primrec.{u1, u2} α σ _inst_1 _inst_5 f
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_5 : Primcodable.{u1} σ] [_inst_6 : Fintype.{u2} α] (f : α -> σ), Primrec.{u2, u1} α σ _inst_1 _inst_5 f
+Case conversion may be inaccurate. Consider using '#align primrec.dom_fintype Primrec.dom_fintypeₓ'. -/
 theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
   let ⟨l, nd, m⟩ := Finite.exists_univ_list α
   option_some_iff.1 <| by
@@ -801,7 +1260,14 @@ theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
     rw [List.get?_map, List.nthLe_get? (List.indexOf_lt_length.2 (m _)), List.indexOf_nthLe] <;> rfl
 #align primrec.dom_fintype Primrec.dom_fintype
 
-theorem nat_boddDiv2 : Primrec Nat.boddDiv2 :=
+/- warning: primrec.nat_bodd_div2 clashes with [anonymous] -> [anonymous]
+warning: primrec.nat_bodd_div2 -> [anonymous] is a dubious translation:
+lean 3 declaration is
+  Primrec.{0, 0} Nat (Prod.{0, 0} Bool Nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.prod.{0, 0} Bool Nat Primcodable.bool (Primcodable.ofDenumerable.{0} Nat Denumerable.nat)) Nat.boddDiv2
+but is expected to have type
+  forall {α : Type.{u}} {β : Type.{v}}, (Nat -> α -> β) -> Nat -> (List.{u} α) -> (List.{v} β)
+Case conversion may be inaccurate. Consider using '#align primrec.nat_bodd_div2 [anonymous]ₓ'. -/
+theorem [anonymous] : Primrec Nat.boddDiv2 :=
   (nat_elim' Primrec.id (const (false, 0))
         (((cond fst (pair (const false) (succ.comp snd)) (pair (const true) snd)).comp snd).comp
             snd).to₂).of_eq
@@ -810,30 +1276,53 @@ theorem nat_boddDiv2 : Primrec Nat.boddDiv2 :=
     induction' n with n IH; · rfl
     simp [-Nat.boddDiv2_eq, Nat.boddDiv2, *]
     rcases Nat.boddDiv2 n with ⟨_ | _, m⟩ <;> simp [Nat.boddDiv2]
-#align primrec.nat_bodd_div2 Primrec.nat_boddDiv2
+#align primrec.nat_bodd_div2 [anonymous]
 
+#print Primrec.nat_bodd /-
 theorem nat_bodd : Primrec Nat.bodd :=
-  fst.comp nat_boddDiv2
+  fst.comp [anonymous]
 #align primrec.nat_bodd Primrec.nat_bodd
+-/
 
+#print Primrec.nat_div2 /-
 theorem nat_div2 : Primrec Nat.div2 :=
-  snd.comp nat_boddDiv2
+  snd.comp [anonymous]
 #align primrec.nat_div2 Primrec.nat_div2
+-/
 
-theorem nat_bit0 : Primrec (@bit0 ℕ _) :=
+/- warning: primrec.nat_bit0 -> Primrec.nat_double is a dubious translation:
+lean 3 declaration is
+  Primrec.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (bit0.{0} Nat Nat.hasAdd)
+but is expected to have type
+  Primrec.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (n : Nat) => HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) n)
+Case conversion may be inaccurate. Consider using '#align primrec.nat_bit0 Primrec.nat_doubleₓ'. -/
+theorem nat_double : Primrec (@bit0 ℕ _) :=
   nat_add.comp Primrec.id Primrec.id
-#align primrec.nat_bit0 Primrec.nat_bit0
+#align primrec.nat_bit0 Primrec.nat_double
 
-theorem nat_bit1 : Primrec (@bit1 ℕ _ _) :=
-  nat_add.comp nat_bit0 (const 1)
-#align primrec.nat_bit1 Primrec.nat_bit1
+/- warning: primrec.nat_bit1 -> Primrec.nat_double_succ is a dubious translation:
+lean 3 declaration is
+  Primrec.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (bit1.{0} Nat Nat.hasOne Nat.hasAdd)
+but is expected to have type
+  Primrec.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (n : Nat) => HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (HMul.hMul.{0, 0, 0} Nat Nat Nat (instHMul.{0} Nat instMulNat) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)) n) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))
+Case conversion may be inaccurate. Consider using '#align primrec.nat_bit1 Primrec.nat_double_succₓ'. -/
+theorem nat_double_succ : Primrec (@bit1 ℕ _ _) :=
+  nat_add.comp nat_double (const 1)
+#align primrec.nat_bit1 Primrec.nat_double_succ
 
 theorem nat_bit : Primrec₂ Nat.bit :=
-  (cond Primrec.fst (nat_bit1.comp Primrec.snd) (nat_bit0.comp Primrec.snd)).of_eq fun n => by
-    cases n.1 <;> rfl
+  (cond Primrec.fst (nat_double_succ.comp Primrec.snd) (nat_double.comp Primrec.snd)).of_eq fun n =>
+    by cases n.1 <;> rfl
 #align primrec.nat_bit Primrec.nat_bit
 
-theorem nat_div_mod : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
+/- warning: primrec.nat_div_mod clashes with [anonymous] -> [anonymous]
+warning: primrec.nat_div_mod -> [anonymous] is a dubious translation:
+lean 3 declaration is
+  Primrec₂.{0, 0, 0} Nat Nat (Prod.{0, 0} Nat Nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.prod.{0, 0} Nat Nat (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (Primcodable.ofDenumerable.{0} Nat Denumerable.nat)) (fun (n : Nat) (k : Nat) => Prod.mk.{0, 0} Nat Nat (HDiv.hDiv.{0, 0, 0} Nat Nat Nat (instHDiv.{0} Nat Nat.hasDiv) n k) (HMod.hMod.{0, 0, 0} Nat Nat Nat (instHMod.{0} Nat Nat.hasMod) n k))
+but is expected to have type
+  forall {α : Type.{u}} {β : Type.{v}}, (Nat -> α -> β) -> Nat -> (List.{u} α) -> (List.{v} β)
+Case conversion may be inaccurate. Consider using '#align primrec.nat_div_mod [anonymous]ₓ'. -/
+theorem [anonymous] : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
   let f (a : ℕ × ℕ) : ℕ × ℕ :=
     a.1.elim (0, 0) fun _ IH =>
       if Nat.succ IH.2 = a.2 then (Nat.succ IH.1, 0) else (IH.1, Nat.succ IH.2)
@@ -870,15 +1359,19 @@ theorem nat_div_mod : Primrec₂ fun n k : ℕ => (n / k, n % k) :=
   · simp [h, h₃ h] at h₁⊢
     simp [h₁]
   · exact (Nat.div_mod_unique h).2 ⟨h₁, h₂ h⟩
-#align primrec.nat_div_mod Primrec.nat_div_mod
+#align primrec.nat_div_mod [anonymous]
 
+#print Primrec.nat_div /-
 theorem nat_div : Primrec₂ ((· / ·) : ℕ → ℕ → ℕ) :=
-  fst.comp₂ nat_div_mod
+  fst.comp₂ [anonymous]
 #align primrec.nat_div Primrec.nat_div
+-/
 
+#print Primrec.nat_mod /-
 theorem nat_mod : Primrec₂ ((· % ·) : ℕ → ℕ → ℕ) :=
-  snd.comp₂ nat_div_mod
+  snd.comp₂ [anonymous]
 #align primrec.nat_mod Primrec.nat_mod
+-/
 
 end Primrec
 
@@ -980,6 +1473,7 @@ variable [Primcodable α] [Primcodable β]
 
 open Primrec
 
+#print Primcodable.sum /-
 instance sum : Primcodable (Sum α β) :=
   ⟨Primrec.nat_iff.1 <|
       (encode_iff.2
@@ -995,7 +1489,9 @@ instance sum : Primcodable (Sum α β) :=
           · cases decode α n.div2 <;> rfl
           · cases decode β n.div2 <;> rfl⟩
 #align primcodable.sum Primcodable.sum
+-/
 
+#print Primcodable.list /-
 instance list : Primcodable (List α) :=
   ⟨letI H := Primcodable.prim (List ℕ)
     have : Primrec₂ fun (a : α) (o : Option (List ℕ)) => o.map (List.cons (encode a)) :=
@@ -1021,6 +1517,7 @@ instance list : Primcodable (List α) :=
         cases o <;> cases p <;> injection IH with h
         exact congr_arg (fun k => (Nat.mkpair (encode a) k).succ.succ) h⟩
 #align primcodable.list Primcodable.list
+-/
 
 end Primcodable
 
@@ -1030,14 +1527,28 @@ variable {α : Type _} {β : Type _} {γ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable σ]
 
+/- warning: primrec.sum_inl -> Primrec.sum_inl is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β], Primrec.{u1, max u1 u2} α (Sum.{u1, u2} α β) _inst_1 (Primcodable.sum.{u1, u2} α β _inst_1 _inst_2) (Sum.inl.{u1, u2} α β)
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u1} β], Primrec.{u2, max u2 u1} α (Sum.{u2, u1} α β) _inst_1 (Primcodable.sum.{u2, u1} α β _inst_1 _inst_2) (Sum.inl.{u2, u1} α β)
+Case conversion may be inaccurate. Consider using '#align primrec.sum_inl Primrec.sum_inlₓ'. -/
 theorem sum_inl : Primrec (@Sum.inl α β) :=
-  encode_iff.1 <| nat_bit0.comp Primrec.encode
+  encode_iff.1 <| nat_double.comp Primrec.encode
 #align primrec.sum_inl Primrec.sum_inl
 
+#print Primrec.sum_inr /-
 theorem sum_inr : Primrec (@Sum.inr α β) :=
-  encode_iff.1 <| nat_bit1.comp Primrec.encode
+  encode_iff.1 <| nat_double_succ.comp Primrec.encode
 #align primrec.sum_inr Primrec.sum_inr
+-/
 
+/- warning: primrec.sum_cases -> Primrec.sum_cases is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} {σ : Type.{u4}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u4} σ] {f : α -> (Sum.{u2, u3} β γ)} {g : α -> β -> σ} {h : α -> γ -> σ}, (Primrec.{u1, max u2 u3} α (Sum.{u2, u3} β γ) _inst_1 (Primcodable.sum.{u2, u3} β γ _inst_2 _inst_3) f) -> (Primrec₂.{u1, u2, u4} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec₂.{u1, u3, u4} α γ σ _inst_1 _inst_3 _inst_4 h) -> (Primrec.{u1, u4} α σ _inst_1 _inst_4 (fun (a : α) => Sum.casesOn.{succ u4, u2, u3} β γ (fun (_x : Sum.{u2, u3} β γ) => σ) (f a) (g a) (h a)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u4}} {γ : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u4} β] [_inst_3 : Primcodable.{u3} γ] [_inst_4 : Primcodable.{u1} σ] {f : α -> (Sum.{u4, u3} β γ)} {g : α -> β -> σ} {h : α -> γ -> σ}, (Primrec.{u2, max u4 u3} α (Sum.{u4, u3} β γ) _inst_1 (Primcodable.sum.{u4, u3} β γ _inst_2 _inst_3) f) -> (Primrec₂.{u2, u4, u1} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec₂.{u2, u3, u1} α γ σ _inst_1 _inst_3 _inst_4 h) -> (Primrec.{u2, u1} α σ _inst_1 _inst_4 (fun (a : α) => Sum.casesOn.{succ u1, u4, u3} β γ (fun (_x : Sum.{u4, u3} β γ) => σ) (f a) (g a) (h a)))
+Case conversion may be inaccurate. Consider using '#align primrec.sum_cases Primrec.sum_casesₓ'. -/
 theorem sum_cases {f : α → Sum β γ} {g : α → β → σ} {h : α → γ → σ} (hf : Primrec f)
     (hg : Primrec₂ g) (hh : Primrec₂ h) : @Primrec _ σ _ _ fun a => Sum.casesOn (f a) (g a) (h a) :=
   option_some_iff.1 <|
@@ -1047,10 +1558,18 @@ theorem sum_cases {f : α → Sum β γ} {g : α → β → σ} {h : α → γ 
       fun a => by cases' f a with b c <;> simp [Nat.div2_bit, Nat.bodd_bit, encodek] <;> rfl
 #align primrec.sum_cases Primrec.sum_cases
 
+#print Primrec.list_cons /-
 theorem list_cons : Primrec₂ (@List.cons α) :=
   list_cons' (Primcodable.prim _)
 #align primrec.list_cons Primrec.list_cons
+-/
 
+/- warning: primrec.list_cases -> Primrec.list_cases is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> σ} {h : α -> (Prod.{u2, u2} β (List.{u2} β)) -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, u2, u3} α (Prod.{u2, u2} β (List.{u2} β)) σ _inst_1 (Primcodable.prod.{u2, u2} β (List.{u2} β) _inst_2 (Primcodable.list.{u2} β _inst_2)) _inst_4 h) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 (fun (a : α) => List.casesOn.{succ u3, u2} β (fun (_x : List.{u2} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u2} β) => h a (Prod.mk.{u2, u2} β (List.{u2} β) b l))))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u1} σ] {f : α -> (List.{u3} β)} {g : α -> σ} {h : α -> (Prod.{u3, u3} β (List.{u3} β)) -> σ}, (Primrec.{u2, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec.{u2, u1} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u2, u3, u1} α (Prod.{u3, u3} β (List.{u3} β)) σ _inst_1 (Primcodable.prod.{u3, u3} β (List.{u3} β) _inst_2 (Primcodable.list.{u3} β _inst_2)) _inst_4 h) -> (Primrec.{u2, u1} α σ _inst_1 _inst_4 (fun (a : α) => List.casesOn.{succ u1, u3} β (fun (_x : List.{u3} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u3} β) => h a (Prod.mk.{u3, u3} β (List.{u3} β) b l))))
+Case conversion may be inaccurate. Consider using '#align primrec.list_cases Primrec.list_casesₓ'. -/
 theorem list_cases {f : α → List β} {g : α → σ} {h : α → β × List β → σ} :
     Primrec f →
       Primrec g →
@@ -1058,16 +1577,30 @@ theorem list_cases {f : α → List β} {g : α → σ} {h : α → β × List 
   list_cases' (Primcodable.prim _)
 #align primrec.list_cases Primrec.list_cases
 
+/- warning: primrec.list_foldl -> Primrec.list_foldl is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> σ} {h : α -> (Prod.{u3, u2} σ β) -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u3 u2, u3} α (Prod.{u3, u2} σ β) σ _inst_1 (Primcodable.prod.{u3, u2} σ β _inst_4 _inst_2) _inst_4 h) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 (fun (a : α) => List.foldl.{u3, u2} σ β (fun (s : σ) (b : β) => h a (Prod.mk.{u3, u2} σ β s b)) (g a) (f a)))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u2} σ] {f : α -> (List.{u3} β)} {g : α -> σ} {h : α -> (Prod.{u2, u3} σ β) -> σ}, (Primrec.{u1, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u3 u2, u2} α (Prod.{u2, u3} σ β) σ _inst_1 (Primcodable.prod.{u2, u3} σ β _inst_4 _inst_2) _inst_4 h) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 (fun (a : α) => List.foldl.{u2, u3} σ β (fun (s : σ) (b : β) => h a (Prod.mk.{u2, u3} σ β s b)) (g a) (f a)))
+Case conversion may be inaccurate. Consider using '#align primrec.list_foldl Primrec.list_foldlₓ'. -/
 theorem list_foldl {f : α → List β} {g : α → σ} {h : α → σ × β → σ} :
     Primrec f →
       Primrec g → Primrec₂ h → Primrec fun a => (f a).foldl (fun s b => h a (s, b)) (g a) :=
   list_foldl' (Primcodable.prim _)
 #align primrec.list_foldl Primrec.list_foldl
 
+#print Primrec.list_reverse /-
 theorem list_reverse : Primrec (@List.reverse α) :=
   list_reverse' (Primcodable.prim _)
 #align primrec.list_reverse Primrec.list_reverse
+-/
 
+/- warning: primrec.list_foldr -> Primrec.list_foldr is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> σ} {h : α -> (Prod.{u2, u3} β σ) -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u2 u3, u3} α (Prod.{u2, u3} β σ) σ _inst_1 (Primcodable.prod.{u2, u3} β σ _inst_2 _inst_4) _inst_4 h) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 (fun (a : α) => List.foldr.{u2, u3} β σ (fun (b : β) (s : σ) => h a (Prod.mk.{u2, u3} β σ b s)) (g a) (f a)))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u2} σ] {f : α -> (List.{u3} β)} {g : α -> σ} {h : α -> (Prod.{u3, u2} β σ) -> σ}, (Primrec.{u1, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u3 u2, u2} α (Prod.{u3, u2} β σ) σ _inst_1 (Primcodable.prod.{u3, u2} β σ _inst_2 _inst_4) _inst_4 h) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 (fun (a : α) => List.foldr.{u3, u2} β σ (fun (b : β) (s : σ) => h a (Prod.mk.{u3, u2} β σ b s)) (g a) (f a)))
+Case conversion may be inaccurate. Consider using '#align primrec.list_foldr Primrec.list_foldrₓ'. -/
 theorem list_foldr {f : α → List β} {g : α → σ} {h : α → β × σ → σ} (hf : Primrec f)
     (hg : Primrec g) (hh : Primrec₂ h) :
     Primrec fun a => (f a).foldr (fun b s => h a (b, s)) (g a) :=
@@ -1075,19 +1608,31 @@ theorem list_foldr {f : α → List β} {g : α → σ} {h : α → β × σ →
     fun a => by simp [List.foldl_reverse]
 #align primrec.list_foldr Primrec.list_foldr
 
+#print Primrec.list_head? /-
 theorem list_head? : Primrec (@List.head? α) :=
   (list_cases Primrec.id (const none) (option_some_iff.2 <| fst.comp snd).to₂).of_eq fun l => by
     cases l <;> rfl
 #align primrec.list_head' Primrec.list_head?
+-/
 
+#print Primrec.list_headI /-
 theorem list_headI [Inhabited α] : Primrec (@List.headI α _) :=
   (option_iget.comp list_head?).of_eq fun l => l.head!_eq_head?.symm
 #align primrec.list_head Primrec.list_headI
+-/
 
+#print Primrec.list_tail /-
 theorem list_tail : Primrec (@List.tail α) :=
   (list_cases Primrec.id (const []) (snd.comp snd).to₂).of_eq fun l => by cases l <;> rfl
 #align primrec.list_tail Primrec.list_tail
+-/
 
+/- warning: primrec.list_rec -> Primrec.list_rec is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> σ} {h : α -> (Prod.{u2, max u2 u3} β (Prod.{u2, u3} (List.{u2} β) σ)) -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u2 u3, u3} α (Prod.{u2, max u2 u3} β (Prod.{u2, u3} (List.{u2} β) σ)) σ _inst_1 (Primcodable.prod.{u2, max u2 u3} β (Prod.{u2, u3} (List.{u2} β) σ) _inst_2 (Primcodable.prod.{u2, u3} (List.{u2} β) σ (Primcodable.list.{u2} β _inst_2) _inst_4)) _inst_4 h) -> (Primrec.{u1, u3} α σ _inst_1 _inst_4 (fun (a : α) => List.recOn.{succ u3, u2} β (fun (_x : List.{u2} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u2} β) (IH : σ) => h a (Prod.mk.{u2, max u2 u3} β (Prod.{u2, u3} (List.{u2} β) σ) b (Prod.mk.{u2, u3} (List.{u2} β) σ l IH)))))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u3}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u2} σ] {f : α -> (List.{u3} β)} {g : α -> σ} {h : α -> (Prod.{u3, max u2 u3} β (Prod.{u3, u2} (List.{u3} β) σ)) -> σ}, (Primrec.{u1, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 g) -> (Primrec₂.{u1, max u3 u2, u2} α (Prod.{u3, max u2 u3} β (Prod.{u3, u2} (List.{u3} β) σ)) σ _inst_1 (Primcodable.prod.{u3, max u3 u2} β (Prod.{u3, u2} (List.{u3} β) σ) _inst_2 (Primcodable.prod.{u3, u2} (List.{u3} β) σ (Primcodable.list.{u3} β _inst_2) _inst_4)) _inst_4 h) -> (Primrec.{u1, u2} α σ _inst_1 _inst_4 (fun (a : α) => List.recOn.{succ u2, u3} β (fun (_x : List.{u3} β) => σ) (f a) (g a) (fun (b : β) (l : List.{u3} β) (IH : σ) => h a (Prod.mk.{u3, max u3 u2} β (Prod.{u3, u2} (List.{u3} β) σ) b (Prod.mk.{u3, u2} (List.{u3} β) σ l IH)))))
+Case conversion may be inaccurate. Consider using '#align primrec.list_rec Primrec.list_recₓ'. -/
 theorem list_rec {f : α → List β} {g : α → σ} {h : α → β × List β × σ → σ} (hf : Primrec f)
     (hg : Primrec g) (hh : Primrec₂ h) :
     @Primrec _ σ _ _ fun a => List.recOn (f a) (g a) fun b l IH => h a (b, l, IH) :=
@@ -1102,11 +1647,12 @@ theorem list_rec {f : α → List β} {g : α → σ} {h : α → β × List β
     induction' f a with b l IH <;> simp [*]
 #align primrec.list_rec Primrec.list_rec
 
+#print Primrec.list_get? /-
 theorem list_get? : Primrec₂ (@List.get? α) :=
   let F (l : List α) (n : ℕ) :=
     l.foldl
       (fun (s : Sum ℕ α) (a : α) =>
-        Sum.casesOn s (@Nat.cases (Sum ℕ α) (Sum.inr a) Sum.inl) Sum.inr)
+        Sum.casesOn s (@Nat.casesOn (Sum ℕ α) (Sum.inr a) Sum.inl) Sum.inr)
       (Sum.inl n)
   have hF : Primrec₂ F :=
     list_foldl fst (sum_inl.comp snd)
@@ -1127,26 +1673,41 @@ theorem list_get? : Primrec₂ (@List.get? α) :=
       induction' l with b l IH <;> simp [*]
     · apply IH
 #align primrec.list_nth Primrec.list_get?
+-/
 
+#print Primrec.list_getD /-
 theorem list_getD (d : α) : Primrec₂ fun l n => List.getD l n d :=
   by
   simp only [List.getD_eq_getD_get?]
   exact option_get_or_else.comp₂ list_nth (const _)
 #align primrec.list_nthd Primrec.list_getD
+-/
 
+#print Primrec.list_getI /-
 theorem list_getI [Inhabited α] : Primrec₂ (@List.getI α _) :=
   list_getD _
 #align primrec.list_inth Primrec.list_getI
+-/
 
+#print Primrec.list_append /-
 theorem list_append : Primrec₂ ((· ++ ·) : List α → List α → List α) :=
   (list_foldr fst snd <| to₂ <| comp (@list_cons α _) snd).to₂.of_eq fun l₁ l₂ => by
     induction l₁ <;> simp [*]
 #align primrec.list_append Primrec.list_append
+-/
 
+#print Primrec.list_concat /-
 theorem list_concat : Primrec₂ fun l (a : α) => l ++ [a] :=
   list_append.comp fst (list_cons.comp snd (const []))
 #align primrec.list_concat Primrec.list_concat
+-/
 
+/- warning: primrec.list_map -> Primrec.list_map is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} {σ : Type.{u3}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] [_inst_4 : Primcodable.{u3} σ] {f : α -> (List.{u2} β)} {g : α -> β -> σ}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec₂.{u1, u2, u3} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec.{u1, u3} α (List.{u3} σ) _inst_1 (Primcodable.list.{u3} σ _inst_4) (fun (a : α) => List.map.{u2, u3} β σ (g a) (f a)))
+but is expected to have type
+  forall {α : Type.{u2}} {β : Type.{u3}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_2 : Primcodable.{u3} β] [_inst_4 : Primcodable.{u1} σ] {f : α -> (List.{u3} β)} {g : α -> β -> σ}, (Primrec.{u2, u3} α (List.{u3} β) _inst_1 (Primcodable.list.{u3} β _inst_2) f) -> (Primrec₂.{u2, u3, u1} α β σ _inst_1 _inst_2 _inst_4 g) -> (Primrec.{u2, u1} α (List.{u1} σ) _inst_1 (Primcodable.list.{u1} σ _inst_4) (fun (a : α) => List.map.{u3, u1} β σ (g a) (f a)))
+Case conversion may be inaccurate. Consider using '#align primrec.list_map Primrec.list_mapₓ'. -/
 theorem list_map {f : α → List β} {g : α → β → σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).map (g a) :=
   (list_foldr hf (const []) <|
@@ -1154,32 +1715,45 @@ theorem list_map {f : α → List β} {g : α → β → σ} (hf : Primrec f) (h
     fun a => by induction f a <;> simp [*]
 #align primrec.list_map Primrec.list_map
 
+#print Primrec.list_range /-
 theorem list_range : Primrec List.range :=
   (nat_elim' Primrec.id (const []) ((list_concat.comp snd fst).comp snd).to₂).of_eq fun n => by
     simp <;> induction n <;> simp [*, List.range_succ] <;> rfl
 #align primrec.list_range Primrec.list_range
+-/
 
+#print Primrec.list_join /-
 theorem list_join : Primrec (@List.join α) :=
   (list_foldr Primrec.id (const []) <| to₂ <| comp (@list_append α _) snd).of_eq fun l => by
     dsimp <;> induction l <;> simp [*]
 #align primrec.list_join Primrec.list_join
+-/
 
+#print Primrec.list_length /-
 theorem list_length : Primrec (@List.length α) :=
   (list_foldr (@Primrec.id (List α) _) (const 0) <| to₂ <| (succ.comp <| snd.comp snd).to₂).of_eq
     fun l => by dsimp <;> induction l <;> simp [*, -add_comm]
 #align primrec.list_length Primrec.list_length
+-/
 
-theorem list_findIndex {f : α → List β} {p : α → β → Prop} [∀ a b, Decidable (p a b)]
-    (hf : Primrec f) (hp : PrimrecRel p) : Primrec fun a => (f a).findIndex (p a) :=
+/- warning: primrec.list_find_index -> Primrec.list_findIdx is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> (List.{u2} β)} {p : α -> β -> Prop} [_inst_5 : forall (a : α) (b : β), Decidable (p a b)], (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (PrimrecRel.{u1, u2} α β _inst_1 _inst_2 p (fun (a : α) (b : β) => _inst_5 a b)) -> (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => List.findIndex.{u2} β (p a) (fun (a_1 : β) => _inst_5 a a_1) (f a)))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_2 : Primcodable.{u2} β] {f : α -> (List.{u2} β)} {p : α -> β -> Bool}, (Primrec.{u1, u2} α (List.{u2} β) _inst_1 (Primcodable.list.{u2} β _inst_2) f) -> (Primrec₂.{u1, u2, 0} α β Bool _inst_1 _inst_2 Primcodable.bool p) -> (Primrec.{u1, 0} α Nat _inst_1 (Primcodable.ofDenumerable.{0} Nat Denumerable.nat) (fun (a : α) => List.findIdx.{u2} β (p a) (f a)))
+Case conversion may be inaccurate. Consider using '#align primrec.list_find_index Primrec.list_findIdxₓ'. -/
+theorem list_findIdx {f : α → List β} {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hf : Primrec f)
+    (hp : PrimrecRel p) : Primrec fun a => (f a).findIndex (p a) :=
   (list_foldr hf (const 0) <|
         to₂ <| ite (hp.comp fst <| fst.comp snd) (const 0) (succ.comp <| snd.comp snd)).of_eq
     fun a => Eq.symm <| by dsimp <;> induction' f a with b l <;> [rfl, simp [*, List.findIndex]]
-#align primrec.list_find_index Primrec.list_findIndex
+#align primrec.list_find_index Primrec.list_findIdx
 
 theorem list_indexOf [DecidableEq α] : Primrec₂ (@List.indexOf α _) :=
-  to₂ <| list_findIndex snd <| Primrec.eq.comp₂ (fst.comp fst).to₂ snd.to₂
+  to₂ <| list_findIdx snd <| Primrec.eq.comp₂ (fst.comp fst).to₂ snd.to₂
 #align primrec.list_index_of Primrec.list_indexOfₓ
 
+#print Primrec.nat_strong_rec /-
 theorem nat_strong_rec (f : α → ℕ → σ) {g : α → List σ → Option σ} (hg : Primrec₂ g)
     (H : ∀ a n, g a ((List.range n).map (f a)) = some (f a n)) : Primrec₂ f :=
   suffices Primrec₂ fun a n => (List.range n).map (f a) from
@@ -1197,6 +1771,7 @@ theorem nat_strong_rec (f : α → ℕ → σ) {g : α → List σ → Option σ
       simp; induction' n with n IH; · rfl
       simp [IH, H, List.range_succ]
 #align primrec.nat_strong_rec Primrec.nat_strong_rec
+-/
 
 end Primrec
 
@@ -1208,6 +1783,7 @@ variable [Primcodable α] [Primcodable β]
 
 open Primrec
 
+#print Primcodable.subtype /-
 /-- A subtype of a primitive recursive predicate is `primcodable`. -/
 def subtype {p : α → Prop} [DecidablePred p] (hp : PrimrecPred p) : Primcodable (Subtype p) :=
   ⟨have : Primrec fun n => (decode α n).bind fun a => Option.guard p a :=
@@ -1220,18 +1796,25 @@ def subtype {p : α → Prop} [DecidablePred p] (hp : PrimrecPred p) : Primcodab
           dsimp [Option.guard]
           by_cases h : p a <;> simp [h] <;> rfl⟩
 #align primcodable.subtype Primcodable.subtype
+-/
 
+#print Primcodable.fin /-
 instance fin {n} : Primcodable (Fin n) :=
   @ofEquiv _ _ (subtype <| nat_lt.comp Primrec.id (const n)) Fin.equivSubtype
 #align primcodable.fin Primcodable.fin
+-/
 
+#print Primcodable.vector /-
 instance vector {n} : Primcodable (Vector α n) :=
   subtype ((@Primrec.eq _ _ Nat.decidableEq).comp list_length (const _))
 #align primcodable.vector Primcodable.vector
+-/
 
+#print Primcodable.finArrow /-
 instance finArrow {n} : Primcodable (Fin n → α) :=
   ofEquiv _ (Equiv.vectorEquivFin _ _).symm
 #align primcodable.fin_arrow Primcodable.finArrow
+-/
 
 instance array {n} : Primcodable (Array' n α) :=
   ofEquiv _ (Equiv.arrayEquivFin _ _)
@@ -1241,9 +1824,10 @@ section Ulower
 
 attribute [local instance] Encodable.decidableRangeEncode Encodable.decidableEqOfEncodable
 
+#print Primcodable.ulower /-
 instance ulower : Primcodable (Ulower α) :=
   have : PrimrecPred fun n => Encodable.decode₂ α n ≠ none :=
-    Primrec.not
+    PrimrecPred.not
       (Primrec.eq.comp
         (Primrec.option_bind Primrec.decode
           (Primrec.ite (Primrec.eq.comp (Primrec.encode.comp Primrec.snd) Primrec.fst)
@@ -1251,6 +1835,7 @@ instance ulower : Primcodable (Ulower α) :=
         (Primrec.const _))
   Primcodable.subtype <| PrimrecPred.of_eq this fun n => decode₂_ne_none_iff
 #align primcodable.ulower Primcodable.ulower
+-/
 
 end Ulower
 
@@ -1262,6 +1847,7 @@ variable {α : Type _} {β : Type _} {γ : Type _} {σ : Type _}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable σ]
 
+#print Primrec.subtype_val /-
 theorem subtype_val {p : α → Prop} [DecidablePred p] {hp : PrimrecPred p} :
     haveI := Primcodable.subtype hp
     Primrec (@Subtype.val α p) :=
@@ -1270,7 +1856,9 @@ theorem subtype_val {p : α → Prop} [DecidablePred p] {hp : PrimrecPred p} :
   refine' (Primcodable.prim (Subtype p)).of_eq fun n => _
   rcases decode (Subtype p) n with (_ | ⟨a, h⟩) <;> rfl
 #align primrec.subtype_val Primrec.subtype_val
+-/
 
+#print Primrec.subtype_val_iff /-
 theorem subtype_val_iff {p : β → Prop} [DecidablePred p] {hp : PrimrecPred p} {f : α → Subtype p} :
     haveI := Primcodable.subtype hp
     (Primrec fun a => (f a).1) ↔ Primrec f :=
@@ -1281,14 +1869,18 @@ theorem subtype_val_iff {p : β → Prop} [DecidablePred p] {hp : PrimrecPred p}
   cases' decode α n with a; · rfl
   simp; cases f a <;> rfl
 #align primrec.subtype_val_iff Primrec.subtype_val_iff
+-/
 
+#print Primrec.subtype_mk /-
 theorem subtype_mk {p : β → Prop} [DecidablePred p] {hp : PrimrecPred p} {f : α → β}
     {h : ∀ a, p (f a)} (hf : Primrec f) :
     haveI := Primcodable.subtype hp
     Primrec fun a => @Subtype.mk β p (f a) (h a) :=
   subtype_val_iff.1 hf
 #align primrec.subtype_mk Primrec.subtype_mk
+-/
 
+#print Primrec.option_get /-
 theorem option_get {f : α → Option β} {h : ∀ a, (f a).isSome} :
     Primrec f → Primrec fun a => Option.get (h a) :=
   by
@@ -1297,61 +1889,92 @@ theorem option_get {f : α → Option β} {h : ∀ a, (f a).isSome} :
   generalize hx : decode α n = x
   cases x <;> simp
 #align primrec.option_get Primrec.option_get
+-/
 
+#print Primrec.ulower_down /-
 theorem ulower_down : Primrec (Ulower.down : α → Ulower α) :=
   letI : ∀ a, Decidable (a ∈ Set.range (encode : α → ℕ)) := decidable_range_encode _
   subtype_mk Primrec.encode
 #align primrec.ulower_down Primrec.ulower_down
+-/
 
+#print Primrec.ulower_up /-
 theorem ulower_up : Primrec (Ulower.up : Ulower α → α) :=
   letI : ∀ a, Decidable (a ∈ Set.range (encode : α → ℕ)) := decidable_range_encode _
   option_get (primrec.decode₂.comp subtype_val)
 #align primrec.ulower_up Primrec.ulower_up
+-/
 
+#print Primrec.fin_val_iff /-
 theorem fin_val_iff {n} {f : α → Fin n} : (Primrec fun a => (f a).1) ↔ Primrec f :=
   by
   let : Primcodable { a // id a < n }; swap
   exact (Iff.trans (by rfl) subtype_val_iff).trans (of_equiv_iff _)
 #align primrec.fin_val_iff Primrec.fin_val_iff
+-/
 
+#print Primrec.fin_val /-
 theorem fin_val {n} : Primrec (coe : Fin n → ℕ) :=
   fin_val_iff.2 Primrec.id
 #align primrec.fin_val Primrec.fin_val
+-/
 
+#print Primrec.fin_succ /-
 theorem fin_succ {n} : Primrec (@Fin.succ n) :=
   fin_val_iff.1 <| by simp [succ.comp fin_val]
 #align primrec.fin_succ Primrec.fin_succ
+-/
 
+#print Primrec.vector_toList /-
 theorem vector_toList {n} : Primrec (@Vector.toList α n) :=
   subtype_val
 #align primrec.vector_to_list Primrec.vector_toList
+-/
 
+#print Primrec.vector_toList_iff /-
 theorem vector_toList_iff {n} {f : α → Vector β n} : (Primrec fun a => (f a).toList) ↔ Primrec f :=
   subtype_val_iff
 #align primrec.vector_to_list_iff Primrec.vector_toList_iff
+-/
 
+#print Primrec.vector_cons /-
 theorem vector_cons {n} : Primrec₂ (@Vector.cons α n) :=
   vector_toList_iff.1 <| by simp <;> exact list_cons.comp fst (vector_to_list_iff.2 snd)
 #align primrec.vector_cons Primrec.vector_cons
+-/
 
+#print Primrec.vector_length /-
 theorem vector_length {n} : Primrec (@Vector.length α n) :=
   const _
 #align primrec.vector_length Primrec.vector_length
+-/
 
+#print Primrec.vector_head /-
 theorem vector_head {n} : Primrec (@Vector.head α n) :=
   option_some_iff.1 <| (list_head?.comp vector_toList).of_eq fun ⟨a :: l, h⟩ => rfl
 #align primrec.vector_head Primrec.vector_head
+-/
 
+#print Primrec.vector_tail /-
 theorem vector_tail {n} : Primrec (@Vector.tail α n) :=
   vector_toList_iff.1 <| (list_tail.comp vector_toList).of_eq fun ⟨l, h⟩ => by cases l <;> rfl
 #align primrec.vector_tail Primrec.vector_tail
+-/
 
+#print Primrec.vector_get /-
 theorem vector_get {n} : Primrec₂ (@Vector.get α n) :=
   option_some_iff.1 <|
     (list_get?.comp (vector_toList.comp fst) (fin_val.comp snd)).of_eq fun a => by
       simp [Vector.get_eq_get] <;> rw [← List.nthLe_get?]
 #align primrec.vector_nth Primrec.vector_get
+-/
 
+/- warning: primrec.list_of_fn -> Primrec.list_ofFn is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} σ] {n : Nat} {f : (Fin n) -> α -> σ}, (forall (i : Fin n), Primrec.{u1, u2} α σ _inst_1 _inst_4 (f i)) -> (Primrec.{u1, u2} α (List.{u2} σ) _inst_1 (Primcodable.list.{u2} σ _inst_4) (fun (a : α) => List.ofFn.{u2} σ n (fun (i : Fin n) => f i a)))
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} σ] {n : Nat} {f : (Fin n) -> α -> σ}, (forall (i : Fin n), Primrec.{u2, u1} α σ _inst_1 _inst_4 (f i)) -> (Primrec.{u2, u1} α (List.{u1} σ) _inst_1 (Primcodable.list.{u1} σ _inst_4) (fun (a : α) => List.ofFn.{u1} σ n (fun (i : Fin n) => f i a)))
+Case conversion may be inaccurate. Consider using '#align primrec.list_of_fn Primrec.list_ofFnₓ'. -/
 theorem list_ofFn :
     ∀ {n} {f : Fin n → α → σ}, (∀ i, Primrec (f i)) → Primrec fun a => List.ofFn fun i => f i a
   | 0, f, hf => const []
@@ -1359,28 +1982,52 @@ theorem list_ofFn :
     simp [List.ofFn_succ] <;> exact list_cons.comp (hf 0) (list_of_fn fun i => hf i.succ)
 #align primrec.list_of_fn Primrec.list_ofFn
 
+/- warning: primrec.vector_of_fn -> Primrec.vector_ofFn is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} σ] {n : Nat} {f : (Fin n) -> α -> σ}, (forall (i : Fin n), Primrec.{u1, u2} α σ _inst_1 _inst_4 (f i)) -> (Primrec.{u1, u2} α (Vector.{u2} σ n) _inst_1 (Primcodable.vector.{u2} σ _inst_4 n) (fun (a : α) => Vector.ofFn.{u2} σ n (fun (i : Fin n) => f i a)))
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} σ] {n : Nat} {f : (Fin n) -> α -> σ}, (forall (i : Fin n), Primrec.{u2, u1} α σ _inst_1 _inst_4 (f i)) -> (Primrec.{u2, u1} α (Vector.{u1} σ n) _inst_1 (Primcodable.vector.{u1} σ _inst_4 n) (fun (a : α) => Vector.ofFn.{u1} σ n (fun (i : Fin n) => f i a)))
+Case conversion may be inaccurate. Consider using '#align primrec.vector_of_fn Primrec.vector_ofFnₓ'. -/
 theorem vector_ofFn {n} {f : Fin n → α → σ} (hf : ∀ i, Primrec (f i)) :
     Primrec fun a => Vector.ofFn fun i => f i a :=
   vector_toList_iff.1 <| by simp [list_of_fn hf]
 #align primrec.vector_of_fn Primrec.vector_ofFn
 
+#print Primrec.vector_nth' /-
 theorem vector_nth' {n} : Primrec (@Vector.get α n) :=
   ofEquiv_symm
 #align primrec.vector_nth' Primrec.vector_nth'
+-/
 
+#print Primrec.vector_of_fn' /-
 theorem vector_of_fn' {n} : Primrec (@Vector.ofFn α n) :=
   ofEquiv
 #align primrec.vector_of_fn' Primrec.vector_of_fn'
+-/
 
+#print Primrec.fin_app /-
 theorem fin_app {n} : Primrec₂ (@id (Fin n → σ)) :=
   (vector_get.comp (vector_of_fn'.comp fst) snd).of_eq fun ⟨v, i⟩ => by simp
 #align primrec.fin_app Primrec.fin_app
+-/
 
+/- warning: primrec.fin_curry₁ -> Primrec.fin_curry₁ is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} σ] {n : Nat} {f : (Fin n) -> α -> σ}, Iff (Primrec₂.{0, u1, u2} (Fin n) α σ (Primcodable.fin n) _inst_1 _inst_4 f) (forall (i : Fin n), Primrec.{u1, u2} α σ _inst_1 _inst_4 (f i))
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} σ] {n : Nat} {f : (Fin n) -> α -> σ}, Iff (Primrec₂.{0, u2, u1} (Fin n) α σ (Primcodable.fin n) _inst_1 _inst_4 f) (forall (i : Fin n), Primrec.{u2, u1} α σ _inst_1 _inst_4 (f i))
+Case conversion may be inaccurate. Consider using '#align primrec.fin_curry₁ Primrec.fin_curry₁ₓ'. -/
 theorem fin_curry₁ {n} {f : Fin n → α → σ} : Primrec₂ f ↔ ∀ i, Primrec (f i) :=
   ⟨fun h i => h.comp (const i) Primrec.id, fun h =>
     (vector_get.comp ((vector_ofFn h).comp snd) fst).of_eq fun a => by simp⟩
 #align primrec.fin_curry₁ Primrec.fin_curry₁
 
+/- warning: primrec.fin_curry -> Primrec.fin_curry is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {σ : Type.{u2}} [_inst_1 : Primcodable.{u1} α] [_inst_4 : Primcodable.{u2} σ] {n : Nat} {f : α -> (Fin n) -> σ}, Iff (Primrec.{u1, u2} α ((Fin n) -> σ) _inst_1 (Primcodable.finArrow.{u2} σ _inst_4 n) f) (Primrec₂.{u1, 0, u2} α (Fin n) σ _inst_1 (Primcodable.fin n) _inst_4 f)
+but is expected to have type
+  forall {α : Type.{u2}} {σ : Type.{u1}} [_inst_1 : Primcodable.{u2} α] [_inst_4 : Primcodable.{u1} σ] {n : Nat} {f : α -> (Fin n) -> σ}, Iff (Primrec.{u2, u1} α ((Fin n) -> σ) _inst_1 (Primcodable.finArrow.{u1} σ _inst_4 n) f) (Primrec₂.{u2, 0, u1} α (Fin n) σ _inst_1 (Primcodable.fin n) _inst_4 f)
+Case conversion may be inaccurate. Consider using '#align primrec.fin_curry Primrec.fin_curryₓ'. -/
 theorem fin_curry {n} {f : α → Fin n → σ} : Primrec f ↔ Primrec₂ f :=
   ⟨fun h => fin_app.comp (h.comp fst) snd, fun h =>
     (vector_nth'.comp
@@ -1394,6 +2041,7 @@ namespace Nat
 
 open Vector
 
+#print Nat.Primrec' /-
 /-- An alternative inductive definition of `primrec` which
   does not use the pairing function on ℕ, and so has to
   work with n-ary functions on ℕ instead of unary functions.
@@ -1413,6 +2061,7 @@ inductive Primrec' : ∀ {n}, (Vector ℕ n → ℕ) → Prop
         primrec' fun v : Vector ℕ (n + 1) =>
           v.headI.elim (f v.tail) fun y IH => g (y ::ᵥ IH ::ᵥ v.tail)
 #align nat.primrec' Nat.Primrec'
+-/
 
 end Nat
 
@@ -1425,6 +2074,7 @@ open Nat (Primrec')
 open Nat.Primrec'
 
 /- ./././Mathport/Syntax/Translate/Command.lean:691:6: unsupported: hide command -/
+#print Nat.Primrec'.to_prim /-
 theorem to_prim {n f} (pf : @Primrec' n f) : Primrec f :=
   by
   induction pf
@@ -1439,81 +2089,120 @@ theorem to_prim {n f} (pf : @Primrec' n f) : Primrec f :=
             vector_cons.comp (fst.comp snd) <|
               vector_cons.comp (snd.comp snd) <| (@vector_tail _ _ (n + 1)).comp fst).to₂
 #align nat.primrec'.to_prim Nat.Primrec'.to_prim
+-/
 
+#print Nat.Primrec'.of_eq /-
 theorem of_eq {n} {f g : Vector ℕ n → ℕ} (hf : Primrec' f) (H : ∀ i, f i = g i) : Primrec' g :=
   (funext H : f = g) ▸ hf
 #align nat.primrec'.of_eq Nat.Primrec'.of_eq
+-/
 
+#print Nat.Primrec'.const /-
 theorem const {n} : ∀ m, @Primrec' n fun v => m
   | 0 => zero.comp Fin.elim0 fun i => i.elim0ₓ
   | m + 1 => succ.comp _ fun i => const m
 #align nat.primrec'.const Nat.Primrec'.const
+-/
 
+#print Nat.Primrec'.head /-
 theorem head {n : ℕ} : @Primrec' n.succ head :=
-  (nth 0).of_eq fun v => by simp [nth_zero]
+  (get 0).of_eq fun v => by simp [nth_zero]
 #align nat.primrec'.head Nat.Primrec'.head
+-/
 
+#print Nat.Primrec'.tail /-
 theorem tail {n f} (hf : @Primrec' n f) : @Primrec' n.succ fun v => f v.tail :=
-  (hf.comp _ fun i => @nth _ i.succ).of_eq fun v => by
+  (hf.comp _ fun i => @get _ i.succ).of_eq fun v => by
     rw [← of_fn_nth v.tail] <;> congr <;> funext i <;> simp
 #align nat.primrec'.tail Nat.Primrec'.tail
+-/
 
+#print Nat.Primrec'.Vec /-
 /-- A function from vectors to vectors is primitive recursive when all of its projections are. -/
 def Vec {n m} (f : Vector ℕ n → Vector ℕ m) : Prop :=
   ∀ i, Primrec' fun v => (f v).get? i
 #align nat.primrec'.vec Nat.Primrec'.Vec
+-/
 
+#print Nat.Primrec'.nil /-
 protected theorem nil {n} : @Vec n 0 fun _ => nil := fun i => i.elim0ₓ
 #align nat.primrec'.nil Nat.Primrec'.nil
+-/
 
+#print Nat.Primrec'.cons /-
 protected theorem cons {n m f g} (hf : @Primrec' n f) (hg : @Vec n m g) :
     Vec fun v => f v ::ᵥ g v := fun i => Fin.cases (by simp [*]) (fun i => by simp [hg i]) i
 #align nat.primrec'.cons Nat.Primrec'.cons
+-/
 
+#print Nat.Primrec'.idv /-
 theorem idv {n} : @Vec n n id :=
-  nth
+  get
 #align nat.primrec'.idv Nat.Primrec'.idv
+-/
 
+#print Nat.Primrec'.comp' /-
 theorem comp' {n m f g} (hf : @Primrec' m f) (hg : @Vec n m g) : Primrec' fun v => f (g v) :=
   (hf.comp _ hg).of_eq fun v => by simp
 #align nat.primrec'.comp' Nat.Primrec'.comp'
+-/
 
+#print Nat.Primrec'.comp₁ /-
 theorem comp₁ (f : ℕ → ℕ) (hf : @Primrec' 1 fun v => f v.headI) {n g} (hg : @Primrec' n g) :
     Primrec' fun v => f (g v) :=
   hf.comp _ fun i => hg
 #align nat.primrec'.comp₁ Nat.Primrec'.comp₁
+-/
 
+#print Nat.Primrec'.comp₂ /-
 theorem comp₂ (f : ℕ → ℕ → ℕ) (hf : @Primrec' 2 fun v => f v.headI v.tail.headI) {n g h}
     (hg : @Primrec' n g) (hh : @Primrec' n h) : Primrec' fun v => f (g v) (h v) := by
   simpa using hf.comp' (hg.cons <| hh.cons primrec'.nil)
 #align nat.primrec'.comp₂ Nat.Primrec'.comp₂
+-/
 
+#print Nat.Primrec'.prec' /-
 theorem prec' {n f g h} (hf : @Primrec' n f) (hg : @Primrec' n g) (hh : @Primrec' (n + 2) h) :
     @Primrec' n fun v => (f v).elim (g v) fun y IH : ℕ => h (y ::ᵥ IH ::ᵥ v) := by
   simpa using comp' (prec hg hh) (hf.cons idv)
 #align nat.primrec'.prec' Nat.Primrec'.prec'
+-/
 
+#print Nat.Primrec'.pred /-
 theorem pred : @Primrec' 1 fun v => v.headI.pred :=
   (prec' head (const 0) head).of_eq fun v => by simp <;> cases v.head <;> rfl
 #align nat.primrec'.pred Nat.Primrec'.pred
+-/
 
+#print Nat.Primrec'.add /-
 theorem add : @Primrec' 2 fun v => v.headI + v.tail.headI :=
   (prec head (succ.comp₁ _ (tail head))).of_eq fun v => by
     simp <;> induction v.head <;> simp [*, Nat.succ_add]
 #align nat.primrec'.add Nat.Primrec'.add
+-/
 
+#print Nat.Primrec'.sub /-
 theorem sub : @Primrec' 2 fun v => v.headI - v.tail.headI :=
   by
   suffices; simpa using comp₂ (fun a b => b - a) this (tail head) head
   refine' (prec head (pred.comp₁ _ (tail head))).of_eq fun v => _
   simp; induction v.head <;> simp [*, Nat.sub_succ]
 #align nat.primrec'.sub Nat.Primrec'.sub
+-/
 
+#print Nat.Primrec'.mul /-
 theorem mul : @Primrec' 2 fun v => v.headI * v.tail.headI :=
   (prec (const 0) (tail (add.comp₂ _ (tail head) head))).of_eq fun v => by
     simp <;> induction v.head <;> simp [*, Nat.succ_mul] <;> rw [add_comm]
 #align nat.primrec'.mul Nat.Primrec'.mul
+-/
 
+/- warning: nat.primrec'.if_lt -> Nat.Primrec'.if_lt is a dubious translation:
+lean 3 declaration is
+  forall {n : Nat} {a : (Vector.{0} Nat n) -> Nat} {b : (Vector.{0} Nat n) -> Nat} {f : (Vector.{0} Nat n) -> Nat} {g : (Vector.{0} Nat n) -> Nat}, (Nat.Primrec' n a) -> (Nat.Primrec' n b) -> (Nat.Primrec' n f) -> (Nat.Primrec' n g) -> (Nat.Primrec' n (fun (v : Vector.{0} Nat n) => ite.{1} Nat (LT.lt.{0} Nat Nat.hasLt (a v) (b v)) (Nat.decidableLt (a v) (b v)) (f v) (g v)))
+but is expected to have type
+  forall {n : Nat} {a : (Vector.{0} Nat n) -> Nat} {b : (Vector.{0} Nat n) -> Nat} {f : (Vector.{0} Nat n) -> Nat} {g : (Vector.{0} Nat n) -> Nat}, (Nat.Primrec' n a) -> (Nat.Primrec' n b) -> (Nat.Primrec' n f) -> (Nat.Primrec' n g) -> (Nat.Primrec' n (fun (v : Vector.{0} Nat n) => ite.{1} Nat (LT.lt.{0} Nat instLTNat (a v) (b v)) (Nat.decLt (a v) (b v)) (f v) (g v)))
+Case conversion may be inaccurate. Consider using '#align nat.primrec'.if_lt Nat.Primrec'.if_ltₓ'. -/
 theorem if_lt {n a b f g} (ha : @Primrec' n a) (hb : @Primrec' n b) (hf : @Primrec' n f)
     (hg : @Primrec' n g) : @Primrec' n fun v => if a v < b v then f v else g v :=
   (prec' (sub.comp₂ _ hb ha) hg (tail <| tail hf)).of_eq fun v =>
@@ -1523,16 +2212,21 @@ theorem if_lt {n a b f g} (ha : @Primrec' n a) (hb : @Primrec' n b) (hf : @Primr
     · simp [Nat.lt_of_sub_eq_succ e]
 #align nat.primrec'.if_lt Nat.Primrec'.if_lt
 
+#print Nat.Primrec'.mkpair /-
 theorem mkpair : @Primrec' 2 fun v => v.headI.mkpair v.tail.headI :=
   if_lt head (tail head) (add.comp₂ _ (tail <| mul.comp₂ _ head head) head)
     (add.comp₂ _ (add.comp₂ _ (mul.comp₂ _ head head) head) (tail head))
 #align nat.primrec'.mkpair Nat.Primrec'.mkpair
+-/
 
+#print Nat.Primrec'.encode /-
 protected theorem encode : ∀ {n}, @Primrec' n encode
   | 0 => (const 0).of_eq fun v => by rw [v.eq_nil] <;> rfl
   | n + 1 => (succ.comp₁ _ (mkpair.comp₂ _ head (tail encode))).of_eq fun ⟨a :: l, e⟩ => rfl
 #align nat.primrec'.encode Nat.Primrec'.encode
+-/
 
+#print Nat.Primrec'.sqrt /-
 theorem sqrt : @Primrec' 1 fun v => v.headI.sqrt :=
   by
   suffices H : ∀ n : ℕ, n.sqrt = n.elim 0 fun x y => if x.succ < y.succ * y.succ then y else y.succ
@@ -1559,7 +2253,9 @@ theorem sqrt : @Primrec' 1 fun v => v.headI.sqrt :=
     exact
       Nat.eq_sqrt.2 ⟨not_lt.1 h, Nat.sqrt_lt.1 <| Nat.lt_succ_iff.2 <| Nat.sqrt_succ_le_succ_sqrt _⟩
 #align nat.primrec'.sqrt Nat.Primrec'.sqrt
+-/
 
+#print Nat.Primrec'.unpair₁ /-
 theorem unpair₁ {n f} (hf : @Primrec' n f) : @Primrec' n fun v => (f v).unpair.1 :=
   by
   have s := sqrt.comp₁ _ hf
@@ -1567,7 +2263,9 @@ theorem unpair₁ {n f} (hf : @Primrec' n f) : @Primrec' n fun v => (f v).unpair
   refine' (if_lt fss s fss s).of_eq fun v => _
   simp [Nat.unpair]; split_ifs <;> rfl
 #align nat.primrec'.unpair₁ Nat.Primrec'.unpair₁
+-/
 
+#print Nat.Primrec'.unpair₂ /-
 theorem unpair₂ {n f} (hf : @Primrec' n f) : @Primrec' n fun v => (f v).unpair.2 :=
   by
   have s := sqrt.comp₁ _ hf
@@ -1575,7 +2273,9 @@ theorem unpair₂ {n f} (hf : @Primrec' n f) : @Primrec' n fun v => (f v).unpair
   refine' (if_lt fss s s (sub.comp₂ _ fss s)).of_eq fun v => _
   simp [Nat.unpair]; split_ifs <;> rfl
 #align nat.primrec'.unpair₂ Nat.Primrec'.unpair₂
+-/
 
+#print Nat.Primrec'.of_prim /-
 theorem of_prim : ∀ {n f}, Primrec f → @Primrec' n f :=
   suffices ∀ f, Nat.Primrec f → @Primrec' 1 fun v => f v.headI from fun n f hf =>
     (pred.comp₁ _ <|
@@ -1596,17 +2296,23 @@ theorem of_prim : ∀ {n f}, Primrec f → @Primrec' n f :=
         (hg.comp₁ _ <|
           mkpair.comp₂ _ (unpair₁ <| tail <| tail head) (mkpair.comp₂ _ head (tail head)))
 #align nat.primrec'.of_prim Nat.Primrec'.of_prim
+-/
 
+#print Nat.Primrec'.prim_iff /-
 theorem prim_iff {n f} : @Primrec' n f ↔ Primrec f :=
   ⟨to_prim, of_prim⟩
 #align nat.primrec'.prim_iff Nat.Primrec'.prim_iff
+-/
 
+#print Nat.Primrec'.prim_iff₁ /-
 theorem prim_iff₁ {f : ℕ → ℕ} : (@Primrec' 1 fun v => f v.headI) ↔ Primrec f :=
   prim_iff.trans
     ⟨fun h => (h.comp <| vector_ofFn fun i => Primrec.id).of_eq fun v => by simp, fun h =>
       h.comp vector_head⟩
 #align nat.primrec'.prim_iff₁ Nat.Primrec'.prim_iff₁
+-/
 
+#print Nat.Primrec'.prim_iff₂ /-
 theorem prim_iff₂ {f : ℕ → ℕ → ℕ} : (@Primrec' 2 fun v => f v.headI v.tail.headI) ↔ Primrec₂ f :=
   prim_iff.trans
     ⟨fun h =>
@@ -1614,15 +2320,20 @@ theorem prim_iff₂ {f : ℕ → ℕ → ℕ} : (@Primrec' 2 fun v => f v.headI
         simp,
       fun h => h.comp vector_head (vector_head.comp vector_tail)⟩
 #align nat.primrec'.prim_iff₂ Nat.Primrec'.prim_iff₂
+-/
 
+#print Nat.Primrec'.vec_iff /-
 theorem vec_iff {m n f} : @Vec m n f ↔ Primrec f :=
   ⟨fun h => by simpa using vector_of_fn fun i => to_prim (h i), fun h i =>
     of_prim <| vector_get.comp h (Primrec.const i)⟩
 #align nat.primrec'.vec_iff Nat.Primrec'.vec_iff
+-/
 
 end Nat.Primrec'
 
+#print Primrec.nat_sqrt /-
 theorem Primrec.nat_sqrt : Primrec Nat.sqrt :=
   Nat.Primrec'.prim_iff₁.1 Nat.Primrec'.sqrt
 #align primrec.nat_sqrt Primrec.nat_sqrt
+-/
 

Changes in mathlib4

mathlib3
mathlib4
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -211,7 +211,6 @@ def Primrec {α β} [Primcodable α] [Primcodable β] (f : α → β) : Prop :=
 namespace Primrec
 
 variable {α : Type*} {β : Type*} {σ : Type*}
-
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
 open Nat.Primrec
@@ -408,7 +407,6 @@ def PrimrecRel {α β} [Primcodable α] [Primcodable β] (s : α → β → Prop
 namespace Primrec₂
 
 variable {α : Type*} {β : Type*} {σ : Type*}
-
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
 theorem mk {f : α → β → σ} (hf : Primrec fun p : α × β => f p.1 p.2) : Primrec₂ f := hf
@@ -470,7 +468,6 @@ end Primrec₂
 section Comp
 
 variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} {σ : Type*}
-
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
 theorem Primrec.comp₂ {f : γ → σ} {g : α → β → γ} (hf : Primrec f) (hg : Primrec₂ g) :
@@ -520,7 +517,6 @@ theorem PrimrecRel.of_eq {α β} [Primcodable α] [Primcodable β] {r s : α →
 namespace Primrec₂
 
 variable {α : Type*} {β : Type*} {σ : Type*}
-
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
 open Nat.Primrec
@@ -551,7 +547,6 @@ end Primrec₂
 namespace Primrec
 
 variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} {σ : Type*}
-
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
 theorem to₂ {f : α × β → σ} (hf : Primrec f) : Primrec₂ fun a b => f (a, b) :=
@@ -869,9 +864,7 @@ end Primrec
 section
 
 variable {α : Type*} {β : Type*} {σ : Type*}
-
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
-
 variable (H : Nat.Primrec fun n => Encodable.encode (@decode (List β) _ n))
 
 open Primrec
@@ -935,7 +928,6 @@ end
 namespace Primcodable
 
 variable {α : Type*} {β : Type*}
-
 variable [Primcodable α] [Primcodable β]
 
 open Primrec
@@ -989,7 +981,6 @@ end Primcodable
 namespace Primrec
 
 variable {α : Type*} {β : Type*} {γ : Type*} {σ : Type*}
-
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable σ]
 
 theorem sum_inl : Primrec (@Sum.inl α β) :=
@@ -1161,7 +1152,6 @@ end Primrec
 namespace Primcodable
 
 variable {α : Type*} {β : Type*}
-
 variable [Primcodable α] [Primcodable β]
 
 open Primrec
@@ -1219,7 +1209,6 @@ end Primcodable
 namespace Primrec
 
 variable {α : Type*} {β : Type*} {γ : Type*} {σ : Type*}
-
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable σ]
 
 theorem subtype_val {p : α → Prop} [DecidablePred p] {hp : PrimrecPred p} :
chore(Computability): Encodable/Fintype -> Countable/Finite (#10869)

Also golf a proof

Diff
@@ -781,7 +781,7 @@ theorem list_indexOf₁ [DecidableEq α] (l : List α) : Primrec fun a => l.inde
   list_findIdx₁ (.swap .beq) l
 #align primrec.list_index_of₁ Primrec.list_indexOf₁
 
-theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
+theorem dom_fintype [Finite α] (f : α → σ) : Primrec f :=
   let ⟨l, _, m⟩ := Finite.exists_univ_list α
   option_some_iff.1 <| by
     haveI := decidableEqOfEncodable α
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
@@ -144,7 +144,7 @@ theorem mul : Nat.Primrec (unpaired (· * ·)) :=
 
 theorem pow : Nat.Primrec (unpaired (· ^ ·)) :=
   (prec (const 1) (mul.comp (pair (right.comp right) left))).of_eq fun p => by
-    simp; induction p.unpair.2 <;> simp [*, pow_succ]
+    simp; induction p.unpair.2 <;> simp [*, Nat.pow_succ]
 #align nat.primrec.pow Nat.Primrec.pow
 
 end Primrec
@@ -169,7 +169,7 @@ instance (priority := 10) ofDenumerable (α) [Denumerable α] : Primcodable α :
 
 /-- Builds a `Primcodable` instance from an equivalence to a `Primcodable` type. -/
 def ofEquiv (α) {β} [Primcodable α] (e : β ≃ α) : Primcodable β :=
-  { Encodable.ofEquiv α e with
+  { __ := Encodable.ofEquiv α e
     prim := (@Primcodable.prim α _).of_eq fun n => by
       rw [decode_ofEquiv]
       cases (@decode α _ n) <;>
@@ -839,7 +839,7 @@ theorem nat_mod : Primrec₂ ((· % ·) : ℕ → ℕ → ℕ) :=
 
 theorem nat_bodd : Primrec Nat.bodd :=
   (Primrec.beq.comp (nat_mod.comp .id (const 2)) (const 1)).of_eq fun n => by
-    cases H : n.bodd <;> simp [Nat.mod_two_of_bodd, H]; rfl
+    cases H : n.bodd <;> simp [Nat.mod_two_of_bodd, H]
 #align primrec.nat_bodd Primrec.nat_bodd
 
 theorem nat_div2 : Primrec Nat.div2 :=
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -33,7 +33,7 @@ open Denumerable Encodable Function
 
 namespace Nat
 
--- porting note: elim is no longer required because lean 4 is better
+-- Porting note: elim is no longer required because lean 4 is better
 -- at inferring motive types (I think this is the reason)
 -- and worst case, we can always explicitly write (motive := fun _ => C)
 -- without having to then add all the other underscores
@@ -50,7 +50,7 @@ namespace Nat
 
 #align nat.elim_succ Nat.rec_add_one
 
--- porting note: cases is no longer required because lean 4 is better
+-- Porting note: cases is no longer required because lean 4 is better
 -- at inferring motive types (I think this is the reason)
 
 -- /-- Cases on whether the input is 0 or a successor. -/
@@ -154,7 +154,7 @@ end Nat
 /-- A `Primcodable` type is an `Encodable` type for which
   the encode/decode functions are primitive recursive. -/
 class Primcodable (α : Type*) extends Encodable α where
-  -- porting note: was `prim [] `.
+  -- Porting note: was `prim [] `.
   -- This means that `prim` does not take the type explicitly in Lean 4
   prim : Nat.Primrec fun n => Encodable.encode (decode n)
 #align primcodable Primcodable
@@ -739,7 +739,7 @@ theorem _root_.PrimrecPred.or {p q : α → Prop} [DecidablePred p] [DecidablePr
   (Primrec.or.comp hp hq).of_eq fun n => by simp
 #align primrec.or PrimrecPred.or
 
--- porting note: It is unclear whether we want to boolean versions
+-- Porting note: It is unclear whether we want to boolean versions
 -- of these lemmas, just the prop versions, or both
 -- The boolean versions are often actually easier to use
 -- but did not exist in Lean 3
@@ -789,7 +789,7 @@ theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
     rw [List.get?_map, List.indexOf_get? (m a), Option.map_some']
 #align primrec.dom_fintype Primrec.dom_fintype
 
--- porting note: These are new lemmas
+-- Porting note: These are new lemmas
 -- I added it because it actually simplified the proofs
 -- and because I couldn't understand the original proof
 /-- A function is `PrimrecBounded` if its size is bounded by a primitive recursive function -/
@@ -846,21 +846,21 @@ theorem nat_div2 : Primrec Nat.div2 :=
   (nat_div.comp .id (const 2)).of_eq fun n => n.div2_val.symm
 #align primrec.nat_div2 Primrec.nat_div2
 
--- porting note: this is no longer used
+-- Porting note: this is no longer used
 -- theorem nat_boddDiv2 : Primrec Nat.boddDiv2 := pair nat_bodd nat_div2
 #noalign primrec.nat_bodd_div2
 
--- porting note: bit0 is deprecated
+-- Porting note: bit0 is deprecated
 theorem nat_double : Primrec (fun n : ℕ => 2 * n) :=
   nat_mul.comp (const _) Primrec.id
 #align primrec.nat_bit0 Primrec.nat_double
 
--- porting note: bit1 is deprecated
+-- Porting note: bit1 is deprecated
 theorem nat_double_succ : Primrec (fun n : ℕ => 2 * n + 1) :=
   nat_double |> Primrec.succ.comp
 #align primrec.nat_bit1 Primrec.nat_double_succ
 
--- porting note: this is no longer used
+-- Porting note: this is no longer used
 -- theorem nat_div_mod : Primrec₂ fun n k : ℕ => (n / k, n % k) := pair nat_div nat_mod
 #noalign primrec.nat_div_mod
 
@@ -1189,7 +1189,7 @@ instance finArrow {n} : Primcodable (Fin n → α) :=
   ofEquiv _ (Equiv.vectorEquivFin _ _).symm
 #align primcodable.fin_arrow Primcodable.finArrow
 
--- porting note: Equiv.arrayEquivFin is not ported yet
+-- Porting note: Equiv.arrayEquivFin is not ported yet
 -- instance array {n} : Primcodable (Array' n α) :=
 --   ofEquiv _ (Equiv.arrayEquivFin _ _)
 -- #align primcodable.array Primcodable.array
chore: prepare Lean version bump with explicit simp (#10999)

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

Diff
@@ -909,7 +909,7 @@ private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ
     refine hF.of_eq fun a => ?_
     rw [this, List.take_all_of_le (length_le_encode _)]
   introv
-  dsimp only
+  dsimp only [F]
   generalize f a = l
   generalize g a = x
   induction' n with n IH generalizing l x
@@ -1059,7 +1059,7 @@ theorem list_rec {f : α → List β} {g : α → σ} {h : α → β × List β
       to₂ <| pair ((list_cons.comp fst (fst.comp snd)).comp snd) hh
   (snd.comp this).of_eq fun a => by
     suffices F a = (f a, List.recOn (f a) (g a) fun b l IH => h a (b, l, IH)) by rw [this]
-    dsimp
+    dsimp [F]
     induction' f a with b l IH <;> simp [*]
 #align primrec.list_rec Primrec.list_rec
 
@@ -1081,7 +1081,7 @@ theorem list_get? : Primrec₂ (@List.get? α) :=
     dsimp; symm
     induction' l with a l IH generalizing n; · rfl
     cases' n with n
-    · dsimp
+    · dsimp [F]
       clear IH
       induction' l with _ l IH <;> simp [*]
     · apply IH
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
@@ -411,6 +411,8 @@ variable {α : Type*} {β : Type*} {σ : Type*}
 
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
+theorem mk {f : α → β → σ} (hf : Primrec fun p : α × β => f p.1 p.2) : Primrec₂ f := hf
+
 theorem of_eq {f g : α → β → σ} (hg : Primrec₂ f) (H : ∀ a b, f a b = g a b) : Primrec₂ g :=
   (by funext a b; apply H : f = g) ▸ hg
 #align primrec₂.of_eq Primrec₂.of_eq
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
@@ -971,9 +971,9 @@ instance list : Primcodable (List α) :=
         intro n IH; simp
         cases' @decode α _ n.unpair.1 with a; · rfl
         simp only [decode_eq_ofNat, Option.some.injEq, Option.some_bind, Option.map_some']
-        suffices : ∀ (o : Option (List ℕ)) (p), encode o = encode p →
-          encode (Option.map (List.cons (encode a)) o) = encode (Option.map (List.cons a) p)
-        exact this _ _ (IH _ (Nat.unpair_right_le n))
+        suffices ∀ (o : Option (List ℕ)) (p), encode o = encode p →
+            encode (Option.map (List.cons (encode a)) o) = encode (Option.map (List.cons a) p) from
+          this _ _ (IH _ (Nat.unpair_right_le n))
         intro o p IH
         cases o <;> cases p
         · rfl
@@ -1454,9 +1454,10 @@ theorem add : @Primrec' 2 fun v => v.head + v.tail.head :=
 #align nat.primrec'.add Nat.Primrec'.add
 
 theorem sub : @Primrec' 2 fun v => v.head - v.tail.head := by
-  suffices; simpa using comp₂ (fun a b => b - a) this (tail head) head
-  refine' (prec head (pred.comp₁ _ (tail head))).of_eq fun v => _
-  simp; induction v.head <;> simp [*, Nat.sub_succ]
+  have : @Primrec' 2 fun v ↦ (fun a b ↦ b - a) v.head v.tail.head := by
+    refine' (prec head (pred.comp₁ _ (tail head))).of_eq fun v => _
+    simp; induction v.head <;> simp [*, Nat.sub_succ]
+  simpa using comp₂ (fun a b => b - a) this (tail head) head
 #align nat.primrec'.sub Nat.Primrec'.sub
 
 theorem mul : @Primrec' 2 fun v => v.head * v.tail.head :=
@@ -1484,8 +1485,9 @@ protected theorem encode : ∀ {n}, @Primrec' n encode
 #align nat.primrec'.encode Nat.Primrec'.encode
 
 theorem sqrt : @Primrec' 1 fun v => v.head.sqrt := by
-  suffices H : ∀ n : ℕ, n.sqrt = n.rec 0 fun x y => if x.succ < y.succ * y.succ then y else y.succ
-  · simp [H]
+  suffices H : ∀ n : ℕ, n.sqrt =
+      n.rec 0 fun x y => if x.succ < y.succ * y.succ then y else y.succ by
+    simp [H]
     have :=
       @prec' 1 _ _
         (fun v => by
chore(*): drop $/<| before fun (#9361)

Subset of #9319

Diff
@@ -112,7 +112,7 @@ theorem casesOn1 {f} (m : ℕ) (hf : Nat.Primrec f) : Nat.Primrec (Nat.casesOn 
 -- Porting note: `Nat.Primrec.casesOn` is already declared as a recursor.
 theorem casesOn' {f g} (hf : Nat.Primrec f) (hg : Nat.Primrec g) :
     Nat.Primrec (unpaired fun z n => n.casesOn (f z) fun y => g <| Nat.pair z y) :=
-  (prec hf (hg.comp (pair left (left.comp right)))).of_eq <| fun n => by simp
+  (prec hf (hg.comp (pair left (left.comp right)))).of_eq fun n => by simp
 #align nat.primrec.cases Nat.Primrec.casesOn'
 
 protected theorem swap : Nat.Primrec (unpaired (swap Nat.pair)) :=
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
@@ -1377,12 +1377,12 @@ namespace Nat.Primrec'
 open Vector Primrec
 
 theorem to_prim {n f} (pf : @Nat.Primrec' n f) : Primrec f := by
-  induction pf
-  case zero => exact .const 0
-  case succ => exact _root_.Primrec.succ.comp .vector_head
-  case get n i => exact Primrec.vector_get.comp .id (.const i)
-  case comp m n f g _ _ hf hg => exact hf.comp (.vector_ofFn fun i => hg i)
-  case prec n f g _ _ hf hg =>
+  induction pf with
+  | zero => exact .const 0
+  | succ => exact _root_.Primrec.succ.comp .vector_head
+  | get i => exact Primrec.vector_get.comp .id (.const i)
+  | comp _ _ _ hf hg => exact hf.comp (.vector_ofFn fun i => hg i)
+  | @prec n f g _ _ hf hg =>
     exact
       .nat_rec' .vector_head (hf.comp Primrec.vector_tail)
         (hg.comp <|
@@ -1525,14 +1525,14 @@ theorem of_prim {n f} : Primrec f → @Primrec' n f :=
             Primrec'.encode).of_eq
       fun i => by simp [encodek]
   fun f hf => by
-  induction hf
-  case zero => exact const 0
-  case succ => exact succ
-  case left => exact unpair₁ head
-  case right => exact unpair₂ head
-  case pair f g _ _ hf hg => exact natPair.comp₂ _ hf hg
-  case comp f g _ _ hf hg => exact hf.comp₁ _ hg
-  case prec f g _ _ hf hg =>
+  induction hf with
+  | zero => exact const 0
+  | succ => exact succ
+  | left => exact unpair₁ head
+  | right => exact unpair₂ head
+  | pair _ _ hf hg => exact natPair.comp₂ _ hf hg
+  | comp _ _ hf hg => exact hf.comp₁ _ hg
+  | prec _ _ hf hg =>
     simpa using
       prec' (unpair₂ head) (hf.comp₁ _ (unpair₁ head))
         (hg.comp₁ _ <|
chore(*): use ∀ s ⊆ t, _ etc (#9276)

Changes in this PR shouldn't change the public API. The only changes about ∃ x ∈ s, _ is inside a proof.

Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Diff
@@ -971,9 +971,8 @@ instance list : Primcodable (List α) :=
         intro n IH; simp
         cases' @decode α _ n.unpair.1 with a; · rfl
         simp only [decode_eq_ofNat, Option.some.injEq, Option.some_bind, Option.map_some']
-        suffices :
-          ∀ (o : Option (List ℕ)) (p) (_ : encode o = encode p),
-            encode (Option.map (List.cons (encode a)) o) = encode (Option.map (List.cons a) p)
+        suffices : ∀ (o : Option (List ℕ)) (p), encode o = encode p →
+          encode (Option.map (List.cons (encode a)) o) = encode (Option.map (List.cons a) p)
         exact this _ _ (IH _ (Nat.unpair_right_le n))
         intro o p IH
         cases o <;> cases p
chore: update Std dependency to match leanprover/std4#397 (#9039)

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

Diff
@@ -776,7 +776,7 @@ theorem list_findIdx₁ {p : α → β → Bool} (hp : Primrec₂ p) :
 #align primrec.list_find_index₁ Primrec.list_findIdx₁
 
 theorem list_indexOf₁ [DecidableEq α] (l : List α) : Primrec fun a => l.indexOf a :=
-  list_findIdx₁ .beq l
+  list_findIdx₁ (.swap .beq) l
 #align primrec.list_index_of₁ Primrec.list_indexOf₁
 
 theorem dom_fintype [Fintype α] (f : α → σ) : Primrec f :=
@@ -1134,7 +1134,7 @@ theorem list_findIdx {f : α → List β} {p : α → β → Bool}
 #align primrec.list_find_index Primrec.list_findIdx
 
 theorem list_indexOf [DecidableEq α] : Primrec₂ (@List.indexOf α _) :=
-  to₂ <| list_findIdx snd <| Primrec.beq.comp₂ (fst.comp fst).to₂ snd.to₂
+  to₂ <| list_findIdx snd <| Primrec.beq.comp₂ snd.to₂ (fst.comp fst).to₂
 #align primrec.list_index_of Primrec.list_indexOfₓ
 
 theorem nat_strong_rec (f : α → ℕ → σ) {g : α → List σ → Option σ} (hg : Primrec₂ g)
chore: bump to v4.3.0-rc2 (#8366)

PR contents

This is the supremum of

along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.

Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.

I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.

Lean PRs involved in this bump

In particular this includes adjustments for the Lean PRs

leanprover/lean4#2778

We can get rid of all the

local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)

macros across Mathlib (and in any projects that want to write natural number powers of reals).

leanprover/lean4#2722

Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).

leanprover/lean4#2783

This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:

  • switching to using explicit lemmas that have the intended level of application
  • (config := { unfoldPartialApp := true }) in some places, to recover the old behaviour
  • Using @[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.

This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!

Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>

Diff
@@ -837,7 +837,7 @@ theorem nat_mod : Primrec₂ ((· % ·) : ℕ → ℕ → ℕ) :=
 
 theorem nat_bodd : Primrec Nat.bodd :=
   (Primrec.beq.comp (nat_mod.comp .id (const 2)) (const 1)).of_eq fun n => by
-    cases H : n.bodd <;> simp [Nat.mod_two_of_bodd, H]
+    cases H : n.bodd <;> simp [Nat.mod_two_of_bodd, H]; rfl
 #align primrec.nat_bodd Primrec.nat_bodd
 
 theorem nat_div2 : Primrec Nat.div2 :=
chore: remove nonterminal simp (#7580)

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

Diff
@@ -324,7 +324,7 @@ instance prod {α β} [Primcodable α] [Primcodable β] : Primcodable (α × β)
   ⟨((casesOn' zero ((casesOn' zero .succ).comp (pair right ((@Primcodable.prim β).comp left)))).comp
           (pair right ((@Primcodable.prim α).comp left))).of_eq
       fun n => by
-      simp [Nat.unpaired]
+      simp only [Nat.unpaired, Nat.unpair_pair, decode_prod_val]
       cases @decode α _ n.unpair.1; · simp
       cases @decode β _ n.unpair.2 <;> simp⟩
 #align primcodable.prod Primcodable.prod
@@ -571,7 +571,7 @@ theorem nat_rec {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f) (
       simp only [Nat.unpaired, id_eq, Nat.unpair_pair, decode_prod_val, decode_nat,
         Option.some_bind, Option.map_map, Option.map_some']
       cases' @decode α _ n.unpair.1 with a; · rfl
-      simp [encodek]
+      simp only [encode_some, encodek, Option.map_some', Option.some_bind, Option.map_map]
       induction' n.unpair.2 with m <;> simp [encodek]
       simp [*, encodek]
 #align primrec.nat_elim Primrec.nat_rec
@@ -948,7 +948,7 @@ instance sum : Primcodable (Sum α β) :=
                 to₂ <| nat_double.comp (Primrec.encode.comp snd)))).of_eq
         fun n =>
         show _ = encode (decodeSum n) by
-          simp [decodeSum]
+          simp only [decodeSum, Nat.boddDiv2_eq]
           cases Nat.bodd n <;> simp [decodeSum]
           · cases @decode α _ n.div2 <;> rfl
           · cases @decode β _ n.div2 <;> rfl⟩
chore: fix nonterminal simps (#7497)

Fixes the nonterminal simps identified by #7496

Diff
@@ -343,7 +343,7 @@ theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β
               (pair right ((@Primcodable.prim β).comp left)))).comp
         (pair right ((@Primcodable.prim α).comp left))).of_eq
     fun n => by
-    simp
+    simp only [Nat.unpaired, Nat.unpair_pair, decode_prod_val]
     cases @decode α _ n.unpair.1 <;> simp
     cases @decode β _ n.unpair.2 <;> simp
 #align primrec.fst Primrec.fst
@@ -354,7 +354,7 @@ theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β
               (pair right ((@Primcodable.prim β).comp left)))).comp
         (pair right ((@Primcodable.prim α).comp left))).of_eq
     fun n => by
-    simp
+    simp only [Nat.unpaired, Nat.unpair_pair, decode_prod_val]
     cases @decode α _ n.unpair.1 <;> simp
     cases @decode β _ n.unpair.2 <;> simp
 #align primrec.snd Primrec.snd
@@ -568,7 +568,8 @@ theorem nat_rec {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f) (
                 Nat.Primrec.right.pair <| Nat.Primrec.right.comp Nat.Primrec.left).comp <|
           Nat.Primrec.id.pair <| (@Primcodable.prim α).comp Nat.Primrec.left).of_eq
       fun n => by
-      simp
+      simp only [Nat.unpaired, id_eq, Nat.unpair_pair, decode_prod_val, decode_nat,
+        Option.some_bind, Option.map_map, Option.map_some']
       cases' @decode α _ n.unpair.1 with a; · rfl
       simp [encodek]
       induction' n.unpair.2 with m <;> simp [encodek]
@@ -911,7 +912,7 @@ private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ
   generalize g a = x
   induction' n with n IH generalizing l x
   · rfl
-  simp
+  simp only [iterate_succ, comp_apply]
   cases' l with b l <;> simp [IH]
 
 private theorem list_cons' : (haveI := prim H; Primrec₂ (@List.cons β)) :=
chore: only four spaces for subsequent lines (#7286)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -768,7 +768,7 @@ protected theorem decode₂ : Primrec (decode₂ α) :=
 #align primrec.decode₂ Primrec.decode₂
 
 theorem list_findIdx₁ {p : α → β → Bool} (hp : Primrec₂ p) :
-  ∀ l : List β, Primrec fun a => l.findIdx (p a)
+    ∀ l : List β, Primrec fun a => l.findIdx (p a)
 | [] => const 0
 | a :: l => (cond (hp.comp .id (const a)) (const 0) (succ.comp (list_findIdx₁ hp l))).of_eq fun n =>
   by simp [List.findIdx_cons]
chore: avoid lean3 style have/suffices (#6964)

Many proofs use the "stream of consciousness" style from Lean 3, rather than have ... := or suffices ... from/by.

This PR updates a fraction of these to the preferred Lean 4 style.

I think a good goal would be to delete the "deferred" versions of have, suffices, and let at the bottom of Mathlib.Tactic.Have

(Anyone who would like to contribute more cleanup is welcome to push directly to this branch.)

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

Diff
@@ -902,8 +902,8 @@ private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ
     (fst.comp <|
       nat_iterate (encode_iff.2 hf) (pair hg hf) <|
       hG)
-  suffices : ∀ a n, F a n = (((f a).take n).foldl (fun s b => h a (s, b)) (g a), (f a).drop n)
-  · refine hF.of_eq fun a => ?_
+  suffices ∀ a n, F a n = (((f a).take n).foldl (fun s b => h a (s, b)) (g a), (f a).drop n) by
+    refine hF.of_eq fun a => ?_
     rw [this, List.take_all_of_le (length_le_encode _)]
   introv
   dsimp only
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -39,9 +39,9 @@ namespace Nat
 -- without having to then add all the other underscores
 
 -- /-- The non-dependent recursor on naturals. -/
--- def elim {C : Sort _} : C → (ℕ → C → C) → ℕ → C :=
+-- def elim {C : Sort*} : C → (ℕ → C → C) → ℕ → C :=
 --   @Nat.rec fun _ => C
--- example {C : Sort _} (base : C) (succ : ℕ → C → C) (a : ℕ) :
+-- example {C : Sort*} (base : C) (succ : ℕ → C → C) (a : ℕ) :
 --   a.elim base succ = a.rec base succ := rfl
 
 #align nat.elim Nat.rec
@@ -54,9 +54,9 @@ namespace Nat
 -- at inferring motive types (I think this is the reason)
 
 -- /-- Cases on whether the input is 0 or a successor. -/
--- def cases {C : Sort _} (a : C) (f : ℕ → C) : ℕ → C :=
+-- def cases {C : Sort*} (a : C) (f : ℕ → C) : ℕ → C :=
 --   Nat.elim a fun n _ => f n
--- example {C : Sort _} (a : C) (f : ℕ → C) (n : ℕ) :
+-- example {C : Sort*} (a : C) (f : ℕ → C) (n : ℕ) :
 --   n.cases a f = n.casesOn a f := rfl
 
 #align nat.cases Nat.casesOn
@@ -153,7 +153,7 @@ end Nat
 
 /-- A `Primcodable` type is an `Encodable` type for which
   the encode/decode functions are primitive recursive. -/
-class Primcodable (α : Type _) extends Encodable α where
+class Primcodable (α : Type*) extends Encodable α where
   -- porting note: was `prim [] `.
   -- This means that `prim` does not take the type explicitly in Lean 4
   prim : Nat.Primrec fun n => Encodable.encode (decode n)
@@ -184,7 +184,7 @@ instance unit : Primcodable PUnit :=
   ⟨(casesOn1 1 zero).of_eq fun n => by cases n <;> simp⟩
 #align primcodable.unit Primcodable.unit
 
-instance option {α : Type _} [h : Primcodable α] : Primcodable (Option α) :=
+instance option {α : Type*} [h : Primcodable α] : Primcodable (Option α) :=
   ⟨(casesOn1 1 ((casesOn1 0 (.comp .succ .succ)).comp (@Primcodable.prim α _))).of_eq fun n => by
     cases n with
       | zero => rfl
@@ -210,7 +210,7 @@ def Primrec {α β} [Primcodable α] [Primcodable β] (f : α → β) : Prop :=
 
 namespace Primrec
 
-variable {α : Type _} {β : Type _} {σ : Type _}
+variable {α : Type*} {β : Type*} {σ : Type*}
 
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
@@ -333,7 +333,7 @@ end Primcodable
 
 namespace Primrec
 
-variable {α : Type _} {σ : Type _} [Primcodable α] [Primcodable σ]
+variable {α : Type*} {σ : Type*} [Primcodable α] [Primcodable σ]
 
 open Nat.Primrec
 
@@ -407,7 +407,7 @@ def PrimrecRel {α β} [Primcodable α] [Primcodable β] (s : α → β → Prop
 
 namespace Primrec₂
 
-variable {α : Type _} {β : Type _} {σ : Type _}
+variable {α : Type*} {β : Type*} {σ : Type*}
 
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
@@ -467,7 +467,7 @@ end Primrec₂
 
 section Comp
 
-variable {α : Type _} {β : Type _} {γ : Type _} {δ : Type _} {σ : Type _}
+variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} {σ : Type*}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
@@ -517,7 +517,7 @@ theorem PrimrecRel.of_eq {α β} [Primcodable α] [Primcodable β] {r s : α →
 
 namespace Primrec₂
 
-variable {α : Type _} {β : Type _} {σ : Type _}
+variable {α : Type*} {β : Type*} {σ : Type*}
 
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
@@ -548,7 +548,7 @@ end Primrec₂
 
 namespace Primrec
 
-variable {α : Type _} {β : Type _} {γ : Type _} {δ : Type _} {σ : Type _}
+variable {α : Type*} {β : Type*} {γ : Type*} {δ : Type*} {σ : Type*}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable δ] [Primcodable σ]
 
@@ -865,7 +865,7 @@ end Primrec
 
 section
 
-variable {α : Type _} {β : Type _} {σ : Type _}
+variable {α : Type*} {β : Type*} {σ : Type*}
 
 variable [Primcodable α] [Primcodable β] [Primcodable σ]
 
@@ -931,7 +931,7 @@ end
 
 namespace Primcodable
 
-variable {α : Type _} {β : Type _}
+variable {α : Type*} {β : Type*}
 
 variable [Primcodable α] [Primcodable β]
 
@@ -986,7 +986,7 @@ end Primcodable
 
 namespace Primrec
 
-variable {α : Type _} {β : Type _} {γ : Type _} {σ : Type _}
+variable {α : Type*} {β : Type*} {γ : Type*} {σ : Type*}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable σ]
 
@@ -1158,7 +1158,7 @@ end Primrec
 
 namespace Primcodable
 
-variable {α : Type _} {β : Type _}
+variable {α : Type*} {β : Type*}
 
 variable [Primcodable α] [Primcodable β]
 
@@ -1216,7 +1216,7 @@ end Primcodable
 
 namespace Primrec
 
-variable {α : Type _} {β : Type _} {γ : Type _} {σ : Type _}
+variable {α : Type*} {β : Type*} {γ : Type*} {σ : Type*}
 
 variable [Primcodable α] [Primcodable β] [Primcodable γ] [Primcodable σ]
 
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,15 +2,12 @@
 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.primrec
-! leanprover-community/mathlib commit 2738d2ca56cbc63be80c3bd48e9ed90ad94e947d
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Logic.Equiv.List
 import Mathlib.Logic.Function.Iterate
 
+#align_import computability.primrec from "leanprover-community/mathlib"@"2738d2ca56cbc63be80c3bd48e9ed90ad94e947d"
+
 /-!
 # The primitive recursive functions
 
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -1499,7 +1499,7 @@ theorem sqrt : @Primrec' 1 fun v => v.head.sqrt := by
     have x1 : @Primrec' 3 fun v => v.head.succ := succ.comp₁ _ head
     have y1 : @Primrec' 3 fun v => v.tail.head.succ := succ.comp₁ _ (tail head)
     exact if_lt x1 (mul.comp₂ _ y1 y1) (tail head) y1
-  introv ; symm
+  introv; symm
   induction' n with n IH; · simp
   dsimp; rw [IH]; split_ifs with h
   · exact le_antisymm (Nat.sqrt_le_sqrt (Nat.le_succ _)) (Nat.lt_succ_iff.1 <| Nat.sqrt_lt.2 h)
fix precedence of Nat.iterate (#5589)
Diff
@@ -604,7 +604,7 @@ theorem nat_casesOn₁ {f : ℕ → α} (a : α) (hf : Primrec f) :
 #align primrec.nat_cases₁ Primrec.nat_casesOn₁
 
 theorem nat_iterate {f : α → ℕ} {g : α → β} {h : α → β → β} (hf : Primrec f) (hg : Primrec g)
-    (hh : Primrec₂ h) : Primrec fun a => (h a^[f a]) (g a) :=
+    (hh : Primrec₂ h) : Primrec fun a => (h a)^[f a] (g a) :=
   (nat_rec' hf hg (hh.comp₂ Primrec₂.left <| snd.comp₂ Primrec₂.right)).of_eq fun a => by
     induction f a <;> simp [*, -Function.iterate_succ, Function.iterate_succ']
 #align primrec.nat_iterate Primrec.nat_iterate
@@ -900,7 +900,7 @@ private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ
     to₂ <|
     pair (hh.comp (fst.comp fst) <| pair ((fst.comp snd).comp fst) (fst.comp snd))
       (snd.comp snd)
-  let F := fun (a : α) (n : ℕ) => (G a^[n]) (g a, f a)
+  let F := fun (a : α) (n : ℕ) => (G a)^[n] (g a, f a)
   have hF : Primrec fun a => (F a (encode (f a))).1 :=
     (fst.comp <|
       nat_iterate (encode_iff.2 hf) (pair hg hf) <|
chore: rename Ulower to ULower (#4430)

ref #4354

Diff
@@ -1195,7 +1195,7 @@ instance finArrow {n} : Primcodable (Fin n → α) :=
 --   ofEquiv _ (Equiv.arrayEquivFin _ _)
 -- #align primcodable.array Primcodable.array
 
-section Ulower
+section ULower
 
 attribute [local instance] Encodable.decidableRangeEncode Encodable.decidableEqOfEncodable
 
@@ -1209,11 +1209,11 @@ theorem mem_range_encode : PrimrecPred (fun n => n ∈ Set.range (encode : α 
         (.const _))
   this.of_eq fun _ => decode₂_ne_none_iff
 
-instance ulower : Primcodable (Ulower α) :=
+instance ulower : Primcodable (ULower α) :=
   Primcodable.subtype mem_range_encode
 #align primcodable.ulower Primcodable.ulower
 
-end Ulower
+end ULower
 
 end Primcodable
 
@@ -1256,13 +1256,13 @@ theorem option_get {f : α → Option β} {h : ∀ a, (f a).isSome} :
   cases x <;> simp
 #align primrec.option_get Primrec.option_get
 
-theorem ulower_down : Primrec (Ulower.down : α → Ulower α) :=
+theorem ulower_down : Primrec (ULower.down : α → ULower α) :=
   letI : ∀ a, Decidable (a ∈ Set.range (encode : α → ℕ)) := decidableRangeEncode _
   subtype_mk .encode
 
 #align primrec.ulower_down Primrec.ulower_down
 
-theorem ulower_up : Primrec (Ulower.up : Ulower α → α) :=
+theorem ulower_up : Primrec (ULower.up : ULower α → α) :=
   letI : ∀ a, Decidable (a ∈ Set.range (encode : α → ℕ)) := decidableRangeEncode _
   option_get (Primrec.decode₂.comp subtype_val)
 #align primrec.ulower_up Primrec.ulower_up
chore: fix upper/lowercase in comments (#4360)
  • Run a non-interactive version of fix-comments.py on all files.
  • Go through the diff and manually add/discard/edit chunks.
Diff
@@ -395,14 +395,14 @@ def Primrec₂ {α β σ} [Primcodable α] [Primcodable β] [Primcodable σ] (f
 
 /-- `PrimrecPred p` means `p : α → Prop` is a (decidable)
   primitive recursive predicate, which is to say that
-  `decide ∘ p : α → bool` is primitive recursive. -/
+  `decide ∘ p : α → Bool` is primitive recursive. -/
 def PrimrecPred {α} [Primcodable α] (p : α → Prop) [DecidablePred p] :=
   Primrec fun a => decide (p a)
 #align primrec_pred PrimrecPred
 
 /-- `PrimrecRel p` means `p : α → β → Prop` is a (decidable)
   primitive recursive relation, which is to say that
-  `decide ∘ p : α → β → bool` is primitive recursive. -/
+  `decide ∘ p : α → β → Bool` is primitive recursive. -/
 def PrimrecRel {α β} [Primcodable α] [Primcodable β] (s : α → β → Prop)
     [∀ a b, Decidable (s a b)] :=
   Primrec₂ fun a b => decide (s a b)
feat: port Computability.PartrecCode (#3833)

This PR also renames some decls in Computability.Primrec.

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

Diff
@@ -108,14 +108,15 @@ theorem prec1 {f} (m : ℕ) (hf : Nat.Primrec f) :
   ((prec (const m) (hf.comp right)).comp (zero.pair Primrec.id)).of_eq fun n => by simp
 #align nat.primrec.prec1 Nat.Primrec.prec1
 
-theorem cases1 {f} (m : ℕ) (hf : Nat.Primrec f) : Nat.Primrec (Nat.casesOn · m f) :=
+theorem casesOn1 {f} (m : ℕ) (hf : Nat.Primrec f) : Nat.Primrec (Nat.casesOn · m f) :=
   (prec1 m (hf.comp left)).of_eq <| by simp
-#align nat.primrec.cases1 Nat.Primrec.cases1
+#align nat.primrec.cases1 Nat.Primrec.casesOn1
 
-theorem cases {f g} (hf : Nat.Primrec f) (hg : Nat.Primrec g) :
+-- Porting note: `Nat.Primrec.casesOn` is already declared as a recursor.
+theorem casesOn' {f g} (hf : Nat.Primrec f) (hg : Nat.Primrec g) :
     Nat.Primrec (unpaired fun z n => n.casesOn (f z) fun y => g <| Nat.pair z y) :=
   (prec hf (hg.comp (pair left (left.comp right)))).of_eq <| fun n => by simp
-#align nat.primrec.cases Nat.Primrec.cases
+#align nat.primrec.cases Nat.Primrec.casesOn'
 
 protected theorem swap : Nat.Primrec (unpaired (swap Nat.pair)) :=
   (pair right left).of_eq fun n => by simp
@@ -126,7 +127,7 @@ theorem swap' {f} (hf : Nat.Primrec (unpaired f)) : Nat.Primrec (unpaired (swap
 #align nat.primrec.swap' Nat.Primrec.swap'
 
 theorem pred : Nat.Primrec pred :=
-  (cases1 0 Primrec.id).of_eq fun n => by cases n <;> simp [*]
+  (casesOn1 0 Primrec.id).of_eq fun n => by cases n <;> simp [*]
 #align nat.primrec.pred Nat.Primrec.pred
 
 theorem add : Nat.Primrec (unpaired (· + ·)) :=
@@ -183,11 +184,11 @@ instance empty : Primcodable Empty :=
 #align primcodable.empty Primcodable.empty
 
 instance unit : Primcodable PUnit :=
-  ⟨(cases1 1 zero).of_eq fun n => by cases n <;> simp⟩
+  ⟨(casesOn1 1 zero).of_eq fun n => by cases n <;> simp⟩
 #align primcodable.unit Primcodable.unit
 
 instance option {α : Type _} [h : Primcodable α] : Primcodable (Option α) :=
-  ⟨(cases1 1 ((cases1 0 (.comp .succ .succ)).comp (@Primcodable.prim α _))).of_eq fun n => by
+  ⟨(casesOn1 1 ((casesOn1 0 (.comp .succ .succ)).comp (@Primcodable.prim α _))).of_eq fun n => by
     cases n with
       | zero => rfl
       | succ n =>
@@ -196,7 +197,7 @@ instance option {α : Type _} [h : Primcodable α] : Primcodable (Option α) :=
 #align primcodable.option Primcodable.option
 
 instance bool : Primcodable Bool :=
-  ⟨(cases1 1 (cases1 2 zero)).of_eq fun n => match n with
+  ⟨(casesOn1 1 (casesOn1 2 zero)).of_eq fun n => match n with
     | 0 => rfl
     | 1 => rfl
     | (n + 2) => by rw [decode_ge_two] <;> simp⟩
@@ -241,7 +242,7 @@ theorem encdec : Primrec fun n => encode (@decode α _ n) :=
 #align primrec.encdec Primrec.encdec
 
 theorem option_some : Primrec (@some α) :=
-  ((cases1 0 (Nat.Primrec.succ.comp .succ)).comp (@Primcodable.prim α _)).of_eq fun n => by
+  ((casesOn1 0 (Nat.Primrec.succ.comp .succ)).comp (@Primcodable.prim α _)).of_eq fun n => by
     cases @decode α _ n <;> simp
 #align primrec.option_some Primrec.option_some
 
@@ -250,7 +251,7 @@ theorem of_eq {f g : α → σ} (hf : Primrec f) (H : ∀ n, f n = g n) : Primre
 #align primrec.of_eq Primrec.of_eq
 
 theorem const (x : σ) : Primrec fun _ : α => x :=
-  ((cases1 0 (.const (encode x).succ)).comp (@Primcodable.prim α _)).of_eq fun n => by
+  ((casesOn1 0 (.const (encode x).succ)).comp (@Primcodable.prim α _)).of_eq fun n => by
     cases @decode α _ n <;> rfl
 #align primrec.const Primrec.const
 
@@ -259,7 +260,7 @@ protected theorem id : Primrec (@id α) :=
 #align primrec.id Primrec.id
 
 theorem comp {f : β → σ} {g : α → β} (hf : Primrec f) (hg : Primrec g) : Primrec fun a => f (g a) :=
-  ((cases1 0 (.comp hf (pred.comp hg))).comp (@Primcodable.prim α _)).of_eq fun n => by
+  ((casesOn1 0 (.comp hf (pred.comp hg))).comp (@Primcodable.prim α _)).of_eq fun n => by
     cases @decode α _ n <;> simp [encodek]
 #align primrec.comp Primrec.comp
 
@@ -288,33 +289,33 @@ theorem option_some_iff {f : α → σ} : (Primrec fun a => some (f a)) ↔ Prim
   ⟨fun h => encode_iff.1 <| pred.comp <| encode_iff.2 h, option_some.comp⟩
 #align primrec.option_some_iff Primrec.option_some_iff
 
-theorem ofEquiv {β} {e : β ≃ α} :
+theorem of_equiv {β} {e : β ≃ α} :
     haveI := Primcodable.ofEquiv α e
     Primrec e :=
   letI : Primcodable β := Primcodable.ofEquiv α e
   encode_iff.1 Primrec.encode
-#align primrec.of_equiv Primrec.ofEquiv
+#align primrec.of_equiv Primrec.of_equiv
 
-theorem ofEquiv_symm {β} {e : β ≃ α} :
+theorem of_equiv_symm {β} {e : β ≃ α} :
     haveI := Primcodable.ofEquiv α e
     Primrec e.symm :=
   letI := Primcodable.ofEquiv α e
   encode_iff.1 (show Primrec fun a => encode (e (e.symm a)) by simp [Primrec.encode])
-#align primrec.of_equiv_symm Primrec.ofEquiv_symm
+#align primrec.of_equiv_symm Primrec.of_equiv_symm
 
-theorem ofEquiv_iff {β} (e : β ≃ α) {f : σ → β} :
+theorem of_equiv_iff {β} (e : β ≃ α) {f : σ → β} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e (f a)) ↔ Primrec f :=
   letI := Primcodable.ofEquiv α e
-  ⟨fun h => (ofEquiv_symm.comp h).of_eq fun a => by simp, ofEquiv.comp⟩
-#align primrec.of_equiv_iff Primrec.ofEquiv_iff
+  ⟨fun h => (of_equiv_symm.comp h).of_eq fun a => by simp, of_equiv.comp⟩
+#align primrec.of_equiv_iff Primrec.of_equiv_iff
 
-theorem ofEquiv_symm_iff {β} (e : β ≃ α) {f : σ → α} :
+theorem of_equiv_symm_iff {β} (e : β ≃ α) {f : σ → α} :
     haveI := Primcodable.ofEquiv α e
     (Primrec fun a => e.symm (f a)) ↔ Primrec f :=
   letI := Primcodable.ofEquiv α e
-  ⟨fun h => (ofEquiv.comp h).of_eq fun a => by simp, ofEquiv_symm.comp⟩
-#align primrec.of_equiv_symm_iff Primrec.ofEquiv_symm_iff
+  ⟨fun h => (of_equiv.comp h).of_eq fun a => by simp, of_equiv_symm.comp⟩
+#align primrec.of_equiv_symm_iff Primrec.of_equiv_symm_iff
 
 end Primrec
 
@@ -323,7 +324,7 @@ namespace Primcodable
 open Nat.Primrec
 
 instance prod {α β} [Primcodable α] [Primcodable β] : Primcodable (α × β) :=
-  ⟨((cases zero ((cases zero .succ).comp (pair right ((@Primcodable.prim β).comp left)))).comp
+  ⟨((casesOn' zero ((casesOn' zero .succ).comp (pair right ((@Primcodable.prim β).comp left)))).comp
           (pair right ((@Primcodable.prim α).comp left))).of_eq
       fun n => by
       simp [Nat.unpaired]
@@ -340,8 +341,8 @@ variable {α : Type _} {σ : Type _} [Primcodable α] [Primcodable σ]
 open Nat.Primrec
 
 theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β) :=
-  ((cases zero
-            ((cases zero (Nat.Primrec.succ.comp left)).comp
+  ((casesOn' zero
+            ((casesOn' zero (Nat.Primrec.succ.comp left)).comp
               (pair right ((@Primcodable.prim β).comp left)))).comp
         (pair right ((@Primcodable.prim α).comp left))).of_eq
     fun n => by
@@ -351,8 +352,8 @@ theorem fst {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.fst α β
 #align primrec.fst Primrec.fst
 
 theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β) :=
-  ((cases zero
-            ((cases zero (Nat.Primrec.succ.comp right)).comp
+  ((casesOn' zero
+            ((casesOn' zero (Nat.Primrec.succ.comp right)).comp
               (pair right ((@Primcodable.prim β).comp left)))).comp
         (pair right ((@Primcodable.prim α).comp left))).of_eq
     fun n => by
@@ -363,7 +364,7 @@ theorem snd {α β} [Primcodable α] [Primcodable β] : Primrec (@Prod.snd α β
 
 theorem pair {α β γ} [Primcodable α] [Primcodable β] [Primcodable γ] {f : α → β} {g : α → γ}
     (hf : Primrec f) (hg : Primrec g) : Primrec fun a => (f a, g a) :=
-  ((cases1 0
+  ((casesOn1 0
             (Nat.Primrec.succ.comp <|
               .pair (Nat.Primrec.pred.comp hf) (Nat.Primrec.pred.comp hg))).comp
         (@Primcodable.prim α _)).of_eq
@@ -378,7 +379,7 @@ theorem list_get?₁ : ∀ l : List α, Primrec l.get?
   | [] => dom_denumerable.2 zero
   | a :: l =>
     dom_denumerable.2 <|
-      (cases1 (encode a).succ <| dom_denumerable.1 <| list_get?₁ l).of_eq fun n => by
+      (casesOn1 (encode a).succ <| dom_denumerable.1 <| list_get?₁ l).of_eq fun n => by
         cases n <;> simp
 #align primrec.list_nth₁ Primrec.list_get?₁
 
@@ -558,10 +559,10 @@ theorem to₂ {f : α × β → σ} (hf : Primrec f) : Primrec₂ fun a b => f (
   hf.of_eq fun _ => rfl
 #align primrec.to₂ Primrec.to₂
 
-theorem nat_elim {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f) (hg : Primrec₂ g) :
+theorem nat_rec {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a (n : ℕ) => n.rec (motive := fun _ => β) (f a) fun n IH => g a (n, IH) :=
   Primrec₂.nat_iff.2 <|
-    ((Nat.Primrec.cases .zero <|
+    ((Nat.Primrec.casesOn' .zero <|
               (Nat.Primrec.prec hf <|
                     .comp hg <|
                       Nat.Primrec.left.pair <|
@@ -575,54 +576,54 @@ theorem nat_elim {f : α → β} {g : α → ℕ × β → β} (hf : Primrec f)
       simp [encodek]
       induction' n.unpair.2 with m <;> simp [encodek]
       simp [*, encodek]
-#align primrec.nat_elim Primrec.nat_elim
+#align primrec.nat_elim Primrec.nat_rec
 
-theorem nat_elim' {f : α → ℕ} {g : α → β} {h : α → ℕ × β → β}
+theorem nat_rec' {f : α → ℕ} {g : α → β} {h : α → ℕ × β → β}
     (hf : Primrec f) (hg : Primrec g) (hh : Primrec₂ h) :
     Primrec fun a => (f a).rec (motive := fun _ => β) (g a) fun n IH => h a (n, IH) :=
-  (nat_elim hg hh).comp .id hf
-#align primrec.nat_elim' Primrec.nat_elim'
+  (nat_rec hg hh).comp .id hf
+#align primrec.nat_elim' Primrec.nat_rec'
 
-theorem nat_elim₁ {f : ℕ → α → α} (a : α) (hf : Primrec₂ f) : Primrec (Nat.rec a f) :=
-  nat_elim' .id (const a) <| comp₂ hf Primrec₂.right
-#align primrec.nat_elim₁ Primrec.nat_elim₁
+theorem nat_rec₁ {f : ℕ → α → α} (a : α) (hf : Primrec₂ f) : Primrec (Nat.rec a f) :=
+  nat_rec' .id (const a) <| comp₂ hf Primrec₂.right
+#align primrec.nat_elim₁ Primrec.nat_rec₁
 
-theorem nat_cases' {f : α → β} {g : α → ℕ → β} (hf : Primrec f) (hg : Primrec₂ g) :
+theorem nat_casesOn' {f : α → β} {g : α → ℕ → β} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec₂ fun a (n : ℕ) => (n.casesOn (f a) (g a) : β) :=
-  nat_elim hf <| hg.comp₂ Primrec₂.left <| comp₂ fst Primrec₂.right
-#align primrec.nat_cases' Primrec.nat_cases'
+  nat_rec hf <| hg.comp₂ Primrec₂.left <| comp₂ fst Primrec₂.right
+#align primrec.nat_cases' Primrec.nat_casesOn'
 
-theorem nat_cases {f : α → ℕ} {g : α → β} {h : α → ℕ → β} (hf : Primrec f) (hg : Primrec g)
+theorem nat_casesOn {f : α → ℕ} {g : α → β} {h : α → ℕ → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => ((f a).casesOn (g a) (h a) : β) :=
-  (nat_cases' hg hh).comp .id hf
-#align primrec.nat_cases Primrec.nat_cases
+  (nat_casesOn' hg hh).comp .id hf
+#align primrec.nat_cases Primrec.nat_casesOn
 
-theorem nat_cases₁ {f : ℕ → α} (a : α) (hf : Primrec f) :
+theorem nat_casesOn₁ {f : ℕ → α} (a : α) (hf : Primrec f) :
     Primrec (fun (n : ℕ) => (n.casesOn a f : α)) :=
-  nat_cases .id (const a) (comp₂ hf .right)
-#align primrec.nat_cases₁ Primrec.nat_cases₁
+  nat_casesOn .id (const a) (comp₂ hf .right)
+#align primrec.nat_cases₁ Primrec.nat_casesOn₁
 
 theorem nat_iterate {f : α → ℕ} {g : α → β} {h : α → β → β} (hf : Primrec f) (hg : Primrec g)
     (hh : Primrec₂ h) : Primrec fun a => (h a^[f a]) (g a) :=
-  (nat_elim' hf hg (hh.comp₂ Primrec₂.left <| snd.comp₂ Primrec₂.right)).of_eq fun a => by
+  (nat_rec' hf hg (hh.comp₂ Primrec₂.left <| snd.comp₂ Primrec₂.right)).of_eq fun a => by
     induction f a <;> simp [*, -Function.iterate_succ, Function.iterate_succ']
 #align primrec.nat_iterate Primrec.nat_iterate
 
-theorem option_cases {o : α → Option β} {f : α → σ} {g : α → β → σ} (ho : Primrec o)
+theorem option_casesOn {o : α → Option β} {f : α → σ} {g : α → β → σ} (ho : Primrec o)
     (hf : Primrec f) (hg : Primrec₂ g) :
     @Primrec _ σ _ _ fun a => Option.casesOn (o a) (f a) (g a) :=
   encode_iff.1 <|
-    (nat_cases (encode_iff.2 ho) (encode_iff.2 hf) <|
+    (nat_casesOn (encode_iff.2 ho) (encode_iff.2 hf) <|
           pred.comp₂ <|
             Primrec₂.encode_iff.2 <|
               (Primrec₂.nat_iff'.1 hg).comp₂ ((@Primrec.encode α _).comp fst).to₂
                 Primrec₂.right).of_eq
       fun a => by cases' o a with b <;> simp [encodek]
-#align primrec.option_cases Primrec.option_cases
+#align primrec.option_cases Primrec.option_casesOn
 
 theorem option_bind {f : α → Option β} {g : α → β → Option σ} (hf : Primrec f) (hg : Primrec₂ g) :
     Primrec fun a => (f a).bind (g a) :=
-  (option_cases hf (const none) hg).of_eq fun a => by cases f a <;> rfl
+  (option_casesOn hf (const none) hg).of_eq fun a => by cases f a <;> rfl
 #align primrec.option_bind Primrec.option_bind
 
 theorem option_bind₁ {f : α → Option σ} (hf : Primrec f) : Primrec fun o => Option.bind o f :=
@@ -639,15 +640,15 @@ theorem option_map₁ {f : α → σ} (hf : Primrec f) : Primrec (Option.map f)
 #align primrec.option_map₁ Primrec.option_map₁
 
 theorem option_iget [Inhabited α] : Primrec (@Option.iget α _) :=
-  (option_cases .id (const <| @default α _) .right).of_eq fun o => by cases o <;> rfl
+  (option_casesOn .id (const <| @default α _) .right).of_eq fun o => by cases o <;> rfl
 #align primrec.option_iget Primrec.option_iget
 
 theorem option_isSome : Primrec (@Option.isSome α) :=
-  (option_cases .id (const false) (const true).to₂).of_eq fun o => by cases o <;> rfl
+  (option_casesOn .id (const false) (const true).to₂).of_eq fun o => by cases o <;> rfl
 #align primrec.option_is_some Primrec.option_isSome
 
 theorem option_getD : Primrec₂ (@Option.getD α) :=
-  Primrec.of_eq (option_cases Primrec₂.left Primrec₂.right .right) fun ⟨o, a⟩ => by
+  Primrec.of_eq (option_casesOn Primrec₂.left Primrec₂.right .right) fun ⟨o, a⟩ => by
     cases o <;> rfl
 #align primrec.option_get_or_else Primrec.option_getD
 
@@ -678,7 +679,7 @@ theorem nat_mul : Primrec₂ ((· * ·) : ℕ → ℕ → ℕ) :=
 
 theorem cond {c : α → Bool} {f : α → σ} {g : α → σ} (hc : Primrec c) (hf : Primrec f)
     (hg : Primrec g) : Primrec fun a => bif (c a) then (f a) else (g a) :=
-  (nat_cases (encode_iff.2 hc) hg (hf.comp fst).to₂).of_eq fun a => by cases c a <;> rfl
+  (nat_casesOn (encode_iff.2 hc) hg (hf.comp fst).to₂).of_eq fun a => by cases c a <;> rfl
 #align primrec.cond Primrec.cond
 
 theorem ite {c : α → Prop} [DecidablePred c] {f : α → σ} {g : α → σ} (hc : PrimrecPred c)
@@ -687,7 +688,7 @@ theorem ite {c : α → Prop} [DecidablePred c] {f : α → σ} {g : α → σ}
 #align primrec.ite Primrec.ite
 
 theorem nat_le : PrimrecRel ((· ≤ ·) : ℕ → ℕ → Prop) :=
-  (nat_cases nat_sub (const true) (const false).to₂).of_eq fun p => by
+  (nat_casesOn nat_sub (const true) (const false).to₂).of_eq fun p => by
     dsimp [swap]
     cases' e : p.1 - p.2 with n
     · simp [tsub_eq_zero_iff_le.1 e]
@@ -761,7 +762,7 @@ theorem option_guard {p : α → β → Prop} [∀ a b, Decidable (p a b)] (hp :
 #align primrec.option_guard Primrec.option_guard
 
 theorem option_orElse : Primrec₂ ((· <|> ·) : Option α → Option α → Option α) :=
-  (option_cases fst snd (fst.comp fst).to₂).of_eq fun ⟨o₁, o₂⟩ => by cases o₁ <;> cases o₂ <;> rfl
+  (option_casesOn fst snd (fst.comp fst).to₂).of_eq fun ⟨o₁, o₂⟩ => by cases o₁ <;> cases o₂ <;> rfl
 #align primrec.option_orelse Primrec.option_orElse
 
 protected theorem decode₂ : Primrec (decode₂ α) :=
@@ -797,7 +798,7 @@ def PrimrecBounded (f : α → β) : Prop :=
 
 theorem nat_findGreatest {f : α → ℕ} {p : α → ℕ → Prop} [∀ x n, Decidable (p x n)]
     (hf : Primrec f) (hp : PrimrecRel p) : Primrec fun x => (f x).findGreatest (p x) :=
-  (nat_elim' (h := fun x nih => if p x (nih.1 + 1) then nih.1 + 1 else nih.2)
+  (nat_rec' (h := fun x nih => if p x (nih.1 + 1) then nih.1 + 1 else nih.2)
     hf (const 0) (ite (hp.comp fst (snd |> fst.comp |> succ.comp))
       (snd |> fst.comp |> succ.comp) (snd.comp snd))).of_eq fun x => by
         induction f x <;> simp [Nat.findGreatest, *]
@@ -877,7 +878,7 @@ open Primrec
 
 private def prim : Primcodable (List β) := ⟨H⟩
 
-private theorem list_cases' {f : α → List β} {g : α → σ} {h : α → β × List β → σ}
+private theorem list_casesOn' {f : α → List β} {g : α → σ} {h : α → β × List β → σ}
     (hf : haveI := prim H; Primrec f) (hg : Primrec g) (hh : haveI := prim H; Primrec₂ h) :
     @Primrec _ σ _ _ fun a => List.casesOn (f a) (g a) fun b l => h a (b, l) :=
   letI := prim H
@@ -885,8 +886,8 @@ private theorem list_cases' {f : α → List β} {g : α → σ} {h : α → β
     @Primrec _ (Option σ) _ _ fun a =>
       (@decode (Option (β × List β)) _ (encode (f a))).map fun o => Option.casesOn o (g a) (h a) :=
     ((@map_decode_iff _ (Option (β × List β)) _ _ _ _ _).2 <|
-          to₂ <|
-            option_cases snd (hg.comp fst) (hh.comp₂ (fst.comp₂ Primrec₂.left) Primrec₂.right)).comp
+      to₂ <|
+        option_casesOn snd (hg.comp fst) (hh.comp₂ (fst.comp₂ Primrec₂.left) Primrec₂.right)).comp
       .id (encode_iff.2 hf)
   option_some_iff.1 <| this.of_eq fun a => by cases' f a with b l <;> simp [encodek]
 
@@ -895,7 +896,7 @@ private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ
     Primrec fun a => (f a).foldl (fun s b => h a (s, b)) (g a) := by
   letI := prim H
   let G (a : α) (IH : σ × List β) : σ × List β := List.casesOn IH.2 IH fun b l => (h a (IH.1, b), l)
-  have hG : Primrec₂ G := list_cases' H (snd.comp snd) snd <|
+  have hG : Primrec₂ G := list_casesOn' H (snd.comp snd) snd <|
     to₂ <|
     pair (hh.comp (fst.comp fst) <| pair ((fst.comp snd).comp fst) (fst.comp snd))
       (snd.comp snd)
@@ -1000,25 +1001,25 @@ theorem sum_inr : Primrec (@Sum.inr α β) :=
   encode_iff.1 <| nat_double_succ.comp Primrec.encode
 #align primrec.sum_inr Primrec.sum_inr
 
-theorem sum_cases {f : α → Sum β γ} {g : α → β → σ} {h : α → γ → σ} (hf : Primrec f)
+theorem sum_casesOn {f : α → Sum β γ} {g : α → β → σ} {h : α → γ → σ} (hf : Primrec f)
     (hg : Primrec₂ g) (hh : Primrec₂ h) : @Primrec _ σ _ _ fun a => Sum.casesOn (f a) (g a) (h a) :=
   option_some_iff.1 <|
     (cond (nat_bodd.comp <| encode_iff.2 hf)
           (option_map (Primrec.decode.comp <| nat_div2.comp <| encode_iff.2 hf) hh)
           (option_map (Primrec.decode.comp <| nat_div2.comp <| encode_iff.2 hf) hg)).of_eq
       fun a => by cases' f a with b c <;> simp [Nat.div2_val, encodek]
-#align primrec.sum_cases Primrec.sum_cases
+#align primrec.sum_cases Primrec.sum_casesOn
 
 theorem list_cons : Primrec₂ (@List.cons α) :=
   list_cons' Primcodable.prim
 #align primrec.list_cons Primrec.list_cons
 
-theorem list_cases {f : α → List β} {g : α → σ} {h : α → β × List β → σ} :
+theorem list_casesOn {f : α → List β} {g : α → σ} {h : α → β × List β → σ} :
     Primrec f →
       Primrec g →
         Primrec₂ h → @Primrec _ σ _ _ fun a => List.casesOn (f a) (g a) fun b l => h a (b, l) :=
-  list_cases' Primcodable.prim
-#align primrec.list_cases Primrec.list_cases
+  list_casesOn' Primcodable.prim
+#align primrec.list_cases Primrec.list_casesOn
 
 theorem list_foldl {f : α → List β} {g : α → σ} {h : α → σ × β → σ} :
     Primrec f →
@@ -1038,7 +1039,7 @@ theorem list_foldr {f : α → List β} {g : α → σ} {h : α → β × σ →
 #align primrec.list_foldr Primrec.list_foldr
 
 theorem list_head? : Primrec (@List.head? α) :=
-  (list_cases .id (const none) (option_some_iff.2 <| fst.comp snd).to₂).of_eq fun l => by
+  (list_casesOn .id (const none) (option_some_iff.2 <| fst.comp snd).to₂).of_eq fun l => by
     cases l <;> rfl
 #align primrec.list_head' Primrec.list_head?
 
@@ -1047,7 +1048,7 @@ theorem list_headI [Inhabited α] : Primrec (@List.headI α _) :=
 #align primrec.list_head Primrec.list_headI
 
 theorem list_tail : Primrec (@List.tail α) :=
-  (list_cases .id (const []) (snd.comp snd).to₂).of_eq fun l => by cases l <;> rfl
+  (list_casesOn .id (const []) (snd.comp snd).to₂).of_eq fun l => by cases l <;> rfl
 #align primrec.list_tail Primrec.list_tail
 
 theorem list_rec {f : α → List β} {g : α → σ} {h : α → β × List β × σ → σ} (hf : Primrec f)
@@ -1071,12 +1072,12 @@ theorem list_get? : Primrec₂ (@List.get? α) :=
       (Sum.inl n)
   have hF : Primrec₂ F :=
     (list_foldl fst (sum_inl.comp snd)
-      ((sum_cases fst (nat_cases snd (sum_inr.comp <| snd.comp fst) (sum_inl.comp snd).to₂).to₂
+      ((sum_casesOn fst (nat_casesOn snd (sum_inr.comp <| snd.comp fst) (sum_inl.comp snd).to₂).to₂
               (sum_inr.comp snd).to₂).comp
           snd).to₂).to₂
   have :
     @Primrec _ (Option α) _ _ fun p : List α × ℕ => Sum.casesOn (F p.1 p.2) (fun _ => none) some :=
-    sum_cases hF (const none).to₂ (option_some.comp snd).to₂
+    sum_casesOn hF (const none).to₂ (option_some.comp snd).to₂
   this.to₂.of_eq fun l n => by
     dsimp; symm
     induction' l with a l IH generalizing n; · rfl
@@ -1113,7 +1114,7 @@ theorem list_map {f : α → List β} {g : α → β → σ} (hf : Primrec f) (h
 #align primrec.list_map Primrec.list_map
 
 theorem list_range : Primrec List.range :=
-  (nat_elim' .id (const []) ((list_concat.comp snd fst).comp snd).to₂).of_eq fun n => by
+  (nat_rec' .id (const []) ((list_concat.comp snd fst).comp snd).to₂).of_eq fun n => by
     simp; induction n <;> simp [*, List.range_succ]
 #align primrec.list_range Primrec.list_range
 
@@ -1145,7 +1146,7 @@ theorem nat_strong_rec (f : α → ℕ → σ) {g : α → List σ → Option σ
       (list_get?.comp (this.comp fst (succ.comp snd)) snd).to₂.of_eq fun a n => by
         simp [List.get?_range (Nat.lt_succ_self n)]
   Primrec₂.option_some_iff.1 <|
-    (nat_elim (const (some []))
+    (nat_rec (const (some []))
           (to₂ <|
             option_bind (snd.comp snd) <|
               to₂ <|
@@ -1268,7 +1269,7 @@ theorem ulower_up : Primrec (Ulower.up : Ulower α → α) :=
 
 theorem fin_val_iff {n} {f : α → Fin n} : (Primrec fun a => (f a).1) ↔ Primrec f := by
   letI : Primcodable { a // id a < n } := Primcodable.subtype (nat_lt.comp .id (const _))
-  exact (Iff.trans (by rfl) subtype_val_iff).trans (ofEquiv_iff _)
+  exact (Iff.trans (by rfl) subtype_val_iff).trans (of_equiv_iff _)
 
 #align primrec.fin_val_iff Primrec.fin_val_iff
 
@@ -1324,16 +1325,16 @@ theorem vector_ofFn {n} {f : Fin n → α → σ} (hf : ∀ i, Primrec (f i)) :
   vector_toList_iff.1 <| by simp [list_ofFn hf]
 #align primrec.vector_of_fn Primrec.vector_ofFn
 
-theorem vector_nth' {n} : Primrec (@Vector.get α n) :=
-  ofEquiv_symm
-#align primrec.vector_nth' Primrec.vector_nth'
+theorem vector_get' {n} : Primrec (@Vector.get α n) :=
+  of_equiv_symm
+#align primrec.vector_nth' Primrec.vector_get'
 
-theorem vector_of_fn' {n} : Primrec (@Vector.ofFn α n) :=
-  ofEquiv
-#align primrec.vector_of_fn' Primrec.vector_of_fn'
+theorem vector_ofFn' {n} : Primrec (@Vector.ofFn α n) :=
+  of_equiv
+#align primrec.vector_of_fn' Primrec.vector_ofFn'
 
 theorem fin_app {n} : Primrec₂ (@id (Fin n → σ)) :=
-  (vector_get.comp (vector_of_fn'.comp fst) snd).of_eq fun ⟨v, i⟩ => by simp
+  (vector_get.comp (vector_ofFn'.comp fst) snd).of_eq fun ⟨v, i⟩ => by simp
 #align primrec.fin_app Primrec.fin_app
 
 theorem fin_curry₁ {n} {f : Fin n → α → σ} : Primrec₂ f ↔ ∀ i, Primrec (f i) :=
@@ -1343,7 +1344,7 @@ theorem fin_curry₁ {n} {f : Fin n → α → σ} : Primrec₂ f ↔ ∀ i, Pri
 
 theorem fin_curry {n} {f : α → Fin n → σ} : Primrec f ↔ Primrec₂ f :=
   ⟨fun h => fin_app.comp (h.comp fst) snd, fun h =>
-    (vector_nth'.comp
+    (vector_get'.comp
           (vector_ofFn fun i => show Primrec fun a => f a i from h.comp .id (const i))).of_eq
       fun a => by funext i; simp⟩
 #align primrec.fin_curry Primrec.fin_curry
@@ -1386,7 +1387,7 @@ theorem to_prim {n f} (pf : @Nat.Primrec' n f) : Primrec f := by
   case comp m n f g _ _ hf hg => exact hf.comp (.vector_ofFn fun i => hg i)
   case prec n f g _ _ hf hg =>
     exact
-      .nat_elim' .vector_head (hf.comp Primrec.vector_tail)
+      .nat_rec' .vector_head (hf.comp Primrec.vector_tail)
         (hg.comp <|
           Primrec.vector_cons.comp (Primrec.fst.comp .snd) <|
           Primrec.vector_cons.comp (Primrec.snd.comp .snd) <|
chore: bye-bye, solo bys! (#3825)

This PR puts, with one exception, every single remaining by that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh. The exception is when the by begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.

Essentially this is s/\n *by$/ by/g, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated bys".

Diff
@@ -529,11 +529,8 @@ theorem swap {f : α → β → σ} (h : Primrec₂ f) : Primrec₂ (swap f) :=
   h.comp₂ Primrec₂.right Primrec₂.left
 #align primrec₂.swap Primrec₂.swap
 
-theorem nat_iff {f : α → β → σ} :
-    Primrec₂ f ↔
-      Nat.Primrec
-        (.unpaired fun m n => encode <| (@decode α _ m).bind fun a => (@decode β _ n).map (f a)) :=
-  by
+theorem nat_iff {f : α → β → σ} : Primrec₂ f ↔ Nat.Primrec
+    (.unpaired fun m n => encode <| (@decode α _ m).bind fun a => (@decode β _ n).map (f a)) := by
   have :
     ∀ (a : Option α) (b : Option β),
       Option.map (fun p : α × β => f p.1 p.2)
@@ -1471,8 +1468,7 @@ theorem mul : @Primrec' 2 fun v => v.head * v.tail.head :=
 
 theorem if_lt {n a b f g} (ha : @Primrec' n a) (hb : @Primrec' n b) (hf : @Primrec' n f)
     (hg : @Primrec' n g) : @Primrec' n fun v => if a v < b v then f v else g v :=
-  (prec' (sub.comp₂ _ hb ha) hg (tail <| tail hf)).of_eq fun v =>
-    by
+  (prec' (sub.comp₂ _ hb ha) hg (tail <| tail hf)).of_eq fun v => by
     cases e : b v - a v
     · simp [not_lt.2 (tsub_eq_zero_iff_le.mp e)]
     · simp [Nat.lt_of_sub_eq_succ e]
chore: rename mkpairpair (#2324)

We rename the ported mkpair to pair, as mkpair didn't follow the naming convention and pair pairs well with unpair. A poll for this decision was held on zulip.

Diff
@@ -15,9 +15,9 @@ import Mathlib.Logic.Function.Iterate
 # The primitive recursive functions
 
 The primitive recursive functions are the least collection of functions
-`ℕ → ℕ` which are closed under projections (using the mkpair
+`ℕ → ℕ` which are closed under projections (using the `pair`
 pairing function), composition, zero, successor, and primitive recursion
-(i.e. Nat.rec where the motive is C n := ℕ).
+(i.e. `Nat.rec` where the motive is `C n := ℕ`).
 
 We can extend this definition to a large class of basic types by
 using canonical encodings of types as natural numbers (Gödel numbering),
@@ -80,12 +80,12 @@ protected inductive Primrec : (ℕ → ℕ) → Prop
   | protected succ : Nat.Primrec succ
   | left : Nat.Primrec fun n => n.unpair.1
   | right : Nat.Primrec fun n => n.unpair.2
-  | pair {f g} : Nat.Primrec f → Nat.Primrec g → Nat.Primrec fun n => mkpair (f n) (g n)
+  | pair {f g} : Nat.Primrec f → Nat.Primrec g → Nat.Primrec fun n => pair (f n) (g n)
   | comp {f g} : Nat.Primrec f → Nat.Primrec g → Nat.Primrec fun n => f (g n)
   | prec {f g} :
       Nat.Primrec f →
         Nat.Primrec g →
-          Nat.Primrec (unpaired fun z n => n.rec (f z) fun y IH => g <| mkpair z <| mkpair y IH)
+          Nat.Primrec (unpaired fun z n => n.rec (f z) fun y IH => g <| pair z <| pair y IH)
 #align nat.primrec Nat.Primrec
 
 namespace Primrec
@@ -104,7 +104,7 @@ protected theorem id : Nat.Primrec id :=
 #align nat.primrec.id Nat.Primrec.id
 
 theorem prec1 {f} (m : ℕ) (hf : Nat.Primrec f) :
-    Nat.Primrec fun n => n.rec m fun y IH => f <| mkpair y IH :=
+    Nat.Primrec fun n => n.rec m fun y IH => f <| Nat.pair y IH :=
   ((prec (const m) (hf.comp right)).comp (zero.pair Primrec.id)).of_eq fun n => by simp
 #align nat.primrec.prec1 Nat.Primrec.prec1
 
@@ -113,11 +113,11 @@ theorem cases1 {f} (m : ℕ) (hf : Nat.Primrec f) : Nat.Primrec (Nat.casesOn ·
 #align nat.primrec.cases1 Nat.Primrec.cases1
 
 theorem cases {f g} (hf : Nat.Primrec f) (hg : Nat.Primrec g) :
-    Nat.Primrec (unpaired fun z n => n.casesOn (f z) fun y => g <| mkpair z y) :=
+    Nat.Primrec (unpaired fun z n => n.casesOn (f z) fun y => g <| Nat.pair z y) :=
   (prec hf (hg.comp (pair left (left.comp right)))).of_eq <| fun n => by simp
 #align nat.primrec.cases Nat.Primrec.cases
 
-protected theorem swap : Nat.Primrec (unpaired (swap mkpair)) :=
+protected theorem swap : Nat.Primrec (unpaired (swap Nat.pair)) :=
   (pair right left).of_eq fun n => by simp
 #align nat.primrec.swap Nat.Primrec.swap
 
@@ -433,11 +433,11 @@ theorem right : Primrec₂ fun (_ : α) (b : β) => b :=
   .snd
 #align primrec₂.right Primrec₂.right
 
-theorem mkpair : Primrec₂ Nat.mkpair := by simp [Primrec₂, Primrec]; constructor
-#align primrec₂.mkpair Primrec₂.mkpair
+theorem natPair : Primrec₂ Nat.pair := by simp [Primrec₂, Primrec]; constructor
+#align primrec₂.mkpair Primrec₂.natPair
 
 theorem unpaired {f : ℕ → ℕ → α} : Primrec (Nat.unpaired f) ↔ Primrec₂ f :=
-  ⟨fun h => by simpa using h.comp mkpair, fun h => h.comp Primrec.unpair⟩
+  ⟨fun h => by simpa using h.comp natPair, fun h => h.comp Primrec.unpair⟩
 #align primrec₂.unpaired Primrec₂.unpaired
 
 theorem unpaired' {f : ℕ → ℕ → ℕ} : Nat.Primrec (Nat.unpaired f) ↔ Primrec₂ f :=
@@ -921,7 +921,7 @@ private theorem list_foldl' {f : α → List β} {g : α → σ} {h : α → σ
 
 private theorem list_cons' : (haveI := prim H; Primrec₂ (@List.cons β)) :=
   letI := prim H
-  encode_iff.1 (succ.comp <| Primrec₂.mkpair.comp (encode_iff.2 fst) (encode_iff.2 snd))
+  encode_iff.1 (succ.comp <| Primrec₂.natPair.comp (encode_iff.2 fst) (encode_iff.2 snd))
 
 private theorem list_reverse' :
     haveI := prim H
@@ -984,7 +984,7 @@ instance list : Primcodable (List α) :=
         · rfl
         · injection IH
         · injection IH
-        · exact congr_arg (fun k => (Nat.mkpair (encode a) k).succ.succ) (Nat.succ.inj IH)⟩
+        · exact congr_arg (fun k => (Nat.pair (encode a) k).succ.succ) (Nat.succ.inj IH)⟩
 
 #align primcodable.list Primcodable.list
 end Primcodable
@@ -1478,15 +1478,15 @@ theorem if_lt {n a b f g} (ha : @Primrec' n a) (hb : @Primrec' n b) (hf : @Primr
     · simp [Nat.lt_of_sub_eq_succ e]
 #align nat.primrec'.if_lt Nat.Primrec'.if_lt
 
-theorem mkpair : @Primrec' 2 fun v => v.head.mkpair v.tail.head :=
+theorem natPair : @Primrec' 2 fun v => v.head.pair v.tail.head :=
   if_lt head (tail head) (add.comp₂ _ (tail <| mul.comp₂ _ head head) head)
     (add.comp₂ _ (add.comp₂ _ (mul.comp₂ _ head head) head) (tail head))
-#align nat.primrec'.mkpair Nat.Primrec'.mkpair
+#align nat.primrec'.mkpair Nat.Primrec'.natPair
 
 protected theorem encode : ∀ {n}, @Primrec' n encode
   | 0 => (const 0).of_eq fun v => by rw [v.eq_nil]; rfl
   | n + 1 =>
-    (succ.comp₁ _ (mkpair.comp₂ _ head (tail Primrec'.encode))).of_eq fun ⟨a :: l, e⟩ => rfl
+    (succ.comp₁ _ (natPair.comp₂ _ head (tail Primrec'.encode))).of_eq fun ⟨a :: l, e⟩ => rfl
 #align nat.primrec'.encode Nat.Primrec'.encode
 
 theorem sqrt : @Primrec' 1 fun v => v.head.sqrt := by
@@ -1536,13 +1536,13 @@ theorem of_prim {n f} : Primrec f → @Primrec' n f :=
   case succ => exact succ
   case left => exact unpair₁ head
   case right => exact unpair₂ head
-  case pair f g _ _ hf hg => exact mkpair.comp₂ _ hf hg
+  case pair f g _ _ hf hg => exact natPair.comp₂ _ hf hg
   case comp f g _ _ hf hg => exact hf.comp₁ _ hg
   case prec f g _ _ hf hg =>
     simpa using
       prec' (unpair₂ head) (hf.comp₁ _ (unpair₁ head))
         (hg.comp₁ _ <|
-          mkpair.comp₂ _ (unpair₁ <| tail <| tail head) (mkpair.comp₂ _ head (tail head)))
+          natPair.comp₂ _ (unpair₁ <| tail <| tail head) (natPair.comp₂ _ head (tail head)))
 #align nat.primrec'.of_prim Nat.Primrec'.of_prim
 
 theorem prim_iff {n f} : @Primrec' n f ↔ Primrec f :=
feat: port/Computability.Primrec (#2360)

Co-authored-by: prakol16 <prakol16@users.noreply.github.com>

Dependencies 6 + 213

214 files ported (97.3%)
95012 lines ported (97.8%)
Show graph

The unported dependencies are