Section fparts2_def.
Variable E : Setoid.
Definition disjoint (A B : part_set E) := Equal (inter A B) (empty E).
unfold disjoint in |- *.
intros A A' B B' H' H'0 H'1; try assumption.
apply Trans with (inter A B).
auto with *.
auto with *.
Qed.
intros A; case A; intros a pa; simpl in |- *.
unfold eq_part, empty in |- *; simpl in |- *.
intuition.
intros.
elim (H x); auto with *.
Qed.
unfold included, disjoint in |- *.
intros A B C H' H'0; try assumption.
apply not_in_empty.
unfold not in |- *; intros.
cut (in_part x (inter B C)).
generalize (empty_not_in (A:=inter B C) H'0).
unfold not in |- *; intros.
apply H0 with (x := x).
auto with *.
auto with *.
apply in_part_inter.
apply H'.
apply in_part_inter_l with C.
auto with *.
apply in_part_inter_r with A.
auto with *.
Qed.
intros A x; red in |- *.
unfold add_part in |- *.
auto with *.
Qed.
Hint Resolve included_add_part: algebra.
unfold not in |- *; intros.
cut (in_part x A \/ in_part x B).
intros H'; try assumption.
intuition.
auto with *.
Qed.
Hint Resolve union_not_in: algebra.
unfold disjoint in |- *.
unfold not in |- *; intros.
cut (in_part x (empty E)).
auto with *.
apply in_part_comp_r with (inter A B).
auto with *.
auto with *.
Qed.
simple induction a.
intros.
apply cardinal_comp_l with (union (empty E) B); auto with *.
apply union_comp; auto with *.
apply Sym.
auto with *.
apply cardinal_comp_l with B; auto with *.
intros.
inversion H0.
simpl in |- *.
apply cardinal_add with (union B0 B) x; auto with *.
apply H; auto with *.
apply disjoint_inclus with (add_part B0 x); auto with *.
apply disjoint_comp with A B; auto with *.
apply union_not_in; auto with *.
apply disjoint_not_in_r with A; auto with *.
apply in_part_comp_r with (add_part B0 x); auto with *.
apply Trans with (union (add_part B0 x) B); auto with *.
unfold add_part in |- *.
apply Trans with (union B0 (union (single x) B)); auto with *.
apply Trans with (union B0 (union B (single x))); auto with *.
Qed.
Hint Resolve cardinal_union_disjoint: algebra.
intros A B.
case A; case B; simpl in |- *.
intros a pa b pb.
unfold eq_part in |- *; simpl in |- *.
intuition.
Qed.
intros A B.
case A; case B; simpl in |- *.
intros a pa b pb.
unfold eq_part in |- *; simpl in |- *.
intuition.
Qed.
intros A B.
case A; case B; simpl in |- *.
intros a pa b pb.
unfold eq_part in |- *; simpl in |- *.
intuition.
Qed.
intros A B.
case A; case B; simpl in |- *.
intros a pa b pb.
unfold eq_part in |- *; simpl in |- *.
intuition.
Qed.
Hint Resolve in_diff: algebra.
intros A B; try assumption.
apply in_eq_part.
intros x H'; try assumption.
elim (in_part_union H').
auto with *.
intros H'0; try assumption.
cut (in_part x B).
auto with *.
exact (diff_in_l H'0).
intros x H'; try assumption.
elim (in_part_union H').
auto with *.
intros H'0; try assumption.
elim (classic (in_part x A)).
auto with *.
intros H'1; try assumption.
cut (in_part x (diff B A)).
auto with *.
auto with *.
Qed.
Hint Resolve union_diff: algebra.
red in |- *.
intros A B; try assumption.
apply not_in_empty.
intros x; red in |- *; intros H'; try exact H'.
absurd (in_part x A).
apply diff_in_r with B.
auto with *.
apply in_part_inter_r with A; auto with *.
apply in_part_inter_l with (diff B A); auto with *.
Qed.
Hint Resolve disjoint_diff: algebra.
intros.
apply cardinal_comp_l with (union A (diff B A)); auto with *.
Qed.
Hint Resolve cardinal_union: algebra.
intros A; try assumption.
apply in_eq_part.
intro.
intros H'; try assumption.
apply diff_in_l with A; auto with *.
intros x H'; try assumption.
absurd (in_part x (empty E)); auto with *.
Qed.
Hint Resolve empty_diff: algebra.
intros A; try assumption.
apply in_eq_part.
intros x H'; try assumption.
apply in_part_inter_l with A; auto with *.
intros x H'; try assumption.
absurd (in_part x (empty E)); auto with *.
Qed.
Hint Resolve empty_inter: algebra.
intros A; case A; simpl in |- *.
intros a pa.
intros x y H' H'0; try assumption.
apply pa with x; auto with *.
Qed.
intros A B0 B x H' H'0 H'1; try assumption.
apply in_eq_part.
intros x0 H'2; try assumption.
apply in_diff.
apply in_part_comp_r with (add_part B0 x).
cut (in_part x0 B0).
unfold add_part in |- *.
auto with *.
apply diff_in_l with B; auto with *.
auto with *.
apply diff_in_r with B0; auto with *.
intros x0 H'2; try assumption.
elim (classic (Equal x0 x)).
intros H'3; try assumption.
absurd (in_part x B); auto with *.
cut (in_part x (diff A B)).
intros H'4; try assumption.
apply diff_in_r with A; auto with *.
apply in_part_trans_eq with x0; auto with *.
intros H'3; try assumption.
apply in_diff.
apply add_part_in_el_diff with x; auto with *.
apply in_part_comp_r with A; auto with *.
apply diff_in_l with B; auto with *.
apply diff_in_r with A; auto with *.
Qed.
unfold not in |- *; intros.
apply H.
apply diff_in_l with B; auto with *.
Qed.
Hint Resolve diff_not_in: algebra.
unfold not in |- *; intros.
apply H.
apply in_part_inter_l with B; auto with *.
Qed.
Hint Resolve inter_not_in: algebra.
(* OK *)

Lemma inter_add_part :
forall (A B0 B : part_set E) (x : E),
~ in_part x B0 ->
Equal A (add_part B0 x) ->
in_part x B -> Equal (inter A B) (add_part (inter B0 B) x).