Module E.
#[universes(polymorphic=yes)]
Definition t@{u} (A : Type@{u}) : Type@{u} := A -> Prop.
#[universes(polymorphic=yes)]
Definition In@{u} {A : Type@{u}} (x : A) (X : t@{u} A) : Prop := X x.
#[universes(polymorphic=yes)]
Definition isSubsetOf@{u} {A : Type@{u}} (X1 : t@{u} A) (X2 : t@{u} A) : Prop :=
forall x, In@{u} x X1 -> In@{u} x X2.
#[local] Infix "\in" := In : type_scope.
#[local] Infix "\subseteq" := isSubsetOf : type_scope.
#[global]
Instance ensemble_isProset {A : Type} : isProset (E.t A) :=
let PROSET : isProset (E.t A) := pi_isProset (fun _ : A => Prop_isProset) in
{|
leProp := isSubsetOf;
Proset_isSetoid := {| eqProp lhs rhs := forall x, x \in lhs <-> x \in rhs; eqProp_Equivalence := PROSET.(Proset_isSetoid).(eqProp_Equivalence) |};
leProp_PreOrder := PROSET.(leProp_PreOrder);
leProp_PartialOrder := PROSET.(leProp_PartialOrder);
|}.
#[global]
Add Parametric Morphism {A : Type}
: (@In A) with signature (eq ==> eqProp ==> iff)
as In_compatWith_eqProp.
(** Section SET_CONSTRUCTIONS. *)
Inductive unions {A : Type} (Xs : E.t (E.t A)) (x : A) : Prop :=
| In_unions X
(H_in : x \in X)
(H_IN : X \in Xs)
: x \in unions Xs.
#[local] Hint Constructors unions : core.
#[global] Hint Rewrite in_unions_iff : simplication_hints.
#[global]
Instance unions_eqPropCompatible1 (A : Type)
: eqPropCompatible1 (@unions A).
Inductive union {A : Type} (X1 : E.t A) (X2 : E.t A) (x : A) : Prop :=
| In_union_l
(H_inl : x \in X1)
: x \in union X1 X2
| In_union_r
(H_inr : x \in X2)
: x \in union X1 X2.
#[local] Hint Constructors union : core.
#[global] Hint Rewrite in_union_iff : simplication_hints.
#[global]
Instance union_eqPropCompatible2 (A : Type)
: eqPropCompatible2 (@union A).
Inductive empty {A : Type} : E.t A :=.
#[local] Hint Constructors empty : core.
#[global] Hint Rewrite in_empty_iff : simplication_hints.
Inductive intersection {A : Type} (X1 : E.t A) (X2 : E.t A) (x : A) : Prop :=
| In_intersection
(H_IN1 : x \in X1)
(H_IN2 : x \in X2)
: x \in intersection X1 X2.
#[local] Hint Constructors intersection : core.
#[global] Hint Rewrite in_intersection_iff : simplication_hints.
#[global]
Instance intersection_eqPropCompatible2 (A : Type)
: eqPropCompatible2 (@intersection A).
Inductive singleton {A : Type} (x : A) : E.t A :=
| In_singleton
: x \in singleton x.
#[local] Hint Constructors singleton : core.
#[global] Hint Rewrite in_singleton_iff : simplication_hints.
Inductive image {A : Type} {B : Type} (f : A -> B) (X : E.t A) (y : B) : Prop :=
| In_image x
(IMAGE : y = f x)
(H_IN : x \in X)
: y \in image f X.
#[local] Hint Constructors image : core.

Lemma in_image_iff (A : Type) (B : Type) f X
: forall z, z \in @image A B f X <-> (exists x, z = f x /\ x \in X).