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

tactic: funext α l n
state_before: ⊢ @removeNth = @removeNthTR

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

tactic: suffices ∀ xs acc, l = acc.data ++ xs →
    removeNthTR.go l xs n acc = acc.data ++ xs.removeNth n from
  (this l #[] (by simp)).symm
state_before: case h.h.h
α : Type u_1
l : List α
n : Nat
⊢ removeNth l n = removeNthTR.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 → removeNthTR.go l xs n acc = acc.data ++ removeNth xs n

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

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

tactic: cases n <;> simp [removeNth, removeNthTR.go, *]
state_before: case h.h.h.cons
α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → removeNthTR.go l xs n acc = acc.data ++ removeNth xs n
n : Nat
acc : Array α
⊢ l = acc.data ++ x :: xs → removeNthTR.go l (x :: xs) n acc = acc.data ++ removeNth (x :: xs) n

tactic: intro h
state_before: case h.h.h.cons.succ
α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → removeNthTR.go l xs n acc = acc.data ++ removeNth xs n
acc : Array α
n✝ : Nat
⊢ l = acc.data ++ x :: xs → removeNthTR.go l xs n✝ (Array.push acc x) = acc.data ++ x :: removeNth xs n✝

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

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

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

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

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