Theorem: List.intercalate_splitOn
File: Mathlib/Data/List/Basic.lean

Proof steps:
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
⊢ [x].intercalate (splitOn x xs) = xs
state_after: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
⊢ (intersperse [x] (splitOnP (fun x_1 => x_1 == x) xs)).join = xs
tactic: simp only [intercalate, splitOn]
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
⊢ (intersperse [x] (splitOnP (fun x_1 => x_1 == x) xs)).join = xs
state_after: case nil
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
⊢ (intersperse [x] (splitOnP (fun x_1 => x_1 == x) [])).join = []

case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl : List α
ih : (intersperse [x] (splitOnP (fun x_1 => x_1 == x) tl)).join = tl
⊢ (intersperse [x] (splitOnP (fun x_1 => x_1 == x) (hd :: tl))).join = hd :: tl
tactic: induction' xs with hd tl ih
state_before: case cons.cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl : List α
ih : (intersperse [x] (splitOnP (fun x_1 => x_1 == x) tl)).join = tl
hd' : List α
tl' : List (List α)
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
⊢ (intersperse [x] (splitOnP (fun x_1 => x_1 == x) (hd :: tl))).join = hd :: tl
state_after: case cons.cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : (intersperse [x] (hd' :: tl')).join = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
⊢ (intersperse [x] (splitOnP (fun x_1 => x_1 == x) (hd :: tl))).join = hd :: tl
tactic: rw [h'] at ih
state_before: case cons.cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : (intersperse [x] (hd' :: tl')).join = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
⊢ (intersperse [x] (splitOnP (fun x_1 => x_1 == x) (hd :: tl))).join = hd :: tl
state_after: case cons.cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : (intersperse [x] (hd' :: tl')).join = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
⊢ (intersperse [x]
        (if (hd == x) = true then [] :: splitOnP (fun x_1 => x_1 == x) tl
        else modifyHead (cons hd) (splitOnP (fun x_1 => x_1 == x) tl))).join =
    hd :: tl
tactic: rw [splitOnP_cons]
state_before: case cons.cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : (intersperse [x] (hd' :: tl')).join = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
⊢ (intersperse [x]
        (if (hd == x) = true then [] :: splitOnP (fun x_1 => x_1 == x) tl
        else modifyHead (cons hd) (splitOnP (fun x_1 => x_1 == x) tl))).join =
    hd :: tl
state_after: case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : (intersperse [x] (hd' :: tl')).join = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
h : (hd == x) = true
⊢ (intersperse [x] ([] :: splitOnP (fun x_1 => x_1 == x) tl)).join = hd :: tl

case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : (intersperse [x] (hd' :: tl')).join = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
h : ¬(hd == x) = true
⊢ (intersperse [x] (modifyHead (cons hd) (splitOnP (fun x_1 => x_1 == x) tl))).join = hd :: tl
tactic: split_ifs with h
state_before: case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : (intersperse [x] (hd' :: tl')).join = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
h : ¬(hd == x) = true
⊢ (intersperse [x] (modifyHead (cons hd) (splitOnP (fun x_1 => x_1 == x) tl))).join = hd :: tl
state_after: no goals
tactic: cases tl' <;> simpa [join, h'] using ih