Theorem: List.splitOnP.go_acc
File: Mathlib/Data/List/Basic.lean

tactic: simp only [go, modifyHead, splitOnP_nil, append_nil]
state_before: case nil
ι : Type ?u.293492
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
acc : List α
⊢ go p [] acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p [])

tactic: simp only [splitOnP, go]
state_before: case cons
ι : Type ?u.293492
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
hd : α
tl : List α
ih : ∀ (acc : List α), go p tl acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p tl)
acc : List α
⊢ go p (hd :: tl) acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p (hd :: tl))

tactic: split
state_before: case cons
ι : Type ?u.293492
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
hd : α
tl : List α
ih : ∀ (acc : List α), go p tl acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p tl)
acc : List α
⊢ (if p hd = true then reverse acc :: go p tl [] else go p tl (hd :: acc)) =
    modifyHead (fun x => reverse acc ++ x) (if p hd = true then reverse [] :: go p tl [] else go p tl [hd])

tactic: simp only [modifyHead, reverse_nil, append_nil]
state_before: case cons.inl
ι : Type ?u.293492
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
hd : α
tl : List α
ih : ∀ (acc : List α), go p tl acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p tl)
acc : List α
h✝ : p hd = true
⊢ reverse acc :: go p tl [] = modifyHead (fun x => reverse acc ++ x) (reverse [] :: go p tl [])

tactic: rw [ih [hd], modifyHead_modifyHead, ih]
state_before: case cons.inr
ι : Type ?u.293492
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
hd : α
tl : List α
ih : ∀ (acc : List α), go p tl acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p tl)
acc : List α
h✝ : ¬p hd = true
⊢ go p tl (hd :: acc) = modifyHead (fun x => reverse acc ++ x) (go p tl [hd])

tactic: congr
state_before: case cons.inr
ι : Type ?u.293492
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
hd : α
tl : List α
ih : ∀ (acc : List α), go p tl acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p tl)
acc : List α
h✝ : ¬p hd = true
⊢ modifyHead (fun x => reverse (hd :: acc) ++ x) (splitOnP p tl) =
    modifyHead ((fun x => reverse acc ++ x) ∘ fun x => reverse [hd] ++ x) (splitOnP p tl)

tactic: funext x
state_before: case cons.inr.e_f
ι : Type ?u.293492
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
hd : α
tl : List α
ih : ∀ (acc : List α), go p tl acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p tl)
acc : List α
h✝ : ¬p hd = true
⊢ (fun x => reverse (hd :: acc) ++ x) = (fun x => reverse acc ++ x) ∘ fun x => reverse [hd] ++ x

tactic: simp only [reverse_cons, append_assoc]
state_before: case cons.inr.e_f.h
ι : Type ?u.293492
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
hd : α
tl : List α
ih : ∀ (acc : List α), go p tl acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p tl)
acc : List α
h✝ : ¬p hd = true
x : List α
⊢ reverse (hd :: acc) ++ x = ((fun x => reverse acc ++ x) ∘ fun x => reverse [hd] ++ x) x

tactic: rfl
state_before: case cons.inr.e_f.h
ι : Type ?u.293492
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
hd : α
tl : List α
ih : ∀ (acc : List α), go p tl acc = modifyHead (fun x => reverse acc ++ x) (splitOnP p tl)
acc : List α
h✝ : ¬p hd = true
x : List α
⊢ reverse acc ++ ([hd] ++ x) = ((fun x => reverse acc ++ x) ∘ fun x => reverse [] ++ ([hd] ++ x)) x