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
a : Code
a_ih : ∀ (n x : ℕ) (h : evaln (k + 1) a n = some x), evaln (k₂ + 1) a n = some x
n x : ℕ
h :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          unpaired
              (fun (a_1 m : ℕ) ↦ do
                let x ← evaln (k + 1) a (Nat.pair a_1 m)
                if x = 0 then pure m else evaln k a.rfind' (Nat.pair a_1 (m + 1)))
              n :
          Option ℕ))
      n =
    some x
⊢ (fun (n : ℕ) ↦
        (do
          guard (n ≤ k₂)
          unpaired
              (fun (a_1 m : ℕ) ↦ do
                let x ← evaln (k₂ + 1) a (Nat.pair a_1 m)
                if x = 0 then pure m else evaln k₂ a.rfind' (Nat.pair a_1 (m + 1)))
              n :
          Option ℕ))
      n =
    some x
have rfind' : ∀
  (h :
    Membership.mem (γ := Option ℕ)
      (unpaired
        (fun (a_1 m : ℕ) ↦ do
          let x ← evaln (k + 1) a (Nat.pair a_1 m)
          if x = 0 then pure m else evaln k a.rfind' (Nat.pair a_1 (m + 1)))
        n)
      x),
  Membership.mem (γ := Option ℕ)
    (unpaired
      (fun (a_1 m : ℕ) ↦ do
        let x ← evaln (k₂ + 1) a (Nat.pair a_1 m)
        if x = 0 then pure m else evaln k₂ a.rfind' (Nat.pair a_1 (m + 1)))
      n)
    x
Tactic: refine this hl' (fun h => ?_) h
-- 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 cg : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
hg : ∀ (n x : ℕ) (h : evaln (k + 1) cg n = some x), evaln (k₂ + 1) cg n = some x
n x : ℕ
h_1 :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          Nat.pair <$> evaln (k + 1) cf n <*> evaln (k + 1) cg n : Option ℕ))
      n =
    some x
h : x ∈ Nat.pair <$> evaln (k + 1) cf n <*> evaln (k + 1) cg n
⊢ x ∈ Nat.pair <$> evaln (k₂ + 1) cf n <*> evaln (k₂ + 1) cg n
have simp : ∀ (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 : ℕ), evaln (k₂ + 1) cf n = some a ∧ ∃ (a_1 : ℕ), evaln (k₂ + 1) cg n = some a_1 ∧ Nat.pair a a_1 = x
Tactic: simp only [Seq.seq, Option.map_eq_map, Option.mem_def, Option.bind_eq_some_iff,
          Option.map_eq_some_iff, exists_exists_and_eq_and] at h ⊢
Cleared hypotheses: h
-- 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 cg : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
hg : ∀ (n x : ℕ) (h : evaln (k + 1) cg n = some x), evaln (k₂ + 1) cg n = some x
n x : ℕ
h_1 :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          Nat.pair <$> evaln (k + 1) cf n <*> evaln (k + 1) cg n : Option ℕ))
      n =
    some x
h : x ∈ Nat.pair <$> evaln (k + 1) cf n <*> evaln (k + 1) cg n
⊢ x ∈ Nat.pair <$> evaln (k₂ + 1) cf n <*> evaln (k₂ + 1) cg n
have simp? : ∀ (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 : ℕ), evaln (k₂ + 1) cf n = some a ∧ ∃ (a_1 : ℕ), evaln (k₂ + 1) cg n = some a_1 ∧ Nat.pair a a_1 = x
Tactic: simp? [Seq.seq, Option.bind_eq_some_iff] at h ⊢ says
        simp only [Seq.seq, Option.map_eq_map, Option.mem_def, Option.bind_eq_some_iff,
          Option.map_eq_some_iff, exists_exists_and_eq_and] at h ⊢
Cleared hypotheses: h
-- 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 cg : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
hg : ∀ (n x : ℕ) (h : evaln (k + 1) cg n = some x), evaln (k₂ + 1) cg n = some x
n x : ℕ
h_1 :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          let x ← evaln (k + 1) cg n
          evaln (k + 1) cf x : Option ℕ))
      n =
    some x
h :
  Membership.mem (γ := Option ℕ)
    (do
      let x ← evaln (k + 1) cg n
      evaln (k + 1) cf x)
    x
⊢ Membership.mem (γ := Option ℕ)
    (do
      let x ← evaln (k₂ + 1) cg n
      evaln (k₂ + 1) cf x)
    x
have simp : ∀ (h : ∃ (a : ℕ), evaln (k + 1) cg n = some a ∧ evaln (k + 1) cf a = some x),
  ∃ (a : ℕ), evaln (k₂ + 1) cg n = some a ∧ evaln (k₂ + 1) cf a = some x
Tactic: simp only [bind, Option.mem_def, Option.bind_eq_some_iff] at h ⊢
Cleared hypotheses: h
-- 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 cg : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
hg : ∀ (n x : ℕ) (h : evaln (k + 1) cg n = some x), evaln (k₂ + 1) cg n = some x
n x : ℕ
h_1 :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          let x ← evaln (k + 1) cg n
          evaln (k + 1) cf x : Option ℕ))
      n =
    some x
