Skip to content

Commit 165a201

Browse files
authored
Totally bounded sets are propositionally decidable (#1625)
...and so are lots of other simple types for which that principle wasn't written down yet?
1 parent b486773 commit 165a201

10 files changed

+245
-28
lines changed

src/foundation/surjective-maps.lagda.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module foundation.surjective-maps where
88

99
```agda
1010
open import foundation.action-on-identifications-functions
11+
open import foundation.coinhabited-pairs-of-types
1112
open import foundation.connected-maps
1213
open import foundation.contractible-types
1314
open import foundation.dependent-pair-types
@@ -248,6 +249,21 @@ abstract
248249
rec-trunc-Prop empty-Prop (¬A ∘ pr1) (is-surjective-map-surjection A↠B b)
249250
```
250251

252+
### If a type `A` has a surjection into `B`, `A` and `B` are coinhabited
253+
254+
```agda
255+
abstract
256+
is-coinhabited-surjection :
257+
{l1 l2 : Level} {A : UU l1} {B : UU l2} → A ↠ B → is-coinhabited A B
258+
pr1 (is-coinhabited-surjection A↠B) = map-is-inhabited (map-surjection A↠B)
259+
pr2 (is-coinhabited-surjection A↠B) |B| =
260+
let open do-syntax-trunc-Prop (is-inhabited-Prop _)
261+
in do
262+
b ← |B|
263+
(a , fa=b) ← is-surjective-map-surjection A↠B b
264+
unit-trunc-Prop a
265+
```
266+
251267
### Any split surjective map is surjective
252268

253269
```agda

src/logic/propositionally-decidable-types.lagda.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ open import foundation.logical-equivalences
1919
open import foundation.negation
2020
open import foundation.propositional-truncations
2121
open import foundation.retracts-of-types
22+
open import foundation.surjective-maps
2223
open import foundation.universe-levels
2324
2425
open import foundation-core.cartesian-product-types
@@ -170,6 +171,26 @@ module _
170171
is-inhabited-or-empty-iff' e , is-inhabited-or-empty-iff' (inv-iff e)
171172
```
172173

174+
### Propositionally decidable types are closed under surjections
175+
176+
```agda
177+
module _
178+
{l1 l2 : Level} {A : UU l1} {B : UU l2}
179+
where
180+
181+
abstract
182+
is-inhabited-or-empty-surjection :
183+
(A ↠ B) → is-inhabited-or-empty A → is-inhabited-or-empty B
184+
is-inhabited-or-empty-surjection A↠B =
185+
is-inhabited-or-empty-is-coinhabited (is-coinhabited-surjection A↠B)
186+
187+
is-inhabited-or-empty-surjection' :
188+
(A ↠ B) → is-inhabited-or-empty B → is-inhabited-or-empty A
189+
is-inhabited-or-empty-surjection' A↠B =
190+
is-inhabited-or-empty-is-coinhabited
191+
( is-symmetric-is-coinhabited (is-coinhabited-surjection A↠B))
192+
```
193+
173194
### Propositionally decidable types are closed under retracts
174195

175196
```agda

src/metric-spaces/approximations-metric-spaces.lagda.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ module metric-spaces.approximations-metric-spaces where
1010
open import elementary-number-theory.positive-rational-numbers
1111
1212
open import foundation.cartesian-products-subtypes
13+
open import foundation.coinhabited-pairs-of-types
1314
open import foundation.dependent-pair-types
1415
open import foundation.existential-quantification
1516
open import foundation.full-subtypes
1617
open import foundation.function-types
18+
open import foundation.functoriality-propositional-truncation
1719
open import foundation.images
1820
open import foundation.images-subtypes
1921
open import foundation.inhabited-subtypes
@@ -93,6 +95,11 @@ module _
9395
type-approximation-Metric-Space =
9496
type-subtype subset-approximation-Metric-Space
9597
98+
inclusion-approximation-Metric-Space :
99+
type-approximation-Metric-Space → type-Metric-Space X
100+
inclusion-approximation-Metric-Space =
101+
inclusion-subtype subset-approximation-Metric-Space
102+
96103
is-approximation-approximation-Metric-Space :
97104
is-approximation-Metric-Space X ε subset-approximation-Metric-Space
98105
is-approximation-approximation-Metric-Space = pr2 S
@@ -243,24 +250,31 @@ module _
243250
is-approximation-im-isometric-equiv-approximation-Metric-Space)
244251
```
245252

246-
### If a metric space is inhabited, so is any approximation
253+
### A metric space and any approximation of it are coinhabited
254+
255+
A metric space is inhabited if and only if any approximation of it is inhabited.
247256

248257
```agda
249258
module _
250-
{l1 l2 l3 : Level}
251-
(X : Metric-Space l1 l2) (|X| : is-inhabited (type-Metric-Space X))
252-
(ε : ℚ⁺) (S : subset-Metric-Space l3 X)
259+
{l1 l2 l3 : Level} (X : Metric-Space l1 l2) (ε : ℚ⁺)
260+
(S : approximation-Metric-Space l3 X ε)
253261
where
254262
255263
abstract
256-
is-inhabited-is-approximation-inhabited-Metric-Space :
257-
is-approximation-Metric-Space X ε S →
258-
is-inhabited-subtype S
259-
is-inhabited-is-approximation-inhabited-Metric-Space is-approx =
260-
let open do-syntax-trunc-Prop (is-inhabited-subtype-Prop S)
264+
is-coinhabited-approximation-Metric-Space :
265+
is-coinhabited
266+
( type-approximation-Metric-Space X ε S)
267+
( type-Metric-Space X)
268+
pr1 is-coinhabited-approximation-Metric-Space =
269+
map-is-inhabited (inclusion-approximation-Metric-Space X ε S)
270+
pr2 is-coinhabited-approximation-Metric-Space |X| =
271+
let
272+
open
273+
do-syntax-trunc-Prop
274+
( is-inhabited-Prop (type-approximation-Metric-Space X ε S))
261275
in do
262276
x ← |X|
263-
(s , Nεsx) ← is-approx x
277+
(s , _) ← is-approximation-approximation-Metric-Space X ε S x
264278
unit-trunc-Prop s
265279
```
266280

src/metric-spaces/inhabited-totally-bounded-subspaces-metric-spaces.lagda.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module metric-spaces.inhabited-totally-bounded-subspaces-metric-spaces where
77
<details><summary>Imports</summary>
88

99
```agda
10+
open import elementary-number-theory.positive-rational-numbers
11+
1012
open import foundation.cartesian-products-subtypes
1113
open import foundation.dependent-pair-types
1214
open import foundation.equivalences
@@ -15,10 +17,14 @@ open import foundation.images
1517
open import foundation.images-subtypes
1618
open import foundation.inhabited-subtypes
1719
open import foundation.inhabited-types
20+
open import foundation.propositional-truncations
1821
open import foundation.universe-levels
1922
23+
open import logic.propositionally-decidable-types
24+
2025
open import metric-spaces.cartesian-products-metric-spaces
2126
open import metric-spaces.metric-spaces
27+
open import metric-spaces.nets-metric-spaces
2228
open import metric-spaces.subspaces-metric-spaces
2329
open import metric-spaces.totally-bounded-metric-spaces
2430
open import metric-spaces.totally-bounded-subspaces-metric-spaces
@@ -135,3 +141,25 @@ product-inhabited-totally-bounded-subspace-Metric-Space
135141
( subset-totally-bounded-subspace-Metric-Space Y T)))
136142
( is-inhabited-Σ |S| (λ _ → |T|)))
137143
```
144+
145+
### It is decidable whether or not a totally bounded subspace of a metric space is inhabited
146+
147+
```agda
148+
module _
149+
{l1 l2 l3 l4 : Level} (X : Metric-Space l1 l2)
150+
(S : totally-bounded-subspace-Metric-Space l3 l4 X)
151+
where
152+
153+
abstract
154+
is-inhabited-or-empty-totally-bounded-subspace-Metric-Space :
155+
is-inhabited-or-empty (type-totally-bounded-subspace-Metric-Space X S)
156+
is-inhabited-or-empty-totally-bounded-subspace-Metric-Space =
157+
rec-trunc-Prop
158+
( is-inhabited-or-empty-Prop _)
159+
( λ M →
160+
is-inhabited-or-empty-type-is-inhabited-or-empty-net-Metric-Space
161+
( subspace-totally-bounded-subspace-Metric-Space X S)
162+
( one-ℚ⁺)
163+
( M one-ℚ⁺))
164+
( is-totally-bounded-subspace-totally-bounded-subspace-Metric-Space X S)
165+
```

src/metric-spaces/nets-metric-spaces.lagda.md

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ module metric-spaces.nets-metric-spaces where
99
```agda
1010
open import elementary-number-theory.positive-rational-numbers
1111
12+
open import foundation.coinhabited-pairs-of-types
1213
open import foundation.dependent-pair-types
1314
open import foundation.images
1415
open import foundation.inhabited-types
16+
open import foundation.logical-equivalences
1517
open import foundation.propositions
1618
open import foundation.subtypes
1719
open import foundation.universe-levels
1820
21+
open import logic.propositionally-decidable-types
22+
1923
open import metric-spaces.approximations-metric-spaces
2024
open import metric-spaces.cartesian-products-metric-spaces
2125
open import metric-spaces.equality-of-metric-spaces
@@ -33,6 +37,7 @@ open import metric-spaces.uniformly-continuous-functions-metric-spaces
3337
open import univalent-combinatorics.finitely-enumerable-subtypes
3438
open import univalent-combinatorics.finitely-enumerable-types
3539
open import univalent-combinatorics.inhabited-finitely-enumerable-subtypes
40+
open import univalent-combinatorics.inhabited-finitely-enumerable-types
3641
```
3742

3843
</details>
@@ -80,6 +85,14 @@ module _
8085
subtype-finitely-enumerable-subtype
8186
( finitely-enumerable-subset-net-Metric-Space)
8287
88+
type-net-Metric-Space : UU (l1 ⊔ l3)
89+
type-net-Metric-Space = type-subtype subset-net-Metric-Space
90+
91+
finitely-enumerable-type-net-Metric-Space : Finitely-Enumerable-Type (l1 ⊔ l3)
92+
finitely-enumerable-type-net-Metric-Space =
93+
finitely-enumerable-type-finitely-enumerable-subtype
94+
( finitely-enumerable-subset-net-Metric-Space)
95+
8396
is-approximation-subset-net-Metric-Space :
8497
is-approximation-Metric-Space X ε subset-net-Metric-Space
8598
is-approximation-subset-net-Metric-Space = pr2 N
@@ -90,28 +103,61 @@ module _
90103
is-approximation-subset-net-Metric-Space)
91104
```
92105

93-
### If a metric space is inhabited, so is any net on it
106+
### A metric space and any net for it are coinhabited
107+
108+
A metric space is inhabited if and only if any net for it is inhabited.
94109

95110
```agda
96111
module _
97112
{l1 l2 l3 : Level}
98-
(X : Metric-Space l1 l2) (|X| : is-inhabited (type-Metric-Space X))
99-
(ε : ℚ⁺) (S : net-Metric-Space l3 X ε)
113+
(X : Metric-Space l1 l2) (ε : ℚ⁺) (S : net-Metric-Space l3 X ε)
100114
where
101115
102116
abstract
103-
is-inhabited-net-inhabited-Metric-Space :
104-
is-inhabited-finitely-enumerable-subtype (pr1 S)
105-
is-inhabited-net-inhabited-Metric-Space =
106-
is-inhabited-is-approximation-inhabited-Metric-Space X |X| ε
107-
( subset-net-Metric-Space X ε S)
108-
( is-approximation-subset-net-Metric-Space X ε S)
109-
110-
inhabited-finitely-enumerable-subtype-net-Metric-Space :
117+
is-coinhabited-net-Metric-Space :
118+
is-coinhabited (type-net-Metric-Space X ε S) (type-Metric-Space X)
119+
is-coinhabited-net-Metric-Space =
120+
is-coinhabited-approximation-Metric-Space
121+
( X)
122+
( ε)
123+
( approximation-net-Metric-Space X ε S)
124+
125+
is-inhabited-type-is-inhabited-net-Metric-Space :
126+
is-inhabited (type-net-Metric-Space X ε S) →
127+
is-inhabited (type-Metric-Space X)
128+
is-inhabited-type-is-inhabited-net-Metric-Space =
129+
forward-implication is-coinhabited-net-Metric-Space
130+
131+
is-inhabited-net-is-inhabited-type-Metric-Space :
132+
is-inhabited (type-Metric-Space X) →
133+
is-inhabited (type-net-Metric-Space X ε S)
134+
is-inhabited-net-is-inhabited-type-Metric-Space =
135+
backward-implication is-coinhabited-net-Metric-Space
136+
137+
inhabited-finitely-enumerable-subset-net-is-inhabited-Metric-Space :
138+
is-inhabited (type-Metric-Space X) →
111139
inhabited-finitely-enumerable-subtype l3 (type-Metric-Space X)
112-
inhabited-finitely-enumerable-subtype-net-Metric-Space =
140+
inhabited-finitely-enumerable-subset-net-is-inhabited-Metric-Space |S| =
113141
( finitely-enumerable-subset-net-Metric-Space X ε S ,
114-
is-inhabited-net-inhabited-Metric-Space)
142+
is-inhabited-net-is-inhabited-type-Metric-Space |S|)
143+
```
144+
145+
### Given any net for a metric space `X`, `X` is propositionally decidable
146+
147+
```agda
148+
module _
149+
{l1 l2 l3 : Level}
150+
(X : Metric-Space l1 l2) (ε : ℚ⁺) (S : net-Metric-Space l3 X ε)
151+
where
152+
153+
abstract
154+
is-inhabited-or-empty-type-is-inhabited-or-empty-net-Metric-Space :
155+
is-inhabited-or-empty (type-Metric-Space X)
156+
is-inhabited-or-empty-type-is-inhabited-or-empty-net-Metric-Space =
157+
is-inhabited-or-empty-is-coinhabited
158+
( is-coinhabited-net-Metric-Space X ε S)
159+
( is-inhabited-or-empty-type-Finitely-Enumerable-Type
160+
( finitely-enumerable-type-net-Metric-Space X ε S))
115161
```
116162

117163
## Properties

src/real-numbers/inhabited-totally-bounded-subsets-real-numbers.lagda.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,15 @@ open import foundation.function-types
1919
open import foundation.identity-types
2020
open import foundation.images
2121
open import foundation.inhabited-subtypes
22-
open import foundation.inhabited-types
2322
open import foundation.logical-equivalences
2423
open import foundation.propositional-truncations
2524
open import foundation.propositions
2625
open import foundation.subtypes
2726
open import foundation.transport-along-identifications
2827
open import foundation.universe-levels
2928
29+
open import logic.propositionally-decidable-types
30+
3031
open import metric-spaces.approximations-metric-spaces
3132
open import metric-spaces.inhabited-totally-bounded-subspaces-metric-spaces
3233
open import metric-spaces.metric-spaces
@@ -155,8 +156,11 @@ module _
155156
net δ =
156157
im-inhabited-finitely-enumerable-subtype
157158
( inclusion-subset-ℝ S)
158-
( inhabited-finitely-enumerable-subtype-net-Metric-Space
159-
( metric-space-subset-ℝ S) |S| δ (M δ))
159+
( inhabited-finitely-enumerable-subset-net-is-inhabited-Metric-Space
160+
( metric-space-subset-ℝ S)
161+
( δ)
162+
( M δ)
163+
( |S|))
160164
161165
is-net :
162166
(δ : ℚ⁺) →
@@ -399,6 +403,23 @@ module _
399403
is-infimum-inf-inhabited-totally-bounded-subset-ℝ)
400404
```
401405

