Theorem: List.getElem_reverse_aux₂
File: Mathlib/Data/List/Basic.lean

Proof steps:
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
h1 : (a :: l).length - 1 - 0 < ((a :: l).reverseAux r).length
x✝ : 0 < (a :: l).length
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - 0] = (a :: l)[0]
state_after: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
h1 : (a :: l).length - 1 - 0 < ((a :: l).reverseAux r).length
x✝ : 0 < (a :: l).length
aux :
  ∀ (h1 : 0 + l.length < (l.reverseAux (a :: r)).length) (h2 : 0 < (a :: r).length),
    (l.reverseAux (a :: r)).get ⟨0 + l.length, h1⟩ = (a :: r).get ⟨0, h2⟩
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - 0] = (a :: l)[0]
tactic: have aux := get_reverse_aux₁ l (a :: r) 0
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
h1 : (a :: l).length - 1 - 0 < ((a :: l).reverseAux r).length
x✝ : 0 < (a :: l).length
aux :
  ∀ (h1 : 0 + l.length < (l.reverseAux (a :: r)).length) (h2 : 0 < (a :: r).length),
    (l.reverseAux (a :: r)).get ⟨0 + l.length, h1⟩ = (a :: r).get ⟨0, h2⟩
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - 0] = (a :: l)[0]
state_after: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
h1 : (a :: l).length - 1 - 0 < ((a :: l).reverseAux r).length
x✝ : 0 < (a :: l).length
aux :
  ∀ (h1 : l.length < (l.reverseAux (a :: r)).length) (h2 : 0 < (a :: r).length),
    (l.reverseAux (a :: r)).get ⟨l.length, h1⟩ = (a :: r).get ⟨0, h2⟩
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - 0] = (a :: l)[0]
tactic: rw [Nat.zero_add] at aux
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
h1 : (a :: l).length - 1 - 0 < ((a :: l).reverseAux r).length
x✝ : 0 < (a :: l).length
aux :
  ∀ (h1 : l.length < (l.reverseAux (a :: r)).length) (h2 : 0 < (a :: r).length),
    (l.reverseAux (a :: r)).get ⟨l.length, h1⟩ = (a :: r).get ⟨0, h2⟩
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - 0] = (a :: l)[0]
state_after: no goals
tactic: exact aux _ (zero_lt_succ _)
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : (a :: l).length - 1 - (i + 1) < ((a :: l).reverseAux r).length
h2 : i + 1 < (a :: l).length
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - (i + 1)] = (a :: l)[i + 1]
state_after: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : (a :: l).length - 1 - (i + 1) < ((a :: l).reverseAux r).length
h2 : i + 1 < (a :: l).length
aux :
  ∀ (h1 : l.length - 1 - i < (l.reverseAux (a :: r)).length) (h2 : i < l.length),
    (l.reverseAux (a :: r))[l.length - 1 - i] = l[i]
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - (i + 1)] = (a :: l)[i + 1]
tactic: have aux := getElem_reverse_aux₂ l (a :: r) i
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : (a :: l).length - 1 - (i + 1) < ((a :: l).reverseAux r).length
h2 : i + 1 < (a :: l).length
aux :
  ∀ (h1 : l.length - 1 - i < (l.reverseAux (a :: r)).length) (h2 : i < l.length),
    (l.reverseAux (a :: r))[l.length - 1 - i] = l[i]
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - (i + 1)] = (a :: l)[i + 1]
state_after: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : (a :: l).length - 1 - (i + 1) < ((a :: l).reverseAux r).length
h2 : i + 1 < (a :: l).length
aux :
  ∀ (h1 : l.length - 1 - i < (l.reverseAux (a :: r)).length) (h2 : i < l.length),
    (l.reverseAux (a :: r))[l.length - 1 - i] = l[i]
heq : (a :: l).length - 1 - (i + 1) = l.length - 1 - i
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - (i + 1)] = (a :: l)[i + 1]
tactic: have heq : length (a :: l) - 1 - (i + 1) = length l - 1 - i := by rw [length]; omega
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : (a :: l).length - 1 - (i + 1) < ((a :: l).reverseAux r).length
h2 : i + 1 < (a :: l).length
aux :
  ∀ (h1 : l.length - 1 - i < (l.reverseAux (a :: r)).length) (h2 : i < l.length),
    (l.reverseAux (a :: r))[l.length - 1 - i] = l[i]
heq : (a :: l).length - 1 - (i + 1) = l.length - 1 - i
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - (i + 1)] = (a :: l)[i + 1]
state_after: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : (a :: l).length - 1 - (i + 1) < ((a :: l).reverseAux r).length
h2 : i + 1 < (a :: l).length
aux :
  ∀ (h1 : (a :: l).length - 1 - (i + 1) < (l.reverseAux (a :: r)).length) (h2 : i < l.length),
    (l.reverseAux (a :: r))[(a :: l).length - 1 - (i + 1)] = l[i]
heq : (a :: l).length - 1 - (i + 1) = l.length - 1 - i
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - (i + 1)] = (a :: l)[i + 1]
tactic: rw [← heq] at aux
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
a : α
l r : List α
i : ℕ
h1 : (a :: l).length - 1 - (i + 1) < ((a :: l).reverseAux r).length
h2 : i + 1 < (a :: l).length
aux :
  ∀ (h1 : (a :: l).length - 1 - (i + 1) < (l.reverseAux (a :: r)).length) (h2 : i < l.length),
    (l.reverseAux (a :: r))[(a :: l).length - 1 - (i + 1)] = l[i]
heq : (a :: l).length - 1 - (i + 1) = l.length - 1 - i
⊢ ((a :: l).reverseAux r)[(a :: l).length - 1 - (i + 1)] = (a :: l)[i + 1]
state_after: no goals
tactic: apply aux