Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
a b : Γ
L R : ListBlank Γ
⊢ stepAux (write (Vector.toList (enc a)) q) 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 b))
          (ListBlank.bind R (fun x => Vector.toList (enc x))
            (_ : ∃ n_1, (fun x => Vector.toList (enc x)) default = List.replicate n_1 default)))) =
    stepAux q 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)))
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
a b : Γ
L R : ListBlank Γ
⊢ stepAux (write (Vector.toList (enc a)) q) v (trTape' enc0 L (ListBlank.cons b R)) =
    stepAux q v (trTape' enc0 (ListBlank.cons a L) R)
simp only [trTape', ListBlank.cons_bind]
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
a b : Γ
L R : ListBlank Γ
⊢ ∀ {L' R' : ListBlank Bool} (l₁ l₂ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
a b : Γ
L R : ListBlank Γ
⊢ stepAux (write (Vector.toList (enc a)) q) 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 b))
          (ListBlank.bind R (fun x => Vector.toList (enc x))
            (_ : ∃ n_1, (fun x => Vector.toList (enc x)) default = List.replicate n_1 default)))) =
    stepAux q 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)))
suffices ∀ {L' R'} (l₁ l₂ l₂' : List Bool) (_ : l₂'.length = l₂.length),
    stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
    stepAux q v (Tape.mk' (L'.append (List.reverseAux l₂ l₁)) R') by
  refine' this [] _ _ ((enc b).2.trans (enc a).2.symm)
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
⊢ ∀ {L' R' : ListBlank Bool} (l₁ l₂ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
a b : Γ
L R : ListBlank Γ
⊢ ∀ {L' R' : ListBlank Bool} (l₁ l₂ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
clear a b L R
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁ l₂ l₂' : List Bool
e : List.length l₂' = List.length l₂
⊢ stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
⊢ ∀ {L' R' : ListBlank Bool} (l₁ l₂ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
intro L' R' l₁ l₂ l₂' e
case 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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂ l₂'✝ : List Bool
e✝ : List.length l₂'✝ = List.length l₂
l₁ l₂' : List Bool
e : List.length l₂' = List.length []
⊢ stepAux (write [] q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux [] l₁) L') R')

case 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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ l₂'✝ : List Bool
e✝ : List.length l₂'✝ = List.length l₂✝
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ l₂' : List Bool
e : List.length l₂' = List.length (a :: l₂)
⊢ stepAux (write (a :: l₂) q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux (a :: l₂) l₁) L') R')
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁ l₂ l₂' : List Bool
e : List.length l₂' = List.length l₂
⊢ stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
induction' l₂ with a l₂ IH generalizing l₁ l₂'
case cons.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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ l₂'✝ : List Bool
e✝ : List.length l₂'✝ = List.length l₂✝
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
b : Bool
l₂' : List Bool
e : List.length l₂' = List.length l₂
⊢ stepAux (write (a :: l₂) q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append (b :: l₂') R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux (a :: l₂) l₁) L') R')
case 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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ l₂'✝ : List Bool
e✝ : List.length l₂'✝ = List.length l₂✝
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ l₂' : List Bool
e : List.length l₂' = List.length (a :: l₂)
⊢ stepAux (write (a :: l₂) q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux (a :: l₂) l₁) L') R')
cases' l₂' with b l₂' <;> simp only [List.length_nil, List.length_cons, Nat.succ_inj'] at e
case cons.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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ l₂'✝ : List Bool
e✝ : List.length l₂'✝ = List.length l₂✝
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
b : Bool
l₂' : List Bool
e : List.length l₂' = List.length l₂
⊢ stepAux (write (a :: l₂) q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append (b :: l₂') R')) =
    stepAux (write l₂ q) v (Tape.mk' (ListBlank.append (a :: l₁) L') (ListBlank.append l₂' R'))
case cons.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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ l₂'✝ : List Bool
e✝ : List.length l₂'✝ = List.length l₂✝
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
b : Bool
l₂' : List Bool
e : List.length l₂' = List.length l₂
⊢ stepAux (write (a :: l₂) q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append (b :: l₂') R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux (a :: l₂) l₁) L') R')
rw [List.reverseAux, ← IH (a :: l₁) l₂' e]
no goals
case cons.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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂✝ l₂'✝ : List Bool
e✝ : List.length l₂'✝ = List.length l₂✝
a : Bool
l₂ : List Bool
IH :
  ∀ (l₁ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
l₁ : List Bool
b : Bool
l₂' : List Bool
e : List.length l₂' = List.length l₂
⊢ stepAux (write (a :: l₂) q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append (b :: l₂') R')) =
    stepAux (write l₂ q) v (Tape.mk' (ListBlank.append (a :: l₁) L') (ListBlank.append l₂' R'))
simp only [stepAux, ListBlank.append, Tape.write_mk', Tape.move_right_mk', ListBlank.head_cons,
  ListBlank.tail_cons]
no goals
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
a b : Γ
L R : ListBlank Γ
this :
  ∀ {L' R' : ListBlank Bool} (l₁ l₂ l₂' : List Bool),
    List.length l₂' = List.length l₂ →
      stepAux (write l₂ q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
        stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux l₂ l₁) L') R')
⊢ stepAux (write (Vector.toList (enc a)) q) 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 b))
          (ListBlank.bind R (fun x => Vector.toList (enc x))
            (_ : ∃ n_1, (fun x => Vector.toList (enc x)) default = List.replicate n_1 default)))) =
    stepAux q 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)))
refine' this [] _ _ ((enc b).2.trans (enc a).2.symm)
case nil.refl
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂ l₂' : List Bool
e✝ : List.length l₂' = List.length l₂
l₁ : List Bool
e : List.length [] = List.length []
⊢ stepAux (write [] q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append [] R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux [] l₁) L') R')
case 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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂ l₂'✝ : List Bool
e✝ : List.length l₂'✝ = List.length l₂
l₁ l₂' : List Bool
e : List.length l₂' = List.length []
⊢ stepAux (write [] q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append l₂' R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux [] l₁) L') R')
cases List.length_eq_zero.1 e
no goals
case nil.refl
Γ : 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₁
q : Stmt Bool Λ' σ
v : σ
L' R' : ListBlank Bool
l₁✝ l₂ l₂' : List Bool
e✝ : List.length l₂' = List.length l₂
l₁ : List Bool
e : List.length [] = List.length []
⊢ stepAux (write [] q) v (Tape.mk' (ListBlank.append l₁ L') (ListBlank.append [] R')) =
    stepAux q v (Tape.mk' (ListBlank.append (List.reverseAux [] l₁) L') R')
rfl