case zero
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n : ℕ
H✝ : n ≤ List.length S
H : Nat.zero ≤ List.length S
⊢ Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
    { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[Nat.zero]) (Tape.mk' ∅ (addBottom L)) }

case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
    { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[Nat.succ n]) (Tape.mk' ∅ (addBottom L)) }
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n : ℕ
H : n ≤ List.length S
⊢ Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
    { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
induction' n with n IH
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[Nat.succ n]) (Tape.mk' ∅ (addBottom L)) } ∈
    TM1.step (tr M) { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
    { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[Nat.succ n]) (Tape.mk' ∅ (addBottom L)) }
apply (IH (le_of_lt H)).tail
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ { l := some (go k o q), var := v,
      Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) } ∈
    TM1.step (tr M) { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[Nat.succ n]) (Tape.mk' ∅ (addBottom L)) } ∈
    TM1.step (tr M) { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
rw [iterate_succ_apply']
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ some
      (bif Option.isNone (ListBlank.nth L n k) then
        TM1.stepAux (trStAct (goto fun x x => ret q) o) v ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)))
      else
        { l := some (go k o q), var := v,
          Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) }) =
    some
      { l := some (go k o q), var := v,
        Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) }
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ { l := some (go k o q), var := v,
      Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) } ∈
    TM1.step (tr M) { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
simp only [TM1.step, TM1.stepAux, tr, Tape.mk'_nth_nat, Tape.move_right_n_head,
  addBottom_nth_snd, Option.mem_def]
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ some
      (bif Option.isNone (some (List.get (List.reverse S) { val := n, isLt := ?succ })) then
        TM1.stepAux (trStAct (goto fun x x => ret q) o) v ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)))
      else
        { l := some (go k o q), var := v,
          Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) }) =
    some
      { l := some (go k o q), var := v,
        Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) }

case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ n < List.length (List.reverse S)
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ some
      (bif Option.isNone (ListBlank.nth L n k) then
        TM1.stepAux (trStAct (goto fun x x => ret q) o) v ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)))
      else
        { l := some (go k o q), var := v,
          Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) }) =
    some
      { l := some (go k o q), var := v,
        Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) }
rw [stk_nth_val _ hL, List.get?_eq_get]
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ n < List.length (List.reverse S)
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ some
      (bif Option.isNone (some (List.get (List.reverse S) { val := n, isLt := ?succ })) then
        TM1.stepAux (trStAct (goto fun x x => ret q) o) v ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)))
      else
        { l := some (go k o q), var := v,
          Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) }) =
    some
      { l := some (go k o q), var := v,
        Tape := Tape.move Dir.right ((Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L))) }

case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ n < List.length (List.reverse S)
rfl
no goals
case succ
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n✝ : ℕ
H✝ : n✝ ≤ List.length S
n : ℕ
IH :
  n ≤ List.length S →
    Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
      { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[n]) (Tape.mk' ∅ (addBottom L)) }
H : Nat.succ n ≤ List.length S
⊢ n < List.length (List.reverse S)
rwa [List.length_reverse]
no goals
case zero
K : Type u_1
inst✝² : DecidableEq K
Γ : K → Type u_2
Λ : Type u_4
inst✝¹ : Inhabited Λ
σ : Type u_3
inst✝ : Inhabited σ
M : Λ → Stmt₂
k : K
o : StAct k
q : Stmt₂
v : σ
S : List (Γ k)
L : ListBlank ((k : K) → Option (Γ k))
hL : ListBlank.map (proj k) L = ListBlank.mk (List.reverse (List.map some S))
n : ℕ
H✝ : n ≤ List.length S
H : Nat.zero ≤ List.length S
⊢ Reaches₀ (TM1.step (tr M)) { l := some (go k o q), var := v, Tape := Tape.mk' ∅ (addBottom L) }
    { l := some (go k o q), var := v, Tape := (Tape.move Dir.right^[Nat.zero]) (Tape.mk' ∅ (addBottom L)) }
rfl