h :
  Membership.mem (γ := Option ℕ)
    (do
      let x ← evaln (k + 1) cg n
      evaln (k + 1) cf x)
    x
⊢ Membership.mem (γ := Option ℕ)
    (do
      let x ← evaln (k₂ + 1) cg n
      evaln (k₂ + 1) cf x)
    x
have simp? : ∀ (h : ∃ (a : ℕ), evaln (k + 1) cg n = some a ∧ evaln (k + 1) cf a = some x),
  ∃ (a : ℕ), evaln (k₂ + 1) cg n = some a ∧ evaln (k₂ + 1) cf a = some x
Tactic: simp? [Bind.bind, Option.bind_eq_some_iff] at h ⊢ says
        simp only [bind, Option.mem_def, Option.bind_eq_some_iff] at h ⊢
Cleared hypotheses: h
-- 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 cg : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
hg : ∀ (n x : ℕ) (h : evaln (k + 1) cg n = some x), evaln (k₂ + 1) cg n = some x
n x : ℕ
h_1 :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          unpaired
              (fun (a n : ℕ) ↦
                Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k + 1) cf a) fun (y : ℕ) ↦ do
                  let i ← evaln k (cf.prec cg) (Nat.pair a y)
                  evaln (k + 1) cg (Nat.pair a (Nat.pair y i)))
              n :
          Option ℕ))
      n =
    some x
h :
  Membership.mem (γ := Option ℕ)
    (unpaired
      (fun (a n : ℕ) ↦
        Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k + 1) cf a) fun (y : ℕ) ↦ do
          let i ← evaln k (cf.prec cg) (Nat.pair a y)
          evaln (k + 1) cg (Nat.pair a (Nat.pair y i)))
      n)
    x
⊢ Membership.mem (γ := Option ℕ)
    (unpaired
      (fun (a n : ℕ) ↦
        Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k₂ + 1) cf a) fun (y : ℕ) ↦ do
          let i ← evaln k₂ (cf.prec cg) (Nat.pair a y)
          evaln (k₂ + 1) cg (Nat.pair a (Nat.pair y i)))
      n)
    x
have revert : ∀
  (h :
    Membership.mem (γ := Option ℕ)
      (unpaired
        (fun (a n : ℕ) ↦
          Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k + 1) cf a) fun (y : ℕ) ↦ do
            let i ← evaln k (cf.prec cg) (Nat.pair a y)
            evaln (k + 1) cg (Nat.pair a (Nat.pair y i)))
        n)
      x),
  Membership.mem (γ := Option ℕ)
    (unpaired
      (fun (a n : ℕ) ↦
        Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k₂ + 1) cf a) fun (y : ℕ) ↦ do
          let i ← evaln k₂ (cf.prec cg) (Nat.pair a y)
          evaln (k₂ + 1) cg (Nat.pair a (Nat.pair y i)))
      n)
    x
Tactic: revert h
Cleared hypotheses: h
-- 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 cg : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
hg : ∀ (n x : ℕ) (h : evaln (k + 1) cg n = some x), evaln (k₂ + 1) cg n = some x
n x : ℕ
h :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          unpaired
              (fun (a n : ℕ) ↦
                Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k + 1) cf a) fun (y : ℕ) ↦ do
                  let i ← evaln k (cf.prec cg) (Nat.pair a y)
                  evaln (k + 1) cg (Nat.pair a (Nat.pair y i)))
              n :
          Option ℕ))
      n =
    some x
⊢ ∀
    (h :
      Membership.mem (γ := Option ℕ)
        (unpaired
          (fun (a n : ℕ) ↦
            Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k + 1) cf a) fun (y : ℕ) ↦ do
              let i ← evaln k (cf.prec cg) (Nat.pair a y)
              evaln (k + 1) cg (Nat.pair a (Nat.pair y i)))
          n)
        x),
    Membership.mem (γ := Option ℕ)
      (unpaired
        (fun (a n : ℕ) ↦
          Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k₂ + 1) cf a) fun (y : ℕ) ↦ do
            let i ← evaln k₂ (cf.prec cg) (Nat.pair a y)
            evaln (k₂ + 1) cg (Nat.pair a (Nat.pair y i)))
        n)
      x
have simp : ∀
  (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),
  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
Tactic: simp only [unpaired, bind, Option.mem_def]
-- 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 cg : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
hg : ∀ (n x : ℕ) (h : evaln (k + 1) cg n = some x), evaln (k₂ + 1) cg n = some x
n x : ℕ
h :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          unpaired
              (fun (a n : ℕ) ↦
                Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k + 1) cf a) fun (y : ℕ) ↦ do
                  let i ← evaln k (cf.prec cg) (Nat.pair a y)
                  evaln (k + 1) cg (Nat.pair a (Nat.pair y i)))
              n :
          Option ℕ))
      n =
    some x
