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

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 α
⊢ [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: induction' xs with hd tl ih
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: 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 : 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 [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] (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: split_ifs with h
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: cases tl' <;> simpa [join, h'] using ih
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: simp [join]
state_before: 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 = []
state_after: no goals

tactic: exact (splitOnP_ne_nil _ tl h').elim
state_before: case cons.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 α
hd : α
tl : List α
ih : (intersperse [x] (splitOnP (fun x_1 => x_1 == x) tl)).join = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = []
⊢ (intersperse [x] (splitOnP (fun x_1 => x_1 == x) (hd :: tl))).join = hd :: tl
state_after: no goals

tactic: rw [beq_iff_eq] at h
state_before: 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
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
⊢ (intersperse [x] ([] :: splitOnP (fun x_1 => x_1 == x) tl)).join = hd :: tl

tactic: subst h
state_before: 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
⊢ (intersperse [x] ([] :: 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 α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : (intersperse [hd] (hd' :: tl')).join = tl
h' : splitOnP (fun x => x == hd) tl = hd' :: tl'
⊢ (intersperse [hd] ([] :: splitOnP (fun x => x == hd) tl)).join = hd :: tl

tactic: simp [ih, join, h']
state_before: 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 α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : (intersperse [hd] (hd' :: tl')).join = tl
h' : splitOnP (fun x => x == hd) tl = hd' :: tl'
⊢ (intersperse [hd] ([] :: splitOnP (fun x => x == hd) tl)).join = hd :: tl
state_after: no goals