awhecmu/canonical-drafter-extract-mathlib huggingface dataset:
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k k₂ : ℕ
hl : k + 1 ≤ k₂ + 1
hl' : k ≤ k₂
this :
  ∀ {k k₂ n x : ℕ} {o₁ o₂ : Option ℕ},
    k ≤ k₂ →
      (x ∈ o₁ → x ∈ o₂) →
        Membership.mem (γ := Option ℕ)
            (do
              guard (n ≤ k)
              o₁)
            x →
          Membership.mem (γ := Option ℕ)
            (do
              guard (n ≤ k₂)
              o₂)
            x
cf : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
n x_1 : ℕ
h_1 :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          unpaired
              (fun (a m : ℕ) ↦ do
                let x ← evaln (k + 1) cf (Nat.pair a m)
                if x = 0 then pure m else evaln k cf.rfind' (Nat.pair a (m + 1)))
              n :
          Option ℕ))
      n =
    some x_1
h :
  ∃ (a : ℕ),
    evaln (k + 1) cf n = some a ∧
      (if a = 0 then some (unpair n).2 else evaln k cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1
x : ℕ
pos :
  ∀ (x0 : x = 0),
    (if x = 0 then some (unpair n).2 else evaln k cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1 →
      (if x = 0 then some (unpair n).2 else evaln k₂ cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1
⊢ (if x = 0 then some (unpair n).2 else evaln k cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1 →
    (if x = 0 then some (unpair n).2 else evaln k₂ cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1
have neg : ∀ (x0 : ¬x = 0),
  (if x = 0 then some (unpair n).2 else evaln k cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1 →
    (if x = 0 then some (unpair n).2 else evaln k₂ cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1
Tactic: by_cases x0 : x = 0
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k k₂ : ℕ
hl : k + 1 ≤ k₂ + 1
hl' : k ≤ k₂
this :
  ∀ {k k₂ n x : ℕ} {o₁ o₂ : Option ℕ},
    k ≤ k₂ →
      (x ∈ o₁ → x ∈ o₂) →
        Membership.mem (γ := Option ℕ)
            (do
              guard (n ≤ k)
              o₁)
            x →
          Membership.mem (γ := Option ℕ)
            (do
              guard (n ≤ k₂)
              o₂)
            x
cf : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
n x_1 : ℕ
h_1 :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          unpaired
              (fun (a m : ℕ) ↦ do
                let x ← evaln (k + 1) cf (Nat.pair a m)
                if x = 0 then pure m else evaln k cf.rfind' (Nat.pair a (m + 1)))
              n :
          Option ℕ))
      n =
    some x_1
h :
  ∃ (a : ℕ),
    evaln (k + 1) cf n = some a ∧
      (if a = 0 then some (unpair n).2 else evaln k cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1
x : ℕ
x0 : ¬x = 0
⊢ (if x = 0 then some (unpair n).2 else evaln k cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1 →
    (if x = 0 then some (unpair n).2 else evaln k₂ cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x_1
have neg : evaln k cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1)) = some x_1 →
  evaln k₂ cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1)) = some x_1
Tactic: simp [x0]
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
c : Code
n x : ℕ
h : x ∈ evaln (k + 1) c n
⊢ x ∈ c.eval n
have zero : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) zero n), x ∈ zero.eval n
Tactic: induction c generalizing x n
Cleared hypotheses: c, n, x, h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
c : Code
n x : ℕ
h : x ∈ evaln (k + 1) c n
zero : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.zero n), x ∈ Code.zero.eval n
⊢ x ∈ c.eval n
have succ : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) succ n), x ∈ succ.eval n
Tactic: induction c generalizing x n
Cleared hypotheses: c, n, x, h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
c : Code
n x : ℕ
h : x ∈ evaln (k + 1) c n
zero : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.zero n), x ∈ Code.zero.eval n
succ : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.succ n), x ∈ Code.succ.eval n
⊢ x ∈ c.eval n
have left : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) left n), x ∈ left.eval n
Tactic: induction c generalizing x n
Cleared hypotheses: c, n, x, h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
c : Code
n x : ℕ
h : x ∈ evaln (k + 1) c n
zero : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.zero n), x ∈ Code.zero.eval n
succ : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.succ n), x ∈ Code.succ.eval n
left : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.left n), x ∈ Code.left.eval n
⊢ x ∈ c.eval n
have right : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) right n), x ∈ right.eval n
Tactic: induction c generalizing x n
Cleared hypotheses: c, n, x, h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
c : Code
n x : ℕ
h : x ∈ evaln (k + 1) c n
zero : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.zero n), x ∈ Code.zero.eval n
succ : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.succ n), x ∈ Code.succ.eval n
left : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.left n), x ∈ Code.left.eval n
right : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.right n), x ∈ Code.right.eval n
⊢ x ∈ c.eval n
have pair : ∀ (a a_1 : Code),
  (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
    (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n) →
      ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) (a.pair a_1) n), x ∈ (a.pair a_1).eval n
