-- Mathlib/Computability/TuringMachine.lean
theorem trCfg_init (k) (L : List (Γ k)) : TrCfg (TM2.init k L)
    (TM1.init (trInit k L) : TM1.Cfg (Γ' K Γ) (Λ' K Γ Λ σ) σ)

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

Tactic:
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

Result:
K : Type u_1
Γ : K → Type u_2
Λ : Type u_3
σ : Type u_4
inst✝² : DecidableEq K
inst✝¹ : Inhabited Λ
inst✝ : Inhabited σ
k : K
L : List (Γ k)
k' : K
i : ℕ
this : ((proj k').f ∘ fun a => update default k (some a)) = fun a => (proj k').f (update default k (some a))
⊢ (List.map ((proj k').f ∘ fun a => update default k (some a)) L.reverse)[i]?.iget =
    (ListBlank.mk (List.map some (update (fun x => []) k L k')).reverse).nth i

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

Tactic:
simp only [List.map_map, List.tail_cons, List.map]

Result:
case e_Tape.e_l.e_tail.cons
K : Type u_1
Γ : K → Type u_2
Λ : Type u_3
σ : Type u_4
inst✝² : DecidableEq K
inst✝¹ : Inhabited Λ
inst✝ : Inhabited σ
k : K
L : List (Γ k)
head✝ : Γ k
tail✝ : List (Γ k)
⊢ List.map (fun a => (false, update (fun x => none) k (some a))) tail✝ =
    List.map (Prod.mk false ∘ fun a => update default k (some a)) tail✝

Proof state:
K : Type u_1
Γ : K → Type u_2
Λ : Type u_3
σ : Type u_4
inst✝² : DecidableEq K
inst✝¹ : Inhabited Λ
inst✝ : Inhabited σ
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)) L.reverse))) }

Tactic:
rw [trInit, TM1.init]

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

Proof state:
K : Type u_1
Γ : K → Type u_2
Λ : Type u_3
σ : Type u_4
inst✝² : DecidableEq K
inst✝¹ : Inhabited Λ
inst✝ : Inhabited σ
k : K
L : List (Γ k)
⊢ TrCfg (TM2.init k L) (TM1.init (trInit k L))

Tactic:
rw [(_ : TM1.init _ = _)]

Result:
K : Type u_1
Γ : K → Type u_2
Λ : Type u_3
σ : Type u_4
inst✝² : DecidableEq K
inst✝¹ : Inhabited Λ
inst✝ : Inhabited σ
k : K
L : List (Γ k)
⊢ TrCfg (TM2.init k L) ?m.157252

K : Type u_1
Γ : K → Type u_2
Λ : Type u_3
σ : Type u_4
inst✝² : DecidableEq K
inst✝¹ : Inhabited Λ
inst✝ : Inhabited σ
k : K
L : List (Γ k)
⊢ TM1.init (trInit k L) = ?m.157252

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

Tactic:
rfl

Result:
no goals

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

Tactic:
simp only [Function.update_self]

Result:
case pos
K : Type u_1
Γ : K → Type u_2
Λ : Type u_3
σ : Type u_4
inst✝² : DecidableEq K
inst✝¹ : Inhabited Λ
inst✝ : Inhabited σ
k : K
L : List (Γ k)
i : ℕ
this : ((proj k).f ∘ fun a => update default k (some a)) = fun a => (proj k).f (update default k (some a))
⊢ (Option.map (fun a => some a) L.reverse[i]?).iget = (ListBlank.mk (List.map some L).reverse).nth i

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

Tactic:
by_cases h : k' = k

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

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

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

Tactic:
cases L.reverse[i]? <;> rfl

Result:
no goals