Global Instance : forall T, Equivalence (@set_eq T).Definition set_incl {A} (m1 m2 : set A) :=
  forall (a : A), m1 a -> m2 a.Definition set0 {T} := [set _ : T | False].Definition setT {T} := [set _ : T | True].Implicit Types (a x : T) (A B : set T).Definition set1 a := eq a.Definition setU A B := [set x | x \in A \/ x \in B].Definition setI A B := [set x | x \in A /\ x \in B].Definition codom (f : T -> U) := [set y | exists x, f x = y].Definition bigcup A (F : T -> set U) := [set x | exists i, i \in A /\ x \in F i].Definition bigcap (A : set T) (F : T -> set U) :=
  [set x | forall (i : T), i \in A -> x \in F i].Definition imset {T U} (f : T -> U) A := bigcup A (fun x => set1 (f x)).Definition imset2 T U V (f : T -> U -> V) A1 A2 :=
  imset (prod_curry f) (setX A1 A2).Definition codom2 T U V (f : T -> U -> V) := codom (prod_curry f).Definition lift {T} (S : set T) : set (option T) :=
  Some @: S :|: [set None].

Lemma imset_id T (A : set T) : id @: A <--> A.