Theorem: Turing.ToPartrec.stepNormal_then
File: Mathlib/Computability/TMToPartrec.lean

tactic: induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
  try { simp only [Cfg.then]; done }
state_before: c : Code
k k' : Cont
v : List ℕ
⊢ stepNormal c (Cont.then k k') v = Cfg.then (stepNormal c k v) k'

tactic: case cons c c' ih _ => rw [← ih, Cont.then]
state_before: case cons
k' : Cont
a✝¹ a✝ : Code
a_ih✝¹ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝¹ (Cont.then k k') v = Cfg.then (stepNormal a✝¹ k v) k'
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝ (Cont.then k k') v = Cfg.then (stepNormal a✝ k v) k'
k : Cont
v : List ℕ
⊢ stepNormal a✝¹ (Cont.cons₁ a✝ v (Cont.then k k')) v = Cfg.then (stepNormal a✝¹ (Cont.cons₁ a✝ v k) v) k'

case comp
k' : Cont
a✝¹ a✝ : Code
a_ih✝¹ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝¹ (Cont.then k k') v = Cfg.then (stepNormal a✝¹ k v) k'
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝ (Cont.then k k') v = Cfg.then (stepNormal a✝ k v) k'
k : Cont
v : List ℕ
⊢ stepNormal a✝ (Cont.comp a✝¹ (Cont.then k k')) v = Cfg.then (stepNormal a✝ (Cont.comp a✝¹ k) v) k'

case case
k' : Cont
a✝¹ a✝ : Code
a_ih✝¹ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝¹ (Cont.then k k') v = Cfg.then (stepNormal a✝¹ k v) k'
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝ (Cont.then k k') v = Cfg.then (stepNormal a✝ k v) k'
k : Cont
v : List ℕ
⊢ Nat.rec (Cfg.then (stepNormal a✝¹ k (List.tail v)) k') (fun y x => Cfg.then (stepNormal a✝ k (y :: List.tail v)) k')
      (List.headI v) =
    Cfg.then (Nat.rec (stepNormal a✝¹ k (List.tail v)) (fun y x => stepNormal a✝ k (y :: List.tail v)) (List.headI v))
      k'

case fix
k' : Cont
a✝ : Code
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝ (Cont.then k k') v = Cfg.then (stepNormal a✝ k v) k'
k : Cont
v : List ℕ
⊢ stepNormal a✝ (Cont.fix a✝ (Cont.then k k')) v = Cfg.then (stepNormal a✝ (Cont.fix a✝ k) v) k'

tactic: case comp c c' _ ih' => rw [← ih', Cont.then]
state_before: case comp
k' : Cont
a✝¹ a✝ : Code
a_ih✝¹ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝¹ (Cont.then k k') v = Cfg.then (stepNormal a✝¹ k v) k'
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝ (Cont.then k k') v = Cfg.then (stepNormal a✝ k v) k'
k : Cont
v : List ℕ
⊢ stepNormal a✝ (Cont.comp a✝¹ (Cont.then k k')) v = Cfg.then (stepNormal a✝ (Cont.comp a✝¹ k) v) k'

case case
k' : Cont
a✝¹ a✝ : Code
a_ih✝¹ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝¹ (Cont.then k k') v = Cfg.then (stepNormal a✝¹ k v) k'
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝ (Cont.then k k') v = Cfg.then (stepNormal a✝ k v) k'
k : Cont
v : List ℕ
⊢ Nat.rec (Cfg.then (stepNormal a✝¹ k (List.tail v)) k') (fun y x => Cfg.then (stepNormal a✝ k (y :: List.tail v)) k')
      (List.headI v) =
    Cfg.then (Nat.rec (stepNormal a✝¹ k (List.tail v)) (fun y x => stepNormal a✝ k (y :: List.tail v)) (List.headI v))
      k'

case fix
k' : Cont
a✝ : Code
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝ (Cont.then k k') v = Cfg.then (stepNormal a✝ k v) k'
k : Cont
v : List ℕ
⊢ stepNormal a✝ (Cont.fix a✝ (Cont.then k k')) v = Cfg.then (stepNormal a✝ (Cont.fix a✝ k) v) k'

tactic: case fix c ih => rw [← ih, Cont.then]
state_before: case fix
k' : Cont
a✝ : Code
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝ (Cont.then k k') v = Cfg.then (stepNormal a✝ k v) k'
k : Cont
v : List ℕ
⊢ stepNormal a✝ (Cont.fix a✝ (Cont.then k k')) v = Cfg.then (stepNormal a✝ (Cont.fix a✝ k) v) k'

tactic: rw [← ih, Cont.then]
state_before: k' : Cont
c c' : Code
ih : ∀ (k : Cont) (v : List ℕ), stepNormal c (Cont.then k k') v = Cfg.then (stepNormal c k v) k'
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal c' (Cont.then k k') v = Cfg.then (stepNormal c' k v) k'
k : Cont
v : List ℕ
⊢ stepNormal c (Cont.cons₁ c' v (Cont.then k k')) v = Cfg.then (stepNormal c (Cont.cons₁ c' v k) v) k'

tactic: rw [← ih', Cont.then]
state_before: k' : Cont
c c' : Code
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal c (Cont.then k k') v = Cfg.then (stepNormal c k v) k'
ih' : ∀ (k : Cont) (v : List ℕ), stepNormal c' (Cont.then k k') v = Cfg.then (stepNormal c' k v) k'
k : Cont
v : List ℕ
⊢ stepNormal c' (Cont.comp c (Cont.then k k')) v = Cfg.then (stepNormal c' (Cont.comp c k) v) k'

tactic: cases v.headI <;> simp only [Nat.rec]
state_before: case case
k' : Cont
a✝¹ a✝ : Code
a_ih✝¹ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝¹ (Cont.then k k') v = Cfg.then (stepNormal a✝¹ k v) k'
a_ih✝ : ∀ (k : Cont) (v : List ℕ), stepNormal a✝ (Cont.then k k') v = Cfg.then (stepNormal a✝ k v) k'
k : Cont
v : List ℕ
⊢ Nat.rec (Cfg.then (stepNormal a✝¹ k (List.tail v)) k') (fun y x => Cfg.then (stepNormal a✝ k (y :: List.tail v)) k')
      (List.headI v) =
    Cfg.then (Nat.rec (stepNormal a✝¹ k (List.tail v)) (fun y x => stepNormal a✝ k (y :: List.tail v)) (List.headI v))
      k'

tactic: rw [← ih, Cont.then]
state_before: k' : Cont
c : Code
ih : ∀ (k : Cont) (v : List ℕ), stepNormal c (Cont.then k k') v = Cfg.then (stepNormal c k v) k'
k : Cont
v : List ℕ
⊢ stepNormal c (Cont.fix c (Cont.then k k')) v = Cfg.then (stepNormal c (Cont.fix c k) v) k'