awhecmu/canonical-drafter-extract-mathlib huggingface dataset:
-- Module: Mathlib.Computability.PartrecCode
Goal:
a : Primrec (β := ℕ × Code) fun (a : List (List (Option ℕ))) ↦ ofNat (ℕ × Code) a.length
k_1 : Primrec (β := ℕ) fun (a : List (List (Option ℕ)) × ℕ) ↦ (ofNat (ℕ × Code) a.1.length).1
n_1 : Primrec (α := List (List (Option ℕ)) × ℕ) Prod.snd
k_2 : Primrec (β := ℕ) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ (ofNat (ℕ × Code) a.1.1.length).1
n_2 : Primrec (β := ℕ) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ a.1.2
k' : Primrec (α := (List (List (Option ℕ)) × ℕ) × ℕ) Prod.snd
c : Primrec (β := Code) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ (ofNat (ℕ × Code) a.1.1.length).2
L : Primrec (β := List (List (Option ℕ))) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.1.1.1
k :
  Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (ofNat (ℕ × Code) a.1.1.1.length).1
n : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.1.1.2
cf : Primrec (β := Code) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.2.1
z : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (unpair a.1.1.2).1
m : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (unpair a.1.1.2).2
h₁ :
  Primrec (β := Option ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦
    lup (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).1
      (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).2.1
      (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).2.2
⊢ Primrec (β := ℕ) fun (a : (((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) × ℕ) ↦ (unpair a.1.1.1.2).2

Tactic:
have m := m.comp (Primrec.fst (β := ℕ))
-- Module: Mathlib.Computability.PartrecCode
Goal:
a : Primrec (β := ℕ × Code) fun (a : List (List (Option ℕ))) ↦ ofNat (ℕ × Code) a.length
k_1 : Primrec (β := ℕ) fun (a : List (List (Option ℕ)) × ℕ) ↦ (ofNat (ℕ × Code) a.1.length).1
n_1 : Primrec (α := List (List (Option ℕ)) × ℕ) Prod.snd
k_2 : Primrec (β := ℕ) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ (ofNat (ℕ × Code) a.1.1.length).1
n_2 : Primrec (β := ℕ) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ a.1.2
k' : Primrec (α := (List (List (Option ℕ)) × ℕ) × ℕ) Prod.snd
c : Primrec (β := Code) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ (ofNat (ℕ × Code) a.1.1.length).2
L : Primrec (β := List (List (Option ℕ))) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.1.1.1
k :
  Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (ofNat (ℕ × Code) a.1.1.1.length).1
n : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.1.1.2
cf : Primrec (β := Code) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.2.1
z : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (unpair a.1.1.2).1
m_1 : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (unpair a.1.1.2).2
h₁ :
  Primrec (β := Option ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦
    lup (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).1
      (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).2.1
      (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).2.2
m : Primrec (β := ℕ) fun (a : (((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) × ℕ) ↦ (unpair a.1.1.1.2).2
⊢ Primrec (β := Option ℕ) fun (p : (((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) × ℕ) ↦
    (fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) (x : ℕ) ↦
        (Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) x (some (unpair a.1.1.2).2) fun (x : ℕ) ↦
            lup a.1.1.1 (a.1.2, (ofNat (ℕ × Code) a.1.1.1.length).2)
              (Nat.pair (unpair a.1.1.2).1 ((unpair a.1.1.2).2 + 1)) :
          Option ℕ))
      p.1 p.2

Tactic:
Primrec.nat_casesOn Primrec.snd (Primrec.option_some.comp m) ?_

Premises used: Primrec.snd, Primrec.option_some, Primrec.comp, Primrec.nat_casesOn
-- Module: Mathlib.Computability.PartrecCode
Goal:
a : Primrec (β := ℕ × Code) fun (a : List (List (Option ℕ))) ↦ ofNat (ℕ × Code) a.length
k_1 : Primrec (β := ℕ) fun (a : List (List (Option ℕ)) × ℕ) ↦ (ofNat (ℕ × Code) a.1.length).1
n_1 : Primrec (α := List (List (Option ℕ)) × ℕ) Prod.snd
k_2 : Primrec (β := ℕ) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ (ofNat (ℕ × Code) a.1.1.length).1
n_2 : Primrec (β := ℕ) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ a.1.2
k' : Primrec (α := (List (List (Option ℕ)) × ℕ) × ℕ) Prod.snd
c : Primrec (β := Code) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ (ofNat (ℕ × Code) a.1.1.length).2
L : Primrec (β := List (List (Option ℕ))) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.1.1.1
k :
  Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (ofNat (ℕ × Code) a.1.1.1.length).1
n : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.1.1.2
cf : Primrec (β := Code) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.2.1
z : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (unpair a.1.1.2).1
m_1 : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (unpair a.1.1.2).2
h₁ :
  Primrec (β := Option ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦
    lup (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).1
      (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).2.1
      (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).2.2
m : Primrec (β := ℕ) fun (a : (((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) × ℕ) ↦ (unpair a.1.1.1.2).2
⊢ Primrec (β := Option ℕ) fun (p : ((((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) × ℕ) × ℕ) ↦
    (fun (p : (((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) × ℕ) (x : ℕ) ↦
        lup p.1.1.1.1 (p.1.1.2, (ofNat (ℕ × Code) p.1.1.1.1.length).2)
          (Nat.pair (unpair p.1.1.1.2).1 ((unpair p.1.1.1.2).2 + 1)))
      p.1 p.2

Tactic:
(hlup.comp ((L.comp Primrec.fst).pair <|
      ((k'.pair c).comp <| Primrec.fst.comp Primrec.fst).pair
        (Primrec₂.natPair.comp (z.comp Primrec.fst) (_root_.Primrec.succ.comp m)))).comp
      Primrec.fst

Premises used: Primrec.fst, Primrec.pair, Nat.pair, _private.0.Nat.Partrec.Code.hlup, Primrec.succ, Primrec.comp, Primrec₂.natPair, Primrec₂.comp, ite
-- Module: Mathlib.Computability.PartrecCode
Goal:
a : Primrec (β := ℕ × Code) fun (a : List (List (Option ℕ))) ↦ ofNat (ℕ × Code) a.length
k_1 : Primrec (β := ℕ) fun (a : List (List (Option ℕ)) × ℕ) ↦ (ofNat (ℕ × Code) a.1.length).1
n_1 : Primrec (α := List (List (Option ℕ)) × ℕ) Prod.snd
k_2 : Primrec (β := ℕ) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ (ofNat (ℕ × Code) a.1.1.length).1
n_2 : Primrec (β := ℕ) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ a.1.2
k' : Primrec (α := (List (List (Option ℕ)) × ℕ) × ℕ) Prod.snd
c : Primrec (β := Code) fun (a : (List (List (Option ℕ)) × ℕ) × ℕ) ↦ (ofNat (ℕ × Code) a.1.1.length).2
L : Primrec (β := List (List (Option ℕ))) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.1.1.1
k :
  Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (ofNat (ℕ × Code) a.1.1.1.length).1
n : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.1.1.2
cf : Primrec (β := Code) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ a.2.1
z : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (unpair a.1.1.2).1
m_1 : Primrec (β := ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦ (unpair a.1.1.2).2
h₁ :
  Primrec (β := Option ℕ) fun (a : ((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) ↦
    lup (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).1
      (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).2.1
      (a.1.1.1, ((ofNat (ℕ × Code) a.1.1.1.length).1, a.2.1), Nat.pair (unpair a.1.1.2).1 (unpair a.1.1.2).2).2.2
m : Primrec (β := ℕ) fun (a : (((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) × ℕ) ↦ (unpair a.1.1.1.2).2
⊢ Primrec (β := Option ℕ) fun (p : ((((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) × ℕ) × ℕ) ↦
    (fun (p : (((List (List (Option ℕ)) × ℕ) × ℕ) × Code × Option ℕ) × ℕ) (x : ℕ) ↦
        lup p.1.1.1.1 (p.1.1.2, (ofNat (ℕ × Code) p.1.1.1.1.length).2)
          (Nat.pair (unpair p.1.1.1.2).1 ((unpair p.1.1.1.2).2 + 1)))
      p.1 p.2

Tactic:
exact (hlup.comp ((L.comp Primrec.fst).pair <|
      ((k'.pair c).comp <| Primrec.fst.comp Primrec.fst).pair
        (Primrec₂.natPair.comp (z.comp Primrec.fst) (_root_.Primrec.succ.comp m)))).comp
      Primrec.fst

Premises used: Primrec.fst, Primrec.pair, _private.0.Nat.Partrec.Code.hlup, Primrec.succ, Primrec.comp, Primrec₂.natPair, Primrec₂.comp
-- Module: Mathlib.Computability.PartrecCode
Goal:
k : ℕ
c : Code
n : ℕ
pos :
  ∀ (kn : n < k),
    ((getElem? (valid := fun (as : List ℕ) (i : ℕ) ↦ i < as.length) (List.range k) n).bind fun (a : ℕ) ↦ evaln k c a) =
      evaln k c n
neg :
  ∀ (kn : ¬n < k),
    ((getElem? (valid := fun (as : List ℕ) (i : ℕ) ↦ i < as.length) (List.range k) n).bind fun (a : ℕ) ↦ evaln k c a) =
      evaln k c n
⊢ ((getElem? (valid := fun (as : List ℕ) (i : ℕ) ↦ i < as.length) (List.range k) n).bind fun (a : ℕ) ↦ evaln k c a) =
    evaln k c n

Tactic:
by_cases kn : n < k
-- Module: Mathlib.Computability.PartrecCode
Goal:
k : ℕ
c : Code
n : ℕ
kn : n < k
⊢ ((getElem? (valid := fun (as : List ℕ) (i : ℕ) ↦ i < as.length) (List.range k) n).bind fun (a : ℕ) ↦ evaln k c a) =
    evaln k c n

Tactic:
simp [List.getElem?_range kn]

Premises used: List.getElem?_range
-- Module: Mathlib.Computability.PartrecCode
Goal:
k : ℕ
c : Code
n : ℕ
kn : ¬n < k
neg : (Option.bind Option.none fun (a : ℕ) ↦ evaln k c a) = evaln k c n
neg₁ : (List.range k).length ≤ n
⊢ ((getElem? (valid := fun (as : List ℕ) (i : ℕ) ↦ i < as.length) (List.range k) n).bind fun (a : ℕ) ↦ evaln k c a) =
    evaln k c n

Tactic:
rw [List.getElem?_eq_none]

Premises used: List.getElem?_eq_none
-- Module: Mathlib.Computability.PartrecCode
Goal:
k : ℕ
c : Code
n : ℕ
kn : ¬n < k
neg :
  ∀ (e : evaln k c n = Option.none), Eq (α := Option ℕ) (Option.bind Option.none fun (a : ℕ) ↦ evaln k c a) Option.none
neg₁ : ∀ (val : ℕ) (e : evaln k c n = some val), (Option.bind Option.none fun (a : ℕ) ↦ evaln k c a) = some val
⊢ (Option.bind Option.none fun (a : ℕ) ↦ evaln k c a) = evaln k c n

Tactic:
cases e : evaln k c n

Premises used: Nat.Partrec.Code.evaln
-- Module: Mathlib.Computability.PartrecCode
Goal:
k : ℕ
c : Code
n : ℕ
kn : ¬n < k
e : evaln k c n = Option.none
⊢ Eq (α := Option ℕ) (Option.bind Option.none fun (a : ℕ) ↦ evaln k c a) Option.none

Tactic:
rfl
-- Module: Mathlib.Computability.PartrecCode
Goal:
k : ℕ
c : Code
n : ℕ
kn : ¬n < k
val : ℕ
e : evaln k c n = some val
⊢ (Option.bind Option.none fun (a : ℕ) ↦ evaln k c a) = some val

Tactic:
kn.elim (evaln_bound e)

Premises used: Nat.Partrec.Code.evaln_bound, Not.elim
-- Module: Mathlib.Computability.PartrecCode
Goal:
k : ℕ
c : Code
n : ℕ
kn : ¬n < k
val : ℕ
e : evaln k c n = some val
⊢ (Option.bind Option.none fun (a : ℕ) ↦ evaln k c a) = some val

Tactic:
exact kn.elim (evaln_bound e)

Premises used: Nat.Partrec.Code.evaln_bound, Not.elim
-- Module: Mathlib.Computability.PartrecCode
Goal:
k : ℕ
c : Code
n : ℕ
kn : ¬n < k
⊢ (List.range k).length ≤ n

Tactic:
simpa using kn
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
⊢ List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))

Tactic:
simp
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
⊢ List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))

Tactic:
have : List.range p = List.range (Nat.pair p.unpair.1 (encode (ofNat Code p.unpair.2))) := by
        simp
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
c : Code
k' : ℕ
nk : n ∈ List.range (k' + 1)
k : ℕ := k' + 1
⊢ n ≤ k'

Tactic:
simp only [List.mem_range, Nat.lt_succ_iff] at nk

Premises used: List.mem_range, Nat.lt_succ_iff
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
c : Code
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
k₁ : ℕ
c₁ : Code
n₁ : ℕ
hl : Nat.pair k₁ (encode c₁) < Nat.pair k (encode c)
⊢ lup
      (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
        (List.range (Nat.pair k (encode c))))
      (k₁, c₁) n₁ =
    evaln k₁ c₁ n₁

Tactic:
simp [lup, List.getElem?_range hl, evaln_map, Bind.bind, Option.bind_map]

Premises used: _private.0.Nat.Partrec.Code.evaln_map, List.getElem?_range, _private.0.Nat.Partrec.Code.lup, Option.bind_map, Bind.bind
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
c : Code
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
⊢ ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode c) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode c))))
          (k', c') n =
        evaln k' c' n

Tactic:
have hg :
        ∀ {k' c' n},
          Nat.pair k' (encode c') < Nat.pair k (encode c) →
            lup ((List.range (Nat.pair k (encode c))).map fun n =>
              (List.range n.unpair.1).map (evaln n.unpair.1 (ofNat Code n.unpair.2))) (k', c') n =
            evaln k' c' n := by
        intro k₁ c₁ n₁ hl
        simp [lup, List.getElem?_range hl, evaln_map, Bind.bind, Option.bind_map]
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.pair cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.pair cg)))))
          (k', c') n =
        evaln k' c' n
⊢ encode cf < encode (cf.pair cg)

Tactic:
obtain ⟨lf, lg⟩ := encode_lt_pair cf cg

Premises used: Nat.Partrec.Code.encode_lt_pair
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.pair cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.pair cg)))))
          (k', c') n =
        evaln k' c' n
lf : encode cf < encode (cf.pair cg)
⊢ encode cg < encode (cf.pair cg)

Tactic:
obtain ⟨lf, lg⟩ := encode_lt_pair cf cg

Premises used: Nat.Partrec.Code.encode_lt_pair
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.pair cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.pair cg)))))
          (k', c') n =
        evaln k' c' n
