lean4-htt/tests/lean/run/def13.lean
Leonardo de Moura 1d9d8c7e75 chore: fix tests
close #402
2021-08-07 13:22:58 -07:00

19 lines
596 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 [if_pos h]
theorem filter_cons_of_neg {a : α} (as : List α) (h : ¬ p a) : filter p (a :: as) = filter p as := by
rw [filter_cons];
rw [if_neg h]