1
(************************************************************************)
2
(* v * The Coq Proof Assistant / The Coq Development Team *)
3
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
4
(* \VV/ **************************************************************)
5
(* // * This file is distributed under the terms of the *)
6
(* * GNU Lesser General Public License Version 2.1 *)
7
(************************************************************************)
8
(****************************************************************************)
10
(* Naive Set Theory in Coq *)
13
(* Rocquencourt Sophia-Antipolis *)
22
(* Acknowledgments: This work was started in July 1993 by F. Prost. Thanks *)
23
(* to the Newton Institute for providing an exceptional work environment *)
24
(* in Summer 1995. Several developments by E. Ledinot were an inspiration. *)
25
(****************************************************************************)
27
(*i $Id: Powerset_Classical_facts.v 10855 2008-04-27 11:16:15Z msozeau $ i*)
29
Require Export Ensembles.
30
Require Export Constructive_sets.
31
Require Export Relations_1.
32
Require Export Relations_1_facts.
33
Require Export Partial_Order.
35
Require Export Powerset.
36
Require Export Powerset_facts.
37
Require Export Classical_Type.
38
Require Export Classical_sets.
40
Section Sets_as_an_algebra.
45
forall (A B:Ensemble U) (x:U),
47
Strict_Included U (Add U A x) (Add U B x) -> Strict_Included U A B.
49
intros A B x H' H'0; red in |- *.
50
lapply (Strict_Included_inv U (Add U A x) (Add U B x)); auto with sets.
51
clear H'0; intro H'0; split.
52
apply incl_add_x with (x := x); tauto.
53
elim H'0; intros H'1 H'2; elim H'2; clear H'0 H'2.
55
red in |- *; intro H'2.
57
rewrite <- H'2; auto with sets.
60
Lemma incl_soustr_in :
61
forall (X:Ensemble U) (x:U), In U X x -> Included U (Subtract U X x) X.
63
intros X x H'; red in |- *.
64
intros x0 H'0; elim H'0; auto with sets.
68
forall (X Y:Ensemble U) (x:U),
69
Included U X Y -> Included U (Subtract U X x) (Subtract U Y x).
71
intros X Y x H'; red in |- *.
72
intros x0 H'0; elim H'0.
74
apply Subtract_intro; auto with sets.
77
Lemma incl_soustr_add_l :
78
forall (X:Ensemble U) (x:U), Included U (Subtract U (Add U X x) x) X.
80
intros X x; red in |- *.
81
intros x0 H'; elim H'; auto with sets.
82
intro H'0; elim H'0; auto with sets.
83
intros t H'1 H'2; elim H'2; auto with sets.
86
Lemma incl_soustr_add_r :
87
forall (X:Ensemble U) (x:U),
88
~ In U X x -> Included U X (Subtract U (Add U X x) x).
90
intros X x H'; red in |- *.
91
intros x0 H'0; try assumption.
92
apply Subtract_intro; auto with sets.
93
red in |- *; intro H'1; apply H'; rewrite H'1; auto with sets.
95
Hint Resolve incl_soustr_add_r: sets v62.
98
forall (X:Ensemble U) (x:U),
99
In U X x -> Included U X (Add U (Subtract U X x) x).
101
intros X x H'; red in |- *.
102
intros x0 H'0; try assumption.
103
elim (classic (x = x0)); intro K; auto with sets.
104
elim K; auto with sets.
108
forall (X:Ensemble U) (x:U),
109
In U X x -> Included U (Add U (Subtract U X x) x) X.
111
intros X x H'; red in |- *.
112
intros x0 H'0; elim H'0; auto with sets.
113
intros y H'1; elim H'1; auto with sets.
114
intros t H'1; try assumption.
115
rewrite <- (Singleton_inv U x t); auto with sets.
118
Lemma add_soustr_xy :
119
forall (X:Ensemble U) (x y:U),
120
x <> y -> Subtract U (Add U X x) y = Add U (Subtract U X y) x.
122
intros X x y H'; apply Extensionality_Ensembles.
124
intros x0 H'0; elim H'0; auto with sets.
126
intros u H'2 H'3; try assumption.
128
apply Subtract_intro; auto with sets.
129
intros t H'2 H'3; try assumption.
130
elim (Singleton_inv U x t); auto with sets.
131
intros u H'2; try assumption.
132
elim (Add_inv U (Subtract U X y) x u); auto with sets.
133
intro H'0; elim H'0; auto with sets.
134
intro H'0; rewrite <- H'0; auto with sets.
137
Lemma incl_st_add_soustr :
138
forall (X Y:Ensemble U) (x:U),
140
Strict_Included U (Add U X x) Y -> Strict_Included U X (Subtract U Y x).
142
intros X Y x H' H'0; apply sincl_add_x with (x := x); auto using add_soustr_1 with sets.
146
generalize (Inclusion_is_transitive U).
147
intro H'4; red in H'4.
148
apply H'4 with (y := Y); auto using add_soustr_2 with sets.
150
elim H'0; intros H'1 H'2; try exact H'1; clear H'0. (* PB *)
151
red in |- *; intro H'0; apply H'2.
152
rewrite H'0; auto 8 using add_soustr_xy, add_soustr_1, add_soustr_2 with sets.
156
forall (X:Ensemble U) (x:U), ~ In U X x -> X = Subtract U (Add U X x) x.
158
auto using incl_soustr_add_l with sets.
162
forall (X X0:Ensemble U) (x:U),
163
~ In U X x -> ~ In U X0 x -> Add U X x = Add U X0 x -> X = X0.
165
intros X X0 x H' H'0 H'1; try assumption.
166
rewrite (Sub_Add_new X x); auto with sets.
167
rewrite (Sub_Add_new X0 x); auto with sets.
168
rewrite H'1; auto with sets.
172
forall (X A:Ensemble U) (x:U),
173
Included U X (Add U A x) ->
174
Included U X A \/ (exists A' : _, X = Add U A' x /\ Included U A' A).
176
intros X A x H'0; try assumption.
177
elim (classic (In U X x)).
178
intro H'1; right; try assumption.
179
exists (Subtract U X x).
180
split; auto using incl_soustr_in, add_soustr_xy, add_soustr_1, add_soustr_2 with sets.
183
intros x0 H'2; try assumption.
184
lapply (Subtract_inv U X x x0); auto with sets.
185
intro H'3; elim H'3; intros K K'; clear H'3.
186
lapply (H'0 x0); auto with sets.
187
intro H'3; try assumption.
188
lapply (Add_inv U A x x0); auto with sets.
190
[ intro H'5; try exact H'5; clear H'4 | intro H'5; clear H'4 ].
191
elim K'; auto with sets.
192
intro H'1; left; try assumption.
195
intros x0 H'2; try assumption.
196
lapply (H'0 x0); auto with sets.
197
intro H'3; try assumption.
198
lapply (Add_inv U A x x0); auto with sets.
200
[ intro H'5; try exact H'5; clear H'4 | intro H'5; clear H'4 ].
201
absurd (In U X x0); auto with sets.
202
rewrite <- H'5; auto with sets.
206
forall A x y:Ensemble U,
207
covers (Ensemble U) (Power_set_PO U A) y x ->
208
Strict_Included U x y /\
209
(forall z:Ensemble U, Included U x z -> Included U z y -> x = z \/ z = y).
211
intros A x y H'; elim H'.
212
unfold Strict_Rel_of in |- *; simpl in |- *.
213
intros H'0 H'1; split; [ auto with sets | idtac ].
214
intros z H'2 H'3; try assumption.
215
elim (classic (x = z)); auto with sets.
216
intro H'4; right; try assumption.
217
elim (classic (z = y)); auto with sets.
218
intro H'5; try assumption.
220
exists z; auto with sets.
224
forall A a:Ensemble U,
228
~ In U a x -> covers (Ensemble U) (Power_set_PO U A) (Add U a x) a.
230
intros A a H' x H'0 H'1; try assumption.
231
apply setcover_intro; auto with sets.
233
split; [ idtac | red in |- *; intro H'2; try exact H'2 ]; auto with sets.
235
rewrite H'2; auto with sets.
236
red in |- *; intro H'2; elim H'2; clear H'2.
237
intros z H'2; elim H'2; intros H'3 H'4; try exact H'3; clear H'2.
238
lapply (Strict_Included_inv U a z); auto with sets; clear H'3.
239
intro H'2; elim H'2; intros H'3 H'5; elim H'5; clear H'2 H'5.
240
intros x0 H'2; elim H'2.
241
intros H'5 H'6; try assumption.
242
generalize H'4; intro K.
244
elim H'4; intros H'8 H'9; red in H'8; clear H'4.
245
lapply (H'8 x0); auto with sets.
246
intro H'7; try assumption.
247
elim (Add_inv U a x x0); auto with sets.
249
cut (Included U (Add U a x) z).
250
intro H'10; try assumption.
252
elim K; intros H'11 H'12; apply H'12; clear K; auto with sets.
255
intros x1 H'10; elim H'10; auto with sets.
256
intros x2 H'11; elim H'11; auto with sets.
260
forall A a a':Ensemble U,
263
covers (Ensemble U) (Power_set_PO U A) a' a ->
264
exists x : _, a' = Add U a x /\ In U A x /\ ~ In U a x.
266
intros A a a' H' H'0 H'1; try assumption.
267
elim (setcover_inv A a a'); auto with sets.
270
elim (Strict_Included_inv U a a'); auto with sets.
271
intros H'5 H'8; elim H'8.
272
intros x H'1; elim H'1.
273
intros H'2 H'3; try assumption.
275
split; [ try assumption | idtac ].
277
elim (H'7 (Add U a x)); auto with sets.
279
absurd (a = Add U a x); auto with sets.
280
red in |- *; intro H'8; try exact H'8.
282
rewrite H'8; auto with sets.
285
intros x0 H'1; elim H'1; auto with sets.
286
intros x1 H'8; elim H'8; auto with sets.
287
split; [ idtac | try assumption ].
288
red in H'0; auto with sets.
291
Theorem covers_is_Add :
292
forall A a a':Ensemble U,
295
(covers (Ensemble U) (Power_set_PO U A) a' a <->
296
(exists x : _, a' = Add U a x /\ In U A x /\ ~ In U a x)).
298
intros A a a' H' H'0; split; intro K.
299
apply covers_Add with (A := A); auto with sets.
301
intros x H'1; elim H'1; intros H'2 H'3; rewrite H'2; clear H'1.
302
apply Add_covers; intuition.
305
Theorem Singleton_atomic :
306
forall (x:U) (A:Ensemble U),
308
covers (Ensemble U) (Power_set_PO U A) (Singleton U x) (Empty_set U).
311
rewrite <- (Empty_set_zero' U x).
312
apply Add_covers; auto with sets.
315
Lemma less_than_singleton :
316
forall (X:Ensemble U) (x:U),
317
Strict_Included U X (Singleton U x) -> X = Empty_set U.
319
intros X x H'; try assumption.
321
lapply (Singleton_atomic x (Full_set U));
322
[ intro H'2; try exact H'2 | apply Full_intro ].
323
elim H'; intros H'0 H'1; try exact H'1; clear H'.
324
elim (setcover_inv (Full_set U) (Empty_set U) (Singleton U x));
325
[ intros H'6 H'7; try exact H'7 | idtac ]; auto with sets.
326
elim (H'7 X); [ intro H'5; try exact H'5 | intro H'5 | idtac | idtac ];
328
elim H'1; auto with sets.
331
End Sets_as_an_algebra.
333
Hint Resolve incl_soustr_in: sets v62.
334
Hint Resolve incl_soustr: sets v62.
335
Hint Resolve incl_soustr_add_l: sets v62.
336
Hint Resolve incl_soustr_add_r: sets v62.
337
Hint Resolve add_soustr_1 add_soustr_2: sets v62.
338
Hint Resolve add_soustr_xy: sets v62.