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

tactic: funext α n l
state_before: ⊢ @take = @takeTR

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

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

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

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

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

tactic: cases n <;> simp [take, takeTR.go]
state_before: case h.h.h.nil
α : Type u_1
l : List α
n : Nat
acc : Array α
⊢ l = acc.data ++ [] → takeTR.go l [] n acc = acc.data ++ take n []

tactic: cases n with simp [take, takeTR.go]
| succ n => intro h; 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 → takeTR.go l xs n acc = acc.data ++ take n xs
n : Nat
acc : Array α
⊢ l = acc.data ++ x :: xs → takeTR.go l (x :: xs) n acc = acc.data ++ take n (x :: xs)

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 → takeTR.go l xs n acc = acc.data ++ take n xs
acc : Array α
n : Nat
⊢ l = acc.data ++ x :: xs → takeTR.go l xs n (Array.push acc x) = acc.data ++ x :: take n xs

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 → takeTR.go l xs n acc = acc.data ++ take n xs
acc : Array α
n : Nat
h : l = acc.data ++ x :: xs
⊢ takeTR.go l xs n (Array.push acc x) = acc.data ++ x :: take n xs

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 → takeTR.go l xs n acc = acc.data ++ take n xs
acc : Array α
n : Nat
h : l = acc.data ++ x :: xs
⊢ (Array.push acc x).data ++ take n xs = acc.data ++ x :: take n xs

case h.h.h.cons.succ.a
α : Type u_1
l : List α
x : α
xs : List α
IH : ∀ (n : Nat) (acc : Array α), l = acc.data ++ xs → takeTR.go l xs n acc = acc.data ++ take n xs
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 → takeTR.go l xs n acc = acc.data ++ take n xs
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 → takeTR.go l xs n acc = acc.data ++ take n xs
acc : Array α
n : Nat
h : l = acc.data ++ x :: xs
⊢ l = acc.data ++ x :: xs