lean4-htt/tests/lean/run/def13.lean
Leonardo de Moura 56d5d6c564 chore: fix tests
2021-05-04 15:42:03 -07:00

19 lines
594 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

variable {α} (p : α → Prop) [DecidablePred p]
def filter : List α → List α
| [] => []
| a::as => if p a then a :: filter as else filter as
theorem filter_nil : filter p [] = [] :=
rfl
theorem filter_cons (a : α) (as : List α) : filter p (a :: as) = if p a then a :: filter p as else filter p as :=
rfl
theorem filter_cons_of_pos {a : α} (as : List α) (h : p a) : filter p (a :: as) = a :: filter p as := by
rw [filter_cons];
rw [ifPos h]
theorem filter_cons_of_neg {a : α} (as : List α) (h : ¬ p a) : filter p (a :: as) = filter p as := by
rw [filter_cons];
rw [ifNeg h]