lf : encode cf < encode (cf.pair cg)
lg : encode cg < encode (cf.pair cg)
succ :
  Eq (α := Option ℕ) ((evaln k cf n).bind fun (a : ℕ) ↦ (evaln k cg n).bind fun (y : ℕ) ↦ some (Nat.pair a y))
    ((Option.map Nat.pair (evaln (k' + 1) cf n)).bind fun (a : ℕ → ℕ) ↦ Option.map a (evaln (k' + 1) cg n))
⊢ Eq (α := Option ℕ)
    ((lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair (k' + 1) (encode (cf.pair cg)))))
          (k' + 1, cf) n).bind
      fun (a : ℕ) ↦
      (lup
            (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
              (List.range (Nat.pair (k' + 1) (encode (cf.pair cg)))))
            (k' + 1, cg) n).bind
        fun (y : ℕ) ↦ some (Nat.pair a y))
    ((Option.map Nat.pair (evaln (k' + 1) cf n)).bind fun (a : ℕ → ℕ) ↦ Option.map a (evaln (k' + 1) cg n))

Tactic:
rw [hg (Nat.pair_lt_pair_right _ lf), hg (Nat.pair_lt_pair_right _ lg)]

Premises used: Nat.pair_lt_pair_right
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.pair cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.pair cg)))))
          (k', c') n =
        evaln k' c' n
lf : encode cf < encode (cf.pair cg)
lg : encode cg < encode (cf.pair cg)
succ :
  Eq (α := Option ℕ) (Option.bind Option.none fun (a : ℕ) ↦ (evaln k cg n).bind fun (y : ℕ) ↦ some (Nat.pair a y))
    ((Option.map Nat.pair Option.none).bind fun (a : ℕ → ℕ) ↦ Option.map a (evaln (k' + 1) cg n))
succ₁ :
  ∀ (val : ℕ),
    Eq (α := Option ℕ) ((some val).bind fun (a : ℕ) ↦ (evaln k cg n).bind fun (y : ℕ) ↦ some (Nat.pair a y))
      ((Option.map Nat.pair (some val)).bind fun (a : ℕ → ℕ) ↦ Option.map a (evaln (k' + 1) cg n))
⊢ Eq (α := Option ℕ) ((evaln k cf n).bind fun (a : ℕ) ↦ (evaln k cg n).bind fun (y : ℕ) ↦ some (Nat.pair a y))
    ((Option.map Nat.pair (evaln (k' + 1) cf n)).bind fun (a : ℕ → ℕ) ↦ Option.map a (evaln (k' + 1) cg n))

Tactic:
cases evaln k cf n

Premises used: Nat.Partrec.Code.evaln
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.pair cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.pair cg)))))
          (k', c') n =
        evaln k' c' n
lf : encode cf < encode (cf.pair cg)
lg : encode cg < encode (cf.pair cg)
⊢ Eq (α := Option ℕ) (Option.bind Option.none fun (a : ℕ) ↦ (evaln k cg n).bind fun (y : ℕ) ↦ some (Nat.pair a y))
    ((Option.map Nat.pair Option.none).bind fun (a : ℕ → ℕ) ↦ Option.map a (evaln (k' + 1) cg n))

Tactic:
rfl
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.pair cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.pair cg)))))
          (k', c') n =
        evaln k' c' n
lf : encode cf < encode (cf.pair cg)
lg : encode cg < encode (cf.pair cg)
val : ℕ
succ :
  Eq (α := Option ℕ) ((some val).bind fun (a : ℕ) ↦ Option.bind Option.none fun (y : ℕ) ↦ some (Nat.pair a y))
    ((Option.map Nat.pair (some val)).bind fun (a : ℕ → ℕ) ↦ Option.map a Option.none)
succ₁ :
  ∀ (val_1 : ℕ),
    Eq (α := Option ℕ) ((some val).bind fun (a : ℕ) ↦ (some val_1).bind fun (y : ℕ) ↦ some (Nat.pair a y))
      ((Option.map Nat.pair (some val)).bind fun (a : ℕ → ℕ) ↦ Option.map a (some val_1))
⊢ Eq (α := Option ℕ) ((some val).bind fun (a : ℕ) ↦ (evaln k cg n).bind fun (y : ℕ) ↦ some (Nat.pair a y))
    ((Option.map Nat.pair (some val)).bind fun (a : ℕ → ℕ) ↦ Option.map a (evaln (k' + 1) cg n))

Tactic:
cases evaln k cg n

Premises used: Nat.Partrec.Code.evaln
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.pair cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.pair cg)))))
          (k', c') n =
        evaln k' c' n
lf : encode cf < encode (cf.pair cg)
lg : encode cg < encode (cf.pair cg)
val : ℕ
⊢ Eq (α := Option ℕ) ((some val).bind fun (a : ℕ) ↦ Option.bind Option.none fun (y : ℕ) ↦ some (Nat.pair a y))
    ((Option.map Nat.pair (some val)).bind fun (a : ℕ → ℕ) ↦ Option.map a Option.none)

Tactic:
rfl
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.pair cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.pair cg)))))
          (k', c') n =
        evaln k' c' n
