l3lab/ntp-mathlib huggingface dataset:
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  

Proof state:
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'

Next tactic:
case cons c c' ih _ => rw [← ih, Cont.then]
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => 

Proof state:
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'

Next tactic:
rw [← ih, Cont.then]
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => rw [← ih, Cont.then]
  

Proof state:
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'

Next tactic:
case comp c c' _ ih' => rw [← ih', Cont.then]
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => rw [← ih, Cont.then]
  

Proof state:
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'

Next tactic:
case comp c c' _ ih' => rw [← ih', Cont.then]
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => rw [← ih, Cont.then]
  case comp c c' _ ih' => 

Proof state:
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'

Next tactic:
rw [← ih', Cont.then]
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => rw [← ih, Cont.then]
  case comp c c' _ ih' => rw [← ih', Cont.then]
  · 

Proof state:
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'

Next tactic:
cases v.headI
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => rw [← ih, Cont.then]
  case comp c c' _ ih' => rw [← ih', Cont.then]
  · cases v.headI <;> 

Proof state:
case case.zero
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')
      Nat.zero =
    Cfg.then (Nat.rec (stepNormal a✝¹ k (List.tail v)) (fun y x => stepNormal a✝ k (y :: List.tail v)) Nat.zero) k'

Next tactic:
simp only [Nat.rec]
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => rw [← ih, Cont.then]
  case comp c c' _ ih' => rw [← ih', Cont.then]
  · cases v.headI <;> 

Proof state:
case case.succ
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 ℕ
n✝ : ℕ
⊢ Nat.rec (Cfg.then (stepNormal a✝¹ k (List.tail v)) k') (fun y x => Cfg.then (stepNormal a✝ k (y :: List.tail v)) k')
      (Nat.succ n✝) =
    Cfg.then (Nat.rec (stepNormal a✝¹ k (List.tail v)) (fun y x => stepNormal a✝ k (y :: List.tail v)) (Nat.succ n✝)) k'

Next tactic:
simp only [Nat.rec]
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => rw [← ih, Cont.then]
  case comp c c' _ ih' => rw [← ih', Cont.then]
  · cases v.headI <;> simp only [Nat.rec]
  

Proof state:
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'

Next tactic:
case fix c ih => rw [← ih, Cont.then]
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => rw [← ih, Cont.then]
  case comp c c' _ ih' => rw [← ih', Cont.then]
  · cases v.headI <;> simp only [Nat.rec]
  

Proof state:
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'

Next tactic:
case fix c ih => rw [← ih, Cont.then]
/-- The `stepNormal` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepNormal_then (c) (k k' : Cont) (v) :
    stepNormal c (k.then k') v = (stepNormal c k v).then k' := by
  induction c generalizing k v <;> simp only [Cont.then, stepNormal, *] <;>
    try { simp only [Cfg.then]; done }
  case cons c c' ih _ => rw [← ih, Cont.then]
  case comp c c' _ ih' => rw [← ih', Cont.then]
  · cases v.headI <;> simp only [Nat.rec]
  case fix c ih => 

Proof state:
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'

Next tactic:
rw [← ih, Cont.then]
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  

Proof state:
k k' : Cont
v : List ℕ
⊢ stepRet (Cont.then k k') v = Cfg.then (stepRet k v) k'

Next tactic:
induction k generalizing v
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> 

Proof state:
case halt
k' : Cont
v : List ℕ
⊢ stepRet (Cont.then Cont.halt k') v = Cfg.then (stepRet Cont.halt v) k'

Next tactic:
simp only [Cont.then, stepRet, *]
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> 

Proof state:
case cons₁
k' : Cont
a✝² : Code
a✝¹ : List ℕ
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ stepRet (Cont.then (Cont.cons₁ a✝² a✝¹ a✝) k') v = Cfg.then (stepRet (Cont.cons₁ a✝² a✝¹ a✝) v) k'

Next tactic:
simp only [Cont.then, stepRet, *]
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> 

Proof state:
case cons₂
k' : Cont
a✝¹ : List ℕ
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ stepRet (Cont.then (Cont.cons₂ a✝¹ a✝) k') v = Cfg.then (stepRet (Cont.cons₂ a✝¹ a✝) v) k'

Next tactic:
simp only [Cont.then, stepRet, *]
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> 

Proof state:
case comp
k' : Cont
a✝¹ : Code
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ stepRet (Cont.then (Cont.comp a✝¹ a✝) k') v = Cfg.then (stepRet (Cont.comp a✝¹ a✝) v) k'

Next tactic:
simp only [Cont.then, stepRet, *]
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> 

Proof state:
case fix
k' : Cont
a✝¹ : Code
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ stepRet (Cont.then (Cont.fix a✝¹ a✝) k') v = Cfg.then (stepRet (Cont.fix a✝¹ a✝) v) k'

Next tactic:
simp only [Cont.then, stepRet, *]
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    

Proof state:
case halt
k' : Cont
v : List ℕ
⊢ stepRet k' v = Cfg.then (Cfg.halt v) k'

Next tactic:
try { simp only [Cfg.then]; done }
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    try 

Proof state:
case halt
k' : Cont
v : List ℕ
⊢ stepRet k' v = Cfg.then (Cfg.halt v) k'

Next tactic:
{ simp only [Cfg.then]; done }
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    try { 

Proof state:
case halt
k' : Cont
v : List ℕ
⊢ stepRet k' v = Cfg.then (Cfg.halt v) k'

Next tactic:
simp only [Cfg.then]
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    try { simp only [Cfg.then]; 

Proof state:

Next tactic:
done
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    

Proof state:
case cons₁
k' : Cont
a✝² : Code
a✝¹ : List ℕ
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ stepNormal a✝² (Cont.cons₂ v (Cont.then a✝ k')) a✝¹ = Cfg.then (stepNormal a✝² (Cont.cons₂ v a✝) a✝¹) k'

Next tactic:
try { simp only [Cfg.then]; done }
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    try 

Proof state:
case cons₁
k' : Cont
a✝² : Code
a✝¹ : List ℕ
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ stepNormal a✝² (Cont.cons₂ v (Cont.then a✝ k')) a✝¹ = Cfg.then (stepNormal a✝² (Cont.cons₂ v a✝) a✝¹) k'

Next tactic:
{ simp only [Cfg.then]; done }
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    try { 

Proof state:
case cons₁
k' : Cont
a✝² : Code
a✝¹ : List ℕ
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ stepNormal a✝² (Cont.cons₂ v (Cont.then a✝ k')) a✝¹ = Cfg.then (stepNormal a✝² (Cont.cons₂ v a✝) a✝¹) k'

Next tactic:
simp only [Cfg.then]
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    try { simp only [Cfg.then]; 

Proof state:
case cons₁
k' : Cont
a✝² : Code
a✝¹ : List ℕ
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ stepNormal a✝² (Cont.cons₂ v (Cont.then a✝ k')) a✝¹ =
    (match (motive := Cfg → Cont → Cfg) stepNormal a✝² (Cont.cons₂ v a✝) a✝¹ with
      | Cfg.halt v => fun k' => stepRet k' v
      | Cfg.ret k v => fun k' => Cfg.ret (Cont.then k k') v)
      k'

Next tactic:
done
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    

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

Next tactic:
try { simp only [Cfg.then]; done }
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    try 

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

Next tactic:
{ simp only [Cfg.then]; done }
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    try { 

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

Next tactic:
simp only [Cfg.then]
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    try { simp only [Cfg.then]; 

Proof state:
case comp
k' : Cont
a✝¹ : Code
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ stepNormal a✝¹ (Cont.then a✝ k') v =
    (match (motive := Cfg → Cont → Cfg) stepNormal a✝¹ a✝ v with
      | Cfg.halt v => fun k' => stepRet k' v
      | Cfg.ret k v => fun k' => Cfg.ret (Cont.then k k') v)
      k'

Next tactic:
done
/-- The `stepRet` function respects the `then k'` homomorphism. Note that this is an exact
equality, not a simulation; the original and embedded machines move in lock-step until the
embedded machine reaches the halt state. -/
theorem stepRet_then {k k' : Cont} {v} : stepRet (k.then k') v = (stepRet k v).then k' := by
  induction k generalizing v <;> simp only [Cont.then, stepRet, *] <;>
    

Proof state:
case fix
k' : Cont
a✝¹ : Code
a✝ : Cont
a_ih✝ : ∀ {v : List ℕ}, stepRet (Cont.then a✝ k') v = Cfg.then (stepRet a✝ v) k'
v : List ℕ
⊢ (if List.headI v = 0 then Cfg.then (stepRet a✝ (List.tail v)) k'
    else stepNormal a✝¹ (Cont.fix a✝¹ (Cont.then a✝ k')) (List.tail v)) =
    Cfg.then (if List.headI v = 0 then stepRet a✝ (List.tail v) else stepNormal a✝¹ (Cont.fix a✝¹ a✝) (List.tail v)) k'

Next tactic:
try { simp only [Cfg.then]; done }