Theorem: List.eraseIdx_eq_eraseIdxTR
File: Std/Data/List/Basic.lean

tactic: funext α l n
state_before: ⊢ @eraseIdx = @eraseIdxTR

tactic: simp [eraseIdxTR]
state_before: case h.h.h
α : Type u_1
l : List α
n : Nat
⊢ eraseIdx l n = eraseIdxTR l n

tactic: suffices ∀ xs acc, l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ xs.eraseIdx n from
  (this l #[] (by simp)).symm
state_before: case h.h.h
α : Type u_1
l : List α
n : Nat
⊢ eraseIdx l n = eraseIdxTR.go l l n #[]

tactic: intro xs
state_before: case h.h.h
α : Type u_1
l : List α
n : Nat
⊢ ∀ (xs : List α) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n

tactic: induction xs generalizing n with intro acc h
| nil => simp [eraseIdx, eraseIdxTR.go, h]
| cons x xs IH =>
match n with
| 0 => simp [eraseIdx, eraseIdxTR.go]
| n+1 =>
simp [eraseIdx, eraseIdxTR.go]
rw [IH]; simp; simp; exact h
state_before: case h.h.h
α : Type u_1
l : List α
n : Nat
xs : List α
⊢ ∀ (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n

tactic: simp
state_before: α : Type u_1
l : List α
n : Nat
this : ∀ (xs : List α) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n
⊢ l = #[].data ++ l

tactic: simp [eraseIdx, eraseIdxTR.go, h]
state_before: case h.h.h.nil
α : Type u_1
l : List α
n : Nat
acc : Array α
h : l = acc.data ++ []
⊢ eraseIdxTR.go l [] n acc = acc.data ++ eraseIdx [] n

tactic: match n with
| 0 => simp [eraseIdx, eraseIdxTR.go]
| n+1 =>
  simp [eraseIdx, eraseIdxTR.go]
  rw [IH]; simp; simp; exact h
state_before: case h.h.h.cons
α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n
n : Nat
acc : Array α
h : l = acc.data ++ x :: xs
⊢ eraseIdxTR.go l (x :: xs) n acc = acc.data ++ eraseIdx (x :: xs) n

tactic: simp [eraseIdx, eraseIdxTR.go]
state_before: α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n
n : Nat
acc : Array α
h : l = acc.data ++ x :: xs
⊢ eraseIdxTR.go l (x :: xs) 0 acc = acc.data ++ eraseIdx (x :: xs) 0

tactic: simp [eraseIdx, eraseIdxTR.go]
state_before: α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n
n✝ : Nat
acc : Array α
h : l = acc.data ++ x :: xs
n : Nat
⊢ eraseIdxTR.go l (x :: xs) (n + 1) acc = acc.data ++ eraseIdx (x :: xs) (n + 1)

tactic: rw [IH]
state_before: α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n
n✝ : Nat
acc : Array α
h : l = acc.data ++ x :: xs
n : Nat
⊢ eraseIdxTR.go l xs n (Array.push acc x) = acc.data ++ x :: eraseIdx xs n

tactic: simp
state_before: α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n
n✝ : Nat
acc : Array α
h : l = acc.data ++ x :: xs
n : Nat
⊢ (Array.push acc x).data ++ eraseIdx xs n = acc.data ++ x :: eraseIdx xs n

case a
α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n
n✝ : Nat
acc : Array α
h : l = acc.data ++ x :: xs
n : Nat
⊢ l = (Array.push acc x).data ++ xs

tactic: simp
state_before: case a
α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n
n✝ : Nat
acc : Array α
h : l = acc.data ++ x :: xs
n : Nat
⊢ l = (Array.push acc x).data ++ xs

tactic: exact h
state_before: case a
α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → eraseIdxTR.go l xs n acc = acc.data ++ eraseIdx xs n
n✝ : Nat
acc : Array α
h : l = acc.data ++ x :: xs
n : Nat
⊢ l = acc.data ++ x :: xs