Coercion seq_In T : seq T -> set T := fun s x => List.In x s.Coercion list_In T : list T -> set T := fun s x => List.In x s.

(* Specifications: *)
Lemma subconsset T (A : set T) x s : x :: s \subset A <-> x \in A /\ s \subset A.
Lemma reindex_bigcup I J K (h : J -> I) (F : I -> set K) A B : h @: B <--> A -> \bigcup_(x in A) F x <--> \bigcup_(y in B) F (h y).
Lemma bigcup_pointwise_incl A B (s : set A) (t : A -> set B) (u : set B) : (forall x, x \in s -> t x \subset u) -> \bigcup_(x in s) t x \subset u.
Lemma setI_comm {U} (s1 s2 : set U) : s1 :&: s2 <--> s2 :&: s1.
Lemma setU_comm {U} (s1 s2 : set U) : s1 :|: s2 <--> s2 :|: s1.
Lemma setI_set0_abs {U} (s : set U) : (s :&: set0) <--> set0.
Lemma setU_set0_neut {U} (s : set U) : (s :|: set0) <--> s.
Lemma setU_set0_neut_eq {A} (s s1 : set A) : s1 <--> set0 -> s <--> s :|: s1.
Lemma setU_set0_l {A} (s1 s2 s3 : set A) : s1 <--> set0 -> s2 <--> s3 -> (s1 :|: s2) <--> s3.
Lemma setU_set0_r {A} (s1 s2 s3 : set A) : s1 <--> set0 -> s3 <--> s2 -> s3 <--> (s1 :|: s2).
Lemma setI_setT_neut {U} (s : set U) : (s :&: setT) <--> s.
Lemma setU_setT_abs {U} (s : set U) : (s :|: setT) <--> setT.
Lemma setU_set_eq_compat {T} (s1 s2 s1' s2' : set T) : s1 <--> s1' -> s2 <--> s2' -> s1 :|: s2 <--> s1' :|: s2'.
Lemma setU_set_subset_compat : forall (T : Type) (s1 s2 s1' s2' : set T), s1 \subset s1' -> s2 \subset s2' -> s1 :|: s2 \subset s1' :|: s2'.
Lemma setU_set_incl_r : forall (T : Type) (s1 s2 s2' : set T), s1 \subset s2' -> s1 \subset s2 :|: s2'.
Lemma setU_assoc {U} (s1 s2 s3 : set U) : (s1 :|: (s2 :|: s3)) <--> ((s1 :|: s2) :|: s3).
Lemma setI_assoc {U} (s1 s2 s3 : set U) : (s1 :&: (s2 :&: s3)) <--> ((s1 :&: s2) :&: s3).
Lemma setI_impl_l {T} (s1 s2 : set T) : s1 \subset s2 -> s1 :&: s2 <--> s1.
Lemma setI_impl_r {T} (s1 s2 : set T) : s2 \subset s1 -> s1 :&: s2 <--> s2.
Lemma setI_set0 {U} (s1 s2 : set U) : (forall x, s1 x -> ~ s2 x) -> (s1 :&: s2) <--> set0.
Lemma setI_subset_compat {U} (s1 s2 s1' s2' : set U) : s1 \subset s1' -> s2 \subset s2' -> (s1 :&: s2) \subset (s1' :&: s2').
Lemma setU_subset_r {U} (s1 s2 s3 : set U) : s1 \subset s3 -> s1 \subset (s2 :|: s3).
Lemma setU_subset_l {U} (s1 s2 s3 : set U) : s1 \subset s2 -> s1 \subset (s2 :|: s3).
Lemma setI_setU_distr {U} (s1 s2 s3 : set U) : ((s1 :|: s2) :&: s3) <--> ((s1 :&: s3) :|: (s2 :&: s3)).
Lemma bigcap_set0 (T U : Type) (F : T -> set U) : \bigcap_(x in set0) F x <--> setT.
Lemma incl_bigcapl T U A B (F : T -> set U) : B \subset A -> \bigcap_(x in A) F x \subset \bigcap_(x in B) F x.
Lemma eq_bigcapr (T U : Type) (A : set T) (F G : T -> set U) : (forall x : T, F x <--> G x) -> \bigcap_(x in A) F x <--> \bigcap_(x in A) G x.
Lemma eq_bigcapl T U A B (F : T -> set U) : A <--> B -> \bigcap_(x in A) F x <--> \bigcap_(x in B) F x.
Lemma eq_bigcup' : forall (T U : Type) (A B : set T) (F G : T -> set U), A <--> B -> (forall x, F x <--> G x) -> \bigcup_(x in A) F x <--> \bigcup_(x in B) G x.
Lemma incl_bigcup_compat : forall (T U : Type) (A B : set T) (F G : T -> set U), A \subset B -> (forall x : T, F x \subset G x) -> \bigcup_(x in A) F x \subset \bigcup_(x in B) G x.
Lemma bigcap_setI_l {U T} (s1 s2 : set U) (f : U -> set T) : bigcap (s1 :|: s2) f <--> bigcap s1 f :&: bigcap s2 f.
Lemma bigcap_setU_l {U T} (s1 s2 : set U) (f : U -> set T) : bigcap s1 f \subset bigcap (s1 :&: s2) f.
Lemma bigcap_set1 {U T} (x : U) (f : U -> set T) : bigcap [set x] f <--> f x.
Lemma bigcup_set0_r (T U : Type) (s : set T) (F : T -> set U) : (forall x, F x <--> set0) -> \bigcup_(x in s) F x <--> set0.
Lemma bigcup_set0_l_eq (T U : Type) (s : set T) (F : T -> set U) : s <--> set0 -> \bigcup_(x in s) F x <--> set0.
Lemma cons_set_eq {A} (x : A) l : (x :: l) <--> [set x] :|: l.
Lemma incl_subset {A : Type} (l1 l2 : seq A) : incl l1 l2 -> l1 \subset l2.
Lemma incl_hd_same {A : Type} (a : A) (l1 l2 : seq A) : incl l1 l2 -> incl (a :: l1) (a :: l2).
Lemma setI_bigcup_assoc {A B} (s1 : set B) (s2 : set A) (s3 : A -> set B) : s1 :&: (\bigcup_(x in s2) s3 x) <--> \bigcup_(x in s2) (s1 :&: (s3 x)).
Lemma cons_subset {A : Type} (x : A) (l : seq A) (P : set A) : P x -> l \subset P -> (x :: l) \subset P.
Lemma imset_union_incl {U T : Type} (s1 s2 : set U) (f : U -> T) : f @: (s1 :|: s2) \subset (f @: s1) :|: (f @: s2).
Lemma imset_singl_incl {U T : Type} (x : U) (f : U -> T) : f @: [set x] \subset [set (f x)].
Lemma imset_set0_incl {U T : Type} (f : U -> T) : f @: set0 \subset set0.
Lemma set_eq_set_incl_r {U : Type} (s1 s2 : set U) : s1 <--> s2 -> s2 \subset s1.
Lemma set_eq_set_incl_l {U : Type} (s1 s2 : set U) : s1 <--> s2 -> s1 \subset s2.
Lemma rewrite_set_l {U : Type} (s1 s2 : set U) x : s1 x -> s1 <--> s2 -> s2 x.
Lemma rewrite_set_r {U : Type} (s1 s2 : set U) x : s2 x -> s1 <--> s2 -> s1 x.
Lemma imset_bigcup_incl_l : forall {T U V : Type} (f : U -> V) (A : set T) (F : T -> set U), f @: (\bigcup_(x in A) F x) \subset \bigcup_(x in A) f @: F x.
Lemma in_imset {U T} (f : U -> T) (S : set U) (x : T) : (f @: S) x -> exists y, x = f y.
Lemma union_lift_subset_compat {A} (s1 s2 : set (option A)) (s3 s4 : set A) : s1 \subset lift s3 -> s2 \subset lift s4 -> (s1 :|: s2) \subset lift (s3 :|: s4).
Lemma lift_subset_pres_l {A} (s1 : set (option A)) (s2 s3 : set A) : s1 \subset lift s2 -> s1 \subset lift (s2 :|: s3).
Lemma lift_subset_pres_r {A} (s1 : set (option A)) (s2 s3 : set A) : s1 \subset lift s3 -> s1 \subset lift (s2 :|: s3).
Lemma set_incl_setI_l {A} (s1 s2 s3 : set A) : s1 \subset s3 -> (s1 :&: s2) \subset s3.
Lemma set_incl_setI_r {A} (s1 s2 s3 : set A) : s2 \subset s3 -> (s1 :&: s2) \subset s3.
Lemma set_incl_setU_l {A} (s1 s2 s3 : set A) : s1 \subset s3 -> s2 \subset s3 -> (s1 :|: s2) \subset s3.
Lemma bigcup_set_I_l {A B} (s1 s2 : set A) (s3 : set B) (f : A -> set B) : \bigcup_(x in s1) (f x) \subset s3 -> \bigcup_(x in (s1 :&: s2)) (f x) \subset s3.
Lemma bigcup_set_U {A B} (s1 s2 : set A) (s3 : set B) (f : A -> set B) : \bigcup_(x in s1) (f x) \subset s3 -> \bigcup_(x in s2) (f x) \subset s3 -> \bigcup_(x in (s1 :|: s2)) (f x) \subset s3.
Lemma bigcup_set0_subset {A B} (s : set B) (f : A -> set B) : \bigcup_(x in set0) (f x) \subset s.
Lemma bigcup_cons_subset {A B} l (ls : seq A) (f : A -> set B) s : f l \subset s -> \bigcup_(x in ls) (f x) \subset s -> \bigcup_(x in l :: ls) (f x) \subset s.
Lemma option_subset {A} (s1 : set (option A)) : s1 \subset (isSome :&: s1) :|: [set None].
Lemma setU_l_subset {U} (s1 s2 s3 : set U) : s1 \subset s3 -> s2 \subset s3 -> (s1 :|: s2) \subset s3.
Lemma bigcup_lift_lift_bigcup {T U} (s1 : set T) (f : T -> set U) : \bigcup_(x in s1) (lift (f x)) \subset lift (\bigcup_(x in s1) (f x)).
Lemma lift_subset_compat {U} (s1 s2 : set U) : s1 \subset s2 -> lift s1 \subset lift s2.
Lemma lift_set_eq_compat {U} (s1 s2 : set U) : s1 <--> s2 -> lift s1 <--> lift s2.
Lemma bigcup_setU_r: forall (U T : Type) (s : set U) (f g : U -> set T), \bigcup_(i in s) (f i :|: g i) <--> \bigcup_(i in s) f i :|: \bigcup_(i in s) g i.
Lemma lift_bigcup_comm : forall (U T : Type) (s : set U) (f : U -> set T), inhabited U -> lift (\bigcup_(i in [set : U]) (f i)) <--> \bigcup_(i in [set : U]) (lift (f i)).
Lemma bigcap_setU_distr: forall (U T : Type) (s1 s2 : set U) (f : U -> set T), \bigcap_(i in s1) f i :&: \bigcap_(i in s2) f i <--> \bigcap_(i in s1 :|: s2) f i.
Lemma setI_set_incl : forall (A : Type) (s1 s2 s3 : set A), s1 \subset s2 -> s1 \subset s3 -> s1 \subset s2 :&: s3.
Lemma imset_isSome {A} (s : set A) : Some @: s \subset isSome.
Lemma bigcup_cons_subset_r : forall (A B : Type) (l : A) (ls : seq A) (f : A -> set B) (s1 s2 : set B), s1 \subset f l -> s2 \subset \bigcup_(x in ls) f x -> s1 :|: s2 \subset \bigcup_(x in (l :: ls)) f x.
Lemma bigcup_setI_cons_subset_r : forall (A B : Type) (l : A) (ls : seq A) (f : A -> set B) (s1 s2 : set B) (s3 : set A), s3 l -> s1 \subset f l -> s2 \subset \bigcup_(x in ls :&: s3) f x -> s1 :|: s2 \subset \bigcup_(x in (l :: ls) :&: s3) f x.
Lemma imset_union_set_eq: forall (U T : Type) (s1 s2 : set U) (f : U -> T), f @: (s1 :|: s2) <--> f @: s1 :|: f @: s2.
Lemma imset_bigcup_setI_cons_subset_r : forall (A B : Type) (l : A) (ls : seq A) (f : A -> set (option B)) (s1 s2 : set B) (s3 : set A), s3 l -> Some @: s1 \subset f l -> Some @: s2 \subset \bigcup_(x in ls :&: s3) f x -> Some @: (s1 :|: s2) \subset \bigcup_(x in (l :: ls) :&: s3) f x.
Lemma imset_set0_subset {A B} (f : A -> B) (s : set B) : (f @: set0) \subset s.
Lemma setI_set_eq_r {A : Type} (s1 s2 s2' : set A) : s2 <--> s2' -> (s1 :&: s2) <--> (s1 :&: s2').
Lemma isSome_subset {A : Type} (s1 s2 s1' s2' : set (option A)) : isSome :&: s1 \subset isSome :&: s2 -> isSome :&: (s1 :|: ([set None] :&: s1')) \subset isSome :&: (s2 :|: ([set None] :&: s2')).
Lemma isSome_set_eq {A} (s : set (option A)) (s' : set A) : s \subset (Some @: s') :|: [set None] -> Some @: s' \subset s -> isSome :&: s <--> Some @: s'.
Lemma set_eq_isSome_sound {A} (s : set (option A)) (s' : set A) : isSome :&: s <--> Some @: s' -> s \subset (Some @: s') :|: [set None].
Lemma set_eq_isSome_complete {A} (s : set (option A)) (s' : set A) : isSome :&: s <--> Some @: s' -> Some @: s' \subset s.