Tactic: induction c generalizing x n
Cleared hypotheses: c, n, x, h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
c : Code
n x : ℕ
h : x ∈ evaln (k + 1) c n
zero : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.zero n), x ∈ Code.zero.eval n
succ : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.succ n), x ∈ Code.succ.eval n
left : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.left n), x ∈ Code.left.eval n
right : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.right n), x ∈ Code.right.eval n
pair :
  ∀ (a a_1 : Code),
    (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
      (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n) →
        ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) (a.pair a_1) n), x ∈ (a.pair a_1).eval n
⊢ x ∈ c.eval n
have comp : ∀ (a a_1 : Code),
  (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
    (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n) →
      ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) (a.comp a_1) n), x ∈ (a.comp a_1).eval n
Tactic: induction c generalizing x n
Cleared hypotheses: c, n, x, h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
c : Code
n x : ℕ
h : x ∈ evaln (k + 1) c n
zero : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.zero n), x ∈ Code.zero.eval n
succ : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.succ n), x ∈ Code.succ.eval n
left : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.left n), x ∈ Code.left.eval n
right : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.right n), x ∈ Code.right.eval n
pair :
  ∀ (a a_1 : Code),
    (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
      (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n) →
        ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) (a.pair a_1) n), x ∈ (a.pair a_1).eval n
comp :
  ∀ (a a_1 : Code),
    (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
      (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n) →
        ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) (a.comp a_1) n), x ∈ (a.comp a_1).eval n
⊢ x ∈ c.eval n
have prec : ∀ (a a_1 : Code),
  (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
    (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n) →
      ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) (a.prec a_1) n), x ∈ (a.prec a_1).eval n
Tactic: induction c generalizing x n
Cleared hypotheses: c, n, x, h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
c : Code
n x : ℕ
h : x ∈ evaln (k + 1) c n
zero : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.zero n), x ∈ Code.zero.eval n
succ : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.succ n), x ∈ Code.succ.eval n
left : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.left n), x ∈ Code.left.eval n
right : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) Code.right n), x ∈ Code.right.eval n
pair :
  ∀ (a a_1 : Code),
    (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
      (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n) →
        ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) (a.pair a_1) n), x ∈ (a.pair a_1).eval n
comp :
  ∀ (a a_1 : Code),
    (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
      (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n) →
        ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) (a.comp a_1) n), x ∈ (a.comp a_1).eval n
prec :
  ∀ (a a_1 : Code),
    (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
      (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n) →
        ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) (a.prec a_1) n), x ∈ (a.prec a_1).eval n
⊢ x ∈ c.eval n
have rfind' : ∀ (a : Code),
  (∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n) →
    ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a.rfind' n), x ∈ a.rfind'.eval n
