End Bool.
(*******************************)
(** ** Further filtering facts *)
(*******************************)
Section Filtering.

(* Specifications: *)
Lemma filter_map_swap A B f g l :
filter f (@map A B g l) = @map A B g (filter (fun a => f (g a)) l).
Lemma ext_in_filter : forall (f g : A -> bool) (l : list A),
filter f l = filter g l -> (forall a, In a l -> f a = g a).
Lemma filter_ext_in_iff : forall (f g : A -> bool) (l : list A),
filter f l = filter g l <-> (forall a, In a l -> f a = g a).
Lemma filter_map : forall (f g : A -> bool) (l : list A),
filter f l = filter g l <-> map f l = map g l.
Lemma filter_ext : forall (f g : A -> bool),
(forall a, f a = g a) -> forall l, filter f l = filter g l.
Lemma partition_as_filter f (l : list A) : partition f l = (filter f l, filter (fun x => negb (f x)) l).
Corollary filter_length f (l : list A) : length (filter f l) + length (filter (fun x => negb (f x)) l) = length l.
Hypothesis eq_dec : forall x y : A, {x = y}+{x <> y}.