refactor(library): move 'filter' to init folder
This commit is contained in:
parent
69cc58dbda
commit
26bc1602a7
2 changed files with 4 additions and 4 deletions
|
|
@ -132,10 +132,6 @@ theorem length_map₂ : ∀(f : A → B → C) x y, length (map₂ f x y) = min
|
|||
... = min (length (xh::xr)) (length (yh::yr)) : rfl
|
||||
|
||||
/- filter -/
|
||||
definition filter (p : A → Prop) [h : decidable_pred p] : list A → list A
|
||||
| [] := []
|
||||
| (a::l) := if p a then a :: filter l else filter l
|
||||
|
||||
theorem filter_nil [simp] (p : A → Prop) [h : decidable_pred p] : filter p [] = [] := rfl
|
||||
|
||||
theorem filter_cons_of_pos [simp] {p : A → Prop} [h : decidable_pred p] {a : A} : ∀ l, p a → filter p (a::l) = a :: filter p l :=
|
||||
|
|
|
|||
|
|
@ -65,6 +65,10 @@ definition map {B : Type} (f : A → B) : list A → list B
|
|||
definition join : list (list A) → list A
|
||||
| [] := []
|
||||
| (l :: ls) := append l (join ls)
|
||||
|
||||
definition filter (p : A → Prop) [h : decidable_pred p] : list A → list A
|
||||
| [] := []
|
||||
| (a::l) := if p a then a :: filter l else filter l
|
||||
end list
|
||||
|
||||
definition list_has_append [instance] {A : Type} : has_append (list A) :=
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue