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

tactic: rfl
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 α
⊢ (zipWith (fun x x_1 => x ++ x_1) (splitOnP p []) (map (fun x => [x]) (filter p []) ++ [[]])).join = []
state_after: no goals

tactic: rw [splitOnP_cons, filter]
state_before: 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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
⊢ (zipWith (fun x x_1 => x ++ x_1) (splitOnP p (a :: as')) (map (fun x => [x]) (filter p (a :: as')) ++ [[]])).join =
    a :: as'
state_after: 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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
⊢ (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') ++
          [[]])).join =
    a :: as'

tactic: by_cases h : p a
state_before: 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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
⊢ (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') ++
          [[]])).join =
    a :: as'
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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
h : p a = true
⊢ (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') ++
          [[]])).join =
    a :: as'

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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
h : ¬p a = true
⊢ (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') ++
          [[]])).join =
    a :: as'

tactic: rw [if_pos h, h, map, cons_append, zipWith, nil_append, join, cons_append, cons_inj_right]
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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
h : p a = true
⊢ (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') ++
          [[]])).join =
    a :: as'
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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
h : p a = true
⊢ [] ++ (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'

tactic: exact ih
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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
h : p a = true
⊢ [] ++ (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
state_after: no goals

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_right]
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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
h : ¬p a = true
⊢ (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') ++
          [[]])).join =
    a :: as'
state_after: 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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
h : ¬p a = true
⊢ (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') ++
          [[]])).join =
    as'

tactic: exact 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 α
a : α
as' : List α
ih : (zipWith (fun x x_1 => x ++ x_1) (splitOnP p as') (map (fun x => [x]) (filter p as') ++ [[]])).join = as'
h : ¬p a = true
⊢ (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') ++
          [[]])).join =
    as'
state_after: no goals

tactic: cases xs with | nil => contradiction | cons =>
  cases ys with | nil => contradiction | cons => rfl
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 α
as : List α
xs ys : List (List α)
a : α
hxs : xs ≠ []
hys : ys ≠ []
⊢ (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) xs) ys).join = a :: (zipWith (fun x x_1 => x ++ x_1) xs ys).join
state_after: no goals

tactic: contradiction
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 α
as : List α
ys : List (List α)
a : α
hys : ys ≠ []
hxs : [] ≠ []
⊢ (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) []) ys).join = a :: (zipWith (fun x x_1 => x ++ x_1) [] ys).join
state_after: no goals

tactic: cases ys with | nil => contradiction | cons => rfl
state_before: 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 α
as : List α
ys : List (List α)
a : α
hys : ys ≠ []
head✝ : List α
tail✝ : List (List α)
hxs : head✝ :: tail✝ ≠ []
⊢ (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) (head✝ :: tail✝)) ys).join =
    a :: (zipWith (fun x x_1 => x ++ x_1) (head✝ :: tail✝) ys).join
state_after: no goals

tactic: contradiction
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 α
as : List α
a : α
head✝ : List α
tail✝ : List (List α)
hxs : head✝ :: tail✝ ≠ []
hys : [] ≠ []
⊢ (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) (head✝ :: tail✝)) []).join =
    a :: (zipWith (fun x x_1 => x ++ x_1) (head✝ :: tail✝) []).join
state_after: no goals

tactic: rfl
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 α
as : List α
a : α
head✝¹ : List α
tail✝¹ : List (List α)
hxs : head✝¹ :: tail✝¹ ≠ []
head✝ : List α
tail✝ : List (List α)
hys : head✝ :: tail✝ ≠ []
⊢ (zipWith (fun x x_1 => x ++ x_1) (modifyHead (cons a) (head✝¹ :: tail✝¹)) (head✝ :: tail✝)).join =
    a :: (zipWith (fun x x_1 => x ++ x_1) (head✝¹ :: tail✝¹) (head✝ :: tail✝)).join
state_after: no goals