lf : encode cf < encode (cf.pair cg)
lg : encode cg < encode (cf.pair cg)
val val_1 : ℕ
⊢ Eq (α := Option ℕ) ((some val).bind fun (a : ℕ) ↦ (some val_1).bind fun (y : ℕ) ↦ some (Nat.pair a y))
    ((Option.map Nat.pair (some val)).bind fun (a : ℕ → ℕ) ↦ Option.map a (some val_1))

Tactic:
rfl
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.comp cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.comp cg)))))
          (k', c') n =
        evaln k' c' n
⊢ encode cf < encode (cf.comp cg)

Tactic:
obtain ⟨lf, lg⟩ := encode_lt_comp cf cg

Premises used: Nat.Partrec.Code.encode_lt_comp
-- Module: Mathlib.Computability.PartrecCode
Goal:
x : Unit
p n : ℕ
this : List.range p = List.range (Nat.pair (unpair p).1 (encode (ofNat Code (unpair p).2)))
k' : ℕ
k : ℕ := k' + 1
nk : n ≤ k'
cf cg : Code
hg :
  ∀ {k' : ℕ} {c' : Code} {n : ℕ},
    Nat.pair k' (encode c') < Nat.pair k (encode (cf.comp cg)) →
      lup
          (List.map (fun (n : ℕ) ↦ List.map (evaln (unpair n).1 (ofNat Code (unpair n).2)) (List.range (unpair n).1))
            (List.range (Nat.pair k (encode (cf.comp cg)))))
          (k', c') n =
        evaln k' c' n
lf : encode cf < encode (cf.comp cg)
⊢ encode cg < encode (cf.comp cg)

Tactic:
obtain ⟨lf, lg⟩ := encode_lt_comp cf cg

Premises used: Nat.Partrec.Code.encode_lt_comp