Tactic: induction c generalizing x n
Cleared hypotheses: c, n, x, h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k n x : ℕ
h : x ∈ evaln (k + 1) zero n
⊢ x ∈ zero.eval n
have h₁ : n ≤ k ∧ 0 = x
Tactic: simp [eval, evaln, Option.bind_eq_some_iff, Seq.seq] at h ⊢
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k n x : ℕ
h : x ∈ evaln (k + 1) succ n
⊢ x ∈ succ.eval n
have succ : ∀ (h : n ≤ k ∧ n + 1 = x), x = n + 1
Tactic: simp [eval, evaln, Option.bind_eq_some_iff, Seq.seq] at h ⊢
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k n x : ℕ
h : x ∈ evaln (k + 1) left n
⊢ x ∈ left.eval n
have left : ∀ (h : n ≤ k ∧ (unpair n).1 = x), x = (unpair n).1
Tactic: simp [eval, evaln, Option.bind_eq_some_iff, Seq.seq] at h ⊢
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k n x : ℕ
h : x ∈ evaln (k + 1) right n
⊢ x ∈ right.eval n
have right : ∀ (h : n ≤ k ∧ (unpair n).2 = x), x = (unpair n).2
Tactic: simp [eval, evaln, Option.bind_eq_some_iff, Seq.seq] at h ⊢
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
a a_1 : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
a_ih_1 : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n
n x : ℕ
h : x ∈ evaln (k + 1) (a.pair a_1) n
⊢ x ∈ (a.pair a_1).eval n
have pair : ∀
  (h :
    n ≤ k ∧ ∃ (a_2 : ℕ), evaln (k + 1) a n = some a_2 ∧ ∃ (a : ℕ), evaln (k + 1) a_1 n = some a ∧ Nat.pair a_2 a = x),
  ∃ a_2 ∈ a.eval n, ∃ a ∈ a_1.eval n, Nat.pair a_2 a = x
Tactic: simp [eval, evaln, Option.bind_eq_some_iff, Seq.seq] at h ⊢
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
a a_1 : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
a_ih_1 : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n
n x : ℕ
h : x ∈ evaln (k + 1) (a.comp a_1) n
⊢ x ∈ (a.comp a_1).eval n
have comp : ∀ (h : n ≤ k ∧ ∃ (a_2 : ℕ), evaln (k + 1) a_1 n = some a_2 ∧ evaln (k + 1) a a_2 = some x),
  ∃ a_2 ∈ a_1.eval n, x ∈ a.eval a_2
Tactic: simp [eval, evaln, Option.bind_eq_some_iff, Seq.seq] at h ⊢
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
a a_1 : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
a_ih_1 : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n
n x : ℕ
h : x ∈ evaln (k + 1) (a.prec a_1) n
⊢ x ∈ (a.prec a_1).eval n
have prec : ∀
  (h :
    n ≤ k ∧
      Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k + 1) a (unpair n).1)
          (fun (n_1 : ℕ) (n_ih : Option ℕ) ↦
            (evaln k (a.prec a_1) (Nat.pair (unpair n).1 n_1)).bind fun (i : ℕ) ↦
              evaln (k + 1) a_1 (Nat.pair (unpair n).1 (Nat.pair n_1 i)))
          (unpair n).2 =
        some x),
  Membership.mem (γ := Part ℕ)
    (Nat.rec (motive := fun (x : ℕ) ↦ Part ℕ) (a.eval (unpair n).1)
        (fun (y : ℕ) (IH : Part ℕ) ↦ IH.bind fun (i : ℕ) ↦ a_1.eval (Nat.pair (unpair n).1 (Nat.pair y i)))
        (unpair n).2 :
      Part ℕ)
    x
Tactic: simp [eval, evaln, Option.bind_eq_some_iff, Seq.seq] at h ⊢
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
a : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
n x : ℕ
h : x ∈ evaln (k + 1) a.rfind' n
⊢ x ∈ a.rfind'.eval n
have rfind' : ∀
  (h :
    n ≤ k ∧
      ∃ (a_1 : ℕ),
        evaln (k + 1) a n = some a_1 ∧
          (if a_1 = 0 then some (unpair n).2 else evaln k a.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) =
            some x),
  ∃ (a_1 : ℕ),
    (0 ∈ a.eval (Nat.pair (unpair n).1 (a_1 + (unpair n).2)) ∧
        ∀ {m : ℕ}, m < a_1 → ∃ a_3 ∈ a.eval (Nat.pair (unpair n).1 (m + (unpair n).2)), ¬a_3 = 0) ∧
      a_1 + (unpair n).2 = x
