Theorem: Turing.TM2to1.tr_respects_aux₁
File: Mathlib/Computability/TuringMachine.lean

tactic: induction' n with n IH
state_before: 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)) }

tactic: apply (IH (le_of_lt H)).tail
state_before: 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)) }

tactic: rw [iterate_succ_apply']
state_before: 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)) }

tactic: simp only [TM1.step, TM1.stepAux, tr, Tape.mk'_nth_nat, Tape.move_right_n_head,
  addBottom_nth_snd, Option.mem_def]
state_before: 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)) }

tactic: rw [stk_nth_val _ hL, List.get?_eq_get]
state_before: 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))) }

tactic: rfl
state_before: 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)

tactic: rwa [List.length_reverse]
state_before: 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)

tactic: rfl
state_before: 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)) }