⊢ ∀
    (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),
    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
have zero : ∀
  (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)))
        0 =
      some x),
  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)))
      0 =
    some x
Tactic: induction n.unpair.2
-- 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 cg : Code
hf : ∀ (n x : ℕ) (h : evaln (k + 1) cf n = some x), evaln (k₂ + 1) cf n = some x
hg : ∀ (n x : ℕ) (h : evaln (k + 1) cg n = some x), evaln (k₂ + 1) cg n = some x
n x : ℕ
h :
  (fun (n : ℕ) ↦
        (do
          guard (n ≤ k)
          unpaired
              (fun (a n : ℕ) ↦
                Nat.casesOn (motive := fun (x : ℕ) ↦ Option ℕ) n (evaln (k + 1) cf a) fun (y : ℕ) ↦ do
                  let i ← evaln k (cf.prec cg) (Nat.pair a y)
                  evaln (k + 1) cg (Nat.pair a (Nat.pair y i)))
              n :
          Option ℕ))
      n =
    some x
n_1 : ℕ
h_1 :
  ∀
    (h :
      Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k + 1) cf (unpair n).1)
          (fun (n_2 : ℕ) (n_ih : Option ℕ) ↦
            (evaln k (cf.prec cg) (Nat.pair (unpair n).1 n_2)).bind fun (i : ℕ) ↦
              evaln (k + 1) cg (Nat.pair (unpair n).1 (Nat.pair n_2 i)))
          n_1 =
        some x),
    Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k₂ + 1) cf (unpair n).1)
        (fun (n_2 : ℕ) (n_ih : Option ℕ) ↦
          (evaln k₂ (cf.prec cg) (Nat.pair (unpair n).1 n_2)).bind fun (i : ℕ) ↦
            evaln (k₂ + 1) cg (Nat.pair (unpair n).1 (Nat.pair n_2 i)))
        n_1 =
      some x
⊢ ∀
    (h :
      Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k + 1) cf (unpair n).1)
          (fun (n_2 : ℕ) (n_ih : Option ℕ) ↦
            (evaln k (cf.prec cg) (Nat.pair (unpair n).1 n_2)).bind fun (i : ℕ) ↦
              evaln (k + 1) cg (Nat.pair (unpair n).1 (Nat.pair n_2 i)))
          (n_1 + 1) =
        some x),
    Nat.rec (motive := fun (x : ℕ) ↦ Option ℕ) (evaln (k₂ + 1) cf (unpair n).1)
        (fun (n_2 : ℕ) (n_ih : Option ℕ) ↦
          (evaln k₂ (cf.prec cg) (Nat.pair (unpair n).1 n_2)).bind fun (i : ℕ) ↦
            evaln (k₂ + 1) cg (Nat.pair (unpair n).1 (Nat.pair n_2 i)))
        (n_1 + 1) =
      some x
have succ : ∀ (x_1 : ℕ),
  evaln k (cf.prec cg) (Nat.pair (unpair n).1 n_1) = some x_1 →
    evaln (k + 1) cg (Nat.pair (unpair n).1 (Nat.pair n_1 x_1)) = some x →
      ∃ (a : ℕ),
        evaln k₂ (cf.prec cg) (Nat.pair (unpair n).1 n_1) = some a ∧
          evaln (k₂ + 1) cg (Nat.pair (unpair n).1 (Nat.pair n_1 a)) = some x
Tactic: simp [Option.bind_eq_some_iff]
-- 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 : ℕ
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
h :
  Membership.mem (γ := Option ℕ)
    (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)
    x
⊢ Membership.mem (γ := Option ℕ)
    (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)
    x
have simp : ∀
  (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),
  ∃ (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
Tactic: simp only [unpaired, bind, pair_unpair, Option.pure_def, Option.mem_def,
          Option.bind_eq_some_iff] at h ⊢
Cleared hypotheses: h
-- 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 : ℕ
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
h :
  Membership.mem (γ := Option ℕ)
    (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)
    x
⊢ Membership.mem (γ := Option ℕ)
    (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)
    x
have simp? : ∀
  (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),
  ∃ (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
Tactic: simp? [Bind.bind, Option.bind_eq_some_iff] at h ⊢ says
        simp only [unpaired, bind, pair_unpair, Option.pure_def, Option.mem_def,
          Option.bind_eq_some_iff] at h ⊢
Cleared hypotheses: h
-- 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 : ℕ
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
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
⊢ ∃ (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
have refine : ∀ (x_1 : ℕ),
  (if x_1 = 0 then some (unpair n).2 else evaln k cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x →
    (if x_1 = 0 then some (unpair n).2 else evaln k₂ cf.rfind' (Nat.pair (unpair n).1 ((unpair n).2 + 1))) = some x
Tactic: refine h.imp fun x => And.imp (hf _ _) ?_
-- 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 : ℕ
⊢ (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 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
Tactic: by_cases x0 : x = 0