Section BoolSpec.
Variable s s' s'' : t.
Variable x y z : elt.
Variable f : elt->bool.
End BoolSpec.
(** * [E.eq] and [Equal] are setoid equalities *)
Instance E_ST : Equivalence E.eq.
Instance Equal_ST : Equivalence Equal.
Instance In_m : Proper (E.eq ==> Equal ==> iff) In.
Instance is_empty_m : Proper (Equal==> Logic.eq) is_empty.
Instance Empty_m : Proper (Equal ==> iff) Empty.
Instance mem_m : Proper (E.eq ==> Equal ==> Logic.eq) mem.
Instance singleton_m : Proper (E.eq ==> Equal) singleton.
Instance add_m : Proper (E.eq==>Equal==>Equal) add.
Instance remove_m : Proper (E.eq==>Equal==>Equal) remove.
Instance union_m : Proper (Equal==>Equal==>Equal) union.
Instance inter_m : Proper (Equal==>Equal==>Equal) inter.
Instance diff_m : Proper (Equal==>Equal==>Equal) diff.
Instance Subset_m : Proper (Equal==>Equal==>iff) Subset.
Instance subset_m : Proper (Equal ==> Equal ==> Logic.eq) subset.
Instance equal_m : Proper (Equal ==> Equal ==> Logic.eq) equal.
(* [Subset] is a setoid order *)
Add Morphism Empty with signature Subset --> Basics.impl as Empty_s_m.
Add Morphism add with signature E.eq ==> Subset ++> Subset as add_s_m.
Add Morphism remove with signature E.eq ==> Subset ++> Subset as remove_s_m.
Add Morphism union with signature Subset ++> Subset ++> Subset as union_s_m.
Add Morphism inter with signature Subset ++> Subset ++> Subset as inter_s_m.
Add Morphism diff with signature Subset ++> Subset --> Subset as diff_s_m.
(* [fold], [filter], [for_all], [exists_] and [partition] cannot be proved morphism without additional hypothesis on [f]. For instance: *)

Lemma filter_subset : forall f, compat_bool E.eq f ->
forall s s', s[<=]s' -> filter f s [<=] filter f s'.