(* cardinal lemmas for fsets *)

(* Specifications: *)
Lemma card_finset (T : finType) (P : pred T) : #|` [fset x in P] | = #|P|.
Lemma cardfs_gt0 A : (0 < #|` A|)%N = (A != fset0).
Lemma cardfsU A B : #|` A `|` B| = (#|` A| + #|` B| - #|` A `&` B|)%N.
Lemma mem_fsetD1 a A : a \notin A -> A `\ a = A.
Lemma fsetI1 a A : A `&` [fset a] = if a \in A then [fset a] else fset0.
Lemma cardfsU1 a A : #|` a |` A| = (a \notin A) + #|` A|.
Lemma cardfs2 a b : #|` [fset a; b]| = (a != b).+1.
(* other inclusions *)
Lemma fsub1set A x : ([fset x] `<=` A) = (x \in A).
Lemma cardfs1P A : reflect (exists x, A = [fset x]) (#|` A| == 1).
Lemma fsubset1 A x : (A `<=` [fset x]) = (A == [fset x]) || (A == fset0).
Arguments fsetIidPl {A B}.
Lemma cardfsDS A B : B `<=` A -> #|` A `\` B| = (#|` A| - #|` B|)%N.
Lemma fsubsetIP A B C : reflect (A `<=` B /\ A `<=` C) (A `<=` B `&` C).
Lemma fsubUsetP A B C : reflect (A `<=` C /\ B `<=` C) (A `|` B `<=` C).
Lemma fsetU_eq0 A B : (A `|` B == fset0) = (A == fset0) && (B == fset0).
Lemma fsubsetD1P A B x : reflect (A `<=` B /\ x \notin A) (A `<=` B `\ x).
Lemma fproperD1 A x : x \in A -> A `\ x `<` A.
Lemma fproperIr A B : ~~ (B `<=` A) -> A `&` B `<` B.
Lemma fproperU A B C : (B `|` C `<` A) -> (B `<` A) && (C `<` A).
Lemma fsetDpS C A B : B `<=` C ->  A `<` B -> C `\` B `<` C `\` A.
Lemma fproperD2l C A B : A `<=` C -> B `<=` C -> (C `\` B `<` C `\` A) = (A `<` B).
Lemma fsetI_eq0 A B : (A `&` B == fset0) = [disjoint A & B].
Lemma disjoint_fsub C A B : A `|` B `<=` C ->
[disjoint fsub C A & fsub C B]%bool = [disjoint A & B].
Lemma fdisjointP {A B} :
reflect (forall a, a \in A -> a \notin B) [disjoint A & B]%fset.
Lemma fsetDidPl A B : reflect (A `\` B = A) [disjoint A & B]%fset.
Lemma disjoint_fsetI0 A B : [disjoint A & B] -> A `&` B = fset0.
Lemma fsubsetDP A B C :
reflect (A `<=` B /\ [disjoint A & C]%fset) (A `<=` (B `\` C)).
Lemma fdisjoint0X A : [disjoint fset0 & A].
Lemma fdisjointX1 x A : [disjoint A & [fset x]] = (x \notin A).
Lemma FSetK A (X : {set A}) : fsub A [fsetval k in X] = X.
End Enum.