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

tactic: induction' l with hd tl IH
state_before: ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ : α → Bool
l : List α
p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
⊢ filter p l <+ filter q l
state_after: case nil
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
⊢ filter p [] <+ filter q []

case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
⊢ filter p (hd :: tl) <+ filter q (hd :: tl)

tactic: rfl
state_before: case nil
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
⊢ filter p [] <+ filter q []
state_after: no goals

tactic: by_cases hp : p hd
state_before: case cons
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
⊢ filter p (hd :: tl) <+ filter q (hd :: tl)
state_after: case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : p hd = true
⊢ filter p (hd :: tl) <+ filter q (hd :: tl)

case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
⊢ filter p (hd :: tl) <+ filter q (hd :: tl)

tactic: rw [filter_cons_of_pos _ hp, filter_cons_of_pos _ (h _ hp)]
state_before: case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : p hd = true
⊢ filter p (hd :: tl) <+ filter q (hd :: tl)
state_after: case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : p hd = true
⊢ hd :: filter p tl <+ hd :: filter q tl

tactic: exact IH.cons_cons hd
state_before: case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : p hd = true
⊢ hd :: filter p tl <+ hd :: filter q tl
state_after: no goals

tactic: rw [filter_cons_of_neg _ hp]
state_before: case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
⊢ filter p (hd :: tl) <+ filter q (hd :: tl)
state_after: case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
⊢ filter p tl <+ filter q (hd :: tl)

tactic: by_cases hq : q hd
state_before: case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
⊢ filter p tl <+ filter q (hd :: tl)
state_after: case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
hq : q hd = true
⊢ filter p tl <+ filter q (hd :: tl)

case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
hq : ¬q hd = true
⊢ filter p tl <+ filter q (hd :: tl)

tactic: rw [filter_cons_of_pos _ hq]
state_before: case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
hq : q hd = true
⊢ filter p tl <+ filter q (hd :: tl)
state_after: case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
hq : q hd = true
⊢ filter p tl <+ hd :: filter q tl

tactic: exact sublist_cons_of_sublist hd IH
state_before: case pos
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
hq : q hd = true
⊢ filter p tl <+ hd :: filter q tl
state_after: no goals

tactic: rw [filter_cons_of_neg _ hq]
state_before: case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
hq : ¬q hd = true
⊢ filter p tl <+ filter q (hd :: tl)
state_after: case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
hq : ¬q hd = true
⊢ filter p tl <+ filter q tl

tactic: exact IH
state_before: case neg
ι : Type u_1
α : Type u
β : Type v
γ : Type w
l₁ l₂ : List α
p✝ p q : α → Bool
h : ∀ (a : α), p a = true → q a = true
hd : α
tl : List α
IH : filter p tl <+ filter q tl
hp : ¬p hd = true
hq : ¬q hd = true
⊢ filter p tl <+ filter q tl
state_after: no goals