Skip to content

Commit 5970b9f

Browse files
committed
Defined strong enumerability and proven finite and kfinite types are enumerable.
1 parent 6a5720b commit 5970b9f

File tree

2 files changed

+88
-2
lines changed

2 files changed

+88
-2
lines changed

code/Enumerability/EnumerableTypes.v

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,58 @@ Section TypePredicateEnumerabilityEquivalence.
117117

118118
End TypePredicateEnumerabilityEquivalence.
119119

120+
Section StrongEnumerability.
121+
122+
Definition isstrongenumerator (X : UU) (f : nat → X) := (issurjective f).
123+
124+
Definition strongenumerator (X : UU) := ∑ (f : nat → X), isstrongenumerator X f.
125+
126+
Definition isstrongenumerable (X : UU) := ishinh (strongenumerator X).
127+
128+
Lemma strongenumeratortoenumerator {X : UU} : strongenumerator X → enumerator X.
129+
Proof.
130+
intros [f isstrenum].
131+
use tpair; cbn beta.
132+
- intros n. exact (some (f n)).
133+
- intros x. use (squash_to_prop (isstrenum x) (propproperty _)); intros [n eq]; clear isstrenum; apply hinhpr.
134+
use tpair; cbn beta. exact n. rewrite -> eq. apply idpath.
135+
Defined.
136+
137+
Lemma isstrongenumerabletoisenumerable {X : UU} : isstrongenumerable X → isenumerable X.
138+
Proof.
139+
intros enum. use (squash_to_prop enum (propproperty _)); clear enum; intros enum; apply hinhpr.
140+
apply strongenumeratortoenumerator. exact enum.
141+
Qed.
142+
143+
Lemma inhabittedenumeratortostrongenumerator {X : UU} : X → enumerator X → strongenumerator X.
144+
Proof.
145+
intros x [f isenum].
146+
use tpair.
147+
- intros n. induction (f n).
148+
+ exact a.
149+
+ exact x.
150+
- intros y. use (squash_to_prop (isenum y) (propproperty _)); intros [n eq]; apply hinhpr.
151+
use tpair.
152+
exact n. cbn beta. rewrite -> eq. apply idpath.
153+
Defined.
154+
155+
Lemma inhabittedenumerabletostrongenumerable {X : UU} : (ishinh X) → isenumerable X → isstrongenumerable X.
156+
Proof.
157+
intros x isenum.
158+
use (squash_to_prop x (propproperty _)); clear x; intros x.
159+
use (squash_to_prop (isenum) (propproperty _)); clear isenum; intros enum. apply hinhpr.
160+
apply inhabittedenumeratortostrongenumerator. exact x. exact enum.
161+
Qed.
162+
163+
Lemma strongenumerableinhabitted {X : UU} : isstrongenumerable X → (ishinh X).
164+
Proof.
165+
intros isenum.
166+
use (squash_to_prop (isenum) (propproperty _)); clear isenum; intros [f isenum]; apply hinhpr.
167+
exact (f 0).
168+
Qed.
169+
170+
End StrongEnumerability.
171+
120172
Section ClosureProperties.
121173

122174
Lemma enumeratornat : (isenumerator nat (λ (n : nat), (some n))).
@@ -265,7 +317,39 @@ Section ClosureProperties.
265317
- exact (nat_rect (λ _, @option (@option X)) (some none) (λ (n : nat) _, some (f n))).
266318
- exact (enumeratoroption X f enumx).
267319
Qed.
268-
320+
321+
Lemma kfinstructenumerator {X : UU} (kfin : kfinstruct X) : (enumerator X).
322+
Proof.
323+
destruct kfin as [n [f issurj]].
324+
use tpair.
325+
- intros m.
326+
induction (natlthorgeh m n).
327+
+ exact (some (f (m,, a))).
328+
+ exact none.
329+
- intros ?.
330+
use (squash_to_prop (issurj x) (propproperty _)); clear issurj; intros [[m nltm] eq]. apply hinhpr.
331+
use tpair. exact m. cbn beta. induction (natlthorgeh m n); simpl.
332+
assert (a = nltm) by apply propproperty. rewrite -> X0. rewrite <- eq. apply idpath.
333+
apply fromempty. apply (natgehtonegnatlth _ _ b). exact nltm.
334+
Defined.
335+
336+
Lemma iskfiniteisenumerable {X : UU} : (iskfinite X) → (isenumerable X).
337+
Proof.
338+
intros isk. use (squash_to_prop isk (propproperty _)); intros enum; apply hinhpr.
339+
apply kfinstructenumerator. exact enum.
340+
Qed.
341+
342+
Lemma finstructenumerator {X : UU} : (finstruct X) → (enumerator X).
343+
Proof.
344+
intros finstr. apply kfinstructenumerator. apply kfinstruct_finstruct.
345+
exact finstr.
346+
Defined.
347+
348+
Lemma isfiniteisenumerable {X : UU} : (isfinite X) → (isenumerable X).
349+
Proof.
350+
intros isf. use (squash_to_prop isf (propproperty _)); intros finstr; apply hinhpr.
351+
exact (finstructenumerator finstr).
352+
Qed.
269353
End ClosureProperties.
270354

271355
Section ListEnumerability.

code/init/imports.v

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
Require Export UniMath.Foundations.All.
2-
Require Export UniMath.Combinatorics.Lists.
2+
Require Export UniMath.Combinatorics.Lists.
3+
Require Export UniMath.Combinatorics.KFiniteTypes.
4+
Require Export UniMath.Combinatorics.FiniteSets.

0 commit comments

Comments
 (0)