406+
### Any totally bounded subset of `` is propositionally decidable
407+
408+
```agda
409+
module _
410+
{l1 l2 l3 : Level}
411+
(S : totally-bounded-subset-ℝ l1 l2 l3)
412+
where
413+
414+
abstract
415+
is-inhabited-or-empty-totally-bounded-subset-ℝ :
416+
is-inhabited-or-empty (type-totally-bounded-subset-ℝ S)
417+
is-inhabited-or-empty-totally-bounded-subset-ℝ =
418+
is-inhabited-or-empty-totally-bounded-subspace-Metric-Space
419+
( metric-space-ℝ l2)
420+
( S)
421+
```
422+
402423
### The infimum of an inhabited totally bounded subset of `` is less than or equal to the supremum
403424

404425
```agda

src/real-numbers/totally-bounded-subsets-real-numbers.lagda.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ module _
6767
subset-totally-bounded-subset-ℝ = pr1 S
6868
6969
type-totally-bounded-subset-ℝ : UU (l1 ⊔ lsuc l2)
70-
type-totally-bounded-subset-ℝ =
71-
type-subtype subset-totally-bounded-subset-ℝ
70+
type-totally-bounded-subset-ℝ = type-subtype subset-totally-bounded-subset-ℝ
7271
7372
metric-space-totally-bounded-subset-ℝ : Metric-Space (l1 ⊔ lsuc l2) l2
7473
metric-space-totally-bounded-subset-ℝ =

src/univalent-combinatorics/finite-types.lagda.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,23 @@ abstract
766766
( pr2 (has-finite-cardinality-is-finite H)))
767767
```
768768

769+
### The finite types are propositionally decidable
770+
771+
```agda
772+
module _
773+
{l : Level} (X : Finite-Type l)
774+
where
775+
776+
is-inhabited-or-empty-type-Finite-Type :
777+
is-inhabited-or-empty (type-Finite-Type X)
778+
is-inhabited-or-empty-type-Finite-Type =
779+
rec-trunc-Prop
780+
( is-inhabited-or-empty-Prop (type-Finite-Type X))
781+
( λ (n , Fin-n≃X) →
782+
is-inhabited-or-empty-equiv' Fin-n≃X (is-inhabited-or-empty-Fin n))
783+
( is-finite-type-Finite-Type X)
784+
```
785+
769786
## External links
770787

771788
- [Finiteness in Sheaf Topoi](https://grossack.site/2024/08/19/finiteness-in-sheaf-topoi),

0 commit comments

Comments
 (0)