Theorem: Primrec.nat_strong_rec
File: Mathlib/Computability/Primrec.lean

tactic: simp [List.getElem?_range (Nat.lt_succ_self n)]
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
σ : Type u_4
inst✝³ : Primcodable α
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ
f : α → ℕ → σ
g : α → List σ → Option σ
hg : Primrec₂ g
H : ∀ (a : α) (n : ℕ), g a (List.map (f a) (List.range n)) = some (f a n)
this : Primrec₂ fun a n => List.map (f a) (List.range n)
a : α
n : ℕ
⊢ (List.map (f (a, n).1) (List.range (a, n).2.succ)).get? (a, n).2 = some (f a n)
state_after: no goals

tactic: simp
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
σ : Type u_4
inst✝³ : Primcodable α
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ
f : α → ℕ → σ
g : α → List σ → Option σ
hg : Primrec₂ g
H : ∀ (a : α) (n : ℕ), g a (List.map (f a) (List.range n)) = some (f a n)
a : α
n : ℕ
⊢ Nat.rec (some [])
      (fun n IH =>
        (a, n, IH).2.2.bind fun b =>
          Option.map (fun b_1 => (((a, n, IH), b), b_1).1.2 ++ [(((a, n, IH), b), b_1).2])
            (g ((a, n, IH), b).1.1 ((a, n, IH), b).2))
      n =
    some (List.map (f a) (List.range n))
state_after: α : Type u_1
β : Type u_2
γ : Type u_3
σ : Type u_4
inst✝³ : Primcodable α
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ
f : α → ℕ → σ
g : α → List σ → Option σ
hg : Primrec₂ g
H : ∀ (a : α) (n : ℕ), g a (List.map (f a) (List.range n)) = some (f a n)
a : α
n : ℕ
⊢ Nat.rec (some []) (fun n IH => IH.bind fun a_1 => Option.map (fun b => a_1 ++ [b]) (g a a_1)) n =
    some (List.map (f a) (List.range n))

tactic: induction' n with n IH
state_before: α : Type u_1
β : Type u_2
γ : Type u_3
σ : Type u_4
inst✝³ : Primcodable α
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ
f : α → ℕ → σ
g : α → List σ → Option σ
hg : Primrec₂ g
H : ∀ (a : α) (n : ℕ), g a (List.map (f a) (List.range n)) = some (f a n)
a : α
n : ℕ
⊢ Nat.rec (some []) (fun n IH => IH.bind fun a_1 => Option.map (fun b => a_1 ++ [b]) (g a a_1)) n =
    some (List.map (f a) (List.range n))
state_after: case zero
α : Type u_1
β : Type u_2
γ : Type u_3
σ : Type u_4
inst✝³ : Primcodable α
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ
f : α → ℕ → σ
g : α → List σ → Option σ
hg : Primrec₂ g
H : ∀ (a : α) (n : ℕ), g a (List.map (f a) (List.range n)) = some (f a n)
a : α
⊢ Nat.rec (some []) (fun n IH => IH.bind fun a_1 => Option.map (fun b => a_1 ++ [b]) (g a a_1)) 0 =
    some (List.map (f a) (List.range 0))

case succ
α : Type u_1
β : Type u_2
γ : Type u_3
σ : Type u_4
inst✝³ : Primcodable α
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ
f : α → ℕ → σ
g : α → List σ → Option σ
hg : Primrec₂ g
H : ∀ (a : α) (n : ℕ), g a (List.map (f a) (List.range n)) = some (f a n)
a : α
n : ℕ
IH :
  Nat.rec (some []) (fun n IH => IH.bind fun a_1 => Option.map (fun b => a_1 ++ [b]) (g a a_1)) n =
    some (List.map (f a) (List.range n))
⊢ Nat.rec (some []) (fun n IH => IH.bind fun a_1 => Option.map (fun b => a_1 ++ [b]) (g a a_1)) (n + 1) =
    some (List.map (f a) (List.range (n + 1)))

tactic: simp [IH, H, List.range_succ]
state_before: case succ
α : Type u_1
β : Type u_2
γ : Type u_3
σ : Type u_4
inst✝³ : Primcodable α
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ
f : α → ℕ → σ
g : α → List σ → Option σ
hg : Primrec₂ g
H : ∀ (a : α) (n : ℕ), g a (List.map (f a) (List.range n)) = some (f a n)
a : α
n : ℕ
IH :
  Nat.rec (some []) (fun n IH => IH.bind fun a_1 => Option.map (fun b => a_1 ++ [b]) (g a a_1)) n =
    some (List.map (f a) (List.range n))
⊢ Nat.rec (some []) (fun n IH => IH.bind fun a_1 => Option.map (fun b => a_1 ++ [b]) (g a a_1)) (n + 1) =
    some (List.map (f a) (List.range (n + 1)))
state_after: no goals

tactic: rfl
state_before: case zero
α : Type u_1
β : Type u_2
γ : Type u_3
σ : Type u_4
inst✝³ : Primcodable α
inst✝² : Primcodable β
inst✝¹ : Primcodable γ
inst✝ : Primcodable σ
f : α → ℕ → σ
g : α → List σ → Option σ
hg : Primrec₂ g
H : ∀ (a : α) (n : ℕ), g a (List.map (f a) (List.range n)) = some (f a n)
a : α
⊢ Nat.rec (some []) (fun n IH => IH.bind fun a_1 => Option.map (fun b => a_1 ++ [b]) (g a a_1)) 0 =
    some (List.map (f a) (List.range 0))
state_after: no goals