ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
h1 : length (a :: l) - 1 - 0 < length (reverseAux (a :: l) r)
x✝ : 0 < length (a :: l)
aux :
  ∀ (h1 : 0 + length l < length (reverseAux l (a :: r))) (h2 : 0 < length (a :: r)),
    get (reverseAux l (a :: r)) { val := 0 + length l, isLt := h1 } = get (a :: r) { val := 0, isLt := h2 }
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - 0, isLt := h1 } = get (a :: l) { val := 0, isLt := x✝ }
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
h1 : length (a :: l) - 1 - 0 < length (reverseAux (a :: l) r)
x✝ : 0 < length (a :: l)
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - 0, isLt := h1 } = get (a :: l) { val := 0, isLt := x✝ }
have aux := get_reverse_aux₁ l (a :: r) 0
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
h1 : length (a :: l) - 1 - 0 < length (reverseAux (a :: l) r)
x✝ : 0 < length (a :: l)
aux :
  ∀ (h1 : length l < length (reverseAux l (a :: r))) (h2 : 0 < length (a :: r)),
    get (reverseAux l (a :: r)) { val := length l, isLt := h1 } = get (a :: r) { val := 0, isLt := h2 }
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - 0, isLt := h1 } = get (a :: l) { val := 0, isLt := x✝ }
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
h1 : length (a :: l) - 1 - 0 < length (reverseAux (a :: l) r)
x✝ : 0 < length (a :: l)
aux :
  ∀ (h1 : 0 + length l < length (reverseAux l (a :: r))) (h2 : 0 < length (a :: r)),
    get (reverseAux l (a :: r)) { val := 0 + length l, isLt := h1 } = get (a :: r) { val := 0, isLt := h2 }
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - 0, isLt := h1 } = get (a :: l) { val := 0, isLt := x✝ }
rw [zero_add] at aux
no goals
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
h1 : length (a :: l) - 1 - 0 < length (reverseAux (a :: l) r)
x✝ : 0 < length (a :: l)
aux :
  ∀ (h1 : length l < length (reverseAux l (a :: r))) (h2 : 0 < length (a :: r)),
    get (reverseAux l (a :: r)) { val := length l, isLt := h1 } = get (a :: r) { val := 0, isLt := h2 }
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - 0, isLt := h1 } = get (a :: l) { val := 0, isLt := x✝ }
exact aux _ (zero_lt_succ _)
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length l - 1 - i < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length l - 1 - i, isLt := h1 } = get l { val := i, isLt := h2 }
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - (i + 1), isLt := h1 } =
    get (a :: l) { val := i + 1, isLt := h2 }
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - (i + 1), isLt := h1 } =
    get (a :: l) { val := i + 1, isLt := h2 }
have aux := get_reverse_aux₂ l (a :: r) i
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length l - 1 - i < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length l - 1 - i, isLt := h1 } = get l { val := i, isLt := h2 }
heq : length (a :: l) - 1 - (i + 1) = length l - 1 - i
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - (i + 1), isLt := h1 } =
    get (a :: l) { val := i + 1, isLt := h2 }
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length l - 1 - i < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length l - 1 - i, isLt := h1 } = get l { val := i, isLt := h2 }
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - (i + 1), isLt := h1 } =
    get (a :: l) { val := i + 1, isLt := h2 }
have heq :=
  calc
    length (a :: l) - 1 - (i + 1) = length l - (1 + i) := by rw [add_comm]; rfl
    _ = length l - 1 - i := by rw [← tsub_add_eq_tsub_tsub]
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length (a :: l) - 1 - (i + 1), isLt := h1 } = get l { val := i, isLt := h2 }
heq : length (a :: l) - 1 - (i + 1) = length l - 1 - i
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - (i + 1), isLt := h1 } =
    get (a :: l) { val := i + 1, isLt := h2 }
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length l - 1 - i < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length l - 1 - i, isLt := h1 } = get l { val := i, isLt := h2 }
heq : length (a :: l) - 1 - (i + 1) = length l - 1 - i
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - (i + 1), isLt := h1 } =
    get (a :: l) { val := i + 1, isLt := h2 }
rw [← heq] at aux
no goals
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length (a :: l) - 1 - (i + 1), isLt := h1 } = get l { val := i, isLt := h2 }
heq : length (a :: l) - 1 - (i + 1) = length l - 1 - i
⊢ get (reverseAux (a :: l) r) { val := length (a :: l) - 1 - (i + 1), isLt := h1 } =
    get (a :: l) { val := i + 1, isLt := h2 }
apply aux
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length l - 1 - i < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length l - 1 - i, isLt := h1 } = get l { val := i, isLt := h2 }
⊢ length (a :: l) - 1 - (1 + i) = length l - (1 + i)
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length l - 1 - i < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length l - 1 - i, isLt := h1 } = get l { val := i, isLt := h2 }
⊢ length (a :: l) - 1 - (i + 1) = length l - (1 + i)
rw [add_comm]
no goals
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length l - 1 - i < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length l - 1 - i, isLt := h1 } = get l { val := i, isLt := h2 }
⊢ length (a :: l) - 1 - (1 + i) = length l - (1 + i)
rfl
no goals
ι : Type ?u.95388
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : length (a :: l) - 1 - (i + 1) < length (reverseAux (a :: l) r)
h2 : i + 1 < length (a :: l)
aux :
  ∀ (h1 : length l - 1 - i < length (reverseAux l (a :: r))) (h2 : i < length l),
    get (reverseAux l (a :: r)) { val := length l - 1 - i, isLt := h1 } = get l { val := i, isLt := h2 }
⊢ length l - (1 + i) = length l - 1 - i
rw [← tsub_add_eq_tsub_tsub]