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

tactic: simp only [intercalate, splitOn]
state_before: ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
⊢ intercalate [x] (splitOn x xs) = xs

tactic: induction' xs with hd tl ih
state_before: ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
⊢ join (intersperse [x] (splitOnP (fun x_1 => x_1 == x) xs)) = xs

tactic: rw [h'] at ih
state_before: case cons.cons
ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl : List α
ih : join (intersperse [x] (splitOnP (fun x_1 => x_1 == x) tl)) = tl
hd' : List α
tl' : List (List α)
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
⊢ join (intersperse [x] (splitOnP (fun x_1 => x_1 == x) (hd :: tl))) = hd :: tl

tactic: rw [splitOnP_cons]
state_before: case cons.cons
ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
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 : join (intersperse [x] (hd' :: tl')) = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
⊢ join (intersperse [x] (splitOnP (fun x_1 => x_1 == x) (hd :: tl))) = hd :: tl

tactic: split_ifs with h
state_before: case cons.cons
ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
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 : join (intersperse [x] (hd' :: tl')) = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
⊢ join
      (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))) =
    hd :: tl

tactic: cases tl' <;> simpa [join, h'] using ih
state_before: case cons.cons.inr
ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
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 : join (intersperse [x] (hd' :: tl')) = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
h : ¬(hd == x) = true
⊢ join (intersperse [x] (modifyHead (cons hd) (splitOnP (fun x_1 => x_1 == x) tl))) = hd :: tl

tactic: simp [join]
state_before: case nil
ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
⊢ join (intersperse [x] (splitOnP (fun x_1 => x_1 == x) [])) = []

tactic: exact (splitOnP_ne_nil _ tl h').elim
state_before: case cons.nil
ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
x : α
inst✝ : DecidableEq α
hd : α
tl : List α
ih : join (intersperse [x] (splitOnP (fun x_1 => x_1 == x) tl)) = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = []
⊢ join (intersperse [x] (splitOnP (fun x_1 => x_1 == x) (hd :: tl))) = hd :: tl

tactic: rw [beq_iff_eq] at h
state_before: case cons.cons.inl
ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
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 : join (intersperse [x] (hd' :: tl')) = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
h : (hd == x) = true
⊢ join (intersperse [x] ([] :: splitOnP (fun x_1 => x_1 == x) tl)) = hd :: tl

tactic: subst h
state_before: case cons.cons.inl
ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
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 : join (intersperse [x] (hd' :: tl')) = tl
h' : splitOnP (fun x_1 => x_1 == x) tl = hd' :: tl'
h : hd = x
⊢ join (intersperse [x] ([] :: splitOnP (fun x_1 => x_1 == x) tl)) = hd :: tl

tactic: simp [ih, join, h']
state_before: case cons.cons.inl
ι : Type ?u.305889
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
inst✝ : DecidableEq α
hd : α
tl hd' : List α
tl' : List (List α)
ih : join (intersperse [hd] (hd' :: tl')) = tl
h' : splitOnP (fun x => x == hd) tl = hd' :: tl'
⊢ join (intersperse [hd] ([] :: splitOnP (fun x => x == hd) tl)) = hd :: tl