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 <;> 

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 ℕ
⊢ stepNormal (Code.case a✝¹ a✝) (Cont.then k k') v = Cfg.then (stepNormal (Code.case a✝¹ a✝) k v) k'

Next tactic:
simp only [Cont.then, stepNormal, *]
/-- 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 <;> 

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 (Code.fix a✝) (Cont.then k k') v = Cfg.then (stepNormal (Code.fix a✝) k v) k'

Next tactic:
simp only [Cont.then, stepNormal, *]
/-- 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, *] <;>
    

Proof state:
case zero'
k' k : Cont
v : List ℕ
⊢ Cfg.ret (Cont.then k k') (0 :: v) = Cfg.then (Cfg.ret k (0 :: v)) k'

Next tactic:
try { simp only [Cfg.then]; done }
/-- 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 

Proof state:
case zero'
k' k : Cont
v : List ℕ
⊢ Cfg.ret (Cont.then k k') (0 :: v) = Cfg.then (Cfg.ret k (0 :: v)) k'

Next tactic:
{ simp only [Cfg.then]; done }
/-- 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 { 

Proof state:
case zero'
k' k : Cont
v : List ℕ
⊢ Cfg.ret (Cont.then k k') (0 :: v) = Cfg.then (Cfg.ret k (0 :: v)) k'

Next tactic:
simp only [Cfg.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]; 

Proof state:

Next tactic:
done
/-- 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, *] <;>
    

Proof state:
case succ
k' k : Cont
v : List ℕ
⊢ Cfg.ret (Cont.then k k') [Nat.succ (List.headI v)] = Cfg.then (Cfg.ret k [Nat.succ (List.headI v)]) k'

Next tactic:
try { simp only [Cfg.then]; done }
/-- 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 

Proof state:
case succ
k' k : Cont
v : List ℕ
⊢ Cfg.ret (Cont.then k k') [Nat.succ (List.headI v)] = Cfg.then (Cfg.ret k [Nat.succ (List.headI v)]) k'

Next tactic:
{ simp only [Cfg.then]; done }
/-- 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 { 

Proof state:
case succ
k' k : Cont
v : List ℕ
⊢ Cfg.ret (Cont.then k k') [Nat.succ (List.headI v)] = Cfg.then (Cfg.ret k [Nat.succ (List.headI v)]) k'

Next tactic:
simp only [Cfg.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, *] <;>
    

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

Next tactic:
try { simp only [Cfg.then]; done }
/-- 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 

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

Next tactic:
{ simp only [Cfg.then]; done }
/-- 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 { 

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

Next tactic:
simp only [Cfg.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, *] <;>
    

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

Next tactic:
try { simp only [Cfg.then]; done }
/-- 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 

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

Next tactic:
{ simp only [Cfg.then]; done }
/-- 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 { 

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

Next tactic:
simp only [Cfg.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]; 

Proof state:
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 =
    (match (motive := Cfg → Cont → Cfg) stepNormal a✝¹ (Cont.cons₁ a✝ v k) 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 `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, *] <;>
    

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'

Next tactic:
try { simp only [Cfg.then]; done }
/-- 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 

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'

Next tactic:
{ simp only [Cfg.then]; done }
/-- 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 { 

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'

Next tactic:
simp only [Cfg.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]; 

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 =
    (match (motive := Cfg → Cont → Cfg) stepNormal a✝ (Cont.comp a✝¹ k) 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 `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, *] <;>
    

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:
try { simp only [Cfg.then]; done }
/-- 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 

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:
{ simp only [Cfg.then]; done }
/-- 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 { 

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:
simp only [Cfg.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]; 

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
      ((match (motive := Cfg → Cont → Cfg) stepNormal a✝¹ k (List.tail v) with
        | Cfg.halt v => fun k' => stepRet k' v
        | Cfg.ret k v => fun k' => Cfg.ret (Cont.then k k') v)
        k')
      (fun y x =>
        (match (motive := Cfg → Cont → Cfg) stepNormal a✝ k (y :: List.tail v) with
          | Cfg.halt v => fun k' => stepRet k' v
          | Cfg.ret k v => fun k' => Cfg.ret (Cont.then k k') v)
          k')
      (List.headI v) =
    (match (motive := Cfg → Cont → Cfg)
        Nat.rec (stepNormal a✝¹ k (List.tail v)) (fun y x => stepNormal a✝ k (y :: List.tail v)) (List.headI 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 `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, *] <;>
    

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:
try { simp only [Cfg.then]; done }
/-- 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 

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:
{ simp only [Cfg.then]; done }
/-- 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 { 

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:
simp only [Cfg.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]; 

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 =
    (match (motive := Cfg → Cont → Cfg) stepNormal a✝ (Cont.fix a✝ k) 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 `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:
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'

Next tactic:
case cons c c' ih _ => rw [← ih, Cont.then]