Tactic: simp [eval, evaln, Option.bind_eq_some_iff, Seq.seq] at h ⊢
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k n x : ℕ
h : n ≤ k ∧ 0 = x
⊢ Membership.mem (γ := Part ℕ) (pure 0 n) x
have left : n ≤ k
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k n x : ℕ
h : n ≤ k ∧ 0 = x
left : n ≤ k
⊢ Membership.mem (γ := Part ℕ) (pure 0 n) x
have h₁ : 0 = x
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k n x : ℕ
h : n ≤ k ∧ n + 1 = x
⊢ x = n + 1
have left : n ≤ k
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k n x : ℕ
h : n ≤ k ∧ n + 1 = x
left : n ≤ k
⊢ x = n + 1
have h₁ : n + 1 = x
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k n x : ℕ
h : n ≤ k ∧ (unpair n).1 = x
⊢ x = (unpair n).1
have left : n ≤ k
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k n x : ℕ
h : n ≤ k ∧ (unpair n).1 = x
left : n ≤ k
⊢ x = (unpair n).1
have h₁ : (unpair n).1 = x
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k n x : ℕ
h : n ≤ k ∧ (unpair n).2 = x
⊢ x = (unpair n).2
have left : n ≤ k
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k n x : ℕ
h : n ≤ k ∧ (unpair n).2 = x
left : n ≤ k
⊢ x = (unpair n).2
have h₁ : (unpair n).2 = x
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k : ℕ
a a_1 : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
a_ih_1 : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n
n x : ℕ
h : n ≤ k ∧ ∃ (a_2 : ℕ), evaln (k + 1) a n = some a_2 ∧ ∃ (a : ℕ), evaln (k + 1) a_1 n = some a ∧ Nat.pair a_2 a = x
⊢ ∃ a_2 ∈ a.eval n, ∃ a ∈ a_1.eval n, Nat.pair a_2 a = x
have left : n ≤ k
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k : ℕ
a a_1 : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
a_ih_1 : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n
n x : ℕ
h : n ≤ k ∧ ∃ (a_2 : ℕ), evaln (k + 1) a n = some a_2 ∧ ∃ (a : ℕ), evaln (k + 1) a_1 n = some a ∧ Nat.pair a_2 a = x
left : n ≤ k
⊢ ∃ a_2 ∈ a.eval n, ∃ a ∈ a_1.eval n, Nat.pair a_2 a = x
have h₁ : ∃ (a_2 : ℕ), evaln (k + 1) a n = some a_2 ∧ ∃ (a : ℕ), evaln (k + 1) a_1 n = some a ∧ Nat.pair a_2 a = x
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k : ℕ
a a_1 : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
a_ih_1 : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n
n x : ℕ
h : n ≤ k ∧ ∃ (a_2 : ℕ), evaln (k + 1) a_1 n = some a_2 ∧ evaln (k + 1) a a_2 = some x
⊢ ∃ a_2 ∈ a_1.eval n, x ∈ a.eval a_2
have left : n ≤ k
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k : ℕ
a a_1 : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
a_ih_1 : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n
n x : ℕ
h : n ≤ k ∧ ∃ (a_2 : ℕ), evaln (k + 1) a_1 n = some a_2 ∧ evaln (k + 1) a a_2 = some x
left : n ≤ k
⊢ ∃ a_2 ∈ a_1.eval n, x ∈ a.eval a_2
have h₁ : ∃ (a_2 : ℕ), evaln (k + 1) a_1 n = some a_2 ∧ evaln (k + 1) a a_2 = some x
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k : ℕ
a a_1 : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
a_ih_1 : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n
n x : ℕ
h :
  n ≤ k ∧
    Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k + 1) a (unpair n).1)
        (fun (n_1 : ℕ) (n_ih : Option ℕ) ↦
          (evaln k (a.prec a_1) (Nat.pair (unpair n).1 n_1)).bind fun (i : ℕ) ↦
            evaln (k + 1) a_1 (Nat.pair (unpair n).1 (Nat.pair n_1 i)))
        (unpair n).2 =
      some x
