Skip to content

Commit ac6d7cc

Browse files
committed
[B] Shuffle some proofs about unions around
Breaking change: renamed `countable_union` to `countable_indexed_union`. Also change which proof-irrelevance was used in this area of the library. This way fewer axioms are introduced.
1 parent 4bcc696 commit ac6d7cc

File tree

6 files changed

+103
-61
lines changed

6 files changed

+103
-61
lines changed

theories/Topology/MetricSpaces.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ as [choice_fun].
465465
lra.
466466
** rewrite H17.
467467
now constructor.
468-
+ apply countable_union.
468+
+ apply countable_indexed_union.
469469
* apply countable_type_ensemble.
470470
exists (fun n:nat => n).
471471
now red.

theories/Topology/RTopology.v

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -599,26 +599,6 @@ destruct (bounded_real_net_has_cluster_point nat_DS x a b) as [x0].
599599
apply RTop_metrization.
600600
Qed.
601601

602-
Lemma countable_union2
603-
{X : Type}
604-
{U V : Ensemble X} :
605-
Countable U ->
606-
Countable V ->
607-
Countable (Union U V).
608-
Proof.
609-
intros Hf Hg.
610-
replace (Union U V) with (IndexedUnion (fun b : bool => if b then U else V)).
611-
- apply countable_union.
612-
+ apply (intro_nat_injection _ (fun b : bool => if b then 1 else 0)%nat).
613-
now intros [|] [|] eq.
614-
+ now intros [|].
615-
- extensionality_ensembles.
616-
+ destruct a;
617-
now (left + right).
618-
+ now apply indexed_union_intro with true.
619-
+ now apply indexed_union_intro with false.
620-
Qed.
621-
622602
Lemma RTop_second_countable : second_countable RTop.
623603
Proof.
624604
apply intro_ctbl_basis with

theories/ZornsLemma/CountableTypes.v

