l3lab/ntp-mathlib huggingface dataset:
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · 

Proof state:
case neg
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
k' : K
i : ℕ
this : ((proj k').f ∘ fun a => update default k (some a)) = fun a => PointedMap.f (proj k') (update default k (some a))
h : ¬k' = k
⊢ Option.iget (Option.map (fun a => update default k (some a) k') (List.get? (List.reverse L) i)) =
    ListBlank.nth (ListBlank.mk (List.reverse (List.map some (update (fun x => []) k L k')))) i

Next tactic:
simp only [Function.update_noteq h]
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      

Proof state:
case neg
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
k' : K
i : ℕ
this : ((proj k').f ∘ fun a => update default k (some a)) = fun a => PointedMap.f (proj k') (update default k (some a))
h : ¬k' = k
⊢ Option.iget (Option.map (fun a => default k') (List.get? (List.reverse L) i)) =
    ListBlank.nth (ListBlank.mk (List.reverse (List.map some []))) i

Next tactic:
rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      

Proof state:
case neg
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
k' : K
i : ℕ
this : ((proj k').f ∘ fun a => update default k (some a)) = fun a => PointedMap.f (proj k') (update default k (some a))
h : ¬k' = k
⊢ Option.iget (Option.map (fun a => default k') (List.get? (List.reverse L) i)) = Option.iget (List.get? [] i)

Next tactic:
cases L.reverse.get? i
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> 

Proof state:
case neg.none
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
k' : K
i : ℕ
this : ((proj k').f ∘ fun a => update default k (some a)) = fun a => PointedMap.f (proj k') (update default k (some a))
h : ¬k' = k
⊢ Option.iget (Option.map (fun a => default k') none) = Option.iget (List.get? [] i)

Next tactic:
rfl
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> 

Proof state:
case neg.some
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
k' : K
i : ℕ
this : ((proj k').f ∘ fun a => update default k (some a)) = fun a => PointedMap.f (proj k') (update default k (some a))
h : ¬k' = k
val✝ : Γ k
⊢ Option.iget (Option.map (fun a => default k') (some val✝)) = Option.iget (List.get? [] i)

Next tactic:
rfl
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · 

Proof state:
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
⊢ TM1.init (trInit k L) =
    { l := Option.map normal (some default), var := default,
      Tape := Tape.mk' ∅ (addBottom (ListBlank.mk (List.map (fun a => update default k (some a)) (List.reverse L)))) }

Next tactic:
rw [trInit, TM1.init]
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    

Proof state:
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
⊢ { l := some default, var := default,
      Tape :=
        Tape.mk₁
          (let L' := List.map (fun a => (false, update (fun x => none) k (some a))) (List.reverse L);
          (true, (List.headI L').2) :: List.tail L') } =
    { l := Option.map normal (some default), var := default,
      Tape := Tape.mk' ∅ (addBottom (ListBlank.mk (List.map (fun a => update default k (some a)) (List.reverse L)))) }

Next tactic:
dsimp only
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    

Proof state:
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
⊢ { l := some default, var := default,
      Tape :=
        Tape.mk₁
          ((true, (List.headI (List.map (fun a => (false, update (fun x => none) k (some a))) (List.reverse L))).2) ::
            List.tail (List.map (fun a => (false, update (fun x => none) k (some a))) (List.reverse L))) } =
    { l := Option.map normal (some default), var := default,
      Tape := Tape.mk' ∅ (addBottom (ListBlank.mk (List.map (fun a => update default k (some a)) (List.reverse L)))) }

Next tactic:
congr
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    congr <;> 

Proof state:
case e_Tape.e_l.e_head.e_snd
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
⊢ (List.headI (List.map (fun a => (false, update (fun x => none) k (some a))) (List.reverse L))).2 =
    ListBlank.head (ListBlank.mk (List.map (fun a => update default k (some a)) (List.reverse L)))

Next tactic:
cases L.reverse
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    congr <;> 

Proof state:
case e_Tape.e_l.e_tail
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
⊢ List.tail (List.map (fun a => (false, update (fun x => none) k (some a))) (List.reverse L)) =
    List.map { f := Prod.mk false, map_pt' := (_ : (false, default) = (false, default)) }.f
      (List.tail (List.map (fun a => update default k (some a)) (List.reverse L)))

Next tactic:
cases L.reverse
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    congr <;> cases L.reverse <;> 

Proof state:
case e_Tape.e_l.e_head.e_snd.nil
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
⊢ (List.headI (List.map (fun a => (false, update (fun x => none) k (some a))) [])).2 =
    ListBlank.head (ListBlank.mk (List.map (fun a => update default k (some a)) []))

Next tactic:
try rfl
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    congr <;> cases L.reverse <;> try 

Proof state:
case e_Tape.e_l.e_head.e_snd.nil
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
⊢ (List.headI (List.map (fun a => (false, update (fun x => none) k (some a))) [])).2 =
    ListBlank.head (ListBlank.mk (List.map (fun a => update default k (some a)) []))

Next tactic:
rfl
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    congr <;> cases L.reverse <;> 

Proof state:
case e_Tape.e_l.e_head.e_snd.cons
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
head✝ : Γ k
tail✝ : List (Γ k)
⊢ (List.headI (List.map (fun a => (false, update (fun x => none) k (some a))) (head✝ :: tail✝))).2 =
    ListBlank.head (ListBlank.mk (List.map (fun a => update default k (some a)) (head✝ :: tail✝)))

Next tactic:
try rfl
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    congr <;> cases L.reverse <;> try 

Proof state:
case e_Tape.e_l.e_head.e_snd.cons
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
head✝ : Γ k
tail✝ : List (Γ k)
⊢ (List.headI (List.map (fun a => (false, update (fun x => none) k (some a))) (head✝ :: tail✝))).2 =
    ListBlank.head (ListBlank.mk (List.map (fun a => update default k (some a)) (head✝ :: tail✝)))

Next tactic:
rfl
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    congr <;> cases L.reverse <;> 

Proof state:
case e_Tape.e_l.e_tail.nil
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
⊢ List.tail (List.map (fun a => (false, update (fun x => none) k (some a))) []) =
    List.map { f := Prod.mk false, map_pt' := (_ : (false, default) = (false, default)) }.f
      (List.tail (List.map (fun a => update default k (some a)) []))

Next tactic:
try rfl
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    congr <;> cases L.reverse <;> try 

Proof state:
case e_Tape.e_l.e_tail.nil
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
⊢ List.tail (List.map (fun a => (false, update (fun x => none) k (some a))) []) =
    List.map { f := Prod.mk false, map_pt' := (_ : (false, default) = (false, default)) }.f
      (List.tail (List.map (fun a => update default k (some a)) []))

Next tactic:
rfl
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L) (TM1.init (trInit k L) : Cfg₂₁) := by
  rw [(_ : TM1.init _ = _)]
  · refine' ⟨ListBlank.mk (L.reverse.map fun a ↦ update default k (some a)), fun k' ↦ _⟩
    refine' ListBlank.ext fun i ↦ _
    rw [ListBlank.map_mk, ListBlank.nth_mk, List.getI_eq_iget_get?, List.map_map]
    have : ((proj k').f ∘ fun a => update (β := fun k => Option (Γ k)) default k (some a))
      = fun a => (proj k').f (update (β := fun k => Option (Γ k)) default k (some a)) := rfl
    rw [this, List.get?_map, proj, PointedMap.mk_val]
    simp only []
    by_cases h : k' = k
    · subst k'
      simp only [Function.update_same]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, ← List.map_reverse, List.get?_map]
    · simp only [Function.update_noteq h]
      rw [ListBlank.nth_mk, List.getI_eq_iget_get?, List.map, List.reverse_nil]
      cases L.reverse.get? i <;> rfl
  · rw [trInit, TM1.init]
    dsimp only
    congr <;> cases L.reverse <;> 

Proof state:
case e_Tape.e_l.e_tail.cons
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_3
inst✝¹ : Inhabited Λ
σ : Type u_4
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
L : List (Γ k)
head✝ : Γ k
tail✝ : List (Γ k)
⊢ List.tail (List.map (fun a => (false, update (fun x => none) k (some a))) (head✝ :: tail✝)) =
    List.map { f := Prod.mk false, map_pt' := (_ : (false, default) = (false, default)) }.f
      (List.tail (List.map (fun a => update default k (some a)) (head✝ :: tail✝)))

Next tactic:
try rfl