⊢ Membership.mem (γ := Part ℕ)
    (Nat.rec (motive := fun (x : ℕ) ↦ Part ℕ) (a.eval (unpair n).1)
        (fun (y : ℕ) (IH : Part ℕ) ↦ IH.bind fun (i : ℕ) ↦ a_1.eval (Nat.pair (unpair n).1 (Nat.pair y i)))
        (unpair n).2 :
      Part ℕ)
    x
have left : n ≤ k
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k : ℕ
a a_1 : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
a_ih_1 : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a_1 n), x ∈ a_1.eval n
n x : ℕ
h :
  n ≤ k ∧
    Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k + 1) a (unpair n).1)
        (fun (n_1 : ℕ) (n_ih : Option ℕ) ↦
          (evaln k (a.prec a_1) (Nat.pair (unpair n).1 n_1)).bind fun (i : ℕ) ↦
            evaln (k + 1) a_1 (Nat.pair (unpair n).1 (Nat.pair n_1 i)))
        (unpair n).2 =
      some x
left : n ≤ k
⊢ Membership.mem (γ := Part ℕ)
    (Nat.rec (motive := fun (x : ℕ) ↦ Part ℕ) (a.eval (unpair n).1)
        (fun (y : ℕ) (IH : Part ℕ) ↦ IH.bind fun (i : ℕ) ↦ a_1.eval (Nat.pair (unpair n).1 (Nat.pair y i)))
        (unpair n).2 :
      Part ℕ)
    x
have h₁ : Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k + 1) a (unpair n).1)
    (fun (n_1 : ℕ) (n_ih : Option ℕ) ↦
      (evaln k (a.prec a_1) (Nat.pair (unpair n).1 n_1)).bind fun (i : ℕ) ↦
        evaln (k + 1) a_1 (Nat.pair (unpair n).1 (Nat.pair n_1 i)))
    (unpair n).2 =
  some x
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k : ℕ
a : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
n x : ℕ
h :
  n ≤ k ∧
    ∃ (a_1 : ℕ),
      evaln (k + 1) a n = some a_1 ∧
        (if a_1 = 0 then some (unpair n).2 else evaln k a.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x
⊢ ∃ (a_1 : ℕ),
    (0 ∈ a.eval (Nat.pair (unpair n).1 (a_1 + (unpair n).2)) ∧
        ∀ {m : ℕ}, m < a_1 → ∃ a_3 ∈ a.eval (Nat.pair (unpair n).1 (m + (unpair n).2)), ¬a_3 = 0) ∧
      a_1 + (unpair n).2 = x
have left : n ≤ k
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (hypothesis)
Goal:
k : ℕ
a : Code
a_ih : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) a n), x ∈ a.eval n
n x : ℕ
h :
  n ≤ k ∧
    ∃ (a_1 : ℕ),
      evaln (k + 1) a n = some a_1 ∧
        (if a_1 = 0 then some (unpair n).2 else evaln k a.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x
left : n ≤ k
⊢ ∃ (a_1 : ℕ),
    (0 ∈ a.eval (Nat.pair (unpair n).1 (a_1 + (unpair n).2)) ∧
        ∀ {m : ℕ}, m < a_1 → ∃ a_3 ∈ a.eval (Nat.pair (unpair n).1 (m + (unpair n).2)), ¬a_3 = 0) ∧
      a_1 + (unpair n).2 = x
have h₁ : ∃ (a_1 : ℕ),
  evaln (k + 1) a n = some a_1 ∧
    (if a_1 = 0 then some (unpair n).2 else evaln k a.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x
Tactic: obtain ⟨_, h⟩ := h
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
cf cg : Code
hf : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) cf n), x ∈ cf.eval n
hg : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) cg n), x ∈ cg.eval n
n x : ℕ
left : n ≤ k
h : ∃ (a : ℕ), evaln (k + 1) cf n = some a ∧ ∃ (a_1 : ℕ), evaln (k + 1) cg n = some a_1 ∧ Nat.pair a a_1 = x
⊢ ∃ a ∈ cf.eval n, ∃ a_1 ∈ cg.eval n, Nat.pair a a_1 = x
have rcases : ∀ (y : ℕ) (ef : evaln (k + 1) cf n = some y) (z : ℕ) (eg : evaln (k + 1) cg n = some z),
  ∃ a ∈ cf.eval n, ∃ a_1 ∈ cg.eval n, Nat.pair a a_1 = Nat.pair y z