Lines changed: 75 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
From Coq Require Export Relation_Definitions QArith ZArith.
22
From Coq Require Import Arith ArithRing FunctionalExtensionality
3-
ProofIrrelevance ClassicalChoice.
3+
Program.Subset ClassicalChoice.
44
From ZornsLemma Require Import InfiniteTypes CSB DecidableDec
55
DependentTypeChoice.
66
From ZornsLemma Require Export FiniteTypes IndexedFamilies.
@@ -178,7 +178,8 @@ exists (fun x => match x with
178178
intros [x1] [x2] H1.
179179
apply H in H1.
180180
injection H1 as H1.
181-
now destruct H1, (proof_irrelevance _ i i0).
181+
destruct H1.
182+
now apply subset_eq.
182183
Qed.
183184

184185
Lemma countable_img {X Y : Type} (f : X -> Y) (S : Ensemble X) :
@@ -196,7 +197,7 @@ exists (exist _ x i).
196197
simpl.
197198
generalize (H0 x i); intro.
198199
generalize (Im_intro X Y S f x i y e); intro.
199-
now destruct e, (proof_irrelevance _ i0 i1).
200+
now apply subset_eq.
200201
Qed.
201202

202203
Lemma countable_type_ensemble {X : Type} (S : Ensemble X) :
@@ -274,36 +275,80 @@ injection H2 as H2.
274275
f_equal; auto.
275276
Qed.
276277

277-
Lemma countable_union: forall {X A:Type}
278+
Lemma countable_family_union: forall {X:Type}
279+
(F:Family X), Countable F ->
280+
(forall U, In F U -> Countable U) ->
281+
Countable (FamilyUnion F).
282+
Proof.
283+
intros.
284+
destruct (choice_on_dependent_type (fun (a : { U | In F U })
285+
(f:{x:X | In (proj1_sig a) x} -> nat) =>
286+
injective f)) as [choice_fun_inj].
287+
{ intros [U].
288+
destruct (H0 U); try assumption.
289+
now exists f.
290+
}
291+
destruct (choice (fun (x:{x:X | In (FamilyUnion F) x}) (a: { U | In F U }) =>
292+
In (proj1_sig a) (proj1_sig x))) as [choice_fun_a].
293+
{ destruct x as [x [a]].
294+
now exists (exist _ a i).
295+
}
296+
destruct countable_nat_product as [g],
297+
H as [h].
298+
exists (fun x:{x:X | In (FamilyUnion F) x} =>
299+
g (h (choice_fun_a x), choice_fun_inj _ (exist _ _ (H2 x)))).
300+
intros x1 x2 H4.
301+
apply H3 in H4.
302+
injection H4 as H5 H6.
303+
apply H in H5.
304+
revert H6.
305+
generalize (H2 x1), (H2 x2).
306+
rewrite H5.
307+
intros.
308+
apply H1 in H6.
309+
injection H6.
310+
destruct x1, x2.
311+
apply subset_eq_compat.
312+
Qed.
313+
314+
Lemma countable_ens X (A : Ensemble X) :
315+
CountableT X -> Countable A.
316+
Proof.
317+
intros. red.
318+
destruct H.
319+
exists (fun x => f (proj1_sig x)).
320+
intros ? ? ?.
321+
apply H in H0.
322+
apply subset_eq.
323+
assumption.
324+
Qed.
325+
326+
Lemma countable_indexed_union: forall {X A:Type}
278327
(F:IndexedFamily A X), CountableT A ->
279328
(forall a:A, Countable (F a)) ->
280329
Countable (IndexedUnion F).
281330
Proof.
282331
intros.
283-
destruct (choice_on_dependent_type (fun (a:A)
284-
(f:{x:X | In (F a) x} -> nat) =>
285-
injective f)) as [choice_fun_inj].
286-
- intro.
287-
destruct (H0 a).
288-
now exists f.
289-
- destruct (choice (fun (x:{x:X | In (IndexedUnion F) x}) (a:A) =>
290-
In (F a) (proj1_sig x))) as [choice_fun_a].
291-
+ destruct x as [x [a]].
292-
now exists a.
293-
+ destruct countable_nat_product as [g],
294-
H as [h].
295-
exists (fun x:{x:X | In (IndexedUnion F) x} =>
296-
g (h (choice_fun_a x), choice_fun_inj _ (exist _ _ (H2 x)))).
297-
intros x1 x2 H4.
298-
apply H3 in H4.
299-
injection H4 as H5 H6.
300-
apply H in H5.
301-
revert H6.
302-
generalize (H2 x1), (H2 x2).
303-
rewrite H5.
304-
intros.
305-
apply H1 in H6.
306-
injection H6.
307-
destruct x1, x2.
308-
apply subset_eq_compat.
332+
rewrite indexed_to_family_union.
333+
apply countable_family_union.
334+
- apply countable_img.
335+
apply countable_ens.
336+
assumption.
337+
- intros. destruct H1.
338+
subst. apply H0.
339+
Qed.
340+
341+
Lemma countable_union2
342+
{X : Type}
343+
{U V : Ensemble X} :
344+
Countable U ->
345+
Countable V ->
346+
Countable (Union U V).
347+
Proof.
348+
intros Hf Hg.
349+
rewrite union_as_family_union.
350+
apply countable_family_union.
351+
- apply Finite_impl_Countable.
352+
apply finite_couple.
353+
- intros ? [|]; assumption.
309354
Qed.

theories/ZornsLemma/Families.v

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,24 @@ apply Extensionality_Ensembles; split; red; intros.
125125
constructor. rewrite Complement_Complement.
126126
assumption.
127127
Qed.
128+
129+
Lemma union_as_family_union (U V : Ensemble T) :
130+
Union U V = FamilyUnion (Couple U V).
131+
Proof.
132+
extensionality_ensembles_inv; subst.
133+
- exists U; firstorder.
134+
- exists V; firstorder.
135+
- left. assumption.
136+
- right. assumption.
137+
Qed.
138+
139+
Lemma family_union_singleton
140+
(S : Ensemble T) :
141+
FamilyUnion (Singleton S) = S.
142+
Proof.
143+
now extensionality_ensembles;
144+
try econstructor.
145+
Qed.
128146
End FamilyFacts.
129147

130148
Lemma image_family_union (X Y : Type) (F : Family X) (f : X -> Y) :
@@ -145,12 +163,3 @@ apply Extensionality_Ensembles; split; red; intros.
145163
apply Im_def.
146164
exists x0; auto.
147165
Qed.
148-
149-
Lemma family_union_singleton
150-
{X : Type}
151-
(S : Ensemble X) :
152-
FamilyUnion (Singleton S) = S.
153-
Proof.
154-
now extensionality_ensembles;
155-
try econstructor.
156-
Qed.

theories/ZornsLemma/FiniteIntersections.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Lemma finite_intersections_countable
264264
Proof.
265265
intros [f Hf].
266266
rewrite <- finite_intersections_len_union.
267-
apply countable_union.
267+
apply countable_indexed_union.
268268
- apply nat_countable.
269269
- intro n.
270270
induction n.

theories/ZornsLemma/FiniteTypes.v

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,3 +979,11 @@ Proof.
979979
+ intros. destruct x as [[]|]; intuition.
980980
+ intros. destruct y as [|]; intuition.
981981
Qed.
982+
983+
Lemma finite_couple {X} (x y : X) :
984+
Finite (Couple x y).
985+
Proof.
986+
rewrite <- Couple_as_union.
987+
apply Union_preserves_Finite.
988+
all: apply Singleton_is_finite.
989+
Qed.

0 commit comments

Comments
 (0)