Theorem: Turing.TM1to1.stepAux_read
File: Mathlib/Computability/TuringMachine.lean

tactic: suffices ∀ f, stepAux (readAux n f) v (trTape' enc0 L R) =
    stepAux (f (enc R.head)) v (trTape' enc0 (L.cons R.head) R.tail) by
  rw [read, this, stepAux_move, encdec, trTape'_move_left enc0]
  simp only [ListBlank.head_cons, ListBlank.cons_head_tail, ListBlank.tail_cons]
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
f : Γ → Stmt Bool Λ' σ
v : σ
L R : ListBlank Γ
⊢ stepAux (read dec f) v (trTape' enc0 L R) = stepAux (f (ListBlank.head R)) v (trTape' enc0 L R)

tactic: obtain ⟨a, R, rfl⟩ := R.exists_cons
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
f : Γ → Stmt Bool Λ' σ
v : σ
L R : ListBlank Γ
⊢ ∀ (f : Vector Bool n → Stmt Bool Λ' σ),
    stepAux (readAux n f) v (trTape' enc0 L R) =
      stepAux (f (enc (ListBlank.head R))) v (trTape' enc0 (ListBlank.cons (ListBlank.head R) L) (ListBlank.tail R))

tactic: simp only [ListBlank.head_cons, ListBlank.tail_cons, trTape', ListBlank.cons_bind,
  ListBlank.append_assoc]
state_before: case intro.intro
Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
f : Γ → Stmt Bool Λ' σ
v : σ
L : ListBlank Γ
a : Γ
R : ListBlank Γ
⊢ ∀ (f : Vector Bool n → Stmt Bool Λ' σ),
    stepAux (readAux n f) v (trTape' enc0 L (ListBlank.cons a R)) =
      stepAux (f (enc (ListBlank.head (ListBlank.cons a R)))) v
        (trTape' enc0 (ListBlank.cons (ListBlank.head (ListBlank.cons a R)) L) (ListBlank.tail (ListBlank.cons a R)))

tactic: suffices ∀ i f L' R' l₁ l₂ h,
    stepAux (readAux i f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
    stepAux (f ⟨l₂, h⟩) v (Tape.mk' (ListBlank.append (l₂.reverseAux l₁) L') R') by
  intro f
  exact this n f (L.bind (fun x => (enc x).1.reverse) _)
    (R.bind (fun x => (enc x).1) _) [] _ (enc a).2
state_before: case intro.intro
Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
f : Γ → Stmt Bool Λ' σ
v : σ
L : ListBlank Γ
a : Γ
R : ListBlank Γ
⊢ ∀ (f : Vector Bool n → Stmt Bool Λ' σ),
    stepAux (readAux n f) v
        (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)))) =
      stepAux (f (enc a)) v
        (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)))

tactic: clear f L a R
state_before: case intro.intro
Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
f : Γ → Stmt Bool Λ' σ
v : σ
L : ListBlank Γ
a : Γ
R : ListBlank Γ
⊢ ∀ (i : ℕ) (f : Vector Bool i → Stmt Bool Λ' σ) (L' R' : ListBlank Bool) (l₁ l₂ : List Bool) (h : List.length l₂ = i),
    stepAux (readAux i f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := h }) v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')

tactic: intro i f L' R' l₁ l₂ _
state_before: case intro.intro
Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
⊢ ∀ (i : ℕ) (f : Vector Bool i → Stmt Bool Λ' σ) (L' R' : ListBlank Bool) (l₁ l₂ : List Bool) (h : List.length l₂ = i),
    stepAux (readAux i f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := h }) v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')

tactic: subst i
state_before: case intro.intro
Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
i : ℕ
f : Vector Bool i → Stmt Bool Λ' σ
L' R' : ListBlank Bool
l₁ l₂ : List Bool
h✝ : List.length l₂ = i
⊢ stepAux (readAux i f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
    stepAux (f { val := l₂, property := h✝ }) v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')

tactic: induction' l₂ with a l₂ IH generalizing l₁
state_before: case intro.intro
Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
L' R' : ListBlank Bool
l₁ l₂ : List Bool
f : Vector Bool (List.length l₂) → Stmt Bool Λ' σ
⊢ stepAux (readAux (List.length l₂) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
    stepAux (f { val := l₂, property := (_ : List.length l₂ = List.length l₂) }) v
      (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')

tactic: trans
  stepAux (readAux l₂.length fun v ↦ f (a ::ᵥ v)) v
    (Tape.mk' ((L'.append l₁).cons a) (R'.append l₂))
state_before: case intro.intro.cons
Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ : List Bool
f✝ : Vector Bool (List.length l₂✝) → Stmt Bool Λ' σ
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ : List Bool) (f : Vector Bool (List.length l₂) → Stmt Bool Λ' σ),
    stepAux (readAux (List.length l₂) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := (_ : List.length l₂ = List.length l₂) }) v
        (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
f : Vector Bool (List.length (a :: l₂)) → Stmt Bool Λ' σ
⊢ stepAux (readAux (List.length (a :: l₂)) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append (a :: l₂) R')) =
    stepAux (f { val := a :: l₂, property := (_ : List.length (a :: l₂) = List.length (a :: l₂)) }) v
      (Tape.mk' (ListBlank.append (List.reverseAux (a :: l₂) l₁) L') R')

tactic: rw [← ListBlank.append, IH]
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ : List Bool
f✝ : Vector Bool (List.length l₂✝) → Stmt Bool Λ' σ
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ : List Bool) (f : Vector Bool (List.length l₂) → Stmt Bool Λ' σ),
    stepAux (readAux (List.length l₂) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := (_ : List.length l₂ = List.length l₂) }) v
        (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
f : Vector Bool (List.length (a :: l₂)) → Stmt Bool Λ' σ
⊢ stepAux (readAux (List.length l₂) fun v => f (a ::ᵥ v)) v
      (Tape.mk' (ListBlank.cons a (ListBlank.append l₁ L')) (ListBlank.append l₂ R')) =
    stepAux (f { val := a :: l₂, property := (_ : List.length (a :: l₂) = List.length (a :: l₂)) }) v
      (Tape.mk' (ListBlank.append (List.reverseAux (a :: l₂) l₁) L') R')

tactic: rfl
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ : List Bool
f✝ : Vector Bool (List.length l₂✝) → Stmt Bool Λ' σ
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ : List Bool) (f : Vector Bool (List.length l₂) → Stmt Bool Λ' σ),
    stepAux (readAux (List.length l₂) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := (_ : List.length l₂ = List.length l₂) }) v
        (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
f : Vector Bool (List.length (a :: l₂)) → Stmt Bool Λ' σ
⊢ stepAux (f (a ::ᵥ { val := l₂, property := (_ : List.length l₂ = List.length l₂) })) v
      (Tape.mk' (ListBlank.append (List.reverseAux l₂ (a :: l₁)) L') R') =
    stepAux (f { val := a :: l₂, property := (_ : List.length (a :: l₂) = List.length (a :: l₂)) }) v
      (Tape.mk' (ListBlank.append (List.reverseAux (a :: l₂) l₁) L') R')

tactic: rw [read, this, stepAux_move, encdec, trTape'_move_left enc0]
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
f : Γ → Stmt Bool Λ' σ
v : σ
L R : ListBlank Γ
this :
  ∀ (f : Vector Bool n → Stmt Bool Λ' σ),
    stepAux (readAux n f) v (trTape' enc0 L R) =
      stepAux (f (enc (ListBlank.head R))) v (trTape' enc0 (ListBlank.cons (ListBlank.head R) L) (ListBlank.tail R))
⊢ stepAux (read dec f) v (trTape' enc0 L R) = stepAux (f (ListBlank.head R)) v (trTape' enc0 L R)

tactic: simp only [ListBlank.head_cons, ListBlank.cons_head_tail, ListBlank.tail_cons]
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
f : Γ → Stmt Bool Λ' σ
v : σ
L R : ListBlank Γ
this :
  ∀ (f : Vector Bool n → Stmt Bool Λ' σ),
    stepAux (readAux n f) v (trTape' enc0 L R) =
      stepAux (f (enc (ListBlank.head R))) v (trTape' enc0 (ListBlank.cons (ListBlank.head R) L) (ListBlank.tail R))
⊢ stepAux (f (ListBlank.head R)) v
      (trTape' enc0 (ListBlank.tail (ListBlank.cons (ListBlank.head R) L))
        (ListBlank.cons (ListBlank.head (ListBlank.cons (ListBlank.head R) L)) (ListBlank.tail R))) =
    stepAux (f (ListBlank.head R)) v (trTape' enc0 L R)

tactic: intro f
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
f : Γ → Stmt Bool Λ' σ
v : σ
L : ListBlank Γ
a : Γ
R : ListBlank Γ
this :
  ∀ (i : ℕ) (f : Vector Bool i → Stmt Bool Λ' σ) (L' R' : ListBlank Bool) (l₁ l₂ : List Bool) (h : List.length l₂ = i),
    stepAux (readAux i f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := h }) v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
⊢ ∀ (f : Vector Bool n → Stmt Bool Λ' σ),
    stepAux (readAux n f) v
        (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)))) =
      stepAux (f (enc a)) v
        (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)))

tactic: exact this n f (L.bind (fun x => (enc x).1.reverse) _)
  (R.bind (fun x => (enc x).1) _) [] _ (enc a).2
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
f✝ : Γ → Stmt Bool Λ' σ
v : σ
L : ListBlank Γ
a : Γ
R : ListBlank Γ
this :
  ∀ (i : ℕ) (f : Vector Bool i → Stmt Bool Λ' σ) (L' R' : ListBlank Bool) (l₁ l₂ : List Bool) (h : List.length l₂ = i),
    stepAux (readAux i f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := h }) v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
f : Vector Bool n → Stmt Bool Λ' σ
⊢ stepAux (readAux n f) v
      (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)))) =
    stepAux (f (enc a)) v
      (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)))

tactic: rfl
state_before: case intro.intro.nil
Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
L' R' : ListBlank Bool
l₁✝ l₂ : List Bool
f✝ : Vector Bool (List.length l₂) → Stmt Bool Λ' σ
l₁ : List Bool
f : Vector Bool (List.length []) → Stmt Bool Λ' σ
⊢ stepAux (readAux (List.length []) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append [] R')) =
    stepAux (f { val := [], property := (_ : List.length [] = List.length []) }) v
      (Tape.mk' (ListBlank.append (List.reverseAux [] l₁) L') R')

tactic: dsimp [readAux, stepAux]
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ : List Bool
f✝ : Vector Bool (List.length l₂✝) → Stmt Bool Λ' σ
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ : List Bool) (f : Vector Bool (List.length l₂) → Stmt Bool Λ' σ),
    stepAux (readAux (List.length l₂) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := (_ : List.length l₂ = List.length l₂) }) v
        (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
f : Vector Bool (List.length (a :: l₂)) → Stmt Bool Λ' σ
⊢ stepAux (readAux (List.length (a :: l₂)) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append (a :: l₂) R')) =
    stepAux (readAux (List.length l₂) fun v => f (a ::ᵥ v)) v
      (Tape.mk' (ListBlank.cons a (ListBlank.append l₁ L')) (ListBlank.append l₂ R'))

tactic: simp
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ : List Bool
f✝ : Vector Bool (List.length l₂✝) → Stmt Bool Λ' σ
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ : List Bool) (f : Vector Bool (List.length l₂) → Stmt Bool Λ' σ),
    stepAux (readAux (List.length l₂) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := (_ : List.length l₂ = List.length l₂) }) v
        (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
f : Vector Bool (List.length (a :: l₂)) → Stmt Bool Λ' σ
⊢ (bif ListBlank.head (ListBlank.cons a (ListBlank.append l₂ R')) then
      stepAux (readAux (List.length l₂) fun v => f (true ::ᵥ v)) v
        (Tape.move Dir.right (Tape.mk' (ListBlank.append l₁ L') (ListBlank.cons a (ListBlank.append l₂ R'))))
    else
      stepAux (readAux (List.length l₂) fun v => f (false ::ᵥ v)) v
        (Tape.move Dir.right (Tape.mk' (ListBlank.append l₁ L') (ListBlank.cons a (ListBlank.append l₂ R'))))) =
    stepAux (readAux (List.length l₂) fun v => f (a ::ᵥ v)) v
      (Tape.mk' (ListBlank.cons a (ListBlank.append l₁ L')) (ListBlank.append l₂ R'))

tactic: cases a <;> rfl
state_before: Γ : Type u_3
inst✝² : Inhabited Γ
Λ : Type u_2
inst✝¹ : Inhabited Λ
σ : Type u_1
inst✝ : Inhabited σ
n : ℕ
enc : Γ → Vector Bool n
dec : Vector Bool n → Γ
enc0 : enc default = Vector.replicate n false
M : Λ → Stmt₁
encdec : ∀ (a : Γ), dec (enc a) = a
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ : List Bool
f✝ : Vector Bool (List.length l₂✝) → Stmt Bool Λ' σ
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ : List Bool) (f : Vector Bool (List.length l₂) → Stmt Bool Λ' σ),
    stepAux (readAux (List.length l₂) f) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂ R')) =
      stepAux (f { val := l₂, property := (_ : List.length l₂ = List.length l₂) }) v
        (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
f : Vector Bool (List.length (a :: l₂)) → Stmt Bool Λ' σ
⊢ (bif a then
      stepAux (readAux (List.length l₂) fun v => f (true ::ᵥ v)) v
        (Tape.mk' (ListBlank.cons a (ListBlank.append l₁ L')) (ListBlank.append l₂ R'))
    else
      stepAux (readAux (List.length l₂) fun v => f (false ::ᵥ v)) v
        (Tape.mk' (ListBlank.cons a (ListBlank.append l₁ L')) (ListBlank.append l₂ R'))) =
    stepAux (readAux (List.length l₂) fun v => f (a ::ᵥ v)) v
      (Tape.mk' (ListBlank.cons a (ListBlank.append l₁ L')) (ListBlank.append l₂ R'))