Tactic: rcases h with ⟨y, ef, z, eg, rfl⟩
Cleared hypotheses: x, h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
cf cg : Code
hf : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) cf n), x ∈ cf.eval n
hg : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) cg n), x ∈ cg.eval n
n x : ℕ
left : n ≤ k
h : ∃ (a : ℕ), evaln (k + 1) cg n = some a ∧ evaln (k + 1) cf a = some x
⊢ ∃ a ∈ cg.eval n, x ∈ cf.eval a
have rcases : ∀ (y : ℕ) (eg : evaln (k + 1) cg n = some y) (ef : evaln (k + 1) cf y = some x), ∃ a ∈ cg.eval n, x ∈ cf.eval a
Tactic: rcases h with ⟨y, eg, ef⟩
Cleared hypotheses: h
-- Lean 4 proof step from Mathlib.Computability.PartrecCode (goal)
Goal:
k : ℕ
cf cg : Code
hf : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) cf n), x ∈ cf.eval n
hg : ∀ (n x : ℕ) (h : x ∈ evaln (k + 1) cg n), x ∈ cg.eval n
n x : ℕ
left : n ≤ k
h :
  Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k + 1) cf (unpair n).1)
      (fun (n_1 : ℕ) (n_ih : Option ℕ) ↦
        (evaln k (cf.prec cg) (Nat.pair (unpair n).1 n_1)).bind fun (i : ℕ) ↦
          evaln (k + 1) cg (Nat.pair (unpair n).1 (Nat.pair n_1 i)))
      (unpair n).2 =
    some x
⊢ Membership.mem (γ := Part ℕ)
    (Nat.rec (motive := fun (x : ℕ) ↦ Part ℕ) (cf.eval (unpair n).1)
        (fun (y : ℕ) (IH : Part ℕ) ↦ IH.bind fun (i : ℕ) ↦ cg.eval (Nat.pair (unpair n).1 (Nat.pair y i)))
        (unpair n).2 :
      Part ℕ)
    x
have revert : ∀
  (h :
    Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k + 1) cf (unpair n).1)
        (fun (n_1 : ℕ) (n_ih : Option ℕ) ↦
          (evaln k (cf.prec cg) (Nat.pair (unpair n).1 n_1)).bind fun (i : ℕ) ↦
            evaln (k + 1) cg (Nat.pair (unpair n).1 (Nat.pair n_1 i)))
        (unpair n).2 =
      some x),
  Membership.mem (γ := Part ℕ)
    (Nat.rec (motive := fun (x : ℕ) ↦ Part ℕ) (cf.eval (unpair n).1)
        (fun (y : ℕ) (IH : Part ℕ) ↦ IH.bind fun (i : ℕ) ↦ cg.eval (Nat.pair (unpair n).1 (Nat.pair y i)))
        (unpair n).2 :
      Part ℕ)
    x
Tactic: revert h
Cleared hypotheses: h