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

tactic: rfl
state_before: case nil
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
⊢ join (zipWith (fun x x_1 => x ++ x_1) (splitOnP p []) (map (fun x => [x]) (filter p []) ++ [[]])) = []

tactic: rw [splitOnP_cons, filter]
state_before: case cons
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
a : α
as' : List α
ih : join (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])) = as'
⊢ join (zipWith (fun x x_1 => x ++ x_1) (splitOnP p (a :: as')) (map (fun x => [x]) (filter p (a :: as')) ++ [[]])) =
    a :: as'

tactic: by_cases h : p a
state_before: case cons
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
a : α
as' : List α
ih : join (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])) = as'
⊢ join
      (zipWith (fun x x_1 => x ++ x_1)
        (if p a = true then [] :: splitOnP p as' else modifyHead (cons a) (splitOnP p as'))
        (map (fun x => [x])
            (match p a with
            | true => a :: filter p as'
            | false => filter p as') ++
          [[]])) =
    a :: as'

tactic: rw [if_pos h, h, map, cons_append, zipWith, nil_append, join, cons_append, cons_inj]
state_before: case pos
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
a : α
as' : List α
ih : join (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])) = as'
h : p a = true
⊢ join
      (zipWith (fun x x_1 => x ++ x_1)
        (if p a = true then [] :: splitOnP p as' else modifyHead (cons a) (splitOnP p as'))
        (map (fun x => [x])
            (match p a with
            | true => a :: filter p as'
            | false => filter p as') ++
          [[]])) =
    a :: as'

tactic: exact ih
state_before: case pos
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
a : α
as' : List α
ih : join (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])) = as'
h : p a = true
⊢ [] ++ join (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])) = as'

tactic: rw [if_neg h, eq_false_of_ne_true h, join_zipWith (splitOnP_ne_nil _ _)
  (append_ne_nil_of_ne_nil_right _ [[]] (cons_ne_nil [] [])), cons_inj]
state_before: case neg
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
a : α
as' : List α
ih : join (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])) = as'
h : ¬p a = true
⊢ join
      (zipWith (fun x x_1 => x ++ x_1)
        (if p a = true then [] :: splitOnP p as' else modifyHead (cons a) (splitOnP p as'))
        (map (fun x => [x])
            (match p a with
            | true => a :: filter p as'
            | false => filter p as') ++
          [[]])) =
    a :: as'

tactic: exact ih
state_before: case neg
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
a : α
as' : List α
ih : join (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])) = as'
h : ¬p a = true
⊢ join
      (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as')
        (map (fun x => [x])
            (match false with
            | true => a :: filter p as'
            | false => filter p as') ++
          [[]])) =
    as'

tactic: cases xs with | nil => contradiction | cons =>
  cases ys with | nil => contradiction | cons => rfl
state_before: ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs✝ ys✝ : List α
ls : List (List α)
f : List α → List α
as : List α
xs ys : List (List α)
a : α
hxs : xs ≠ []
hys : ys ≠ []
⊢ join (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) xs) ys) = a :: join (zipWith (fun x x_1 => x ++ x_1) xs ys)

tactic: contradiction
state_before: case nil
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys✝ : List α
ls : List (List α)
f : List α → List α
as : List α
ys : List (List α)
a : α
hys : ys ≠ []
hxs : [] ≠ []
⊢ join (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) []) ys) = a :: join (zipWith (fun x x_1 => x ++ x_1) [] ys)

tactic: cases ys with | nil => contradiction | cons => rfl
state_before: case cons
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys✝ : List α
ls : List (List α)
f : List α → List α
as : List α
ys : List (List α)
a : α
hys : ys ≠ []
head✝ : List α
tail✝ : List (List α)
hxs : head✝ :: tail✝ ≠ []
⊢ join (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) (head✝ :: tail✝)) ys) =
    a :: join (zipWith (fun x x_1 => x ++ x_1) (head✝ :: tail✝) ys)

tactic: contradiction
state_before: case cons.nil
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
as : List α
a : α
head✝ : List α
tail✝ : List (List α)
hxs : head✝ :: tail✝ ≠ []
hys : [] ≠ []
⊢ join (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) (head✝ :: tail✝)) []) =
    a :: join (zipWith (fun x x_1 => x ++ x_1) (head✝ :: tail✝) [])

tactic: rfl
state_before: case cons.cons
ι : Type ?u.296730
α : Type u
β : Type v
γ : Type w
δ : Type x
l₁ l₂ : List α
p : α → Bool
xs ys : List α
ls : List (List α)
f : List α → List α
as : List α
a : α
head✝¹ : List α
tail✝¹ : List (List α)
hxs : head✝¹ :: tail✝¹ ≠ []
head✝ : List α
tail✝ : List (List α)
hys : head✝ :: tail✝ ≠ []
⊢ join (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) (head✝¹ :: tail✝¹)) (head✝ :: tail✝)) =
    a :: join (zipWith (fun x x_1 => x ++ x_1) (head✝¹ :: tail✝¹) (head✝ :: tail✝))