Theorem: Turing.TM1to1.trTape'_move_left
File: Mathlib/Computability/TuringMachine.lean

tactic: obtain ⟨a, L, rfl⟩ := L.exists_cons
state_before: Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
L R : ListBlank Γ
⊢ (Tape.move Dir.left^[n]) (trTape' enc0 L R) = trTape' enc0 (ListBlank.tail L) (ListBlank.cons (ListBlank.head L) R)

tactic: simp only [trTape', ListBlank.cons_bind, ListBlank.head_cons, ListBlank.tail_cons]
state_before: case intro.intro
Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
⊢ (Tape.move Dir.left^[n]) (trTape' enc0 (ListBlank.cons a L) R) =
    trTape' enc0 (ListBlank.tail (ListBlank.cons a L)) (ListBlank.cons (ListBlank.head (ListBlank.cons a L)) R)

tactic: suffices ∀ {L' R' l₁ l₂} (_ : Vector.toList (enc a) = List.reverseAux l₁ l₂),
    (Tape.move Dir.left^[l₁.length])
    (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
    Tape.mk' L' (ListBlank.append (Vector.toList (enc a)) R') by
  simpa only [List.length_reverse, Vector.toList_length] using this (List.reverse_reverse _).symm
state_before: case intro.intro
Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
⊢ (Tape.move Dir.left^[n])
      (Tape.mk'
        (ListBlank.append (List.reverse (Vector.toList (enc a)))
          (ListBlank.bind L (fun x => List.reverse (Vector.toList (enc x)))
            (_ : ∃ n_1, (fun x => List.reverse (Vector.toList (enc x))) default = List.replicate n_1 default)))
        (ListBlank.bind R (fun x => Vector.toList (enc x))
          (_ : ∃ n_1, (fun x => Vector.toList (enc x)) default = List.replicate n_1 default))) =
    Tape.mk'
      (ListBlank.bind L (fun x => List.reverse (Vector.toList (enc x)))
        (_ : ∃ n_1, (fun x => List.reverse (Vector.toList (enc x))) default = List.replicate n_1 default))
      (ListBlank.append (Vector.toList (enc a))
        (ListBlank.bind R (fun x => Vector.toList (enc x))
          (_ : ∃ n_1, (fun x => Vector.toList (enc x)) default = List.replicate n_1 default)))

tactic: intro _ _ l₁ l₂ e
state_before: case intro.intro
Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
⊢ ∀ {L' R' : ListBlank Bool} {l₁ l₂ : List Bool},
    Vector.toList (enc a) = List.reverseAux l₁ l₂ →
      (Tape.move Dir.left^[List.length l₁]) (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
        Tape.mk' L' (ListBlank.append (Vector.toList (enc a)) R')

tactic: induction' l₁ with b l₁ IH generalizing l₂
state_before: case intro.intro
Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
L'✝ R'✝ : ListBlank Bool
l₁ l₂ : List Bool
e : Vector.toList (enc a) = List.reverseAux l₁ l₂
⊢ (Tape.move Dir.left^[List.length l₁]) (Tape.mk' (ListBlank.append l₁ L'✝) (ListBlank.append l₂ R'✝)) =
    Tape.mk' L'✝ (ListBlank.append (Vector.toList (enc a)) R'✝)

tactic: simp only [List.length, List.cons_append, iterate_succ_apply]
state_before: case intro.intro.cons
Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
L'✝ R'✝ : ListBlank Bool
l₁✝ l₂✝ : List Bool
e✝ : Vector.toList (enc a) = List.reverseAux l₁✝ l₂✝
b : Bool
l₁ : List Bool
IH :
  ∀ {l₂ : List Bool},
    Vector.toList (enc a) = List.reverseAux l₁ l₂ →
      (Tape.move Dir.left^[List.length l₁]) (Tape.mk' (ListBlank.append l₁ L'✝) (ListBlank.append l₂ R'✝)) =
        Tape.mk' L'✝ (ListBlank.append (Vector.toList (enc a)) R'✝)
l₂ : List Bool
e : Vector.toList (enc a) = List.reverseAux (b :: l₁) l₂
⊢ (Tape.move Dir.left^[List.length (b :: l₁)]) (Tape.mk' (ListBlank.append (b :: l₁) L'✝) (ListBlank.append l₂ R'✝)) =
    Tape.mk' L'✝ (ListBlank.append (Vector.toList (enc a)) R'✝)

tactic: convert IH e
state_before: case intro.intro.cons
Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
L'✝ R'✝ : ListBlank Bool
l₁✝ l₂✝ : List Bool
e✝ : Vector.toList (enc a) = List.reverseAux l₁✝ l₂✝
b : Bool
l₁ : List Bool
IH :
  ∀ {l₂ : List Bool},
    Vector.toList (enc a) = List.reverseAux l₁ l₂ →
      (Tape.move Dir.left^[List.length l₁]) (Tape.mk' (ListBlank.append l₁ L'✝) (ListBlank.append l₂ R'✝)) =
        Tape.mk' L'✝ (ListBlank.append (Vector.toList (enc a)) R'✝)
l₂ : List Bool
e : Vector.toList (enc a) = List.reverseAux (b :: l₁) l₂
⊢ (Tape.move Dir.left^[List.length l₁])
      (Tape.move Dir.left (Tape.mk' (ListBlank.append (b :: l₁) L'✝) (ListBlank.append l₂ R'✝))) =
    Tape.mk' L'✝ (ListBlank.append (Vector.toList (enc a)) R'✝)

tactic: simp only [ListBlank.tail_cons, ListBlank.append, Tape.move_left_mk', ListBlank.head_cons]
state_before: case h.e'_2.h.e'_4
Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
L'✝ R'✝ : ListBlank Bool
l₁✝ l₂✝ : List Bool
e✝ : Vector.toList (enc a) = List.reverseAux l₁✝ l₂✝
b : Bool
l₁ : List Bool
IH :
  ∀ {l₂ : List Bool},
    Vector.toList (enc a) = List.reverseAux l₁ l₂ →
      (Tape.move Dir.left^[List.length l₁]) (Tape.mk' (ListBlank.append l₁ L'✝) (ListBlank.append l₂ R'✝)) =
        Tape.mk' L'✝ (ListBlank.append (Vector.toList (enc a)) R'✝)
l₂ : List Bool
e : Vector.toList (enc a) = List.reverseAux (b :: l₁) l₂
⊢ Tape.move Dir.left (Tape.mk' (ListBlank.append (b :: l₁) L'✝) (ListBlank.append l₂ R'✝)) =
    Tape.mk' (ListBlank.append l₁ L'✝) (ListBlank.append (b :: l₂) R'✝)

tactic: simpa only [List.length_reverse, Vector.toList_length] using this (List.reverse_reverse _).symm
state_before: Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
this :
  ∀ {L' R' : ListBlank Bool} {l₁ l₂ : List Bool},
    Vector.toList (enc a) = List.reverseAux l₁ l₂ →
      (Tape.move Dir.left^[List.length l₁]) (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
        Tape.mk' L' (ListBlank.append (Vector.toList (enc a)) R')
⊢ (Tape.move Dir.left^[n])
      (Tape.mk'
        (ListBlank.append (List.reverse (Vector.toList (enc a)))
          (ListBlank.bind L (fun x => List.reverse (Vector.toList (enc x)))
            (_ : ∃ n_1, (fun x => List.reverse (Vector.toList (enc x))) default = List.replicate n_1 default)))
        (ListBlank.bind R (fun x => Vector.toList (enc x))
          (_ : ∃ n_1, (fun x => Vector.toList (enc x)) default = List.replicate n_1 default))) =
    Tape.mk'
      (ListBlank.bind L (fun x => List.reverse (Vector.toList (enc x)))
        (_ : ∃ n_1, (fun x => List.reverse (Vector.toList (enc x))) default = List.replicate n_1 default))
      (ListBlank.append (Vector.toList (enc a))
        (ListBlank.bind R (fun x => Vector.toList (enc x))
          (_ : ∃ n_1, (fun x => Vector.toList (enc x)) default = List.replicate n_1 default)))

tactic: cases e
state_before: case intro.intro.nil
Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
L'✝ R'✝ : ListBlank Bool
l₁ l₂✝ : List Bool
e✝ : Vector.toList (enc a) = List.reverseAux l₁ l₂✝
l₂ : List Bool
e : Vector.toList (enc a) = List.reverseAux [] l₂
⊢ (Tape.move Dir.left^[List.length []]) (Tape.mk' (ListBlank.append [] L'✝) (ListBlank.append l₂ R'✝)) =
    Tape.mk' L'✝ (ListBlank.append (Vector.toList (enc a)) R'✝)

tactic: rfl
state_before: case intro.intro.nil.refl
Γ : Type u_1
inst✝² : Inhabited Γ
Λ : Type ?u.366855
inst✝¹ : Inhabited Λ
σ : Type ?u.366861
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
R : ListBlank Γ
a : Γ
L : ListBlank Γ
L'✝ R'✝ : ListBlank Bool
l₁ l₂ : List Bool
e : Vector.toList (enc a) = List.reverseAux l₁ l₂
⊢ (Tape.move Dir.left^[List.length []]) (Tape.mk' (ListBlank.append [] L'✝) (ListBlank.append (enc a).1 R'✝)) =
    Tape.mk' L'✝ (ListBlank.append (Vector.toList (enc a)) R'✝)