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

tactic: funext α _ l a
state_before: ⊢ @List.erase = @eraseTR

tactic: simp [eraseTR]
state_before: case h.h.h.h
α : Type u_1
x✝ : BEq α
l : List α
a : α
⊢ List.erase l a = eraseTR l a

tactic: suffices ∀ xs acc, l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ xs.erase a from
  (this l #[] (by simp)).symm
state_before: case h.h.h.h
α : Type u_1
x✝ : BEq α
l : List α
a : α
⊢ List.erase l a = eraseTR.go l a l #[]

tactic: intro xs
state_before: case h.h.h.h
α : Type u_1
x✝ : BEq α
l : List α
a : α
⊢ ∀ (xs : List α) (acc : Array α), l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ List.erase xs a

tactic: simp
state_before: α : Type u_1
x✝ : BEq α
l : List α
a : α
this : ∀ (xs : List α) (acc : Array α), l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ List.erase xs a
⊢ l = #[].data ++ l

tactic: simp [List.erase, eraseTR.go, h]
state_before: case h.h.h.h.nil
α : Type u_1
x✝ : BEq α
l : List α
a : α
acc : Array α
h : l = acc.data ++ []
⊢ eraseTR.go l a [] acc = acc.data ++ List.erase [] a

tactic: simp [List.erase, eraseTR.go]
state_before: case h.h.h.h.cons
α : Type u_1
x✝ : BEq α
l : List α
a x : α
xs : List α
IH : ∀ (acc : Array α), l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ List.erase xs a
acc : Array α
h : l = acc.data ++ x :: xs
⊢ eraseTR.go l a (x :: xs) acc = acc.data ++ List.erase (x :: xs) a

tactic: cases x == a <;> simp
state_before: case h.h.h.h.cons
α : Type u_1
x✝ : BEq α
l : List α
a x : α
xs : List α
IH : ∀ (acc : Array α), l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ List.erase xs a
acc : Array α
h : l = acc.data ++ x :: xs
⊢ (bif x == a then acc.data ++ xs else eraseTR.go l a xs (Array.push acc x)) =
    acc.data ++
      match x == a with
      | true => xs
      | false => x :: List.erase xs a

tactic: rw [IH]
state_before: case h.h.h.h.cons.false
α : Type u_1
x✝ : BEq α
l : List α
a x : α
xs : List α
IH : ∀ (acc : Array α), l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ List.erase xs a
acc : Array α
h : l = acc.data ++ x :: xs
⊢ eraseTR.go l a xs (Array.push acc x) = acc.data ++ x :: List.erase xs a

tactic: simp
state_before: case h.h.h.h.cons.false
α : Type u_1
x✝ : BEq α
l : List α
a x : α
xs : List α
IH : ∀ (acc : Array α), l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ List.erase xs a
acc : Array α
h : l = acc.data ++ x :: xs
⊢ (Array.push acc x).data ++ List.erase xs a = acc.data ++ x :: List.erase xs a

case h.h.h.h.cons.false.a
α : Type u_1
x✝ : BEq α
l : List α
a x : α
xs : List α
IH : ∀ (acc : Array α), l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ List.erase xs a
acc : Array α
h : l = acc.data ++ x :: xs
⊢ l = (Array.push acc x).data ++ xs

tactic: simp
state_before: case h.h.h.h.cons.false.a
α : Type u_1
x✝ : BEq α
l : List α
a x : α
xs : List α
IH : ∀ (acc : Array α), l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ List.erase xs a
acc : Array α
h : l = acc.data ++ x :: xs
⊢ l = (Array.push acc x).data ++ xs

tactic: exact h
state_before: case h.h.h.h.cons.false.a
α : Type u_1
x✝ : BEq α
l : List α
a x : α
xs : List α
IH : ∀ (acc : Array α), l = acc.data ++ xs → eraseTR.go l a xs acc = acc.data ++ List.erase xs a
acc : Array α
h : l = acc.data ++ x :: xs
⊢ l = acc.data ++ x :: xs