diff --git a/references.bib b/references.bib
index f63c1f2c16..6c02da9a26 100644
--- a/references.bib
+++ b/references.bib
@@ -258,6 +258,15 @@ @online{DavidJaz/Cohesion
howpublished = {{{GitHub}} repository}
}
+@misc{Diener18,
+ title = {Constructive Reverse Mathematics},
+ author = {Hannes Diener},
+ year = {2018},
+ eprint = {1804.05495},
+ archiveprefix = {arXiv},
+ primaryclass = {math.LO}
+}
+
@article{dJE23,
title = {{On Small Types in Univalent Foundations}},
author = {de Jong, Tom and Escardó, Martín Hötzel},
@@ -333,6 +342,21 @@ @article{Esc08
primaryclass = {cs.LO}
}
+@article{Esc13,
+ author = {Escardó, Martín Hötzel},
+ title = {Infinite sets that satisfy the principle of omniscience in any
+ variety of constructive mathematics},
+ journal = {The Journal of Symbolic Logic},
+ volume = {78},
+ year = {2013},
+ number = {3},
+ pages = {764--784},
+ issn = {0022-4812,1943-5886},
+ mrclass = {03F50 (03F55)},
+ mrnumber = {3135497},
+ mrreviewer = {Paulo\ Oliva}
+}
+
@online{Esc17YetAnother,
title = {Yet another characterization of univalence},
author = {Escardó, Martín Hötzel},
diff --git a/src/category-theory/representing-arrow-category.lagda.md b/src/category-theory/representing-arrow-category.lagda.md
index dbdfec5962..b92c75bdbc 100644
--- a/src/category-theory/representing-arrow-category.lagda.md
+++ b/src/category-theory/representing-arrow-category.lagda.md
@@ -12,15 +12,20 @@ open import category-theory.isomorphisms-in-precategories
open import category-theory.precategories
open import foundation.booleans
+open import foundation.decidable-propositions
open import foundation.dependent-pair-types
open import foundation.empty-types
open import foundation.identity-types
+open import foundation.inequality-booleans
open import foundation.logical-equivalences
+open import foundation.logical-operations-booleans
open import foundation.propositions
open import foundation.sets
open import foundation.subtypes
open import foundation.unit-type
open import foundation.universe-levels
+
+open import order-theory.posets
```
@@ -42,9 +47,7 @@ obj-representing-arrow-Category = bool
hom-set-representing-arrow-Category :
obj-representing-arrow-Category → obj-representing-arrow-Category → Set lzero
-hom-set-representing-arrow-Category true true = unit-Set
-hom-set-representing-arrow-Category true false = empty-Set
-hom-set-representing-arrow-Category false _ = unit-Set
+hom-set-representing-arrow-Category x y = set-Prop (leq-bool-Prop x y)
hom-representing-arrow-Category :
obj-representing-arrow-Category → obj-representing-arrow-Category → UU lzero
@@ -60,8 +63,8 @@ comp-hom-representing-arrow-Category :
hom-representing-arrow-Category y z →
hom-representing-arrow-Category x y →
hom-representing-arrow-Category x z
-comp-hom-representing-arrow-Category {true} {true} {true} _ _ = star
-comp-hom-representing-arrow-Category {false} _ _ = star
+comp-hom-representing-arrow-Category {x} {y} {z} =
+ transitive-leq-bool {x} {y} {z}
associative-comp-hom-representing-arrow-Category :
{x y z w : obj-representing-arrow-Category} →
@@ -79,8 +82,7 @@ associative-comp-hom-representing-arrow-Category {false} h g f = refl
id-hom-representing-arrow-Category :
{x : obj-representing-arrow-Category} → hom-representing-arrow-Category x x
-id-hom-representing-arrow-Category {true} = star
-id-hom-representing-arrow-Category {false} = star
+id-hom-representing-arrow-Category {x} = refl-leq-bool {x}
left-unit-law-comp-hom-representing-arrow-Category :
{x y : obj-representing-arrow-Category} →
@@ -101,16 +103,7 @@ right-unit-law-comp-hom-representing-arrow-Category {true} {true} f = refl
right-unit-law-comp-hom-representing-arrow-Category {false} f = refl
representing-arrow-Precategory : Precategory lzero lzero
-representing-arrow-Precategory =
- make-Precategory
- ( obj-representing-arrow-Category)
- ( hom-set-representing-arrow-Category)
- ( λ {x} {y} {z} → comp-hom-representing-arrow-Category {x} {y} {z})
- ( λ x → id-hom-representing-arrow-Category {x})
- ( λ {x} {y} {z} {w} →
- associative-comp-hom-representing-arrow-Category {x} {y} {z} {w})
- ( λ {x} {y} → left-unit-law-comp-hom-representing-arrow-Category {x} {y})
- ( λ {x} {y} → right-unit-law-comp-hom-representing-arrow-Category {x} {y})
+representing-arrow-Precategory = precategory-Poset bool-Poset
```
### The representing arrow category
@@ -118,32 +111,11 @@ representing-arrow-Precategory =
```agda
is-category-representing-arrow-Category :
is-category-Precategory representing-arrow-Precategory
-is-category-representing-arrow-Category true true =
- is-equiv-has-converse-is-prop
- ( is-set-bool true true)
- ( is-prop-type-subtype
- ( is-iso-prop-Precategory representing-arrow-Precategory {true} {true})
- ( is-prop-unit))
- ( λ _ → refl)
-is-category-representing-arrow-Category true false =
- is-equiv-is-empty
- ( iso-eq-Precategory representing-arrow-Precategory true false)
- ( hom-iso-Precategory representing-arrow-Precategory)
-is-category-representing-arrow-Category false true =
- is-equiv-is-empty
- ( iso-eq-Precategory representing-arrow-Precategory false true)
- ( hom-inv-iso-Precategory representing-arrow-Precategory)
-is-category-representing-arrow-Category false false =
- is-equiv-has-converse-is-prop
- ( is-set-bool false false)
- ( is-prop-type-subtype
- ( is-iso-prop-Precategory representing-arrow-Precategory {false} {false})
- ( is-prop-unit))
- ( λ _ → refl)
+is-category-representing-arrow-Category =
+ is-category-precategory-Poset bool-Poset
representing-arrow-Category : Category lzero lzero
-pr1 representing-arrow-Category = representing-arrow-Precategory
-pr2 representing-arrow-Category = is-category-representing-arrow-Category
+representing-arrow-Category = category-Poset bool-Poset
```
## Properties
diff --git a/src/elementary-number-theory/decidable-types.lagda.md b/src/elementary-number-theory/decidable-types.lagda.md
index 047ada9a91..273fc1783c 100644
--- a/src/elementary-number-theory/decidable-types.lagda.md
+++ b/src/elementary-number-theory/decidable-types.lagda.md
@@ -14,6 +14,7 @@ open import elementary-number-theory.upper-bounds-natural-numbers
open import foundation.cartesian-product-types
open import foundation.coproduct-types
+open import foundation.decidable-type-families
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.empty-types
@@ -35,7 +36,7 @@ decidable.
```agda
is-decidable-Σ-ℕ :
- {l : Level} (m : ℕ) (P : ℕ → UU l) (d : is-decidable-fam P) →
+ {l : Level} (m : ℕ) (P : ℕ → UU l) (d : is-decidable-family P) →
is-decidable (Σ ℕ (λ x → (leq-ℕ m x) × (P x))) → is-decidable (Σ ℕ P)
is-decidable-Σ-ℕ m P d (inl (pair x (pair l p))) = inl (pair x p)
is-decidable-Σ-ℕ zero-ℕ P d (inr f) =
@@ -60,7 +61,7 @@ is-decidable-Σ-ℕ (succ-ℕ m) P d (inr f) with d zero-ℕ
```agda
is-decidable-bounded-Σ-ℕ :
{l1 l2 : Level} (m : ℕ) (P : ℕ → UU l1) (Q : ℕ → UU l2)
- (dP : is-decidable-fam P) (dQ : is-decidable-fam Q)
+ (dP : is-decidable-family P) (dQ : is-decidable-family Q)
(H : is-upper-bound-ℕ P m) → is-decidable (Σ ℕ (λ x → (P x) × (Q x)))
is-decidable-bounded-Σ-ℕ m P Q dP dQ H =
is-decidable-Σ-ℕ
@@ -76,7 +77,7 @@ is-decidable-bounded-Σ-ℕ m P Q dP dQ H =
( pr1 (pr2 p))))
is-decidable-bounded-Σ-ℕ' :
- {l : Level} (m : ℕ) (P : ℕ → UU l) (d : is-decidable-fam P) →
+ {l : Level} (m : ℕ) (P : ℕ → UU l) (d : is-decidable-family P) →
is-decidable (Σ ℕ (λ x → (leq-ℕ x m) × (P x)))
is-decidable-bounded-Σ-ℕ' m P d =
is-decidable-bounded-Σ-ℕ m
@@ -92,7 +93,7 @@ is-decidable-bounded-Σ-ℕ' m P d =
```agda
is-decidable-strictly-bounded-Σ-ℕ :
{l1 l2 : Level} (m : ℕ) (P : ℕ → UU l1) (Q : ℕ → UU l2)
- (dP : is-decidable-fam P) (dQ : is-decidable-fam Q)
+ (dP : is-decidable-family P) (dQ : is-decidable-family Q)
(H : is-strict-upper-bound-ℕ P m) →
is-decidable (Σ ℕ (λ x → (P x) × (Q x)))
is-decidable-strictly-bounded-Σ-ℕ m P Q dP dQ H =
@@ -100,7 +101,7 @@ is-decidable-strictly-bounded-Σ-ℕ m P Q dP dQ H =
( is-upper-bound-is-strict-upper-bound-ℕ P m H)
is-decidable-strictly-bounded-Σ-ℕ' :
- {l : Level} (m : ℕ) (P : ℕ → UU l) (d : is-decidable-fam P) →
+ {l : Level} (m : ℕ) (P : ℕ → UU l) (d : is-decidable-family P) →
is-decidable (Σ ℕ (λ x → (le-ℕ x m) × (P x)))
is-decidable-strictly-bounded-Σ-ℕ' m P d =
is-decidable-strictly-bounded-Σ-ℕ m
@@ -115,7 +116,7 @@ is-decidable-strictly-bounded-Σ-ℕ' m P d =
```agda
is-decidable-Π-ℕ :
- {l : Level} (P : ℕ → UU l) (d : is-decidable-fam P) (m : ℕ) →
+ {l : Level} (P : ℕ → UU l) (d : is-decidable-family P) (m : ℕ) →
is-decidable ((x : ℕ) → (leq-ℕ m x) → P x) → is-decidable ((x : ℕ) → P x)
is-decidable-Π-ℕ P d zero-ℕ (inr nH) = inr (λ f → nH (λ x y → f x))
is-decidable-Π-ℕ P d zero-ℕ (inl H) = inl (λ x → H x (leq-zero-ℕ x))
@@ -136,8 +137,8 @@ is-decidable-Π-ℕ P d (succ-ℕ m) (inl H) with d zero-ℕ
```agda
is-decidable-bounded-Π-ℕ :
- {l1 l2 : Level} (P : ℕ → UU l1) (Q : ℕ → UU l2) (dP : is-decidable-fam P) →
- (dQ : is-decidable-fam Q) (m : ℕ) (H : is-upper-bound-ℕ P m) →
+ {l1 l2 : Level} (P : ℕ → UU l1) (Q : ℕ → UU l2) (dP : is-decidable-family P) →
+ (dQ : is-decidable-family Q) (m : ℕ) (H : is-upper-bound-ℕ P m) →
is-decidable ((x : ℕ) → P x → Q x)
is-decidable-bounded-Π-ℕ P Q dP dQ m H =
is-decidable-Π-ℕ
@@ -147,7 +148,7 @@ is-decidable-bounded-Π-ℕ P Q dP dQ m H =
( inl (λ x l p → ex-falso (contradiction-leq-ℕ x m (H x p) l)))
is-decidable-bounded-Π-ℕ' :
- {l : Level} (P : ℕ → UU l) (d : is-decidable-fam P) (m : ℕ) →
+ {l : Level} (P : ℕ → UU l) (d : is-decidable-family P) (m : ℕ) →
is-decidable ((x : ℕ) → (leq-ℕ x m) → P x)
is-decidable-bounded-Π-ℕ' P d m =
is-decidable-bounded-Π-ℕ
@@ -163,14 +164,14 @@ is-decidable-bounded-Π-ℕ' P d m =
```agda
is-decidable-strictly-bounded-Π-ℕ :
- {l1 l2 : Level} (P : ℕ → UU l1) (Q : ℕ → UU l2) (dP : is-decidable-fam P) →
- (dQ : is-decidable-fam Q) (m : ℕ) (H : is-strict-upper-bound-ℕ P m) →
+ {l1 l2 : Level} (P : ℕ → UU l1) (Q : ℕ → UU l2) (dP : is-decidable-family P) →
+ (dQ : is-decidable-family Q) (m : ℕ) (H : is-strict-upper-bound-ℕ P m) →
is-decidable ((x : ℕ) → P x → Q x)
is-decidable-strictly-bounded-Π-ℕ P Q dP dQ m H =
is-decidable-bounded-Π-ℕ P Q dP dQ m (λ x p → leq-le-ℕ x m (H x p))
is-decidable-strictly-bounded-Π-ℕ' :
- {l : Level} (P : ℕ → UU l) (d : is-decidable-fam P) (m : ℕ) →
+ {l : Level} (P : ℕ → UU l) (d : is-decidable-family P) (m : ℕ) →
is-decidable ((x : ℕ) → le-ℕ x m → P x)
is-decidable-strictly-bounded-Π-ℕ' P d m =
is-decidable-strictly-bounded-Π-ℕ
diff --git a/src/elementary-number-theory/equality-natural-numbers.lagda.md b/src/elementary-number-theory/equality-natural-numbers.lagda.md
index bb335e5e58..1c5fb74ff5 100644
--- a/src/elementary-number-theory/equality-natural-numbers.lagda.md
+++ b/src/elementary-number-theory/equality-natural-numbers.lagda.md
@@ -14,6 +14,7 @@ open import foundation.coproduct-types
open import foundation.decidable-equality
open import foundation.decidable-types
open import foundation.dependent-pair-types
+open import foundation.discrete-types
open import foundation.empty-types
open import foundation.equivalences
open import foundation.function-types
@@ -22,11 +23,11 @@ open import foundation.identity-types
open import foundation.propositions
open import foundation.set-truncations
open import foundation.sets
+open import foundation.tight-apartness-relations
open import foundation.unit-type
open import foundation.universe-levels
open import foundation-core.decidable-propositions
-open import foundation-core.discrete-types
open import foundation-core.torsorial-type-families
```
@@ -179,3 +180,11 @@ is-equiv-Eq-eq-ℕ {m} {n} =
equiv-unit-trunc-ℕ-Set : ℕ ≃ type-trunc-Set ℕ
equiv-unit-trunc-ℕ-Set = equiv-unit-trunc-Set ℕ-Set
```
+
+### The natural numbers have a tight apartness relation
+
+```agda
+ℕ-Type-With-Tight-Apartness : Type-With-Tight-Apartness lzero lzero
+ℕ-Type-With-Tight-Apartness =
+ type-with-tight-apartness-Discrete-Type ℕ-Discrete-Type
+```
diff --git a/src/elementary-number-theory/greatest-common-divisor-natural-numbers.lagda.md b/src/elementary-number-theory/greatest-common-divisor-natural-numbers.lagda.md
index 13347d69ac..bc14f911c8 100644
--- a/src/elementary-number-theory/greatest-common-divisor-natural-numbers.lagda.md
+++ b/src/elementary-number-theory/greatest-common-divisor-natural-numbers.lagda.md
@@ -24,6 +24,7 @@ open import elementary-number-theory.well-ordering-principle-natural-numbers
open import foundation.action-on-identifications-functions
open import foundation.cartesian-product-types
open import foundation.coproduct-types
+open import foundation.decidable-type-families
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.empty-types
@@ -87,7 +88,7 @@ pr2 (refl-is-common-divisor-ℕ x) = refl-div-ℕ x
```agda
is-decidable-is-common-divisor-ℕ :
- (a b : ℕ) → is-decidable-fam (is-common-divisor-ℕ a b)
+ (a b : ℕ) → is-decidable-family (is-common-divisor-ℕ a b)
is-decidable-is-common-divisor-ℕ a b x =
is-decidable-product
( is-decidable-div-ℕ x a)
@@ -137,7 +138,7 @@ leq-sum-is-common-divisor-ℕ a b d H =
```agda
is-decidable-is-multiple-of-gcd-ℕ :
- (a b : ℕ) → is-decidable-fam (is-multiple-of-gcd-ℕ a b)
+ (a b : ℕ) → is-decidable-family (is-multiple-of-gcd-ℕ a b)
is-decidable-is-multiple-of-gcd-ℕ a b n =
is-decidable-function-type'
( is-decidable-neg (is-decidable-is-zero-ℕ (a +ℕ b)))
diff --git a/src/elementary-number-theory/inequality-natural-numbers.lagda.md b/src/elementary-number-theory/inequality-natural-numbers.lagda.md
index a31c50691d..f536153a61 100644
--- a/src/elementary-number-theory/inequality-natural-numbers.lagda.md
+++ b/src/elementary-number-theory/inequality-natural-numbers.lagda.md
@@ -182,13 +182,16 @@ cases-order-three-elements-ℕ x y z =
order-three-elements-ℕ :
(x y z : ℕ) → cases-order-three-elements-ℕ x y z
-order-three-elements-ℕ zero-ℕ zero-ℕ zero-ℕ = inl (inl (pair star star))
-order-three-elements-ℕ zero-ℕ zero-ℕ (succ-ℕ z) = inl (inl (pair star star))
-order-three-elements-ℕ zero-ℕ (succ-ℕ y) zero-ℕ = inl (inr (pair star star))
+order-three-elements-ℕ zero-ℕ zero-ℕ zero-ℕ =
+ inl (inl (star , star))
+order-three-elements-ℕ zero-ℕ zero-ℕ (succ-ℕ z) =
+ inl (inl (star , star))
+order-three-elements-ℕ zero-ℕ (succ-ℕ y) zero-ℕ =
+ inl (inr (star , star))
order-three-elements-ℕ zero-ℕ (succ-ℕ y) (succ-ℕ z) =
inl (map-coproduct (pair star) (pair star) (linear-leq-ℕ y z))
order-three-elements-ℕ (succ-ℕ x) zero-ℕ zero-ℕ =
- inr (inl (inl (pair star star)))
+ inr (inl (inl (star , star)))
order-three-elements-ℕ (succ-ℕ x) zero-ℕ (succ-ℕ z) =
inr (inl (map-coproduct (pair star) (pair star) (linear-leq-ℕ z x)))
order-three-elements-ℕ (succ-ℕ x) (succ-ℕ y) zero-ℕ =
@@ -362,8 +365,8 @@ leq-add-ℕ' m n =
```agda
subtraction-leq-ℕ : (n m : ℕ) → n ≤-ℕ m → Σ ℕ (λ l → l +ℕ n = m)
-subtraction-leq-ℕ zero-ℕ m p = pair m refl
-subtraction-leq-ℕ (succ-ℕ n) (succ-ℕ m) p = pair (pr1 P) (ap succ-ℕ (pr2 P))
+subtraction-leq-ℕ zero-ℕ m p = (m , refl)
+subtraction-leq-ℕ (succ-ℕ n) (succ-ℕ m) p = (pr1 P , ap succ-ℕ (pr2 P))
where
P : Σ ℕ (λ l' → l' +ℕ n = m)
P = subtraction-leq-ℕ n m p
@@ -450,12 +453,12 @@ leq-mul-ℕ' k x =
leq-mul-is-nonzero-ℕ :
(k x : ℕ) → is-nonzero-ℕ k → x ≤-ℕ (x *ℕ k)
leq-mul-is-nonzero-ℕ k x H with is-successor-is-nonzero-ℕ H
-... | pair l refl = leq-mul-ℕ l x
+... | (l , refl) = leq-mul-ℕ l x
leq-mul-is-nonzero-ℕ' :
(k x : ℕ) → is-nonzero-ℕ k → x ≤-ℕ (k *ℕ x)
leq-mul-is-nonzero-ℕ' k x H with is-successor-is-nonzero-ℕ H
-... | pair l refl = leq-mul-ℕ' l x
+... | (l , refl) = leq-mul-ℕ' l x
```
## See also
diff --git a/src/elementary-number-theory/kolakoski-sequence.lagda.md b/src/elementary-number-theory/kolakoski-sequence.lagda.md
index 602bc2597a..cdc0b8b321 100644
--- a/src/elementary-number-theory/kolakoski-sequence.lagda.md
+++ b/src/elementary-number-theory/kolakoski-sequence.lagda.md
@@ -14,6 +14,7 @@ open import elementary-number-theory.strong-induction-natural-numbers
open import foundation.booleans
open import foundation.cartesian-product-types
open import foundation.dependent-pair-types
+open import foundation.logical-operations-booleans
```
diff --git a/src/elementary-number-theory/negative-integers.lagda.md b/src/elementary-number-theory/negative-integers.lagda.md
index a549a3ae37..7bc2494ac5 100644
--- a/src/elementary-number-theory/negative-integers.lagda.md
+++ b/src/elementary-number-theory/negative-integers.lagda.md
@@ -14,6 +14,7 @@ open import elementary-number-theory.nonzero-integers
open import foundation.action-on-identifications-functions
open import foundation.coproduct-types
open import foundation.decidable-subtypes
+open import foundation.decidable-type-families
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.empty-types
@@ -96,7 +97,7 @@ neg-one-negative-ℤ = (neg-one-ℤ , star)
### Negativity is decidable
```agda
-is-decidable-is-negative-ℤ : is-decidable-fam is-negative-ℤ
+is-decidable-is-negative-ℤ : is-decidable-family is-negative-ℤ
is-decidable-is-negative-ℤ (inl x) = inl star
is-decidable-is-negative-ℤ (inr x) = inr id
diff --git a/src/elementary-number-theory/nonnegative-integers.lagda.md b/src/elementary-number-theory/nonnegative-integers.lagda.md
index 6f9d446eca..9c06ff7fb4 100644
--- a/src/elementary-number-theory/nonnegative-integers.lagda.md
+++ b/src/elementary-number-theory/nonnegative-integers.lagda.md
@@ -13,6 +13,7 @@ open import elementary-number-theory.natural-numbers
open import foundation.action-on-identifications-functions
open import foundation.coproduct-types
open import foundation.decidable-subtypes
+open import foundation.decidable-type-families
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.empty-types
@@ -98,7 +99,7 @@ one-nonnegative-ℤ = (one-ℤ , star)
### Nonnegativity is decidable
```agda
-is-decidable-is-nonnegative-ℤ : is-decidable-fam is-nonnegative-ℤ
+is-decidable-is-nonnegative-ℤ : is-decidable-family is-nonnegative-ℤ
is-decidable-is-nonnegative-ℤ (inl x) = inr id
is-decidable-is-nonnegative-ℤ (inr x) = inl star
diff --git a/src/elementary-number-theory/nonpositive-integers.lagda.md b/src/elementary-number-theory/nonpositive-integers.lagda.md
index 423216dbe2..2fb4ab4cb4 100644
--- a/src/elementary-number-theory/nonpositive-integers.lagda.md
+++ b/src/elementary-number-theory/nonpositive-integers.lagda.md
@@ -13,6 +13,7 @@ open import elementary-number-theory.natural-numbers
open import foundation.action-on-identifications-functions
open import foundation.coproduct-types
open import foundation.decidable-subtypes
+open import foundation.decidable-type-families
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.empty-types
@@ -100,7 +101,7 @@ neg-one-nonpositive-ℤ = (neg-one-ℤ , star)
### Nonpositivity is decidable
```agda
-is-decidable-is-nonpositive-ℤ : is-decidable-fam is-nonpositive-ℤ
+is-decidable-is-nonpositive-ℤ : is-decidable-family is-nonpositive-ℤ
is-decidable-is-nonpositive-ℤ (inl x) = inl star
is-decidable-is-nonpositive-ℤ (inr (inl x)) = inl star
is-decidable-is-nonpositive-ℤ (inr (inr x)) = inr id
diff --git a/src/elementary-number-theory/positive-integers.lagda.md b/src/elementary-number-theory/positive-integers.lagda.md
index bc942b406f..c5cae426ab 100644
--- a/src/elementary-number-theory/positive-integers.lagda.md
+++ b/src/elementary-number-theory/positive-integers.lagda.md
@@ -15,6 +15,7 @@ open import elementary-number-theory.nonzero-natural-numbers
open import foundation.action-on-identifications-functions
open import foundation.coproduct-types
open import foundation.decidable-subtypes
+open import foundation.decidable-type-families
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.empty-types
@@ -105,7 +106,7 @@ one-positive-ℤ = (one-ℤ , star)
### Positivity is decidable
```agda
-is-decidable-is-positive-ℤ : is-decidable-fam is-positive-ℤ
+is-decidable-is-positive-ℤ : is-decidable-family is-positive-ℤ
is-decidable-is-positive-ℤ (inl x) = inr id
is-decidable-is-positive-ℤ (inr (inl x)) = inr id
is-decidable-is-positive-ℤ (inr (inr x)) = inl star
diff --git a/src/elementary-number-theory/well-ordering-principle-natural-numbers.lagda.md b/src/elementary-number-theory/well-ordering-principle-natural-numbers.lagda.md
index a72905645f..c17dbcafba 100644
--- a/src/elementary-number-theory/well-ordering-principle-natural-numbers.lagda.md
+++ b/src/elementary-number-theory/well-ordering-principle-natural-numbers.lagda.md
@@ -13,6 +13,7 @@ open import elementary-number-theory.natural-numbers
open import foundation.cartesian-product-types
open import foundation.coproduct-types
+open import foundation.decidable-type-families
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.empty-types
@@ -66,7 +67,7 @@ module _
pr2 minimal-element-ℕ-Prop = is-prop-minimal-element-ℕ
is-minimal-element-succ-ℕ :
- {l : Level} (P : ℕ → UU l) (d : is-decidable-fam P)
+ {l : Level} (P : ℕ → UU l) (d : is-decidable-family P)
(m : ℕ) (pm : P (succ-ℕ m))
(is-lower-bound-m : is-lower-bound-ℕ (λ x → P (succ-ℕ x)) m) →
¬ (P zero-ℕ) → is-lower-bound-ℕ P (succ-ℕ m)
@@ -80,7 +81,7 @@ is-minimal-element-succ-ℕ
is-lower-bound-m n psuccn
well-ordering-principle-succ-ℕ :
- {l : Level} (P : ℕ → UU l) (d : is-decidable-fam P)
+ {l : Level} (P : ℕ → UU l) (d : is-decidable-family P)
(n : ℕ) (p : P (succ-ℕ n)) →
is-decidable (P zero-ℕ) →
minimal-element-ℕ (λ m → P (succ-ℕ m)) → minimal-element-ℕ P
@@ -90,7 +91,7 @@ well-ordering-principle-succ-ℕ P d n p (inr neg-p0) (m , pm , is-min-m) =
( succ-ℕ m , pm , is-minimal-element-succ-ℕ P d m pm is-min-m neg-p0)
well-ordering-principle-ℕ :
- {l : Level} (P : ℕ → UU l) (d : is-decidable-fam P) →
+ {l : Level} (P : ℕ → UU l) (d : is-decidable-family P) →
Σ ℕ P → minimal-element-ℕ P
pr1 (well-ordering-principle-ℕ P d (pair zero-ℕ p)) = zero-ℕ
pr1 (pr2 (well-ordering-principle-ℕ P d (pair zero-ℕ p))) = p
@@ -103,7 +104,7 @@ well-ordering-principle-ℕ P d (pair (succ-ℕ n) p) =
( pair n p))
number-well-ordering-principle-ℕ :
- {l : Level} (P : ℕ → UU l) (d : is-decidable-fam P) (nP : Σ ℕ P) → ℕ
+ {l : Level} (P : ℕ → UU l) (d : is-decidable-family P) (nP : Σ ℕ P) → ℕ
number-well-ordering-principle-ℕ P d nP =
pr1 (well-ordering-principle-ℕ P d nP)
```
@@ -114,7 +115,7 @@ This is independently of the input `(pair n p) : Σ ℕ P`.
```agda
is-zero-well-ordering-principle-succ-ℕ :
- {l : Level} (P : ℕ → UU l) (d : is-decidable-fam P)
+ {l : Level} (P : ℕ → UU l) (d : is-decidable-family P)
(n : ℕ) (p : P (succ-ℕ n)) (d0 : is-decidable (P zero-ℕ)) →
(x : minimal-element-ℕ (λ m → P (succ-ℕ m))) (p0 : P zero-ℕ) →
pr1 (well-ordering-principle-succ-ℕ P d n p d0 x) = zero-ℕ
@@ -124,7 +125,7 @@ is-zero-well-ordering-principle-succ-ℕ P d n p (inr np0) x q0 =
ex-falso (np0 q0)
is-zero-well-ordering-principle-ℕ :
- {l : Level} (P : ℕ → UU l) (d : is-decidable-fam P) →
+ {l : Level} (P : ℕ → UU l) (d : is-decidable-family P) →
(x : Σ ℕ P) → P zero-ℕ → is-zero-ℕ (number-well-ordering-principle-ℕ P d x)
is-zero-well-ordering-principle-ℕ P d (pair zero-ℕ p) p0 = refl
is-zero-well-ordering-principle-ℕ P d (pair (succ-ℕ m) p) =
diff --git a/src/elementary-number-theory/well-ordering-principle-standard-finite-types.lagda.md b/src/elementary-number-theory/well-ordering-principle-standard-finite-types.lagda.md
index a422c722f0..c8d6c7ef26 100644
--- a/src/elementary-number-theory/well-ordering-principle-standard-finite-types.lagda.md
+++ b/src/elementary-number-theory/well-ordering-principle-standard-finite-types.lagda.md
@@ -15,6 +15,7 @@ open import elementary-number-theory.well-ordering-principle-natural-numbers
open import foundation.cartesian-product-types
open import foundation.coproduct-types
open import foundation.decidable-subtypes
+open import foundation.decidable-type-families
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.empty-types
@@ -56,7 +57,7 @@ numbers.
```agda
exists-not-not-for-all-Fin :
- {l : Level} (k : ℕ) {P : Fin k → UU l} → (is-decidable-fam P) →
+ {l : Level} (k : ℕ) {P : Fin k → UU l} → (is-decidable-family P) →
¬ ((x : Fin k) → P x) → Σ (Fin k) (λ x → ¬ (P x))
exists-not-not-for-all-Fin {l} zero-ℕ d H = ex-falso (H ind-empty)
exists-not-not-for-all-Fin {l} (succ-ℕ k) {P} d H with d (inr star)
@@ -71,7 +72,7 @@ exists-not-not-for-all-Fin {l} (succ-ℕ k) {P} d H with d (inr star)
exists-not-not-for-all-count :
{l1 l2 : Level} {X : UU l1} (P : X → UU l2) →
- (is-decidable-fam P) → count X →
+ (is-decidable-family P) → count X →
¬ ((x : X) → P x) → Σ X (λ x → ¬ (P x))
exists-not-not-for-all-count {l1} {l2} {X} P p e =
( g) ∘
diff --git a/src/finite-group-theory/orbits-permutations.lagda.md b/src/finite-group-theory/orbits-permutations.lagda.md
index 06919a3b39..835bcc5323 100644
--- a/src/finite-group-theory/orbits-permutations.lagda.md
+++ b/src/finite-group-theory/orbits-permutations.lagda.md
@@ -55,6 +55,8 @@ open import foundation.universe-levels
open import lists.lists
+open import logic.propositionally-decidable-types
+
open import univalent-combinatorics.2-element-decidable-subtypes
open import univalent-combinatorics.2-element-types
open import univalent-combinatorics.counting
@@ -491,7 +493,6 @@ module _
( prop-equivalence-relation same-orbits-permutation a b))
( λ h →
is-decidable-trunc-Prop-is-merely-decidable
- ( Σ ℕ (λ k → Id (iterate k (map-equiv f) a) b))
( unit-trunc-Prop
( is-decidable-iterate-is-decidable-bounded h a b
( is-decidable-bounded-Σ-ℕ n
diff --git a/src/foundation-core.lagda.md b/src/foundation-core.lagda.md
index 9b9dd2512c..8291e2bc80 100644
--- a/src/foundation-core.lagda.md
+++ b/src/foundation-core.lagda.md
@@ -21,6 +21,7 @@ open import foundation-core.decidable-propositions public
open import foundation-core.dependent-identifications public
open import foundation-core.diagonal-maps-cartesian-products-of-types public
open import foundation-core.discrete-types public
+open import foundation-core.double-negation-stable-equality public
open import foundation-core.embeddings public
open import foundation-core.empty-types public
open import foundation-core.endomorphisms public
@@ -36,6 +37,7 @@ open import foundation-core.homotopies public
open import foundation-core.identity-types public
open import foundation-core.injective-maps public
open import foundation-core.invertible-maps public
+open import foundation-core.iterating-functions public
open import foundation-core.negation public
open import foundation-core.operations-span-diagrams public
open import foundation-core.operations-spans public
diff --git a/src/foundation-core/decidable-propositions.lagda.md b/src/foundation-core/decidable-propositions.lagda.md
index eb48a26b7d..6c69978020 100644
--- a/src/foundation-core/decidable-propositions.lagda.md
+++ b/src/foundation-core/decidable-propositions.lagda.md
@@ -12,9 +12,9 @@ open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.double-negation
open import foundation.negation
-open import foundation.propositional-truncations
open import foundation.transport-along-identifications
open import foundation.unit-type
+open import foundation.universal-property-empty-type
open import foundation.universe-levels
open import foundation-core.cartesian-product-types
@@ -23,6 +23,7 @@ open import foundation-core.empty-types
open import foundation-core.function-types
open import foundation-core.functoriality-dependent-pair-types
open import foundation-core.propositions
+open import foundation-core.sets
open import foundation-core.subtypes
```
@@ -116,6 +117,9 @@ module _
is-decidable type-Decidable-Prop
pr2 is-decidable-prop-Decidable-Prop =
is-prop-is-decidable is-prop-type-Decidable-Prop
+
+ set-Decidable-Prop : Set l
+ set-Decidable-Prop = set-Prop prop-Decidable-Prop
```
### The empty type is a decidable proposition
@@ -206,24 +210,25 @@ module _
is-decidable-is-decidable-prop-Σ : is-decidable (Σ P Q)
is-decidable-is-decidable-prop-Σ =
- rec-coproduct
- ( λ x →
- rec-coproduct
- ( λ y → inl (x , y))
- ( λ ny →
- inr
- ( λ xy →
- ny
- ( tr Q
- ( eq-is-prop (is-prop-type-is-decidable-prop H))
- ( pr2 xy))))
- ( is-decidable-type-is-decidable-prop (K x)))
- ( λ nx → inr (λ xy → nx (pr1 xy)))
+ is-decidable-Σ-has-double-negation-dense-equality-base
+ ( λ x y →
+ intro-double-negation (eq-is-prop (is-prop-type-is-decidable-prop H)))
( is-decidable-type-is-decidable-prop H)
+ ( is-decidable-type-is-decidable-prop ∘ K)
is-decidable-prop-Σ : is-decidable-prop (Σ P Q)
is-decidable-prop-Σ =
( is-prop-is-decidable-prop-Σ , is-decidable-is-decidable-prop-Σ)
+
+Σ-Decidable-Prop :
+ {l1 l2 : Level} →
+ (P : Decidable-Prop l1) →
+ (type-Decidable-Prop P → Decidable-Prop l2) → Decidable-Prop (l1 ⊔ l2)
+Σ-Decidable-Prop P Q =
+ ( Σ (type-Decidable-Prop P) (type-Decidable-Prop ∘ Q) ,
+ is-decidable-prop-Σ
+ ( is-decidable-prop-type-Decidable-Prop P)
+ ( is-decidable-prop-type-Decidable-Prop ∘ Q))
```
### The negation operation on decidable propositions
@@ -251,38 +256,71 @@ type-neg-Decidable-Prop :
type-neg-Decidable-Prop P = type-Decidable-Prop (neg-Decidable-Prop P)
```
-### Decidability of a propositional truncation
+### Function types between decidable propositions
```agda
-abstract
- is-prop-is-decidable-trunc-Prop :
- {l : Level} (A : UU l) → is-prop (is-decidable (type-trunc-Prop A))
- is-prop-is-decidable-trunc-Prop A =
- is-prop-is-decidable is-prop-type-trunc-Prop
-
-is-decidable-trunc-Prop : {l : Level} → UU l → Prop l
-pr1 (is-decidable-trunc-Prop A) = is-decidable (type-trunc-Prop A)
-pr2 (is-decidable-trunc-Prop A) = is-prop-is-decidable-trunc-Prop A
-
-is-decidable-trunc-Prop-is-merely-decidable :
- {l : Level} (A : UU l) →
- is-merely-decidable A → is-decidable (type-trunc-Prop A)
-is-decidable-trunc-Prop-is-merely-decidable A =
- map-universal-property-trunc-Prop
- ( is-decidable-trunc-Prop A)
- ( f)
+module _
+ {l1 l2 : Level} {P : UU l1} {Q : UU l2}
where
- f : is-decidable A → type-Prop (is-decidable-trunc-Prop A)
- f (inl a) = inl (unit-trunc-Prop a)
- f (inr f) = inr (map-universal-property-trunc-Prop empty-Prop f)
-
-is-merely-decidable-is-decidable-trunc-Prop :
- {l : Level} (A : UU l) →
- is-decidable (type-trunc-Prop A) → is-merely-decidable A
-is-merely-decidable-is-decidable-trunc-Prop A (inl x) =
- apply-universal-property-trunc-Prop x
- ( is-merely-decidable-Prop A)
- ( unit-trunc-Prop ∘ inl)
-is-merely-decidable-is-decidable-trunc-Prop A (inr f) =
- unit-trunc-Prop (inr (f ∘ unit-trunc-Prop))
+
+ is-decidable-prop-function-type' :
+ is-decidable P → (P → is-decidable-prop Q) → is-decidable-prop (P → Q)
+ is-decidable-prop-function-type' H K =
+ ( rec-coproduct
+ ( λ p → is-prop-function-type (is-prop-type-is-decidable-prop (K p)))
+ ( λ np → is-prop-is-contr (universal-property-empty-is-empty P np Q))
+ ( H)) ,
+ ( is-decidable-function-type' H (is-decidable-type-is-decidable-prop ∘ K))
+
+ is-decidable-prop-function-type :
+ is-decidable P → is-decidable-prop Q → is-decidable-prop (P → Q)
+ is-decidable-prop-function-type H K =
+ ( is-prop-function-type (is-prop-type-is-decidable-prop K)) ,
+ ( is-decidable-function-type H (is-decidable-type-is-decidable-prop K))
+
+hom-Decidable-Prop :
+ {l1 l2 : Level} →
+ Decidable-Prop l1 → Decidable-Prop l2 → Decidable-Prop (l1 ⊔ l2)
+hom-Decidable-Prop P Q =
+ ( type-Decidable-Prop P → type-Decidable-Prop Q) ,
+ ( is-decidable-prop-function-type
+ ( is-decidable-Decidable-Prop P)
+ ( is-decidable-prop-type-Decidable-Prop Q))
+```
+
+### Dependent products of decidable propositions
+
+```agda
+module _
+ {l1 l2 : Level} {P : UU l1} {Q : P → UU l2}
+ where
+
+ is-decidable-Π-is-decidable-prop :
+ is-decidable-prop P →
+ ((x : P) → is-decidable-prop (Q x)) →
+ is-decidable ((x : P) → Q x)
+ is-decidable-Π-is-decidable-prop (H , inl x) K =
+ rec-coproduct
+ ( λ y → inl (λ x' → tr Q (eq-is-prop H) y))
+ ( λ ny → inr (λ f → ny (f x)))
+ ( is-decidable-type-is-decidable-prop (K x))
+ is-decidable-Π-is-decidable-prop (H , inr nx) K =
+ inl (λ x' → ex-falso (nx x'))
+
+ is-decidable-prop-Π :
+ is-decidable-prop P →
+ ((x : P) → is-decidable-prop (Q x)) →
+ is-decidable-prop ((x : P) → Q x)
+ is-decidable-prop-Π H K =
+ ( is-prop-Π (is-prop-type-is-decidable-prop ∘ K)) ,
+ ( is-decidable-Π-is-decidable-prop H K)
+
+Π-Decidable-Prop :
+ {l1 l2 : Level} (P : Decidable-Prop l1) →
+ (type-Decidable-Prop P → Decidable-Prop l2) → Decidable-Prop (l1 ⊔ l2)
+Π-Decidable-Prop P Q =
+ ( (x : type-Decidable-Prop P) → type-Decidable-Prop (Q x)) ,
+ ( is-decidable-prop-Π
+ ( is-decidable-prop-type-Decidable-Prop P)
+ ( is-decidable-prop-type-Decidable-Prop ∘ Q))
```
diff --git a/src/foundation-core/double-negation-stable-equality.lagda.md b/src/foundation-core/double-negation-stable-equality.lagda.md
new file mode 100644
index 0000000000..54e1d424ee
--- /dev/null
+++ b/src/foundation-core/double-negation-stable-equality.lagda.md
@@ -0,0 +1,308 @@
+# Double negation stable equality
+
+```agda
+module foundation-core.double-negation-stable-equality where
+```
+
+Imports
+
+```agda
+open import foundation.action-on-identifications-dependent-functions
+open import foundation.action-on-identifications-functions
+open import foundation.coproduct-types
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.equality-cartesian-product-types
+open import foundation.equality-dependent-pair-types
+open import foundation.equivalences
+open import foundation.injective-maps
+open import foundation.irrefutable-equality
+open import foundation.negation
+open import foundation.reflecting-maps-equivalence-relations
+open import foundation.sets
+open import foundation.unit-type
+open import foundation.universe-levels
+
+open import foundation-core.cartesian-product-types
+open import foundation-core.empty-types
+open import foundation-core.identity-types
+open import foundation-core.propositions
+open import foundation-core.retractions
+open import foundation-core.retracts-of-types
+
+open import logic.double-negation-elimination
+```
+
+
+
+## Idea
+
+A type `A` is said to have
+{{#concept "double negation stable equality" Disambiguation="type" Agda=has-double-negation-stable-equality}}
+if `x = y` has
+[double negation elimination](logic.double-negation-elimination.md) for every
+`x y : A`. By the
+[fundamental theorem of identity types](foundation.fundamental-theorem-of-identity-types.md),
+types with double negation stable equality are [sets](foundation-core.sets.md).
+
+## Definitions
+
+```agda
+has-based-double-negation-stable-equality : {l : Level} (A : UU l) → A → UU l
+has-based-double-negation-stable-equality A x =
+ (y : A) → has-double-negation-elim (x = y)
+
+has-based-double-negation-stable-equality' : {l : Level} (A : UU l) → A → UU l
+has-based-double-negation-stable-equality' A x =
+ (y : A) → has-double-negation-elim (y = x)
+
+has-double-negation-stable-equality : {l : Level} → UU l → UU l
+has-double-negation-stable-equality A =
+ (x : A) → has-based-double-negation-stable-equality A x
+```
+
+## Examples
+
+### Propositions have double negation stable equality
+
+```agda
+abstract
+ has-double-negation-stable-equality-is-prop :
+ {l1 : Level} {A : UU l1} → is-prop A → has-double-negation-stable-equality A
+ has-double-negation-stable-equality-is-prop H x y =
+ double-negation-elim-is-contr (H x y)
+```
+
+### The empty type has double negation stable equality
+
+```agda
+has-double-negation-stable-equality-empty :
+ has-double-negation-stable-equality empty
+has-double-negation-stable-equality-empty ()
+```
+
+### The unit type has double negation stable equality
+
+```agda
+has-double-negation-stable-equality-unit :
+ has-double-negation-stable-equality unit
+has-double-negation-stable-equality-unit _ _ _ = refl
+```
+
+## Properties
+
+### Types with double negation stable equality are sets
+
+```agda
+module _
+ {l : Level} {A : UU l}
+ where
+
+ is-prop-based-Id-has-based-double-negation-stable-equality :
+ {x : A} →
+ has-based-double-negation-stable-equality A x → (y : A) → is-prop (x = y)
+ is-prop-based-Id-has-based-double-negation-stable-equality {x} =
+ is-prop-based-Id-prop-in-based-id x
+ ( λ y → ¬¬ (x = y))
+ ( λ y → is-prop-neg)
+ ( intro-double-negation refl)
+
+ is-set-has-double-negation-stable-equality :
+ has-double-negation-stable-equality A → is-set A
+ is-set-has-double-negation-stable-equality H x =
+ is-prop-based-Id-has-based-double-negation-stable-equality (H x)
+```
+
+### Types with double negation stable equality are closed under injections
+
+```agda
+abstract
+ has-double-negation-stable-equality-injection :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ injection A B →
+ has-double-negation-stable-equality B →
+ has-double-negation-stable-equality A
+ has-double-negation-stable-equality-injection (f , H) d x y =
+ has-double-negation-elim-iff (ap f , H) (d (f x) (f y))
+```
+
+### Types with double negation stable equality are closed under retracts
+
+```agda
+abstract
+ has-double-negation-stable-equality-retract-of :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ A retract-of B →
+ has-double-negation-stable-equality B →
+ has-double-negation-stable-equality A
+ has-double-negation-stable-equality-retract-of (i , r , R) =
+ has-double-negation-stable-equality-injection
+ ( i , is-injective-has-retraction i r R)
+```
+
+### Types with double negation stable equality are closed under equivalences
+
+```agda
+abstract
+ has-double-negation-stable-equality-equiv :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →
+ has-double-negation-stable-equality B →
+ has-double-negation-stable-equality A
+ has-double-negation-stable-equality-equiv e =
+ has-double-negation-stable-equality-retract-of (retract-equiv e)
+
+abstract
+ has-double-negation-stable-equality-equiv' :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →
+ has-double-negation-stable-equality A →
+ has-double-negation-stable-equality B
+ has-double-negation-stable-equality-equiv' e =
+ has-double-negation-stable-equality-retract-of (retract-inv-equiv e)
+```
+
+### Having double negation stable equality is a property
+
+```agda
+abstract
+ is-prop-has-based-double-negation-stable-equality :
+ {l1 : Level} {X : UU l1} (x : X) →
+ is-prop (has-based-double-negation-stable-equality X x)
+ is-prop-has-based-double-negation-stable-equality x =
+ is-prop-has-element
+ ( λ d →
+ is-prop-Π
+ ( λ y →
+ is-prop-function-type
+ ( is-prop-based-Id-has-based-double-negation-stable-equality d y)))
+
+abstract
+ is-prop-has-double-negation-stable-equality :
+ {l1 : Level} {X : UU l1} → is-prop (has-double-negation-stable-equality X)
+ is-prop-has-double-negation-stable-equality =
+ is-prop-Π is-prop-has-based-double-negation-stable-equality
+
+has-double-negation-stable-equality-Prop : {l1 : Level} → UU l1 → Prop l1
+has-double-negation-stable-equality-Prop X =
+ ( has-double-negation-stable-equality X ,
+ is-prop-has-double-negation-stable-equality)
+```
+
+### Any map into a type with double negation stable equality reflects irrefutable equality
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {X : UU l2}
+ (H : has-double-negation-stable-equality X) (f : A → X)
+ where
+
+ reflects-irrefutable-eq :
+ reflects-equivalence-relation (irrefutable-eq-equivalence-relation A) f
+ reflects-irrefutable-eq {x} {y} r =
+ H (f x) (f y) (map-double-negation (ap f) r)
+
+ reflecting-map-irrefutable-eq :
+ reflecting-map-equivalence-relation
+ ( irrefutable-eq-equivalence-relation A)
+ ( X)
+ reflecting-map-irrefutable-eq = (f , reflects-irrefutable-eq)
+```
+
+### A product of types with double negation stable equality has double negation stable equality
+
+```agda
+has-double-negation-stable-equality-product :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ has-double-negation-stable-equality A →
+ has-double-negation-stable-equality B →
+ has-double-negation-stable-equality (A × B)
+has-double-negation-stable-equality-product d e x y p =
+ eq-pair
+ ( d (pr1 x) (pr1 y) (map-double-negation (ap pr1) p))
+ ( e (pr2 x) (pr2 y) (map-double-negation (ap pr2) p))
+```
+
+### Double negation stability of equality of the factors of a cartesian product
+
+If `A × B` has double negation stable equality and `B` has an element, then `A`
+has double negation stable equality; and vice versa.
+
+```agda
+has-double-negation-stable-equality-left-factor :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ has-double-negation-stable-equality (A × B) →
+ B →
+ has-double-negation-stable-equality A
+has-double-negation-stable-equality-left-factor d b x y p =
+ ap pr1 (d (x , b) (y , b) (map-double-negation (λ q → eq-pair q refl) p))
+
+has-double-negation-stable-equality-right-factor :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ has-double-negation-stable-equality (A × B) →
+ A → has-double-negation-stable-equality B
+has-double-negation-stable-equality-right-factor d a x y p =
+ ap pr2 (d (a , x) (a , y) (map-double-negation (eq-pair refl) p))
+```
+
+### If the total space has double negation stable equality, and `B` has a section, then the base type has double negation stable equality
+
+```agda
+abstract
+ has-double-negation-stable-equality-base-has-double-negation-stable-equality-Σ :
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2} (b : (x : A) → B x) →
+ has-double-negation-stable-equality (Σ A B) →
+ has-double-negation-stable-equality A
+ has-double-negation-stable-equality-base-has-double-negation-stable-equality-Σ
+ b dΣ x y nnp =
+ ap
+ ( pr1)
+ ( dΣ
+ ( x , b x)
+ ( y , b y)
+ ( map-double-negation (λ p → eq-pair-Σ p (apd b p)) nnp))
+```
+
+### If `A` and `B` have double negation stable equality, then so does their coproduct
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ has-double-negation-stable-equality-coproduct :
+ has-double-negation-stable-equality A →
+ has-double-negation-stable-equality B →
+ has-double-negation-stable-equality (A + B)
+ has-double-negation-stable-equality-coproduct dA dB (inl x) (inl y) =
+ has-double-negation-elim-iff (is-injective-inl , ap inl) (dA x y)
+ has-double-negation-stable-equality-coproduct dA dB (inl x) (inr y) p =
+ ex-falso (p neq-inl-inr)
+ has-double-negation-stable-equality-coproduct dA dB (inr x) (inl y) p =
+ ex-falso (p neq-inr-inl)
+ has-double-negation-stable-equality-coproduct dA dB (inr x) (inr y) =
+ has-double-negation-elim-iff (is-injective-inr , ap inr) (dB x y)
+
+ has-double-negation-stable-equality-left-summand :
+ has-double-negation-stable-equality (A + B) →
+ has-double-negation-stable-equality A
+ has-double-negation-stable-equality-left-summand d x y =
+ has-double-negation-elim-iff (ap inl , is-injective-inl) (d (inl x) (inl y))
+
+ has-double-negation-stable-equality-right-summand :
+ has-double-negation-stable-equality (A + B) →
+ has-double-negation-stable-equality B
+ has-double-negation-stable-equality-right-summand d x y =
+ has-double-negation-elim-iff (ap inr , is-injective-inr) (d (inr x) (inr y))
+```
+
+## See also
+
+- Every type with a
+ [tight apartness relation](foundation.tight-apartness-relations.md) has double
+ negation stable equality. Conversely, every type with double negation stable
+ equality has a tight, symmetric, antireflexive relation. However, this
+ relation need not be cotransitive.
+
+## External links
+
+- [double negation stable equality](https://ncatlab.org/nlab/show/decidable+equality)
+ at $n$Lab
diff --git a/src/foundation-core/homotopies.lagda.md b/src/foundation-core/homotopies.lagda.md
index 9ddfef0692..b507404937 100644
--- a/src/foundation-core/homotopies.lagda.md
+++ b/src/foundation-core/homotopies.lagda.md
@@ -347,8 +347,7 @@ module _
{H H' : f ~ g}
where
- ap-inv-htpy :
- H ~ H' → inv-htpy H ~ inv-htpy H'
+ ap-inv-htpy : H ~ H' → inv-htpy H ~ inv-htpy H'
ap-inv-htpy K x = ap inv (K x)
```
diff --git a/src/foundation-core/identity-types.lagda.md b/src/foundation-core/identity-types.lagda.md
index 1a8a144f36..56b104ea96 100644
--- a/src/foundation-core/identity-types.lagda.md
+++ b/src/foundation-core/identity-types.lagda.md
@@ -120,10 +120,19 @@ have the induction principle of the identity type.
ind-Id :
{l1 l2 : Level} {A : UU l1}
(x : A) (B : (y : A) (p : x = y) → UU l2) →
- (B x refl) → (y : A) (p : x = y) → B y p
+ B x refl → (y : A) (p : x = y) → B y p
ind-Id x B b y refl = b
```
+### The recursion principle of identity types
+
+```agda
+rec-Id :
+ {l1 l2 : Level} {A : UU l1} (x : A) {B : A → UU l2} →
+ B x → (y : A) → x = y → B y
+rec-Id x {B} = ind-Id x (λ y p → B y)
+```
+
## Operations on the identity type
The identity types form a weak groupoidal structure on types. Thus they come
diff --git a/src/foundation-core/injective-maps.lagda.md b/src/foundation-core/injective-maps.lagda.md
index 72003be269..86895ecbf7 100644
--- a/src/foundation-core/injective-maps.lagda.md
+++ b/src/foundation-core/injective-maps.lagda.md
@@ -18,6 +18,7 @@ open import foundation-core.function-types
open import foundation-core.homotopies
open import foundation-core.identity-types
open import foundation-core.retractions
+open import foundation-core.retracts-of-types
open import foundation-core.sections
```
@@ -25,7 +26,9 @@ open import foundation-core.sections
## Idea
-A map `f : A → B` is **injective** if `f x = f y` implies `x = y`.
+A map `f : A → B` is
+{{#concept "injective" Disambiguation="map of types" WD="injective function" WDID=Q12047217 Agda=is-injective Agda=injection}},
+also called _left cancellable_, if `f x = f y` implies `x = y`.
## Warning
@@ -42,6 +45,16 @@ is-injective {l1} {l2} {A} {B} f = {x y : A} → f x = f y → x = y
injection : {l1 l2 : Level} (A : UU l1) (B : UU l2) → UU (l1 ⊔ l2)
injection A B = Σ (A → B) is-injective
+
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : injection A B)
+ where
+
+ map-injection : A → B
+ map-injection = pr1 f
+
+ is-injective-injection : is-injective map-injection
+ is-injective-injection = pr2 f
```
## Examples
@@ -100,6 +113,39 @@ module _
is-inj-h (is-inj-g ((inv (H x)) ∙ (p ∙ (H x'))))
```
+### Embeddings are injective
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-injective-is-emb : {f : A → B} → is-emb f → is-injective f
+ is-injective-is-emb is-emb-f {x} {y} = map-inv-is-equiv (is-emb-f x y)
+
+ is-injective-emb : (e : A ↪ B) → is-injective (map-emb e)
+ is-injective-emb e {x} {y} = map-inv-is-equiv (is-emb-map-emb e x y)
+
+ injection-emb : A ↪ B → injection A B
+ injection-emb (f , H) = (f , is-injective-is-emb H)
+```
+
+### Retracts are injective
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-injective-inclusion-retract :
+ (R : A retract-of B) → is-injective (inclusion-retract R)
+ is-injective-inclusion-retract (i , R) = is-injective-retraction i R
+
+ injection-retract : A retract-of B → injection A B
+ injection-retract R =
+ ( inclusion-retract R , is-injective-inclusion-retract R)
+```
+
### Equivalences are injective
```agda
@@ -137,20 +183,6 @@ module _
is-equiv-is-invertible g G (λ x → H (G (f x)))
```
-### Any embedding is injective
-
-```agda
-module _
- {l1 l2 : Level} {A : UU l1} {B : UU l2}
- where
-
- is-injective-is-emb : {f : A → B} → is-emb f → is-injective f
- is-injective-is-emb is-emb-f {x} {y} = map-inv-is-equiv (is-emb-f x y)
-
- is-injective-emb : (e : A ↪ B) → is-injective (map-emb e)
- is-injective-emb e {x} {y} = map-inv-is-equiv (is-emb-map-emb e x y)
-```
-
### Any map out of a contractible type is injective
```agda
diff --git a/src/foundation-core/iterating-functions.lagda.md b/src/foundation-core/iterating-functions.lagda.md
new file mode 100644
index 0000000000..e17b549215
--- /dev/null
+++ b/src/foundation-core/iterating-functions.lagda.md
@@ -0,0 +1,123 @@
+# Iterating functions
+
+```agda
+module foundation-core.iterating-functions where
+```
+
+Imports
+
+```agda
+open import elementary-number-theory.natural-numbers
+
+open import foundation.action-on-identifications-functions
+open import foundation.subtypes
+open import foundation.universe-levels
+
+open import foundation-core.commuting-squares-of-maps
+open import foundation-core.function-types
+open import foundation-core.homotopies
+open import foundation-core.identity-types
+```
+
+
+
+## Idea
+
+Any map `f : X → X` can be
+{{#concept "iterated" Disambiguation="endo map of types" Agda=iterate Agda=iterate'}}
+by repeatedly applying `f`.
+
+## Definition
+
+### Iterating functions
+
+```agda
+module _
+ {l : Level} {X : UU l}
+ where
+
+ iterate : ℕ → (X → X) → (X → X)
+ iterate zero-ℕ f x = x
+ iterate (succ-ℕ k) f x = f (iterate k f x)
+
+ iterate' : ℕ → (X → X) → (X → X)
+ iterate' zero-ℕ f x = x
+ iterate' (succ-ℕ k) f x = iterate' k f (f x)
+```
+
+### Homotopies of iterating functions
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} (s : A → A) (t : B → B)
+ where
+
+ coherence-square-iterate :
+ {f : A → B} (H : coherence-square-maps f s t f) →
+ (n : ℕ) → coherence-square-maps f (iterate n s) (iterate n t) f
+ coherence-square-iterate {f} H zero-ℕ x = refl
+ coherence-square-iterate {f} H (succ-ℕ n) =
+ pasting-vertical-coherence-square-maps
+ ( f)
+ ( iterate n s)
+ ( iterate n t)
+ ( f)
+ ( s)
+ ( t)
+ ( f)
+ ( coherence-square-iterate H n)
+ ( H)
+```
+
+## Properties
+
+### The two definitions of iterating are homotopic
+
+```agda
+module _
+ {l : Level} {X : UU l}
+ where
+
+ reassociate-iterate-succ-ℕ :
+ (k : ℕ) (f : X → X) (x : X) → iterate (succ-ℕ k) f x = iterate k f (f x)
+ reassociate-iterate-succ-ℕ zero-ℕ f x = refl
+ reassociate-iterate-succ-ℕ (succ-ℕ k) f x =
+ ap f (reassociate-iterate-succ-ℕ k f x)
+
+ reassociate-iterate : (k : ℕ) (f : X → X) → iterate k f ~ iterate' k f
+ reassociate-iterate zero-ℕ f x = refl
+ reassociate-iterate (succ-ℕ k) f x =
+ reassociate-iterate-succ-ℕ k f x ∙ reassociate-iterate k f (f x)
+```
+
+### If `f : X → X` satisfies a property of endofunctions on `X`, and the property is closed under composition then iterates of `f` satisfy the property
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {f : X → X}
+ (P : subtype l2 (X → X))
+ where
+
+ is-in-subtype-iterate-succ-ℕ :
+ (F : is-in-subtype P f) →
+ ( (h g : X → X) →
+ is-in-subtype P h →
+ is-in-subtype P g →
+ is-in-subtype P (h ∘ g)) →
+ (n : ℕ) → is-in-subtype P (iterate (succ-ℕ n) f)
+ is-in-subtype-iterate-succ-ℕ F H zero-ℕ = F
+ is-in-subtype-iterate-succ-ℕ F H (succ-ℕ n) =
+ H f (iterate (succ-ℕ n) f) F (is-in-subtype-iterate-succ-ℕ F H n)
+
+ is-in-subtype-iterate :
+ (I : is-in-subtype P (id {A = X})) →
+ (F : is-in-subtype P f) →
+ ( (h g : X → X) →
+ is-in-subtype P h →
+ is-in-subtype P g →
+ is-in-subtype P (h ∘ g)) →
+ (n : ℕ) → is-in-subtype P (iterate n f)
+ is-in-subtype-iterate I F H zero-ℕ = I
+ is-in-subtype-iterate I F H (succ-ℕ n) =
+ H f (iterate n f) F (is-in-subtype-iterate I F H n)
+```
diff --git a/src/foundation-core/subtypes.lagda.md b/src/foundation-core/subtypes.lagda.md
index 128f682668..5310ef728e 100644
--- a/src/foundation-core/subtypes.lagda.md
+++ b/src/foundation-core/subtypes.lagda.md
@@ -9,6 +9,7 @@ module foundation-core.subtypes where
```agda
open import foundation.action-on-identifications-functions
open import foundation.dependent-pair-types
+open import foundation.injective-maps
open import foundation.logical-equivalences
open import foundation.subtype-identity-principle
open import foundation.universe-levels
@@ -192,6 +193,9 @@ module _
pr1 emb-subtype = inclusion-subtype B
pr2 emb-subtype = is-emb-inclusion-subtype
+ injection-subtype : injection (type-subtype B) A
+ injection-subtype = injection-emb emb-subtype
+
equiv-ap-inclusion-subtype :
{s t : type-subtype B} →
(s = t) ≃ (inclusion-subtype B s = inclusion-subtype B t)
diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md
index 429dd75e39..85a173a73b 100644
--- a/src/foundation.lagda.md
+++ b/src/foundation.lagda.md
@@ -110,12 +110,14 @@ open import foundation.decidable-maps public
open import foundation.decidable-propositions public
open import foundation.decidable-relations public
open import foundation.decidable-subtypes public
+open import foundation.decidable-type-families public
open import foundation.decidable-types public
open import foundation.dependent-binary-homotopies public
open import foundation.dependent-binomial-theorem public
open import foundation.dependent-epimorphisms public
open import foundation.dependent-epimorphisms-with-respect-to-truncated-types public
open import foundation.dependent-function-types public
+open import foundation.dependent-function-types-with-apartness-relations public
open import foundation.dependent-homotopies public
open import foundation.dependent-identifications public
open import foundation.dependent-inverse-sequential-diagrams public
@@ -144,6 +146,8 @@ open import foundation.disjoint-subtypes public
open import foundation.disjunction public
open import foundation.double-arrows public
open import foundation.double-negation public
+open import foundation.double-negation-dense-equality-maps public
+open import foundation.double-negation-images public
open import foundation.double-negation-modality public
open import foundation.double-negation-stable-equality public
open import foundation.double-negation-stable-propositions public
@@ -199,6 +203,7 @@ open import foundation.fixed-points-endofunctions public
open import foundation.full-subtypes public
open import foundation.function-extensionality public
open import foundation.function-types public
+open import foundation.function-types-with-apartness-relations public
open import foundation.functional-correspondences public
open import foundation.functoriality-action-on-identifications-functions public
open import foundation.functoriality-cartesian-product-types public
@@ -222,6 +227,7 @@ open import foundation.global-subuniverses public
open import foundation.globular-type-of-dependent-functions public
open import foundation.globular-type-of-functions public
open import foundation.higher-homotopies-morphisms-arrows public
+open import foundation.hilbert-epsilon-operators-maps public
open import foundation.hilberts-epsilon-operators public
open import foundation.homotopies public
open import foundation.homotopies-morphisms-arrows public
@@ -240,6 +246,7 @@ open import foundation.implicit-function-types public
open import foundation.impredicative-encodings public
open import foundation.impredicative-universes public
open import foundation.induction-principle-propositional-truncation public
+open import foundation.inequality-booleans public
open import foundation.infinitely-coherent-equivalences public
open import foundation.inhabited-subtypes public
open import foundation.inhabited-types public
@@ -249,6 +256,7 @@ open import foundation.intersections-subtypes public
open import foundation.inverse-sequential-diagrams public
open import foundation.invertible-maps public
open import foundation.involutions public
+open import foundation.irrefutable-equality public
open import foundation.irrefutable-propositions public
open import foundation.isolated-elements public
open import foundation.isomorphisms-of-sets public
@@ -275,6 +283,7 @@ open import foundation.limited-principle-of-omniscience public
open import foundation.locale-of-propositions public
open import foundation.locally-small-types public
open import foundation.logical-equivalences public
+open import foundation.logical-operations-booleans public
open import foundation.maps-in-global-subuniverses public
open import foundation.maps-in-subuniverses public
open import foundation.maybe public
@@ -454,6 +463,9 @@ open import foundation.type-arithmetic-standard-pullbacks public
open import foundation.type-arithmetic-unit-type public
open import foundation.type-duality public
open import foundation.type-theoretic-principle-of-choice public
+open import foundation.types-with-decidable-dependent-pair-types public
+open import foundation.types-with-decidable-dependent-product-types public
+open import foundation.types-with-decidable-universal-quantification public
open import foundation.uniformly-decidable-type-families public
open import foundation.unions-subtypes public
open import foundation.uniqueness-image public
diff --git a/src/foundation/apartness-relations.lagda.md b/src/foundation/apartness-relations.lagda.md
index ed13a9135d..4fe8567102 100644
--- a/src/foundation/apartness-relations.lagda.md
+++ b/src/foundation/apartness-relations.lagda.md
@@ -10,14 +10,10 @@ module foundation.apartness-relations where
open import foundation.binary-relations
open import foundation.dependent-pair-types
open import foundation.disjunction
-open import foundation.existential-quantification
-open import foundation.propositional-truncations
open import foundation.universal-quantification
open import foundation.universe-levels
open import foundation-core.cartesian-product-types
-open import foundation-core.coproduct-types
-open import foundation-core.empty-types
open import foundation-core.identity-types
open import foundation-core.negation
open import foundation-core.propositions
@@ -27,8 +23,9 @@ open import foundation-core.propositions
## Idea
-An **apartness relation** on a type `A` is a
-[relation](foundation.binary-relations.md) `R` which is
+An
+{{#concept "apartness relation" Disambiguation="types" WD="apartness relation" WDID=Q4779193 Agda=Apartness-Relation Agda=is-apartness-relation}}
+on a type `A` is a [relation](foundation.binary-relations.md) `R` which is
- **Antireflexive:** For any `a : A` we have `¬ (R a a)`
- **Symmetric:** For any `a b : A` we have `R a b → R b a`
@@ -56,7 +53,7 @@ module _
is-cotransitive-Prop : Prop (l1 ⊔ l2)
is-cotransitive-Prop =
- ∀' A (λ a → ∀' A (λ b → ∀' A (λ c → R a b ⇒ (R a c ∨ R b c))))
+ ∀' A (λ a → ∀' A (λ b → ∀' A (λ c → R a b ⇒ (R a c) ∨ (R b c))))
is-cotransitive : UU (l1 ⊔ l2)
is-cotransitive = type-Prop is-cotransitive-Prop
@@ -81,6 +78,9 @@ module _
apart-Apartness-Relation : A → A → UU l2
apart-Apartness-Relation x y = type-Prop (rel-Apartness-Relation x y)
+ is-apartness-Apartness-Relation : is-apartness-relation rel-Apartness-Relation
+ is-apartness-Apartness-Relation = pr2 R
+
antirefl-Apartness-Relation : is-antireflexive rel-Apartness-Relation
antirefl-Apartness-Relation = pr1 (pr2 R)
@@ -123,6 +123,11 @@ module _
apart-Type-With-Apartness =
apart-Apartness-Relation apartness-relation-Type-With-Apartness
+ is-apartness-rel-apart-Type-With-Apartness :
+ is-apartness-relation rel-apart-Type-With-Apartness
+ is-apartness-rel-apart-Type-With-Apartness =
+ is-apartness-Apartness-Relation apartness-relation-Type-With-Apartness
+
antirefl-apart-Type-With-Apartness :
is-antireflexive rel-apart-Type-With-Apartness
antirefl-apart-Type-With-Apartness =
@@ -144,83 +149,72 @@ module _
cotransitive-Apartness-Relation apartness-relation-Type-With-Apartness
```
-### Apartness on the type of functions into a type with an apartness relation
-
-```agda
-module _
- {l1 l2 l3 : Level} (X : UU l1) (Y : Type-With-Apartness l2 l3)
- where
-
- rel-apart-function-into-Type-With-Apartness :
- Relation-Prop (l1 ⊔ l3) (X → type-Type-With-Apartness Y)
- rel-apart-function-into-Type-With-Apartness f g =
- ∃ X (λ x → rel-apart-Type-With-Apartness Y (f x) (g x))
-
- apart-function-into-Type-With-Apartness :
- Relation (l1 ⊔ l3) (X → type-Type-With-Apartness Y)
- apart-function-into-Type-With-Apartness f g =
- type-Prop (rel-apart-function-into-Type-With-Apartness f g)
-
- is-prop-apart-function-into-Type-With-Apartness :
- (f g : X → type-Type-With-Apartness Y) →
- is-prop (apart-function-into-Type-With-Apartness f g)
- is-prop-apart-function-into-Type-With-Apartness f g =
- is-prop-type-Prop (rel-apart-function-into-Type-With-Apartness f g)
-```
-
## Properties
+### Restricting apartness along maps
+
```agda
module _
- {l1 l2 l3 : Level} (X : UU l1) (Y : Type-With-Apartness l2 l3)
+ {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2}
+ (f : X → Y)
where
- is-antireflexive-apart-function-into-Type-With-Apartness :
- is-antireflexive (rel-apart-function-into-Type-With-Apartness X Y)
- is-antireflexive-apart-function-into-Type-With-Apartness f H =
- apply-universal-property-trunc-Prop H
- ( empty-Prop)
- ( λ (x , a) → antirefl-apart-Type-With-Apartness Y (f x) a)
-
- is-symmetric-apart-function-into-Type-With-Apartness :
- is-symmetric (apart-function-into-Type-With-Apartness X Y)
- is-symmetric-apart-function-into-Type-With-Apartness f g H =
- apply-universal-property-trunc-Prop H
- ( rel-apart-function-into-Type-With-Apartness X Y g f)
- ( λ (x , a) →
- unit-trunc-Prop
- ( x , symmetric-apart-Type-With-Apartness Y (f x) (g x) a))
-
- abstract
- is-cotransitive-apart-function-into-Type-With-Apartness :
- is-cotransitive (rel-apart-function-into-Type-With-Apartness X Y)
- is-cotransitive-apart-function-into-Type-With-Apartness f g h H =
- apply-universal-property-trunc-Prop H
- ( disjunction-Prop
- ( rel-apart-function-into-Type-With-Apartness X Y f h)
- ( rel-apart-function-into-Type-With-Apartness X Y g h))
- ( λ (x , a) →
- apply-universal-property-trunc-Prop
- ( cotransitive-apart-Type-With-Apartness Y (f x) (g x) (h x) a)
- ( disjunction-Prop
- ( rel-apart-function-into-Type-With-Apartness X Y f h)
- ( rel-apart-function-into-Type-With-Apartness X Y g h))
- ( λ where
- ( inl b) → inl-disjunction (intro-exists x b)
- ( inr b) → inr-disjunction (intro-exists x b)))
-
- exp-Type-With-Apartness : Type-With-Apartness (l1 ⊔ l2) (l1 ⊔ l3)
- pr1 exp-Type-With-Apartness = X → type-Type-With-Apartness Y
- pr1 (pr2 exp-Type-With-Apartness) =
- rel-apart-function-into-Type-With-Apartness X Y
- pr1 (pr2 (pr2 exp-Type-With-Apartness)) =
- is-antireflexive-apart-function-into-Type-With-Apartness
- pr1 (pr2 (pr2 (pr2 exp-Type-With-Apartness))) =
- is-symmetric-apart-function-into-Type-With-Apartness
- pr2 (pr2 (pr2 (pr2 exp-Type-With-Apartness))) =
- is-cotransitive-apart-function-into-Type-With-Apartness
+ restriction-Relation-Prop : Relation-Prop l3 Y → Relation-Prop l3 X
+ restriction-Relation-Prop R x x' = R (f x) (f x')
+
+ restriction-Relation : Relation l3 Y → Relation l3 X
+ restriction-Relation R x x' =
+ R (f x) (f x')
+
+ is-antireflexive-restriction-Relation-Prop :
+ (R : Relation-Prop l3 Y) →
+ is-antireflexive R → is-antireflexive (restriction-Relation-Prop R)
+ is-antireflexive-restriction-Relation-Prop R H x =
+ H (f x)
+
+ is-symmetric-restriction-Relation :
+ (R : Relation l3 Y) →
+ is-symmetric R → is-symmetric (restriction-Relation R)
+ is-symmetric-restriction-Relation R H x x' =
+ H (f x) (f x')
+
+ is-cotransitive-restriction-Relation-Prop :
+ (R : Relation-Prop l3 Y) →
+ is-cotransitive R → is-cotransitive (restriction-Relation-Prop R)
+ is-cotransitive-restriction-Relation-Prop R H x x' x'' =
+ H (f x) (f x') (f x'')
+
+ is-apartness-restriction-Relation-Prop :
+ (R : Relation-Prop l3 Y) →
+ is-apartness-relation R →
+ is-apartness-relation (restriction-Relation-Prop R)
+ is-apartness-restriction-Relation-Prop R (a , s , c) =
+ is-antireflexive-restriction-Relation-Prop R a ,
+ is-symmetric-restriction-Relation (λ y y' → type-Prop (R y y')) s ,
+ is-cotransitive-restriction-Relation-Prop R c
+
+ restriction-Apartness-Relation :
+ Apartness-Relation l3 Y → Apartness-Relation l3 X
+ restriction-Apartness-Relation R =
+ restriction-Relation-Prop (rel-Apartness-Relation R) ,
+ is-apartness-restriction-Relation-Prop
+ ( rel-Apartness-Relation R)
+ ( is-apartness-Apartness-Relation R)
+
+apartness-relation-restriction-Type-With-Apartness :
+ {l1 l2 l3 : Level} {X : UU l1} (Y : Type-With-Apartness l2 l3) →
+ (X → type-Type-With-Apartness Y) → Apartness-Relation l3 X
+apartness-relation-restriction-Type-With-Apartness Y f =
+ restriction-Apartness-Relation f (apartness-relation-Type-With-Apartness Y)
```
## References
{{#bibliography}} {{#reference MRR88}}
+
+## See also
+
+- [Large apartness relations](foundation.large-apartness-relations.md)
+- [Tight apartness relations](foundation.tight-apartness-relations.md)
+- [Dependent function types with apartness relations](foundation.dependent-function-types-with-apartness-relations.md)
+- [Function types with apartness relations](foundation.function-types-with-apartness-relations.md)
diff --git a/src/foundation/booleans.lagda.md b/src/foundation/booleans.lagda.md
index 712d69cc6b..efa937da3b 100644
--- a/src/foundation/booleans.lagda.md
+++ b/src/foundation/booleans.lagda.md
@@ -7,6 +7,7 @@ module foundation.booleans where
Imports
```agda
+open import foundation.apartness-relations
open import foundation.decidable-equality
open import foundation.decidable-types
open import foundation.dependent-pair-types
@@ -14,11 +15,14 @@ open import foundation.discrete-types
open import foundation.involutions
open import foundation.negated-equality
open import foundation.raising-universe-levels
+open import foundation.tight-apartness-relations
open import foundation.unit-type
open import foundation.universe-levels
open import foundation-core.constant-maps
open import foundation-core.coproduct-types
+open import foundation-core.decidable-propositions
+open import foundation-core.double-negation-stable-equality
open import foundation-core.empty-types
open import foundation-core.equivalences
open import foundation-core.function-types
@@ -38,8 +42,8 @@ open import univalent-combinatorics.standard-finite-types
## Idea
-The type of **booleans** is a
-[2-element type](univalent-combinatorics.2-element-types.md) with elements
+The type of {{#concept "booleans" WD="Boolean domain" WDID=Q3269980 Agda=bool}}
+is a [2-element type](univalent-combinatorics.2-element-types.md) with elements
`true false : bool`, which is used for reasoning with
[decidable propositions](foundation-core.decidable-propositions.md).
@@ -144,34 +148,20 @@ neq-false-true-bool ()
neq-true-false-bool : true ≠ false
neq-true-false-bool ()
-```
-## Structure
+is-decidable-Eq-bool : {x y : bool} → is-decidable (Eq-bool x y)
+is-decidable-Eq-bool {true} {true} = inl star
+is-decidable-Eq-bool {true} {false} = inr id
+is-decidable-Eq-bool {false} {true} = inr id
+is-decidable-Eq-bool {false} {false} = inl star
+```
-### The boolean operators
+### The standard interpretation of booleans as decidable propositions
```agda
-neg-bool : bool → bool
-neg-bool true = false
-neg-bool false = true
-
-conjunction-bool : bool → bool → bool
-conjunction-bool true true = true
-conjunction-bool true false = false
-conjunction-bool false true = false
-conjunction-bool false false = false
-
-disjunction-bool : bool → bool → bool
-disjunction-bool true true = true
-disjunction-bool true false = true
-disjunction-bool false true = true
-disjunction-bool false false = false
-
-implication-bool : bool → bool → bool
-implication-bool true true = true
-implication-bool true false = false
-implication-bool false true = true
-implication-bool false false = true
+decidable-prop-bool : bool → Decidable-Prop lzero
+decidable-prop-bool true = unit-Decidable-Prop
+decidable-prop-bool false = empty-Decidable-Prop
```
## Properties
@@ -210,6 +200,19 @@ has-decidable-equality-bool false false = inl refl
bool-Discrete-Type : Discrete-Type lzero
bool-Discrete-Type = bool , has-decidable-equality-bool
+
+has-double-negation-stable-equality-bool :
+ has-double-negation-stable-equality bool
+has-double-negation-stable-equality-bool x y =
+ double-negation-elim-is-decidable (has-decidable-equality-bool x y)
+```
+
+### The booleans have a tight apartness relation
+
+```agda
+bool-Type-With-Tight-Apartness : Type-With-Tight-Apartness lzero lzero
+bool-Type-With-Tight-Apartness =
+ type-with-tight-apartness-Discrete-Type bool-Discrete-Type
```
### The "is true" predicate on booleans
@@ -222,7 +225,14 @@ is-prop-is-true : (b : bool) → is-prop (is-true b)
is-prop-is-true b = is-set-bool b true
is-true-Prop : bool → Prop lzero
-is-true-Prop b = is-true b , is-prop-is-true b
+is-true-Prop b = (is-true b , is-prop-is-true b)
+
+is-decidable-prop-is-true : (b : bool) → is-decidable-prop (is-true b)
+is-decidable-prop-is-true b =
+ ( is-prop-is-true b , has-decidable-equality-bool b true)
+
+is-true-Decidable-Prop : bool → Decidable-Prop lzero
+is-true-Decidable-Prop b = (is-true b , is-decidable-prop-is-true b)
```
### The "is false" predicate on booleans
@@ -236,18 +246,43 @@ is-prop-is-false b = is-set-bool b false
is-false-Prop : bool → Prop lzero
is-false-Prop b = is-false b , is-prop-is-false b
+
+is-decidable-prop-is-false : (b : bool) → is-decidable-prop (is-false b)
+is-decidable-prop-is-false b =
+ ( is-prop-is-false b , has-decidable-equality-bool b false)
+
+is-false-Decidable-Prop : bool → Decidable-Prop lzero
+is-false-Decidable-Prop b = (is-false b , is-decidable-prop-is-false b)
```
### A boolean cannot be both true and false
```agda
-not-is-false-is-true : (x : bool) → is-true x → ¬ (is-false x)
-not-is-false-is-true true t ()
-not-is-false-is-true false () f
-
-not-is-true-is-false : (x : bool) → is-false x → ¬ (is-true x)
-not-is-true-is-false true () f
-not-is-true-is-false false t ()
+is-not-false-is-true : (x : bool) → is-true x → ¬ (is-false x)
+is-not-false-is-true true t ()
+is-not-false-is-true false () f
+
+is-not-true-is-false : (x : bool) → is-false x → ¬ (is-true x)
+is-not-true-is-false true () f
+is-not-true-is-false false t ()
+
+is-false-is-not-true : (x : bool) → ¬ (is-true x) → is-false x
+is-false-is-not-true true np = ex-falso (np refl)
+is-false-is-not-true false np = refl
+
+is-true-is-not-false : (x : bool) → ¬ (is-false x) → is-true x
+is-true-is-not-false true np = refl
+is-true-is-not-false false np = ex-falso (np refl)
+
+contrapositive-is-true-bool :
+ {x y : bool} → (is-true x → is-true y) → is-false y → is-false x
+contrapositive-is-true-bool {x} f refl =
+ is-false-is-not-true x (neq-false-true-bool ∘ f)
+
+contrapositive-is-false-bool :
+ {x y : bool} → (is-false x → is-false y) → is-true y → is-true x
+contrapositive-is-false-bool {x} f refl =
+ is-true-is-not-false x (neq-true-false-bool ∘ f)
```
### The type of booleans is equivalent to `Fin 2`
@@ -298,37 +333,6 @@ pr1 bool-Finite-Type = bool
pr2 bool-Finite-Type = is-finite-bool
```
-### Boolean negation has no fixed points
-
-```agda
-neq-neg-bool : (b : bool) → b ≠ neg-bool b
-neq-neg-bool true ()
-neq-neg-bool false ()
-
-neq-neg-bool' : (b : bool) → neg-bool b ≠ b
-neq-neg-bool' b = neq-neg-bool b ∘ inv
-```
-
-### Boolean negation is an involution
-
-```agda
-is-involution-neg-bool : is-involution neg-bool
-is-involution-neg-bool true = refl
-is-involution-neg-bool false = refl
-```
-
-### Boolean negation is an equivalence
-
-```agda
-abstract
- is-equiv-neg-bool : is-equiv neg-bool
- is-equiv-neg-bool = is-equiv-is-involution is-involution-neg-bool
-
-equiv-neg-bool : bool ≃ bool
-pr1 equiv-neg-bool = neg-bool
-pr2 equiv-neg-bool = is-equiv-neg-bool
-```
-
### The constant function `const bool b` is not an equivalence
```agda
diff --git a/src/foundation/cantors-theorem.lagda.md b/src/foundation/cantors-theorem.lagda.md
index 499ebf65d6..2abcbd3a35 100644
--- a/src/foundation/cantors-theorem.lagda.md
+++ b/src/foundation/cantors-theorem.lagda.md
@@ -16,16 +16,14 @@ open import foundation.function-extensionality
open import foundation.logical-equivalences
open import foundation.negation
open import foundation.powersets
-open import foundation.propositional-truncations
open import foundation.surjective-maps
open import foundation.universe-levels
-open import foundation-core.empty-types
open import foundation-core.fibers-of-maps
-open import foundation-core.propositions
open import logic.de-morgan-propositions
open import logic.de-morgan-subtypes
+open import logic.double-negation-dense-maps
open import logic.double-negation-stable-subtypes
```
@@ -74,18 +72,20 @@ module _
subtype-theorem-Cantor : powerset l2 X
subtype-theorem-Cantor x = neg-Prop (f x x)
- abstract
- not-in-image-subtype-theorem-Cantor : ¬ (fiber f subtype-theorem-Cantor)
- not-in-image-subtype-theorem-Cantor (ξ , α) =
- no-fixed-points-neg-Prop (f ξ ξ) (iff-eq (htpy-eq α ξ))
+ not-in-image-subtype-theorem-Cantor : ¬ (fiber f subtype-theorem-Cantor)
+ not-in-image-subtype-theorem-Cantor (ξ , α) =
+ no-fixed-points-neg-Prop (f ξ ξ) (iff-eq (htpy-eq α ξ))
+
+ theorem-double-negation-dense-Cantor : ¬ (is-double-negation-dense-map f)
+ theorem-double-negation-dense-Cantor H =
+ H subtype-theorem-Cantor not-in-image-subtype-theorem-Cantor
abstract
theorem-Cantor : ¬ (is-surjective f)
- theorem-Cantor H =
- apply-universal-property-trunc-Prop
- ( H subtype-theorem-Cantor)
- ( empty-Prop)
- ( not-in-image-subtype-theorem-Cantor)
+ theorem-Cantor =
+ map-neg
+ is-double-negation-dense-map-is-surjective
+ theorem-double-negation-dense-Cantor
```
### Cantor's theorem for the set of decidable subtypes
@@ -101,21 +101,24 @@ module _
map-theorem-decidable-Cantor : decidable-subtype l2 X
map-theorem-decidable-Cantor x = neg-Decidable-Prop (f x x)
- abstract
- not-in-image-map-theorem-decidable-Cantor :
- ¬ (fiber f map-theorem-decidable-Cantor)
- not-in-image-map-theorem-decidable-Cantor (x , α) =
- no-fixed-points-neg-Decidable-Prop
- ( f x x)
- ( iff-eq (ap prop-Decidable-Prop (htpy-eq α x)))
+ not-in-image-map-theorem-decidable-Cantor :
+ ¬ (fiber f map-theorem-decidable-Cantor)
+ not-in-image-map-theorem-decidable-Cantor (x , α) =
+ no-fixed-points-neg-Decidable-Prop
+ ( f x x)
+ ( iff-eq (ap prop-Decidable-Prop (htpy-eq α x)))
+
+ theorem-double-negation-dense-decidable-Cantor :
+ ¬ (is-double-negation-dense-map f)
+ theorem-double-negation-dense-decidable-Cantor H =
+ H map-theorem-decidable-Cantor not-in-image-map-theorem-decidable-Cantor
abstract
theorem-decidable-Cantor : ¬ (is-surjective f)
- theorem-decidable-Cantor H =
- apply-universal-property-trunc-Prop
- ( H map-theorem-decidable-Cantor)
- ( empty-Prop)
- ( not-in-image-map-theorem-decidable-Cantor)
+ theorem-decidable-Cantor =
+ map-neg
+ is-double-negation-dense-map-is-surjective
+ theorem-double-negation-dense-decidable-Cantor
```
### Cantor's theorem for the set of double negation stable subtypes
@@ -133,21 +136,25 @@ module _
map-theorem-double-negation-stable-Cantor x =
neg-Double-Negation-Stable-Prop (f x x)
- abstract
- not-in-image-map-theorem-double-negation-stable-Cantor :
- ¬ (fiber f map-theorem-double-negation-stable-Cantor)
- not-in-image-map-theorem-double-negation-stable-Cantor (x , α) =
- no-fixed-points-neg-Double-Negation-Stable-Prop
- ( f x x)
- ( iff-eq (ap prop-Double-Negation-Stable-Prop (htpy-eq α x)))
+ not-in-image-map-theorem-double-negation-stable-Cantor :
+ ¬ (fiber f map-theorem-double-negation-stable-Cantor)
+ not-in-image-map-theorem-double-negation-stable-Cantor (x , α) =
+ no-fixed-points-neg-Double-Negation-Stable-Prop
+ ( f x x)
+ ( iff-eq (ap prop-Double-Negation-Stable-Prop (htpy-eq α x)))
+
+ theorem-double-negation-dense-double-negation-stable-Cantor :
+ ¬ (is-double-negation-dense-map f)
+ theorem-double-negation-dense-double-negation-stable-Cantor H =
+ H map-theorem-double-negation-stable-Cantor
+ not-in-image-map-theorem-double-negation-stable-Cantor
abstract
theorem-double-negation-stable-Cantor : ¬ (is-surjective f)
- theorem-double-negation-stable-Cantor H =
- apply-universal-property-trunc-Prop
- ( H map-theorem-double-negation-stable-Cantor)
- ( empty-Prop)
- ( not-in-image-map-theorem-double-negation-stable-Cantor)
+ theorem-double-negation-stable-Cantor =
+ map-neg
+ is-double-negation-dense-map-is-surjective
+ theorem-double-negation-dense-double-negation-stable-Cantor
```
### Cantor's theorem for the set of De Morgan subtypes
@@ -163,21 +170,24 @@ module _
map-theorem-de-morgan-Cantor : de-morgan-subtype l2 X
map-theorem-de-morgan-Cantor x = neg-De-Morgan-Prop (f x x)
- abstract
- not-in-image-map-theorem-de-morgan-Cantor :
- ¬ (fiber f map-theorem-de-morgan-Cantor)
- not-in-image-map-theorem-de-morgan-Cantor (x , α) =
- no-fixed-points-neg-De-Morgan-Prop
- ( f x x)
- ( iff-eq (ap prop-De-Morgan-Prop (htpy-eq α x)))
+ not-in-image-map-theorem-de-morgan-Cantor :
+ ¬ (fiber f map-theorem-de-morgan-Cantor)
+ not-in-image-map-theorem-de-morgan-Cantor (x , α) =
+ no-fixed-points-neg-De-Morgan-Prop
+ ( f x x)
+ ( iff-eq (ap prop-De-Morgan-Prop (htpy-eq α x)))
+
+ theorem-double-negation-dense-de-morgan-Cantor :
+ ¬ (is-double-negation-dense-map f)
+ theorem-double-negation-dense-de-morgan-Cantor H =
+ H map-theorem-de-morgan-Cantor not-in-image-map-theorem-de-morgan-Cantor
abstract
theorem-de-morgan-Cantor : ¬ (is-surjective f)
- theorem-de-morgan-Cantor H =
- apply-universal-property-trunc-Prop
- ( H map-theorem-de-morgan-Cantor)
- ( empty-Prop)
- ( not-in-image-map-theorem-de-morgan-Cantor)
+ theorem-de-morgan-Cantor =
+ map-neg
+ is-double-negation-dense-map-is-surjective
+ theorem-double-negation-dense-de-morgan-Cantor
```
## References
diff --git a/src/foundation/cartesian-product-types.lagda.md b/src/foundation/cartesian-product-types.lagda.md
index 08740b0e83..89c6862b58 100644
--- a/src/foundation/cartesian-product-types.lagda.md
+++ b/src/foundation/cartesian-product-types.lagda.md
@@ -13,7 +13,11 @@ open import foundation.dependent-pair-types
open import foundation.subuniverses
open import foundation.universe-levels
+open import foundation-core.homotopies
open import foundation-core.identity-types
+open import foundation-core.retractions
+open import foundation-core.retracts-of-types
+open import foundation-core.sections
open import foundation-core.transport-along-identifications
```
@@ -46,3 +50,23 @@ is-closed-under-products-subuniverse :
is-closed-under-products-subuniverse P =
is-closed-under-products-subuniverses P P P
```
+
+### If a factor has an element, then the opposite factor is a retract of the product
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2}
+ where
+
+ section-pr1-product : Y → section (pr1 {A = X} {B = λ _ → Y})
+ section-pr1-product y = ((λ x → (x , y)) , refl-htpy)
+
+ retract-left-factor-product : Y → X retract-of (X × Y)
+ retract-left-factor-product y = retract-section pr1 (section-pr1-product y)
+
+ section-pr2-product : X → section (pr2 {A = X} {B = λ _ → Y})
+ section-pr2-product x = ((λ y → (x , y)) , refl-htpy)
+
+ retract-right-factor-product : X → Y retract-of (X × Y)
+ retract-right-factor-product x = retract-section pr2 (section-pr2-product x)
+```
diff --git a/src/foundation/computational-identity-types.lagda.md b/src/foundation/computational-identity-types.lagda.md
index dd7b53ac80..bd5460d23f 100644
--- a/src/foundation/computational-identity-types.lagda.md
+++ b/src/foundation/computational-identity-types.lagda.md
@@ -41,8 +41,12 @@ has the limitation that many of the basic operations only satisfy algebraic laws
_weakly_. On this page, we consider the
{{#concept "computational identity types" Agda=computational-Id}} `x =ʲ y`,
whose elements we call
-{{#concept "computational identifications" Agda=computational-Id}}. These are
-defined by taking the
+{{#concept "computational identifications" Agda=computational-Id}}. The
+computational identity types are equivalent to the standard identity types, but
+have strictly associative and one-sided unital concatenation and a strictly
+involutive inverse operator.
+
+The computational identity types are defined by taking the
[strictly involutive identity types](foundation.strictly-involutive-identity-types.md):
```text
@@ -92,8 +96,8 @@ computational identity types that computes strictly.
- `p ∙ʲ invʲ p ≐ reflʲ`,
and they do not have a strict computation property for their induction
-principle. This boils down to the fact that the Yoneda identity types do not
-have a strict computation property for their induction principle, which is
+principle. This is a consequence of the fact that the Yoneda identity types do
+not have a strict computation property for their induction principle, which is
explained further there.
## Definition
diff --git a/src/foundation/coproduct-types.lagda.md b/src/foundation/coproduct-types.lagda.md
index aaadc73d63..ded32cc218 100644
--- a/src/foundation/coproduct-types.lagda.md
+++ b/src/foundation/coproduct-types.lagda.md
@@ -17,6 +17,7 @@ open import foundation.subuniverses
open import foundation.unit-type
open import foundation.universe-levels
+open import foundation-core.constant-maps
open import foundation-core.contractible-types
open import foundation-core.empty-types
open import foundation-core.equivalences
@@ -26,6 +27,8 @@ open import foundation-core.identity-types
open import foundation-core.injective-maps
open import foundation-core.negation
open import foundation-core.propositions
+open import foundation-core.retractions
+open import foundation-core.retracts-of-types
```
@@ -225,3 +228,23 @@ pr1 (coproduct-Prop P Q H) =
pr2 (coproduct-Prop P Q H) =
is-prop-coproduct H (is-prop-type-Prop P) (is-prop-type-Prop Q)
```
+
+### If a summand has an element, then that summand is a retract of the coproduct
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ retraction-inl : A → retraction (inl {A = A} {B})
+ retraction-inl a = (rec-coproduct id (const B a) , refl-htpy)
+
+ retract-left-summand-coproduct : A → A retract-of (A + B)
+ retract-left-summand-coproduct a = (inl , retraction-inl a)
+
+ retraction-inr : B → retraction (inr {A = A} {B})
+ retraction-inr b = (rec-coproduct (const A b) id , refl-htpy)
+
+ retract-right-summand-coproduct : B → B retract-of (A + B)
+ retract-right-summand-coproduct b = (inr , retraction-inr b)
+```
diff --git a/src/foundation/decidable-dependent-function-types.lagda.md b/src/foundation/decidable-dependent-function-types.lagda.md
index c63c6ddeea..48da0bfb77 100644
--- a/src/foundation/decidable-dependent-function-types.lagda.md
+++ b/src/foundation/decidable-dependent-function-types.lagda.md
@@ -7,9 +7,14 @@ module foundation.decidable-dependent-function-types where
Imports
```agda
+open import foundation.decidable-propositions
open import foundation.decidable-types
+open import foundation.dependent-pair-types
open import foundation.functoriality-dependent-function-types
+open import foundation.irrefutable-equality
open import foundation.maybe
+open import foundation.mere-equality
+open import foundation.propositions
open import foundation.uniformly-decidable-type-families
open import foundation.universal-property-coproduct-types
open import foundation.universal-property-maybe
@@ -19,7 +24,8 @@ open import foundation-core.coproduct-types
open import foundation-core.empty-types
open import foundation-core.equivalences
open import foundation-core.function-types
-open import foundation-core.negation
+
+open import logic.propositionally-decidable-types
```
@@ -46,6 +52,28 @@ is-decidable-Π-uniformly-decidable-family (inl a) (inr b) =
inr (λ f → b a (f a))
is-decidable-Π-uniformly-decidable-family (inr na) _ =
inl (ex-falso ∘ na)
+
+is-decidable-prop-Π-uniformly-decidable-family :
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2} →
+ is-decidable A →
+ is-uniformly-decidable-family B →
+ ((x : A) → is-prop (B x)) →
+ is-decidable-prop ((a : A) → (B a))
+is-decidable-prop-Π-uniformly-decidable-family dA dB H =
+ ( is-prop-Π H , is-decidable-Π-uniformly-decidable-family dA dB)
+
+abstract
+ is-decidable-prop-Π-uniformly-decidable-family' :
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2} →
+ is-inhabited-or-empty A →
+ is-uniformly-decidable-family B →
+ ((x : A) → is-prop (B x)) →
+ is-decidable-prop ((a : A) → (B a))
+ is-decidable-prop-Π-uniformly-decidable-family' {A = A} {B} dA dB H =
+ elim-is-inhabited-or-empty-Prop'
+ ( is-decidable-prop-Prop ((a : A) → (B a)))
+ ( λ d → is-decidable-prop-Π-uniformly-decidable-family d dB H)
+ ( dA)
```
### Decidablitilty of dependent products over coproducts
@@ -76,6 +104,97 @@ is-decidable-Π-Maybe {B = B} du de =
( is-decidable-product du de)
```
+### Dependent products of decidable propositions over a base with double negation dense equality are decidable propositions
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} (B : A → Decidable-Prop l2)
+ where
+
+ is-decidable-Π-has-double-negation-dense-equality-base :
+ has-double-negation-dense-equality A →
+ is-decidable A →
+ is-decidable ((x : A) → type-Decidable-Prop (B x))
+ is-decidable-Π-has-double-negation-dense-equality-base H dA =
+ is-decidable-Π-uniformly-decidable-family dA
+ ( is-uniformly-decidable-family-has-double-negation-dense-equality-base
+ ( H)
+ ( is-decidable-Decidable-Prop ∘ B)
+ ( dA))
+
+ is-decidable-prop-Π-has-double-negation-dense-equality-base :
+ has-double-negation-dense-equality A →
+ is-decidable A →
+ is-decidable-prop ((x : A) → type-Decidable-Prop (B x))
+ is-decidable-prop-Π-has-double-negation-dense-equality-base H dA =
+ is-decidable-prop-Π-uniformly-decidable-family dA
+ ( is-uniformly-decidable-family-has-double-negation-dense-equality-base
+ ( H)
+ ( is-decidable-Decidable-Prop ∘ B)
+ ( dA))
+ ( is-prop-type-Decidable-Prop ∘ B)
+
+ is-decidable-prop-Π-has-double-negation-dense-equality-base' :
+ has-double-negation-dense-equality A →
+ is-inhabited-or-empty A →
+ is-decidable-prop ((x : A) → type-Decidable-Prop (B x))
+ is-decidable-prop-Π-has-double-negation-dense-equality-base' H dA =
+ is-decidable-prop-Π-uniformly-decidable-family' dA
+ ( is-uniformly-decidable-family-has-double-negation-dense-equality-base'
+ ( H)
+ ( is-decidable-Decidable-Prop ∘ B)
+ ( dA)
+ ( is-prop-type-Decidable-Prop ∘ B))
+ ( is-prop-type-Decidable-Prop ∘ B)
+```
+
+### Dependent products of decidable propositions over a base with mere equality are decidable propositions
+
+Assuming the base `A` is empty or 0-connected, a dependent product of decidable
+propositions over `A` is again a decidable proposition.
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} (B : A → Decidable-Prop l2)
+ where
+
+ is-decidable-Π-all-elements-merely-equal-base :
+ all-elements-merely-equal A →
+ is-decidable A →
+ is-decidable ((x : A) → type-Decidable-Prop (B x))
+ is-decidable-Π-all-elements-merely-equal-base H dA =
+ is-decidable-Π-uniformly-decidable-family dA
+ ( is-uniformly-decidable-family-all-elements-merely-equal-base
+ ( H)
+ ( is-decidable-Decidable-Prop ∘ B)
+ ( dA))
+
+ is-decidable-prop-Π-all-elements-merely-equal-base :
+ all-elements-merely-equal A →
+ is-decidable A →
+ is-decidable-prop ((x : A) → type-Decidable-Prop (B x))
+ is-decidable-prop-Π-all-elements-merely-equal-base H dA =
+ is-decidable-prop-Π-uniformly-decidable-family dA
+ ( is-uniformly-decidable-family-all-elements-merely-equal-base
+ ( H)
+ ( is-decidable-Decidable-Prop ∘ B)
+ ( dA))
+ ( is-prop-type-Decidable-Prop ∘ B)
+
+ is-decidable-prop-Π-all-elements-merely-equal-base' :
+ all-elements-merely-equal A →
+ is-inhabited-or-empty A →
+ is-decidable-prop ((x : A) → type-Decidable-Prop (B x))
+ is-decidable-prop-Π-all-elements-merely-equal-base' H dA =
+ is-decidable-prop-Π-uniformly-decidable-family' dA
+ ( is-uniformly-decidable-family-all-elements-merely-equal-base'
+ ( H)
+ ( is-decidable-Decidable-Prop ∘ B)
+ ( dA)
+ ( is-prop-type-Decidable-Prop ∘ B))
+ ( is-prop-type-Decidable-Prop ∘ B)
+```
+
### Decidability of dependent products over an equivalence
```agda
diff --git a/src/foundation/decidable-dependent-pair-types.lagda.md b/src/foundation/decidable-dependent-pair-types.lagda.md
index 4af4b5e568..6d80fb78de 100644
--- a/src/foundation/decidable-dependent-pair-types.lagda.md
+++ b/src/foundation/decidable-dependent-pair-types.lagda.md
@@ -9,7 +9,10 @@ module foundation.decidable-dependent-pair-types where
```agda
open import foundation.decidable-types
open import foundation.dependent-pair-types
+open import foundation.irrefutable-equality
open import foundation.maybe
+open import foundation.propositional-truncations
+open import foundation.transport-along-identifications
open import foundation.type-arithmetic-coproduct-types
open import foundation.type-arithmetic-unit-type
open import foundation.uniformly-decidable-type-families
@@ -20,6 +23,8 @@ open import foundation-core.equivalences
open import foundation-core.function-types
open import foundation-core.functoriality-dependent-pair-types
open import foundation-core.negation
+
+open import logic.propositionally-decidable-types
```
@@ -32,6 +37,21 @@ We describe conditions under which
## Properites
+### Decidability of dependent sums over equivalences
+
+```agda
+module _
+ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : A → UU l3} {D : B → UU l4}
+ (e : A ≃ B) (f : (x : A) → C x ≃ D (map-equiv e x))
+ where
+
+ is-decidable-Σ-equiv : is-decidable (Σ A C) → is-decidable (Σ B D)
+ is-decidable-Σ-equiv = is-decidable-equiv' (equiv-Σ D e f)
+
+ is-decidable-Σ-equiv' : is-decidable (Σ B D) → is-decidable (Σ A C)
+ is-decidable-Σ-equiv' = is-decidable-equiv (equiv-Σ D e f)
+```
+
### Dependent sums of a uniformly decidable family of types
```agda
@@ -66,24 +86,38 @@ is-decidable-Σ-coproduct {A = A} {B} C dA dB =
```agda
is-decidable-Σ-Maybe :
{l1 l2 : Level} {A : UU l1} {B : Maybe A → UU l2} →
- is-decidable (Σ A (B ∘ unit-Maybe)) → is-decidable (B exception-Maybe) →
+ is-decidable (Σ A (B ∘ unit-Maybe)) →
+ is-decidable (B exception-Maybe) →
is-decidable (Σ (Maybe A) B)
is-decidable-Σ-Maybe {A = A} {B} dA de =
is-decidable-Σ-coproduct B dA
( is-decidable-equiv (left-unit-law-Σ (B ∘ inr)) de)
```
-### Decidability of dependent sums over equivalences
+### Decidability of dependent sums over bases with double negation dense equality
```agda
module _
- {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : A → UU l3} {D : B → UU l4}
- (e : A ≃ B) (f : (x : A) → C x ≃ D (map-equiv e x))
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ (H : has-double-negation-dense-equality A)
where
- is-decidable-Σ-equiv : is-decidable (Σ A C) → is-decidable (Σ B D)
- is-decidable-Σ-equiv = is-decidable-equiv' (equiv-Σ D e f)
-
- is-decidable-Σ-equiv' : is-decidable (Σ B D) → is-decidable (Σ A C)
- is-decidable-Σ-equiv' = is-decidable-equiv (equiv-Σ D e f)
+ is-inhabited-or-empty-Σ-has-double-negation-dense-equality-base :
+ is-inhabited-or-empty A →
+ ((x : A) → is-inhabited-or-empty (B x)) →
+ is-inhabited-or-empty (Σ A B)
+ is-inhabited-or-empty-Σ-has-double-negation-dense-equality-base dA dB =
+ elim-is-inhabited-or-empty-Prop
+ ( is-inhabited-or-empty-Prop (Σ A B))
+ ( λ a →
+ elim-is-inhabited-or-empty-Prop
+ ( is-inhabited-or-empty-Prop (Σ A B))
+ ( λ b → inl (unit-trunc-Prop (a , b)))
+ ( λ nb → inr (λ x → H (pr1 x) a (λ p → nb (tr B p (pr2 x)))))
+ ( dB a))
+ ( λ na → inr (map-neg pr1 na))
+ ( dA)
```
+
+See [`foundation.decidable-types`](foundation.decidable-types.md) for the
+untruncated version.
diff --git a/src/foundation/decidable-equality.lagda.md b/src/foundation/decidable-equality.lagda.md
index 05a5b5b201..83b6334b47 100644
--- a/src/foundation/decidable-equality.lagda.md
+++ b/src/foundation/decidable-equality.lagda.md
@@ -12,6 +12,7 @@ open import foundation.coproduct-types
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.double-negation
+open import foundation.equivalences
open import foundation.injective-maps
open import foundation.negation
open import foundation.sections
@@ -23,10 +24,10 @@ open import foundation.universe-levels
open import foundation-core.cartesian-product-types
open import foundation-core.empty-types
open import foundation-core.equality-dependent-pair-types
-open import foundation-core.equivalences
open import foundation-core.fibers-of-maps
open import foundation-core.identity-types
open import foundation-core.propositions
+open import foundation-core.retractions
open import foundation-core.retracts-of-types
open import foundation-core.transport-along-identifications
```
@@ -41,7 +42,7 @@ if `x = y` is a [decidable type](foundation.decidable-types.md) for every
`x y : A`.
```agda
-has-decidable-equality : {l : Level} (A : UU l) → UU l
+has-decidable-equality : {l : Level} → UU l → UU l
has-decidable-equality A = (x y : A) → is-decidable (x = y)
```
@@ -72,47 +73,17 @@ has-decidable-equality-unit star star = inl refl
## Properties
-### A product of types with decidable equality has decidable equality
-
-```agda
-has-decidable-equality-product' :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- (f : B → has-decidable-equality A) (g : A → has-decidable-equality B) →
- has-decidable-equality (A × B)
-has-decidable-equality-product' f g (pair x y) (pair x' y') with
- f y x x' | g x y y'
-... | inl refl | inl refl = inl refl
-... | inl refl | inr nq = inr (λ r → nq (ap pr2 r))
-... | inr np | inl refl = inr (λ r → np (ap pr1 r))
-... | inr np | inr nq = inr (λ r → np (ap pr1 r))
-
-has-decidable-equality-product :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- has-decidable-equality A → has-decidable-equality B →
- has-decidable-equality (A × B)
-has-decidable-equality-product d e =
- has-decidable-equality-product' (λ y → d) (λ x → e)
-```
-
-### Decidability of equality of the factors of a cartesian product
-
-If `A × B` has decidable equality and `B` has an element, then `A` has decidable
-equality; and vice versa.
+### Types with decidable equality are closed under injections
```agda
-has-decidable-equality-left-factor :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- has-decidable-equality (A × B) → B → has-decidable-equality A
-has-decidable-equality-left-factor d b x y with d (pair x b) (pair y b)
-... | inl p = inl (ap pr1 p)
-... | inr np = inr (λ q → np (ap (λ z → pair z b) q))
-
-has-decidable-equality-right-factor :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- has-decidable-equality (A × B) → A → has-decidable-equality B
-has-decidable-equality-right-factor d a x y with d (pair a x) (pair a y)
-... | inl p = inl (ap pr2 p)
-... | inr np = inr (λ q → np (eq-pair-eq-fiber q))
+abstract
+ has-decidable-equality-injection :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ injection A B →
+ has-decidable-equality B →
+ has-decidable-equality A
+ has-decidable-equality-injection (f , H) d x y =
+ is-decidable-iff H (ap f) (d (f x) (f y))
```
### Types with decidable equality are closed under retracts
@@ -121,11 +92,12 @@ has-decidable-equality-right-factor d a x y with d (pair a x) (pair a y)
abstract
has-decidable-equality-retract-of :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
- A retract-of B → has-decidable-equality B → has-decidable-equality A
- has-decidable-equality-retract-of (pair i (pair r H)) d x y =
- is-decidable-retract-of
- ( retract-eq (pair i (pair r H)) x y)
- ( d (i x) (i y))
+ A retract-of B →
+ has-decidable-equality B →
+ has-decidable-equality A
+ has-decidable-equality-retract-of (i , r , R) =
+ has-decidable-equality-injection
+ ( i , is-injective-has-retraction i r R)
```
### Types with decidable equality are closed under equivalences
@@ -134,21 +106,24 @@ abstract
abstract
has-decidable-equality-equiv :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →
- has-decidable-equality B → has-decidable-equality A
- has-decidable-equality-equiv e dB x y =
- is-decidable-equiv (equiv-ap e x y) (dB (map-equiv e x) (map-equiv e y))
+ has-decidable-equality B →
+ has-decidable-equality A
+ has-decidable-equality-equiv e =
+ has-decidable-equality-retract-of (retract-equiv e)
abstract
has-decidable-equality-equiv' :
{l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →
- has-decidable-equality A → has-decidable-equality B
- has-decidable-equality-equiv' e = has-decidable-equality-equiv (inv-equiv e)
+ has-decidable-equality A →
+ has-decidable-equality B
+ has-decidable-equality-equiv' e =
+ has-decidable-equality-retract-of (retract-inv-equiv e)
```
-### Hedberg's theorem
+### Characterizing equality in a type with decidable equality
-**Hedberg's theorem** asserts that types with decidable equality are
-[sets](foundation-core.sets.md).
+The identity types of a type with decidable equality are necessarily also
+propositions, hence, they are either the unit or empty type.
```agda
module _
@@ -164,48 +139,50 @@ module _
(d : has-decidable-equality A) → A → A → UU lzero
Eq-has-decidable-equality d x y = Eq-has-decidable-equality' x y (d x y)
- abstract
- is-prop-Eq-has-decidable-equality' :
- (x y : A) (t : is-decidable (x = y)) →
- is-prop (Eq-has-decidable-equality' x y t)
- is-prop-Eq-has-decidable-equality' x y (inl p) = is-prop-unit
- is-prop-Eq-has-decidable-equality' x y (inr f) = is-prop-empty
-
- abstract
- is-prop-Eq-has-decidable-equality :
- (d : has-decidable-equality A)
- {x y : A} → is-prop (Eq-has-decidable-equality d x y)
- is-prop-Eq-has-decidable-equality d {x} {y} =
- is-prop-Eq-has-decidable-equality' x y (d x y)
+ is-prop-Eq-has-decidable-equality' :
+ (x y : A) (t : is-decidable (x = y)) →
+ is-prop (Eq-has-decidable-equality' x y t)
+ is-prop-Eq-has-decidable-equality' x y (inl p) = is-prop-unit
+ is-prop-Eq-has-decidable-equality' x y (inr f) = is-prop-empty
+
+ is-prop-Eq-has-decidable-equality :
+ (d : has-decidable-equality A)
+ {x y : A} → is-prop (Eq-has-decidable-equality d x y)
+ is-prop-Eq-has-decidable-equality d {x} {y} =
+ is-prop-Eq-has-decidable-equality' x y (d x y)
+
+ refl-Eq-has-decidable-equality :
+ (d : has-decidable-equality A) (x : A) →
+ Eq-has-decidable-equality d x x
+ refl-Eq-has-decidable-equality d x with d x x
+ ... | inl α = star
+ ... | inr f = f refl
+
+ Eq-has-decidable-equality-eq :
+ (d : has-decidable-equality A) {x y : A} →
+ x = y → Eq-has-decidable-equality d x y
+ Eq-has-decidable-equality-eq d {x} {.x} refl =
+ refl-Eq-has-decidable-equality d x
+
+ eq-Eq-has-decidable-equality' :
+ (x y : A) (t : is-decidable (x = y)) →
+ Eq-has-decidable-equality' x y t → x = y
+ eq-Eq-has-decidable-equality' x y (inl p) t = p
+ eq-Eq-has-decidable-equality' x y (inr f) t = ex-falso t
+
+ eq-Eq-has-decidable-equality :
+ (d : has-decidable-equality A) {x y : A} →
+ Eq-has-decidable-equality d x y → x = y
+ eq-Eq-has-decidable-equality d {x} {y} =
+ eq-Eq-has-decidable-equality' x y (d x y)
+```
- abstract
- refl-Eq-has-decidable-equality :
- (d : has-decidable-equality A) (x : A) →
- Eq-has-decidable-equality d x x
- refl-Eq-has-decidable-equality d x with d x x
- ... | inl α = star
- ... | inr f = f refl
+### Types with decidable equality are sets
- abstract
- Eq-has-decidable-equality-eq :
- (d : has-decidable-equality A) {x y : A} →
- x = y → Eq-has-decidable-equality d x y
- Eq-has-decidable-equality-eq d {x} {.x} refl =
- refl-Eq-has-decidable-equality d x
-
- abstract
- eq-Eq-has-decidable-equality' :
- (x y : A) (t : is-decidable (x = y)) →
- Eq-has-decidable-equality' x y t → x = y
- eq-Eq-has-decidable-equality' x y (inl p) t = p
- eq-Eq-has-decidable-equality' x y (inr f) t = ex-falso t
-
- abstract
- eq-Eq-has-decidable-equality :
- (d : has-decidable-equality A) {x y : A} →
- Eq-has-decidable-equality d x y → x = y
- eq-Eq-has-decidable-equality d {x} {y} =
- eq-Eq-has-decidable-equality' x y (d x y)
+```agda
+module _
+ {l : Level} {A : UU l}
+ where
abstract
is-set-has-decidable-equality : has-decidable-equality A → is-set A
@@ -241,6 +218,49 @@ pr1 (has-decidable-equality-Prop X) = has-decidable-equality X
pr2 (has-decidable-equality-Prop X) = is-prop-has-decidable-equality
```
+### A product of types with decidable equality has decidable equality
+
+```agda
+has-decidable-equality-product' :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ (f : B → has-decidable-equality A) (g : A → has-decidable-equality B) →
+ has-decidable-equality (A × B)
+has-decidable-equality-product' f g (x , y) (x' , y') with
+ f y x x' | g x y y'
+... | inl refl | inl refl = inl refl
+... | inl refl | inr nq = inr (λ r → nq (ap pr2 r))
+... | inr np | inl refl = inr (λ r → np (ap pr1 r))
+... | inr np | inr nq = inr (λ r → np (ap pr1 r))
+
+has-decidable-equality-product :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ has-decidable-equality A → has-decidable-equality B →
+ has-decidable-equality (A × B)
+has-decidable-equality-product d e =
+ has-decidable-equality-product' (λ _ → d) (λ _ → e)
+```
+
+### Decidability of equality of the factors of a cartesian product
+
+If `A × B` has decidable equality and `B` has an element, then `A` has decidable
+equality; and vice versa.
+
+```agda
+has-decidable-equality-left-factor :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ has-decidable-equality (A × B) → B → has-decidable-equality A
+has-decidable-equality-left-factor d b x y with d (x , b) (y , b)
+... | inl p = inl (ap pr1 p)
+... | inr np = inr (λ q → np (ap (λ z → z , b) q))
+
+has-decidable-equality-right-factor :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ has-decidable-equality (A × B) → A → has-decidable-equality B
+has-decidable-equality-right-factor d a x y with d (a , x) (a , y)
+... | inl p = inl (ap pr2 p)
+... | inr np = inr (λ q → np (eq-pair-eq-fiber q))
+```
+
### Types with decidable equality are closed under dependent pair types
```agda
@@ -249,7 +269,7 @@ abstract
{l1 l2 : Level} {A : UU l1} {B : A → UU l2} →
has-decidable-equality A → ((x : A) → has-decidable-equality (B x)) →
has-decidable-equality (Σ A B)
- has-decidable-equality-Σ dA dB (pair x y) (pair x' y') with dA x x'
+ has-decidable-equality-Σ {B = B} dA dB (x , y) (x' , y') with dA x x'
... | inr np = inr (λ r → np (ap pr1 r))
... | inl p =
is-decidable-iff eq-pair-Σ' pair-eq-Σ
@@ -328,6 +348,12 @@ module _
is-decidable-iff is-injective-inr (ap inr) (d (inr x) (inr y))
```
+## See also
+
+- An element `x` is [isolated](foundation.isolated-elements.md) if `A` has
+ decidable equality locally at `x`, meaning that for every `y`, the identity
+ type `x = y` is decidable.
+
## External links
- [decidable equality](https://ncatlab.org/nlab/show/decidable+equality) at
diff --git a/src/foundation/decidable-maps.lagda.md b/src/foundation/decidable-maps.lagda.md
index 926253c0dc..fa0d3711df 100644
--- a/src/foundation/decidable-maps.lagda.md
+++ b/src/foundation/decidable-maps.lagda.md
@@ -13,8 +13,10 @@ open import foundation.coproduct-types
open import foundation.decidable-equality
open import foundation.decidable-types
open import foundation.dependent-pair-types
+open import foundation.embeddings
open import foundation.functoriality-cartesian-product-types
open import foundation.functoriality-coproduct-types
+open import foundation.hilbert-epsilon-operators-maps
open import foundation.identity-types
open import foundation.retracts-of-maps
open import foundation.universe-levels
@@ -81,14 +83,13 @@ module _
### Decidable maps are closed under homotopy
```agda
-abstract
- is-decidable-map-htpy :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} →
- f ~ g → is-decidable-map g → is-decidable-map f
- is-decidable-map-htpy H K b =
- is-decidable-equiv
- ( equiv-tot (λ a → equiv-concat (inv (H a)) b))
- ( K b)
+is-decidable-map-htpy :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} →
+ f ~ g → is-decidable-map g → is-decidable-map f
+is-decidable-map-htpy H K b =
+ is-decidable-equiv
+ ( equiv-tot (λ a → equiv-concat (inv (H a)) b))
+ ( K b)
```
### Composition of decidable maps
@@ -279,3 +280,32 @@ module _
( retract-fiber-retract-map f g R x)
( G (map-codomain-inclusion-retract-map f g R x))
```
+
+### Decidable maps have Hilbert ε-operators
+
+```agda
+ε-operator-map-is-decidable-map :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} →
+ is-decidable-map f → ε-operator-map f
+ε-operator-map-is-decidable-map F = ε-operator-is-decidable ∘ F
+```
+
+### Decidable injective maps are embeddings
+
+**Proof.** Given a decidable map `f : A → B` then `f` decomposes
+`B ≃ (im f) + B∖(im f)`. Restricting to `im f` we have a section given by the
+Hilbert ε-operator on `f`. Now, by injectivity of `f` we know this restriction
+map is an equivalence. Hence, by 3-for-2 `f` is also an embedding.
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B}
+ where
+
+ is-emb-is-injective-is-decidable-map :
+ is-decidable-map f → is-injective f → is-emb f
+ is-emb-is-injective-is-decidable-map H K =
+ is-emb-is-injective-ε-operator-map (ε-operator-map-is-decidable-map H) K
+```
+
+There is also an analogous proof using the double negation image.
diff --git a/src/foundation/decidable-propositions.lagda.md b/src/foundation/decidable-propositions.lagda.md
index ef885f24e7..a6f6edc2ae 100644
--- a/src/foundation/decidable-propositions.lagda.md
+++ b/src/foundation/decidable-propositions.lagda.md
@@ -11,8 +11,10 @@ open import foundation-core.decidable-propositions public
```agda
open import foundation.action-on-identifications-functions
open import foundation.booleans
+open import foundation.decidable-equality
open import foundation.decidable-types
open import foundation.dependent-pair-types
+open import foundation.discrete-types
open import foundation.embeddings
open import foundation.empty-types
open import foundation.equivalences
@@ -122,15 +124,18 @@ module _
equiv-bool-Decidable-Prop : Decidable-Prop l ≃ bool
equiv-bool-Decidable-Prop = equiv-bool-Decidable-Prop' ∘e split-Decidable-Prop
+ bool-Decidable-Prop : Decidable-Prop l → bool
+ bool-Decidable-Prop = map-equiv equiv-bool-Decidable-Prop
+
abstract
compute-equiv-bool-Decidable-Prop :
(P : Decidable-Prop l) →
type-Decidable-Prop P ≃ (map-equiv equiv-bool-Decidable-Prop P = true)
- compute-equiv-bool-Decidable-Prop (pair P (pair H (inl p))) =
+ compute-equiv-bool-Decidable-Prop (P , H , inl p) =
equiv-is-contr
( is-proof-irrelevant-is-prop H p)
( is-proof-irrelevant-is-prop (is-set-bool true true) refl)
- compute-equiv-bool-Decidable-Prop (pair P (pair H (inr np))) =
+ compute-equiv-bool-Decidable-Prop (P , H , inr np) =
equiv-is-empty np neq-false-true-bool
```
@@ -166,6 +171,21 @@ pr2 (iff-universes-Decidable-Prop l l' P) p =
( p)))
```
+### The type of decidable propositions in any universe is discrete
+
+```agda
+has-decidable-equality-Decidable-Prop :
+ {l : Level} → has-decidable-equality (Decidable-Prop l)
+has-decidable-equality-Decidable-Prop =
+ has-decidable-equality-equiv
+ ( equiv-bool-Decidable-Prop)
+ ( has-decidable-equality-bool)
+
+Decidable-Prop-Discrete-Type : (l : Level) → Discrete-Type (lsuc l)
+Decidable-Prop-Discrete-Type l =
+ ( Decidable-Prop l , has-decidable-equality-Decidable-Prop)
+```
+
### The type of decidable propositions in any universe is a set
```agda
diff --git a/src/foundation/decidable-subtypes.lagda.md b/src/foundation/decidable-subtypes.lagda.md
index 0bd5ecec7f..fcfc92492a 100644
--- a/src/foundation/decidable-subtypes.lagda.md
+++ b/src/foundation/decidable-subtypes.lagda.md
@@ -154,14 +154,14 @@ module _
( is-decidable-emb-map-decidable-emb f)
( y)
- compute-type-decidable-type-decidable-emb :
+ compute-type-decidable-subtype-decidable-emb :
type-decidable-subtype decidable-subtype-decidable-emb ≃ X
- compute-type-decidable-type-decidable-emb =
+ compute-type-decidable-subtype-decidable-emb =
equiv-total-fiber (map-decidable-emb f)
- inv-compute-type-decidable-type-decidable-emb :
+ inv-compute-type-decidable-subtype-decidable-emb :
X ≃ type-decidable-subtype decidable-subtype-decidable-emb
- inv-compute-type-decidable-type-decidable-emb =
+ inv-compute-type-decidable-subtype-decidable-emb =
inv-equiv-total-fiber (map-decidable-emb f)
```
diff --git a/src/foundation/decidable-type-families.lagda.md b/src/foundation/decidable-type-families.lagda.md
new file mode 100644
index 0000000000..385f928a49
--- /dev/null
+++ b/src/foundation/decidable-type-families.lagda.md
@@ -0,0 +1,166 @@
+# Decidable families
+
+```agda
+module foundation.decidable-type-families where
+```
+
+Imports
+
+```agda
+open import foundation.coproduct-types
+open import foundation.decidable-subtypes
+open import foundation.decidable-types
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.irrefutable-equality
+open import foundation.negation
+open import foundation.propositions
+open import foundation.transport-along-identifications
+open import foundation.universe-levels
+
+open import foundation-core.function-types
+open import foundation-core.identity-types
+```
+
+
+
+## Idea
+
+A type family `B : A → 𝒰` is said to be
+{{#concept "decidable" Disambiguation="type family" Agda=is-decidable-family}}
+if we, for every `x : A`, can either construct an element of `B x`, or we can
+prove that it is [empty](foundation-core.empty-types.md). In other words, we
+interpret decidability via the
+[Curry–Howard interpretation](https://en.wikipedia.org/wiki/Curry–Howard_correspondence)
+of logic into type theory. A related concept is that a type family is either
+[inhabited](foundation.inhabited-types.md) or empty, where inhabitedness of a
+type is expressed using the
+[propositional truncation](foundation.propositional-truncations.md).
+
+## Definitions
+
+### The Curry–Howard interpretation of decidability
+
+```agda
+is-decidable-family : {l1 l2 : Level} {A : UU l1} (P : A → UU l2) → UU (l1 ⊔ l2)
+is-decidable-family {A = A} P = (x : A) → is-decidable (P x)
+
+decidable-family : {l1 : Level} (l2 : Level) → UU l1 → UU (l1 ⊔ lsuc l2)
+decidable-family l2 A = Σ (A → UU l2) is-decidable-family
+
+module _
+ {l1 l2 : Level} {A : UU l1} (P : decidable-family l2 A)
+ where
+
+ family-decidable-family : A → UU l2
+ family-decidable-family = pr1 P
+
+ is-decidable-decidable-family : is-decidable-family family-decidable-family
+ is-decidable-decidable-family = pr2 P
+```
+
+### The underlying decidable type family of a decidable subtype
+
+```agda
+decidable-family-decidable-subtype :
+ {l1 l2 : Level} {A : UU l1} → decidable-subtype l2 A → decidable-family l2 A
+decidable-family-decidable-subtype P =
+ ( is-in-decidable-subtype P , is-decidable-decidable-subtype P)
+```
+
+## Properties
+
+### Reindexing decidable type families
+
+```agda
+module _
+ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (P : decidable-family l3 B)
+ where
+
+ reindex-decidable-family : (f : A → B) → decidable-family l3 A
+ reindex-decidable-family f =
+ ( family-decidable-family P ∘ f , is-decidable-decidable-family P ∘ f)
+```
+
+### The negation of a decidable family is decidable
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} (P : decidable-family l2 A)
+ where
+
+ is-decidable-neg-decidable-family :
+ is-decidable-family (¬_ ∘ family-decidable-family P)
+ is-decidable-neg-decidable-family =
+ is-decidable-neg ∘ is-decidable-decidable-family P
+
+ neg-decidable-family : decidable-family l2 A
+ neg-decidable-family =
+ ( ¬_ ∘ family-decidable-family P , is-decidable-neg-decidable-family)
+```
+
+### Composition of decidable families
+
+Given a decidable family of types with double negation dense equality
+`P : A → 𝒰` and a decidable type family `Q : (x : A) → P x → 𝒰` then we may
+_compose_ `Q` after `P` and obtain a decidabe type family `Q ∘ P : A → 𝒰`.
+
+```agda
+module _
+ {l1 l2 l3 : Level} {A : UU l1}
+ where
+
+ is-decidable-comp-decidable-family-decidable-subtype' :
+ (P : decidable-family l2 A)
+ (Q : (x : A) → decidable-family l3 (family-decidable-family P x)) →
+ ( (x : A) →
+ has-double-negation-dense-equality (family-decidable-family P x)) →
+ is-decidable-family
+ ( λ x → Σ (family-decidable-family P x) (family-decidable-family (Q x)))
+ is-decidable-comp-decidable-family-decidable-subtype' P Q H x =
+ rec-coproduct
+ ( λ p →
+ rec-coproduct
+ ( λ q → inl (p , q))
+ (λ nq →
+ inr
+ ( λ q →
+ H ( x)
+ ( p)
+ ( pr1 q)
+ ( λ r →
+ nq (tr (family-decidable-family (Q x)) (inv r) (pr2 q)))))
+ ( is-decidable-decidable-family (Q x) p))
+ (λ np → inr (map-neg pr1 np))
+ ( is-decidable-decidable-family P x)
+
+ comp-decidable-family-decidable-subtype' :
+ (P : decidable-family l2 A) →
+ ((x : A) → decidable-family l3 (family-decidable-family P x)) →
+ ( (x : A) →
+ has-double-negation-dense-equality (family-decidable-family P x)) →
+ decidable-family (l2 ⊔ l3) A
+ comp-decidable-family-decidable-subtype' P Q H =
+ ( λ x → Σ (family-decidable-family P x) (family-decidable-family (Q x))) ,
+ ( is-decidable-comp-decidable-family-decidable-subtype' P Q H)
+
+ comp-decidable-family-decidable-subtype :
+ (P : decidable-subtype l2 A) →
+ ((x : A) → decidable-family l3 (is-in-decidable-subtype P x)) →
+ decidable-family (l2 ⊔ l3) A
+ comp-decidable-family-decidable-subtype P Q =
+ comp-decidable-family-decidable-subtype'
+ ( decidable-family-decidable-subtype P)
+ ( Q)
+ ( λ x p q →
+ intro-double-negation
+ ( eq-is-prop (is-prop-is-in-decidable-subtype P x)))
+```
+
+### Decidable families on the subuniverse of propositions
+
+> TODO
+
+## See also
+
+- [Uniformly decidable type families](foundation.uniformly-decidable-type-families.md)
diff --git a/src/foundation/decidable-types.lagda.md b/src/foundation/decidable-types.lagda.md
index 93bdd1707e..4ab1a9b661 100644
--- a/src/foundation/decidable-types.lagda.md
+++ b/src/foundation/decidable-types.lagda.md
@@ -13,19 +13,22 @@ open import foundation.dependent-pair-types
open import foundation.double-negation
open import foundation.empty-types
open import foundation.equivalences
+open import foundation.evaluation-functions
+open import foundation.functoriality-coproduct-types
open import foundation.hilberts-epsilon-operators
+open import foundation.irrefutable-equality
open import foundation.logical-equivalences
open import foundation.negation
open import foundation.propositional-truncations
open import foundation.raising-universe-levels
open import foundation.retracts-of-types
+open import foundation.transport-along-identifications
open import foundation.type-arithmetic-empty-type
open import foundation.unit-type
open import foundation.universe-levels
open import foundation-core.cartesian-product-types
open import foundation-core.function-types
-open import foundation-core.propositions
open import foundation-core.retractions
open import foundation-core.sections
```
@@ -45,40 +48,13 @@ of logic into type theory. A related concept is that a type is either
type is expressed using the
[propositional truncation](foundation.propositional-truncations.md).
-## Definition
+## Definitions
### The Curry–Howard interpretation of decidability
```agda
is-decidable : {l : Level} (A : UU l) → UU l
is-decidable A = A + (¬ A)
-
-is-decidable-fam :
- {l1 l2 : Level} {A : UU l1} (P : A → UU l2) → UU (l1 ⊔ l2)
-is-decidable-fam {A = A} P = (x : A) → is-decidable (P x)
-```
-
-### The predicate that a type is inhabited or empty
-
-```agda
-is-inhabited-or-empty : {l1 : Level} → UU l1 → UU l1
-is-inhabited-or-empty A = type-trunc-Prop A + is-empty A
-```
-
-### Merely decidable types
-
-A type `A` is said to be
-{{#concept "merely decidable" Agda=is-merely-decidable}} if it comes equipped
-with an element of `║ is-decidable A ║₋₁`, or equivalently, the
-[disjunction](foundation.disjunction.md) `A ∨ ¬ A` holds.
-
-```agda
-is-merely-decidable-Prop :
- {l : Level} → UU l → Prop l
-is-merely-decidable-Prop A = trunc-Prop (is-decidable A)
-
-is-merely-decidable : {l : Level} → UU l → UU l
-is-merely-decidable A = type-trunc-Prop (is-decidable A)
```
## Examples
@@ -112,7 +88,7 @@ is-decidable-coproduct (inr na) (inr nb) = inr (rec-coproduct na nb)
is-decidable-product :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
is-decidable A → is-decidable B → is-decidable (A × B)
-is-decidable-product (inl a) (inl b) = inl (pair a b)
+is-decidable-product (inl a) (inl b) = inl (a , b)
is-decidable-product (inl a) (inr g) = inr (g ∘ pr2)
is-decidable-product (inr f) (inl b) = inr (f ∘ pr1)
is-decidable-product (inr f) (inr g) = inr (f ∘ pr1)
@@ -120,22 +96,21 @@ is-decidable-product (inr f) (inr g) = inr (f ∘ pr1)
is-decidable-product' :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
is-decidable A → (A → is-decidable B) → is-decidable (A × B)
-is-decidable-product' (inl a) d with d a
-... | inl b = inl (pair a b)
-... | inr nb = inr (nb ∘ pr2)
+is-decidable-product' (inl a) d =
+ rec-coproduct (λ b → inl (a , b)) (λ nb → inr (nb ∘ pr2)) (d a)
is-decidable-product' (inr na) d = inr (na ∘ pr1)
is-decidable-left-factor :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
is-decidable (A × B) → B → is-decidable A
-is-decidable-left-factor (inl (pair x y)) b = inl x
-is-decidable-left-factor (inr f) b = inr (λ a → f (pair a b))
+is-decidable-left-factor (inl (x , y)) b = inl x
+is-decidable-left-factor (inr f) b = inr (λ a → f (a , b))
is-decidable-right-factor :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
is-decidable (A × B) → A → is-decidable B
-is-decidable-right-factor (inl (pair x y)) a = inl y
-is-decidable-right-factor (inr f) a = inr (λ b → f (pair a b))
+is-decidable-right-factor (inl (x , y)) a = inl y
+is-decidable-right-factor (inr f) a = inr (λ b → f (a , b))
```
### Function types of decidable types are decidable
@@ -144,16 +119,15 @@ is-decidable-right-factor (inr f) a = inr (λ b → f (pair a b))
is-decidable-function-type :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
is-decidable A → is-decidable B → is-decidable (A → B)
-is-decidable-function-type (inl a) (inl b) = inl (λ x → b)
-is-decidable-function-type (inl a) (inr g) = inr (λ h → g (h a))
+is-decidable-function-type (inl a) (inl b) = inl (λ _ → b)
+is-decidable-function-type (inl a) (inr nb) = inr (map-neg (ev a) nb)
is-decidable-function-type (inr f) _ = inl (ex-falso ∘ f)
is-decidable-function-type' :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
is-decidable A → (A → is-decidable B) → is-decidable (A → B)
-is-decidable-function-type' (inl a) d with d a
-... | inl b = inl (λ x → b)
-... | inr nb = inr (λ f → nb (f a))
+is-decidable-function-type' (inl a) d =
+ rec-coproduct (λ b → inl (λ _ → b)) (λ nb → inr (map-neg (ev a) nb)) (d a)
is-decidable-function-type' (inr na) d = inl (ex-falso ∘ na)
```
@@ -165,6 +139,14 @@ is-decidable-neg :
is-decidable-neg d = is-decidable-function-type d is-decidable-empty
```
+### The double negation of a decidable type is decidable
+
+```agda
+is-decidable-double-negation :
+ {l : Level} {A : UU l} → is-decidable A → is-decidable (¬¬ A)
+is-decidable-double-negation d = is-decidable-neg (is-decidable-neg d)
+```
+
### Decidable types are closed under coinhabited types
```agda
@@ -279,38 +261,28 @@ See also
### Decidable types have ε-operators
```agda
-elim-trunc-Prop-is-decidable :
+ε-operator-is-decidable :
{l : Level} {A : UU l} → is-decidable A → ε-operator-Hilbert A
-elim-trunc-Prop-is-decidable (inl a) x = a
-elim-trunc-Prop-is-decidable (inr f) x =
+ε-operator-is-decidable (inl a) x = a
+ε-operator-is-decidable (inr f) x =
ex-falso (apply-universal-property-trunc-Prop x empty-Prop f)
```
### `is-decidable` is an idempotent operation
```agda
-idempotent-is-decidable :
- {l : Level} (P : UU l) → is-decidable (is-decidable P) → is-decidable P
-idempotent-is-decidable P (inl (inl p)) = inl p
-idempotent-is-decidable P (inl (inr np)) = inr np
-idempotent-is-decidable P (inr np) = inr (λ p → np (inl p))
-```
+module _
+ {l : Level} {P : UU l}
+ where
-### Being inhabited or empty is a proposition
+ map-idempotent-is-decidable : is-decidable P → is-decidable (is-decidable P)
+ map-idempotent-is-decidable = inl
-```agda
-abstract
- is-property-is-inhabited-or-empty :
- {l1 : Level} (A : UU l1) → is-prop (is-inhabited-or-empty A)
- is-property-is-inhabited-or-empty A =
- is-prop-coproduct
- ( λ t → apply-universal-property-trunc-Prop t empty-Prop)
- ( is-prop-type-trunc-Prop)
- ( is-prop-neg)
-
-is-inhabited-or-empty-Prop : {l1 : Level} → UU l1 → Prop l1
-pr1 (is-inhabited-or-empty-Prop A) = is-inhabited-or-empty A
-pr2 (is-inhabited-or-empty-Prop A) = is-property-is-inhabited-or-empty A
+ map-inv-idempotent-is-decidable :
+ is-decidable (is-decidable P) → is-decidable P
+ map-inv-idempotent-is-decidable (inl (inl p)) = inl p
+ map-inv-idempotent-is-decidable (inl (inr np)) = inr np
+ map-inv-idempotent-is-decidable (inr np) = inr (λ p → np (inl p))
```
### Any inhabited type is a fixed point for `is-decidable`
@@ -322,60 +294,32 @@ is-fixed-point-is-decidable-is-inhabited {l} {X} t =
right-unit-law-coproduct-is-empty X (¬ X) (is-nonempty-is-inhabited t)
```
-### Raising universe level conserves decidability
+### The dependent sum of a family of decidable propositions over a decidable base with double negation dense equality is decidable
```agda
-module _
- (l : Level) {l1 : Level} (A : UU l1)
- where
-
- is-decidable-raise : is-decidable A → is-decidable (raise l A)
- is-decidable-raise = is-decidable-equiv' (compute-raise l A)
+is-decidable-Σ-has-double-negation-dense-equality-base :
+ {l1 l2 : Level} {P : UU l1} {Q : P → UU l2} →
+ has-double-negation-dense-equality P →
+ is-decidable P →
+ ((x : P) → is-decidable (Q x)) → is-decidable (Σ P Q)
+is-decidable-Σ-has-double-negation-dense-equality-base {Q = Q} hP (inl p) dQ =
+ map-coproduct
+ ( pair p)
+ ( λ nq pq → hP (pr1 pq) p (λ r → nq (tr Q r (pr2 pq))))
+ ( dQ p)
+is-decidable-Σ-has-double-negation-dense-equality-base hP (inr np) _ =
+ inr (map-neg pr1 np)
```
-### Decidable types are inhabited or empty
-
-```agda
-is-inhabited-or-empty-is-decidable :
- {l : Level} {A : UU l} → is-decidable A → is-inhabited-or-empty A
-is-inhabited-or-empty-is-decidable (inl x) = inl (unit-trunc-Prop x)
-is-inhabited-or-empty-is-decidable (inr y) = inr y
-```
-
-### Decidable types are merely decidable
-
-```agda
-is-merely-decidable-is-decidable :
- {l : Level} {A : UU l} → is-decidable A → is-merely-decidable A
-is-merely-decidable-is-decidable = unit-trunc-Prop
-```
-
-### Types are inhabited or empty if and only if they are merely decidable
+### Raising universe level conserves decidability
```agda
module _
- {l : Level} {A : UU l}
+ (l : Level) {l1 : Level} (A : UU l1)
where
- is-inhabited-or-empty-is-merely-decidable :
- is-merely-decidable A → is-inhabited-or-empty A
- is-inhabited-or-empty-is-merely-decidable =
- rec-trunc-Prop
- ( is-inhabited-or-empty-Prop A)
- ( is-inhabited-or-empty-is-decidable)
-
- is-merely-decidable-is-inhabited-or-empty :
- is-inhabited-or-empty A → is-merely-decidable A
- is-merely-decidable-is-inhabited-or-empty (inl |x|) =
- rec-trunc-Prop (is-merely-decidable-Prop A) (unit-trunc-Prop ∘ inl) |x|
- is-merely-decidable-is-inhabited-or-empty (inr y) =
- unit-trunc-Prop (inr y)
-
- iff-is-inhabited-or-empty-is-merely-decidable :
- is-merely-decidable A ↔ is-inhabited-or-empty A
- iff-is-inhabited-or-empty-is-merely-decidable =
- ( is-inhabited-or-empty-is-merely-decidable ,
- is-merely-decidable-is-inhabited-or-empty)
+ is-decidable-raise : is-decidable A → is-decidable (raise l A)
+ is-decidable-raise = is-decidable-equiv' (compute-raise l A)
```
## See also
diff --git a/src/foundation/dependent-function-types-with-apartness-relations.lagda.md b/src/foundation/dependent-function-types-with-apartness-relations.lagda.md
new file mode 100644
index 0000000000..63d7c55ccd
--- /dev/null
+++ b/src/foundation/dependent-function-types-with-apartness-relations.lagda.md
@@ -0,0 +1,212 @@
+# Apartness relations on dependent function types
+
+```agda
+module foundation.dependent-function-types-with-apartness-relations where
+```
+
+Imports
+
+```agda
+open import foundation.apartness-relations
+open import foundation.binary-relations
+open import foundation.dependent-pair-types
+open import foundation.disjunction
+open import foundation.existential-quantification
+open import foundation.function-extensionality
+open import foundation.function-types
+open import foundation.propositional-truncations
+open import foundation.tight-apartness-relations
+open import foundation.universe-levels
+
+open import foundation-core.coproduct-types
+open import foundation-core.empty-types
+open import foundation-core.propositions
+```
+
+
+
+## Idea
+
+Given a family `Y` of types with
+[apartness relations](foundation.apartness-relations.md) over `X`, then the
+[dependent function type](foundation.dependent-function-types.md) `Π X Y` again
+has an apartness relation. Two dependent functions `f` and `g` are **apart** in
+`Π X Y` if there [exists](foundation.existential-quantification.md) an `x : X`
+such that `f x` is apart from `g x` in `Y x`. If the apartness relations on `Y`
+are [tight](foundation.tight-apartness-relations.md) then so is the apartness
+relation on `Π X Y`.
+
+## Properties
+
+### Apartness on the type of dependent functions into a family of types with an apartness relation
+
+```agda
+module _
+ {l1 l2 l3 : Level} (X : UU l1) (Y : X → Type-With-Apartness l2 l3)
+ where
+
+ rel-apart-Π-Type-With-Apartness :
+ Relation-Prop (l1 ⊔ l3) ((x : X) → type-Type-With-Apartness (Y x))
+ rel-apart-Π-Type-With-Apartness f g =
+ ∃ X (λ x → rel-apart-Type-With-Apartness (Y x) (f x) (g x))
+
+ apart-Π-Type-With-Apartness :
+ Relation (l1 ⊔ l3) ((x : X) → type-Type-With-Apartness (Y x))
+ apart-Π-Type-With-Apartness f g =
+ type-Prop (rel-apart-Π-Type-With-Apartness f g)
+
+ is-prop-apart-Π-Type-With-Apartness :
+ (f g : (x : X) → type-Type-With-Apartness (Y x)) →
+ is-prop (apart-Π-Type-With-Apartness f g)
+ is-prop-apart-Π-Type-With-Apartness f g =
+ is-prop-type-Prop (rel-apart-Π-Type-With-Apartness f g)
+```
+
+```agda
+module _
+ {l1 l2 l3 : Level} (X : UU l1) (Y : X → Type-With-Apartness l2 l3)
+ where
+
+ is-antireflexive-apart-Π-Type-With-Apartness :
+ is-antireflexive (rel-apart-Π-Type-With-Apartness X Y)
+ is-antireflexive-apart-Π-Type-With-Apartness f H =
+ apply-universal-property-trunc-Prop H
+ ( empty-Prop)
+ ( λ (x , a) → antirefl-apart-Type-With-Apartness (Y x) (f x) a)
+
+ is-symmetric-apart-Π-Type-With-Apartness :
+ is-symmetric (apart-Π-Type-With-Apartness X Y)
+ is-symmetric-apart-Π-Type-With-Apartness f g H =
+ apply-universal-property-trunc-Prop H
+ ( rel-apart-Π-Type-With-Apartness X Y g f)
+ ( λ (x , a) →
+ unit-trunc-Prop
+ ( x , symmetric-apart-Type-With-Apartness (Y x) (f x) (g x) a))
+
+ abstract
+ is-cotransitive-apart-Π-Type-With-Apartness :
+ is-cotransitive (rel-apart-Π-Type-With-Apartness X Y)
+ is-cotransitive-apart-Π-Type-With-Apartness f g h H =
+ apply-universal-property-trunc-Prop H
+ ( disjunction-Prop
+ ( rel-apart-Π-Type-With-Apartness X Y f h)
+ ( rel-apart-Π-Type-With-Apartness X Y g h))
+ ( λ (x , a) →
+ apply-universal-property-trunc-Prop
+ ( cotransitive-apart-Type-With-Apartness (Y x) (f x) (g x) (h x) a)
+ ( disjunction-Prop
+ ( rel-apart-Π-Type-With-Apartness X Y f h)
+ ( rel-apart-Π-Type-With-Apartness X Y g h))
+ ( λ where
+ ( inl b) → inl-disjunction (intro-exists x b)
+ ( inr b) → inr-disjunction (intro-exists x b)))
+
+ is-apartness-relation-apart-Π-Type-With-Apartness :
+ is-apartness-relation (rel-apart-Π-Type-With-Apartness X Y)
+ is-apartness-relation-apart-Π-Type-With-Apartness =
+ is-antireflexive-apart-Π-Type-With-Apartness ,
+ is-symmetric-apart-Π-Type-With-Apartness ,
+ is-cotransitive-apart-Π-Type-With-Apartness
+
+ apartness-relation-Π-Type-With-Apartness :
+ Apartness-Relation (l1 ⊔ l3) ((x : X) → type-Type-With-Apartness (Y x))
+ apartness-relation-Π-Type-With-Apartness =
+ rel-apart-Π-Type-With-Apartness X Y ,
+ is-apartness-relation-apart-Π-Type-With-Apartness
+
+ Π-Type-With-Apartness : Type-With-Apartness (l1 ⊔ l2) (l1 ⊔ l3)
+ Π-Type-With-Apartness =
+ ((x : X) → type-Type-With-Apartness (Y x)) ,
+ rel-apart-Π-Type-With-Apartness X Y ,
+ is-antireflexive-apart-Π-Type-With-Apartness ,
+ is-symmetric-apart-Π-Type-With-Apartness ,
+ is-cotransitive-apart-Π-Type-With-Apartness
+```
+
+### Tight apartness on the type of dependent functions into a family of types with tight apartness
+
+```agda
+module _
+ {l1 l2 l3 : Level} (X : UU l1) (Y : X → Type-With-Tight-Apartness l2 l3)
+ where
+
+ rel-apart-Π-Type-With-Tight-Apartness :
+ Relation-Prop (l1 ⊔ l3) ((x : X) → type-Type-With-Tight-Apartness (Y x))
+ rel-apart-Π-Type-With-Tight-Apartness =
+ rel-apart-Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y)
+
+ apart-Π-Type-With-Tight-Apartness :
+ Relation (l1 ⊔ l3) ((x : X) → type-Type-With-Tight-Apartness (Y x))
+ apart-Π-Type-With-Tight-Apartness =
+ apart-Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y)
+
+ is-prop-apart-Π-Type-With-Tight-Apartness :
+ (f g : (x : X) → type-Type-With-Tight-Apartness (Y x)) →
+ is-prop (apart-Π-Type-With-Tight-Apartness f g)
+ is-prop-apart-Π-Type-With-Tight-Apartness =
+ is-prop-apart-Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y)
+
+ is-antireflexive-apart-Π-Type-With-Tight-Apartness :
+ is-antireflexive rel-apart-Π-Type-With-Tight-Apartness
+ is-antireflexive-apart-Π-Type-With-Tight-Apartness =
+ is-antireflexive-apart-Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y)
+
+ is-symmetric-apart-Π-Type-With-Tight-Apartness :
+ is-symmetric apart-Π-Type-With-Tight-Apartness
+ is-symmetric-apart-Π-Type-With-Tight-Apartness =
+ is-symmetric-apart-Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y)
+
+ is-cotransitive-apart-Π-Type-With-Tight-Apartness :
+ is-cotransitive rel-apart-Π-Type-With-Tight-Apartness
+ is-cotransitive-apart-Π-Type-With-Tight-Apartness =
+ is-cotransitive-apart-Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y)
+
+ is-apartness-relation-apart-Π-Type-With-Tight-Apartness :
+ is-apartness-relation rel-apart-Π-Type-With-Tight-Apartness
+ is-apartness-relation-apart-Π-Type-With-Tight-Apartness =
+ is-apartness-relation-apart-Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y)
+
+ apartness-relation-Π-Type-With-Tight-Apartness :
+ Apartness-Relation
+ ( l1 ⊔ l3)
+ ( (x : X) → type-Type-With-Tight-Apartness (Y x))
+ apartness-relation-Π-Type-With-Tight-Apartness =
+ apartness-relation-Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y)
+
+ is-tight-apart-Π-Type-With-Tight-Apartness :
+ is-tight rel-apart-Π-Type-With-Tight-Apartness
+ is-tight-apart-Π-Type-With-Tight-Apartness f g H =
+ eq-htpy
+ ( λ x →
+ is-tight-apart-Type-With-Tight-Apartness
+ ( Y x)
+ ( f x)
+ ( g x)
+ ( λ u → H (unit-trunc-Prop (x , u))))
+
+ tight-apartness-relation-Π-Type-With-Tight-Apartness :
+ Tight-Apartness-Relation (l1 ⊔ l3)
+ ( (x : X) → type-Type-With-Tight-Apartness (Y x))
+ tight-apartness-relation-Π-Type-With-Tight-Apartness =
+ apartness-relation-Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y) ,
+ is-tight-apart-Π-Type-With-Tight-Apartness
+
+ Π-Type-With-Tight-Apartness : Type-With-Tight-Apartness (l1 ⊔ l2) (l1 ⊔ l3)
+ Π-Type-With-Tight-Apartness =
+ Π-Type-With-Apartness X
+ ( type-with-apartness-Type-With-Tight-Apartness ∘ Y) ,
+ is-tight-apart-Π-Type-With-Tight-Apartness
+```
+
+## See also
+
+- [Function types with apartness relations](foundation.function-types-with-apartness-relations.md)
diff --git a/src/foundation/disjoint-subtypes.lagda.md b/src/foundation/disjoint-subtypes.lagda.md
index e21739bbd5..77b37edb06 100644
--- a/src/foundation/disjoint-subtypes.lagda.md
+++ b/src/foundation/disjoint-subtypes.lagda.md
@@ -53,3 +53,7 @@ module _
disjoint-subtype B B → is-empty (type-subtype B)
is-empty-disjoint-subtype-self H (b , b∈B) = H b (b∈B , b∈B)
```
+
+## See also
+
+- [Exclusive sums](foundation.exclusive-sum.md)
diff --git a/src/foundation/disjunction.lagda.md b/src/foundation/disjunction.lagda.md
index 21a764be49..136e6d62f9 100644
--- a/src/foundation/disjunction.lagda.md
+++ b/src/foundation/disjunction.lagda.md
@@ -22,6 +22,8 @@ open import foundation-core.empty-types
open import foundation-core.equivalences
open import foundation-core.function-types
open import foundation-core.propositions
+
+open import logic.propositionally-decidable-types
```
@@ -308,7 +310,6 @@ module _
is-decidable A → is-decidable B → is-decidable (disjunction-type A B)
is-decidable-disjunction is-decidable-A is-decidable-B =
is-decidable-trunc-Prop-is-merely-decidable
- ( A + B)
( unit-trunc-Prop (is-decidable-coproduct is-decidable-A is-decidable-B))
module _
diff --git a/src/foundation/double-negation-dense-equality-maps.lagda.md b/src/foundation/double-negation-dense-equality-maps.lagda.md
new file mode 100644
index 0000000000..86b0e049c6
--- /dev/null
+++ b/src/foundation/double-negation-dense-equality-maps.lagda.md
@@ -0,0 +1,35 @@
+# Maps with double negation dense equality
+
+```agda
+module foundation.double-negation-dense-equality-maps where
+```
+
+Imports
+
+```agda
+open import foundation.irrefutable-equality
+open import foundation.universe-levels
+
+open import foundation-core.fibers-of-maps
+```
+
+
+
+## Idea
+
+A map `f : A → B` is said to have
+{{#concept "double negation dense equality" Disambiguation="map of types" Agda=has-double-negation-dense-equality-map}}
+if its [fibers](foundation-core.fibers-of-maps.md) have
+[double negation dense equality](foundation.irrefutable-equality.md). I.e., if
+for every `y : B` and every pair `p q : fiber f y` it is
+[irrefutable](foundation.irrefutable-propositions.md) that `p` equals `q`. In
+other words, `¬¬ (p = q)` holds.
+
+## Definitions
+
+```agda
+has-double-negation-dense-equality-map :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} → (A → B) → UU (l1 ⊔ l2)
+has-double-negation-dense-equality-map {B = B} f =
+ (y : B) → has-double-negation-dense-equality (fiber f y)
+```
diff --git a/src/foundation/double-negation-images.lagda.md b/src/foundation/double-negation-images.lagda.md
new file mode 100644
index 0000000000..c6c10ecf79
--- /dev/null
+++ b/src/foundation/double-negation-images.lagda.md
@@ -0,0 +1,299 @@
+# The double negation image of a map
+
+```agda
+module foundation.double-negation-images where
+```
+
+Imports
+
+```agda
+open import foundation.action-on-identifications-functions
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.embeddings
+open import foundation.fundamental-theorem-of-identity-types
+open import foundation.hilbert-epsilon-operators-maps
+open import foundation.slice
+open import foundation.split-surjective-maps
+open import foundation.subtype-identity-principle
+open import foundation.universe-levels
+
+open import foundation-core.1-types
+open import foundation-core.commuting-triangles-of-maps
+open import foundation-core.equivalences
+open import foundation-core.fibers-of-maps
+open import foundation-core.identity-types
+open import foundation-core.injective-maps
+open import foundation-core.propositions
+open import foundation-core.sets
+open import foundation-core.subtypes
+open import foundation-core.torsorial-type-families
+open import foundation-core.truncated-types
+open import foundation-core.truncation-levels
+
+open import logic.double-negation-dense-maps
+open import logic.double-negation-eliminating-maps
+open import logic.double-negation-stable-embeddings
+```
+
+
+
+## Idea
+
+The
+{{#concept "double negation image" Disambiguation="of a map" Agda=double-negation-im}}
+of `f : A → B` is the essentially unique type that factorizes `f` as a
+[double negation dense map](logic.double-negation-dense-maps.md) followed by a
+[double negation stable embedding](logic.double-negation-stable-embeddings.md).
+
+## Definitions
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A → X)
+ where
+
+ subtype-double-negation-im : subtype (l1 ⊔ l2) X
+ subtype-double-negation-im x = double-negation-type-Prop (fiber f x)
+
+ is-in-double-negation-im : X → UU (l1 ⊔ l2)
+ is-in-double-negation-im = is-in-subtype subtype-double-negation-im
+
+ double-negation-im : UU (l1 ⊔ l2)
+ double-negation-im = type-subtype subtype-double-negation-im
+
+ inclusion-double-negation-im : double-negation-im → X
+ inclusion-double-negation-im = inclusion-subtype subtype-double-negation-im
+
+ map-unit-double-negation-im : A → double-negation-im
+ map-unit-double-negation-im a = (f a , intro-double-negation (a , refl))
+
+ triangle-unit-double-negation-im :
+ coherence-triangle-maps
+ ( f)
+ ( inclusion-double-negation-im)
+ ( map-unit-double-negation-im)
+ triangle-unit-double-negation-im a = refl
+
+ unit-double-negation-im : hom-slice f inclusion-double-negation-im
+ pr1 unit-double-negation-im = map-unit-double-negation-im
+ pr2 unit-double-negation-im = triangle-unit-double-negation-im
+```
+
+## Properties
+
+### We characterize the identity type of `double-negation-im f`
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A → X)
+ where
+
+ Eq-double-negation-im : double-negation-im f → double-negation-im f → UU l1
+ Eq-double-negation-im x y = (pr1 x = pr1 y)
+
+ refl-Eq-double-negation-im :
+ (x : double-negation-im f) → Eq-double-negation-im x x
+ refl-Eq-double-negation-im x = refl
+
+ Eq-eq-double-negation-im :
+ (x y : double-negation-im f) → x = y → Eq-double-negation-im x y
+ Eq-eq-double-negation-im x .x refl = refl-Eq-double-negation-im x
+
+ abstract
+ is-torsorial-Eq-double-negation-im :
+ (x : double-negation-im f) → is-torsorial (Eq-double-negation-im x)
+ is-torsorial-Eq-double-negation-im x =
+ is-torsorial-Eq-subtype
+ ( is-torsorial-Id (pr1 x))
+ ( is-prop-is-in-subtype (subtype-double-negation-im f))
+ ( pr1 x)
+ ( refl)
+ ( pr2 x)
+
+ abstract
+ is-equiv-Eq-eq-double-negation-im :
+ (x y : double-negation-im f) → is-equiv (Eq-eq-double-negation-im x y)
+ is-equiv-Eq-eq-double-negation-im x =
+ fundamental-theorem-id
+ ( is-torsorial-Eq-double-negation-im x)
+ ( Eq-eq-double-negation-im x)
+
+ equiv-Eq-eq-double-negation-im :
+ (x y : double-negation-im f) → (x = y) ≃ Eq-double-negation-im x y
+ equiv-Eq-eq-double-negation-im x y =
+ ( Eq-eq-double-negation-im x y , is-equiv-Eq-eq-double-negation-im x y)
+
+ eq-Eq-double-negation-im :
+ (x y : double-negation-im f) → Eq-double-negation-im x y → x = y
+ eq-Eq-double-negation-im x y =
+ map-inv-equiv (equiv-Eq-eq-double-negation-im x y)
+```
+
+### The unit map of the double negation image is double negation dense
+
+```agda
+abstract
+ is-double-negation-dense-unit-double-negation-im :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →
+ is-double-negation-dense-map (map-unit-double-negation-im f)
+ is-double-negation-dense-unit-double-negation-im f (y , nnq) np =
+ nnq
+ ( λ p →
+ np
+ ( pr1 p ,
+ eq-Eq-double-negation-im f
+ ( map-unit-double-negation-im f (pr1 p)) (y , nnq) (pr2 p)))
+```
+
+### The double negation image inclusion is a double negation stable embedding
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A → X)
+ where
+
+ is-emb-inclusion-double-negation-im :
+ is-emb (inclusion-double-negation-im f)
+ is-emb-inclusion-double-negation-im =
+ is-emb-inclusion-subtype (subtype-double-negation-im f)
+
+ emb-double-negation-im : double-negation-im f ↪ X
+ emb-double-negation-im =
+ ( inclusion-double-negation-im f , is-emb-inclusion-double-negation-im)
+
+ is-injective-inclusion-double-negation-im :
+ is-injective (inclusion-double-negation-im f)
+ is-injective-inclusion-double-negation-im =
+ is-injective-is-emb is-emb-inclusion-double-negation-im
+
+ is-double-negation-eliminating-map-inclusion-double-negation-im :
+ is-double-negation-eliminating-map (inclusion-double-negation-im f)
+ is-double-negation-eliminating-map-inclusion-double-negation-im x nnip =
+ ( ( x ,
+ ( λ np →
+ nnip
+ ( λ ip →
+ is-double-negation-dense-unit-double-negation-im f
+ ( pr1 ip)
+ ( λ ηq →
+ np
+ ( pr1 ηq ,
+ ap (inclusion-double-negation-im f) (pr2 ηq) ∙ pr2 ip))))) ,
+ ( refl))
+
+ double-negation-eliminating-map-inclusion-double-negation-im :
+ double-negation-im f →¬¬ X
+ double-negation-eliminating-map-inclusion-double-negation-im =
+ ( inclusion-double-negation-im f ,
+ is-double-negation-eliminating-map-inclusion-double-negation-im)
+
+ is-double-negation-stable-emb-inclusion-double-negation-im :
+ is-double-negation-stable-emb (inclusion-double-negation-im f)
+ is-double-negation-stable-emb-inclusion-double-negation-im =
+ ( is-emb-inclusion-double-negation-im ,
+ is-double-negation-eliminating-map-inclusion-double-negation-im)
+
+ double-negation-stable-emb-double-negation-im : double-negation-im f ↪¬¬ X
+ double-negation-stable-emb-double-negation-im =
+ ( inclusion-double-negation-im f ,
+ is-double-negation-stable-emb-inclusion-double-negation-im)
+
+ ε-operator-map-inclusion-double-negation-im :
+ ε-operator-map (inclusion-double-negation-im f)
+ ε-operator-map-inclusion-double-negation-im =
+ ε-operator-double-negation-eliminating-map
+ ( double-negation-eliminating-map-inclusion-double-negation-im)
+```
+
+### The double negation image of a map into a truncated type is truncated
+
+```agda
+abstract
+ is-trunc-double-negation-im :
+ {l1 l2 : Level} (k : 𝕋) {X : UU l1} {A : UU l2} (f : A → X) →
+ is-trunc (succ-𝕋 k) X → is-trunc (succ-𝕋 k) (double-negation-im f)
+ is-trunc-double-negation-im k f = is-trunc-emb k (emb-double-negation-im f)
+
+double-negation-im-Truncated-Type :
+ {l1 l2 : Level} (k : 𝕋) (X : Truncated-Type l1 (succ-𝕋 k)) {A : UU l2}
+ (f : A → type-Truncated-Type X) → Truncated-Type (l1 ⊔ l2) (succ-𝕋 k)
+double-negation-im-Truncated-Type k X f =
+ ( double-negation-im f ,
+ is-trunc-double-negation-im k f (is-trunc-type-Truncated-Type X))
+```
+
+### The double negation image of a map into a proposition is a proposition
+
+```agda
+abstract
+ is-prop-double-negation-im :
+ {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A → X) →
+ is-prop X → is-prop (double-negation-im f)
+ is-prop-double-negation-im = is-trunc-double-negation-im neg-two-𝕋
+
+double-negation-im-Prop :
+ {l1 l2 : Level} (X : Prop l1) {A : UU l2}
+ (f : A → type-Prop X) → Prop (l1 ⊔ l2)
+double-negation-im-Prop = double-negation-im-Truncated-Type neg-two-𝕋
+```
+
+### The double negation image of a map into a set is a set
+
+```agda
+abstract
+ is-set-double-negation-im :
+ {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A → X) →
+ is-set X → is-set (double-negation-im f)
+ is-set-double-negation-im = is-trunc-double-negation-im neg-one-𝕋
+
+double-negation-im-Set :
+ {l1 l2 : Level} (X : Set l1) {A : UU l2}
+ (f : A → type-Set X) → Set (l1 ⊔ l2)
+double-negation-im-Set = double-negation-im-Truncated-Type (neg-one-𝕋)
+```
+
+### The double negation image of a map into a 1-type is a 1-type
+
+```agda
+abstract
+ is-1-type-double-negation-im :
+ {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A → X) →
+ is-1-type X → is-1-type (double-negation-im f)
+ is-1-type-double-negation-im = is-trunc-double-negation-im zero-𝕋
+
+double-negation-im-1-Type :
+ {l1 l2 : Level} (X : 1-Type l1) {A : UU l2}
+ (f : A → type-1-Type X) → 1-Type (l1 ⊔ l2)
+double-negation-im-1-Type = double-negation-im-Truncated-Type zero-𝕋
+```
+
+### Injective double negation eliminating maps are embeddings
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {A : UU l2} {f : A → X}
+ where
+
+ is-emb-is-injective-is-double-negation-eliminating-map :
+ is-double-negation-eliminating-map f → is-injective f → is-emb f
+ is-emb-is-injective-is-double-negation-eliminating-map K H =
+ is-emb-comp
+ ( inclusion-double-negation-im f)
+ ( map-unit-double-negation-im f)
+ ( is-emb-inclusion-double-negation-im f)
+ ( is-emb-is-equiv
+ ( is-equiv-is-split-surjective-is-injective
+ ( map-unit-double-negation-im f)
+ ( is-injective-right-factor
+ ( inclusion-double-negation-im f)
+ ( map-unit-double-negation-im f) H)
+ ( λ x →
+ pr1 (K (pr1 x) (pr2 x)) ,
+ is-injective-inclusion-double-negation-im f
+ ( pr2 (K (pr1 x) (pr2 x))))))
+```
+
+## See also
+
+- [The double negation modality](foundation.double-negation-modality.md)
diff --git a/src/foundation/double-negation-stable-equality.lagda.md b/src/foundation/double-negation-stable-equality.lagda.md
index 8917c7da41..2deed88d8f 100644
--- a/src/foundation/double-negation-stable-equality.lagda.md
+++ b/src/foundation/double-negation-stable-equality.lagda.md
@@ -2,35 +2,22 @@
```agda
module foundation.double-negation-stable-equality where
+
+open import foundation-core.double-negation-stable-equality public
```
Imports
```agda
-open import foundation.action-on-identifications-dependent-functions
-open import foundation.action-on-identifications-functions
-open import foundation.coproduct-types
open import foundation.dependent-pair-types
open import foundation.double-negation
-open import foundation.equality-cartesian-product-types
-open import foundation.equality-dependent-pair-types
-open import foundation.equivalences
-open import foundation.injective-maps
-open import foundation.negated-equality
-open import foundation.negation
-open import foundation.sets
-open import foundation.transport-along-identifications
-open import foundation.unit-type
+open import foundation.identity-types
open import foundation.universe-levels
-open import foundation-core.cartesian-product-types
-open import foundation-core.empty-types
-open import foundation-core.identity-types
-open import foundation-core.propositions
-open import foundation-core.retractions
-open import foundation-core.retracts-of-types
+open import foundation-core.homotopies
-open import logic.double-negation-elimination
+open import logic.double-negation-dense-maps
+open import logic.double-negation-dense-subtypes
```
@@ -45,233 +32,80 @@ if `x = y` has
[fundamental theorem of identity types](foundation.fundamental-theorem-of-identity-types.md),
types with double negation stable equality are [sets](foundation-core.sets.md).
-## Definitions
-
-```agda
-has-based-double-negation-stable-equality : {l : Level} (A : UU l) → A → UU l
-has-based-double-negation-stable-equality A x =
- (y : A) → has-double-negation-elim (x = y)
-
-has-based-double-negation-stable-equality' : {l : Level} (A : UU l) → A → UU l
-has-based-double-negation-stable-equality' A x =
- (y : A) → has-double-negation-elim (y = x)
-
-has-double-negation-stable-equality : {l : Level} → UU l → UU l
-has-double-negation-stable-equality A =
- (x : A) → has-based-double-negation-stable-equality A x
-```
-
-## Examples
-
-### Propositions have double negation stable equality
-
-```agda
-abstract
- has-double-negation-stable-equality-is-prop :
- {l1 : Level} {A : UU l1} → is-prop A → has-double-negation-stable-equality A
- has-double-negation-stable-equality-is-prop H x y =
- double-negation-elim-is-contr (H x y)
-```
-
-### The empty type has double negation stable equality
-
-```agda
-has-double-negation-stable-equality-empty :
- has-double-negation-stable-equality empty
-has-double-negation-stable-equality-empty ()
-```
-
-### The unit type has double negation stable equality
-
-```agda
-has-double-negation-stable-equality-unit :
- has-double-negation-stable-equality unit
-has-double-negation-stable-equality-unit _ _ _ = refl
-```
-
## Properties
-### Types with double negation stable equality are sets
+### Homotopies of maps into types with double negation stable equality
+
+Given a double negation dense subtype `P ⊆ X` and two functions `f` and
+`g : X → Y` into a type `Y` with double negation stable equality. Then if `f`
+and `g` are homotopic on `P`, they are homotopic on all of `X`.
```agda
module _
- {l : Level} {A : UU l}
+ {l1 l2 l3 : Level} {X : UU l1} {Y : X → UU l2} {X' : UU l3} (i : X' ↠¬¬ X)
where
- is-prop-based-Id-has-based-double-negation-stable-equality :
- {x : A} →
- has-based-double-negation-stable-equality A x → (y : A) → is-prop (x = y)
- is-prop-based-Id-has-based-double-negation-stable-equality {x} =
- is-prop-based-Id-prop-in-based-id x
- ( λ y → ¬¬ (x = y))
- ( λ y → is-prop-neg)
- ( intro-double-negation refl)
-
- is-set-has-double-negation-stable-equality :
- has-double-negation-stable-equality A → is-set A
- is-set-has-double-negation-stable-equality H x =
- is-prop-based-Id-has-based-double-negation-stable-equality (H x)
-```
+ abstract
+ htpy-htpy-double-negation-dense-map' :
+ {f g : (x : X) → Y x}
+ (K :
+ (x : X') →
+ f (map-double-negation-dense-map i x) =
+ g (map-double-negation-dense-map i x)) →
+ (x : X) → ¬¬ (f x = g x)
+ htpy-htpy-double-negation-dense-map' {f} {g} K x =
+ map-double-negation
+ ( λ where (x' , refl) → K x')
+ ( is-double-negation-dense-map-double-negation-dense-map i x)
+
+ htpy-htpy-double-negation-dense-map :
+ (H : (x : X) → has-double-negation-stable-equality (Y x))
+ {f g : (x : X) → Y x}
+ (K :
+ (x : X') →
+ f (map-double-negation-dense-map i x) =
+ g (map-double-negation-dense-map i x)) →
+ f ~ g
+ htpy-htpy-double-negation-dense-map H {f} {g} K x =
+ H x (f x) (g x) (htpy-htpy-double-negation-dense-map' {f} {g} K x)
-### Types with double negation stable equality are closed under injections
-
-```agda
-abstract
- has-double-negation-stable-equality-injection :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- injection A B →
- has-double-negation-stable-equality B →
- has-double-negation-stable-equality A
- has-double-negation-stable-equality-injection (f , H) d x y =
- has-double-negation-elim-iff (ap f , H) (d (f x) (f y))
-```
-
-### Types with double negation stable equality are closed under retracts
-
-```agda
-abstract
- has-double-negation-stable-equality-retract-of :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- A retract-of B →
- has-double-negation-stable-equality B →
- has-double-negation-stable-equality A
- has-double-negation-stable-equality-retract-of (i , r , R) =
- has-double-negation-stable-equality-injection
- ( i , is-injective-has-retraction i r R)
-```
-
-### Types with double negation stable equality are closed under equivalences
-
-```agda
-abstract
- has-double-negation-stable-equality-equiv :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →
- has-double-negation-stable-equality B →
- has-double-negation-stable-equality A
- has-double-negation-stable-equality-equiv e =
- has-double-negation-stable-equality-retract-of (retract-equiv e)
-
-abstract
- has-double-negation-stable-equality-equiv' :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) →
- has-double-negation-stable-equality A →
- has-double-negation-stable-equality B
- has-double-negation-stable-equality-equiv' e =
- has-double-negation-stable-equality-retract-of (retract-inv-equiv e)
-```
-
-### Having double negation stable equality is a property
-
-```agda
-abstract
- is-prop-has-based-double-negation-stable-equality :
- {l1 : Level} {X : UU l1} (x : X) →
- is-prop (has-based-double-negation-stable-equality X x)
- is-prop-has-based-double-negation-stable-equality x =
- is-prop-has-element
- ( λ d →
- is-prop-Π
- ( λ y →
- is-prop-function-type
- ( is-prop-based-Id-has-based-double-negation-stable-equality d y)))
-
-abstract
- is-prop-has-double-negation-stable-equality :
- {l1 : Level} {X : UU l1} → is-prop (has-double-negation-stable-equality X)
- is-prop-has-double-negation-stable-equality =
- is-prop-Π is-prop-has-based-double-negation-stable-equality
-
-has-double-negation-stable-equality-Prop : {l1 : Level} → UU l1 → Prop l1
-has-double-negation-stable-equality-Prop X =
- ( has-double-negation-stable-equality X ,
- is-prop-has-double-negation-stable-equality)
-```
-
-### A product of types with double negation stable equality has double negation stable equality
-
-```agda
-has-double-negation-stable-equality-product :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- has-double-negation-stable-equality A →
- has-double-negation-stable-equality B →
- has-double-negation-stable-equality (A × B)
-has-double-negation-stable-equality-product d e x y p =
- eq-pair
- ( d (pr1 x) (pr1 y) (map-double-negation (ap pr1) p))
- ( e (pr2 x) (pr2 y) (map-double-negation (ap pr2) p))
-```
-
-### Double negation stability of equality of the factors of a cartesian product
-
-If `A × B` has double negation stable equality and `B` has an element, then `A`
-has double negation stable equality; and vice versa.
-
-```agda
-has-double-negation-stable-equality-left-factor :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- has-double-negation-stable-equality (A × B) →
- B →
- has-double-negation-stable-equality A
-has-double-negation-stable-equality-left-factor d b x y p =
- ap pr1 (d (x , b) (y , b) (map-double-negation (λ q → eq-pair q refl) p))
-
-has-double-negation-stable-equality-right-factor :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- has-double-negation-stable-equality (A × B) →
- A → has-double-negation-stable-equality B
-has-double-negation-stable-equality-right-factor d a x y p =
- ap pr2 (d (a , x) (a , y) (map-double-negation (eq-pair refl) p))
-```
-
-### If the total space has double negation stable equality, and `B` has a section, then the base type has double negation stable equality
+module _
+ {l1 l2 l3 : Level} {X : UU l1} {Y : X → UU l2}
+ (P : double-negation-dense-subtype l3 X)
+ (H : (x : X) → has-double-negation-stable-equality (Y x))
+ where
-```agda
-abstract
- has-double-negation-stable-equality-base-has-double-negation-stable-equality-Σ :
- {l1 l2 : Level} {A : UU l1} {B : A → UU l2} (b : (x : A) → B x) →
- has-double-negation-stable-equality (Σ A B) →
- has-double-negation-stable-equality A
- has-double-negation-stable-equality-base-has-double-negation-stable-equality-Σ
- b dΣ x y nnp =
- ap
- ( pr1)
- ( dΣ
- ( x , b x)
- ( y , b y)
- ( map-double-negation (λ p → eq-pair-Σ p (apd b p)) nnp))
+ htpy-htpy-on-double-negation-dense-subtype :
+ {f g : (x : X) → Y x}
+ (K :
+ (x : type-double-negation-dense-subtype P) →
+ f (inclusion-double-negation-dense-subtype P x) =
+ g (inclusion-double-negation-dense-subtype P x)) →
+ f ~ g
+ htpy-htpy-on-double-negation-dense-subtype =
+ htpy-htpy-double-negation-dense-map
+ ( double-negation-dense-inclusion-double-negation-dense-subtype P)
+ ( H)
```
-### If `A` and `B` have double negation stable equality, then so does their coproduct
+As a corollary, if `f` is constant on `P`, it is constant on all of `X`. This is
+Lemma 3.4 in {{#cite Esc13}}.
```agda
module _
- {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2}
+ (P : double-negation-dense-subtype l3 X)
+ (H : has-double-negation-stable-equality Y)
where
- has-double-negation-stable-equality-coproduct :
- has-double-negation-stable-equality A →
- has-double-negation-stable-equality B →
- has-double-negation-stable-equality (A + B)
- has-double-negation-stable-equality-coproduct dA dB (inl x) (inl y) =
- has-double-negation-elim-iff (is-injective-inl , ap inl) (dA x y)
- has-double-negation-stable-equality-coproduct dA dB (inl x) (inr y) p =
- ex-falso (p neq-inl-inr)
- has-double-negation-stable-equality-coproduct dA dB (inr x) (inl y) p =
- ex-falso (p neq-inr-inl)
- has-double-negation-stable-equality-coproduct dA dB (inr x) (inr y) =
- has-double-negation-elim-iff (is-injective-inr , ap inr) (dB x y)
-
- has-double-negation-stable-equality-left-summand :
- has-double-negation-stable-equality (A + B) →
- has-double-negation-stable-equality A
- has-double-negation-stable-equality-left-summand d x y =
- has-double-negation-elim-iff (ap inl , is-injective-inl) (d (inl x) (inl y))
-
- has-double-negation-stable-equality-right-summand :
- has-double-negation-stable-equality (A + B) →
- has-double-negation-stable-equality B
- has-double-negation-stable-equality-right-summand d x y =
- has-double-negation-elim-iff (ap inr , is-injective-inr) (d (inr x) (inr y))
+ htpy-const-htpy-const-on-double-negation-dense-subtype :
+ (f : X → Y) (y : Y)
+ (K :
+ (x : type-double-negation-dense-subtype P) →
+ f (inclusion-double-negation-dense-subtype P x) = y) →
+ (x : X) → f x = y
+ htpy-const-htpy-const-on-double-negation-dense-subtype f y =
+ htpy-htpy-on-double-negation-dense-subtype P (λ _ → H)
```
## See also
@@ -282,6 +116,10 @@ module _
equality has a tight, symmetric, antireflexive relation. However, this
relation need not be cotransitive.
+## References
+
+{{#bibliography}}
+
## External links
- [double negation stable equality](https://ncatlab.org/nlab/show/decidable+equality)
diff --git a/src/foundation/double-negation-stable-propositions.lagda.md b/src/foundation/double-negation-stable-propositions.lagda.md
index 0ba325bf24..b3486593b7 100644
--- a/src/foundation/double-negation-stable-propositions.lagda.md
+++ b/src/foundation/double-negation-stable-propositions.lagda.md
@@ -8,27 +8,20 @@ module foundation.double-negation-stable-propositions where
```agda
open import foundation.cartesian-product-types
-open import foundation.conjunction
-open import foundation.coproduct-types
open import foundation.decidable-propositions
open import foundation.decidable-types
open import foundation.dependent-pair-types
-open import foundation.disjunction
open import foundation.double-negation
open import foundation.embeddings
open import foundation.empty-types
open import foundation.equivalences
-open import foundation.existential-quantification
open import foundation.logical-equivalences
open import foundation.negation
open import foundation.propositional-extensionality
open import foundation.propositions
open import foundation.sets
open import foundation.subtypes
-open import foundation.transport-along-identifications
-open import foundation.type-arithmetic-dependent-pair-types
open import foundation.unit-type
-open import foundation.universal-quantification
open import foundation.universe-levels
open import foundation-core.contractible-types
@@ -283,6 +276,20 @@ neg-Double-Negation-Stable-Prop P =
neg-type-Double-Negation-Stable-Prop (type-Double-Negation-Stable-Prop P)
```
+### Double negations of types are double negation stable propositions
+
+```agda
+double-negation-type-Double-Negation-Stable-Prop :
+ {l : Level} → UU l → Double-Negation-Stable-Prop l
+double-negation-type-Double-Negation-Stable-Prop A =
+ neg-Double-Negation-Stable-Prop (neg-type-Double-Negation-Stable-Prop A)
+
+double-negation-Double-Negation-Stable-Prop :
+ {l : Level} → Double-Negation-Stable-Prop l → Double-Negation-Stable-Prop l
+double-negation-Double-Negation-Stable-Prop P =
+ neg-Double-Negation-Stable-Prop (neg-Double-Negation-Stable-Prop P)
+```
+
### Universal quantification over double negation stable propositions is double negation stable
```agda
@@ -292,7 +299,7 @@ is-double-negation-stable-prop-Π :
is-double-negation-stable-prop ((a : A) → B a)
is-double-negation-stable-prop-Π b =
( is-prop-Π (is-prop-type-is-double-negation-stable-prop ∘ b)) ,
- ( double-negation-elim-for-all
+ ( double-negation-elim-Π
( has-double-negation-elim-is-double-negation-stable-prop ∘ b))
Π-Double-Negation-Stable-Prop :
diff --git a/src/foundation/double-negation.lagda.md b/src/foundation/double-negation.lagda.md
index ee813f6384..5ecc842912 100644
--- a/src/foundation/double-negation.lagda.md
+++ b/src/foundation/double-negation.lagda.md
@@ -42,6 +42,9 @@ intro-double-negation p f = f p
map-double-negation :
{l1 l2 : Level} {P : UU l1} {Q : UU l2} → (P → Q) → ¬¬ P → ¬¬ Q
map-double-negation f = map-neg (map-neg f)
+
+elim-triple-negation : {l : Level} {P : UU l} → ¬¬¬ P → ¬ P
+elim-triple-negation = map-neg intro-double-negation
```
## Properties
@@ -94,23 +97,28 @@ double-negation-linearity-implication {P = P} {Q = Q} f =
### Maps into double negations extend along `intro-double-negation`
```agda
-double-negation-extend :
+extend-double-negation :
{l1 l2 : Level} {P : UU l1} {Q : UU l2} →
(P → ¬¬ Q) → (¬¬ P → ¬¬ Q)
-double-negation-extend {P = P} {Q = Q} f nnp nq = nnp (λ p → f p nq)
+extend-double-negation {P = P} {Q = Q} f nnp nq = nnp (λ p → f p nq)
```
### The double negation of a type is logically equivalent to the double negation of its propositional truncation
```agda
+abstract
+ intro-double-negation-type-trunc-Prop :
+ {l : Level} {A : UU l} → type-trunc-Prop A → ¬¬ A
+ intro-double-negation-type-trunc-Prop {A = A} =
+ map-universal-property-trunc-Prop
+ ( double-negation-type-Prop A)
+ ( intro-double-negation)
+
abstract
double-negation-double-negation-type-trunc-Prop :
- {l : Level} (A : UU l) → ¬¬ (type-trunc-Prop A) → ¬¬ A
- double-negation-double-negation-type-trunc-Prop A =
- double-negation-extend
- ( map-universal-property-trunc-Prop
- ( double-negation-type-Prop A)
- ( intro-double-negation))
+ {l : Level} {A : UU l} → ¬¬ (type-trunc-Prop A) → ¬¬ A
+ double-negation-double-negation-type-trunc-Prop =
+ extend-double-negation intro-double-negation-type-trunc-Prop
abstract
double-negation-type-trunc-Prop-double-negation :
diff --git a/src/foundation/full-subtypes.lagda.md b/src/foundation/full-subtypes.lagda.md
index 57a9714080..6392c181e5 100644
--- a/src/foundation/full-subtypes.lagda.md
+++ b/src/foundation/full-subtypes.lagda.md
@@ -36,7 +36,7 @@ module _
where
is-full-subtype-Prop : Prop (l1 ⊔ l2)
- is-full-subtype-Prop = Π-Prop A (λ x → P x)
+ is-full-subtype-Prop = Π-Prop A P
is-full-subtype : UU (l1 ⊔ l2)
is-full-subtype = type-Prop is-full-subtype-Prop
diff --git a/src/foundation/function-types-with-apartness-relations.lagda.md b/src/foundation/function-types-with-apartness-relations.lagda.md
new file mode 100644
index 0000000000..86dead90a3
--- /dev/null
+++ b/src/foundation/function-types-with-apartness-relations.lagda.md
@@ -0,0 +1,158 @@
+# Apartness relations on function types
+
+```agda
+module foundation.function-types-with-apartness-relations where
+```
+
+Imports
+
+```agda
+open import foundation.apartness-relations
+open import foundation.binary-relations
+open import foundation.dependent-function-types-with-apartness-relations
+open import foundation.tight-apartness-relations
+open import foundation.universe-levels
+
+open import foundation-core.propositions
+```
+
+
+
+## Idea
+
+Given a type `Y` with an [apartness relation](foundation.apartness-relations.md)
+and an arbitrary type `X`, then the
+[function type](foundation.function-types.md) `X → Y` again has an apartness
+relation. Two functions `f` and `g` are **apart** in `X → Y` if there
+[exists](foundation.existential-quantification.md) an `x : X` such that `f x` is
+apart from `g x` in `Y`. If the apartness relation on `Y` is
+[tight](foundation.tight-apartness-relations.md) then so is the apartness
+relation on `X → Y`.
+
+## Properties
+
+### Apartness on the type of functions into a type with an apartness relation
+
+```agda
+module _
+ {l1 l2 l3 : Level} (X : UU l1) (Y : Type-With-Apartness l2 l3)
+ where
+
+ rel-apart-function-into-Type-With-Apartness :
+ Relation-Prop (l1 ⊔ l3) (X → type-Type-With-Apartness Y)
+ rel-apart-function-into-Type-With-Apartness =
+ rel-apart-Π-Type-With-Apartness X (λ _ → Y)
+
+ apart-function-into-Type-With-Apartness :
+ Relation (l1 ⊔ l3) (X → type-Type-With-Apartness Y)
+ apart-function-into-Type-With-Apartness =
+ apart-Π-Type-With-Apartness X (λ _ → Y)
+
+ is-prop-apart-function-into-Type-With-Apartness :
+ (f g : X → type-Type-With-Apartness Y) →
+ is-prop (apart-function-into-Type-With-Apartness f g)
+ is-prop-apart-function-into-Type-With-Apartness =
+ is-prop-apart-Π-Type-With-Apartness X (λ _ → Y)
+```
+
+```agda
+module _
+ {l1 l2 l3 : Level} (X : UU l1) (Y : Type-With-Apartness l2 l3)
+ where
+
+ is-antireflexive-apart-function-into-Type-With-Apartness :
+ is-antireflexive (rel-apart-function-into-Type-With-Apartness X Y)
+ is-antireflexive-apart-function-into-Type-With-Apartness =
+ is-antireflexive-apart-Π-Type-With-Apartness X (λ _ → Y)
+
+ is-symmetric-apart-function-into-Type-With-Apartness :
+ is-symmetric (apart-function-into-Type-With-Apartness X Y)
+ is-symmetric-apart-function-into-Type-With-Apartness =
+ is-symmetric-apart-Π-Type-With-Apartness X (λ _ → Y)
+
+ is-apartness-relation-apart-function-into-Type-With-Apartness :
+ is-apartness-relation (rel-apart-function-into-Type-With-Apartness X Y)
+ is-apartness-relation-apart-function-into-Type-With-Apartness =
+ is-apartness-relation-apart-Π-Type-With-Apartness X (λ _ → Y)
+
+ apartness-relation-function-into-Type-With-Apartness :
+ Apartness-Relation (l1 ⊔ l3) (X → type-Type-With-Apartness Y)
+ apartness-relation-function-into-Type-With-Apartness =
+ apartness-relation-Π-Type-With-Apartness X (λ _ → Y)
+
+ is-cotransitive-apart-function-into-Type-With-Apartness :
+ is-cotransitive (rel-apart-function-into-Type-With-Apartness X Y)
+ is-cotransitive-apart-function-into-Type-With-Apartness =
+ is-cotransitive-apart-Π-Type-With-Apartness X (λ _ → Y)
+
+ function-into-Type-With-Apartness : Type-With-Apartness (l1 ⊔ l2) (l1 ⊔ l3)
+ function-into-Type-With-Apartness = Π-Type-With-Apartness X (λ _ → Y)
+```
+
+### Tight apartness on the type of functions into a type with tight apartness
+
+```agda
+module _
+ {l1 l2 l3 : Level} (X : UU l1) (Y : Type-With-Tight-Apartness l2 l3)
+ where
+
+ rel-apart-function-into-Type-With-Tight-Apartness :
+ Relation-Prop (l1 ⊔ l3) (X → type-Type-With-Tight-Apartness Y)
+ rel-apart-function-into-Type-With-Tight-Apartness =
+ rel-apart-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ apart-function-into-Type-With-Tight-Apartness :
+ Relation (l1 ⊔ l3) (X → type-Type-With-Tight-Apartness Y)
+ apart-function-into-Type-With-Tight-Apartness =
+ apart-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ is-prop-apart-function-into-Type-With-Tight-Apartness :
+ (f g : X → type-Type-With-Tight-Apartness Y) →
+ is-prop (apart-function-into-Type-With-Tight-Apartness f g)
+ is-prop-apart-function-into-Type-With-Tight-Apartness =
+ is-prop-apart-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ is-antireflexive-apart-function-into-Type-With-Tight-Apartness :
+ is-antireflexive rel-apart-function-into-Type-With-Tight-Apartness
+ is-antireflexive-apart-function-into-Type-With-Tight-Apartness =
+ is-antireflexive-apart-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ is-symmetric-apart-function-into-Type-With-Tight-Apartness :
+ is-symmetric apart-function-into-Type-With-Tight-Apartness
+ is-symmetric-apart-function-into-Type-With-Tight-Apartness =
+ is-symmetric-apart-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ is-cotransitive-apart-function-into-Type-With-Tight-Apartness :
+ is-cotransitive rel-apart-function-into-Type-With-Tight-Apartness
+ is-cotransitive-apart-function-into-Type-With-Tight-Apartness =
+ is-cotransitive-apart-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ is-apartness-relation-apart-function-into-Type-With-Tight-Apartness :
+ is-apartness-relation rel-apart-function-into-Type-With-Tight-Apartness
+ is-apartness-relation-apart-function-into-Type-With-Tight-Apartness =
+ is-apartness-relation-apart-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ apartness-relation-function-into-Type-With-Tight-Apartness :
+ Apartness-Relation (l1 ⊔ l3) (X → type-Type-With-Tight-Apartness Y)
+ apartness-relation-function-into-Type-With-Tight-Apartness =
+ apartness-relation-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ is-tight-apart-function-into-Type-With-Tight-Apartness :
+ is-tight rel-apart-function-into-Type-With-Tight-Apartness
+ is-tight-apart-function-into-Type-With-Tight-Apartness =
+ is-tight-apart-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ tight-apartness-relation-function-into-Type-With-Tight-Apartness :
+ Tight-Apartness-Relation (l1 ⊔ l3) (X → type-Type-With-Tight-Apartness Y)
+ tight-apartness-relation-function-into-Type-With-Tight-Apartness =
+ tight-apartness-relation-Π-Type-With-Tight-Apartness X (λ _ → Y)
+
+ function-into-Type-With-Tight-Apartness :
+ Type-With-Tight-Apartness (l1 ⊔ l2) (l1 ⊔ l3)
+ function-into-Type-With-Tight-Apartness =
+ Π-Type-With-Tight-Apartness X (λ _ → Y)
+```
+
+## See also
+
+- [Dependent function types with apartness relations](foundation.dependent-function-types-with-apartness-relations.md)
diff --git a/src/foundation/functoriality-dependent-pair-types.lagda.md b/src/foundation/functoriality-dependent-pair-types.lagda.md
index beffdd38f2..b826c1eefe 100644
--- a/src/foundation/functoriality-dependent-pair-types.lagda.md
+++ b/src/foundation/functoriality-dependent-pair-types.lagda.md
@@ -27,6 +27,8 @@ open import foundation-core.homotopies
open import foundation-core.identity-types
open import foundation-core.injective-maps
open import foundation-core.propositional-maps
+open import foundation-core.retracts-of-types
+open import foundation-core.sections
open import foundation-core.transport-along-identifications
open import foundation-core.truncated-maps
open import foundation-core.truncated-types
@@ -394,6 +396,20 @@ module _
( eq-pair-eq-fiber (inv (is-section-map-inv-equiv (e a) c))))
```
+### If every fiber has an element then the base is a retract of the dependent sum
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ where
+
+ section-pr1-section : ((x : A) → B x) → section (pr1 {A = A} {B})
+ section-pr1-section f = ((λ x → (x , f x)) , refl-htpy)
+
+ retract-base-Σ-section-family : ((x : A) → B x) → A retract-of (Σ A B)
+ retract-base-Σ-section-family f = retract-section pr1 (section-pr1-section f)
+```
+
### Dependent sums of morphisms of arrows
```agda
diff --git a/src/foundation/hilbert-epsilon-operators-maps.lagda.md b/src/foundation/hilbert-epsilon-operators-maps.lagda.md
new file mode 100644
index 0000000000..1c7dbdbbfd
--- /dev/null
+++ b/src/foundation/hilbert-epsilon-operators-maps.lagda.md
@@ -0,0 +1,93 @@
+# Hilbert ε-operators on maps
+
+```agda
+module foundation.hilbert-epsilon-operators-maps where
+```
+
+Imports
+
+```agda
+open import foundation.dependent-pair-types
+open import foundation.embeddings
+open import foundation.hilberts-epsilon-operators
+open import foundation.images
+open import foundation.universe-levels
+
+open import foundation-core.equivalences
+open import foundation-core.fibers-of-maps
+open import foundation-core.injective-maps
+open import foundation-core.sections
+```
+
+
+
+## Idea
+
+A
+{{#concept "Hilbert ε-operator" Disambiguation="on a map" Agda=ε-operator-map}}
+on a map $f : A → B$ is a family of
+[Hilbert ε-operators](foundation.hilberts-epsilon-operators.md) on its
+[fibers](foundation-core.fibers-of-maps.md). I.e., for every `y : B` there is an
+operator
+
+```text
+ ε_y : ║ fiber f y ║₋₁ → fiber f y.
+```
+
+Some authors also refer to this as _split support_ {{#cite KECA17}}. Contrary to
+Hilbert, we do not assume that such an operator exists for every map.
+
+## Definitions
+
+### The structure of a Hilbert ε-operator on a map
+
+```agda
+ε-operator-map :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} → (A → B) → UU (l1 ⊔ l2)
+ε-operator-map {B = B} f = (y : B) → ε-operator-Hilbert (fiber f y)
+```
+
+## Properties
+
+### ε-operators on maps are sections of the image-unit
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B}
+ where
+
+ map-section-map-unit-im-ε-operator-map : ε-operator-map f → im f → A
+ map-section-map-unit-im-ε-operator-map ε (y , p) = pr1 (ε y p)
+
+ is-section-map-section-map-unit-im-ε-operator-map :
+ (ε : ε-operator-map f) →
+ is-section (map-unit-im f) (map-section-map-unit-im-ε-operator-map ε)
+ is-section-map-section-map-unit-im-ε-operator-map ε (y , p) =
+ eq-Eq-im f _ _ (pr2 (ε y p))
+
+ section-map-unit-im-ε-operator-map :
+ ε-operator-map f → section (map-unit-im f)
+ section-map-unit-im-ε-operator-map ε =
+ ( map-section-map-unit-im-ε-operator-map ε ,
+ is-section-map-section-map-unit-im-ε-operator-map ε)
+```
+
+### Injective maps with ε-operators are embeddings
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B}
+ where
+
+ is-emb-is-injective-ε-operator-map :
+ ε-operator-map f → is-injective f → is-emb f
+ is-emb-is-injective-ε-operator-map ε H =
+ is-emb-comp
+ ( inclusion-im f)
+ ( map-unit-im f)
+ ( is-emb-inclusion-im f)
+ ( is-emb-is-equiv
+ ( is-equiv-is-injective
+ ( section-map-unit-im-ε-operator-map ε)
+ ( is-injective-right-factor (inclusion-im f) (map-unit-im f) H)))
+```
diff --git a/src/foundation/hilberts-epsilon-operators.lagda.md b/src/foundation/hilberts-epsilon-operators.lagda.md
index 1c23904a8b..476596058c 100644
--- a/src/foundation/hilberts-epsilon-operators.lagda.md
+++ b/src/foundation/hilberts-epsilon-operators.lagda.md
@@ -1,4 +1,4 @@
-# Hilbert's `ε`-operators
+# Hilbert's ε-operators
```agda
module foundation.hilberts-epsilon-operators where
@@ -19,7 +19,8 @@ open import foundation-core.function-types
## Idea
-{{#concept "Hilbert's $ε$-operator"}} at a type `A` is a map
+{{#concept "Hilbert's ε-operator" Disambiguation="on types" Agda=ε-operator-Hilbert}}
+on a type `A` is a map
```text
ε : ║A║₋₁ → A
diff --git a/src/foundation/images-subtypes.lagda.md b/src/foundation/images-subtypes.lagda.md
index f2959311bd..fc716d0cc9 100644
--- a/src/foundation/images-subtypes.lagda.md
+++ b/src/foundation/images-subtypes.lagda.md
@@ -252,7 +252,7 @@ module _
has-same-elements-subtype (subtype-im (g ∘ f)) (im-subtype g (subtype-im f))
compute-subtype-im-comp x =
logical-equivalence-reasoning
- is-in-subtype-im (g ∘ f) x
+ is-in-im (g ∘ f) x
↔ is-in-im-subtype (g ∘ f) (full-subtype lzero A) x
by
inv-iff (compute-im-full-subtype (g ∘ f) x)
diff --git a/src/foundation/images.lagda.md b/src/foundation/images.lagda.md
index 4ffd596c45..7fdbb46a83 100644
--- a/src/foundation/images.lagda.md
+++ b/src/foundation/images.lagda.md
@@ -17,7 +17,6 @@ open import foundation.universe-levels
open import foundation-core.1-types
open import foundation-core.commuting-triangles-of-maps
-open import foundation-core.contractible-types
open import foundation-core.embeddings
open import foundation-core.equivalences
open import foundation-core.fibers-of-maps
@@ -52,8 +51,8 @@ module _
subtype-im : subtype (l1 ⊔ l2) X
subtype-im x = trunc-Prop (fiber f x)
- is-in-subtype-im : X → UU (l1 ⊔ l2)
- is-in-subtype-im = is-in-subtype subtype-im
+ is-in-im : X → UU (l1 ⊔ l2)
+ is-in-im = is-in-subtype subtype-im
im : UU (l1 ⊔ l2)
im = type-subtype subtype-im
diff --git a/src/foundation/inequality-booleans.lagda.md b/src/foundation/inequality-booleans.lagda.md
new file mode 100644
index 0000000000..48c3f4f6ad
--- /dev/null
+++ b/src/foundation/inequality-booleans.lagda.md
@@ -0,0 +1,226 @@
+# The standard inequality relation on booleans
+
+```agda
+module foundation.inequality-booleans where
+```
+
+Imports
+
+```agda
+open import foundation.booleans
+open import foundation.decidable-propositions
+open import foundation.decidable-types
+open import foundation.dependent-pair-types
+open import foundation.disjunction
+open import foundation.logical-operations-booleans
+open import foundation.propositional-truncations
+open import foundation.unit-type
+open import foundation.universe-levels
+
+open import foundation-core.coproduct-types
+open import foundation-core.identity-types
+open import foundation-core.propositions
+
+open import order-theory.decidable-total-orders
+open import order-theory.posets
+open import order-theory.preorders
+open import order-theory.total-orders
+```
+
+
+
+## Idea
+
+The
+{{#concept "standard inequality relation" Disambiguation="on booleans" Agda=}}
+on [booleans](foundation.booleans.md) is the inductively defined
+[relation](foundation.binary-relations.md) given by the four inequalities
+
+```text
+ false ≤ false
+ false ≤ true
+ true ≤ true
+ true ≰ false.
+```
+
+## Definitions
+
+### The standard inequality relation on booleans
+
+```agda
+leq-bool-Decidable-Prop : bool → bool → Decidable-Prop lzero
+leq-bool-Decidable-Prop x y = decidable-prop-bool (hom-bool x y)
+
+leq-bool-Prop : bool → bool → Prop lzero
+leq-bool-Prop x y = prop-Decidable-Prop (leq-bool-Decidable-Prop x y)
+
+leq-bool : bool → bool → UU lzero
+leq-bool x y = type-Decidable-Prop (leq-bool-Decidable-Prop x y)
+
+is-decidable-leq-bool : {x y : bool} → is-decidable (leq-bool x y)
+is-decidable-leq-bool {x} {y} =
+ is-decidable-Decidable-Prop (leq-bool-Decidable-Prop x y)
+
+is-prop-leq-bool : {x y : bool} → is-prop (leq-bool x y)
+is-prop-leq-bool {x} {y} = is-prop-type-Prop (leq-bool-Prop x y)
+```
+
+## Properties
+
+### Reflexivity
+
+```agda
+refl-leq-bool : {x : bool} → leq-bool x x
+refl-leq-bool {true} = star
+refl-leq-bool {false} = star
+
+refl-leq-bool' : (x : bool) → leq-bool x x
+refl-leq-bool' x = refl-leq-bool {x}
+
+leq-eq-bool : {x y : bool} → x = y → leq-bool x y
+leq-eq-bool {x} refl = refl-leq-bool' x
+```
+
+### Transitivity
+
+```agda
+transitive-leq-bool :
+ {x y z : bool} → leq-bool y z → leq-bool x y → leq-bool x z
+transitive-leq-bool {true} {true} {true} p q = star
+transitive-leq-bool {false} {y} {z} p q = star
+```
+
+### Antisymmetry
+
+```agda
+antisymmetric-leq-bool :
+ {x y : bool} → leq-bool x y → leq-bool y x → x = y
+antisymmetric-leq-bool {true} {true} p q = refl
+antisymmetric-leq-bool {false} {false} p q = refl
+```
+
+### Linearity
+
+```agda
+linear-leq-bool : {x y : bool} → leq-bool x y + leq-bool y x
+linear-leq-bool {true} {true} = inr star
+linear-leq-bool {true} {false} = inr star
+linear-leq-bool {false} {y} = inl star
+
+is-total-leq-bool :
+ (x y : bool) → disjunction-type (leq-bool x y) (leq-bool y x)
+is-total-leq-bool x y = unit-trunc-Prop (linear-leq-bool {x} {y})
+```
+
+### The maximal and minimal elements
+
+```agda
+leq-true-bool : {x : bool} → leq-bool x true
+leq-true-bool {true} = star
+leq-true-bool {false} = star
+
+leq-false-bool : {x : bool} → leq-bool false x
+leq-false-bool = star
+
+eq-leq-true-bool : {x : bool} → leq-bool true x → x = true
+eq-leq-true-bool {true} p = refl
+
+eq-leq-false-bool : {x : bool} → leq-bool x false → x = false
+eq-leq-false-bool {false} p = refl
+```
+
+### The decidable total order on booleans
+
+```agda
+bool-Preorder : Preorder lzero lzero
+bool-Preorder =
+ ( bool ,
+ leq-bool-Prop ,
+ refl-leq-bool' ,
+ ( λ x y z → transitive-leq-bool {x} {y} {z}))
+
+bool-Poset : Poset lzero lzero
+bool-Poset = (bool-Preorder , (λ x y → antisymmetric-leq-bool {x} {y}))
+
+bool-Total-Order : Total-Order lzero lzero
+bool-Total-Order = (bool-Poset , is-total-leq-bool)
+
+bool-Decidable-Total-Order : Decidable-Total-Order lzero lzero
+bool-Decidable-Total-Order =
+ ( bool-Poset ,
+ ( is-total-leq-bool) ,
+ ( λ x y → is-decidable-Decidable-Prop (leq-bool-Decidable-Prop x y)))
+```
+
+### Interactions between the inequality relation and the disjunction operation
+
+```agda
+leq-or-bool : {x y : bool} → leq-bool x (or-bool x y)
+leq-or-bool {true} {y} = star
+leq-or-bool {false} {y} = star
+
+leq-or-bool' : {x y : bool} → leq-bool y (or-bool x y)
+leq-or-bool' {true} {true} = star
+leq-or-bool' {true} {false} = star
+leq-or-bool' {false} {true} = star
+leq-or-bool' {false} {false} = star
+
+leq-left-or-bool : {x y : bool} → leq-bool x y → leq-bool (or-bool x y) y
+leq-left-or-bool {true} {true} p = star
+leq-left-or-bool {false} {true} p = star
+leq-left-or-bool {false} {false} p = star
+
+leq-right-or-bool : {x y : bool} → leq-bool x y → leq-bool (or-bool y x) y
+leq-right-or-bool {x} {true} p = star
+leq-right-or-bool {false} {false} p = star
+
+leq-or-bool'' :
+ {x y z : bool} → leq-bool x z → leq-bool y z → leq-bool (or-bool x y) z
+leq-or-bool'' {true} {y} {true} p q = star
+leq-or-bool'' {false} {true} {true} p q = star
+leq-or-bool'' {false} {false} {true} p q = star
+leq-or-bool'' {false} {false} {false} p q = star
+```
+
+### Interactions between the inequality relation and the conjunction operation
+
+```agda
+leq-and-bool : {x y : bool} → leq-bool (and-bool x y) x
+leq-and-bool {true} {true} = star
+leq-and-bool {false} {true} = star
+leq-and-bool {true} {false} = star
+leq-and-bool {false} {false} = star
+
+leq-and-bool' : {x y : bool} → leq-bool (and-bool x y) y
+leq-and-bool' {true} {true} = star
+leq-and-bool' {true} {false} = star
+leq-and-bool' {false} {y} = star
+
+leq-left-and-bool : {x y : bool} → leq-bool x y → leq-bool x (and-bool x y)
+leq-left-and-bool {true} {true} p = star
+leq-left-and-bool {false} {y} p = star
+
+leq-right-and-bool : {x y : bool} → leq-bool x y → leq-bool x (and-bool y x)
+leq-right-and-bool {true} {true} p = star
+leq-right-and-bool {false} {y} p = star
+
+leq-and-bool'' :
+ {x y z : bool} → leq-bool x y → leq-bool x z → leq-bool x (and-bool y z)
+leq-and-bool'' {true} {true} {true} p q = star
+leq-and-bool'' {false} {y} {z} p q = star
+```
+
+```agda
+is-false-is-false-leq-bool :
+ {x y : bool} → leq-bool x y → is-false y → is-false x
+is-false-is-false-leq-bool {false} {false} p refl = refl
+
+is-true-is-true-leq-bool :
+ {x y : bool} → leq-bool x y → is-true x → is-true y
+is-true-is-true-leq-bool {true} {true} p refl = refl
+```
+
+## See also
+
+- The underlying category of the poset of booleans is called
+ [the representing arrow category](category-theory.representing-arrow-category.md).
diff --git a/src/foundation/injective-maps.lagda.md b/src/foundation/injective-maps.lagda.md
index 8ab3913353..56aff7be4a 100644
--- a/src/foundation/injective-maps.lagda.md
+++ b/src/foundation/injective-maps.lagda.md
@@ -9,7 +9,6 @@ open import foundation-core.injective-maps public
Imports
```agda
-open import foundation.action-on-identifications-dependent-functions
open import foundation.action-on-identifications-functions
open import foundation.dependent-pair-types
open import foundation.function-extensionality
@@ -33,7 +32,8 @@ open import foundation-core.sets
## Idea
-A map `f : A → B` is **injective** if `f x = f y` implies `x = y`.
+A map `f : A → B` is **injective**, also called _left cancellable_, if
+`f x = f y` implies `x = y`.
## Warning
diff --git a/src/foundation/irrefutable-equality.lagda.md b/src/foundation/irrefutable-equality.lagda.md
new file mode 100644
index 0000000000..cfe37e3665
--- /dev/null
+++ b/src/foundation/irrefutable-equality.lagda.md
@@ -0,0 +1,162 @@
+# Irrefutable equality
+
+```agda
+module foundation.irrefutable-equality where
+```
+
+Imports
+
+```agda
+open import foundation.action-on-identifications-functions
+open import foundation.binary-relations
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.equality-dependent-pair-types
+open import foundation.equivalences
+open import foundation.retracts-of-types
+open import foundation.transport-along-identifications
+open import foundation.universe-levels
+
+open import foundation-core.equivalence-relations
+open import foundation-core.identity-types
+open import foundation-core.propositions
+open import foundation-core.sets
+```
+
+
+
+## Idea
+
+Two elements `x` and `y` in a type are said to be
+{{#concept "irrefutably equal" Disambiguation="elements of a type" Agda=irrefutable-eq}}
+if there is an element of the [double negation](foundation.double-negation.md)
+of the [identity type](foundation-core.identity-types.md) between them,
+`¬¬ (x = y)`. If every two elements of a type are irrefutably equal, we say the
+type _has double negation dense equality_.
+
+## Definitions
+
+### Irrefutably equal elements
+
+```agda
+module _
+ {l : Level} {A : UU l}
+ where
+
+ irrefutable-eq : A → A → UU l
+ irrefutable-eq x y = ¬¬ (x = y)
+
+ is-prop-irrefutable-eq : (x y : A) → is-prop (irrefutable-eq x y)
+ is-prop-irrefutable-eq x y = is-prop-double-negation
+
+ irrefutable-eq-Prop : A → A → Prop l
+ irrefutable-eq-Prop x y = (irrefutable-eq x y , is-prop-irrefutable-eq x y)
+```
+
+### Types with double negation dense equality
+
+```agda
+has-double-negation-dense-equality : {l : Level} → UU l → UU l
+has-double-negation-dense-equality A = (x y : A) → irrefutable-eq x y
+```
+
+## Properties
+
+### Reflexivity
+
+```agda
+abstract
+ refl-irrefutable-eq :
+ {l : Level} {A : UU l} → is-reflexive (irrefutable-eq {l} {A})
+ refl-irrefutable-eq _ = intro-double-negation refl
+
+irrefutable-eq-eq :
+ {l : Level} {A : UU l} {x y : A} → x = y → irrefutable-eq x y
+irrefutable-eq-eq = intro-double-negation
+```
+
+### Symmetry
+
+```agda
+abstract
+ symmetric-irrefutable-eq :
+ {l : Level} {A : UU l} → is-symmetric (irrefutable-eq {l} {A})
+ symmetric-irrefutable-eq _ _ = map-double-negation inv
+```
+
+### Transitivity
+
+```agda
+abstract
+ transitive-irrefutable-eq :
+ {l : Level} {A : UU l} → is-transitive (irrefutable-eq {l} {A})
+ transitive-irrefutable-eq x y z nnp nnq npq =
+ nnp (λ p → nnq (λ q → npq (q ∙ p)))
+```
+
+### Irrefutable equality is an equivalence relation
+
+```agda
+irrefutable-eq-equivalence-relation :
+ {l1 : Level} (A : UU l1) → equivalence-relation l1 A
+pr1 (irrefutable-eq-equivalence-relation A) = irrefutable-eq-Prop
+pr1 (pr2 (irrefutable-eq-equivalence-relation A)) = refl-irrefutable-eq
+pr1 (pr2 (pr2 (irrefutable-eq-equivalence-relation A))) =
+ symmetric-irrefutable-eq
+pr2 (pr2 (pr2 (irrefutable-eq-equivalence-relation A))) =
+ transitive-irrefutable-eq
+```
+
+### If irrefutable equality maps into the identity type of `A`, then `A` is a set
+
+```agda
+is-set-irrefutable-eq-in-id :
+ {l : Level} {A : UU l} → ((x y : A) → irrefutable-eq x y → x = y) → is-set A
+is-set-irrefutable-eq-in-id =
+ is-set-prop-in-id irrefutable-eq is-prop-irrefutable-eq refl-irrefutable-eq
+```
+
+### Retracts of types with double negation dense equality
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ has-double-negation-dense-equality-retract-of :
+ B retract-of A →
+ has-double-negation-dense-equality A →
+ has-double-negation-dense-equality B
+ has-double-negation-dense-equality-retract-of (i , r , R) H x y =
+ map-double-negation (λ p → inv (R x) ∙ ap r p ∙ R y) (H (i x) (i y))
+
+ has-double-negation-dense-equality-equiv :
+ B ≃ A →
+ has-double-negation-dense-equality A → has-double-negation-dense-equality B
+ has-double-negation-dense-equality-equiv e =
+ has-double-negation-dense-equality-retract-of (retract-equiv e)
+
+ has-double-negation-dense-equality-equiv' :
+ A ≃ B →
+ has-double-negation-dense-equality A → has-double-negation-dense-equality B
+ has-double-negation-dense-equality-equiv' e =
+ has-double-negation-dense-equality-retract-of (retract-inv-equiv e)
+```
+
+### Dependent sums of types with double negation dense equality
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ (mA : has-double-negation-dense-equality A)
+ (mB : (x : A) → has-double-negation-dense-equality (B x))
+ where
+
+ has-double-negation-dense-equality-Σ :
+ has-double-negation-dense-equality (Σ A B)
+ has-double-negation-dense-equality-Σ x y =
+ extend-double-negation
+ ( λ p →
+ map-double-negation (eq-pair-Σ p) (mB (pr1 y) (tr B p (pr2 x)) (pr2 y)))
+ ( mA (pr1 x) (pr1 y))
+```
diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md
index a6a0d7fcde..6cd2618c29 100644
--- a/src/foundation/irrefutable-propositions.lagda.md
+++ b/src/foundation/irrefutable-propositions.lagda.md
@@ -9,20 +9,15 @@ module foundation.irrefutable-propositions where
```agda
open import foundation.cartesian-product-types
open import foundation.contractible-types
-open import foundation.coproduct-types
open import foundation.decidable-propositions
-open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.double-negation
-open import foundation.empty-types
open import foundation.function-types
-open import foundation.negation
open import foundation.propositions
open import foundation.subuniverses
-open import foundation.unit-type
open import foundation.universe-levels
-open import logic.double-negation-elimination
+open import logic.irrefutable-types
```
@@ -30,7 +25,8 @@ open import logic.double-negation-elimination
## Idea
The [subuniverse](foundation.subuniverses.md) of
-{{#concept "irrefutable propositions" Agda=Irrefutable-Prop}} consists of
+{{#concept "irrefutable propositions" Agda=Irrefutable-Prop}}, or **double
+negation dense propositions**, consists of
[propositions](foundation-core.propositions.md) `P` for which the
[double negation](foundation.double-negation.md) `¬¬P` is true.
@@ -43,14 +39,11 @@ module _
{l : Level} (P : Prop l)
where
- is-irrefutable : UU l
- is-irrefutable = ¬¬ (type-Prop P)
-
- is-prop-is-irrefutable : is-prop is-irrefutable
- is-prop-is-irrefutable = is-prop-double-negation
-
is-irrefutable-Prop : Prop l
- is-irrefutable-Prop = double-negation-Prop P
+ is-irrefutable-Prop = is-irrefutable-prop-Type (type-Prop P)
+
+ is-irrefutable-type-Prop : UU l
+ is-irrefutable-type-Prop = is-irrefutable (type-Prop P)
```
### The predicate on a type of being an irrefutable proposition
@@ -81,7 +74,7 @@ module _
prop-is-irrefutable-prop = P , is-prop-type-is-irrefutable-prop
is-irrefutable-is-irrefutable-prop :
- is-irrefutable (P , is-prop-type-is-irrefutable-prop)
+ is-irrefutable P
is-irrefutable-is-irrefutable-prop = pr2 H
```
@@ -92,7 +85,7 @@ Irrefutable-Prop : (l : Level) → UU (lsuc l)
Irrefutable-Prop l = type-subuniverse is-irrefutable-prop-Prop
make-Irrefutable-Prop :
- {l : Level} (P : Prop l) → is-irrefutable P → Irrefutable-Prop l
+ {l : Level} (P : Prop l) → is-irrefutable-type-Prop P → Irrefutable-Prop l
make-Irrefutable-Prop P is-irrefutable-P =
( type-Prop P , is-prop-type-Prop P , is-irrefutable-P)
@@ -114,60 +107,31 @@ module _
prop-Irrefutable-Prop : Prop l
prop-Irrefutable-Prop = type-Irrefutable-Prop , is-prop-type-Irrefutable-Prop
- is-irrefutable-Irrefutable-Prop : is-irrefutable prop-Irrefutable-Prop
+ is-irrefutable-Irrefutable-Prop : is-irrefutable type-Irrefutable-Prop
is-irrefutable-Irrefutable-Prop =
is-irrefutable-is-irrefutable-prop is-irrefutable-prop-type-Irrefutable-Prop
```
## Properties
-### Provable propositions are irrefutable
-
-```agda
-module _
- {l : Level} (P : Prop l)
- where
-
- is-irrefutable-has-element : type-Prop P → is-irrefutable P
- is-irrefutable-has-element = intro-double-negation
-
-is-irrefutable-unit : is-irrefutable unit-Prop
-is-irrefutable-unit = is-irrefutable-has-element unit-Prop star
-```
-
### Contractible types are irrefutable propositions
```agda
is-irrefutable-prop-is-contr :
{l : Level} {P : UU l} → is-contr P → is-irrefutable-prop P
is-irrefutable-prop-is-contr H =
- ( is-prop-is-contr H , intro-double-negation (center H))
-```
-
-### If it is irrefutable that a proposition is irrefutable, then the proposition is irrefutable
-
-```agda
-module _
- {l : Level} (P : Prop l)
- where
-
- is-idempotent-is-irrefutable :
- is-irrefutable (is-irrefutable-Prop P) → is-irrefutable P
- is-idempotent-is-irrefutable =
- double-negation-elim-neg (¬ (type-Prop P))
+ ( is-prop-is-contr H , is-irrefutable-is-contr H)
```
### Decidability is irrefutable
```agda
-is-irrefutable-is-decidable : {l : Level} {A : UU l} → ¬¬ (is-decidable A)
-is-irrefutable-is-decidable H = H (inr (H ∘ inl))
-
module _
{l : Level} (P : Prop l)
where
- is-irrefutable-is-decidable-Prop : is-irrefutable (is-decidable-Prop P)
+ is-irrefutable-is-decidable-Prop :
+ is-irrefutable-type-Prop (is-decidable-Prop P)
is-irrefutable-is-decidable-Prop = is-irrefutable-is-decidable
is-decidable-prop-Irrefutable-Prop : Irrefutable-Prop l
@@ -175,15 +139,6 @@ module _
make-Irrefutable-Prop (is-decidable-Prop P) is-irrefutable-is-decidable-Prop
```
-### Double negation elimination is irrefutable
-
-```agda
-is-irrefutable-double-negation-elim :
- {l : Level} {A : UU l} → ¬¬ (has-double-negation-elim A)
-is-irrefutable-double-negation-elim H =
- H (λ f → ex-falso (f (λ a → H (λ _ → a))))
-```
-
### Dependent sums of irrefutable propositions
```agda
@@ -191,10 +146,6 @@ module _
{l1 l2 : Level} {A : UU l1} {B : A → UU l2}
where
- is-irrefutable-Σ :
- ¬¬ A → ((x : A) → ¬¬ B x) → ¬¬ (Σ A B)
- is-irrefutable-Σ nna nnb nab = nna (λ a → nnb a (λ b → nab (a , b)))
-
is-irrefutable-prop-Σ :
is-irrefutable-prop A → ((x : A) → is-irrefutable-prop (B x)) →
is-irrefutable-prop (Σ A B)
@@ -214,28 +165,11 @@ module _
{l1 l2 : Level} {A : UU l1} {B : UU l2}
where
- is-irrefutable-product : ¬¬ A → ¬¬ B → ¬¬ (A × B)
- is-irrefutable-product nna nnb = is-irrefutable-Σ nna (λ _ → nnb)
-
is-irrefutable-prop-product :
is-irrefutable-prop A → is-irrefutable-prop B → is-irrefutable-prop (A × B)
is-irrefutable-prop-product a b = is-irrefutable-prop-Σ a (λ _ → b)
```
-### Coproducts of irrefutable propositions
-
-```agda
-module _
- {l1 l2 : Level} {A : UU l1} {B : UU l2}
- where
-
- is-irrefutable-coproduct-inl : ¬¬ A → ¬¬ (A + B)
- is-irrefutable-coproduct-inl nna x = nna (x ∘ inl)
-
- is-irrefutable-coproduct-inr : ¬¬ B → ¬¬ (A + B)
- is-irrefutable-coproduct-inr nnb x = nnb (x ∘ inr)
-```
-
## See also
- [De Morgan's law](logic.de-morgans-law.md) is irrefutable.
diff --git a/src/foundation/iterating-functions.lagda.md b/src/foundation/iterating-functions.lagda.md
index 60dafe2242..97c6d29d93 100644
--- a/src/foundation/iterating-functions.lagda.md
+++ b/src/foundation/iterating-functions.lagda.md
@@ -2,6 +2,8 @@
```agda
module foundation.iterating-functions where
+
+open import foundation-core.iterating-functions public
```
Imports
@@ -19,9 +21,7 @@ open import foundation.dependent-pair-types
open import foundation.function-extensionality
open import foundation.universe-levels
-open import foundation-core.commuting-squares-of-maps
open import foundation-core.endomorphisms
-open import foundation-core.homotopies
open import foundation-core.identity-types
open import foundation-core.sets
@@ -32,71 +32,12 @@ open import group-theory.monoid-actions
## Idea
-Any map `f : X → X` can be iterated by repeatedly applying `f`
-
-## Definition
-
-### Iterating functions
-
-```agda
-module _
- {l : Level} {X : UU l}
- where
-
- iterate : ℕ → (X → X) → (X → X)
- iterate zero-ℕ f x = x
- iterate (succ-ℕ k) f x = f (iterate k f x)
-
- iterate' : ℕ → (X → X) → (X → X)
- iterate' zero-ℕ f x = x
- iterate' (succ-ℕ k) f x = iterate' k f (f x)
-```
-
-### Homotopies of iterating functions
-
-```agda
-module _
- {l1 l2 : Level} {A : UU l1} {B : UU l2} (s : A → A) (t : B → B)
- where
-
- coherence-square-iterate :
- {f : A → B} (H : coherence-square-maps f s t f) →
- (n : ℕ) → coherence-square-maps f (iterate n s) (iterate n t) f
- coherence-square-iterate {f} H zero-ℕ x = refl
- coherence-square-iterate {f} H (succ-ℕ n) =
- pasting-vertical-coherence-square-maps
- ( f)
- ( iterate n s)
- ( iterate n t)
- ( f)
- ( s)
- ( t)
- ( f)
- ( coherence-square-iterate H n)
- ( H)
-```
+Any map `f : X → X` can be
+{{#concept "iterated" Disambiguation="endo map of types"}} by repeatedly
+applying `f`.
## Properties
-### The two definitions of iterating are homotopic
-
-```agda
-module _
- {l : Level} {X : UU l}
- where
-
- reassociate-iterate-succ-ℕ :
- (k : ℕ) (f : X → X) (x : X) → iterate (succ-ℕ k) f x = iterate k f (f x)
- reassociate-iterate-succ-ℕ zero-ℕ f x = refl
- reassociate-iterate-succ-ℕ (succ-ℕ k) f x =
- ap f (reassociate-iterate-succ-ℕ k f x)
-
- reassociate-iterate : (k : ℕ) (f : X → X) → iterate k f ~ iterate' k f
- reassociate-iterate zero-ℕ f x = refl
- reassociate-iterate (succ-ℕ k) f x =
- reassociate-iterate-succ-ℕ k f x ∙ reassociate-iterate k f (f x)
-```
-
### For any map `f : X → X`, iterating `f` defines a monoid action of ℕ on `X`
```agda
diff --git a/src/foundation/large-apartness-relations.lagda.md b/src/foundation/large-apartness-relations.lagda.md
index 49844edacb..88ed670657 100644
--- a/src/foundation/large-apartness-relations.lagda.md
+++ b/src/foundation/large-apartness-relations.lagda.md
@@ -7,8 +7,6 @@ module foundation.large-apartness-relations where
Imports
```agda
-open import foundation.cartesian-product-types
-open import foundation.disjunction
open import foundation.identity-types
open import foundation.large-binary-relations
open import foundation.negated-equality
@@ -23,8 +21,9 @@ open import foundation.universe-levels
A
{{#concept "large apartness relation" WD="apartness relation" WDID=Q4779193 Agda=Large-Apartness-Relation}}
-on a family of types indexed by universe levels `A` is a
-[large binary relation](foundation.large-binary-relations.md) `R` which is
+on a family of types indexed by [universe levels](foundation.universe-levels.md)
+`A` is a [large binary relation](foundation.large-binary-relations.md) `R` which
+is
- **Antireflexive:** For any `a : A` we have `¬ (R a a)`
- **Symmetric:** For any `a b : A` we have `R a b → R b a`
diff --git a/src/foundation/limited-principle-of-omniscience.lagda.md b/src/foundation/limited-principle-of-omniscience.lagda.md
index e66cea9ad0..de2a9feed7 100644
--- a/src/foundation/limited-principle-of-omniscience.lagda.md
+++ b/src/foundation/limited-principle-of-omniscience.lagda.md
@@ -12,17 +12,12 @@ open import elementary-number-theory.natural-numbers
open import foundation.booleans
open import foundation.coproduct-types
open import foundation.dependent-pair-types
-open import foundation.disjunction
open import foundation.existential-quantification
open import foundation.negation
open import foundation.universal-quantification
open import foundation.universe-levels
-open import foundation-core.identity-types
open import foundation-core.propositions
-open import foundation-core.sets
-
-open import univalent-combinatorics.standard-finite-types
```
@@ -55,7 +50,7 @@ is-prop-LPO =
is-prop-coproduct
( elim-exists
( ¬' ∀' ℕ (λ n → is-false-Prop (f n)))
- ( λ n t h → not-is-false-is-true (f n) t (h n)))
+ ( λ n t h → is-not-false-is-true (f n) t (h n)))
( is-prop-exists ℕ (λ n → is-true-Prop (f n)))
( is-prop-for-all-Prop ℕ (λ n → is-false-Prop (f n))))
diff --git a/src/foundation/logical-operations-booleans.lagda.md b/src/foundation/logical-operations-booleans.lagda.md
new file mode 100644
index 0000000000..b0818af5f1
--- /dev/null
+++ b/src/foundation/logical-operations-booleans.lagda.md
@@ -0,0 +1,297 @@
+# Logical operations on the booleans
+
+```agda
+module foundation.logical-operations-booleans where
+```
+
+Imports
+
+```agda
+open import foundation.apartness-relations
+open import foundation.booleans
+open import foundation.decidable-equality
+open import foundation.decidable-types
+open import foundation.dependent-pair-types
+open import foundation.discrete-types
+open import foundation.involutions
+open import foundation.negated-equality
+open import foundation.raising-universe-levels
+open import foundation.tight-apartness-relations
+open import foundation.unit-type
+open import foundation.universe-levels
+
+open import foundation-core.constant-maps
+open import foundation-core.coproduct-types
+open import foundation-core.decidable-propositions
+open import foundation-core.empty-types
+open import foundation-core.equivalences
+open import foundation-core.function-types
+open import foundation-core.homotopies
+open import foundation-core.identity-types
+open import foundation-core.injective-maps
+open import foundation-core.negation
+open import foundation-core.propositions
+open import foundation-core.sections
+open import foundation-core.sets
+
+open import univalent-combinatorics.finite-types
+open import univalent-combinatorics.standard-finite-types
+```
+
+
+
+## Idea
+
+We consider basic logical operations on the booleans and prove standard facts
+about them.
+
+## Definitions
+
+### Negation
+
+```agda
+neg-bool : bool → bool
+neg-bool true = false
+neg-bool false = true
+```
+
+### Conjunction
+
+```agda
+and-bool : bool → bool → bool
+and-bool true y = y
+and-bool false y = false
+```
+
+### Disjunction
+
+```agda
+or-bool : bool → bool → bool
+or-bool true y = true
+or-bool false y = y
+```
+
+### Implication
+
+```agda
+hom-bool : bool → bool → bool
+hom-bool x = or-bool (neg-bool x)
+```
+
+### Exclusive disjunction
+
+```agda
+xor-bool : bool → bool → bool
+xor-bool true y = neg-bool y
+xor-bool false y = y
+```
+
+### Negated exclusive disjunction
+
+```agda
+xnor-bool : bool → bool → bool
+xnor-bool true y = y
+xnor-bool false y = neg-bool y
+```
+
+## Properties
+
+### Boolean negation has no fixed points
+
+```agda
+neq-neg-bool : (b : bool) → b ≠ neg-bool b
+neq-neg-bool true ()
+neq-neg-bool false ()
+
+neq-neg-bool' : (b : bool) → neg-bool b ≠ b
+neq-neg-bool' b = neq-neg-bool b ∘ inv
+
+is-true-is-false-neg-bool : {b : bool} → is-false (neg-bool b) → is-true b
+is-true-is-false-neg-bool {true} p = refl
+
+is-false-is-true-neg-bool : {b : bool} → is-true (neg-bool b) → is-false b
+is-false-is-true-neg-bool {false} p = refl
+```
+
+### Boolean negation is an involution
+
+```agda
+is-involution-neg-bool : is-involution neg-bool
+is-involution-neg-bool true = refl
+is-involution-neg-bool false = refl
+```
+
+### Boolean negation is an equivalence
+
+```agda
+abstract
+ is-equiv-neg-bool : is-equiv neg-bool
+ is-equiv-neg-bool = is-equiv-is-involution is-involution-neg-bool
+
+equiv-neg-bool : bool ≃ bool
+pr1 equiv-neg-bool = neg-bool
+pr2 equiv-neg-bool = is-equiv-neg-bool
+```
+
+### Basic properties of the or operation
+
+```agda
+left-unit-law-or-bool : {x : bool} → or-bool false x = x
+left-unit-law-or-bool = refl
+
+right-unit-law-or-bool : {x : bool} → or-bool x false = x
+right-unit-law-or-bool {true} = refl
+right-unit-law-or-bool {false} = refl
+
+left-zero-law-or-bool : {x : bool} → or-bool true x = true
+left-zero-law-or-bool = refl
+
+right-zero-law-or-bool : {x : bool} → or-bool x true = true
+right-zero-law-or-bool {true} = refl
+right-zero-law-or-bool {false} = refl
+
+idempotent-or-bool : {x : bool} → or-bool x x = x
+idempotent-or-bool {true} = refl
+idempotent-or-bool {false} = refl
+
+commutative-or-bool : {x y : bool} → or-bool x y = or-bool y x
+commutative-or-bool {true} {true} = refl
+commutative-or-bool {true} {false} = refl
+commutative-or-bool {false} {true} = refl
+commutative-or-bool {false} {false} = refl
+
+associative-or-bool :
+ {x y z : bool} → or-bool (or-bool x y) z = or-bool x (or-bool y z)
+associative-or-bool {true} {y} {z} = refl
+associative-or-bool {false} {y} {z} = refl
+```
+
+### Basic properties of the and operation
+
+```agda
+left-unit-law-and-bool : {x : bool} → and-bool true x = x
+left-unit-law-and-bool = refl
+
+right-unit-law-and-bool : {x : bool} → and-bool x true = x
+right-unit-law-and-bool {true} = refl
+right-unit-law-and-bool {false} = refl
+
+left-zero-law-and-bool : {x : bool} → and-bool false x = false
+left-zero-law-and-bool = refl
+
+right-zero-law-and-bool : {x : bool} → and-bool x false = false
+right-zero-law-and-bool {true} = refl
+right-zero-law-and-bool {false} = refl
+
+commutative-and-bool : {x y : bool} → and-bool x y = and-bool y x
+commutative-and-bool {true} {true} = refl
+commutative-and-bool {true} {false} = refl
+commutative-and-bool {false} {true} = refl
+commutative-and-bool {false} {false} = refl
+
+idempotent-and-bool : {x : bool} → and-bool x x = x
+idempotent-and-bool {true} = refl
+idempotent-and-bool {false} = refl
+
+associative-and-bool :
+ {x y z : bool} → and-bool (and-bool x y) z = and-bool x (and-bool y z)
+associative-and-bool {true} {y} {z} = refl
+associative-and-bool {false} {y} {z} = refl
+```
+
+### Basic properties of the implication operation
+
+```agda
+left-unit-law-hom-bool : {x : bool} → hom-bool true x = x
+left-unit-law-hom-bool = refl
+
+right-neg-law-hom-bool : {x : bool} → hom-bool x false = neg-bool x
+right-neg-law-hom-bool {true} = refl
+right-neg-law-hom-bool {false} = refl
+
+left-zero-law-hom-bool : {x : bool} → hom-bool false x = true
+left-zero-law-hom-bool = refl
+
+right-zero-law-hom-bool : {x : bool} → hom-bool x true = true
+right-zero-law-hom-bool {true} = refl
+right-zero-law-hom-bool {false} = refl
+
+compute-hom-self-bool : {x : bool} → hom-bool x x = true
+compute-hom-self-bool {true} = refl
+compute-hom-self-bool {false} = refl
+```
+
+### Computing implication on connectives
+
+```agda
+compute-and-hom-bool :
+ {x y z : bool} → hom-bool (and-bool x y) z = hom-bool x (hom-bool y z)
+compute-and-hom-bool {true} {y} {z} = refl
+compute-and-hom-bool {false} {y} {z} = refl
+
+compute-or-hom-bool :
+ {x y z : bool} →
+ hom-bool (or-bool x y) z = and-bool (hom-bool x z) (hom-bool y z)
+compute-or-hom-bool {true} {true} {true} = refl
+compute-or-hom-bool {true} {false} {true} = refl
+compute-or-hom-bool {true} {true} {false} = refl
+compute-or-hom-bool {true} {false} {false} = refl
+compute-or-hom-bool {false} {y} {z} = refl
+
+distributive-hom-and-bool :
+ {x y z : bool} →
+ hom-bool x (and-bool y z) = and-bool (hom-bool x y) (hom-bool x z)
+distributive-hom-and-bool {true} {y} {z} = refl
+distributive-hom-and-bool {false} {y} {z} = refl
+```
+
+### Distributivity of conjunction over disjunction
+
+```agda
+distributive-and-or-bool :
+ {x y z : bool} →
+ and-bool x (or-bool y z) = or-bool (and-bool x y) (and-bool x z)
+distributive-and-or-bool {true} = refl
+distributive-and-or-bool {false} = refl
+```
+
+### Distributivity of disjunction over conjunction
+
+```agda
+distributive-or-and-bool :
+ {x y z : bool} →
+ or-bool x (and-bool y z) = and-bool (or-bool x y) (or-bool x z)
+distributive-or-and-bool {true} = refl
+distributive-or-and-bool {false} = refl
+```
+
+### The law of excluded middle
+
+```agda
+law-of-excluded-middle-bool :
+ {x : bool} → or-bool x (neg-bool x) = true
+law-of-excluded-middle-bool {true} = refl
+law-of-excluded-middle-bool {false} = refl
+```
+
+### Double negation elimination
+
+```agda
+double-negation-elim-bool : {x : bool} → neg-bool (neg-bool x) = x
+double-negation-elim-bool {true} = refl
+double-negation-elim-bool {false} = refl
+```
+
+### De Morgan's laws
+
+```agda
+de-morgans-law-bool :
+ {x y : bool} → neg-bool (and-bool x y) = or-bool (neg-bool x) (neg-bool y)
+de-morgans-law-bool {true} = refl
+de-morgans-law-bool {false} = refl
+
+de-morgans-law-bool' :
+ {x y : bool} → neg-bool (or-bool x y) = and-bool (neg-bool x) (neg-bool y)
+de-morgans-law-bool' {true} = refl
+de-morgans-law-bool' {false} = refl
+```
diff --git a/src/foundation/mere-equality.lagda.md b/src/foundation/mere-equality.lagda.md
index d5319cae0a..39d7049b9b 100644
--- a/src/foundation/mere-equality.lagda.md
+++ b/src/foundation/mere-equality.lagda.md
@@ -10,9 +10,15 @@ module foundation.mere-equality where
open import foundation.action-on-identifications-functions
open import foundation.binary-relations
open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.equality-dependent-pair-types
+open import foundation.equivalences
open import foundation.functoriality-propositional-truncation
+open import foundation.irrefutable-equality
open import foundation.propositional-truncations
open import foundation.reflecting-maps-equivalence-relations
+open import foundation.retracts-of-types
+open import foundation.transport-along-identifications
open import foundation.universe-levels
open import foundation-core.equivalence-relations
@@ -28,7 +34,7 @@ open import foundation-core.sets
Two elements in a type are said to be merely equal if there is an element of the
propositionally truncated identity type between them.
-## Definition
+## Definitions
```agda
module _
@@ -45,6 +51,13 @@ module _
is-prop-mere-eq x y = is-prop-type-trunc-Prop
```
+### Types whose elements are merely equal
+
+```agda
+all-elements-merely-equal : {l : Level} → UU l → UU l
+all-elements-merely-equal A = (x y : A) → mere-eq x y
+```
+
## Properties
### Reflexivity
@@ -107,8 +120,7 @@ module _
reflecting-map-equivalence-relation
( mere-eq-equivalence-relation A)
( type-Set X)
- pr1 reflecting-map-mere-eq = f
- pr2 reflecting-map-mere-eq = reflects-mere-eq
+ reflecting-map-mere-eq = (f , reflects-mere-eq)
```
### If mere equality maps into the identity type of `A`, then `A` is a set
@@ -117,8 +129,63 @@ module _
is-set-mere-eq-in-id :
{l : Level} {A : UU l} → ((x y : A) → mere-eq x y → x = y) → is-set A
is-set-mere-eq-in-id =
- is-set-prop-in-id
- ( mere-eq)
- ( is-prop-mere-eq)
- ( refl-mere-eq)
+ is-set-prop-in-id mere-eq is-prop-mere-eq refl-mere-eq
+```
+
+In other words, if equality on `A` has an
+[ε-operator](foundation.hilberts-epsilon-operators.md), then `A` is a set.
+
+### Retracts of types with merely equal elements
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ all-elements-merely-equal-retract-of :
+ B retract-of A → all-elements-merely-equal A → all-elements-merely-equal B
+ all-elements-merely-equal-retract-of (i , r , R) H x y =
+ rec-trunc-Prop
+ ( mere-eq-Prop x y)
+ ( λ p → unit-trunc-Prop (inv (R x) ∙ ap r p ∙ R y))
+ ( H (i x) (i y))
+
+ all-elements-merely-equal-equiv :
+ B ≃ A → all-elements-merely-equal A → all-elements-merely-equal B
+ all-elements-merely-equal-equiv e =
+ all-elements-merely-equal-retract-of (retract-equiv e)
+
+ all-elements-merely-equal-equiv' :
+ A ≃ B → all-elements-merely-equal A → all-elements-merely-equal B
+ all-elements-merely-equal-equiv' e =
+ all-elements-merely-equal-retract-of (retract-inv-equiv e)
+```
+
+### Dependent sums of types with merely equal elements
+
+```agda
+all-elements-merely-equal-Σ :
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2} →
+ all-elements-merely-equal A →
+ ((x : A) → all-elements-merely-equal (B x)) →
+ all-elements-merely-equal (Σ A B)
+all-elements-merely-equal-Σ {B = B} mA mB x y =
+ rec-trunc-Prop
+ ( mere-eq-Prop x y)
+ ( λ p → map-trunc-Prop (eq-pair-Σ p) (mB (pr1 y) (tr B p (pr2 x)) (pr2 y)))
+ ( mA (pr1 x) (pr1 y))
+```
+
+### Mere equality implies irrefutable equality
+
+```agda
+irrefutable-eq-mere-eq :
+ {l : Level} {A : UU l} {x y : A} → mere-eq x y → irrefutable-eq x y
+irrefutable-eq-mere-eq = intro-double-negation-type-trunc-Prop
+
+has-double-negation-dense-equality-all-elements-merely-equal :
+ {l : Level} {A : UU l} →
+ all-elements-merely-equal A → has-double-negation-dense-equality A
+has-double-negation-dense-equality-all-elements-merely-equal H x y =
+ irrefutable-eq-mere-eq (H x y)
```
diff --git a/src/foundation/null-homotopic-maps.lagda.md b/src/foundation/null-homotopic-maps.lagda.md
index 2500c019f4..7c91dd99e8 100644
--- a/src/foundation/null-homotopic-maps.lagda.md
+++ b/src/foundation/null-homotopic-maps.lagda.md
@@ -11,27 +11,21 @@ open import foundation.commuting-triangles-of-identifications
open import foundation.constant-maps
open import foundation.dependent-pair-types
open import foundation.empty-types
-open import foundation.functoriality-dependent-pair-types
open import foundation.fundamental-theorem-of-identity-types
open import foundation.homotopy-induction
open import foundation.identity-types
-open import foundation.images
open import foundation.inhabited-types
-open import foundation.negation
open import foundation.propositional-truncations
open import foundation.propositions
open import foundation.sets
open import foundation.structure-identity-principle
open import foundation.torsorial-type-families
open import foundation.type-arithmetic-dependent-pair-types
-open import foundation.unit-type
open import foundation.universal-property-empty-type
open import foundation.universe-levels
open import foundation.weakly-constant-maps
-open import foundation-core.contractible-types
open import foundation-core.equivalences
-open import foundation-core.function-types
open import foundation-core.homotopies
```
diff --git a/src/foundation/path-split-type-families.lagda.md b/src/foundation/path-split-type-families.lagda.md
index 690d6d1a74..54af7a8822 100644
--- a/src/foundation/path-split-type-families.lagda.md
+++ b/src/foundation/path-split-type-families.lagda.md
@@ -36,7 +36,7 @@ and `v` _over_ p. This condition is
[equivalent](foundation.logical-equivalences.md) to asking that `P` is a family
of [propositions](foundation-core.propositions.md).
-This condition is a direct rephrasing of stating that the
+This condition is a direct rephrasing of the statement that the
[action on identifications](foundation.action-on-identifications-functions.md)
of the first projection map `Σ A P → A` has a
[section](foundation-core.sections.md), and in this way is closely related to
diff --git a/src/foundation/projective-types.lagda.md b/src/foundation/projective-types.lagda.md
index f537366853..4ac853ef0d 100644
--- a/src/foundation/projective-types.lagda.md
+++ b/src/foundation/projective-types.lagda.md
@@ -15,7 +15,6 @@ open import foundation.surjective-maps
open import foundation.truncation-levels
open import foundation.universe-levels
-open import foundation-core.function-types
open import foundation-core.sets
open import foundation-core.truncated-types
```
@@ -76,5 +75,5 @@ is-projective l2 l3 k X =
## See also
-- The natural map `(X → A)/~ → (X → A/R)` was studied in
- [foundation.exponents-set-quotients](foundation.exponents-set-quotients.md)
+- The natural map `(X → A)/~ → (X → A/R)` is studied in
+ [`foundation.exponents-set-quotients`](foundation.exponents-set-quotients.md)
diff --git a/src/foundation/propositional-truncations.lagda.md b/src/foundation/propositional-truncations.lagda.md
index 2ae3713137..9888a5f5aa 100644
--- a/src/foundation/propositional-truncations.lagda.md
+++ b/src/foundation/propositional-truncations.lagda.md
@@ -8,6 +8,7 @@ module foundation.propositional-truncations where
```agda
open import foundation.action-on-identifications-functions
+open import foundation.constant-type-families
open import foundation.dependent-pair-types
open import foundation.functoriality-cartesian-product-types
open import foundation.logical-equivalences
@@ -19,6 +20,7 @@ open import foundation.universe-levels
open import foundation-core.cartesian-product-types
open import foundation-core.contractible-types
open import foundation-core.coproduct-types
+open import foundation-core.dependent-identifications
open import foundation-core.equivalences
open import foundation-core.function-types
open import foundation-core.identity-types
@@ -46,22 +48,22 @@ postulate of the existence of truncations at all levels, found in the file
type-trunc-Prop : {l : Level} → UU l → UU l
type-trunc-Prop = type-trunc neg-one-𝕋
-unit-trunc-Prop : {l : Level} {A : UU l} → A → type-trunc-Prop A
+║_║₋₁ : {l : Level} → UU l → UU l
+║_║₋₁ = type-trunc-Prop
+
+unit-trunc-Prop : {l : Level} {A : UU l} → A → ║ A ║₋₁
unit-trunc-Prop = unit-trunc
-is-prop-type-trunc-Prop : {l : Level} {A : UU l} → is-prop (type-trunc-Prop A)
+is-prop-type-trunc-Prop : {l : Level} {A : UU l} → is-prop (║ A ║₋₁)
is-prop-type-trunc-Prop = is-trunc-type-trunc
all-elements-equal-type-trunc-Prop :
- {l : Level} {A : UU l} → all-elements-equal (type-trunc-Prop A)
+ {l : Level} {A : UU l} → all-elements-equal (║ A ║₋₁)
all-elements-equal-type-trunc-Prop {l} {A} =
eq-is-prop' (is-prop-type-trunc-Prop {l} {A})
trunc-Prop : {l : Level} → UU l → Prop l
trunc-Prop = trunc neg-one-𝕋
-
-║_║₋₁ : {l : Level} → UU l → UU l
-║_║₋₁ = type-trunc-Prop
```
**Notation.** The [box drawings double vertical](https://codepoints.net/U+2551)
@@ -76,10 +78,10 @@ the list.
```agda
abstract
is-prop-condition-ind-trunc-Prop' :
- {l1 l2 : Level} {A : UU l1} {P : type-trunc-Prop A → UU l2} →
- ( (x y : type-trunc-Prop A) (u : P x) (v : P y) →
- tr P (all-elements-equal-type-trunc-Prop x y) u = v) →
- (x : type-trunc-Prop A) → is-prop (P x)
+ {l1 l2 : Level} {A : UU l1} {P : ║ A ║₋₁ → UU l2} →
+ ( (x y : ║ A ║₋₁) (u : P x) (v : P y) →
+ dependent-identification P (all-elements-equal-type-trunc-Prop x y) u v) →
+ (x : ║ A ║₋₁) → is-prop (P x)
is-prop-condition-ind-trunc-Prop' {P = P} H x =
is-prop-all-elements-equal
( λ u v →
@@ -93,29 +95,46 @@ abstract
```agda
ind-trunc-Prop' :
- {l l1 : Level} {A : UU l1} (P : type-trunc-Prop A → UU l)
+ {l l1 : Level} {A : UU l1} (P : ║ A ║₋₁ → UU l)
(f : (x : A) → P (unit-trunc-Prop x))
(H :
- (x y : type-trunc-Prop A) (u : P x) (v : P y) →
- tr P (all-elements-equal-type-trunc-Prop x y) u = v) →
- (x : type-trunc-Prop A) → P x
+ (x y : ║ A ║₋₁) (u : P x) (v : P y) →
+ dependent-identification P (all-elements-equal-type-trunc-Prop x y) u v) →
+ (x : ║ A ║₋₁) → P x
ind-trunc-Prop' P f H =
function-dependent-universal-property-trunc
- ( λ x → pair (P x) (is-prop-condition-ind-trunc-Prop' H x))
+ ( λ x → (P x , is-prop-condition-ind-trunc-Prop' H x))
( f)
```
+### The recursion principle for propositional truncations
+
+```agda
+rec-trunc-Prop' :
+ {l l1 : Level} {A : UU l1} {P : UU l}
+ (f : A → P) (H : ║ A ║₋₁ → (u v : P) → u = v) →
+ ║ A ║₋₁ → P
+rec-trunc-Prop' {P = P} f H =
+ ind-trunc-Prop'
+ ( λ _ → P)
+ ( f)
+ ( λ x y u v →
+ map-compute-dependent-identification-constant-type-family
+ ( all-elements-equal-type-trunc-Prop x y)
+ ( H x u v))
+```
+
### The propositional induction principle for propositional truncations
```agda
module _
- {l l1 : Level} {A : UU l1} (P : type-trunc-Prop A → Prop l)
+ {l l1 : Level} {A : UU l1} (P : ║ A ║₋₁ → Prop l)
where
abstract
ind-trunc-Prop :
((x : A) → type-Prop (P (unit-trunc-Prop x))) →
- (( y : type-trunc-Prop A) → type-Prop (P y))
+ (( y : ║ A ║₋₁) → type-Prop (P y))
ind-trunc-Prop f =
ind-trunc-Prop' (type-Prop ∘ P) f
( λ x y u v → eq-is-prop (is-prop-type-Prop (P y)))
@@ -135,7 +154,7 @@ module _
abstract
rec-trunc-Prop :
- (A → type-Prop P) → (type-trunc-Prop A → type-Prop P)
+ (A → type-Prop P) → (║ A ║₋₁ → type-Prop P)
rec-trunc-Prop = ind-trunc-Prop (λ _ → P)
compute-rec-trunc-Prop :
@@ -186,15 +205,15 @@ abstract
abstract
apply-universal-property-trunc-Prop :
- {l1 l2 : Level} {A : UU l1} (t : type-trunc-Prop A) (P : Prop l2) →
+ {l1 l2 : Level} {A : UU l1} (t : ║ A ║₋₁) (P : Prop l2) →
(A → type-Prop P) → type-Prop P
apply-universal-property-trunc-Prop t P f =
map-universal-property-trunc-Prop P f t
abstract
apply-twice-universal-property-trunc-Prop :
- {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (u : type-trunc-Prop A)
- (v : type-trunc-Prop B) (P : Prop l3) →
+ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (u : ║ A ║₋₁)
+ (v : ║ B ║₋₁) (P : Prop l3) →
(A → B → type-Prop P) → type-Prop P
apply-twice-universal-property-trunc-Prop u v P f =
apply-universal-property-trunc-Prop u P
@@ -203,7 +222,7 @@ abstract
abstract
apply-three-times-universal-property-trunc-Prop :
{l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3}
- (u : type-trunc-Prop A) (v : type-trunc-Prop B) (w : type-trunc-Prop C) →
+ (u : ║ A ║₋₁) (v : ║ B ║₋₁) (w : ║ C ║₋₁) →
(P : Prop l4) → (A → B → C → type-Prop P) → type-Prop P
apply-three-times-universal-property-trunc-Prop u v w P f =
apply-universal-property-trunc-Prop u P
@@ -214,12 +233,12 @@ abstract
```agda
is-trunc-trunc-Prop :
- {l : Level} (k : 𝕋) {A : UU l} → is-trunc (succ-𝕋 k) (type-trunc-Prop A)
+ {l : Level} (k : 𝕋) {A : UU l} → is-trunc (succ-𝕋 k) (║ A ║₋₁)
is-trunc-trunc-Prop k = is-trunc-is-prop k is-prop-type-trunc-Prop
truncated-type-trunc-Prop :
{l : Level} (k : 𝕋) → UU l → Truncated-Type l (succ-𝕋 k)
-pr1 (truncated-type-trunc-Prop k A) = type-trunc-Prop A
+pr1 (truncated-type-trunc-Prop k A) = ║ A ║₋₁
pr2 (truncated-type-trunc-Prop k A) = is-trunc-trunc-Prop k
set-trunc-Prop : {l : Level} → UU l → Set l
@@ -233,7 +252,7 @@ module _
{l : Level} (A : Prop l)
where
- equiv-unit-trunc-Prop : type-Prop A ≃ type-trunc-Prop (type-Prop A)
+ equiv-unit-trunc-Prop : type-Prop A ≃ ║ type-Prop A ║₋₁
equiv-unit-trunc-Prop = equiv-unit-trunc A
```
@@ -246,7 +265,7 @@ module _
abstract
map-idempotent-trunc-Prop :
- type-trunc-Prop (type-trunc-Prop A) → type-trunc-Prop A
+ ║ (║ A ║₋₁) ║₋₁ → ║ A ║₋₁
map-idempotent-trunc-Prop =
map-universal-property-trunc-Prop (trunc-Prop A) id
@@ -259,13 +278,13 @@ module _
( unit-trunc-Prop)
idempotent-trunc-Prop :
- type-trunc-Prop (type-trunc-Prop A) ≃ type-trunc-Prop A
+ ║ (║ A ║₋₁) ║₋₁ ≃ ║ A ║₋₁
pr1 idempotent-trunc-Prop = map-idempotent-trunc-Prop
pr2 idempotent-trunc-Prop = is-equiv-map-idempotent-trunc-Prop
abstract
is-equiv-map-inv-idempotent-trunc-Prop :
- is-equiv (unit-trunc-Prop {A = type-trunc-Prop A})
+ is-equiv (unit-trunc-Prop {A = ║ A ║₋₁})
is-equiv-map-inv-idempotent-trunc-Prop =
is-equiv-has-converse-is-prop
( is-prop-type-trunc-Prop)
@@ -273,7 +292,7 @@ module _
( map-idempotent-trunc-Prop)
inv-idempotent-trunc-Prop :
- type-trunc-Prop A ≃ type-trunc-Prop (type-trunc-Prop A)
+ ║ A ║₋₁ ≃ ║ (║ A ║₋₁) ║₋₁
pr1 inv-idempotent-trunc-Prop = unit-trunc-Prop
pr2 inv-idempotent-trunc-Prop = is-equiv-map-inv-idempotent-trunc-Prop
```
@@ -294,11 +313,11 @@ abstract
( is-propositional-truncation-trunc-Prop A)
module _
- {l1 l2 : Level} {A : UU l1} (P : type-trunc-Prop A → Prop l2)
+ {l1 l2 : Level} {A : UU l1} (P : ║ A ║₋₁ → Prop l2)
where
equiv-dependent-universal-property-trunc-Prop :
- ((y : type-trunc-Prop A) → type-Prop (P y)) ≃
+ ((y : ║ A ║₋₁) → type-Prop (P y)) ≃
((x : A) → type-Prop (P (unit-trunc-Prop x)))
pr1 equiv-dependent-universal-property-trunc-Prop =
precomp-Π unit-trunc-Prop (type-Prop ∘ P)
@@ -306,7 +325,7 @@ module _
dependent-universal-property-trunc-Prop P
apply-dependent-universal-property-trunc-Prop :
- (y : type-trunc-Prop A) → ((x : A) → type-Prop (P (unit-trunc-Prop x))) →
+ (y : ║ A ║₋₁) → ((x : A) → type-Prop (P (unit-trunc-Prop x))) →
type-Prop (P y)
apply-dependent-universal-property-trunc-Prop y f =
map-inv-equiv equiv-dependent-universal-property-trunc-Prop f y
@@ -339,17 +358,17 @@ equiv-product-trunc-Prop A A' =
map-distributive-trunc-product-Prop :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
- type-trunc-Prop (A × B) → type-trunc-Prop A × type-trunc-Prop B
+ ║ A × B ║₋₁ → ║ A ║₋₁ × ║ B ║₋₁
map-distributive-trunc-product-Prop {l1} {l2} {A} {B} =
map-universal-property-trunc-Prop
( pair
- ( type-trunc-Prop A × type-trunc-Prop B)
+ ( ║ A ║₋₁ × ║ B ║₋₁)
( is-prop-product is-prop-type-trunc-Prop is-prop-type-trunc-Prop))
( map-product unit-trunc-Prop unit-trunc-Prop)
map-inv-distributive-trunc-product-Prop :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
- type-trunc-Prop A × type-trunc-Prop B → type-trunc-Prop (A × B)
+ ║ A ║₋₁ × ║ B ║₋₁ → ║ A × B ║₋₁
map-inv-distributive-trunc-product-Prop {l1} {l2} {A} {B} t =
map-universal-property-trunc-Prop
( trunc-Prop (A × B))
@@ -372,7 +391,7 @@ abstract
distributive-trunc-product-Prop :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
- type-trunc-Prop (A × B) ≃ (type-trunc-Prop A × type-trunc-Prop B)
+ ║ A × B ║₋₁ ≃ ║ A ║₋₁ × ║ B ║₋₁
pr1 distributive-trunc-product-Prop = map-distributive-trunc-product-Prop
pr2 distributive-trunc-product-Prop =
is-equiv-map-distributive-trunc-product-Prop
@@ -389,7 +408,7 @@ abstract
inv-distributive-trunc-product-Prop :
{l1 l2 : Level} {A : UU l1} {B : UU l2} →
- ( type-trunc-Prop A × type-trunc-Prop B) ≃ type-trunc-Prop (A × B)
+ ( ║ A ║₋₁ × ║ B ║₋₁) ≃ ║ A × B ║₋₁
pr1 inv-distributive-trunc-product-Prop =
map-inv-distributive-trunc-product-Prop
pr2 inv-distributive-trunc-product-Prop =
@@ -400,16 +419,18 @@ pr2 inv-distributive-trunc-product-Prop =
```agda
module _
- {l : Level} {A : UU l} where
+ {l : Level} {A : UU l}
+ where
+
map-trunc-Prop-diagonal-coproduct :
- type-trunc-Prop (A + A) → type-trunc-Prop A
+ ║ A + A ║₋₁ → ║ A ║₋₁
map-trunc-Prop-diagonal-coproduct =
map-universal-property-trunc-Prop
( trunc-Prop A)
( unit-trunc ∘ rec-coproduct id id)
map-inv-trunc-Prop-diagonal-coproduct :
- type-trunc-Prop A → type-trunc-Prop (A + A)
+ ║ A ║₋₁ → ║ A + A ║₋₁
map-inv-trunc-Prop-diagonal-coproduct =
map-universal-property-trunc-Prop
( trunc-Prop (A + A))
@@ -433,13 +454,13 @@ module _
map-trunc-Prop-diagonal-coproduct
equiv-trunc-Prop-diagonal-coproduct :
- type-trunc-Prop (A + A) ≃ type-trunc-Prop A
+ ║ A + A ║₋₁ ≃ ║ A ║₋₁
pr1 equiv-trunc-Prop-diagonal-coproduct = map-trunc-Prop-diagonal-coproduct
pr2 equiv-trunc-Prop-diagonal-coproduct =
is-equiv-map-trunc-Prop-diagonal-coproduct
inv-equiv-trunc-Prop-diagonal-coproduct :
- type-trunc-Prop A ≃ type-trunc-Prop (A + A)
+ ║ A ║₋₁ ≃ ║ A + A ║₋₁
pr1 inv-equiv-trunc-Prop-diagonal-coproduct =
map-inv-trunc-Prop-diagonal-coproduct
pr2 inv-equiv-trunc-Prop-diagonal-coproduct =
diff --git a/src/foundation/split-surjective-maps.lagda.md b/src/foundation/split-surjective-maps.lagda.md
index 10fb45cb17..be0a77d97c 100644
--- a/src/foundation/split-surjective-maps.lagda.md
+++ b/src/foundation/split-surjective-maps.lagda.md
@@ -95,25 +95,22 @@ module _
retraction-is-split-surjective-is-injective :
is-injective f → is-split-surjective f → retraction f
- pr1 (retraction-is-split-surjective-is-injective l s) = pr1 ∘ s
- pr2 (retraction-is-split-surjective-is-injective l s) = l ∘ pr2 ∘ s ∘ f
+ retraction-is-split-surjective-is-injective l s = (pr1 ∘ s , l ∘ pr2 ∘ s ∘ f)
is-equiv-is-split-surjective-is-injective :
is-injective f → is-split-surjective f → is-equiv f
- pr1 (is-equiv-is-split-surjective-is-injective l s) =
- section-is-split-surjective f s
- pr2 (is-equiv-is-split-surjective-is-injective l s) =
- retraction-is-split-surjective-is-injective l s
+ is-equiv-is-split-surjective-is-injective l s =
+ ( section-is-split-surjective f s ,
+ retraction-is-split-surjective-is-injective l s)
is-split-surjective-is-equiv : is-equiv f → is-split-surjective f
is-split-surjective-is-equiv = is-split-surjective-section f ∘ pr1
is-split-surjective-is-injective-is-equiv :
is-equiv f → is-injective f × is-split-surjective f
- pr1 (is-split-surjective-is-injective-is-equiv is-equiv-f) =
- is-injective-is-equiv is-equiv-f
- pr2 (is-split-surjective-is-injective-is-equiv is-equiv-f) =
- is-split-surjective-is-equiv is-equiv-f
+ is-split-surjective-is-injective-is-equiv is-equiv-f =
+ ( is-injective-is-equiv is-equiv-f ,
+ is-split-surjective-is-equiv is-equiv-f)
```
## See also
diff --git a/src/foundation/standard-apartness-relations.lagda.md b/src/foundation/standard-apartness-relations.lagda.md
index 3a3df40ac0..73ece0d862 100644
--- a/src/foundation/standard-apartness-relations.lagda.md
+++ b/src/foundation/standard-apartness-relations.lagda.md
@@ -25,9 +25,9 @@ open import foundation-core.negation
## Idea
An [apartness relation](foundation.apartness-relations.md) `#` is said to be
-**standard** if the
-[law of excluded middle](foundation.law-of-excluded-middle.md) implies that `#`
-is [equivalent](foundation.logical-equivalences.md) to
+{{#concept "standard" Disambiguation="apartness relation" Agda=is-standard-Apartness-Relation}}
+if the [law of excluded middle](foundation.law-of-excluded-middle.md) implies
+that `#` is [equivalent](foundation.logical-equivalences.md) to
[negated equality](foundation.negated-equality.md).
## Definition
diff --git a/src/foundation/structure.lagda.md b/src/foundation/structure.lagda.md
index 6a5b9217b7..4f5fa67f41 100644
--- a/src/foundation/structure.lagda.md
+++ b/src/foundation/structure.lagda.md
@@ -26,18 +26,31 @@ consists of a type `A` _equipped_ with an element of type `𝒫 A`.
## Definitions
+### Structure at a universe
+
```agda
structure : {l1 l2 : Level} (𝒫 : UU l1 → UU l2) → UU (lsuc l1 ⊔ l2)
structure {l1} 𝒫 = Σ (UU l1) 𝒫
-fam-structure :
- {l1 l2 l3 : Level} (𝒫 : UU l1 → UU l2) (A : UU l3) → UU (lsuc l1 ⊔ l2 ⊔ l3)
-fam-structure 𝒫 A = A → structure 𝒫
+structure-family :
+ {l1 l2 l3 : Level} (𝒫 : UU l1 → UU l2) {A : UU l3} →
+ (A → UU l1) → UU (l2 ⊔ l3)
+structure-family 𝒫 {A} B = (x : A) → 𝒫 (B x)
+
+structured-family :
+ {l1 l2 l3 : Level} (𝒫 : UU l1 → UU l2) → UU l3 → UU (lsuc l1 ⊔ l2 ⊔ l3)
+structured-family 𝒫 A = A → structure 𝒫
structure-map :
{l1 l2 l3 : Level} (𝒫 : UU (l1 ⊔ l2) → UU l3) {A : UU l1} {B : UU l2}
(f : A → B) → UU (l2 ⊔ l3)
-structure-map 𝒫 {A} {B} f = (b : B) → 𝒫 (fiber f b)
+structure-map 𝒫 {A} {B} f = structure-family 𝒫 (fiber f)
+
+structured-map :
+ {l1 l2 l3 : Level}
+ (𝒫 : UU (l1 ⊔ l2) → UU l3)
+ (A : UU l1) (B : UU l2) → UU (l1 ⊔ l2 ⊔ l3)
+structured-map 𝒫 A B = Σ (A → B) (structure-map 𝒫)
hom-structure :
{l1 l2 l3 : Level} (𝒫 : UU (l1 ⊔ l2) → UU l3) →
diff --git a/src/foundation/structured-type-duality.lagda.md b/src/foundation/structured-type-duality.lagda.md
index e7d04bcb07..cdbbcfc227 100644
--- a/src/foundation/structured-type-duality.lagda.md
+++ b/src/foundation/structured-type-duality.lagda.md
@@ -36,7 +36,7 @@ Slice-structure l P B = Σ (UU l) (λ A → hom-structure P A B)
equiv-Fiber-structure :
{l1 l2 : Level} (l : Level) (P : UU (l1 ⊔ l) → UU l2) (B : UU l1) →
- Slice-structure (l1 ⊔ l) P B ≃ fam-structure P B
+ Slice-structure (l1 ⊔ l) P B ≃ structured-family P B
equiv-Fiber-structure {l1} {l3} l P B =
( ( inv-distributive-Π-Σ) ∘e
( equiv-Σ
diff --git a/src/foundation/surjective-maps.lagda.md b/src/foundation/surjective-maps.lagda.md
index f6fc1ffb05..3a233849c0 100644
--- a/src/foundation/surjective-maps.lagda.md
+++ b/src/foundation/surjective-maps.lagda.md
@@ -41,6 +41,7 @@ open import foundation-core.homotopies
open import foundation-core.precomposition-dependent-functions
open import foundation-core.propositional-maps
open import foundation-core.propositions
+open import foundation-core.retracts-of-types
open import foundation-core.sections
open import foundation-core.sets
open import foundation-core.subtypes
@@ -225,6 +226,16 @@ abstract
is-surjective-has-section (g , G) b = unit-trunc-Prop (g b , G b)
```
+### The underlying surjection of a retract
+
+```agda
+surjection-retract :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ A retract-of B → B ↠ A
+surjection-retract R =
+ ( map-retraction-retract R , is-surjective-has-section (section-retract R))
+```
+
### Any split surjective map is surjective
```agda
diff --git a/src/foundation/tight-apartness-relations.lagda.md b/src/foundation/tight-apartness-relations.lagda.md
index f848664137..2247b4443c 100644
--- a/src/foundation/tight-apartness-relations.lagda.md
+++ b/src/foundation/tight-apartness-relations.lagda.md
@@ -10,24 +10,33 @@ module foundation.tight-apartness-relations where
open import foundation.apartness-relations
open import foundation.binary-relations
open import foundation.dependent-pair-types
-open import foundation.function-extensionality
-open import foundation.propositional-truncations
+open import foundation.double-negation
+open import foundation.embeddings
+open import foundation.injective-maps
+open import foundation.negated-equality
+open import foundation.negation
+open import foundation.propositions
+open import foundation.retracts-of-types
open import foundation.universe-levels
open import foundation-core.cartesian-product-types
+open import foundation-core.double-negation-stable-equality
open import foundation-core.identity-types
-open import foundation-core.negation
-open import foundation-core.propositions
+open import foundation-core.sets
+open import foundation-core.subtypes
```
## Idea
-A [relation](foundation.binary-relations.md) `R` is said to be **tight** if for
-every `x y : A` we have `¬ (R x y) → (x = y)`.
+A [relation](foundation.binary-relations.md) `R` is said to be
+{{#concept "tight" Disambiguation="binary relation" Agda=is-tight}} if for every
+`x y : A` we have `¬ (R x y) → (x = y)`.
-## Definition
+## Definitions
+
+### The tightness predicate
```agda
module _
@@ -58,6 +67,14 @@ module _
Apartness-Relation l2 A
apartness-relation-Tight-Apartness-Relation = pr1 R
+ rel-Tight-Apartness-Relation : Relation-Prop l2 A
+ rel-Tight-Apartness-Relation =
+ rel-Apartness-Relation apartness-relation-Tight-Apartness-Relation
+
+ apart-Tight-Apartness-Relation : Relation l2 A
+ apart-Tight-Apartness-Relation =
+ apart-Apartness-Relation apartness-relation-Tight-Apartness-Relation
+
is-tight-apartness-relation-Tight-Apartness-Relation :
is-tight-Apartness-Relation apartness-relation-Tight-Apartness-Relation
is-tight-apartness-relation-Tight-Apartness-Relation = pr2 R
@@ -71,6 +88,12 @@ Type-With-Tight-Apartness l1 l2 =
Σ ( Type-With-Apartness l1 l2)
( λ X → is-tight (rel-apart-Type-With-Apartness X))
+make-Type-With-Tight-Apartness :
+ {l1 l2 : Level} {X : UU l1} →
+ Tight-Apartness-Relation l2 X →
+ Type-With-Tight-Apartness l1 l2
+make-Type-With-Tight-Apartness {X = X} (R , t) = ((X , R) , t)
+
module _
{l1 l2 : Level} (X : Type-With-Tight-Apartness l1 l2)
where
@@ -82,6 +105,12 @@ module _
type-Type-With-Tight-Apartness =
type-Type-With-Apartness type-with-apartness-Type-With-Tight-Apartness
+ apartness-relation-Type-With-Tight-Apartness :
+ Apartness-Relation l2 type-Type-With-Tight-Apartness
+ apartness-relation-Type-With-Tight-Apartness =
+ apartness-relation-Type-With-Apartness
+ ( type-with-apartness-Type-With-Tight-Apartness)
+
rel-apart-Type-With-Tight-Apartness :
Relation-Prop l2 type-Type-With-Tight-Apartness
rel-apart-Type-With-Tight-Apartness =
@@ -92,38 +121,166 @@ module _
apart-Type-With-Tight-Apartness =
apart-Type-With-Apartness type-with-apartness-Type-With-Tight-Apartness
+ antirefl-apart-Type-With-Tight-Apartness :
+ is-antireflexive rel-apart-Type-With-Tight-Apartness
+ antirefl-apart-Type-With-Tight-Apartness =
+ antirefl-apart-Type-With-Apartness
+ type-with-apartness-Type-With-Tight-Apartness
+
+ consistent-apart-Type-With-Tight-Apartness :
+ is-consistent rel-apart-Type-With-Tight-Apartness
+ consistent-apart-Type-With-Tight-Apartness =
+ consistent-apart-Type-With-Apartness
+ type-with-apartness-Type-With-Tight-Apartness
+
+ symmetric-apart-Type-With-Tight-Apartness :
+ is-symmetric apart-Type-With-Tight-Apartness
+ symmetric-apart-Type-With-Tight-Apartness =
+ symmetric-apart-Type-With-Apartness
+ type-with-apartness-Type-With-Tight-Apartness
+
+ cotransitive-apart-Type-With-Tight-Apartness :
+ is-cotransitive rel-apart-Type-With-Tight-Apartness
+ cotransitive-apart-Type-With-Tight-Apartness =
+ cotransitive-apart-Type-With-Apartness
+ type-with-apartness-Type-With-Tight-Apartness
+
is-tight-apart-Type-With-Tight-Apartness :
is-tight rel-apart-Type-With-Tight-Apartness
is-tight-apart-Type-With-Tight-Apartness = pr2 X
+
+ tight-apartness-relation-Type-With-Tight-Apartness :
+ Tight-Apartness-Relation l2 type-Type-With-Tight-Apartness
+ tight-apartness-relation-Type-With-Tight-Apartness =
+ ( apartness-relation-Type-With-Tight-Apartness ,
+ is-tight-apart-Type-With-Tight-Apartness)
```
## Properties
-### The apartness relation of functions into a type with tight apartness is tight
+### Restricting tight apartness along injections
```agda
-is-tight-apartness-function-into-Type-With-Tight-Apartness :
- {l1 l2 l3 : Level} {X : UU l1} (Y : Type-With-Tight-Apartness l2 l3) →
- is-tight
- ( rel-apart-function-into-Type-With-Apartness X
- ( type-with-apartness-Type-With-Tight-Apartness Y))
-is-tight-apartness-function-into-Type-With-Tight-Apartness Y f g H =
- eq-htpy
- ( λ x →
- is-tight-apart-Type-With-Tight-Apartness Y
- ( f x)
- ( g x)
- ( λ u → H ( unit-trunc-Prop (x , u))))
-
-exp-Type-With-Tight-Apartness :
- {l1 l2 l3 : Level} (X : UU l1) → Type-With-Tight-Apartness l2 l3 →
- Type-With-Tight-Apartness (l1 ⊔ l2) (l1 ⊔ l3)
-pr1 (exp-Type-With-Tight-Apartness X Y) =
- exp-Type-With-Apartness X (type-with-apartness-Type-With-Tight-Apartness Y)
-pr2 (exp-Type-With-Tight-Apartness X Y) =
- is-tight-apartness-function-into-Type-With-Tight-Apartness Y
+is-tight-restriction-Relation-Prop :
+ {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2}
+ (f : injection X Y)
+ (R : Relation-Prop l3 Y) → is-tight R →
+ is-tight (restriction-Relation-Prop (map-injection f) R)
+is-tight-restriction-Relation-Prop f R H x x' np =
+ is-injective-injection f (H (map-injection f x) (map-injection f x') np)
+
+restriction-Tight-Apartness-Relation :
+ {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2} →
+ injection X Y → Tight-Apartness-Relation l3 Y → Tight-Apartness-Relation l3 X
+restriction-Tight-Apartness-Relation f R =
+ ( restriction-Apartness-Relation
+ ( map-injection f)
+ ( apartness-relation-Tight-Apartness-Relation R)) ,
+ ( is-tight-restriction-Relation-Prop f
+ ( rel-Tight-Apartness-Relation R)
+ ( is-tight-apartness-relation-Tight-Apartness-Relation R))
+```
+
+### Restricting tight apartness along embeddings
+
+```agda
+restriction-emb-Tight-Apartness-Relation :
+ {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2} →
+ X ↪ Y → Tight-Apartness-Relation l3 Y → Tight-Apartness-Relation l3 X
+restriction-emb-Tight-Apartness-Relation f =
+ restriction-Tight-Apartness-Relation (injection-emb f)
+```
+
+### Restricting tight apartness along retracts
+
+```agda
+restriction-retract-Tight-Apartness-Relation :
+ {l1 l2 l3 : Level} {X : UU l1} {Y : UU l2} →
+ X retract-of Y → Tight-Apartness-Relation l3 Y → Tight-Apartness-Relation l3 X
+restriction-retract-Tight-Apartness-Relation R =
+ restriction-Tight-Apartness-Relation (injection-retract R)
+```
+
+### Tight apartness on subtypes
+
+```agda
+type-subtype-Tight-Apartness-Relation :
+ {l1 l2 l3 : Level} {X : UU l1} (P : subtype l2 X) →
+ Tight-Apartness-Relation l3 X → Tight-Apartness-Relation l3 (type-subtype P)
+type-subtype-Tight-Apartness-Relation P R =
+ restriction-Tight-Apartness-Relation (injection-subtype P) R
+
+subtype-Type-With-Tight-Apartness :
+ {l1 l2 l3 : Level}
+ ( X : Type-With-Tight-Apartness l1 l2)
+ ( P : subtype l3 (type-Type-With-Tight-Apartness X)) →
+ Type-With-Tight-Apartness (l1 ⊔ l3) l2
+subtype-Type-With-Tight-Apartness X P =
+ make-Type-With-Tight-Apartness
+ ( type-subtype-Tight-Apartness-Relation P
+ ( tight-apartness-relation-Type-With-Tight-Apartness X))
+```
+
+### Types with tight apartness relations have double negation stable equality
+
+```agda
+has-double-negation-stable-equality-has-tight-antireflexive-relation :
+ {l1 l2 : Level} {A : UU l1} {R : A → A → UU l2} →
+ ((x : A) → ¬ (R x x)) → ((x y : A) → ¬ (R x y) → x = y) →
+ has-double-negation-stable-equality A
+has-double-negation-stable-equality-has-tight-antireflexive-relation
+ H K x y nnp =
+ K x y (elim-triple-negation (map-double-negation (rec-Id x (H x) y) nnp))
+
+has-double-negation-stable-equality-type-Type-With-Tight-Apartness :
+ {l1 l2 : Level} (A : Type-With-Tight-Apartness l1 l2) →
+ has-double-negation-stable-equality (type-Type-With-Tight-Apartness A)
+has-double-negation-stable-equality-type-Type-With-Tight-Apartness A =
+ has-double-negation-stable-equality-has-tight-antireflexive-relation
+ ( antirefl-apart-Type-With-Tight-Apartness A)
+ ( is-tight-apart-Type-With-Tight-Apartness A)
+```
+
+### A type with double negation stable equality is a type whose negated equality relation is tight
+
+```agda
+is-tight-nonequal-has-double-negation-stable-equality :
+ {l : Level} {A : UU l} →
+ has-double-negation-stable-equality A →
+ is-tight (nonequal-Prop {A = A})
+is-tight-nonequal-has-double-negation-stable-equality H x y = H x y
+```
+
+### Types with tight apartness relations are sets
+
+```agda
+is-set-has-tight-antireflexive-relation :
+ {l1 l2 : Level} {A : UU l1} {R : A → A → UU l2} →
+ ((x : A) → ¬ (R x x)) → ((x y : A) → ¬ (R x y) → x = y) → is-set A
+is-set-has-tight-antireflexive-relation {R = R} =
+ is-set-prop-in-id (λ x y → ¬ (R x y)) (λ x y → is-prop-neg)
+
+is-set-type-Type-With-Tight-Apartness :
+ {l1 l2 : Level} (A : Type-With-Tight-Apartness l1 l2) →
+ is-set (type-Type-With-Tight-Apartness A)
+is-set-type-Type-With-Tight-Apartness A =
+ is-set-has-tight-antireflexive-relation
+ ( antirefl-apart-Type-With-Tight-Apartness A)
+ ( is-tight-apart-Type-With-Tight-Apartness A)
+
+set-Type-With-Tight-Apartness :
+ {l1 l2 : Level} (A : Type-With-Tight-Apartness l1 l2) →
+ Set l1
+set-Type-With-Tight-Apartness A =
+ ( type-Type-With-Tight-Apartness A , is-set-type-Type-With-Tight-Apartness A)
```
## References
{{#bibliography}} {{#reference MRR88}}
+
+## See also
+
+- Every tight apartness relation is
+ [standard](foundation.standard-apartness-relations.md).
+- [Dependent function types with apartness relations](foundation.dependent-function-types-with-apartness-relations.md)
diff --git a/src/foundation/types-with-decidable-dependent-pair-types.lagda.md b/src/foundation/types-with-decidable-dependent-pair-types.lagda.md
new file mode 100644
index 0000000000..f83476e0a3
--- /dev/null
+++ b/src/foundation/types-with-decidable-dependent-pair-types.lagda.md
@@ -0,0 +1,635 @@
+# Types with decidable Σ-types
+
+```agda
+module foundation.types-with-decidable-dependent-pair-types where
+```
+
+Imports
+
+```agda
+open import elementary-number-theory.natural-numbers
+
+open import foundation.booleans
+open import foundation.cartesian-product-types
+open import foundation.coproduct-types
+open import foundation.decidable-embeddings
+open import foundation.decidable-propositions
+open import foundation.decidable-subtypes
+open import foundation.decidable-type-families
+open import foundation.decidable-types
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.empty-types
+open import foundation.equivalences
+open import foundation.function-types
+open import foundation.functoriality-coproduct-types
+open import foundation.functoriality-dependent-pair-types
+open import foundation.identity-types
+open import foundation.irrefutable-equality
+open import foundation.logical-operations-booleans
+open import foundation.negation
+open import foundation.retracts-of-types
+open import foundation.surjective-maps
+open import foundation.transport-along-identifications
+open import foundation.type-arithmetic-dependent-pair-types
+open import foundation.type-arithmetic-unit-type
+open import foundation.unit-type
+open import foundation.universe-levels
+
+open import logic.double-negation-dense-maps
+
+open import univalent-combinatorics.counting
+open import univalent-combinatorics.standard-finite-types
+```
+
+
+
+## Idea
+
+A type `X`
+{{#concept "has decidable Σ-types" Disambiguation="on type" Agda=has-decidable-Σ}}
+if for every [decidable type family](foundation.decidable-type-families.md) `P`,
+we can construct an element in some fiber of `P` or determine that `P` is the
+empty family. In other words, we have a witness of type
+
+```text
+ (P : decidable-family X) → is-decidable (Σ x. P x).
+```
+
+**Terminology.** In the terminology of Martín Escardó, a type that has decidable
+Σ-types for families of propositions is referred to as _searchable_,
+_exhaustively searchable_, _exhaustibly searchable_, _exhaustible_,
+_omniscient_, _satisfying the principle of omniscience_, _compact_, or
+_Σ-compact_. {{#cite Esc08}} {{#cite TypeTopology}}
+
+## Definitions
+
+### The predicate of having decidable Σ-types
+
+```agda
+has-decidable-Σ-Level : {l1 : Level} (l2 : Level) → UU l1 → UU (l1 ⊔ lsuc l2)
+has-decidable-Σ-Level l2 X =
+ (P : decidable-family l2 X) → is-decidable (Σ X (family-decidable-family P))
+
+has-decidable-Σ : {l1 : Level} → UU l1 → UUω
+has-decidable-Σ X = {l2 : Level} → has-decidable-Σ-Level l2 X
+```
+
+### The predicate of having small decidable Σ-types
+
+```agda
+has-decidable-Σ-bool : {l1 : Level} → UU l1 → UU l1
+has-decidable-Σ-bool X = (b : X → bool) → is-decidable (Σ X (is-true ∘ b))
+```
+
+### The type of types with decidable Σ-types
+
+```agda
+record Type-With-Decidable-Σ (l : Level) : UUω
+ where
+ field
+ type-Type-With-Decidable-Σ : UU l
+
+ has-decidable-Σ-type-Type-With-Decidable-Σ :
+ has-decidable-Σ type-Type-With-Decidable-Σ
+
+open Type-With-Decidable-Σ public
+```
+
+### The predicate of having decidable Σ-types on subtypes
+
+```agda
+has-decidable-type-subtype-Level :
+ {l1 : Level} (l2 : Level) → UU l1 → UU (l1 ⊔ lsuc l2)
+has-decidable-type-subtype-Level l2 X =
+ (P : decidable-subtype l2 X) → is-decidable (Σ X (is-in-decidable-subtype P))
+
+has-decidable-type-subtype : {l1 : Level} → UU l1 → UUω
+has-decidable-type-subtype X =
+ {l2 : Level} → has-decidable-type-subtype-Level l2 X
+```
+
+### The predicate of pointedly having decidable Σ-types
+
+```agda
+has-decidable-Σ-pointed-Level :
+ {l1 : Level} (l2 : Level) → UU l1 → UU (l1 ⊔ lsuc l2)
+has-decidable-Σ-pointed-Level l2 X =
+ ( P : decidable-family l2 X) →
+ Σ X
+ ( λ x₀ →
+ family-decidable-family P x₀ → (x : X) → family-decidable-family P x)
+
+has-decidable-Σ-pointed : {l1 : Level} → UU l1 → UUω
+has-decidable-Σ-pointed X = {l2 : Level} → has-decidable-Σ-pointed-Level l2 X
+```
+
+### The predicate of pointedly having decidable Σ-types on subtypes
+
+```agda
+has-decidable-type-subtype-pointed-Level :
+ {l1 : Level} (l2 : Level) → UU l1 → UU (l1 ⊔ lsuc l2)
+has-decidable-type-subtype-pointed-Level l2 X =
+ ( P : decidable-subtype l2 X) →
+ Σ X
+ ( λ x₀ →
+ is-in-decidable-subtype P x₀ → (x : X) → is-in-decidable-subtype P x)
+
+has-decidable-type-subtype-pointed : {l1 : Level} → UU l1 → UUω
+has-decidable-type-subtype-pointed X =
+ {l2 : Level} → has-decidable-type-subtype-pointed-Level l2 X
+```
+
+### The small predicate of pointedly having decidable Σ-types
+
+```agda
+has-decidable-Σ-pointed-bool : {l : Level} → UU l → UU l
+has-decidable-Σ-pointed-bool X =
+ (b : X → bool) → Σ X (λ x₀ → is-true (b x₀) → (x : X) → is-true (b x))
+
+has-decidable-Σ-pointed-bool' : {l : Level} → UU l → UU l
+has-decidable-Σ-pointed-bool' X =
+ (b : X → bool) → Σ X (λ x₀ → is-false (b x₀) → (x : X) → is-false (b x))
+```
+
+## Properties
+
+### Types with decidable Σ-types are decidable
+
+```agda
+is-decidable-type-has-decidable-Σ :
+ {l1 : Level} {X : UU l1} → has-decidable-Σ X → is-decidable X
+is-decidable-type-has-decidable-Σ f =
+ is-decidable-equiv'
+ ( right-unit-law-product)
+ ( f ((λ _ → unit) , (λ _ → inl star)))
+```
+
+### Types with decidable Σ-types on subtypes have decidable Σ-types
+
+```agda
+abstract
+ has-decidable-Σ-has-decidable-type-subtype :
+ {l1 : Level} {X : UU l1} →
+ has-decidable-type-subtype X → has-decidable-Σ X
+ has-decidable-Σ-has-decidable-type-subtype f P =
+ map-coproduct
+ ( λ xp →
+ pr1 xp ,
+ rec-coproduct
+ ( id)
+ ( ex-falso ∘ pr2 xp)
+ ( is-decidable-decidable-family P (pr1 xp)))
+ ( λ nxp xp → nxp (pr1 xp , intro-double-negation (pr2 xp)))
+ ( f ( λ x →
+ neg-type-Decidable-Prop
+ ( ¬ (family-decidable-family P x))
+ ( is-decidable-neg (is-decidable-decidable-family P x))))
+```
+
+### A type has decidable Σ-types if and only if it satisfies the small predicate of having decidable Σ-types
+
+```agda
+module _
+ {l : Level} {X : UU l}
+ where
+
+ has-decidable-type-subtype-has-decidable-Σ-bool :
+ has-decidable-Σ-bool X → has-decidable-type-subtype X
+ has-decidable-type-subtype-has-decidable-Σ-bool f P =
+ is-decidable-equiv
+ ( equiv-tot (compute-equiv-bool-Decidable-Prop ∘ P))
+ ( f (bool-Decidable-Prop ∘ P))
+
+ abstract
+ has-decidable-Σ-has-decidable-Σ-bool :
+ has-decidable-Σ-bool X → has-decidable-Σ X
+ has-decidable-Σ-has-decidable-Σ-bool f =
+ has-decidable-Σ-has-decidable-type-subtype
+ ( has-decidable-type-subtype-has-decidable-Σ-bool
+ ( f))
+
+ has-decidable-Σ-bool-has-decidable-type-subtype :
+ has-decidable-type-subtype X → has-decidable-Σ-bool X
+ has-decidable-Σ-bool-has-decidable-type-subtype f P =
+ f (is-true-Decidable-Prop ∘ P)
+
+ has-decidable-Σ-bool-has-decidable-Σ :
+ has-decidable-Σ X → has-decidable-Σ-bool X
+ has-decidable-Σ-bool-has-decidable-Σ f P =
+ f (is-true ∘ P , λ x → has-decidable-equality-bool (P x) true)
+```
+
+### A pointed type with decidable Σ-types has pointedly decidable Σ-types
+
+```agda
+has-decidable-Σ-pointed-has-decidable-Σ-has-element :
+ {l : Level} {X : UU l} →
+ X → has-decidable-Σ X → has-decidable-Σ-pointed X
+has-decidable-Σ-pointed-has-decidable-Σ-has-element x₀ f P =
+ rec-coproduct
+ ( λ xr → (pr1 xr , ex-falso ∘ pr2 xr))
+ ( λ nx →
+ ( x₀ ,
+ λ _ x →
+ rec-coproduct
+ ( id)
+ ( λ npx → ex-falso (nx (x , npx)))
+ ( is-decidable-decidable-family P x)))
+ ( f (neg-decidable-family P))
+```
+
+### The two small predicate of pointedly having decidable Σ-types are equivalent
+
+```agda
+flip-has-decidable-Σ-pointed-bool :
+ {l : Level} {X : UU l} →
+ has-decidable-Σ-pointed-bool' X →
+ has-decidable-Σ-pointed-bool X
+pr1 (flip-has-decidable-Σ-pointed-bool H b) = pr1 (H (neg-bool ∘ b))
+pr2 (flip-has-decidable-Σ-pointed-bool H b) p x =
+ is-true-is-false-neg-bool
+ ( pr2
+ ( H (neg-bool ∘ b))
+ ( is-false-is-true-neg-bool
+ ( is-involution-neg-bool (b (pr1 (H (neg-bool ∘ b)))) ∙ p))
+ ( x))
+```
+
+> The converse remains to be formalized.
+
+### A type has pointedly decidable Σ-types if and only if it pointedly has small decidable Σ-types
+
+```agda
+abstract
+ has-decidable-type-subtype-pointed-has-decidable-Σ-pointed-bool :
+ {l : Level} {X : UU l} →
+ has-decidable-Σ-pointed-bool X →
+ has-decidable-type-subtype-pointed X
+ has-decidable-type-subtype-pointed-has-decidable-Σ-pointed-bool
+ f P =
+ ( pr1 (f (bool-Decidable-Prop ∘ P))) ,
+ ( λ Px₀ x →
+ map-inv-equiv
+ ( compute-equiv-bool-Decidable-Prop (P x))
+ ( pr2
+ ( f (bool-Decidable-Prop ∘ P))
+ ( map-equiv
+ ( compute-equiv-bool-Decidable-Prop
+ ( P (pr1 (f (bool-Decidable-Prop ∘ P)))))
+ ( Px₀))
+ ( x)))
+
+has-decidable-Σ-pointed-bool-has-decidable-type-subtype-pointed :
+ {l : Level} {X : UU l} →
+ has-decidable-type-subtype-pointed X →
+ has-decidable-Σ-pointed-bool X
+has-decidable-Σ-pointed-bool-has-decidable-type-subtype-pointed
+ f b =
+ f (is-true-Decidable-Prop ∘ b)
+```
+
+### Types that pointedly have decidable Σ-types on subtypes has pointedly decidable Σ-types
+
+```agda
+abstract
+ has-decidable-Σ-pointed-has-decidable-type-subtype-pointed :
+ {l1 : Level} {X : UU l1} →
+ has-decidable-type-subtype-pointed X →
+ has-decidable-Σ-pointed X
+ has-decidable-Σ-pointed-has-decidable-type-subtype-pointed
+ {X = X} f P =
+ ( pr1 g) ,
+ ( λ p x →
+ rec-coproduct
+ ( id)
+ ( ex-falso ∘ pr2 g (intro-double-negation p) x)
+ ( is-decidable-decidable-family P x))
+ where
+ g : Σ X
+ ( λ x₀ →
+ ¬¬ (family-decidable-family P x₀) →
+ (x : X) → ¬¬ (family-decidable-family P x))
+ g =
+ f
+ ( λ x →
+ neg-type-Decidable-Prop
+ ( ¬ (family-decidable-family P x))
+ ( is-decidable-neg (is-decidable-decidable-family P x)))
+```
+
+### Types that pointedly have decidable Σ-types have decidable Σ-types
+
+```text
+is-decidable-Σ-is-this-other-thing :
+ {l1 l2 : Level} {X : UU l1} {Y : X → UU l2} →
+ ((x : X) → ¬ (Y x)) → ¬ (Σ X Y)
+is-decidable-Σ-is-this-other-thing f xp = f (pr1 xp) (pr2 xp)
+
+has-decidable-Σ-has-decidable-Σ-pointed :
+ {l : Level} {X : UU l} →
+ has-decidable-Σ-pointed X → has-decidable-Σ X
+has-decidable-Σ-has-decidable-Σ-pointed {X = X} f P =
+ map-coproduct
+ ( pair (pr1 (f P)))
+ ( λ np xp → np TODO)
+ ( is-decidable-decidable-family P (pr1 (f P)))
+ where postulate TODO : _ -- TODO
+```
+
+### Having decidable Σ-types transfers along double negation dense maps
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} (h : X ↠¬¬ Y)
+ where
+
+ has-decidable-Σ-double-negation-dense-map :
+ has-decidable-Σ X → has-decidable-Σ Y
+ has-decidable-Σ-double-negation-dense-map f P =
+ map-coproduct
+ ( λ xp → map-double-negation-dense-map h (pr1 xp) , pr2 xp)
+ ( λ nxpf yp →
+ is-double-negation-dense-map-double-negation-dense-map
+ ( h)
+ ( pr1 yp)
+ ( λ xr →
+ nxpf
+ ( pr1 xr ,
+ tr (family-decidable-family P) (inv (pr2 xr)) (pr2 yp))))
+ ( f (reindex-decidable-family P (map-double-negation-dense-map h)))
+```
+
+### Having decidable Σ-types transfers along surjections
+
+```agda
+has-decidable-Σ-surjection :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ↠ Y →
+ has-decidable-Σ X → has-decidable-Σ Y
+has-decidable-Σ-surjection h =
+ has-decidable-Σ-double-negation-dense-map
+ ( double-negation-dense-map-surjection h)
+```
+
+### Types with decidable Σ-types are closed under retracts
+
+```agda
+has-decidable-Σ-retract :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} →
+ Y retract-of X → has-decidable-Σ X → has-decidable-Σ Y
+has-decidable-Σ-retract R =
+ has-decidable-Σ-double-negation-dense-map
+ ( double-negation-dense-map-retract R)
+```
+
+### Types with decidable Σ-types are closed under equivalences
+
+```agda
+has-decidable-Σ-equiv :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} →
+ Y ≃ X → has-decidable-Σ X → has-decidable-Σ Y
+has-decidable-Σ-equiv e =
+ has-decidable-Σ-retract (retract-equiv e)
+
+has-decidable-Σ-equiv' :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} →
+ X ≃ Y → has-decidable-Σ X → has-decidable-Σ Y
+has-decidable-Σ-equiv' e =
+ has-decidable-Σ-retract (retract-inv-equiv e)
+```
+
+### Decidable types with double negation dense equality have decidable Σ-types
+
+```agda
+has-decidable-Σ-is-decidable-has-double-negation-dense-equality :
+ {l1 : Level} {X : UU l1} → has-double-negation-dense-equality X →
+ is-decidable X → has-decidable-Σ X
+has-decidable-Σ-is-decidable-has-double-negation-dense-equality
+ H d P =
+ is-decidable-Σ-has-double-negation-dense-equality-base H d
+ ( is-decidable-decidable-family P)
+```
+
+**Comment.** It might suffice for the above result that `X` is inhabited or
+empty.
+
+### Decidable subtypes of types with decidable Σ-types have decidable Σ-types
+
+```agda
+has-decidable-Σ-type-decidable-subtype :
+ {l1 l2 : Level} {X : UU l1} →
+ has-decidable-Σ X →
+ (P : decidable-subtype l2 X) →
+ has-decidable-Σ (type-decidable-subtype P)
+has-decidable-Σ-type-decidable-subtype {X = X} f P Q =
+ is-decidable-equiv
+ ( associative-Σ X (is-in-decidable-subtype P) (family-decidable-family Q))
+ ( f ( comp-decidable-family-decidable-subtype P
+ ( reindex-decidable-family Q ∘ pair)))
+
+has-decidable-Σ-decidable-emb :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} →
+ has-decidable-Σ X → Y ↪ᵈ X → has-decidable-Σ Y
+has-decidable-Σ-decidable-emb f h =
+ has-decidable-Σ-equiv'
+ ( compute-type-decidable-subtype-decidable-emb h)
+ ( has-decidable-Σ-type-decidable-subtype f
+ ( decidable-subtype-decidable-emb h))
+```
+
+### The empty type has decidable Σ-types
+
+```agda
+has-decidable-Σ-empty : has-decidable-Σ empty
+has-decidable-Σ-empty P = inr pr1
+```
+
+### The unit type has decidable Σ-types
+
+```agda
+has-decidable-Σ-unit : has-decidable-Σ unit
+has-decidable-Σ-unit P =
+ rec-coproduct
+ ( inl ∘ pair star)
+ ( inr ∘ map-neg pr2)
+ ( is-decidable-decidable-family P star)
+```
+
+### Coproducts of types with decidable Σ-types
+
+Coproducts of types with decidable Σ-types have decidable Σ-types. Conversely,
+if the coproduct has decidable Σ-types and a summand has an element, then that
+summand also has decidable Σ-types.
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2}
+ where
+
+ has-decidable-Σ-coproduct :
+ has-decidable-Σ X →
+ has-decidable-Σ Y →
+ has-decidable-Σ (X + Y)
+ has-decidable-Σ-coproduct f g P =
+ rec-coproduct
+ ( λ xp → inl (inl (pr1 xp) , pr2 xp))
+ ( λ nx →
+ rec-coproduct
+ ( λ yp → inl (inr (pr1 yp) , pr2 yp))
+ ( λ ny →
+ inr
+ ( λ where
+ (inl x , p) → nx (x , p)
+ (inr y , p) → ny (y , p)))
+ ( g (reindex-decidable-family P inr)))
+ ( f (reindex-decidable-family P inl))
+
+ has-decidable-Σ-left-summand-coproduct :
+ has-decidable-Σ (X + Y) →
+ X → has-decidable-Σ X
+ has-decidable-Σ-left-summand-coproduct f x =
+ has-decidable-Σ-retract (retract-left-summand-coproduct x) f
+
+ has-decidable-Σ-right-summand-coproduct :
+ has-decidable-Σ (X + Y) →
+ Y → has-decidable-Σ Y
+ has-decidable-Σ-right-summand-coproduct f y =
+ has-decidable-Σ-retract (retract-right-summand-coproduct y) f
+```
+
+### Dependent sums of types with decidable Σ-types
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ where
+
+ has-decidable-Σ-Σ :
+ has-decidable-Σ A →
+ ((x : A) → has-decidable-Σ (B x)) →
+ has-decidable-Σ (Σ A B)
+ has-decidable-Σ-Σ f g {l} P =
+ is-decidable-equiv
+ ( associative-Σ A B (family-decidable-family P))
+ ( f ( ( λ x → Σ (B x) (λ y → family-decidable-family P (x , y))) ,
+ ( λ x → g x (reindex-decidable-family P (λ b → (x , b))))))
+```
+
+### The total space of decidable families of types with double negation dense equality over types with decidable Σ-types have decidable Σ-types
+
+```agda
+abstract
+ has-decidable-Σ-Σ-decidable-family-has-double-negation-dense-equality :
+ {l1 l2 : Level} {X : UU l1} →
+ has-decidable-Σ X →
+ (P : decidable-family l2 X) →
+ ( (x : X) →
+ has-double-negation-dense-equality (family-decidable-family P x)) →
+ has-decidable-Σ (Σ X (family-decidable-family P))
+ has-decidable-Σ-Σ-decidable-family-has-double-negation-dense-equality
+ f P H =
+ has-decidable-Σ-Σ f
+ ( λ x →
+ has-decidable-Σ-is-decidable-has-double-negation-dense-equality
+ ( H x)
+ ( is-decidable-decidable-family P x))
+```
+
+### Dependent sums of types with decidable Σ-types
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ where
+
+ has-decidable-Σ-base-has-decidable-Σ-Σ :
+ has-decidable-Σ (Σ A B) →
+ ((x : A) → B x) →
+ has-decidable-Σ A
+ has-decidable-Σ-base-has-decidable-Σ-Σ f s =
+ has-decidable-Σ-retract (retract-base-Σ-section-family s) f
+```
+
+### Products of types with decidable Σ-types
+
+```agda
+has-decidable-Σ-product :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ has-decidable-Σ A → has-decidable-Σ B → has-decidable-Σ (A × B)
+has-decidable-Σ-product f g = has-decidable-Σ-Σ f (λ _ → g)
+```
+
+### Factors of products with decidable Σ-types
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2}
+ where
+
+ has-decidable-Σ-left-factor-product :
+ has-decidable-Σ (X × Y) → Y → has-decidable-Σ X
+ has-decidable-Σ-left-factor-product f y =
+ has-decidable-Σ-retract (retract-left-factor-product y) f
+
+ has-decidable-Σ-right-factor-product :
+ has-decidable-Σ (X × Y) → X → has-decidable-Σ Y
+ has-decidable-Σ-right-factor-product f x =
+ has-decidable-Σ-retract (retract-right-factor-product x) f
+```
+
+### Standard finite types have decidable Σ-types
+
+```agda
+has-decidable-Σ-Fin : (n : ℕ) → has-decidable-Σ (Fin n)
+has-decidable-Σ-Fin zero-ℕ = has-decidable-Σ-empty
+has-decidable-Σ-Fin (succ-ℕ n) =
+ has-decidable-Σ-coproduct
+ ( has-decidable-Σ-Fin n)
+ ( has-decidable-Σ-unit)
+```
+
+### Types equipped with a counting have decidable Σ-types
+
+```agda
+has-decidable-Σ-count :
+ {l : Level} {X : UU l} → count X → has-decidable-Σ X
+has-decidable-Σ-count f =
+ has-decidable-Σ-equiv'
+ ( equiv-count f)
+ ( has-decidable-Σ-Fin (number-of-elements-count f))
+```
+
+### The booleans have decidable Σ-types
+
+```agda
+has-decidable-Σ-bool' : has-decidable-Σ bool
+has-decidable-Σ-bool' =
+ has-decidable-Σ-equiv' (equiv-bool-Fin-2) (has-decidable-Σ-Fin 2)
+```
+
+### The subuniverse of propositions has decidable Σ-types
+
+```agda
+-- has-decidable-Σ-Prop : {l : Level} → has-decidable-Σ (Prop l)
+-- has-decidable-Σ-Prop {l} P =
+-- rec-coproduct
+-- ( λ p → inl (raise-unit-Prop l , p))
+-- ( λ np →
+-- rec-coproduct
+-- ( λ q → inl (raise-empty-Prop l , q))
+-- ( λ nq → inr {! !})
+-- ( is-decidable-decidable-family P (raise-empty-Prop l)))
+-- ( is-decidable-decidable-family P (raise-unit-Prop l))
+```
+
+> The above results depends on certain properties of the subuniverse of
+> propositions that are not formalized at the time of writing.
+
+## References
+
+{{#bibliography}}
+
+## See also
+
+- [Types with decidable Π-types](foundation.types-with-decidable-dependent-product-types.md)
+- [Types with decidable universal quantifications](foundation.types-with-decidable-universal-quantification.md)
diff --git a/src/foundation/types-with-decidable-dependent-product-types.lagda.md b/src/foundation/types-with-decidable-dependent-product-types.lagda.md
new file mode 100644
index 0000000000..1753132e52
--- /dev/null
+++ b/src/foundation/types-with-decidable-dependent-product-types.lagda.md
@@ -0,0 +1,402 @@
+# Types with decidable Π-types
+
+```agda
+module foundation.types-with-decidable-dependent-product-types where
+```
+
+Imports
+
+```agda
+open import elementary-number-theory.natural-numbers
+
+open import foundation.booleans
+open import foundation.cartesian-product-types
+open import foundation.coproduct-types
+open import foundation.decidable-embeddings
+open import foundation.decidable-subtypes
+open import foundation.decidable-type-families
+open import foundation.decidable-types
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.empty-types
+open import foundation.equivalences
+open import foundation.function-types
+open import foundation.functoriality-coproduct-types
+open import foundation.functoriality-dependent-pair-types
+open import foundation.irrefutable-equality
+open import foundation.propositions
+open import foundation.retracts-of-types
+open import foundation.surjective-maps
+open import foundation.transport-along-identifications
+open import foundation.types-with-decidable-dependent-pair-types
+open import foundation.unit-type
+open import foundation.universal-property-dependent-pair-types
+open import foundation.universe-levels
+
+open import logic.de-morgan-types
+open import logic.double-negation-dense-maps
+
+open import univalent-combinatorics.counting
+open import univalent-combinatorics.standard-finite-types
+```
+
+
+
+## Idea
+
+A type `X` {{#concept "has decidable Π-types" Agda=has-decidable-Π}} if for
+every [decidable type family](foundation.decidable-type-families.md) `P` on `X`,
+we can compute a section of `P`, `(x : X) → P x`, or determine that no such
+section exists. In other words, we have a witness of type
+
+```text
+ (P : decidable-family X) → is-decidable (Π x. P x).
+```
+
+**Terminology.** In the terminology of Martín Escardó, a type that has decidable
+Π-types is referred to as _weakly compact_, _Π-compact_, or _satisfying the weak
+principle of omniscience_. {{#cite TypeTopology}}
+
+## Definitions
+
+### The predicate of having decidable Π-types
+
+```agda
+has-decidable-Π-Level :
+ {l1 : Level} (l2 : Level) → UU l1 → UU (l1 ⊔ lsuc l2)
+has-decidable-Π-Level l2 X =
+ (P : decidable-family l2 X) →
+ is-decidable ((x : X) → family-decidable-family P x)
+
+has-decidable-Π : {l1 : Level} → UU l1 → UUω
+has-decidable-Π X =
+ {l2 : Level} → has-decidable-Π-Level l2 X
+```
+
+### The type of types with decidable Π-types
+
+```agda
+record Type-With-Decidable-Π (l : Level) : UUω
+ where
+ field
+ type-Type-With-Decidable-Π : UU l
+
+ has-decidable-Π-type-Type-With-Decidable-Π :
+ has-decidable-Π type-Type-With-Decidable-Π
+```
+
+## Properties
+
+### Types with decidable Π-types are De Morgan
+
+```agda
+is-de-morgan-has-decidable-Π-Prop :
+ {l1 : Level} {X : UU l1} → has-decidable-Π X → is-de-morgan X
+is-de-morgan-has-decidable-Π-Prop f =
+ f ((λ _ → empty) , (λ _ → inr id))
+```
+
+### Having decidable Π-types transfers along double negation dense maps
+
+```agda
+has-decidable-Π-double-negation-dense-map :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} →
+ X ↠¬¬ Y → has-decidable-Π X → has-decidable-Π Y
+has-decidable-Π-double-negation-dense-map h f P =
+ map-coproduct
+ ( λ p x →
+ rec-coproduct
+ ( id)
+ ( λ np →
+ ex-falso
+ ( is-double-negation-dense-map-double-negation-dense-map h x
+ ( λ yp →
+ np (tr (family-decidable-family P) (pr2 yp) (p (pr1 yp))))))
+ ( is-decidable-decidable-family P x))
+ ( λ nph p → nph (p ∘ map-double-negation-dense-map h))
+ ( f (reindex-decidable-family P (map-double-negation-dense-map h)))
+```
+
+### Having decidable Π-types transfers along surjections
+
+```agda
+has-decidable-Π-surjection :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ↠ Y →
+ has-decidable-Π X → has-decidable-Π Y
+has-decidable-Π-surjection h =
+ has-decidable-Π-double-negation-dense-map
+ ( double-negation-dense-map-surjection h)
+```
+
+### Types with decidable Π-types are closed under retracts
+
+```agda
+has-decidable-Π-retract :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} → Y retract-of X →
+ has-decidable-Π X → has-decidable-Π Y
+has-decidable-Π-retract R =
+ has-decidable-Π-double-negation-dense-map
+ ( double-negation-dense-map-retract R)
+```
+
+### Types with decidable Π-types are closed under equivalences
+
+```agda
+has-decidable-Π-equiv :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} → Y ≃ X →
+ has-decidable-Π X → has-decidable-Π Y
+has-decidable-Π-equiv e =
+ has-decidable-Π-retract (retract-equiv e)
+
+has-decidable-Π-equiv' :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ≃ Y →
+ has-decidable-Π X → has-decidable-Π Y
+has-decidable-Π-equiv' e =
+ has-decidable-Π-retract (retract-inv-equiv e)
+```
+
+### The empty type has decidable Π-types
+
+```agda
+has-decidable-Π-empty :
+ has-decidable-Π empty
+has-decidable-Π-empty P = inl ind-empty
+```
+
+### The unit type has decidable Π-types
+
+```agda
+has-decidable-Π-unit : has-decidable-Π unit
+has-decidable-Π-unit P =
+ map-coproduct
+ ( λ p _ → p)
+ ( λ np p → np (p star))
+ ( is-decidable-decidable-family P star)
+```
+
+### Coproducts of types with decidable Π-types
+
+Coproducts of types with decidable Π-types for untruncated universal
+quantification have decidable Π-types. Conversely, if the coproduct has
+decidable Π-types and a summand has an element, then that summand also has
+decidable Π-types.
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2}
+ where
+
+ has-decidable-Π-coproduct :
+ has-decidable-Π X →
+ has-decidable-Π Y →
+ has-decidable-Π (X + Y)
+ has-decidable-Π-coproduct f g P =
+ rec-coproduct
+ ( λ pl →
+ rec-coproduct
+ ( λ pr → inl (ind-coproduct (family-decidable-family P) pl pr))
+ ( λ npr → inr (λ p → npr (p ∘ inr)))
+ ( g (reindex-decidable-family P inr)))
+ ( λ npl → inr (λ p → npl (p ∘ inl)))
+ ( f (reindex-decidable-family P inl))
+
+ has-decidable-Π-left-summand-coproduct :
+ has-decidable-Π (X + Y) →
+ X → has-decidable-Π X
+ has-decidable-Π-left-summand-coproduct f x =
+ has-decidable-Π-retract
+ ( retract-left-summand-coproduct x)
+ ( f)
+
+ has-decidable-Π-right-summand-coproduct :
+ has-decidable-Π (X + Y) →
+ Y → has-decidable-Π Y
+ has-decidable-Π-right-summand-coproduct f y =
+ has-decidable-Π-retract
+ ( retract-right-summand-coproduct y)
+ ( f)
+```
+
+### Dependent sums of types with decidable Π-types
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ where
+
+ has-decidable-Π-Σ :
+ has-decidable-Π A →
+ ((x : A) → has-decidable-Π (B x)) →
+ has-decidable-Π (Σ A B)
+ has-decidable-Π-Σ f g P =
+ is-decidable-equiv equiv-ev-pair
+ ( f ( ( λ x → (y : B x) → family-decidable-family P (x , y)) ,
+ ( λ x → g x (reindex-decidable-family P (pair x)))))
+
+ has-decidable-Π-base-has-decidable-Π-Σ :
+ has-decidable-Π (Σ A B) →
+ ((x : A) → B x) →
+ has-decidable-Π A
+ has-decidable-Π-base-has-decidable-Π-Σ
+ f s =
+ has-decidable-Π-retract
+ ( retract-base-Σ-section-family s)
+ ( f)
+```
+
+### Products of types with decidable Π-types
+
+```agda
+has-decidable-Π-product :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ has-decidable-Π A →
+ has-decidable-Π B →
+ has-decidable-Π (A × B)
+has-decidable-Π-product f g =
+ has-decidable-Π-Σ f (λ _ → g)
+```
+
+### Factors of products with decidable Π-types
+
+```agda
+module _
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2}
+ where
+
+ has-decidable-Π-left-factor-product :
+ has-decidable-Π (X × Y) →
+ Y → has-decidable-Π X
+ has-decidable-Π-left-factor-product f y =
+ has-decidable-Π-retract (retract-left-factor-product y) f
+
+ has-decidable-Π-right-factor-product :
+ has-decidable-Π (X × Y) →
+ X → has-decidable-Π Y
+ has-decidable-Π-right-factor-product f x =
+ has-decidable-Π-retract (retract-right-factor-product x) f
+```
+
+### Standard finite types have decidable Π-types
+
+```agda
+has-decidable-Π-Fin :
+ (n : ℕ) → has-decidable-Π (Fin n)
+has-decidable-Π-Fin zero-ℕ =
+ has-decidable-Π-empty
+has-decidable-Π-Fin (succ-ℕ n) =
+ has-decidable-Π-coproduct
+ ( has-decidable-Π-Fin n)
+ ( has-decidable-Π-unit)
+```
+
+### Types equipped with a counting have decidable Π-types
+
+```agda
+has-decidable-Π-count :
+ {l : Level} {X : UU l} → count X → has-decidable-Π X
+has-decidable-Π-count f =
+ has-decidable-Π-equiv'
+ ( equiv-count f)
+ ( has-decidable-Π-Fin (number-of-elements-count f))
+```
+
+### The booleans have decidable Π-types
+
+```agda
+has-decidable-Π-bool : has-decidable-Π bool
+has-decidable-Π-bool =
+ has-decidable-Π-equiv'
+ ( equiv-bool-Fin-2)
+ ( has-decidable-Π-Fin 2)
+```
+
+### Types with decidable Σ-types have decidable Π-types
+
+```agda
+has-decidable-Π-has-decidable-Σ :
+ {l : Level} {X : UU l} →
+ has-decidable-Σ X →
+ has-decidable-Π X
+has-decidable-Π-has-decidable-Σ f P =
+ rec-coproduct
+ ( λ xnp → inr (λ p → pr2 xnp (p (pr1 xnp))))
+ ( λ nxnp →
+ inl
+ ( λ x →
+ rec-coproduct
+ ( id)
+ ( λ np → ex-falso (nxnp (x , np)))
+ ( is-decidable-decidable-family P x)))
+ ( f (neg-decidable-family P))
+```
+
+### Decidable types with double negation dense equality have decidable Π-types
+
+```agda
+abstract
+ has-decidable-Π-is-decidable-has-double-negation-dense-equality :
+ {l : Level} {X : UU l} →
+ has-double-negation-dense-equality X →
+ is-decidable X →
+ has-decidable-Π X
+ has-decidable-Π-is-decidable-has-double-negation-dense-equality
+ H d =
+ has-decidable-Π-has-decidable-Σ
+ ( has-decidable-Σ-is-decidable-has-double-negation-dense-equality H d)
+```
+
+### The total space of decidable families with double negation dense equality over types with decidable Π-types have decidable Π-types
+
+```agda
+abstract
+ has-decidable-Π-Σ-decidable-family-has-double-negation-dense-equality :
+ {l1 l2 : Level} {X : UU l1} →
+ has-decidable-Π X →
+ (P : decidable-family l2 X) →
+ ( (x : X) →
+ has-double-negation-dense-equality (family-decidable-family P x)) →
+ has-decidable-Π (Σ X (family-decidable-family P))
+ has-decidable-Π-Σ-decidable-family-has-double-negation-dense-equality
+ f P H =
+ has-decidable-Π-Σ f
+ ( λ x →
+ has-decidable-Π-is-decidable-has-double-negation-dense-equality
+ ( H x)
+ ( is-decidable-decidable-family P x))
+```
+
+### Decidable subtypes of types with decidable Π-types have decidable Π-types
+
+```agda
+abstract
+ has-decidable-Π-type-decidable-subtype :
+ {l1 l2 : Level} {X : UU l1} →
+ has-decidable-Π X →
+ (P : decidable-subtype l2 X) →
+ has-decidable-Π (type-decidable-subtype P)
+ has-decidable-Π-type-decidable-subtype {X = X} f P =
+ has-decidable-Π-Σ-decidable-family-has-double-negation-dense-equality
+ ( f)
+ ( decidable-family-decidable-subtype P)
+ ( λ x p q →
+ intro-double-negation
+ ( eq-is-prop (is-prop-is-in-decidable-subtype P x)))
+
+has-decidable-Π-decidable-emb :
+ {l1 l2 : Level} {X : UU l1} {Y : UU l2} → Y ↪ᵈ X →
+ has-decidable-Π X → has-decidable-Π Y
+has-decidable-Π-decidable-emb h f =
+ has-decidable-Π-equiv'
+ ( compute-type-decidable-subtype-decidable-emb h)
+ ( has-decidable-Π-type-decidable-subtype f
+ ( decidable-subtype-decidable-emb h))
+```
+
+## References
+
+{{#bibliography}}
+
+## See also
+
+- [Types with decidable Σ-types](foundation.types-with-decidable-dependent-pair-types.md)
+- [Types with decidable universal quantifications](foundation.types-with-decidable-universal-quantification.md)
diff --git a/src/foundation/types-with-decidable-universal-quantification.lagda.md b/src/foundation/types-with-decidable-universal-quantification.lagda.md
new file mode 100644
index 0000000000..9ec3edcdc4
--- /dev/null
+++ b/src/foundation/types-with-decidable-universal-quantification.lagda.md
@@ -0,0 +1,157 @@
+# Types with decidable universal quantifications
+
+```agda
+module foundation.types-with-decidable-universal-quantification where
+```
+
+Imports
+
+```agda
+open import foundation.coproduct-types
+open import foundation.decidable-propositions
+open import foundation.decidable-subtypes
+open import foundation.decidable-type-families
+open import foundation.decidable-types
+open import foundation.double-negation
+open import foundation.empty-types
+open import foundation.evaluation-functions
+open import foundation.full-subtypes
+open import foundation.function-types
+open import foundation.functoriality-coproduct-types
+open import foundation.mere-equality
+open import foundation.negation
+open import foundation.propositional-truncations
+open import foundation.propositions
+open import foundation.transport-along-identifications
+open import foundation.types-with-decidable-dependent-product-types
+open import foundation.universe-levels
+
+open import logic.propositionally-decidable-types
+```
+
+
+
+## Idea
+
+A type `X`
+{{#concept "has decidable universal quantifications" Disambiguation="on type" Agda=has-decidable-∀}}
+if, for every [decidable subtype](foundation.decidable-subtypes.md) `P` of `X`,
+it is decidable if `P` is the full subtype. In other words, we have a witness of
+type
+
+```text
+ (P : decidable-subtype X) → is-decidable (∀ x. x ∈ P).
+```
+
+Having decidable universal quantifications is
+[logically equivalent](foundation.logical-equivalences.md) to having decidable
+Π-types, but the latter is not a [proposition](foundation-core.propositions.md).
+
+**Terminology.** In the terminology of Martín Escardó, a type that has decidable
+universal quantifications is referred to as _weakly compact_, or _Π-compact_, or
+_satisfying the weak principle of omniscience_. {{#cite TypeTopology}}
+
+## Definitions
+
+### The predicate of having decidable universal quantifications
+
+```agda
+has-decidable-∀-Level :
+ {l1 : Level} (l2 : Level) → UU l1 → UU (l1 ⊔ lsuc l2)
+has-decidable-∀-Level l2 X =
+ (P : decidable-subtype l2 X) → is-decidable (is-full-decidable-subtype P)
+
+has-decidable-∀ : {l1 : Level} → UU l1 → UUω
+has-decidable-∀ X =
+ {l2 : Level} → has-decidable-∀-Level l2 X
+
+is-prop-has-decidable-∀-Level :
+ {l1 l2 : Level} {X : UU l1} →
+ is-prop (has-decidable-∀-Level l2 X)
+is-prop-has-decidable-∀-Level =
+ is-prop-Π
+ ( λ P →
+ is-prop-is-decidable
+ ( is-prop-is-full-subtype (subtype-decidable-subtype P)))
+```
+
+## Properties
+
+### Types with decidable universal quantifications have decidable Π-types
+
+```agda
+has-decidable-Π-has-decidable-∀ :
+ {l1 : Level} {X : UU l1} →
+ has-decidable-∀ X →
+ has-decidable-Π X
+has-decidable-Π-has-decidable-∀
+ f P =
+ map-coproduct
+ ( λ nnp x →
+ rec-coproduct id (ex-falso ∘ nnp x) (is-decidable-decidable-family P x))
+ ( λ nnnp p → nnnp (intro-double-negation ∘ p))
+ ( f ( λ x →
+ neg-type-Decidable-Prop
+ ( ¬ (family-decidable-family P x))
+ ( is-decidable-neg (is-decidable-decidable-family P x))))
+```
+
+### Merely decidable types with merely equal elements have decidable universal quantifications
+
+```agda
+abstract
+ has-decidable-∀-is-inhabited-or-empty-all-elements-merely-equal :
+ {l : Level} {X : UU l} →
+ is-inhabited-or-empty X →
+ all-elements-merely-equal X →
+ has-decidable-∀ X
+ has-decidable-∀-is-inhabited-or-empty-all-elements-merely-equal
+ { X = X} (inl |x|) H P =
+ rec-trunc-Prop
+ ( is-decidable-Prop (Π-Prop X (subtype-decidable-subtype P)))
+ ( λ x →
+ map-coproduct
+ ( λ p x' →
+ rec-trunc-Prop
+ ( subtype-decidable-subtype P x')
+ ( λ r → tr (is-in-decidable-subtype P) r p)
+ ( H x x'))
+ ( map-neg (ev x))
+ ( is-decidable-decidable-subtype P x))
+ ( |x|)
+ has-decidable-∀-is-inhabited-or-empty-all-elements-merely-equal
+ ( inr nx) H P =
+ inl (ex-falso ∘ nx)
+
+abstract
+ has-decidable-Π-is-inhabited-or-empty-all-elements-merely-equal :
+ {l : Level} {X : UU l} →
+ is-inhabited-or-empty X →
+ all-elements-merely-equal X →
+ has-decidable-Π X
+ has-decidable-Π-is-inhabited-or-empty-all-elements-merely-equal
+ d H =
+ has-decidable-Π-has-decidable-∀
+ ( has-decidable-∀-is-inhabited-or-empty-all-elements-merely-equal
+ ( d)
+ ( H))
+
+abstract
+ has-decidable-Π-is-decidable-all-elements-merely-equal :
+ {l : Level} {X : UU l} →
+ is-decidable X →
+ all-elements-merely-equal X →
+ has-decidable-Π X
+ has-decidable-Π-is-decidable-all-elements-merely-equal d =
+ has-decidable-Π-is-inhabited-or-empty-all-elements-merely-equal
+ ( is-inhabited-or-empty-is-decidable d)
+```
+
+## References
+
+{{#bibliography}}
+
+## See also
+
+- [Types with decidable Σ-types](foundation.types-with-decidable-dependent-pair-types.md)
+- [Types with decidable Π-types](foundation.types-with-decidable-dependent-product-types.md)
diff --git a/src/foundation/uniformly-decidable-type-families.lagda.md b/src/foundation/uniformly-decidable-type-families.lagda.md
index 01904ea182..caa6bc0aff 100644
--- a/src/foundation/uniformly-decidable-type-families.lagda.md
+++ b/src/foundation/uniformly-decidable-type-families.lagda.md
@@ -9,25 +9,28 @@ module foundation.uniformly-decidable-type-families where
```agda
open import foundation.contractible-types
open import foundation.coproduct-types
+open import foundation.decidable-type-families
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.equality-coproduct-types
+open import foundation.functoriality-coproduct-types
open import foundation.inhabited-types
+open import foundation.irrefutable-equality
+open import foundation.mere-equality
open import foundation.negation
open import foundation.propositional-truncations
open import foundation.propositions
+open import foundation.subtypes
+open import foundation.transport-along-identifications
open import foundation.truncated-types
open import foundation.truncation-levels
open import foundation.type-arithmetic-empty-type
open import foundation.universe-levels
-open import foundation-core.cartesian-product-types
-open import foundation-core.contractible-maps
open import foundation-core.empty-types
-open import foundation-core.equivalences
open import foundation-core.function-types
-open import foundation-core.homotopies
-open import foundation-core.identity-types
+
+open import logic.propositionally-decidable-types
```
@@ -63,7 +66,7 @@ is-decidable-is-uniformly-decidable-family (inl f) x = inl (f x)
is-decidable-is-uniformly-decidable-family (inr g) x = inr (g x)
```
-### The uniform decidability predicate on a family of truncated types
+### The uniform decidability predicate on a family of contractible types
```agda
module _
@@ -132,6 +135,16 @@ module _
rec-trunc-Prop
( is-prop-Prop (is-uniformly-decidable-family B))
( is-prop-is-uniformly-decidable-family-is-inhabited-base' H)
+
+is-uniformly-decidable-family-Prop :
+ {l1 l2 : Level}
+ (A : Inhabited-Type l1) (B : subtype l2 (type-Inhabited-Type A)) →
+ Prop (l1 ⊔ l2)
+is-uniformly-decidable-family-Prop (A , |a|) B =
+ ( is-uniformly-decidable-family (is-in-subtype B)) ,
+ ( is-prop-is-uniformly-decidable-family-is-inhabited-base
+ ( is-prop-is-in-subtype B)
+ ( |a|))
```
### The uniform decidability predicate on a family of truncated types
@@ -173,3 +186,76 @@ module _
( succ-𝕋 (succ-𝕋 k)) H _ =
is-trunc-succ-succ-is-uniformly-decidable-family k H
```
+
+### Every family of decidable propositions over a decidable base with double negation dense equality is uniformly decidable
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ (H : has-double-negation-dense-equality A)
+ (dB : is-decidable-family B)
+ where
+
+ abstract
+ is-uniformly-decidable-family-has-double-negation-dense-equality-base :
+ is-decidable A →
+ is-uniformly-decidable-family B
+ is-uniformly-decidable-family-has-double-negation-dense-equality-base
+ (inl a) =
+ map-coproduct
+ ( λ b x →
+ double-negation-elim-is-decidable
+ ( dB x)
+ ( λ nb → H a x (λ p → nb (tr B p b))))
+ ( λ nb x b → H x a (λ p → nb (tr B p b)))
+ ( dB a)
+ is-uniformly-decidable-family-has-double-negation-dense-equality-base
+ (inr na) =
+ inr (λ x _ → na x)
+
+ abstract
+ is-uniformly-decidable-family-has-double-negation-dense-equality-base' :
+ is-inhabited-or-empty A →
+ ((x : A) → is-prop (B x)) →
+ is-uniformly-decidable-family B
+ is-uniformly-decidable-family-has-double-negation-dense-equality-base'
+ ( inl |a|) K =
+ rec-trunc-Prop
+ ( is-uniformly-decidable-family-Prop (A , |a|) (λ x → (B x , K x)))
+ ( is-uniformly-decidable-family-has-double-negation-dense-equality-base ∘
+ inl)
+ ( |a|)
+ is-uniformly-decidable-family-has-double-negation-dense-equality-base'
+ ( inr na) K =
+ is-uniformly-decidable-family-has-double-negation-dense-equality-base
+ ( inr na)
+```
+
+### A family of decidable propositions over a decidable base with mere equality is uniformly decidable
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ (H : all-elements-merely-equal A)
+ (dB : is-decidable-family B)
+ where
+
+ abstract
+ is-uniformly-decidable-family-all-elements-merely-equal-base :
+ is-decidable A →
+ is-uniformly-decidable-family B
+ is-uniformly-decidable-family-all-elements-merely-equal-base =
+ is-uniformly-decidable-family-has-double-negation-dense-equality-base
+ ( has-double-negation-dense-equality-all-elements-merely-equal H)
+ ( dB)
+
+ abstract
+ is-uniformly-decidable-family-all-elements-merely-equal-base' :
+ is-inhabited-or-empty A →
+ ((x : A) → is-prop (B x)) →
+ is-uniformly-decidable-family B
+ is-uniformly-decidable-family-all-elements-merely-equal-base' =
+ is-uniformly-decidable-family-has-double-negation-dense-equality-base'
+ ( has-double-negation-dense-equality-all-elements-merely-equal H)
+ ( dB)
+```
diff --git a/src/foundation/universal-property-identity-types.lagda.md b/src/foundation/universal-property-identity-types.lagda.md
index 1412af1bae..d9a24447ac 100644
--- a/src/foundation/universal-property-identity-types.lagda.md
+++ b/src/foundation/universal-property-identity-types.lagda.md
@@ -26,7 +26,6 @@ open import foundation-core.contractible-maps
open import foundation-core.contractible-types
open import foundation-core.families-of-equivalences
open import foundation-core.fibers-of-maps
-open import foundation-core.function-types
open import foundation-core.functoriality-dependent-pair-types
open import foundation-core.homotopies
open import foundation-core.propositional-maps
diff --git a/src/foundation/weakly-constant-maps.lagda.md b/src/foundation/weakly-constant-maps.lagda.md
index 741e4c32c8..9e1eadf540 100644
--- a/src/foundation/weakly-constant-maps.lagda.md
+++ b/src/foundation/weakly-constant-maps.lagda.md
@@ -15,7 +15,9 @@ open import foundation.iterated-dependent-product-types
open import foundation.universe-levels
open import foundation-core.contractible-types
+open import foundation-core.function-types
open import foundation-core.functoriality-dependent-pair-types
+open import foundation-core.homotopies
open import foundation-core.propositions
open import foundation-core.sets
open import foundation-core.torsorial-type-families
@@ -26,9 +28,11 @@ open import foundation-core.torsorial-type-families
## Idea
A map `f : A → B` is said to be
-{{#concept "weakly constant" Disambiguation="map of types" Agda=is-weakly-constant}}
-if any two elements in `A` are mapped to
-[identical elements](foundation-core.identity-types.md) in `B`.
+{{#concept "weakly constant" Disambiguation="map of types" Agda=is-weakly-constant}},
+or **steady**, if any two elements in `A` are mapped to
+[identical elements](foundation-core.identity-types.md) in `B`. This concept is
+considered in {{#cite KECA17}} where it is in particular used to give a
+generalization of Hedberg's theorem.
## Definitions
@@ -58,6 +62,22 @@ module _
is-weakly-constant-weakly-constant-map = pr2 f
```
+### Factorizations through propositions
+
+```agda
+factorization-through-Prop :
+ {l1 l2 : Level} (l3 : Level) {A : UU l1} {B : UU l2} →
+ (A → B) → UU (l1 ⊔ l2 ⊔ lsuc l3)
+factorization-through-Prop l3 {A} {B} f =
+ Σ ( Prop l3)
+ ( λ P → Σ (type-Prop P → B) (λ i → Σ (A → type-Prop P) (λ j → i ∘ j ~ f)))
+```
+
+**Comment.** We need this type to state a factorization property of weakly
+constant maps, but placing it in its appropriate place
+(`orthogonal-factorization-systems.factorizations-of-maps`) leads to circular
+dependencies.
+
## Properties
### Being weakly constant is a property if the codomain is a set
@@ -77,6 +97,34 @@ module _
pr2 is-weakly-constant-prop-Set = is-prop-is-weakly-constant-Set
```
+### The type of fixed points of a weakly constant endomap is a proposition
+
+This is Lemma 4.1 of {{#cite KECA17}}. We follow the second proof, due to
+Christian Sattler.
+
+```agda
+module _
+ {l : Level} {A : UU l} {f : A → A} (W : is-weakly-constant f)
+ where
+
+ is-proof-irrelevant-fixed-point-is-weakly-constant :
+ is-proof-irrelevant (fixed-point f)
+ is-proof-irrelevant-fixed-point-is-weakly-constant (x , p) =
+ is-contr-equiv
+ ( Σ A (λ z → f x = z))
+ ( equiv-tot (λ z → equiv-concat (W x z) z))
+ ( is-torsorial-Id (f x))
+
+ is-prop-fixed-point-is-weakly-constant : is-prop (fixed-point f)
+ is-prop-fixed-point-is-weakly-constant =
+ is-prop-is-proof-irrelevant
+ ( is-proof-irrelevant-fixed-point-is-weakly-constant)
+
+ prop-fixed-point-is-weakly-constant : Prop l
+ prop-fixed-point-is-weakly-constant =
+ ( fixed-point f , is-prop-fixed-point-is-weakly-constant)
+```
+
### The action on identifications of a weakly constant map is weakly constant
This is Auxiliary Lemma 4.3 of {{#cite KECA17}}.
@@ -111,30 +159,54 @@ module _
is-weakly-constant-ap (is-weakly-constant-weakly-constant-map f))
```
-### The type of fixed points of a weakly constant endomap is a proposition
-
-This is Lemma 4.1 of {{#cite KECA17}}. We follow the second proof, due to
-Christian Sattler.
+### Weakly constant maps are closed under composition with arbitrary maps
```agda
module _
- {l : Level} {A : UU l} {f : A → A} (W : is-weakly-constant f)
+ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3}
where
- is-proof-irrelevant-fixed-point-is-weakly-constant :
- is-proof-irrelevant (fixed-point f)
- is-proof-irrelevant-fixed-point-is-weakly-constant (x , p) =
- is-contr-equiv
- ( Σ A (λ z → f x = z))
- ( equiv-tot (λ z → equiv-concat (W x z) z))
- ( is-torsorial-Id (f x))
+ is-weakly-constant-right-comp :
+ {f : A → B} (g : B → C) → is-weakly-constant f → is-weakly-constant (g ∘ f)
+ is-weakly-constant-right-comp g W x y = ap g (W x y)
- is-prop-fixed-point-is-weakly-constant : is-prop (fixed-point f)
- is-prop-fixed-point-is-weakly-constant =
- is-prop-is-proof-irrelevant
- ( is-proof-irrelevant-fixed-point-is-weakly-constant)
+ is-weakly-constant-left-comp :
+ (f : A → B) {g : B → C} → is-weakly-constant g → is-weakly-constant (g ∘ f)
+ is-weakly-constant-left-comp f W x y = W (f x) (f y)
+```
+
+### A map is weakly constant if and only if it factors through a proposition
+
+A map `f : A → B` is weakly constant if and only if there exists a proposition
+`P` and a commuting diagram
+
+```text
+ P
+ ∧ \
+ / \
+ / ∨
+ A --------> B
+ f
+```
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B}
+ where
+
+ is-weakly-constant-factors-through-Prop :
+ {l3 : Level} → factorization-through-Prop l3 f → is-weakly-constant f
+ is-weakly-constant-factors-through-Prop (P , i , j , H) x y =
+ inv (H x) ∙ ap i (eq-type-Prop P) ∙ H y
```
+> The converse remains to be formalized.
+
## References
{{#bibliography}} {{#reference KECA17}}
+
+## External links
+
+- [weakly constant function](https://ncatlab.org/nlab/show/weakly+constant+function)
+ at $n$Lab
diff --git a/src/literature/introduction-to-homotopy-type-theory.lagda.md b/src/literature/introduction-to-homotopy-type-theory.lagda.md
index 73694d20ac..c849718839 100644
--- a/src/literature/introduction-to-homotopy-type-theory.lagda.md
+++ b/src/literature/introduction-to-homotopy-type-theory.lagda.md
@@ -302,16 +302,16 @@ open import foundation.booleans using
; ind-bool)
-- (a)
-open import foundation.booleans using
+open import foundation.logical-operations-booleans using
( neg-bool)
-- (b)
-open import foundation.booleans using
- ( conjunction-bool)
+open import foundation.logical-operations-booleans using
+ ( and-bool)
-- (c)
-open import foundation.booleans using
- ( disjunction-bool)
+open import foundation.logical-operations-booleans using
+ ( or-bool)
```
**Exercise 4.3.** Double negation.
@@ -336,7 +336,7 @@ open import foundation.double-negation using
( ¬¬_
; intro-double-negation -- P → ¬¬P
; map-double-negation -- (P → Q) → (¬¬P → ¬¬Q)
- ; double-negation-extend -- (P → ¬¬Q) → (¬¬P → ¬¬Q)
+ ; extend-double-negation -- (P → ¬¬Q) → (¬¬P → ¬¬Q)
)
-- (c)
@@ -345,7 +345,7 @@ open import foundation.double-negation using
; double-negation-Peirces-law -- ¬¬(((P → Q) → P) → P)
; double-negation-linearity-implication -- ¬¬((P → Q) + (Q → P))
)
-open import foundation.irrefutable-propositions using
+open import logic.irrefutable-types using
( is-irrefutable-is-decidable -- ¬¬(P + ¬P)
)
@@ -382,7 +382,7 @@ _ =
( double-negation-elim-neg (¬ Q))
-- (f)
-open import foundation.irrefutable-propositions using
+open import logic.irrefutable-types using
( is-irrefutable-product -- ¬¬A → ¬¬B → ¬¬(A × B)
)
@@ -935,7 +935,7 @@ _ : (x y : bool) → (x = y) ↔ Eq-bool x y
_ = λ x y → (Eq-eq-bool , eq-Eq-bool)
-- (c)
-open import foundation.booleans using
+open import foundation.logical-operations-booleans using
( neq-neg-bool -- b ≠ neg-bool b
)
_ : ¬ (false = true)
@@ -1753,7 +1753,7 @@ open import elementary-number-theory.collatz-conjecture using
```agda
open import foundation.decidable-types using
- ( idempotent-is-decidable -- is-decidable (is-decidable P) → is-decidable P
+ ( map-idempotent-is-decidable -- is-decidable (is-decidable P) → is-decidable P
)
```
diff --git a/src/logic.lagda.md b/src/logic.lagda.md
index 840556f77d..601198477e 100644
--- a/src/logic.lagda.md
+++ b/src/logic.lagda.md
@@ -14,11 +14,19 @@ open import logic.de-morgan-propositions public
open import logic.de-morgan-subtypes public
open import logic.de-morgan-types public
open import logic.de-morgans-law public
+open import logic.dirk-gentlys-principle public
+open import logic.double-negation-dense-maps public
+open import logic.double-negation-dense-subtypes public
open import logic.double-negation-eliminating-maps public
open import logic.double-negation-elimination public
open import logic.double-negation-stable-embeddings public
open import logic.double-negation-stable-subtypes public
open import logic.functoriality-existential-quantification public
+open import logic.irrefutable-types public
open import logic.markovian-types public
open import logic.markovs-principle public
+open import logic.propositional-double-negation-elimination public
+open import logic.propositionally-decidable-maps public
+open import logic.propositionally-decidable-types public
+open import logic.propositionally-double-negation-eliminating-maps public
```
diff --git a/src/logic/complements-decidable-subtypes.lagda.md b/src/logic/complements-decidable-subtypes.lagda.md
index ae2a775f33..5887b51c6d 100644
--- a/src/logic/complements-decidable-subtypes.lagda.md
+++ b/src/logic/complements-decidable-subtypes.lagda.md
@@ -13,21 +13,19 @@ open import foundation.decidable-propositions
open import foundation.decidable-subtypes
open import foundation.decidable-types
open import foundation.dependent-pair-types
-open import foundation.double-negation-stable-propositions
open import foundation.evaluation-functions
open import foundation.full-subtypes
open import foundation.involutions
-open import foundation.negation
-open import foundation.postcomposition-functions
-open import foundation.powersets
open import foundation.propositional-truncations
+open import foundation.propositions
+open import foundation.type-arithmetic-coproduct-types
+open import foundation.type-arithmetic-dependent-pair-types
open import foundation.unions-subtypes
open import foundation.universe-levels
+open import foundation-core.equivalences
open import foundation-core.function-types
open import foundation-core.subtypes
-
-open import logic.double-negation-stable-subtypes
```
@@ -44,9 +42,20 @@ the elements that are not in `B`.
### Complements of decidable subtypes
```agda
-complement-decidable-subtype :
- {l1 l2 : Level} {A : UU l1} → decidable-subtype l2 A → decidable-subtype l2 A
-complement-decidable-subtype P x = neg-Decidable-Prop (P x)
+module _
+ {l1 l2 : Level} {A : UU l1} (P : decidable-subtype l2 A)
+ where
+
+ complement-decidable-subtype : decidable-subtype l2 A
+ complement-decidable-subtype x = neg-Decidable-Prop (P x)
+
+ type-complement-decidable-subtype : UU (l1 ⊔ l2)
+ type-complement-decidable-subtype =
+ type-decidable-subtype complement-decidable-subtype
+
+ is-in-complement-decidable-subtype : A → UU l2
+ is-in-complement-decidable-subtype =
+ is-in-decidable-subtype complement-decidable-subtype
```
## Properties
@@ -98,3 +107,31 @@ module _
( subtype-decidable-subtype P)
( is-decidable-decidable-subtype P)
```
+
+### The coproduct decomposition associated to a decidable subtype
+
+Every decidable subtype `P ⊆ A` decomposes `A` into a coproduct `A ≃ (P + A∖P)`.
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} (P : decidable-subtype l2 A)
+ where
+
+ equiv-coproduct-decomposition-decidable-subtype :
+ A ≃ type-decidable-subtype P + type-complement-decidable-subtype P
+ equiv-coproduct-decomposition-decidable-subtype =
+ equivalence-reasoning
+ A
+ ≃ Σ A (λ x → is-decidable (is-in-decidable-subtype P x))
+ by
+ inv-right-unit-law-Σ-is-contr
+ ( λ x →
+ is-proof-irrelevant-is-prop
+ ( is-prop-is-decidable (is-prop-is-in-decidable-subtype P x))
+ ( is-decidable-decidable-subtype P x))
+ ≃ type-decidable-subtype P + type-complement-decidable-subtype P
+ by
+ left-distributive-Σ-coproduct A
+ ( is-in-decidable-subtype P)
+ ( is-in-complement-decidable-subtype P)
+```
diff --git a/src/logic/de-morgan-types.lagda.md b/src/logic/de-morgan-types.lagda.md
index a87cd18593..37de751b7a 100644
--- a/src/logic/de-morgan-types.lagda.md
+++ b/src/logic/de-morgan-types.lagda.md
@@ -8,7 +8,6 @@ module logic.de-morgan-types where
```agda
open import foundation.cartesian-product-types
-open import foundation.conjunction
open import foundation.contractible-types
open import foundation.coproduct-types
open import foundation.decidable-types
@@ -16,13 +15,9 @@ open import foundation.dependent-pair-types
open import foundation.disjunction
open import foundation.double-negation
open import foundation.empty-types
-open import foundation.evaluation-functions
open import foundation.function-types
-open import foundation.identity-types
-open import foundation.irrefutable-propositions
open import foundation.logical-equivalences
open import foundation.negation
-open import foundation.precomposition-functions
open import foundation.propositional-truncations
open import foundation.retracts-of-types
open import foundation.truncation-levels
@@ -34,7 +29,8 @@ open import foundation-core.decidable-propositions
open import foundation-core.equivalences
open import foundation-core.propositions
-open import logic.de-morgans-law
+open import logic.irrefutable-types
+open import logic.propositionally-decidable-types
```
@@ -249,7 +245,8 @@ module _
### It is irrefutable that a type is De Morgan
```agda
-is-irrefutable-is-de-morgan : {l : Level} {A : UU l} → ¬¬ (is-de-morgan A)
+is-irrefutable-is-de-morgan :
+ {l : Level} {A : UU l} → is-irrefutable (is-de-morgan A)
is-irrefutable-is-de-morgan = is-irrefutable-is-decidable
```
diff --git a/src/logic/dirk-gentlys-principle.lagda.md b/src/logic/dirk-gentlys-principle.lagda.md
new file mode 100644
index 0000000000..3b8f8c0ef6
--- /dev/null
+++ b/src/logic/dirk-gentlys-principle.lagda.md
@@ -0,0 +1,68 @@
+# Dirk Gently's principle
+
+```agda
+module logic.dirk-gentlys-principle where
+```
+
+Imports
+
+```agda
+open import foundation.disjunction
+open import foundation.propositions
+open import foundation.universe-levels
+```
+
+
+
+## Idea
+
+{{#concept "Dirk Gently's principle" Agda=Dirk-Gently's-Principle}} is the
+logical axiom that the type of [propositions](foundation-core.propositions.md)
+is [linearly ordered](order-theory.total-orders.md). In other words, for every
+pair of propositions `P` and `Q`, either `P` implies `Q` or `Q` implies `P`:
+
+$$
+ (P ⇒ Q) ∨ (Q ⇒ P).
+$$
+
+The proof strength of this principle lies strictly between the
+[law of excluded middle](foundation.law-of-excluded-middle.md) and
+[De Morgan's law](logic.de-morgans-law.md), Section 8.5 {{#cite Diener18}}.
+
+> The name is based on the guiding principle of the protagonist of Douglas
+> Adam’s novel Dirk Gently’s Holistic Detective Agency who believes in the
+> “fundamental interconnectedness of all things.” {{#cite Diener18}}
+
+## Statement
+
+```agda
+instance-prop-Dirk-Gently's-Principle :
+ {l1 l2 : Level} → Prop l1 → Prop l2 → Prop (l1 ⊔ l2)
+instance-prop-Dirk-Gently's-Principle P Q = (P ⇒ Q) ∨ (Q ⇒ P)
+
+instance-Dirk-Gently's-Principle :
+ {l1 l2 : Level} → Prop l1 → Prop l2 → UU (l1 ⊔ l2)
+instance-Dirk-Gently's-Principle P Q =
+ type-Prop (instance-prop-Dirk-Gently's-Principle P Q)
+
+Dirk-Gently's-Principle-Level : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2)
+Dirk-Gently's-Principle-Level l1 l2 =
+ (P : Prop l1) (Q : Prop l2) → instance-Dirk-Gently's-Principle P Q
+
+Dirk-Gently's-Principle : UUω
+Dirk-Gently's-Principle =
+ {l1 l2 : Level} → Dirk-Gently's-Principle-Level l1 l2
+```
+
+## Properties
+
+### The law of excluded middle implies Dirk Gently's principle
+
+**Proof.** Assuming the law of excluded middle, then every proposition is either
+true or false, so since false ≤ true, we are done.
+
+> This remains to be formalized.
+
+## References
+
+{{#bibliography}}
diff --git a/src/logic/double-negation-dense-maps.lagda.md b/src/logic/double-negation-dense-maps.lagda.md
new file mode 100644
index 0000000000..ab92b0b512
--- /dev/null
+++ b/src/logic/double-negation-dense-maps.lagda.md
@@ -0,0 +1,516 @@
+# Double negation dense maps
+
+```agda
+module logic.double-negation-dense-maps where
+```
+
+Imports
+
+```agda
+open import foundation.connected-maps
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.functoriality-cartesian-product-types
+open import foundation.functoriality-dependent-pair-types
+open import foundation.fundamental-theorem-of-identity-types
+open import foundation.homotopy-induction
+open import foundation.identity-types
+open import foundation.split-surjective-maps
+open import foundation.structure-identity-principle
+open import foundation.subtype-identity-principle
+open import foundation.surjective-maps
+open import foundation.univalence
+open import foundation.universe-levels
+
+open import foundation-core.cartesian-product-types
+open import foundation-core.contractible-maps
+open import foundation-core.equivalences
+open import foundation-core.fibers-of-maps
+open import foundation-core.function-types
+open import foundation-core.homotopies
+open import foundation-core.propositions
+open import foundation-core.retracts-of-types
+open import foundation-core.sections
+open import foundation-core.torsorial-type-families
+open import foundation-core.truncation-levels
+
+open import logic.double-negation-stable-embeddings
+open import logic.irrefutable-types
+```
+
+
+
+## Idea
+
+A map `f : A → B` is
+{{#concept "double negation dense" Agda=is-double-negation-dense-map}}, if all
+of its [fibers](foundation-core.fibers-of-maps.md) are
+[irrefutable](foundation.irrefutable-propositions.md). I.e., for every `y : B`,
+it is not not true that `y` has a preimage under `f`.
+
+Double negation dense maps are a close cousin of
+[surjective maps](foundation.surjective-maps.md), but don't require the
+existence of
+[propositional truncations](foundation.propositional-truncations.md). In
+particular, every map factors essentially uniquely as a double negation dense
+map followed by a
+[double negation stable embedding](logic.double-negation-stable-embeddings.md),
+through its [double negation image](foundation.double-negation-images.md).
+
+## Definitions
+
+### The predicate on maps of being double negation dense
+
+```agda
+is-double-negation-dense-map-Prop :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} → (A → B) → Prop (l1 ⊔ l2)
+is-double-negation-dense-map-Prop {B = B} f =
+ Π-Prop B (double-negation-type-Prop ∘ fiber f)
+
+is-double-negation-dense-map :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} → (A → B) → UU (l1 ⊔ l2)
+is-double-negation-dense-map f = type-Prop (is-double-negation-dense-map-Prop f)
+
+is-prop-is-double-negation-dense-map :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) →
+ is-prop (is-double-negation-dense-map f)
+is-prop-is-double-negation-dense-map f =
+ is-prop-type-Prop (is-double-negation-dense-map-Prop f)
+```
+
+### The type of double negation dense maps
+
+```agda
+infix 5 _↠¬¬_
+_↠¬¬_ : {l1 l2 : Level} → UU l1 → UU l2 → UU (l1 ⊔ l2)
+A ↠¬¬ B = Σ (A → B) is-double-negation-dense-map
+
+double-negation-dense-map : {l1 l2 : Level} → UU l1 → UU l2 → UU (l1 ⊔ l2)
+double-negation-dense-map = _↠¬¬_
+
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↠¬¬ B)
+ where
+
+ map-double-negation-dense-map : A → B
+ map-double-negation-dense-map = pr1 f
+
+ is-double-negation-dense-map-double-negation-dense-map :
+ is-double-negation-dense-map map-double-negation-dense-map
+ is-double-negation-dense-map-double-negation-dense-map = pr2 f
+```
+
+### The type of all double negation dense maps out of a type
+
+```agda
+Double-Negation-Dense-Map :
+ {l1 : Level} (l2 : Level) → UU l1 → UU (l1 ⊔ lsuc l2)
+Double-Negation-Dense-Map l2 A = Σ (UU l2) (A ↠¬¬_)
+
+module _
+ {l1 l2 : Level} {A : UU l1} (f : Double-Negation-Dense-Map l2 A)
+ where
+
+ type-Double-Negation-Dense-Map : UU l2
+ type-Double-Negation-Dense-Map = pr1 f
+
+ double-negation-dense-map-Double-Negation-Dense-Map :
+ A ↠¬¬ type-Double-Negation-Dense-Map
+ double-negation-dense-map-Double-Negation-Dense-Map = pr2 f
+
+ map-Double-Negation-Dense-Map : A → type-Double-Negation-Dense-Map
+ map-Double-Negation-Dense-Map =
+ map-double-negation-dense-map
+ double-negation-dense-map-Double-Negation-Dense-Map
+
+ is-double-negation-dense-map-Double-Negation-Dense-Map :
+ is-double-negation-dense-map map-Double-Negation-Dense-Map
+ is-double-negation-dense-map-Double-Negation-Dense-Map =
+ is-double-negation-dense-map-double-negation-dense-map
+ double-negation-dense-map-Double-Negation-Dense-Map
+```
+
+## Properties
+
+### Any surjective map is double negation dense
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-double-negation-dense-map-is-surjective :
+ {f : A → B} → is-surjective f → is-double-negation-dense-map f
+ is-double-negation-dense-map-is-surjective H =
+ intro-double-negation-type-trunc-Prop ∘ H
+
+ double-negation-dense-map-surjection : (A ↠ B) → (A ↠¬¬ B)
+ double-negation-dense-map-surjection =
+ tot (λ _ → is-double-negation-dense-map-is-surjective)
+```
+
+### Any map that has a section is double negation dense
+
+```agda
+is-double-negation-dense-map-has-section :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} →
+ section f → is-double-negation-dense-map f
+is-double-negation-dense-map-has-section (g , G) b =
+ intro-double-negation (g b , G b)
+```
+
+### The underlying double negation dense map of a retract
+
+```agda
+double-negation-dense-map-retract :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ A retract-of B → B ↠¬¬ A
+double-negation-dense-map-retract R =
+ ( map-retraction-retract R ,
+ is-double-negation-dense-map-has-section (section-retract R))
+```
+
+### Any split surjective map is double negation dense
+
+```agda
+is-double-negation-dense-map-is-split-surjective :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} →
+ is-split-surjective f → is-double-negation-dense-map f
+is-double-negation-dense-map-is-split-surjective H =
+ intro-double-negation ∘ H
+```
+
+### Any equivalence is double negation dense
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-double-negation-dense-map-is-equiv :
+ {f : A → B} → is-equiv f → is-double-negation-dense-map f
+ is-double-negation-dense-map-is-equiv H =
+ is-double-negation-dense-map-has-section (section-is-equiv H)
+
+ is-double-negation-dense-map-equiv :
+ (e : A ≃ B) → is-double-negation-dense-map (map-equiv e)
+ is-double-negation-dense-map-equiv e =
+ is-double-negation-dense-map-is-equiv (is-equiv-map-equiv e)
+
+ double-negation-dense-map-equiv : A ≃ B → A ↠¬¬ B
+ double-negation-dense-map-equiv e =
+ (map-equiv e , is-double-negation-dense-map-equiv e)
+
+ double-negation-dense-map-inv-equiv : B ≃ A → A ↠¬¬ B
+ double-negation-dense-map-inv-equiv e =
+ double-negation-dense-map-equiv (inv-equiv e)
+```
+
+### The identity function is double negation dense
+
+```agda
+module _
+ {l : Level} {A : UU l}
+ where
+
+ is-double-negation-dense-map-id : is-double-negation-dense-map (id {A = A})
+ is-double-negation-dense-map-id a = intro-double-negation (a , refl)
+```
+
+### A (k+1)-connected map is double negation dense
+
+```agda
+is-double-negation-dense-map-is-connected-map :
+ {l1 l2 : Level} (k : 𝕋) {A : UU l1} {B : UU l2}
+ {f : A → B} → is-connected-map (succ-𝕋 k) f →
+ is-double-negation-dense-map f
+is-double-negation-dense-map-is-connected-map k H =
+ is-double-negation-dense-map-is-surjective
+ ( is-surjective-is-connected-map k H)
+```
+
+### Maps which are homotopic to double negation dense maps are double negation dense
+
+```agda
+module _
+ { l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ abstract
+ is-double-negation-dense-map-htpy :
+ {f g : A → B} → f ~ g →
+ is-double-negation-dense-map g → is-double-negation-dense-map f
+ is-double-negation-dense-map-htpy {f} {g} H K b =
+ map-double-negation (map-equiv-fiber-htpy H b) (K b)
+
+ abstract
+ is-double-negation-dense-map-htpy' :
+ {f g : A → B} → f ~ g →
+ is-double-negation-dense-map f → is-double-negation-dense-map g
+ is-double-negation-dense-map-htpy' H =
+ is-double-negation-dense-map-htpy (inv-htpy H)
+```
+
+### A map that is both double negation dense and a double negation stable embedding is an equivalence
+
+```agda
+abstract
+ is-equiv-is-double-negation-stable-emb-is-double-negation-dense-map :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} →
+ is-double-negation-dense-map f →
+ is-double-negation-stable-emb f →
+ is-equiv f
+ is-equiv-is-double-negation-stable-emb-is-double-negation-dense-map H K =
+ is-equiv-is-contr-map
+ ( λ y →
+ is-proof-irrelevant-is-prop
+ ( is-prop-map-is-double-negation-stable-emb K y)
+ ( is-double-negation-eliminating-map-is-double-negation-stable-emb K y
+ ( H y)))
+```
+
+### Composite of double negation dense maps
+
+```agda
+module _
+ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
+ where
+
+ is-double-negation-dense-map-comp :
+ {g : B → X} {h : A → B} →
+ is-double-negation-dense-map g →
+ is-double-negation-dense-map h →
+ is-double-negation-dense-map (g ∘ h)
+ is-double-negation-dense-map-comp {g} {h} G H x =
+ map-double-negation
+ ( map-inv-compute-fiber-comp g h x)
+ ( is-irrefutable-Σ (G x) (H ∘ pr1))
+
+ is-double-negation-dense-map-left-map-triangle :
+ (f : A → X) (g : B → X) (h : A → B) → f ~ g ∘ h →
+ is-double-negation-dense-map g →
+ is-double-negation-dense-map h →
+ is-double-negation-dense-map f
+ is-double-negation-dense-map-left-map-triangle f g h K G H =
+ is-double-negation-dense-map-htpy K (is-double-negation-dense-map-comp G H)
+
+ comp-double-negation-dense-map : B ↠¬¬ X → A ↠¬¬ B → A ↠¬¬ X
+ comp-double-negation-dense-map (g , G) (h , H) =
+ ( g ∘ h , is-double-negation-dense-map-comp G H)
+```
+
+### Products of double negation dense maps
+
+```agda
+module _
+ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4}
+ where
+
+ is-double-negation-dense-map-product :
+ {f : A → C} {g : B → D} →
+ is-double-negation-dense-map f →
+ is-double-negation-dense-map g →
+ is-double-negation-dense-map (map-product f g)
+ is-double-negation-dense-map-product {f} {g} F G (c , d) =
+ map-double-negation
+ ( map-inv-compute-fiber-map-product f g (c , d))
+ ( is-irrefutable-product (F c) (G d))
+
+ double-negation-dense-map-product :
+ (A ↠¬¬ C) → (B ↠¬¬ D) → ((A × B) ↠¬¬ (C × D))
+ double-negation-dense-map-product f g =
+ map-product
+ ( map-double-negation-dense-map f)
+ ( map-double-negation-dense-map g) ,
+ is-double-negation-dense-map-product
+ ( is-double-negation-dense-map-double-negation-dense-map f)
+ ( is-double-negation-dense-map-double-negation-dense-map g)
+```
+
+### The composite of a double negation dense map before an equivalence is double negation dense
+
+```agda
+is-double-negation-dense-map-left-comp-equiv :
+ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3}
+ (e : B ≃ C) {f : A → B} →
+ is-double-negation-dense-map f →
+ is-double-negation-dense-map (map-equiv e ∘ f)
+is-double-negation-dense-map-left-comp-equiv e =
+ is-double-negation-dense-map-comp (is-double-negation-dense-map-equiv e)
+```
+
+### The composite of a double negation dense map after an equivalence is double negation dense
+
+```agda
+is-double-negation-dense-map-right-comp-equiv :
+ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : B → C} →
+ is-double-negation-dense-map f →
+ (e : A ≃ B) →
+ is-double-negation-dense-map (f ∘ map-equiv e)
+is-double-negation-dense-map-right-comp-equiv H e =
+ is-double-negation-dense-map-comp H (is-double-negation-dense-map-equiv e)
+```
+
+### If a composite is double negation dense, then so is its left factor
+
+```agda
+module _
+ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {X : UU l3}
+ where
+
+ is-double-negation-dense-map-left-factor :
+ {g : B → X} (h : A → B) →
+ is-double-negation-dense-map (g ∘ h) → is-double-negation-dense-map g
+ is-double-negation-dense-map-left-factor {g} h GH x =
+ map-double-negation (pr1 ∘ map-compute-fiber-comp g h x) (GH x)
+
+ is-double-negation-dense-map-right-map-triangle' :
+ (f : A → X) (g : B → X) (h : A → B) → g ∘ h ~ f →
+ is-double-negation-dense-map f → is-double-negation-dense-map g
+ is-double-negation-dense-map-right-map-triangle' f g h K F =
+ is-double-negation-dense-map-left-factor h
+ ( is-double-negation-dense-map-htpy K F)
+
+ is-double-negation-dense-map-right-map-triangle :
+ (f : A → X) (g : B → X) (h : A → B) → f ~ g ∘ h →
+ is-double-negation-dense-map f → is-double-negation-dense-map g
+ is-double-negation-dense-map-right-map-triangle f g h K =
+ is-double-negation-dense-map-right-map-triangle' f g h (inv-htpy K)
+```
+
+### Characterization of the identity type of `A ↠¬¬ B`
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↠¬¬ B)
+ where
+
+ htpy-double-negation-dense-map : (A ↠¬¬ B) → UU (l1 ⊔ l2)
+ htpy-double-negation-dense-map g =
+ map-double-negation-dense-map f ~ map-double-negation-dense-map g
+
+ refl-htpy-double-negation-dense-map : htpy-double-negation-dense-map f
+ refl-htpy-double-negation-dense-map = refl-htpy
+
+ is-torsorial-htpy-double-negation-dense-map :
+ is-torsorial htpy-double-negation-dense-map
+ is-torsorial-htpy-double-negation-dense-map =
+ is-torsorial-Eq-subtype
+ ( is-torsorial-htpy (map-double-negation-dense-map f))
+ ( is-prop-is-double-negation-dense-map)
+ ( map-double-negation-dense-map f)
+ ( refl-htpy)
+ ( is-double-negation-dense-map-double-negation-dense-map f)
+
+ htpy-eq-double-negation-dense-map :
+ (g : A ↠¬¬ B) → (f = g) → htpy-double-negation-dense-map g
+ htpy-eq-double-negation-dense-map .f refl =
+ refl-htpy-double-negation-dense-map
+
+ is-equiv-htpy-eq-double-negation-dense-map :
+ (g : A ↠¬¬ B) → is-equiv (htpy-eq-double-negation-dense-map g)
+ is-equiv-htpy-eq-double-negation-dense-map =
+ fundamental-theorem-id
+ is-torsorial-htpy-double-negation-dense-map
+ htpy-eq-double-negation-dense-map
+
+ extensionality-double-negation-dense-map :
+ (g : A ↠¬¬ B) → (f = g) ≃ htpy-double-negation-dense-map g
+ extensionality-double-negation-dense-map g =
+ ( htpy-eq-double-negation-dense-map g ,
+ is-equiv-htpy-eq-double-negation-dense-map g)
+
+ eq-htpy-double-negation-dense-map :
+ (g : A ↠¬¬ B) → htpy-double-negation-dense-map g → f = g
+ eq-htpy-double-negation-dense-map g =
+ map-inv-equiv (extensionality-double-negation-dense-map g)
+```
+
+### Characterization of the identity type of `Double-Negation-Dense-Map l2 A`
+
+```agda
+equiv-Double-Negation-Dense-Map :
+ {l1 l2 l3 : Level} {A : UU l1} →
+ Double-Negation-Dense-Map l2 A →
+ Double-Negation-Dense-Map l3 A →
+ UU (l1 ⊔ l2 ⊔ l3)
+equiv-Double-Negation-Dense-Map f g =
+ Σ ( type-Double-Negation-Dense-Map f ≃
+ type-Double-Negation-Dense-Map g)
+ ( λ e →
+ map-equiv e ∘ map-Double-Negation-Dense-Map f ~
+ map-Double-Negation-Dense-Map g)
+
+module _
+ {l1 l2 : Level} {A : UU l1} (f : Double-Negation-Dense-Map l2 A)
+ where
+
+ id-equiv-Double-Negation-Dense-Map : equiv-Double-Negation-Dense-Map f f
+ pr1 id-equiv-Double-Negation-Dense-Map = id-equiv
+ pr2 id-equiv-Double-Negation-Dense-Map = refl-htpy
+
+ is-torsorial-equiv-Double-Negation-Dense-Map :
+ is-torsorial (equiv-Double-Negation-Dense-Map f)
+ is-torsorial-equiv-Double-Negation-Dense-Map =
+ is-torsorial-Eq-structure
+ ( is-torsorial-equiv (type-Double-Negation-Dense-Map f))
+ ( type-Double-Negation-Dense-Map f , id-equiv)
+ ( is-torsorial-htpy-double-negation-dense-map
+ ( double-negation-dense-map-Double-Negation-Dense-Map f))
+
+ equiv-eq-Double-Negation-Dense-Map :
+ (g : Double-Negation-Dense-Map l2 A) →
+ f = g → equiv-Double-Negation-Dense-Map f g
+ equiv-eq-Double-Negation-Dense-Map .f refl =
+ id-equiv-Double-Negation-Dense-Map
+
+ is-equiv-equiv-eq-Double-Negation-Dense-Map :
+ (g : Double-Negation-Dense-Map l2 A) →
+ is-equiv (equiv-eq-Double-Negation-Dense-Map g)
+ is-equiv-equiv-eq-Double-Negation-Dense-Map =
+ fundamental-theorem-id
+ is-torsorial-equiv-Double-Negation-Dense-Map
+ equiv-eq-Double-Negation-Dense-Map
+
+ extensionality-Double-Negation-Dense-Map :
+ (g : Double-Negation-Dense-Map l2 A) →
+ (f = g) ≃ equiv-Double-Negation-Dense-Map f g
+ pr1 (extensionality-Double-Negation-Dense-Map g) =
+ equiv-eq-Double-Negation-Dense-Map g
+ pr2 (extensionality-Double-Negation-Dense-Map g) =
+ is-equiv-equiv-eq-Double-Negation-Dense-Map g
+
+ eq-equiv-Double-Negation-Dense-Map :
+ (g : Double-Negation-Dense-Map l2 A) →
+ equiv-Double-Negation-Dense-Map f g → f = g
+ eq-equiv-Double-Negation-Dense-Map g =
+ map-inv-equiv (extensionality-Double-Negation-Dense-Map g)
+```
+
+### Every type that maps double negation densely onto an irrefutable type is irrefutable
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-irrefutable-is-double-negation-dense-map :
+ {f : A → B} → is-double-negation-dense-map f → ¬¬ B → ¬¬ A
+ is-irrefutable-is-double-negation-dense-map F nnb na =
+ nnb (λ b → F b (λ p → na (pr1 p)))
+
+ is-irrefutable-double-negation-dense-map :
+ A ↠¬¬ B → ¬¬ B → ¬¬ A
+ is-irrefutable-double-negation-dense-map f =
+ is-irrefutable-is-double-negation-dense-map
+ ( is-double-negation-dense-map-double-negation-dense-map f)
+```
+
+## See also
+
+- [Double negation modality](foundation.double-negation-modality.md)
+
+## External links
+
+- [TypeTopology.Density](https://martinescardo.github.io/TypeTopology/TypeTopology.Density.html)
+ at TypeTopology
diff --git a/src/logic/double-negation-dense-subtypes.lagda.md b/src/logic/double-negation-dense-subtypes.lagda.md
new file mode 100644
index 0000000000..0afa4b0cb6
--- /dev/null
+++ b/src/logic/double-negation-dense-subtypes.lagda.md
@@ -0,0 +1,143 @@
+# Double negation dense subtypes of types
+
+```agda
+module logic.double-negation-dense-subtypes where
+```
+
+Imports
+
+```agda
+open import foundation.complements-subtypes
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.full-subtypes
+open import foundation.function-types
+open import foundation.type-arithmetic-dependent-pair-types
+open import foundation.unit-type
+open import foundation.universe-levels
+
+open import foundation-core.equivalences
+open import foundation-core.identity-types
+open import foundation-core.propositions
+open import foundation-core.subtypes
+open import foundation-core.transport-along-identifications
+
+open import logic.double-negation-dense-maps
+```
+
+
+
+## Idea
+
+A
+{{#concept "double negationdense" Disambiguation="subtype" Agda=is-double-negation-dense-subtype Agda=double-negation-dense-subtype}}
+[subtype](foundation.subtypes.md) of a type `X` is a subtype `P ⊆ X` such that
+its double [complement](foundation.complements-subtypes.md) is
+[full](foundation.full-subtypes.md).
+
+## Definitions
+
+### The predicate on a subtype of being double negation dense
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} (P : subtype l2 A)
+ where
+
+ is-double-negation-dense-subtype-Prop : Prop (l1 ⊔ l2)
+ is-double-negation-dense-subtype-Prop =
+ is-full-subtype-Prop (complement-subtype (complement-subtype P))
+
+ is-double-negation-dense-subtype : UU (l1 ⊔ l2)
+ is-double-negation-dense-subtype =
+ type-Prop is-double-negation-dense-subtype-Prop
+
+ is-prop-is-double-negation-dense-subtype :
+ is-prop is-double-negation-dense-subtype
+ is-prop-is-double-negation-dense-subtype =
+ is-prop-type-Prop is-double-negation-dense-subtype-Prop
+```
+
+### The type of double negation dense subtypes
+
+```agda
+double-negation-dense-subtype :
+ {l1 : Level} (l2 : Level) → UU l1 → UU (l1 ⊔ lsuc l2)
+double-negation-dense-subtype l2 A =
+ Σ (subtype l2 A) is-double-negation-dense-subtype
+
+module _
+ {l1 l2 : Level} {A : UU l1} (P : double-negation-dense-subtype l2 A)
+ where
+
+ subtype-double-negation-dense-subtype : subtype l2 A
+ subtype-double-negation-dense-subtype = pr1 P
+
+ is-double-negation-dense-double-negation-dense-subtype :
+ is-double-negation-dense-subtype subtype-double-negation-dense-subtype
+ is-double-negation-dense-double-negation-dense-subtype = pr2 P
+
+ type-double-negation-dense-subtype : UU (l1 ⊔ l2)
+ type-double-negation-dense-subtype =
+ type-subtype subtype-double-negation-dense-subtype
+
+ is-in-double-negation-dense-subtype : A → UU l2
+ is-in-double-negation-dense-subtype =
+ is-in-subtype subtype-double-negation-dense-subtype
+
+ is-prop-is-in-double-negation-dense-subtype :
+ (x : A) → is-prop (is-in-double-negation-dense-subtype x)
+ is-prop-is-in-double-negation-dense-subtype =
+ is-prop-is-in-subtype subtype-double-negation-dense-subtype
+
+ inclusion-double-negation-dense-subtype :
+ type-double-negation-dense-subtype → A
+ inclusion-double-negation-dense-subtype =
+ inclusion-subtype subtype-double-negation-dense-subtype
+```
+
+## Properties
+
+### A subtype is double negation dense if and only if the inclusion is double negation dense
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} (P : subtype l2 A)
+ where
+
+ is-double-negation-dense-inclusion-is-double-negation-dense-subtype :
+ is-double-negation-dense-subtype P →
+ is-double-negation-dense-map (inclusion-subtype P)
+ is-double-negation-dense-inclusion-is-double-negation-dense-subtype H x =
+ map-double-negation (λ y → ((x , y) , refl)) (H x)
+
+ double-negation-dense-inclusion-is-double-negation-dense-subtype :
+ is-double-negation-dense-subtype P → type-subtype P ↠¬¬ A
+ double-negation-dense-inclusion-is-double-negation-dense-subtype H =
+ ( inclusion-subtype P ,
+ is-double-negation-dense-inclusion-is-double-negation-dense-subtype H)
+
+ is-dense-is-double-negation-dense-inclusion-subtype :
+ is-double-negation-dense-map (inclusion-subtype P) →
+ is-double-negation-dense-subtype P
+ is-dense-is-double-negation-dense-inclusion-subtype H x =
+ map-double-negation (λ p → tr (is-in-subtype P) (pr2 p) (pr2 (pr1 p))) (H x)
+
+module _
+ {l1 l2 : Level} {A : UU l1} (P : double-negation-dense-subtype l2 A)
+ where
+
+ is-double-negation-dense-inclusion-double-negation-dense-subtype :
+ is-double-negation-dense-map (inclusion-double-negation-dense-subtype P)
+ is-double-negation-dense-inclusion-double-negation-dense-subtype =
+ is-double-negation-dense-inclusion-is-double-negation-dense-subtype
+ ( subtype-double-negation-dense-subtype P)
+ ( is-double-negation-dense-double-negation-dense-subtype P)
+
+ double-negation-dense-inclusion-double-negation-dense-subtype :
+ type-double-negation-dense-subtype P ↠¬¬ A
+ double-negation-dense-inclusion-double-negation-dense-subtype =
+ double-negation-dense-inclusion-is-double-negation-dense-subtype
+ ( subtype-double-negation-dense-subtype P)
+ ( is-double-negation-dense-double-negation-dense-subtype P)
+```
diff --git a/src/logic/double-negation-eliminating-maps.lagda.md b/src/logic/double-negation-eliminating-maps.lagda.md
index 836e3191e1..8313f7656b 100644
--- a/src/logic/double-negation-eliminating-maps.lagda.md
+++ b/src/logic/double-negation-eliminating-maps.lagda.md
@@ -10,7 +10,6 @@ module logic.double-negation-eliminating-maps where
open import foundation.action-on-identifications-functions
open import foundation.cartesian-morphisms-arrows
open import foundation.coproduct-types
-open import foundation.decidable-equality
open import foundation.decidable-maps
open import foundation.decidable-types
open import foundation.dependent-pair-types
@@ -18,11 +17,10 @@ open import foundation.double-negation
open import foundation.empty-types
open import foundation.functoriality-cartesian-product-types
open import foundation.functoriality-coproduct-types
+open import foundation.hilbert-epsilon-operators-maps
open import foundation.identity-types
open import foundation.injective-maps
-open import foundation.retractions
open import foundation.retracts-of-maps
-open import foundation.retracts-of-types
open import foundation.transport-along-identifications
open import foundation.universe-levels
@@ -180,7 +178,7 @@ module _
(y : B) → ¬¬ (fiber f y) → Σ (fiber g (g y)) (λ t → fiber f (pr1 t))
fiber-comp-is-double-negation-eliminating-map-right-factor' y nnfy =
map-compute-fiber-comp g f (g y)
- ( GF (g y) (λ ngfgy → nnfy λ x → ngfgy ((pr1 x) , ap g (pr2 x))))
+ ( GF (g y) (map-double-negation (λ x → (pr1 x , ap g (pr2 x))) nnfy))
is-double-negation-eliminating-map-right-factor' :
is-injective g → is-double-negation-eliminating-map f
@@ -333,3 +331,27 @@ module _
( retract-fiber-retract-map f g R x)
( G (map-codomain-inclusion-retract-map f g R x))
```
+
+### Double negation eliminating maps have Hilbert ε-operators
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ ε-operator-map-is-double-negation-eliminating-map :
+ {f : A → B} → is-double-negation-eliminating-map f → ε-operator-map f
+ ε-operator-map-is-double-negation-eliminating-map H x =
+ ε-operator-Hilbert-has-double-negation-elim (H x)
+
+ ε-operator-double-negation-eliminating-map :
+ (f : A →¬¬ B) → ε-operator-map (map-double-negation-eliminating-map f)
+ ε-operator-double-negation-eliminating-map f =
+ ε-operator-map-is-double-negation-eliminating-map
+ ( is-double-negation-eliminating-double-negation-eliminating-map f)
+```
+
+## See also
+
+- In [double negation images](foundation.double-negation-images.md) we show that
+ injective maps with double negation elimination are embeddings.
diff --git a/src/logic/double-negation-elimination.lagda.md b/src/logic/double-negation-elimination.lagda.md
index 1acfd21ebb..da4cab7023 100644
--- a/src/logic/double-negation-elimination.lagda.md
+++ b/src/logic/double-negation-elimination.lagda.md
@@ -12,20 +12,21 @@ open import foundation.coproduct-types
open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.double-negation
+open import foundation.empty-types
open import foundation.evaluation-functions
open import foundation.hilberts-epsilon-operators
+open import foundation.irrefutable-equality
open import foundation.logical-equivalences
+open import foundation.mere-equality
+open import foundation.negation
open import foundation.retracts-of-types
open import foundation.transport-along-identifications
open import foundation.unit-type
open import foundation.universe-levels
open import foundation-core.contractible-types
-open import foundation-core.decidable-propositions
-open import foundation-core.empty-types
open import foundation-core.equivalences
open import foundation-core.function-types
-open import foundation-core.negation
open import foundation-core.propositions
```
@@ -171,6 +172,81 @@ double-negation-elim-neg :
double-negation-elim-neg A f p = f (ev p)
```
+### Double negation elimination for dependent sums of types with double negation elimination over a double negation stable proposition
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ where
+
+ double-negation-elim-Σ-has-double-negation-dense-equality-base :
+ has-double-negation-dense-equality A →
+ has-double-negation-elim A →
+ ((x : A) → has-double-negation-elim (B x)) →
+ has-double-negation-elim (Σ A B)
+ double-negation-elim-Σ-has-double-negation-dense-equality-base H f g h =
+ ( f ( map-double-negation pr1 h)) ,
+ ( g ( f ( map-double-negation pr1 h))
+ ( λ nb →
+ h ( λ x →
+ H ( pr1 x)
+ ( f (map-double-negation pr1 h))
+ ( λ p → nb (tr B p (pr2 x))))))
+
+ double-negation-elim-Σ-all-elements-merely-equal-base :
+ all-elements-merely-equal A →
+ has-double-negation-elim A →
+ ((x : A) → has-double-negation-elim (B x)) →
+ has-double-negation-elim (Σ A B)
+ double-negation-elim-Σ-all-elements-merely-equal-base H =
+ double-negation-elim-Σ-has-double-negation-dense-equality-base
+ ( has-double-negation-dense-equality-all-elements-merely-equal H)
+
+ double-negation-elim-Σ-is-prop-base :
+ is-prop A → has-double-negation-elim A →
+ ((x : A) → has-double-negation-elim (B x)) →
+ has-double-negation-elim (Σ A B)
+ double-negation-elim-Σ-is-prop-base is-prop-A =
+ double-negation-elim-Σ-has-double-negation-dense-equality-base
+ ( λ x y → intro-double-negation (eq-is-prop is-prop-A))
+
+ double-negation-elim-base-Σ-section' :
+ has-double-negation-elim (Σ A B) →
+ (A → Σ A B) →
+ has-double-negation-elim A
+ double-negation-elim-base-Σ-section' H f nna =
+ pr1 (H (map-double-negation f nna))
+
+ double-negation-elim-base-Σ-section :
+ has-double-negation-elim (Σ A B) →
+ ((x : A) → B x) →
+ has-double-negation-elim A
+ double-negation-elim-base-Σ-section H f =
+ double-negation-elim-base-Σ-section' H (λ x → x , f x)
+
+ double-negation-elim-family-Σ-is-prop-base :
+ has-double-negation-elim (Σ A B) →
+ is-prop A →
+ (x : A) → has-double-negation-elim (B x)
+ double-negation-elim-family-Σ-is-prop-base K is-prop-A x nnb =
+ tr B (eq-is-prop is-prop-A) (pr2 (K (map-double-negation (pair x) nnb)))
+```
+
+### Double negation elimination for products of types with double negation elimination
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ double-negation-elim-product :
+ has-double-negation-elim A →
+ has-double-negation-elim B →
+ has-double-negation-elim (A × B)
+ double-negation-elim-product f g h =
+ ( f (map-double-negation pr1 h) , g (map-double-negation pr2 h))
+```
+
### Double negation elimination for universal quantification over double negations
```agda
@@ -178,17 +254,15 @@ module _
{l1 l2 : Level} {P : UU l1} {Q : P → UU l2}
where
- double-negation-elim-for-all-neg-neg :
+ double-negation-elim-Π-neg-neg :
has-double-negation-elim ((p : P) → ¬¬ (Q p))
- double-negation-elim-for-all-neg-neg f p =
- double-negation-elim-neg
- ( ¬ (Q p))
- ( map-double-negation (λ (g : (u : P) → ¬¬ (Q u)) → g p) f)
+ double-negation-elim-Π-neg-neg f p =
+ double-negation-elim-neg (¬ (Q p)) (map-double-negation (ev p) f)
- double-negation-elim-for-all :
+ double-negation-elim-Π :
((p : P) → has-double-negation-elim (Q p)) →
has-double-negation-elim ((p : P) → Q p)
- double-negation-elim-for-all H f p = H p (λ nq → f (λ g → nq (g p)))
+ double-negation-elim-Π H f p = H p (map-double-negation (ev p) f)
```
### Double negation elimination for function types into double negations
@@ -198,61 +272,21 @@ module _
{l1 l2 : Level} {P : UU l1} {Q : UU l2}
where
- double-negation-elim-exp-neg-neg :
- has-double-negation-elim (P → ¬¬ Q)
- double-negation-elim-exp-neg-neg =
- double-negation-elim-for-all-neg-neg
+ double-negation-elim-exp-neg-neg : has-double-negation-elim (P → ¬¬ Q)
+ double-negation-elim-exp-neg-neg = double-negation-elim-Π-neg-neg
double-negation-elim-exp :
- has-double-negation-elim Q →
- has-double-negation-elim (P → Q)
- double-negation-elim-exp q = double-negation-elim-for-all (λ _ → q)
-```
-
-### Double negation elimination for dependent sums of types with double negation elimination over a double negation stable proposition
-
-```agda
-double-negation-elim-Σ-is-prop-base :
- {l1 l2 : Level} {A : UU l1} {B : A → UU l2} →
- is-prop A →
- has-double-negation-elim A →
- ((a : A) → has-double-negation-elim (B a)) →
- has-double-negation-elim (Σ A B)
-double-negation-elim-Σ-is-prop-base {B = B} is-prop-A f g h =
- ( f (λ na → h (na ∘ pr1))) ,
- ( g ( f (λ na → h (na ∘ pr1)))
- ( λ nb → h (λ y → nb (tr B (eq-is-prop is-prop-A) (pr2 y)))))
-
-double-negation-elim-Σ-is-decidable-prop-base :
- {l1 l2 : Level} {P : UU l1} {B : P → UU l2} →
- is-decidable-prop P →
- ((x : P) → has-double-negation-elim (B x)) →
- has-double-negation-elim (Σ P B)
-double-negation-elim-Σ-is-decidable-prop-base (H , d) =
- double-negation-elim-Σ-is-prop-base H (double-negation-elim-is-decidable d)
-```
-
-### Double negation elimination for products of types with double negation elimination
-
-```agda
-double-negation-elim-product :
- {l1 l2 : Level} {A : UU l1} {B : UU l2} →
- has-double-negation-elim A →
- has-double-negation-elim B →
- has-double-negation-elim (A × B)
-double-negation-elim-product f g h =
- f (λ na → h (na ∘ pr1)) , g (λ nb → h (nb ∘ pr2))
+ has-double-negation-elim Q → has-double-negation-elim (P → Q)
+ double-negation-elim-exp q = double-negation-elim-Π (λ _ → q)
```
### If a type satisfies untruncated double negation elimination then it has a Hilbert ε-operator
```agda
ε-operator-Hilbert-has-double-negation-elim :
- {l1 : Level} {A : UU l1} →
- has-double-negation-elim A →
- ε-operator-Hilbert A
-ε-operator-Hilbert-has-double-negation-elim {A = A} H =
- H ∘ double-negation-double-negation-type-trunc-Prop A ∘ intro-double-negation
+ {l1 : Level} {A : UU l1} → has-double-negation-elim A → ε-operator-Hilbert A
+ε-operator-Hilbert-has-double-negation-elim H =
+ H ∘ double-negation-double-negation-type-trunc-Prop ∘ intro-double-negation
```
## See also
diff --git a/src/logic/double-negation-stable-embeddings.lagda.md b/src/logic/double-negation-stable-embeddings.lagda.md
index 4e6a207085..ccca6ddc30 100644
--- a/src/logic/double-negation-stable-embeddings.lagda.md
+++ b/src/logic/double-negation-stable-embeddings.lagda.md
@@ -10,9 +10,6 @@ module logic.double-negation-stable-embeddings where
open import foundation.action-on-identifications-functions
open import foundation.cartesian-morphisms-arrows
open import foundation.decidable-embeddings
-open import foundation.decidable-maps
-open import foundation.decidable-propositions
-open import foundation.decidable-types
open import foundation.dependent-pair-types
open import foundation.double-negation-stable-propositions
open import foundation.embeddings
@@ -23,18 +20,15 @@ open import foundation.fundamental-theorem-of-identity-types
open import foundation.homotopy-induction
open import foundation.identity-types
open import foundation.logical-equivalences
-open import foundation.negation
open import foundation.propositional-maps
open import foundation.propositions
open import foundation.retracts-of-maps
open import foundation.subtype-identity-principle
-open import foundation.type-arithmetic-dependent-pair-types
open import foundation.unit-type
open import foundation.universal-property-equivalences
open import foundation.universe-levels
open import foundation-core.cartesian-product-types
-open import foundation-core.coproduct-types
open import foundation-core.empty-types
open import foundation-core.equivalences
open import foundation-core.function-types
@@ -62,6 +56,12 @@ Equivalently, a double negation stable embedding is a map whose fibers are
We refer to this condition as being a
{{#concept "double negation stable propositional map" Disambiguation="of types" Agda=is-double-negation-stable-prop-map}}.
+Double negation stable embeddings form the right class of an orthogonal
+factorization system on types whose left class is
+[double negation dense maps](logic.double-negation-dense-maps.md). This
+orthogonal factorization system is determined by the
+[double negation modality](foundation.double-negation-modality.md).
+
## Definitions
### The condition on a map of being a double negation stable embedding
@@ -729,3 +729,7 @@ module _
( is-emb-terminal-map-is-prop (is-prop-type-Prop P)))
( p))
```
+
+## See also
+
+- [Double negation images](foundation.double-negation-images.md)
diff --git a/src/logic/irrefutable-types.lagda.md b/src/logic/irrefutable-types.lagda.md
new file mode 100644
index 0000000000..f26c0613de
--- /dev/null
+++ b/src/logic/irrefutable-types.lagda.md
@@ -0,0 +1,167 @@
+# Irrefutable types
+
+```agda
+module logic.irrefutable-types where
+```
+
+Imports
+
+```agda
+open import foundation.cartesian-product-types
+open import foundation.contractible-types
+open import foundation.coproduct-types
+open import foundation.decidable-types
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.empty-types
+open import foundation.function-types
+open import foundation.inhabited-types
+open import foundation.negation
+open import foundation.propositions
+open import foundation.subuniverses
+open import foundation.unit-type
+open import foundation.universe-levels
+
+open import logic.double-negation-elimination
+```
+
+
+
+## Idea
+
+The [subuniverse](foundation.subuniverses.md) of
+{{#concept "irrefutable types" Agda=Irrefutable-Type}}, or **double negation
+dense types**, consists of types `X` for which the
+[double negation](foundation.double-negation.md) `¬¬X` is true.
+
+## Definitions
+
+### The predicate on a type of being irrefutable
+
+```agda
+is-irrefutable : {l : Level} → UU l → UU l
+is-irrefutable X = ¬¬ X
+
+is-prop-is-irrefutable : {l : Level} {X : UU l} → is-prop (is-irrefutable X)
+is-prop-is-irrefutable = is-prop-double-negation
+
+is-irrefutable-prop-Type : {l : Level} → UU l → Prop l
+is-irrefutable-prop-Type X = (is-irrefutable X , is-prop-is-irrefutable)
+```
+
+### The subuniverse of irrefutable types
+
+```agda
+Irrefutable-Type : (l : Level) → UU (lsuc l)
+Irrefutable-Type l = type-subuniverse is-irrefutable-prop-Type
+
+make-Irrefutable-Type :
+ {l : Level} {X : UU l} → is-irrefutable X → Irrefutable-Type l
+make-Irrefutable-Type {X = X} is-irrefutable-X = (X , is-irrefutable-X)
+
+module _
+ {l : Level} (X : Irrefutable-Type l)
+ where
+
+ type-Irrefutable-Type : UU l
+ type-Irrefutable-Type = pr1 X
+
+ is-irrefutable-Irrefutable-Type : is-irrefutable type-Irrefutable-Type
+ is-irrefutable-Irrefutable-Type = pr2 X
+```
+
+## Properties
+
+### Provable types are irrefutable
+
+```agda
+is-irrefutable-has-element : {l : Level} {X : UU l} → X → is-irrefutable X
+is-irrefutable-has-element = intro-double-negation
+
+is-irrefutable-unit : is-irrefutable unit
+is-irrefutable-unit = is-irrefutable-has-element star
+```
+
+### Inhabited types are irrefutable
+
+```agda
+is-irrefutable-is-inhabited :
+ {l : Level} {X : UU l} → is-inhabited X → is-irrefutable X
+is-irrefutable-is-inhabited = intro-double-negation-type-trunc-Prop
+```
+
+### Contractible types are irrefutable
+
+```agda
+is-irrefutable-is-contr :
+ {l : Level} {X : UU l} → is-contr X → is-irrefutable X
+is-irrefutable-is-contr H = intro-double-negation (center H)
+```
+
+### If it is irrefutable that a type is irrefutable, then the type is irrefutable
+
+```agda
+is-idempotent-is-irrefutable :
+ {l : Level} {X : UU l} → is-irrefutable (is-irrefutable X) → is-irrefutable X
+is-idempotent-is-irrefutable {X = X} = double-negation-elim-neg (¬ X)
+```
+
+### Decidability is irrefutable
+
+```agda
+is-irrefutable-is-decidable :
+ {l : Level} {A : UU l} → is-irrefutable (is-decidable A)
+is-irrefutable-is-decidable H = H (inr (H ∘ inl))
+```
+
+### Double negation elimination is irrefutable
+
+```agda
+is-irrefutable-double-negation-elim :
+ {l : Level} {A : UU l} → is-irrefutable (has-double-negation-elim A)
+is-irrefutable-double-negation-elim H =
+ H (λ f → ex-falso (f (λ a → H (λ _ → a))))
+```
+
+### Dependent sums of irrefutable types
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ where
+
+ is-irrefutable-Σ :
+ is-irrefutable A → ((x : A) → is-irrefutable (B x)) → is-irrefutable (Σ A B)
+ is-irrefutable-Σ nna nnb nab = nna (λ a → nnb a (λ b → nab (a , b)))
+```
+
+### Products of irrefutable types
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-irrefutable-product :
+ is-irrefutable A → is-irrefutable B → is-irrefutable (A × B)
+ is-irrefutable-product nna nnb = is-irrefutable-Σ nna (λ _ → nnb)
+```
+
+### Coproducts of irrefutable types
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-irrefutable-coproduct-inl : is-irrefutable A → is-irrefutable (A + B)
+ is-irrefutable-coproduct-inl nna x = nna (x ∘ inl)
+
+ is-irrefutable-coproduct-inr : is-irrefutable B → is-irrefutable (A + B)
+ is-irrefutable-coproduct-inr nnb x = nnb (x ∘ inr)
+```
+
+## See also
+
+- [Irrefutable propositions](foundation.irrefutable-propositions.md)
+- [De Morgan's law](logic.de-morgans-law.md) is irrefutable
diff --git a/src/logic/markovian-types.lagda.md b/src/logic/markovian-types.lagda.md
index 54b779cddd..8e9fd0e12e 100644
--- a/src/logic/markovian-types.lagda.md
+++ b/src/logic/markovian-types.lagda.md
@@ -7,24 +7,15 @@ module logic.markovian-types where
Imports
```agda
-open import elementary-number-theory.natural-numbers
-
open import foundation.booleans
open import foundation.decidable-subtypes
-open import foundation.dependent-pair-types
-open import foundation.disjunction
open import foundation.existential-quantification
open import foundation.function-types
-open import foundation.inhabited-types
open import foundation.negation
open import foundation.universal-quantification
open import foundation.universe-levels
-open import foundation-core.identity-types
open import foundation-core.propositions
-open import foundation-core.sets
-
-open import univalent-combinatorics.standard-finite-types
```
@@ -91,6 +82,10 @@ module _
> This remains to be formalized.
+### Types with decidability search are markovian
+
+> This remains to be formalized.
+
## See also
- [Markov's principle](logic.markovs-principle.md)
diff --git a/src/logic/propositional-double-negation-elimination.lagda.md b/src/logic/propositional-double-negation-elimination.lagda.md
new file mode 100644
index 0000000000..4f81b3f93e
--- /dev/null
+++ b/src/logic/propositional-double-negation-elimination.lagda.md
@@ -0,0 +1,269 @@
+# Propositional double negation elimination
+
+```agda
+module logic.propositional-double-negation-elimination where
+```
+
+Imports
+
+```agda
+open import foundation.cartesian-product-types
+open import foundation.coproduct-types
+open import foundation.decidable-types
+open import foundation.dependent-pair-types
+open import foundation.double-negation
+open import foundation.empty-types
+open import foundation.functoriality-propositional-truncation
+open import foundation.irrefutable-equality
+open import foundation.logical-equivalences
+open import foundation.mere-equality
+open import foundation.negation
+open import foundation.propositional-truncations
+open import foundation.retracts-of-types
+open import foundation.transport-along-identifications
+open import foundation.universe-levels
+
+open import foundation-core.equivalences
+open import foundation-core.function-types
+open import foundation-core.propositions
+
+open import logic.double-negation-elimination
+open import logic.propositionally-decidable-types
+```
+
+
+
+## Idea
+
+We say a type `A` satisfies
+{{#concept "propositional double negation elimination" Disambiguation="on a type" Agda=has-prop-double-negation-elim}}
+if the implication
+
+```text
+ ¬¬A ⇒ ║A║₋₁
+```
+
+holds.
+
+## Definitions
+
+### Propositional double negation elimination
+
+```agda
+module _
+ {l : Level} (A : UU l)
+ where
+
+ has-prop-double-negation-elim : UU l
+ has-prop-double-negation-elim = ¬¬ A → ║ A ║₋₁
+
+ is-prop-has-prop-double-negation-elim : is-prop has-prop-double-negation-elim
+ is-prop-has-prop-double-negation-elim =
+ is-prop-function-type is-prop-type-trunc-Prop
+
+ has-prop-double-negation-elim-Prop : Prop l
+ has-prop-double-negation-elim-Prop =
+ ( has-prop-double-negation-elim , is-prop-has-prop-double-negation-elim)
+```
+
+## Properties
+
+### Propositional double negation elimination is preserved by logical equivalences
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ has-prop-double-negation-elim-iff :
+ A ↔ B → has-prop-double-negation-elim B → has-prop-double-negation-elim A
+ has-prop-double-negation-elim-iff e H =
+ map-trunc-Prop (backward-implication e) ∘
+ H ∘
+ map-double-negation (forward-implication e)
+
+ has-prop-double-negation-elim-iff' :
+ B ↔ A → has-prop-double-negation-elim B → has-prop-double-negation-elim A
+ has-prop-double-negation-elim-iff' e =
+ has-prop-double-negation-elim-iff (inv-iff e)
+```
+
+### Propositional double negation elimination is preserved by equivalences
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ has-prop-double-negation-elim-equiv :
+ A ≃ B → has-prop-double-negation-elim B → has-prop-double-negation-elim A
+ has-prop-double-negation-elim-equiv e =
+ has-prop-double-negation-elim-iff (iff-equiv e)
+
+ has-prop-double-negation-elim-equiv' :
+ B ≃ A → has-prop-double-negation-elim B → has-prop-double-negation-elim A
+ has-prop-double-negation-elim-equiv' e =
+ has-prop-double-negation-elim-iff' (iff-equiv e)
+```
+
+### Propositional double negation elimination is preserved by retracts
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ has-prop-double-negation-elim-retract :
+ A retract-of B →
+ has-prop-double-negation-elim B → has-prop-double-negation-elim A
+ has-prop-double-negation-elim-retract e =
+ has-prop-double-negation-elim-iff (iff-retract e)
+
+ has-prop-double-negation-elim-retract' :
+ B retract-of A →
+ has-prop-double-negation-elim B → has-prop-double-negation-elim A
+ has-prop-double-negation-elim-retract' e =
+ has-prop-double-negation-elim-iff' (iff-retract e)
+```
+
+### If the negation of a type with double negation elimination is decidable, then the type is merely decidable
+
+```agda
+module _
+ {l1 : Level} {A : UU l1}
+ where
+
+ is-inhabited-or-empty-is-decidable-neg-has-prop-double-negation-elim :
+ has-prop-double-negation-elim A →
+ is-decidable (¬ A) →
+ is-inhabited-or-empty A
+ is-inhabited-or-empty-is-decidable-neg-has-prop-double-negation-elim f
+ ( inl nx) =
+ inr nx
+ is-inhabited-or-empty-is-decidable-neg-has-prop-double-negation-elim f
+ ( inr nnx) =
+ inl (f nnx)
+```
+
+**Remark.** It is an established fact that both the property of satisfying
+double negation elimination, and the property of having decidable negation, are
+strictly weaker conditions than being decidable. Therefore, this result
+demonstrates that they are independent too.
+
+### Types with double negation elimination satisfy propositional double negation elimination
+
+```agda
+has-prop-double-negation-elim-has-double-negation-elim :
+ {l : Level} {A : UU l} →
+ has-double-negation-elim A →
+ has-prop-double-negation-elim A
+has-prop-double-negation-elim-has-double-negation-elim H = unit-trunc-Prop ∘ H
+```
+
+### Propositional double negation elimination for merely decidable types
+
+```agda
+prop-double-negation-elim-is-inhabited-or-empty :
+ {l : Level} {A : UU l} →
+ is-inhabited-or-empty A → has-prop-double-negation-elim A
+prop-double-negation-elim-is-inhabited-or-empty (inl |a|) _ = |a|
+prop-double-negation-elim-is-inhabited-or-empty (inr na) nna = ex-falso (nna na)
+```
+
+### Propositional double negation elimination for dependent sums
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : A → UU l2}
+ where
+
+ has-prop-double-negation-elim-Σ-has-double-negation-dense-equality-base :
+ has-double-negation-dense-equality A →
+ has-prop-double-negation-elim A →
+ ((x : A) → has-prop-double-negation-elim (B x)) →
+ has-prop-double-negation-elim (Σ A B)
+ has-prop-double-negation-elim-Σ-has-double-negation-dense-equality-base
+ H f g nnab =
+ rec-trunc-Prop
+ ( trunc-Prop (Σ A B))
+ ( λ a →
+ rec-trunc-Prop
+ ( trunc-Prop (Σ A B))
+ ( λ b → unit-trunc-Prop (a , b))
+ ( g a (λ nb → nnab (λ x → H (pr1 x) a (λ p → nb (tr B p (pr2 x)))))))
+ ( f (map-double-negation pr1 nnab))
+
+ has-prop-double-negation-elim-Σ-all-elements-merely-equal-base :
+ all-elements-merely-equal A →
+ has-prop-double-negation-elim A →
+ ((x : A) → has-prop-double-negation-elim (B x)) →
+ has-prop-double-negation-elim (Σ A B)
+ has-prop-double-negation-elim-Σ-all-elements-merely-equal-base H =
+ has-prop-double-negation-elim-Σ-has-double-negation-dense-equality-base
+ ( λ x y →
+ double-negation-double-negation-type-trunc-Prop
+ ( intro-double-negation (H x y)))
+
+ has-prop-double-negation-elim-Σ-is-prop-base :
+ is-prop A →
+ has-prop-double-negation-elim A →
+ ((x : A) → has-prop-double-negation-elim (B x)) →
+ has-prop-double-negation-elim (Σ A B)
+ has-prop-double-negation-elim-Σ-is-prop-base is-prop-A =
+ has-prop-double-negation-elim-Σ-all-elements-merely-equal-base
+ ( λ x y → unit-trunc-Prop (eq-is-prop is-prop-A))
+
+ has-prop-double-negation-elim-base-Σ-section' :
+ has-prop-double-negation-elim (Σ A B) →
+ (A → Σ A B) →
+ has-prop-double-negation-elim A
+ has-prop-double-negation-elim-base-Σ-section' H f nna =
+ map-trunc-Prop pr1 (H (λ nab → nna (λ x → nab (f x))))
+
+ has-prop-double-negation-elim-base-Σ-section :
+ has-prop-double-negation-elim (Σ A B) →
+ ((x : A) → B x) →
+ has-prop-double-negation-elim A
+ has-prop-double-negation-elim-base-Σ-section H f =
+ has-prop-double-negation-elim-base-Σ-section' H (λ x → x , f x)
+
+ has-prop-double-negation-elim-family-Σ-all-elements-merely-equal-base :
+ has-prop-double-negation-elim (Σ A B) →
+ all-elements-merely-equal A →
+ (x : A) → has-prop-double-negation-elim (B x)
+ has-prop-double-negation-elim-family-Σ-all-elements-merely-equal-base
+ K q x nnb =
+ rec-trunc-Prop
+ ( trunc-Prop (B x))
+ ( λ xy →
+ rec-trunc-Prop
+ ( trunc-Prop (B x))
+ ( λ p → unit-trunc-Prop (tr B p (pr2 xy)))
+ ( q (pr1 xy) x))
+ ( K (λ nab → nnb (λ y → nab (x , y))))
+```
+
+### Double negation elimination for products of types with double negation elimination
+
+```agda
+has-prop-double-negation-elim-product :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ has-prop-double-negation-elim A →
+ has-prop-double-negation-elim B →
+ has-prop-double-negation-elim (A × B)
+has-prop-double-negation-elim-product {A = A} {B} f g nnab =
+ rec-trunc-Prop
+ ( trunc-Prop (A × B))
+ ( λ a →
+ rec-trunc-Prop
+ ( trunc-Prop (A × B))
+ ( λ b → unit-trunc-Prop (a , b))
+ ( g (map-double-negation pr2 nnab)))
+ ( f (map-double-negation pr1 nnab))
+```
+
+## See also
+
+- [The double negation modality](foundation.double-negation-modality.md)
+- [Irrefutable propositions](foundation.irrefutable-propositions.md) are double
+ negation connected types.
diff --git a/src/logic/propositionally-decidable-maps.lagda.md b/src/logic/propositionally-decidable-maps.lagda.md
new file mode 100644
index 0000000000..8bfa67b800
--- /dev/null
+++ b/src/logic/propositionally-decidable-maps.lagda.md
@@ -0,0 +1,187 @@
+# Propositionally decidable maps
+
+```agda
+module logic.propositionally-decidable-maps where
+```
+
+Imports
+
+```agda
+open import elementary-number-theory.natural-numbers
+
+open import foundation.coproduct-types
+open import foundation.decidable-dependent-pair-types
+open import foundation.decidable-maps
+open import foundation.dependent-pair-types
+open import foundation.double-negation-dense-equality-maps
+open import foundation.identity-types
+open import foundation.propositional-truncations
+open import foundation.universe-levels
+
+open import foundation-core.fibers-of-maps
+open import foundation-core.function-types
+open import foundation-core.functoriality-dependent-pair-types
+open import foundation-core.homotopies
+open import foundation-core.injective-maps
+open import foundation-core.iterating-functions
+
+open import logic.propositionally-decidable-types
+```
+
+
+
+## Idea
+
+A [map](foundation-core.function-types.md) is said to be
+{{#concept "propositionally decidable" Disambiguation="map of types" Agda=is-inhabited-or-empty-map}}
+if its [fibers](foundation-core.fibers-of-maps.md) are
+[propositionally decidable types](logic.propositionally-decidable-types.md),
+i.e., if they are merely [inhabited](foundation.inhabited-types.md) or
+[empty](foundation.empty-types.md).
+
+## Definitions
+
+### The propositional decidability predicate on a map
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-inhabited-or-empty-map : (A → B) → UU (l1 ⊔ l2)
+ is-inhabited-or-empty-map f = (y : B) → is-inhabited-or-empty (fiber f y)
+```
+
+### The type of propositionally decidable maps
+
+```agda
+inhabited-or-empty-map : {l1 l2 : Level} (A : UU l1) (B : UU l2) → UU (l1 ⊔ l2)
+inhabited-or-empty-map A B = Σ (A → B) (is-inhabited-or-empty-map)
+
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : inhabited-or-empty-map A B)
+ where
+
+ map-inhabited-or-empty-map : A → B
+ map-inhabited-or-empty-map = pr1 f
+
+ is-decidable-inhabited-or-empty-map :
+ is-inhabited-or-empty-map map-inhabited-or-empty-map
+ is-decidable-inhabited-or-empty-map = pr2 f
+```
+
+## Properties
+
+### Propositionally decidable maps are closed under homotopy
+
+```agda
+abstract
+ is-inhabited-or-empty-map-htpy :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} →
+ f ~ g → is-inhabited-or-empty-map g → is-inhabited-or-empty-map f
+ is-inhabited-or-empty-map-htpy H K b =
+ is-inhabited-or-empty-equiv
+ ( equiv-tot (λ a → equiv-concat (inv (H a)) b))
+ ( K b)
+```
+
+### Decidable maps are propositionally decidable
+
+```agda
+is-inhabited-or-empty-map-is-decidable-map :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} →
+ is-decidable-map f → is-inhabited-or-empty-map f
+is-inhabited-or-empty-map-is-decidable-map H x =
+ is-inhabited-or-empty-is-decidable (H x)
+```
+
+### The identity map is propositionally decidable
+
+```agda
+abstract
+ is-inhabited-or-empty-map-id :
+ {l : Level} {X : UU l} → is-inhabited-or-empty-map (id {l} {X})
+ is-inhabited-or-empty-map-id y = inl (unit-trunc-Prop (y , refl))
+```
+
+### Composition of propositionally decidable maps
+
+The composite `g ∘ f` of two propositionally decidable maps is propositionally
+decidable if `g` is injective.
+
+```agda
+module _
+ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3}
+ {g : B → C} {f : A → B}
+ where
+
+ abstract
+ is-inhabited-or-empty-map-comp :
+ is-injective g →
+ is-inhabited-or-empty-map g →
+ is-inhabited-or-empty-map f →
+ is-inhabited-or-empty-map (g ∘ f)
+ is-inhabited-or-empty-map-comp H G F x =
+ is-inhabited-or-empty-equiv
+ ( compute-fiber-comp g f x)
+ ( elim-is-inhabited-or-empty-Prop
+ ( is-inhabited-or-empty-Prop
+ ( Σ (fiber g x) (fiber f ∘ pr1)))
+ ( λ t →
+ elim-is-inhabited-or-empty-Prop
+ ( is-inhabited-or-empty-Prop (Σ (fiber g x) (fiber f ∘ pr1)))
+ ( λ s → inl (unit-trunc-Prop (t , s)))
+ ( λ ns →
+ inr
+ ( λ ts →
+ ns
+ ( pr1 (pr2 ts) ,
+ pr2 (pr2 ts) ∙ H ((pr2 (pr1 ts)) ∙ inv (pr2 t)))))
+ ( F (pr1 t)))
+ ( λ nt → inr (λ ts → nt (pr1 ts)))
+ ( G x))
+```
+
+The composite `g ∘ f` of two propositionally decidable maps is propositionally
+decidable if `g` has double negation dense equality.
+
+```agda
+module _
+ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3}
+ {g : B → C} {f : A → B}
+ where
+
+ abstract
+ is-inhabited-or-empty-map-comp-has-double-negation-dense-equality-map :
+ has-double-negation-dense-equality-map g →
+ is-inhabited-or-empty-map g →
+ is-inhabited-or-empty-map f →
+ is-inhabited-or-empty-map (g ∘ f)
+ is-inhabited-or-empty-map-comp-has-double-negation-dense-equality-map
+ H G F x =
+ is-inhabited-or-empty-equiv
+ ( compute-fiber-comp g f x)
+ ( is-inhabited-or-empty-Σ-has-double-negation-dense-equality-base
+ ( H x)
+ ( G x)
+ ( F ∘ pr1))
+
+module _
+ {l1 : Level} {A : UU l1} {f : A → A}
+ (is-inhabited-or-empty-f : is-inhabited-or-empty-map f)
+ (F : has-double-negation-dense-equality-map f)
+ where
+
+ is-inhabited-or-empty-map-iterate-has-double-negation-dense-equality-map :
+ (n : ℕ) → is-inhabited-or-empty-map (iterate n f)
+ is-inhabited-or-empty-map-iterate-has-double-negation-dense-equality-map
+ zero-ℕ =
+ is-inhabited-or-empty-map-id
+ is-inhabited-or-empty-map-iterate-has-double-negation-dense-equality-map
+ ( succ-ℕ n) =
+ is-inhabited-or-empty-map-comp-has-double-negation-dense-equality-map
+ ( F)
+ ( is-inhabited-or-empty-f)
+ ( is-inhabited-or-empty-map-iterate-has-double-negation-dense-equality-map
+ ( n))
+```
diff --git a/src/logic/propositionally-decidable-types.lagda.md b/src/logic/propositionally-decidable-types.lagda.md
new file mode 100644
index 0000000000..400e949a3b
--- /dev/null
+++ b/src/logic/propositionally-decidable-types.lagda.md
@@ -0,0 +1,362 @@
+# Propositionally decidable types
+
+```agda
+module logic.propositionally-decidable-types where
+```
+
+Imports
+
+```agda
+open import foundation.coinhabited-pairs-of-types
+open import foundation.coproduct-types
+open import foundation.decidable-types
+open import foundation.dependent-pair-types
+open import foundation.empty-types
+open import foundation.equivalences
+open import foundation.functoriality-coproduct-types
+open import foundation.logical-equivalences
+open import foundation.negation
+open import foundation.propositional-truncations
+open import foundation.retracts-of-types
+open import foundation.universe-levels
+
+open import foundation-core.cartesian-product-types
+open import foundation-core.decidable-propositions
+open import foundation-core.function-types
+open import foundation-core.propositions
+```
+
+
+
+## Idea
+
+A type is said to be
+{{#concept "propositionally decidable" Disambiguation="type" Agda=is-inhabited-or-empty}}
+if we can either deduce that it is [inhabited](foundation.inhabited-types.md),
+or we can deduce that it is [empty](foundation-core.empty-types.md), where
+inhabitedness of a type is expressed using the
+[propositional truncation](foundation.propositional-truncations.md).
+
+## Definitions
+
+### The predicate that a type is inhabited or empty
+
+```agda
+is-inhabited-or-empty : {l1 : Level} → UU l1 → UU l1
+is-inhabited-or-empty A = type-trunc-Prop A + is-empty A
+```
+
+### Merely decidable types
+
+A type `A` is said to be
+{{#concept "merely decidable" Agda=is-merely-decidable}} if it comes equipped
+with an element of `║ is-decidable A ║₋₁`, or equivalently, the
+[disjunction](foundation.disjunction.md) `A ∨ ¬ A` holds.
+
+```agda
+is-merely-decidable-Prop :
+ {l : Level} → UU l → Prop l
+is-merely-decidable-Prop A = trunc-Prop (is-decidable A)
+
+is-merely-decidable : {l : Level} → UU l → UU l
+is-merely-decidable A = type-trunc-Prop (is-decidable A)
+```
+
+## Properties
+
+### Decidable types are inhabited or empty
+
+```agda
+is-inhabited-or-empty-is-decidable :
+ {l : Level} {A : UU l} → is-decidable A → is-inhabited-or-empty A
+is-inhabited-or-empty-is-decidable (inl x) = inl (unit-trunc-Prop x)
+is-inhabited-or-empty-is-decidable (inr y) = inr y
+```
+
+### Decidable types are merely decidable
+
+```agda
+is-merely-decidable-is-decidable :
+ {l : Level} {A : UU l} → is-decidable A → is-merely-decidable A
+is-merely-decidable-is-decidable = unit-trunc-Prop
+```
+
+### Being inhabited or empty is a proposition
+
+```agda
+abstract
+ is-property-is-inhabited-or-empty :
+ {l1 : Level} (A : UU l1) → is-prop (is-inhabited-or-empty A)
+ is-property-is-inhabited-or-empty A =
+ is-prop-coproduct
+ ( λ t → apply-universal-property-trunc-Prop t empty-Prop)
+ ( is-prop-type-trunc-Prop)
+ ( is-prop-neg)
+
+is-inhabited-or-empty-Prop : {l1 : Level} → UU l1 → Prop l1
+pr1 (is-inhabited-or-empty-Prop A) = is-inhabited-or-empty A
+pr2 (is-inhabited-or-empty-Prop A) = is-property-is-inhabited-or-empty A
+```
+
+### Types are inhabited or empty if and only if they are merely decidable
+
+```agda
+module _
+ {l : Level} {A : UU l}
+ where
+
+ is-inhabited-or-empty-is-merely-decidable :
+ is-merely-decidable A → is-inhabited-or-empty A
+ is-inhabited-or-empty-is-merely-decidable =
+ rec-trunc-Prop
+ ( is-inhabited-or-empty-Prop A)
+ ( is-inhabited-or-empty-is-decidable)
+
+ is-merely-decidable-is-inhabited-or-empty :
+ is-inhabited-or-empty A → is-merely-decidable A
+ is-merely-decidable-is-inhabited-or-empty (inl |x|) =
+ rec-trunc-Prop (is-merely-decidable-Prop A) (unit-trunc-Prop ∘ inl) |x|
+ is-merely-decidable-is-inhabited-or-empty (inr y) =
+ unit-trunc-Prop (inr y)
+
+ iff-is-inhabited-or-empty-is-merely-decidable :
+ is-merely-decidable A ↔ is-inhabited-or-empty A
+ iff-is-inhabited-or-empty-is-merely-decidable =
+ ( is-inhabited-or-empty-is-merely-decidable ,
+ is-merely-decidable-is-inhabited-or-empty)
+```
+
+### Propositionally decidable types are closed under coinhabited types
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-inhabited-or-empty-is-coinhabited :
+ is-coinhabited A B → is-inhabited-or-empty A → is-inhabited-or-empty B
+ is-inhabited-or-empty-is-coinhabited (f , b) =
+ map-coproduct
+ ( f)
+ ( is-empty-type-trunc-Prop' ∘ map-neg b ∘ is-empty-type-trunc-Prop)
+```
+
+### Propositionally decidable types are closed under logical equivalences
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-inhabited-or-empty-iff :
+ (A → B) → (B → A) → is-inhabited-or-empty A → is-inhabited-or-empty B
+ is-inhabited-or-empty-iff f g (inl |a|) =
+ inl (rec-trunc-Prop (trunc-Prop B) (unit-trunc-Prop ∘ f) |a|)
+ is-inhabited-or-empty-iff f g (inr na) = inr (na ∘ g)
+
+ is-inhabited-or-empty-iff' :
+ A ↔ B → is-inhabited-or-empty A → is-inhabited-or-empty B
+ is-inhabited-or-empty-iff' (f , g) = is-inhabited-or-empty-iff f g
+
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ iff-is-inhabited-or-empty :
+ A ↔ B → is-inhabited-or-empty A ↔ is-inhabited-or-empty B
+ iff-is-inhabited-or-empty e =
+ is-inhabited-or-empty-iff' e , is-inhabited-or-empty-iff' (inv-iff e)
+```
+
+### Propositionally decidable types are closed under retracts
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-inhabited-or-empty-retract-of :
+ A retract-of B → is-inhabited-or-empty B → is-inhabited-or-empty A
+ is-inhabited-or-empty-retract-of R =
+ is-inhabited-or-empty-iff' (iff-retract' R)
+
+ is-inhabited-or-empty-retract-of' :
+ A retract-of B → is-inhabited-or-empty A → is-inhabited-or-empty B
+ is-inhabited-or-empty-retract-of' R =
+ is-inhabited-or-empty-iff' (inv-iff (iff-retract' R))
+```
+
+### Propositionally decidable types are closed under equivalences
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-inhabited-or-empty-is-equiv :
+ {f : A → B} → is-equiv f → is-inhabited-or-empty B → is-inhabited-or-empty A
+ is-inhabited-or-empty-is-equiv {f} H =
+ is-inhabited-or-empty-retract-of (retract-equiv (f , H))
+
+ is-inhabited-or-empty-equiv :
+ A ≃ B → is-inhabited-or-empty B → is-inhabited-or-empty A
+ is-inhabited-or-empty-equiv e =
+ is-inhabited-or-empty-iff (map-inv-equiv e) (map-equiv e)
+
+ is-inhabited-or-empty-equiv' :
+ A ≃ B → is-inhabited-or-empty A → is-inhabited-or-empty B
+ is-inhabited-or-empty-equiv' e =
+ is-inhabited-or-empty-iff (map-equiv e) (map-inv-equiv e)
+```
+
+### Elimination for propositional decidability
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} (B : Prop l2)
+ where
+
+ elim-is-inhabited-or-empty-Prop :
+ (A → type-Prop B) → (¬ A → type-Prop B) →
+ is-inhabited-or-empty A → type-Prop B
+ elim-is-inhabited-or-empty-Prop b nb (inl |a|) = rec-trunc-Prop B b |a|
+ elim-is-inhabited-or-empty-Prop b nb (inr na) = nb na
+
+ elim-is-inhabited-or-empty-Prop' :
+ (is-decidable A → type-Prop B) → is-inhabited-or-empty A → type-Prop B
+ elim-is-inhabited-or-empty-Prop' f =
+ elim-is-inhabited-or-empty-Prop (f ∘ inl) (f ∘ inr)
+```
+
+### Coproducts of propositionally decidable types are propositionally decidable
+
+```agda
+is-inhabited-or-empty-coproduct :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ is-inhabited-or-empty A →
+ is-inhabited-or-empty B →
+ is-inhabited-or-empty (A + B)
+is-inhabited-or-empty-coproduct (inl a) dB =
+ rec-trunc-Prop (is-inhabited-or-empty-Prop _) (inl ∘ unit-trunc-Prop ∘ inl) a
+is-inhabited-or-empty-coproduct (inr na) (inl b) =
+ rec-trunc-Prop (is-inhabited-or-empty-Prop _) (inl ∘ unit-trunc-Prop ∘ inr) b
+is-inhabited-or-empty-coproduct (inr na) (inr nb) = inr (rec-coproduct na nb)
+```
+
+### Cartesian products of propositionally decidable types are propositionally decidable
+
+```agda
+is-inhabited-or-empty-product :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ is-inhabited-or-empty A →
+ is-inhabited-or-empty B →
+ is-inhabited-or-empty (A × B)
+is-inhabited-or-empty-product (inl a) (inl b) =
+ inl (map-inv-distributive-trunc-product-Prop (a , b))
+is-inhabited-or-empty-product (inl a) (inr nb) = inr (nb ∘ pr2)
+is-inhabited-or-empty-product (inr na) dB = inr (na ∘ pr1)
+
+is-inhabited-or-empty-product' :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ is-inhabited-or-empty A → (A → is-inhabited-or-empty B) →
+ is-inhabited-or-empty (A × B)
+is-inhabited-or-empty-product' (inl a) dB =
+ rec-trunc-Prop
+ ( is-inhabited-or-empty-Prop _)
+ ( rec-coproduct
+ ( λ b → inl (map-inv-distributive-trunc-product-Prop (a , b)))
+ ( λ nb → inr (nb ∘ pr2)) ∘
+ dB)
+ ( a)
+is-inhabited-or-empty-product' (inr na) dB = inr (na ∘ pr1)
+
+is-inhabited-or-empty-left-factor :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ is-inhabited-or-empty (A × B) → B → is-inhabited-or-empty A
+is-inhabited-or-empty-left-factor (inl x) b =
+ inl (pr1 (map-distributive-trunc-product-Prop x))
+is-inhabited-or-empty-left-factor (inr nx) b = inr (λ a → nx (a , b))
+
+is-inhabited-or-empty-right-factor :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ is-inhabited-or-empty (A × B) → A → is-inhabited-or-empty B
+is-inhabited-or-empty-right-factor (inl x) a =
+ inl (pr2 (map-distributive-trunc-product-Prop x))
+is-inhabited-or-empty-right-factor (inr nx) a = inr (λ b → nx (a , b))
+```
+
+### Function types of propositionally decidable types are propositionally decidable
+
+```agda
+is-inhabited-or-empty-function-type :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ is-inhabited-or-empty A →
+ is-inhabited-or-empty B →
+ is-inhabited-or-empty (A → B)
+is-inhabited-or-empty-function-type (inl a) (inl b) =
+ inl (rec-trunc-Prop (trunc-Prop _) (λ y → unit-trunc-Prop (λ _ → y)) b)
+is-inhabited-or-empty-function-type (inl a) (inr nb) =
+ inr (λ f → rec-trunc-Prop empty-Prop (λ x → nb (f x)) a)
+is-inhabited-or-empty-function-type (inr na) dB =
+ inl (unit-trunc-Prop (ex-falso ∘ na))
+
+is-inhabited-or-empty-function-type' :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} →
+ is-inhabited-or-empty A → (A → is-inhabited-or-empty B) →
+ is-inhabited-or-empty (A → B)
+is-inhabited-or-empty-function-type' (inl a) dB =
+ rec-trunc-Prop (is-inhabited-or-empty-Prop _)
+ ( λ x →
+ rec-coproduct
+ ( inl ∘ rec-trunc-Prop (trunc-Prop _) (λ y → unit-trunc-Prop (λ _ → y)))
+ ( λ nb → inr (λ f → nb (f x)))
+ ( dB x))
+ ( a)
+is-inhabited-or-empty-function-type' (inr na) dB =
+ inl (unit-trunc-Prop (ex-falso ∘ na))
+```
+
+### Decidability of a propositional truncation
+
+```agda
+abstract
+ is-prop-is-decidable-trunc-Prop :
+ {l : Level} (A : UU l) → is-prop (is-decidable (type-trunc-Prop A))
+ is-prop-is-decidable-trunc-Prop A =
+ is-prop-is-decidable is-prop-type-trunc-Prop
+
+is-decidable-trunc-Prop : {l : Level} → UU l → Prop l
+pr1 (is-decidable-trunc-Prop A) = is-decidable (type-trunc-Prop A)
+pr2 (is-decidable-trunc-Prop A) = is-prop-is-decidable-trunc-Prop A
+
+is-decidable-trunc-Prop-is-decidable :
+ {l : Level} {A : UU l} →
+ is-decidable A → type-Prop (is-decidable-trunc-Prop A)
+is-decidable-trunc-Prop-is-decidable (inl a) =
+ inl (unit-trunc-Prop a)
+is-decidable-trunc-Prop-is-decidable (inr f) =
+ inr (map-universal-property-trunc-Prop empty-Prop f)
+
+is-decidable-trunc-Prop-is-merely-decidable :
+ {l : Level} {A : UU l} →
+ is-merely-decidable A → is-decidable (type-trunc-Prop A)
+is-decidable-trunc-Prop-is-merely-decidable {A = A} =
+ map-universal-property-trunc-Prop
+ ( is-decidable-trunc-Prop A)
+ ( is-decidable-trunc-Prop-is-decidable)
+
+is-merely-decidable-is-decidable-trunc-Prop :
+ {l : Level} (A : UU l) →
+ is-decidable (type-trunc-Prop A) → is-merely-decidable A
+is-merely-decidable-is-decidable-trunc-Prop A (inl x) =
+ apply-universal-property-trunc-Prop x
+ ( is-merely-decidable-Prop A)
+ ( unit-trunc-Prop ∘ inl)
+is-merely-decidable-is-decidable-trunc-Prop A (inr f) =
+ unit-trunc-Prop (inr (f ∘ unit-trunc-Prop))
+```
+
+## See also
+
+- That decidablity is irrefutable is shown in
+ [`foundation.irrefutable-propositions`](foundation.irrefutable-propositions.md).
diff --git a/src/logic/propositionally-double-negation-eliminating-maps.lagda.md b/src/logic/propositionally-double-negation-eliminating-maps.lagda.md
new file mode 100644
index 0000000000..446cfea6f7
--- /dev/null
+++ b/src/logic/propositionally-double-negation-eliminating-maps.lagda.md
@@ -0,0 +1,124 @@
+# Propositionally double negation eliminating maps
+
+```agda
+module logic.propositionally-double-negation-eliminating-maps where
+```
+
+Imports
+
+```agda
+open import foundation.dependent-pair-types
+open import foundation.identity-types
+open import foundation.propositions
+open import foundation.universe-levels
+
+open import foundation-core.fibers-of-maps
+open import foundation-core.functoriality-dependent-pair-types
+open import foundation-core.homotopies
+
+open import logic.double-negation-eliminating-maps
+open import logic.propositional-double-negation-elimination
+open import logic.propositionally-decidable-maps
+```
+
+
+
+## Idea
+
+A [map](foundation-core.function-types.md) is said to be
+{{#concept "propositionally double negation eliminating" Disambiguation="map of types" Agda=is-prop-double-negation-eliminating-map}}
+if its [fibers](foundation-core.fibers-of-maps.md) satisfy
+[propositional double negation elimination](logic.propositional-double-negation-elimination.md).
+I.e., for every `y : B`, if `fiber f y` is
+[irrefutable](foundation.irrefutable-propositions.md), then we have then the
+fiber is in fact inhabited. In other words, double negation eliminating maps
+come [equipped](foundation.structure.md) with a map
+
+```text
+ (y : B) → ¬¬ (fiber f y) → ║ fiber f y ║₋₁.
+```
+
+## Definintion
+
+### Propositional double negation elimination on a map
+
+```agda
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ where
+
+ is-prop-double-negation-eliminating-map : (A → B) → UU (l1 ⊔ l2)
+ is-prop-double-negation-eliminating-map f =
+ (y : B) → has-prop-double-negation-elim (fiber f y)
+
+ is-property-is-prop-double-negation-eliminating-map :
+ {f : A → B} → is-prop (is-prop-double-negation-eliminating-map f)
+ is-property-is-prop-double-negation-eliminating-map {f} =
+ is-prop-Π (λ y → is-prop-has-prop-double-negation-elim (fiber f y))
+
+ is-prop-double-negation-eliminating-map-Prop : (A → B) → Prop (l1 ⊔ l2)
+ is-prop-double-negation-eliminating-map-Prop f =
+ is-prop-double-negation-eliminating-map f ,
+ is-property-is-prop-double-negation-eliminating-map
+```
+
+### The type of propositionally double negation eliminating maps
+
+```agda
+prop-double-negation-eliminating-map :
+ {l1 l2 : Level} (A : UU l1) (B : UU l2) → UU (l1 ⊔ l2)
+prop-double-negation-eliminating-map A B =
+ Σ (A → B) (is-prop-double-negation-eliminating-map)
+
+module _
+ {l1 l2 : Level} {A : UU l1} {B : UU l2}
+ (f : prop-double-negation-eliminating-map A B)
+ where
+
+ map-prop-double-negation-eliminating-map : A → B
+ map-prop-double-negation-eliminating-map = pr1 f
+
+ is-prop-double-negation-eliminating-prop-double-negation-eliminating-map :
+ is-prop-double-negation-eliminating-map
+ map-prop-double-negation-eliminating-map
+ is-prop-double-negation-eliminating-prop-double-negation-eliminating-map =
+ pr2 f
+```
+
+## Properties
+
+### Propositionally double negation eliminating maps are closed under homotopy
+
+```agda
+abstract
+ is-prop-double-negation-eliminating-map-htpy :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} →
+ f ~ g →
+ is-prop-double-negation-eliminating-map g →
+ is-prop-double-negation-eliminating-map f
+ is-prop-double-negation-eliminating-map-htpy H K b =
+ has-prop-double-negation-elim-equiv
+ ( equiv-tot (λ a → equiv-concat (inv (H a)) b))
+ ( K b)
+```
+
+### Double negation eliminating maps are propositionally double negation eliminating
+
+```agda
+is-prop-double-negation-eliminating-map-is-double-negation-eliminating-map :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} →
+ is-double-negation-eliminating-map f →
+ is-prop-double-negation-eliminating-map f
+is-prop-double-negation-eliminating-map-is-double-negation-eliminating-map H y =
+ has-prop-double-negation-elim-has-double-negation-elim (H y)
+```
+
+### Propositionally decidable maps are propositionally double negation eliminating
+
+```agda
+is-prop-double-negation-eliminating-map-is-inhabited-or-empty-map :
+ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} →
+ is-inhabited-or-empty-map f → is-prop-double-negation-eliminating-map f
+is-prop-double-negation-eliminating-map-is-inhabited-or-empty-map H y =
+ prop-double-negation-elim-is-inhabited-or-empty (H y)
+```
diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md
index 5d93468b21..7a1d0c0615 100644
--- a/src/order-theory.lagda.md
+++ b/src/order-theory.lagda.md
@@ -116,6 +116,8 @@ open import order-theory.resizing-preorders public
open import order-theory.resizing-suplattices public
open import order-theory.similarity-of-elements-large-posets public
open import order-theory.similarity-of-elements-large-preorders public
+open import order-theory.similarity-of-elements-posets public
+open import order-theory.similarity-of-elements-preorders public
open import order-theory.similarity-of-order-preserving-maps-large-posets public
open import order-theory.similarity-of-order-preserving-maps-large-preorders public
open import order-theory.strict-order-preserving-maps public
diff --git a/src/order-theory/decidable-posets.lagda.md b/src/order-theory/decidable-posets.lagda.md
index b02c21afbf..8b29619917 100644
--- a/src/order-theory/decidable-posets.lagda.md
+++ b/src/order-theory/decidable-posets.lagda.md
@@ -8,8 +8,11 @@ module order-theory.decidable-posets where
```agda
open import foundation.binary-relations
+open import foundation.decidable-equality
open import foundation.decidable-propositions
+open import foundation.decidable-types
open import foundation.dependent-pair-types
+open import foundation.discrete-types
open import foundation.identity-types
open import foundation.propositions
open import foundation.sets
@@ -18,16 +21,19 @@ open import foundation.universe-levels
open import order-theory.decidable-preorders
open import order-theory.posets
open import order-theory.preorders
+open import order-theory.similarity-of-elements-posets
```
## Idea
-A **decidable poset** is a poset of which the ordering relation is decidable. It
-follows that decidable posets have decidable equality.
+A {{#concept "decidable poset" Agda=Decidable-Poset}} is a
+[poset](order-theory.posets.md) of which the ordering relation is
+[decidable](foundation.decidable-types.md). It follows that decidable posets
+have [decidable equality](foundation.decidable-equality.md).
-## Definition
+## Definitions
```agda
module _
@@ -111,3 +117,35 @@ module _
set-Decidable-Poset : Set l1
set-Decidable-Poset = set-Poset poset-Decidable-Poset
```
+
+## Properties
+
+### Decidable posets have decidable equality
+
+**Proof.** By antisymmetry, equality `x = y` in a poset is characterized by
+smiliarity, `(x ≤ y) × (y ≤ x)`, and this is a decidable type.
+
+```agda
+module _
+ {l1 l2 : Level} (P : Decidable-Poset l1 l2)
+ where
+
+ is-decidable-sim-Decidable-Poset :
+ {x y : type-Decidable-Poset P} →
+ is-decidable (sim-Poset (poset-Decidable-Poset P) x y)
+ is-decidable-sim-Decidable-Poset {x} {y} =
+ is-decidable-product
+ ( is-decidable-leq-Decidable-Poset P x y)
+ ( is-decidable-leq-Decidable-Poset P y x)
+
+ has-decidable-equality-type-Decidable-Poset :
+ has-decidable-equality (type-Decidable-Poset P)
+ has-decidable-equality-type-Decidable-Poset x y =
+ is-decidable-equiv
+ ( extensionality-Poset (poset-Decidable-Poset P) x y)
+ ( is-decidable-sim-Decidable-Poset)
+
+ discrete-type-Decidable-Poset : Discrete-Type l1
+ discrete-type-Decidable-Poset =
+ ( type-Decidable-Poset P , has-decidable-equality-type-Decidable-Poset)
+```
diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md
index 2d8296df76..20dd4549fa 100644
--- a/src/order-theory/decidable-total-orders.lagda.md
+++ b/src/order-theory/decidable-total-orders.lagda.md
@@ -10,8 +10,11 @@ module order-theory.decidable-total-orders where
open import foundation.action-on-identifications-functions
open import foundation.binary-relations
open import foundation.coproduct-types
+open import foundation.decidable-equality
open import foundation.decidable-propositions
+open import foundation.decidable-types
open import foundation.dependent-pair-types
+open import foundation.discrete-types
open import foundation.empty-types
open import foundation.identity-types
open import foundation.logical-equivalences
@@ -28,6 +31,7 @@ open import order-theory.least-upper-bounds-posets
open import order-theory.meet-semilattices
open import order-theory.posets
open import order-theory.preorders
+open import order-theory.similarity-of-elements-posets
open import order-theory.total-orders
```
@@ -192,6 +196,33 @@ module _
## Properties
+### Decidable total orders have decidable equality
+
+**Proof.** By antisymmetry, equality `x = y` in a decidable total order is
+characterized by smiliarity, `(x ≤ y) × (y ≤ x)`, and this is a decidable type.
+
+```agda
+module _
+ {l1 l2 : Level} (P : Decidable-Total-Order l1 l2)
+ where
+
+ is-decidable-sim-Decidable-Total-Order :
+ {x y : type-Decidable-Total-Order P} →
+ is-decidable (sim-Poset (poset-Decidable-Total-Order P) x y)
+ is-decidable-sim-Decidable-Total-Order =
+ is-decidable-sim-Decidable-Poset (decidable-poset-Decidable-Total-Order P)
+
+ has-decidable-equality-type-Decidable-Total-Order :
+ has-decidable-equality (type-Decidable-Total-Order P)
+ has-decidable-equality-type-Decidable-Total-Order =
+ has-decidable-equality-type-Decidable-Poset
+ ( decidable-poset-Decidable-Total-Order P)
+
+ discrete-type-Decidable-Total-Order : Discrete-Type l1
+ discrete-type-Decidable-Total-Order =
+ discrete-type-Decidable-Poset (decidable-poset-Decidable-Total-Order P)
+```
+
### Any two elements in a decidable total order have a minimum and maximum
```agda
diff --git a/src/order-theory/ordinals.lagda.md b/src/order-theory/ordinals.lagda.md
index 7dc9994603..e805ff678b 100644
--- a/src/order-theory/ordinals.lagda.md
+++ b/src/order-theory/ordinals.lagda.md
@@ -100,9 +100,9 @@ module _
is-extensional-Ordinal : extensionality-principle-Ordinal le-prop-Ordinal
is-extensional-Ordinal = pr2 is-ordinal-Ordinal
- is-transitive-le-Ordinal : is-transitive le-Ordinal
- is-transitive-le-Ordinal =
- is-transitive-le-Transitive-Well-Founded-Relation
+ transitive-le-Ordinal : is-transitive le-Ordinal
+ transitive-le-Ordinal =
+ transitive-le-Transitive-Well-Founded-Relation
transitive-well-founded-relation-Ordinal
is-well-founded-relation-le-Ordinal : is-well-founded-Relation le-Ordinal
@@ -148,14 +148,24 @@ The associated reflexive relation on an ordinal.
refl-leq-Transitive-Well-Founded-Relation
transitive-well-founded-relation-Ordinal
+ leq-eq-Ordinal : {x y : type-Ordinal} → x = y → leq-Ordinal x y
+ leq-eq-Ordinal =
+ leq-eq-Transitive-Well-Founded-Relation
+ transitive-well-founded-relation-Ordinal
+
transitive-leq-Ordinal : is-transitive leq-Ordinal
transitive-leq-Ordinal =
transitive-leq-Transitive-Well-Founded-Relation
transitive-well-founded-relation-Ordinal
+ leq-le-Ordinal : {x y : type-Ordinal} → le-Ordinal x y → leq-Ordinal x y
+ leq-le-Ordinal =
+ leq-le-Transitive-Well-Founded-Relation
+ transitive-well-founded-relation-Ordinal
+
antisymmetric-leq-Ordinal : is-antisymmetric leq-Ordinal
antisymmetric-leq-Ordinal x y p q =
- is-extensional-Ordinal x y (λ u → p u , q u)
+ is-extensional-Ordinal x y (λ u → (p u , q u))
is-preorder-leq-Ordinal : is-preorder-Relation-Prop leq-prop-Ordinal
is-preorder-leq-Ordinal = (refl-leq-Ordinal , transitive-leq-Ordinal)
diff --git a/src/order-theory/posets.lagda.md b/src/order-theory/posets.lagda.md
index f1875f86f2..51b2ea0f66 100644
--- a/src/order-theory/posets.lagda.md
+++ b/src/order-theory/posets.lagda.md
@@ -34,7 +34,7 @@ A **poset** is a [set](foundation-core.sets.md)
[relation](foundation.binary-relations.md) that takes values in
[propositions](foundation-core.propositions.md).
-## Definition
+## Definitions
```agda
is-antisymmetric-leq-Preorder :
@@ -102,18 +102,6 @@ module _
antisymmetric-leq-Poset : is-antisymmetric leq-Poset
antisymmetric-leq-Poset = pr2 X
-
- is-set-type-Poset : is-set type-Poset
- is-set-type-Poset =
- is-set-prop-in-id
- ( λ x y → leq-Poset x y × leq-Poset y x)
- ( λ x y → is-prop-product (is-prop-leq-Poset x y) (is-prop-leq-Poset y x))
- ( λ x → refl-leq-Poset x , refl-leq-Poset x)
- ( λ x y (H , K) → antisymmetric-leq-Poset x y H K)
-
- set-Poset : Set l1
- pr1 set-Poset = type-Poset
- pr2 set-Poset = is-set-type-Poset
```
## Reasoning with inequalities in posets
@@ -157,6 +145,29 @@ syntax step-calculate-in-Poset X u z v = u ≤ z by v in-Poset X
## Properties
+### The underlying type of a poset is a set
+
+```agda
+module _
+ {l1 l2 : Level} (X : Poset l1 l2)
+ where
+
+ is-set-type-Poset : is-set (type-Poset X)
+ is-set-type-Poset =
+ is-set-prop-in-id
+ ( λ x y → leq-Poset X x y × leq-Poset X y x)
+ ( λ x y →
+ is-prop-product (is-prop-leq-Poset X x y) (is-prop-leq-Poset X y x))
+ ( λ x → refl-leq-Poset X x , refl-leq-Poset X x)
+ ( λ x y (H , K) → antisymmetric-leq-Poset X x y H K)
+
+ set-Poset : Set l1
+ set-Poset = (type-Poset X , is-set-type-Poset)
+```
+
+We characterize equality in a poset as _similarity of elements_ in
+[`order-theory.similarity-of-elements-posets`](order-theory.similarity-of-elements-posets.md).
+
### Posets are categories whose underlying hom-sets are propositions
```agda
diff --git a/src/order-theory/preorders.lagda.md b/src/order-theory/preorders.lagda.md
index 37293a7863..c8dddfb9d9 100644
--- a/src/order-theory/preorders.lagda.md
+++ b/src/order-theory/preorders.lagda.md
@@ -98,17 +98,11 @@ module _
is-prop-le-Preorder : (x y : type-Preorder) → is-prop (le-Preorder x y)
is-prop-le-Preorder = is-prop-type-Relation-Prop le-prop-Preorder
- is-reflexive-leq-Preorder : is-reflexive (leq-Preorder)
- is-reflexive-leq-Preorder = pr1 (pr2 (pr2 X))
-
refl-leq-Preorder : is-reflexive leq-Preorder
- refl-leq-Preorder = is-reflexive-leq-Preorder
-
- is-transitive-leq-Preorder : is-transitive leq-Preorder
- is-transitive-leq-Preorder = pr2 (pr2 (pr2 X))
+ refl-leq-Preorder = pr1 (pr2 (pr2 X))
transitive-leq-Preorder : is-transitive leq-Preorder
- transitive-leq-Preorder = is-transitive-leq-Preorder
+ transitive-leq-Preorder = pr2 (pr2 (pr2 X))
```
## Reasoning with inequalities in preorders
@@ -146,7 +140,7 @@ step-calculate-in-Preorder :
{x y : type-Preorder X} → leq-Preorder X x y →
(z : type-Preorder X) → leq-Preorder X y z → leq-Preorder X x z
step-calculate-in-Preorder X {x} {y} u z v =
- is-transitive-leq-Preorder X x y z v u
+ transitive-leq-Preorder X x y z v u
syntax step-calculate-in-Preorder X u z v = u ≤ z by v in-Preorder X
```
@@ -165,7 +159,7 @@ module _
make-Precategory
( type-Preorder X)
( λ x y → set-Prop (leq-prop-Preorder X x y))
- ( λ {x} {y} {z} → is-transitive-leq-Preorder X x y z)
+ ( λ {x} {y} {z} → transitive-leq-Preorder X x y z)
( refl-leq-Preorder X)
( λ {x} {y} {z} {w} h g f →
eq-is-prop (is-prop-type-Prop (leq-prop-Preorder X x w)))
diff --git a/src/order-theory/similarity-of-elements-large-posets.lagda.md b/src/order-theory/similarity-of-elements-large-posets.lagda.md
index 5e2d8199ea..73ac0d314e 100644
--- a/src/order-theory/similarity-of-elements-large-posets.lagda.md
+++ b/src/order-theory/similarity-of-elements-large-posets.lagda.md
@@ -26,9 +26,11 @@ open import order-theory.similarity-of-elements-large-preorders
## Idea
Two elements `x` and `y` of a [large poset](order-theory.large-posets.md) `P`
-are said to be **similar** if both `x ≤ y` and `y ≤ x` hold. Note that the
-similarity relation is defined across universe levels, and that only similar
-elements of the same universe level are equal.
+are said to be
+{{#concept "similar" Disambiguation="elements of a large poset" Agda=sim-Large-Poset}}
+if both `x ≤ y` and `y ≤ x` hold. Note that the similarity relation is defined
+across universe levels, and that only similar elements of the same universe
+level are equal.
In informal writing we will use the notation `x ≈ y` to assert that `x` and `y`
are similar elements in a poset `P`.
diff --git a/src/order-theory/similarity-of-elements-large-preorders.lagda.md b/src/order-theory/similarity-of-elements-large-preorders.lagda.md
index c027bb56db..204965eb5c 100644
--- a/src/order-theory/similarity-of-elements-large-preorders.lagda.md
+++ b/src/order-theory/similarity-of-elements-large-preorders.lagda.md
@@ -21,10 +21,12 @@ open import order-theory.large-preorders
## Idea
Two elements `x` and `y` of a [large preorder](order-theory.large-preorders.md)
-`P` are said to be **similar** if both `x ≤ y` and `y ≤ x` hold.
+`P` are said to be
+{{#concept "similar" Disambiguation="elements of a large preorder" Agda=sim-Large-Preorder}}
+if both `x ≤ y` and `y ≤ x` hold.
In informal writing we will use the notation `x ≈ y` to assert that `x` and `y`
-are similar elements in a preorder `P`.
+are similar elements in a large preorder `P`.
## Definition
diff --git a/src/order-theory/similarity-of-elements-posets.lagda.md b/src/order-theory/similarity-of-elements-posets.lagda.md
new file mode 100644
index 0000000000..167d16364c
--- /dev/null
+++ b/src/order-theory/similarity-of-elements-posets.lagda.md
@@ -0,0 +1,139 @@
+# Similarity of elements in posets
+
+```agda
+module order-theory.similarity-of-elements-posets where
+```
+
+Imports
+
+```agda
+open import foundation.binary-relations
+open import foundation.dependent-pair-types
+open import foundation.equivalences
+open import foundation.fundamental-theorem-of-identity-types
+open import foundation.identity-types
+open import foundation.propositions
+open import foundation.subtypes
+open import foundation.torsorial-type-families
+open import foundation.universe-levels
+
+open import order-theory.posets
+open import order-theory.similarity-of-elements-preorders
+```
+
+
+
+## Idea
+
+Two elements `x` and `y` of a [poset](order-theory.posets.md) `P` are said to be
+{{#concept "similar" Disambiguation="elements in a poset" Agda=sim-Poset}} if
+both `x ≤ y` and `y ≤ x` hold. In informal writing we will use the notation
+`x ≈ y` to assert that `x` and `y` are similar elements in a poset `P`.
+
+## Definitions
+
+```agda
+module _
+ {l1 l2 : Level} (P : Poset l1 l2)
+ where
+
+ sim-prop-Poset : (x y : type-Poset P) → Prop l2
+ sim-prop-Poset = sim-prop-Preorder (preorder-Poset P)
+
+ sim-Poset : (x y : type-Poset P) → UU l2
+ sim-Poset = sim-Preorder (preorder-Poset P)
+
+ is-prop-sim-Poset : (x y : type-Poset P) → is-prop (sim-Poset x y)
+ is-prop-sim-Poset = is-prop-sim-Preorder (preorder-Poset P)
+```
+
+## Properties
+
+### The similarity relation is reflexive
+
+```agda
+module _
+ {l1 l2 : Level} (P : Poset l1 l2)
+ where
+
+ refl-sim-Poset : is-reflexive-Relation-Prop (sim-prop-Poset P)
+ refl-sim-Poset = refl-sim-Preorder (preorder-Poset P)
+```
+
+### The similarity relation is transitive
+
+```agda
+module _
+ {l1 l2 : Level} (P : Poset l1 l2)
+ where
+
+ transitive-sim-Poset : is-transitive-Relation-Prop (sim-prop-Poset P)
+ transitive-sim-Poset = transitive-sim-Preorder (preorder-Poset P)
+```
+
+### The similarity relation is symmetric
+
+```agda
+module _
+ {l1 l2 : Level} (P : Poset l1 l2)
+ where
+
+ symmetric-sim-Poset : is-symmetric-Relation-Prop (sim-prop-Poset P)
+ symmetric-sim-Poset = symmetric-sim-Preorder (preorder-Poset P)
+```
+
+### Any element in a poset is similar to at most one element
+
+```agda
+module _
+ {l1 l2 : Level} (P : Poset l1 l2)
+ where
+
+ all-elements-equal-total-sim-Poset :
+ (x : type-Poset P) → all-elements-equal (Σ (type-Poset P) (sim-Poset P x))
+ all-elements-equal-total-sim-Poset x (y , H) (z , K) =
+ eq-type-subtype
+ ( sim-prop-Poset P x)
+ ( antisymmetric-leq-Poset P
+ ( y)
+ ( z)
+ ( transitive-leq-Poset P y x z (pr1 K) (pr2 H))
+ ( transitive-leq-Poset P z x y (pr1 H) (pr2 K)))
+
+ is-prop-total-sim-Poset :
+ (x : type-Poset P) → is-prop (Σ (type-Poset P) (sim-Poset P x))
+ is-prop-total-sim-Poset x =
+ is-prop-all-elements-equal
+ ( all-elements-equal-total-sim-Poset x)
+
+ is-torsorial-sim-Poset :
+ (x : type-Poset P) → is-torsorial (sim-Poset P x)
+ is-torsorial-sim-Poset x =
+ is-proof-irrelevant-is-prop
+ ( is-prop-total-sim-Poset x)
+ ( x , refl-sim-Poset P x)
+```
+
+### Similarity characterizes the identity type of elements in a poset
+
+```agda
+module _
+ {l1 l2 : Level} (P : Poset l1 l2)
+ where
+
+ sim-eq-Poset : {x y : type-Poset P} → x = y → sim-Poset P x y
+ sim-eq-Poset = sim-eq-Preorder (preorder-Poset P)
+
+ is-equiv-sim-eq-Poset :
+ (x y : type-Poset P) → is-equiv (sim-eq-Poset {x} {y})
+ is-equiv-sim-eq-Poset x =
+ fundamental-theorem-id
+ ( is-torsorial-sim-Poset P x)
+ ( λ y → sim-eq-Poset {x} {y})
+
+ extensionality-Poset : (x y : type-Poset P) → (x = y) ≃ sim-Poset P x y
+ extensionality-Poset x y = (sim-eq-Poset , is-equiv-sim-eq-Poset x y)
+
+ eq-sim-Poset : (x y : type-Poset P) → sim-Poset P x y → x = y
+ eq-sim-Poset x y = map-inv-is-equiv (is-equiv-sim-eq-Poset x y)
+```
diff --git a/src/order-theory/similarity-of-elements-preorders.lagda.md b/src/order-theory/similarity-of-elements-preorders.lagda.md
new file mode 100644
index 0000000000..34994e8945
--- /dev/null
+++ b/src/order-theory/similarity-of-elements-preorders.lagda.md
@@ -0,0 +1,101 @@
+# Similarity of elements in preorders
+
+```agda
+module order-theory.similarity-of-elements-preorders where
+```
+
+Imports
+
+```agda
+open import foundation.binary-relations
+open import foundation.dependent-pair-types
+open import foundation.identity-types
+open import foundation.propositions
+open import foundation.reflexive-relations
+open import foundation.universe-levels
+
+open import order-theory.preorders
+```
+
+
+
+## Idea
+
+Two elements `x` and `y` of a [preorder](order-theory.preorders.md) `P` are said
+to be
+{{#concept "similar" Disambiguation="elements of a preorder" Agda=sim-Preorder}}
+if both `x ≤ y` and `y ≤ x` hold.
+
+In informal writing we will use the notation `x ≈ y` to assert that `x` and `y`
+are similar elements in a preorder `P`.
+
+## Definitions
+
+```agda
+module _
+ {l1 l2 : Level} (P : Preorder l1 l2)
+ where
+
+ sim-prop-Preorder : (x y : type-Preorder P) → Prop l2
+ sim-prop-Preorder x y =
+ product-Prop (leq-prop-Preorder P x y) (leq-prop-Preorder P y x)
+
+ sim-Preorder :
+ (x y : type-Preorder P) → UU l2
+ sim-Preorder x y = type-Prop (sim-prop-Preorder x y)
+
+ is-prop-sim-Preorder :
+ (x y : type-Preorder P) → is-prop (sim-Preorder x y)
+ is-prop-sim-Preorder x y =
+ is-prop-type-Prop (sim-prop-Preorder x y)
+```
+
+## Properties
+
+### The similarity relation is reflexive
+
+```agda
+module _
+ {l1 l2 : Level} (P : Preorder l1 l2)
+ where
+
+ refl-sim-Preorder :
+ is-reflexive-Relation-Prop (sim-prop-Preorder P)
+ refl-sim-Preorder x = refl-leq-Preorder P x , refl-leq-Preorder P x
+```
+
+### The similarity relation is transitive
+
+```agda
+module _
+ {l1 l2 : Level} (P : Preorder l1 l2)
+ where
+
+ transitive-sim-Preorder :
+ is-transitive-Relation-Prop (sim-prop-Preorder P)
+ transitive-sim-Preorder x y z H K =
+ ( transitive-leq-Preorder P x y z (pr1 H) (pr1 K) ,
+ transitive-leq-Preorder P z y x (pr2 K) (pr2 H))
+```
+
+### The similarity relation is symmetric
+
+```agda
+module _
+ {l1 l2 : Level} (P : Preorder l1 l2)
+ where
+
+ symmetric-sim-Preorder : is-symmetric-Relation-Prop (sim-prop-Preorder P)
+ symmetric-sim-Preorder _ _ H = (pr2 H , pr1 H)
+```
+
+### Equal elements are similar
+
+```agda
+module _
+ {l1 l2 : Level} (P : Preorder l1 l2)
+ where
+
+ sim-eq-Preorder : {x y : type-Preorder P} → x = y → sim-Preorder P x y
+ sim-eq-Preorder {x} refl = refl-sim-Preorder P x
+```
diff --git a/src/order-theory/strict-preorders.lagda.md b/src/order-theory/strict-preorders.lagda.md
index 071d017b3d..e58c86ab4b 100644
--- a/src/order-theory/strict-preorders.lagda.md
+++ b/src/order-theory/strict-preorders.lagda.md
@@ -11,7 +11,6 @@ open import foundation.binary-relations
open import foundation.cartesian-product-types
open import foundation.dependent-pair-types
open import foundation.empty-types
-open import foundation.negation
open import foundation.propositions
open import foundation.universe-levels
```
@@ -25,8 +24,8 @@ A {{#concept "strict preorder" Agda=Strict-Preorder}} consists of a type $A$, a
[propositions](foundation-core.propositions.md), such that the relation $<$ is
irreflexive and transitive:
-- For any $x:A$ we have $x \nle x$.
-- For any $x,y,z:A$ we have $yImports
+
+```agda
+open import elementary-number-theory.natural-numbers
+
+open import foundation.booleans
+open import foundation.dependent-pair-types
+open import foundation.double-negation-stable-equality
+open import foundation.propositions
+open import foundation.sets
+open import foundation.subtypes
+open import foundation.tight-apartness-relations
+open import foundation.universe-levels
+
+open import foundation-core.identity-types
+
+open import order-theory.posets
+open import order-theory.subposets
+
+open import set-theory.increasing-binary-sequences
+open import set-theory.inequality-increasing-binary-sequences
+```
+
+
+
+## Idea
+
+Given an [increasing binary sequence](set-theory.increasing-binary-sequences.md)
+`n`, then another increasing binary sequence `x` is
+{{#concept "bounded" Disambiguation="increasing binary sequence by increasing binary sequence" Agda=bounded-ℕ∞↑}}
+by `n` if `x ≤ n`.
+
+## Definitions
+
+### Bounded increasing binary sequences
+
+```agda
+bounded-ℕ∞↑ : (n : ℕ∞↑) → UU lzero
+bounded-ℕ∞↑ n = Σ ℕ∞↑ (_≤-ℕ∞↑ n)
+
+module _
+ (n : ℕ∞↑) (k : bounded-ℕ∞↑ n)
+ where
+
+ increasing-binary-sequence-bounded-ℕ∞↑ : ℕ∞↑
+ increasing-binary-sequence-bounded-ℕ∞↑ = pr1 k
+
+ sequence-bounded-ℕ∞↑ : ℕ → bool
+ sequence-bounded-ℕ∞↑ = sequence-ℕ∞↑ increasing-binary-sequence-bounded-ℕ∞↑
+
+ is-increasing-sequence-bounded-ℕ∞↑ :
+ is-increasing-binary-sequence sequence-bounded-ℕ∞↑
+ is-increasing-sequence-bounded-ℕ∞↑ =
+ is-increasing-sequence-ℕ∞↑ increasing-binary-sequence-bounded-ℕ∞↑
+
+ is-bounded-bounded-ℕ∞↑ : increasing-binary-sequence-bounded-ℕ∞↑ ≤-ℕ∞↑ n
+ is-bounded-bounded-ℕ∞↑ = pr2 k
+
+abstract
+ is-set-bounded-ℕ∞↑ : (n : ℕ∞↑) → is-set (bounded-ℕ∞↑ n)
+ is-set-bounded-ℕ∞↑ n = is-set-type-subtype (λ k → leq-prop-ℕ∞↑ k n) is-set-ℕ∞↑
+```
+
+### Successor-bounded increasing binary sequences
+
+```agda
+succ-bounded-ℕ∞↑ : (n : ℕ∞↑) → UU lzero
+succ-bounded-ℕ∞↑ n = Σ ℕ∞↑ (λ k → (succ-ℕ∞↑ k) ≤-ℕ∞↑ n)
+
+module _
+ (n : ℕ∞↑) (k : succ-bounded-ℕ∞↑ n)
+ where
+
+ increasing-binary-sequence-succ-bounded-ℕ∞↑ : ℕ∞↑
+ increasing-binary-sequence-succ-bounded-ℕ∞↑ = pr1 k
+
+ sequence-succ-bounded-ℕ∞↑ : ℕ → bool
+ sequence-succ-bounded-ℕ∞↑ =
+ sequence-ℕ∞↑ increasing-binary-sequence-succ-bounded-ℕ∞↑
+
+ is-increasing-sequence-succ-bounded-ℕ∞↑ :
+ is-increasing-binary-sequence sequence-succ-bounded-ℕ∞↑
+ is-increasing-sequence-succ-bounded-ℕ∞↑ =
+ is-increasing-sequence-ℕ∞↑ increasing-binary-sequence-succ-bounded-ℕ∞↑
+
+ is-succ-bounded-succ-bounded-ℕ∞↑ :
+ succ-ℕ∞↑ increasing-binary-sequence-succ-bounded-ℕ∞↑ ≤-ℕ∞↑ n
+ is-succ-bounded-succ-bounded-ℕ∞↑ = pr2 k
+
+ bounded-succ-succ-bounded-ℕ∞↑ : bounded-ℕ∞↑ n
+ bounded-succ-succ-bounded-ℕ∞↑ =
+ ( succ-ℕ∞↑ increasing-binary-sequence-succ-bounded-ℕ∞↑ ,
+ is-succ-bounded-succ-bounded-ℕ∞↑)
+
+ is-bounded-succ-bounded-ℕ∞↑ :
+ increasing-binary-sequence-succ-bounded-ℕ∞↑ ≤-ℕ∞↑ n
+ is-bounded-succ-bounded-ℕ∞↑ =
+ transitive-leq-ℕ∞↑
+ ( increasing-binary-sequence-succ-bounded-ℕ∞↑)
+ ( succ-ℕ∞↑ increasing-binary-sequence-succ-bounded-ℕ∞↑)
+ ( n)
+ ( is-succ-bounded-succ-bounded-ℕ∞↑)
+ ( leq-succ-ℕ∞↑ increasing-binary-sequence-succ-bounded-ℕ∞↑)
+
+ bounded-succ-bounded-ℕ∞↑ : bounded-ℕ∞↑ n
+ bounded-succ-bounded-ℕ∞↑ =
+ ( increasing-binary-sequence-succ-bounded-ℕ∞↑ , is-bounded-succ-bounded-ℕ∞↑)
+
+abstract
+ is-set-succ-bounded-ℕ∞↑ : (n : ℕ∞↑) → is-set (succ-bounded-ℕ∞↑ n)
+ is-set-succ-bounded-ℕ∞↑ n =
+ is-set-type-subtype (λ k → leq-prop-ℕ∞↑ (succ-ℕ∞↑ k) n) is-set-ℕ∞↑
+```
+
+### Inequality on bounded increasing binary sequences
+
+```agda
+module _
+ (n : ℕ∞↑)
+ where
+
+ bounded-ℕ∞↑-Poset : Poset lzero lzero
+ bounded-ℕ∞↑-Poset = poset-Subposet ℕ∞↑-Poset (λ k → leq-prop-ℕ∞↑ k n)
+
+ leq-bounded-ℕ∞↑ : (x y : bounded-ℕ∞↑ n) → UU lzero
+ leq-bounded-ℕ∞↑ = leq-Poset bounded-ℕ∞↑-Poset
+
+ leq-prop-bounded-ℕ∞↑ : (x y : bounded-ℕ∞↑ n) → Prop lzero
+ leq-prop-bounded-ℕ∞↑ = leq-prop-Poset bounded-ℕ∞↑-Poset
+
+ refl-leq-bounded-ℕ∞↑ : (x : bounded-ℕ∞↑ n) → leq-bounded-ℕ∞↑ x x
+ refl-leq-bounded-ℕ∞↑ = refl-leq-Poset bounded-ℕ∞↑-Poset
+
+ transitive-leq-bounded-ℕ∞↑ :
+ (x y z : bounded-ℕ∞↑ n) →
+ leq-bounded-ℕ∞↑ y z → leq-bounded-ℕ∞↑ x y → leq-bounded-ℕ∞↑ x z
+ transitive-leq-bounded-ℕ∞↑ = transitive-leq-Poset bounded-ℕ∞↑-Poset
+
+ antisymmetric-leq-bounded-ℕ∞↑ :
+ (x y : bounded-ℕ∞↑ n) → leq-bounded-ℕ∞↑ x y → leq-bounded-ℕ∞↑ y x → x = y
+ antisymmetric-leq-bounded-ℕ∞↑ = antisymmetric-leq-Poset bounded-ℕ∞↑-Poset
+```
+
+### The zero element
+
+```agda
+zero-bounded-ℕ∞↑ : (n : ℕ∞↑) → bounded-ℕ∞↑ n
+zero-bounded-ℕ∞↑ n = (zero-ℕ∞↑ , leq-zero-ℕ∞↑ n)
+```
+
+### The successor function
+
+```agda
+inclusion-bounded-succ-bounded-ℕ∞↑ :
+ (n : ℕ∞↑) → bounded-ℕ∞↑ n → bounded-ℕ∞↑ (succ-ℕ∞↑ n)
+inclusion-bounded-succ-bounded-ℕ∞↑ n x =
+ ( increasing-binary-sequence-bounded-ℕ∞↑ n x ,
+ transitive-leq-ℕ∞↑
+ ( increasing-binary-sequence-bounded-ℕ∞↑ n x)
+ ( n)
+ ( succ-ℕ∞↑ n)
+ ( leq-succ-ℕ∞↑ n)
+ ( is-bounded-bounded-ℕ∞↑ n x))
+
+inclusion-succ-bounded-ℕ∞↑ :
+ (n : ℕ∞↑) → bounded-ℕ∞↑ n → bounded-ℕ∞↑ (succ-ℕ∞↑ n)
+inclusion-succ-bounded-ℕ∞↑ n x =
+ ( succ-ℕ∞↑ (increasing-binary-sequence-bounded-ℕ∞↑ n x) ,
+ preserves-order-succ-ℕ∞↑
+ ( increasing-binary-sequence-bounded-ℕ∞↑ n x)
+ ( n)
+ ( is-bounded-bounded-ℕ∞↑ n x))
+```
+
+### Every increasing binary sequence is bounded by itself
+
+```agda
+self-bounded-ℕ∞↑ : (n : ℕ∞↑) → bounded-ℕ∞↑ n
+self-bounded-ℕ∞↑ n = (n , refl-leq-ℕ∞↑ n)
+```
+
+## Properties
+
+### Bounded increasing binary sequences have tight apartness
+
+```agda
+bounded-ℕ∞↑-Type-With-Tight-Apartness :
+ ℕ∞↑ → Type-With-Tight-Apartness lzero lzero
+bounded-ℕ∞↑-Type-With-Tight-Apartness n =
+ subtype-Type-With-Tight-Apartness
+ ( ℕ∞↑-Type-With-Tight-Apartness)
+ ( λ k → leq-prop-ℕ∞↑ k n)
+```
+
+### Bounded increasing binary sequences have double negation stable equality
+
+```agda
+has-double-negation-stable-equality-bounded-ℕ∞↑ :
+ (n : ℕ∞↑) → has-double-negation-stable-equality (bounded-ℕ∞↑ n)
+has-double-negation-stable-equality-bounded-ℕ∞↑ n =
+ has-double-negation-stable-equality-type-Type-With-Tight-Apartness
+ ( bounded-ℕ∞↑-Type-With-Tight-Apartness n)
+```
+
+### If `n` is finite then `bounded-ℕ∞↑ n` is a finite set with `n + 1` elements
+
+> This remains to be formalized.
diff --git a/src/set-theory/cantor-space.lagda.md b/src/set-theory/cantor-space.lagda.md
index 41ea6e9e47..c5eeef8124 100644
--- a/src/set-theory/cantor-space.lagda.md
+++ b/src/set-theory/cantor-space.lagda.md
@@ -10,23 +10,15 @@ module set-theory.cantor-space where
open import elementary-number-theory.natural-numbers
open import foundation.booleans
-open import foundation.coproduct-types
open import foundation.dependent-pair-types
-open import foundation.empty-types
-open import foundation.lawveres-fixed-point-theorem
-open import foundation.negation
-open import foundation.propositional-truncations
+open import foundation.double-negation-stable-equality
+open import foundation.function-types-with-apartness-relations
open import foundation.sets
open import foundation.tight-apartness-relations
-open import foundation.unit-type
open import foundation.universe-levels
open import set-theory.cantors-diagonal-argument
-open import set-theory.countable-sets
open import set-theory.uncountable-sets
-
-open import univalent-combinatorics.equality-standard-finite-types
-open import univalent-combinatorics.standard-finite-types
```
@@ -36,15 +28,15 @@ open import univalent-combinatorics.standard-finite-types
The
{{#concept "Cantor space" Disambiguation="as a type" Agda=cantor-space WD="Cantor space" WDID=Q616653}}
is the [set](foundation-core.sets.md) of
-[functions](foundation-core.function-types.md) `ℕ → Fin 2`. In other words, it
-is the set of [binary](foundation.booleans.md)
+[functions](foundation-core.function-types.md) `ℕ → bool`. In other words, it is
+the set of [binary](foundation.booleans.md)
[sequences](foundation.sequences.md).
## Definition
```agda
cantor-space : UU lzero
-cantor-space = ℕ → Fin 2
+cantor-space = ℕ → bool
```
## Properties
@@ -52,16 +44,33 @@ cantor-space = ℕ → Fin 2
### The cantor space has a tight apartness relation
```agda
+tight-apartness-relation-cantor-space :
+ Tight-Apartness-Relation lzero cantor-space
+tight-apartness-relation-cantor-space =
+ tight-apartness-relation-function-into-Type-With-Tight-Apartness
+ ℕ
+ bool-Type-With-Tight-Apartness
+
cantor-space-Type-With-Tight-Apartness : Type-With-Tight-Apartness lzero lzero
cantor-space-Type-With-Tight-Apartness =
- exp-Type-With-Tight-Apartness ℕ (Fin-Type-With-Tight-Apartness 2)
+ function-into-Type-With-Tight-Apartness ℕ bool-Type-With-Tight-Apartness
+```
+
+### The cantor space has double negation stable equality
+
+```agda
+has-double-negation-stable-equality-cantor-space :
+ has-double-negation-stable-equality cantor-space
+has-double-negation-stable-equality-cantor-space =
+ has-double-negation-stable-equality-type-Type-With-Tight-Apartness
+ cantor-space-Type-With-Tight-Apartness
```
### The cantor space is a set
```agda
is-set-cantor-space : is-set cantor-space
-is-set-cantor-space = is-set-function-type (is-set-Fin 2)
+is-set-cantor-space = is-set-function-type is-set-bool
cantor-space-Set : Set lzero
cantor-space-Set = (cantor-space , is-set-cantor-space)
@@ -73,10 +82,10 @@ cantor-space-Set = (cantor-space , is-set-cantor-space)
is-uncountable-cantor-space : is-uncountable cantor-space-Set
is-uncountable-cantor-space =
is-uncountable-sequence-discrete-type-diagonal-argument-Cantor
- ( Fin-Discrete-Type 2)
- ( inr star)
- ( inl (inr star))
- ( neq-inr-inl)
+ ( bool-Discrete-Type)
+ ( true)
+ ( false)
+ ( neq-true-false-bool)
```
## External links
diff --git a/src/set-theory/cantors-diagonal-argument.lagda.md b/src/set-theory/cantors-diagonal-argument.lagda.md
index b573aa9ab7..083b3aff85 100644
--- a/src/set-theory/cantors-diagonal-argument.lagda.md
+++ b/src/set-theory/cantors-diagonal-argument.lagda.md
@@ -33,6 +33,8 @@ open import foundation-core.empty-types
open import foundation-core.fibers-of-maps
open import foundation-core.propositions
+open import logic.propositionally-decidable-types
+
open import set-theory.countable-sets
open import set-theory.infinite-sets
open import set-theory.uncountable-sets
diff --git a/src/set-theory/countable-sets.lagda.md b/src/set-theory/countable-sets.lagda.md
index 023911e269..63e739cefd 100644
--- a/src/set-theory/countable-sets.lagda.md
+++ b/src/set-theory/countable-sets.lagda.md
@@ -92,18 +92,18 @@ module _
{l : Level} (X : Set l)
where
- decidable-subprojection-ℕ : UU (lsuc l ⊔ l)
+ decidable-subprojection-ℕ : UU (lsuc l)
decidable-subprojection-ℕ =
Σ ( decidable-subtype l ℕ)
( λ P → type-decidable-subtype P ↠ type-Set X)
- is-countable-Prop' : Prop (lsuc l ⊔ l)
+ is-countable-Prop' : Prop (lsuc l)
is-countable-Prop' =
exists-structure-Prop
( decidable-subtype l ℕ)
( λ P → type-decidable-subtype P ↠ type-Set X)
- is-countable' : UU (lsuc l ⊔ l)
+ is-countable' : UU (lsuc l)
is-countable' = type-Prop is-countable-Prop'
is-prop-is-countable' : is-prop is-countable'
diff --git a/src/set-theory/finite-elements-increasing-binary-sequences.lagda.md b/src/set-theory/finite-elements-increasing-binary-sequences.lagda.md
new file mode 100644
index 0000000000..414e2173b9
--- /dev/null
+++ b/src/set-theory/finite-elements-increasing-binary-sequences.lagda.md
@@ -0,0 +1,240 @@
+# Finite elements in the type of increasing binary sequences
+
+```agda
+module set-theory.finite-elements-increasing-binary-sequences where
+```
+
+Imports
+
+```agda
+open import elementary-number-theory.inequality-natural-numbers
+open import elementary-number-theory.natural-numbers
+
+open import foundation.booleans
+open import foundation.constant-maps
+open import foundation.decidable-propositions
+open import foundation.decidable-types
+open import foundation.dependent-pair-types
+open import foundation.equality-dependent-pair-types
+open import foundation.function-types
+open import foundation.homotopies
+open import foundation.inequality-booleans
+open import foundation.inhabited-types
+open import foundation.negation
+open import foundation.propositional-truncations
+open import foundation.propositions
+open import foundation.universe-levels
+
+open import foundation-core.identity-types
+
+open import set-theory.increasing-binary-sequences
+```
+
+
+
+## Idea
+
+An [increasing binary sequence](set-theory.increasing-binary-sequences.md) `x`
+is a
+{{#concept "finite element" Disambiguation="element of the type of increasing binary sequences" Agda=is-finite-ℕ∞↑}}
+if there [exists](foundation.existential-quantification.md) a
+[natural number](elementary-number-theory.natural-numbers.md) `n : ℕ` such that
+`xₙ` is true.
+
+## Definitions
+
+### Finite boundedness of increasing binary sequences
+
+An increasing binary sequence `x` is _bounded_ by a natural number `n` if `x n`
+is true.
+
+```agda
+leq-decidable-prop-ℕ-ℕ∞↑ : ℕ∞↑ → ℕ → Decidable-Prop lzero
+leq-decidable-prop-ℕ-ℕ∞↑ x n = is-true-Decidable-Prop (sequence-ℕ∞↑ x n)
+
+leq-prop-ℕ-ℕ∞↑ : ℕ∞↑ → ℕ → Prop lzero
+leq-prop-ℕ-ℕ∞↑ x n = prop-Decidable-Prop (leq-decidable-prop-ℕ-ℕ∞↑ x n)
+
+leq-ℕ-ℕ∞↑ : ℕ∞↑ → ℕ → UU lzero
+leq-ℕ-ℕ∞↑ x n = type-Decidable-Prop (leq-decidable-prop-ℕ-ℕ∞↑ x n)
+
+infix 30 _≤-ℕ∞↑-ℕ_
+_≤-ℕ∞↑-ℕ_ : ℕ∞↑ → ℕ → UU lzero
+_≤-ℕ∞↑-ℕ_ = leq-ℕ-ℕ∞↑
+
+is-prop-leq-ℕ-ℕ∞↑ : (x : ℕ∞↑) (n : ℕ) → is-prop (x ≤-ℕ∞↑-ℕ n)
+is-prop-leq-ℕ-ℕ∞↑ x n =
+ is-prop-type-Decidable-Prop (leq-decidable-prop-ℕ-ℕ∞↑ x n)
+
+is-decidable-leq-ℕ-ℕ∞↑ : (x : ℕ∞↑) (n : ℕ) → is-decidable (x ≤-ℕ∞↑-ℕ n)
+is-decidable-leq-ℕ-ℕ∞↑ x n =
+ is-decidable-Decidable-Prop (leq-decidable-prop-ℕ-ℕ∞↑ x n)
+```
+
+### Strict finite boundedness below of increasing binary sequences
+
+An increasing binary sequence `x` is _bounded below_ by a natural number `n` if
+`x n` is false.
+
+```agda
+le-decidable-prop-ℕ∞↑-ℕ : ℕ → ℕ∞↑ → Decidable-Prop lzero
+le-decidable-prop-ℕ∞↑-ℕ n x = is-false-Decidable-Prop (sequence-ℕ∞↑ x n)
+
+le-prop-ℕ∞↑-ℕ : ℕ → ℕ∞↑ → Prop lzero
+le-prop-ℕ∞↑-ℕ n x = prop-Decidable-Prop (le-decidable-prop-ℕ∞↑-ℕ n x)
+
+le-ℕ∞↑-ℕ : ℕ → ℕ∞↑ → UU lzero
+le-ℕ∞↑-ℕ x n = type-Decidable-Prop (le-decidable-prop-ℕ∞↑-ℕ x n)
+
+infix 30 _<-ℕ-ℕ∞↑_
+_<-ℕ-ℕ∞↑_ : ℕ → ℕ∞↑ → UU lzero
+_<-ℕ-ℕ∞↑_ = le-ℕ∞↑-ℕ
+
+is-prop-le-ℕ∞↑-ℕ : (n : ℕ) (x : ℕ∞↑) → is-prop (n <-ℕ-ℕ∞↑ x)
+is-prop-le-ℕ∞↑-ℕ n x =
+ is-prop-type-Decidable-Prop (le-decidable-prop-ℕ∞↑-ℕ n x)
+
+is-decidable-le-ℕ∞↑-ℕ : (n : ℕ) (x : ℕ∞↑) → is-decidable (n <-ℕ-ℕ∞↑ x)
+is-decidable-le-ℕ∞↑-ℕ n x =
+ is-decidable-Decidable-Prop (le-decidable-prop-ℕ∞↑-ℕ n x)
+```
+
+```agda
+is-positive-ℕ∞↑ : ℕ∞↑ → UU lzero
+is-positive-ℕ∞↑ x = 0 <-ℕ-ℕ∞↑ x
+```
+
+### Bounds on the size of a finite element in increasing binary sequences
+
+```agda
+upper-bound-ℕ∞↑ : ℕ∞↑ → UU lzero
+upper-bound-ℕ∞↑ x = Σ ℕ (x ≤-ℕ∞↑-ℕ_)
+```
+
+### Least upper bounds on the size of a finite element in increasing binary sequences
+
+```agda
+least-upper-bound-ℕ∞↑ : ℕ∞↑ → UU lzero
+least-upper-bound-ℕ∞↑ x =
+ Σ (upper-bound-ℕ∞↑ x) (λ n → (m : upper-bound-ℕ∞↑ x) → pr1 n ≤-ℕ pr1 m)
+
+all-elements-equal-least-upper-bound-ℕ∞↑ :
+ (x : ℕ∞↑) → all-elements-equal (least-upper-bound-ℕ∞↑ x)
+all-elements-equal-least-upper-bound-ℕ∞↑
+ (x , X) ((n , p) , H) ((m , q) , K) =
+ eq-pair-Σ
+ ( eq-pair-Σ
+ ( antisymmetric-leq-ℕ n m (H (m , q)) (K (n , p)))
+ ( eq-is-prop (is-set-bool (x m) true)))
+ ( eq-is-prop (is-prop-Π λ u → is-prop-leq-ℕ m (pr1 u)))
+
+is-prop-least-upper-bound-ℕ∞↑ : (x : ℕ∞↑) → is-prop (least-upper-bound-ℕ∞↑ x)
+is-prop-least-upper-bound-ℕ∞↑ x =
+ is-prop-all-elements-equal (all-elements-equal-least-upper-bound-ℕ∞↑ x)
+
+least-upper-bound-prop-ℕ∞↑ : ℕ∞↑ → Prop lzero
+least-upper-bound-prop-ℕ∞↑ x =
+ ( least-upper-bound-ℕ∞↑ x , is-prop-least-upper-bound-ℕ∞↑ x)
+```
+
+### The predicate on an increasing binary sequence of being a finite element
+
+```agda
+is-finite-prop-ℕ∞↑ : ℕ∞↑ → Prop lzero
+is-finite-prop-ℕ∞↑ = is-inhabited-Prop ∘ upper-bound-ℕ∞↑
+
+is-finite-ℕ∞↑ :
+ ℕ∞↑ → UU lzero
+is-finite-ℕ∞↑ =
+ type-Prop ∘ is-finite-prop-ℕ∞↑
+
+is-prop-is-finite-ℕ∞↑ :
+ (x : ℕ∞↑) →
+ is-prop (is-finite-ℕ∞↑ x)
+is-prop-is-finite-ℕ∞↑ =
+ is-prop-type-Prop ∘ is-finite-prop-ℕ∞↑
+```
+
+### The canonical inclusion of the natural numbers into increasing binary sequences
+
+```agda
+inclusion-ℕ∞↑ : ℕ → ℕ∞↑
+inclusion-ℕ∞↑ = rec-ℕ (zero-ℕ∞↑) (λ _ → succ-ℕ∞↑)
+
+upper-bound-inclusion-ℕ∞↑ :
+ (n : ℕ) → upper-bound-ℕ∞↑ (inclusion-ℕ∞↑ n)
+upper-bound-inclusion-ℕ∞↑ zero-ℕ =
+ ( 0 , refl)
+upper-bound-inclusion-ℕ∞↑ (succ-ℕ n) =
+ ( succ-ℕ (pr1 (upper-bound-inclusion-ℕ∞↑ n)) ,
+ pr2 (upper-bound-inclusion-ℕ∞↑ n))
+
+is-finite-inclusion-ℕ∞↑ : (n : ℕ) → is-finite-ℕ∞↑ (inclusion-ℕ∞↑ n)
+is-finite-inclusion-ℕ∞↑ n = unit-trunc-Prop (upper-bound-inclusion-ℕ∞↑ n)
+```
+
+## Properties
+
+### Infinity is not finitely bounded
+
+```agda
+is-not-finitely-bounded-infinity-ℕ∞↑ : (n : ℕ) → ¬ (infinity-ℕ∞↑ ≤-ℕ∞↑-ℕ n)
+is-not-finitely-bounded-infinity-ℕ∞↑ n ()
+```
+
+### If an increasing binary sequence is not finitely bounded then it is infinite
+
+```agda
+module _
+ (x : ℕ∞↑) (H : (n : ℕ) → ¬ (x ≤-ℕ∞↑-ℕ n))
+ where
+
+ Eq-infinity-is-not-finitely-bounded-ℕ∞↑ : sequence-ℕ∞↑ x ~ const ℕ false
+ Eq-infinity-is-not-finitely-bounded-ℕ∞↑ n =
+ is-false-is-not-true (sequence-ℕ∞↑ x n) (H n)
+
+ eq-infinity-is-not-finitely-bounded-ℕ∞↑ : x = infinity-ℕ∞↑
+ eq-infinity-is-not-finitely-bounded-ℕ∞↑ =
+ eq-Eq-ℕ∞↑ (Eq-infinity-is-not-finitely-bounded-ℕ∞↑)
+```
+
+### If an increasing binary sequence has an upper bound there exists a unique least upper bound
+
+> This remains to be formalized.
+
+### If an increasing binary sequence is strictly bounded below by a natural number, then it is positive
+
+```agda
+le-le-succ-ℕ∞↑-ℕ : (x : ℕ∞↑) (n : ℕ) → (succ-ℕ n) <-ℕ-ℕ∞↑ x → n <-ℕ-ℕ∞↑ x
+le-le-succ-ℕ∞↑-ℕ x n =
+ is-false-is-false-leq-bool (is-increasing-sequence-ℕ∞↑ x n)
+
+is-positive-le-ℕ∞↑-ℕ : (x : ℕ∞↑) (n : ℕ) → n <-ℕ-ℕ∞↑ x → is-positive-ℕ∞↑ x
+is-positive-le-ℕ∞↑-ℕ x 0 p = p
+is-positive-le-ℕ∞↑-ℕ x (succ-ℕ n) p =
+ is-positive-le-ℕ∞↑-ℕ x n (le-le-succ-ℕ∞↑-ℕ x n p)
+```
+
+### If an increasing binary sequence is bounded above by a finite number, then it is bounded above by any larger finite number
+
+```agda
+abstract
+ leq-succ-leq-ℕ-ℕ∞↑ : (x : ℕ∞↑) (n : ℕ) → x ≤-ℕ∞↑-ℕ n → x ≤-ℕ∞↑-ℕ (succ-ℕ n)
+ leq-succ-leq-ℕ-ℕ∞↑ x n =
+ is-true-is-true-leq-bool (is-increasing-sequence-ℕ∞↑ x n)
+
+abstract
+ leq-leq-zero-ℕ-ℕ∞↑ : (x : ℕ∞↑) (n : ℕ) → x ≤-ℕ∞↑-ℕ 0 → x ≤-ℕ∞↑-ℕ n
+ leq-leq-zero-ℕ-ℕ∞↑ x 0 s = s
+ leq-leq-zero-ℕ-ℕ∞↑ x (succ-ℕ i) s =
+ contrapositive-is-false-bool
+ ( is-false-is-false-leq-bool (is-increasing-sequence-ℕ∞↑ x i))
+ ( leq-leq-zero-ℕ-ℕ∞↑ x i s)
+
+abstract
+ concatenate-right-leq-ℕ-ℕ∞↑ :
+ (x : ℕ∞↑) (n m : ℕ) → n ≤-ℕ m → x ≤-ℕ∞↑-ℕ n → x ≤-ℕ∞↑-ℕ m
+ concatenate-right-leq-ℕ-ℕ∞↑ x 0 m p = leq-leq-zero-ℕ-ℕ∞↑ x m
+ concatenate-right-leq-ℕ-ℕ∞↑ x (succ-ℕ n) (succ-ℕ m) =
+ concatenate-right-leq-ℕ-ℕ∞↑ (shift-left-ℕ∞↑ x) n m
+```
diff --git a/src/set-theory/inclusion-natural-numbers-increasing-binary-sequences.lagda.md b/src/set-theory/inclusion-natural-numbers-increasing-binary-sequences.lagda.md
new file mode 100644
index 0000000000..df58fc75cb
--- /dev/null
+++ b/src/set-theory/inclusion-natural-numbers-increasing-binary-sequences.lagda.md
@@ -0,0 +1,267 @@
+# The canonical inclusion of natural numbers into increasing binary sequences
+
+```agda
+module set-theory.inclusion-natural-numbers-increasing-binary-sequences where
+```
+
+Imports
+
+```agda
+open import elementary-number-theory.inequality-natural-numbers
+open import elementary-number-theory.natural-numbers
+
+open import foundation.action-on-identifications-functions
+open import foundation.booleans
+open import foundation.constant-maps
+open import foundation.coproduct-types
+open import foundation.dependent-pair-types
+open import foundation.double-negation-stable-equality
+open import foundation.embeddings
+open import foundation.empty-types
+open import foundation.equality-coproduct-types
+open import foundation.function-extensionality
+open import foundation.function-types
+open import foundation.homotopies
+open import foundation.injective-maps
+open import foundation.maybe
+open import foundation.negated-equality
+open import foundation.negation
+open import foundation.surjective-maps
+open import foundation.unit-type
+open import foundation.universal-property-maybe
+open import foundation.universe-levels
+
+open import foundation-core.identity-types
+
+open import logic.double-negation-dense-maps
+
+open import order-theory.order-preserving-maps-posets
+
+open import set-theory.finite-elements-increasing-binary-sequences
+open import set-theory.increasing-binary-sequences
+open import set-theory.inequality-increasing-binary-sequences
+```
+
+
+
+## Idea
+
+The canonical map `ℕ → ℕ∞↑` defined by induction to send zero to zero, and the
+successor of `n` to the successor of the map evaluated at `n` is the
+{{#concept "canonical inclusion" Disambiguaiton="of the natural numbers into increasing binary sequences" Agda=inclusion-ℕ∞↑-ℕ}}.
+This map is a [embedding](foundation-core.embeddings.md) of
+[sets](foundation-core.sets.md) that is
+non-[surjective](foundation.surjective-maps.md), as it does not hit the element
+at infinity. We may extend this inclusion by adding a point at infinity
+
+```text
+ ℕ + {∞} ↪ ℕ∞↑
+```
+
+to obtain a [double negation dense](logic.double-negation-dense-maps.md)
+embedding of sets. This map is surjective if and only if the
+[weak limited principle of omniscience](foundation.weak-limited-principle-of-omniscience.md)
+holds.
+
+## Definitions
+
+### The canonical inclusion of natural numbers
+
+```agda
+inclusion-ℕ∞↑-ℕ : ℕ → ℕ∞↑
+inclusion-ℕ∞↑-ℕ = rec-ℕ zero-ℕ∞↑ (λ _ → succ-ℕ∞↑)
+```
+
+### The canonical extended inclusion
+
+```agda
+inclusion-ℕ∞↑-Maybe-ℕ : Maybe ℕ → ℕ∞↑
+inclusion-ℕ∞↑-Maybe-ℕ = rec-coproduct inclusion-ℕ∞↑-ℕ (point infinity-ℕ∞↑)
+```
+
+## Properties
+
+### The canonical inclusion is an embedding
+
+```agda
+abstract
+ is-injective-inclusion-ℕ∞↑-ℕ : is-injective inclusion-ℕ∞↑-ℕ
+ is-injective-inclusion-ℕ∞↑-ℕ {zero-ℕ} {zero-ℕ} p =
+ refl
+ is-injective-inclusion-ℕ∞↑-ℕ {zero-ℕ} {succ-ℕ y} p =
+ ex-falso (neq-zero-succ-ℕ∞↑ p)
+ is-injective-inclusion-ℕ∞↑-ℕ {succ-ℕ x} {zero-ℕ} p =
+ ex-falso (neq-succ-zero-ℕ∞↑ p)
+ is-injective-inclusion-ℕ∞↑-ℕ {succ-ℕ x} {succ-ℕ y} p =
+ ap succ-ℕ (is-injective-inclusion-ℕ∞↑-ℕ (is-injective-succ-ℕ∞↑ p))
+
+abstract
+ is-emb-inclusion-ℕ∞↑-ℕ : is-emb inclusion-ℕ∞↑-ℕ
+ is-emb-inclusion-ℕ∞↑-ℕ =
+ is-emb-is-injective is-set-ℕ∞↑ is-injective-inclusion-ℕ∞↑-ℕ
+
+emb-ℕ∞↑-ℕ : ℕ ↪ ℕ∞↑
+emb-ℕ∞↑-ℕ = (inclusion-ℕ∞↑-ℕ , is-emb-inclusion-ℕ∞↑-ℕ)
+```
+
+### The canonical inclusion preserves order
+
+```agda
+abstract
+ preserves-order-inclusion-ℕ∞↑-ℕ :
+ preserves-order-Poset ℕ-Poset ℕ∞↑-Poset inclusion-ℕ∞↑-ℕ
+ preserves-order-inclusion-ℕ∞↑-ℕ zero-ℕ y p =
+ leq-zero-ℕ∞↑ (inclusion-ℕ∞↑-ℕ y)
+ preserves-order-inclusion-ℕ∞↑-ℕ
+ ( succ-ℕ x) (succ-ℕ y) p =
+ preserves-order-succ-ℕ∞↑
+ ( inclusion-ℕ∞↑-ℕ x)
+ ( inclusion-ℕ∞↑-ℕ y)
+ ( preserves-order-inclusion-ℕ∞↑-ℕ x y p)
+```
+
+### The canonical inclusion is not surjective
+
+```agda
+abstract
+ Neq-infinity-inclusion-ℕ∞↑-ℕ :
+ (n : ℕ) → ¬ (sequence-ℕ∞↑ (inclusion-ℕ∞↑-ℕ n) ~ const ℕ false)
+ Neq-infinity-inclusion-ℕ∞↑-ℕ zero-ℕ H = neq-true-false-bool (H 0)
+ Neq-infinity-inclusion-ℕ∞↑-ℕ (succ-ℕ n) H =
+ Neq-infinity-inclusion-ℕ∞↑-ℕ n (H ∘ succ-ℕ)
+
+neq-infinity-inclusion-ℕ∞↑-ℕ :
+ (n : ℕ) → inclusion-ℕ∞↑-ℕ n ≠ infinity-ℕ∞↑
+neq-infinity-inclusion-ℕ∞↑-ℕ n =
+ map-neg Eq-eq-ℕ∞↑ (Neq-infinity-inclusion-ℕ∞↑-ℕ n)
+
+is-not-double-negation-dense-inclusion-ℕ∞↑-ℕ :
+ ¬ (is-double-negation-dense-map inclusion-ℕ∞↑-ℕ)
+is-not-double-negation-dense-inclusion-ℕ∞↑-ℕ H =
+ H infinity-ℕ∞↑ (λ p → neq-infinity-inclusion-ℕ∞↑-ℕ (pr1 p) (pr2 p))
+
+is-not-surjective-inclusion-ℕ∞↑-ℕ : ¬ (is-surjective inclusion-ℕ∞↑-ℕ)
+is-not-surjective-inclusion-ℕ∞↑-ℕ =
+ map-neg
+ is-double-negation-dense-map-is-surjective
+ is-not-double-negation-dense-inclusion-ℕ∞↑-ℕ
+```
+
+### The canonical extended inclusion is an embedding
+
+```agda
+abstract
+ is-emb-inclusion-ℕ∞↑-Maybe-ℕ : is-emb inclusion-ℕ∞↑-Maybe-ℕ
+ is-emb-inclusion-ℕ∞↑-Maybe-ℕ =
+ is-emb-coproduct
+ ( is-emb-inclusion-ℕ∞↑-ℕ)
+ ( is-emb-is-injective is-set-ℕ∞↑ (is-injective-point infinity-ℕ∞↑))
+ ( λ n * → neq-infinity-inclusion-ℕ∞↑-ℕ n)
+
+emb-ℕ∞↑-Maybe-ℕ : Maybe ℕ ↪ ℕ∞↑
+emb-ℕ∞↑-Maybe-ℕ = (inclusion-ℕ∞↑-Maybe-ℕ , is-emb-inclusion-ℕ∞↑-Maybe-ℕ)
+```
+
+#### Successor condition on the image of the natural numbers
+
+If an increasing binary sequence `x` switches from `false` to `true` at `n + 1`,
+then it is the image of `n + 1`.
+
+```agda
+abstract
+ Eq-succ-criterion-ℕ∞↑ :
+ {x : ℕ∞↑} {n : ℕ} →
+ n <-ℕ-ℕ∞↑ x → x ≤-ℕ∞↑-ℕ (succ-ℕ n) → Eq-ℕ∞↑ x (inclusion-ℕ∞↑-ℕ (succ-ℕ n))
+ Eq-succ-criterion-ℕ∞↑ {x} {0} r s 0 = r
+ Eq-succ-criterion-ℕ∞↑ {x} {0} r s (succ-ℕ i) =
+ leq-leq-zero-ℕ-ℕ∞↑ (shift-left-ℕ∞↑ x) i s
+ Eq-succ-criterion-ℕ∞↑ {x} {succ-ℕ n} r s 0 =
+ is-positive-le-ℕ∞↑-ℕ x (succ-ℕ n) r
+ Eq-succ-criterion-ℕ∞↑ {x} {succ-ℕ n} r s (succ-ℕ i) =
+ Eq-succ-criterion-ℕ∞↑ {shift-left-ℕ∞↑ x} {n} r s i
+
+eq-succ-criterion-ℕ∞↑ :
+ {x : ℕ∞↑} {n : ℕ} →
+ n <-ℕ-ℕ∞↑ x → x ≤-ℕ∞↑-ℕ (succ-ℕ n) → x = inclusion-ℕ∞↑-ℕ (succ-ℕ n)
+eq-succ-criterion-ℕ∞↑ {x} {n} r s =
+ is-injective-sequence-ℕ∞↑ (eq-htpy (Eq-succ-criterion-ℕ∞↑ {x} {n} r s))
+```
+
+### If an increasing binary sequence is not in the image of the natural numbers it is infinite
+
+```agda
+module _
+ (x : ℕ∞↑) (H : (n : ℕ) → x ≠ inclusion-ℕ∞↑-ℕ n)
+ where
+
+ abstract
+ Eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ :
+ sequence-ℕ∞↑ x ~ const ℕ false
+ Eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ zero-ℕ =
+ is-false-is-not-true (sequence-ℕ∞↑ x 0) (H 0 ∘ eq-zero-is-zero-ℕ∞↑ x)
+ Eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ (succ-ℕ n) =
+ is-false-is-not-true
+ ( sequence-ℕ∞↑ x (succ-ℕ n))
+ ( H (succ-ℕ n) ∘
+ eq-succ-criterion-ℕ∞↑ (Eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ n))
+
+ eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ : x = infinity-ℕ∞↑
+ eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ =
+ eq-Eq-ℕ∞↑ Eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ
+
+ eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ' : infinity-ℕ∞↑ = x
+ eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ' =
+ inv eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ
+```
+
+### The extended inclusion is double negation dense
+
+```agda
+is-double-negation-dense-inclusion-ℕ∞↑-Maybe-ℕ :
+ is-double-negation-dense-map inclusion-ℕ∞↑-Maybe-ℕ
+is-double-negation-dense-inclusion-ℕ∞↑-Maybe-ℕ x H =
+ H ( inr star ,
+ eq-infinity-is-not-in-image-inclusion-ℕ∞↑-ℕ' x
+ ( λ n p → H (inl n , inv p)))
+
+double-negation-dense-inclusion-ℕ∞↑-Maybe-ℕ : Maybe ℕ ↠¬¬ ℕ∞↑
+double-negation-dense-inclusion-ℕ∞↑-Maybe-ℕ =
+ ( inclusion-ℕ∞↑-Maybe-ℕ , is-double-negation-dense-inclusion-ℕ∞↑-Maybe-ℕ)
+```
+
+```agda
+module _
+ {l : Level} {Y : ℕ∞↑ → UU l}
+ {f g : (x : ℕ∞↑) → Y x}
+ where
+
+ htpy-ℕ∞↑-htpy-ℕ :
+ (H : (x : ℕ∞↑) → has-double-negation-stable-equality (Y x)) →
+ ((n : ℕ) → f (inclusion-ℕ∞↑-ℕ n) = g (inclusion-ℕ∞↑-ℕ n)) →
+ f infinity-ℕ∞↑ = g infinity-ℕ∞↑ →
+ f ~ g
+ htpy-ℕ∞↑-htpy-ℕ H h h∞ =
+ htpy-htpy-double-negation-dense-map
+ ( double-negation-dense-inclusion-ℕ∞↑-Maybe-ℕ)
+ ( H)
+ ( ind-Maybe (h , h∞))
+```
+
+### The tight bounds on the image of the natural numbers
+
+```agda
+refl-leq-ℕ-ℕ∞↑ : (n : ℕ) → inclusion-ℕ∞↑-ℕ n ≤-ℕ∞↑-ℕ n
+refl-leq-ℕ-ℕ∞↑ zero-ℕ = refl
+refl-leq-ℕ-ℕ∞↑ (succ-ℕ n) = refl-leq-ℕ-ℕ∞↑ n
+
+le-succ-ℕ-ℕ∞↑ : (n : ℕ) → n <-ℕ-ℕ∞↑ (inclusion-ℕ∞↑-ℕ (succ-ℕ n))
+le-succ-ℕ-ℕ∞↑ zero-ℕ = refl
+le-succ-ℕ-ℕ∞↑ (succ-ℕ n) = le-succ-ℕ-ℕ∞↑ n
+```
+
+## References
+
+- [`CoNaturals.GenericConvergentSequence`](https://martinescardo.github.io/TypeTopology/CoNaturals.GenericConvergentSequence.html)
+ at TypeTopology {{#cite TypeTopology}}
+
+{{#bibliography}}
diff --git a/src/set-theory/increasing-binary-sequences.lagda.md b/src/set-theory/increasing-binary-sequences.lagda.md
new file mode 100644
index 0000000000..779c595225
--- /dev/null
+++ b/src/set-theory/increasing-binary-sequences.lagda.md
@@ -0,0 +1,345 @@
+# The type of increasing binary sequences
+
+```agda
+module set-theory.increasing-binary-sequences where
+```
+
+Imports
+
+```agda
+open import elementary-number-theory.decidable-total-order-natural-numbers
+open import elementary-number-theory.inequality-natural-numbers
+open import elementary-number-theory.natural-numbers
+
+open import foundation.action-on-identifications-functions
+open import foundation.booleans
+open import foundation.constant-maps
+open import foundation.coproduct-types
+open import foundation.dependent-pair-types
+open import foundation.double-negation-stable-equality
+open import foundation.embeddings
+open import foundation.equivalences
+open import foundation.function-extensionality
+open import foundation.function-types
+open import foundation.homotopies
+open import foundation.inequality-booleans
+open import foundation.injective-maps
+open import foundation.logical-operations-booleans
+open import foundation.maybe
+open import foundation.negated-equality
+open import foundation.propositions
+open import foundation.retractions
+open import foundation.retracts-of-types
+open import foundation.sections
+open import foundation.sets
+open import foundation.subtypes
+open import foundation.tight-apartness-relations
+open import foundation.unit-type
+open import foundation.universe-levels
+
+open import foundation-core.identity-types
+
+open import order-theory.order-preserving-maps-posets
+
+open import set-theory.cantor-space
+```
+
+
+
+## Idea
+
+The type of
+{{#concept "increasing binary sequences" WD="Extended natural numbers" WDID=Q105759800 Agda=ℕ∞↑}}
+is the [subset](foundation-core.subtypes.md) of the
+[cantor set](set-theory.cantor-space.md) consisting of increasing sequences of
+binary numbers. This type is equivalent to the
+[conatural numbers](elementary-number-theory.conatural-numbers.md).
+
+Many of these formalizations mirror work from the TypeTopology library.
+{{#cite TypeTopology}}
+
+## Definitions
+
+### The predicate on a binary sequence of being increasing
+
+```agda
+is-increasing-binary-sequence : cantor-space → UU lzero
+is-increasing-binary-sequence x = (n : ℕ) → leq-bool (x n) (x (succ-ℕ n))
+
+is-prop-is-increasing-binary-sequence :
+ (x : cantor-space) → is-prop (is-increasing-binary-sequence x)
+is-prop-is-increasing-binary-sequence x =
+ is-prop-Π (λ n → is-prop-leq-bool {x n} {x (succ-ℕ n)})
+
+is-increasing-binary-sequence-Prop : cantor-space → Prop lzero
+is-increasing-binary-sequence-Prop x =
+ ( is-increasing-binary-sequence x ,
+ is-prop-is-increasing-binary-sequence x)
+```
+
+### The type of increasing binary sequences
+
+```agda
+ℕ∞↑ : UU lzero
+ℕ∞↑ = Σ cantor-space is-increasing-binary-sequence
+
+sequence-ℕ∞↑ : ℕ∞↑ → cantor-space
+sequence-ℕ∞↑ = pr1
+
+is-increasing-sequence-ℕ∞↑ :
+ (x : ℕ∞↑) → is-increasing-binary-sequence (sequence-ℕ∞↑ x)
+is-increasing-sequence-ℕ∞↑ = pr2
+
+emb-sequence-ℕ∞↑ : ℕ∞↑ ↪ cantor-space
+emb-sequence-ℕ∞↑ = emb-subtype is-increasing-binary-sequence-Prop
+
+is-injective-sequence-ℕ∞↑ : is-injective sequence-ℕ∞↑
+is-injective-sequence-ℕ∞↑ = is-injective-emb emb-sequence-ℕ∞↑
+```
+
+### The element at infinity
+
+```agda
+infinity-ℕ∞↑ : ℕ∞↑
+infinity-ℕ∞↑ = (const ℕ false , λ _ → star)
+```
+
+### The zero element
+
+We interpret the constantly zero sequence as the zero element of the generic
+convergent sequence.
+
+```agda
+zero-ℕ∞↑ : ℕ∞↑
+zero-ℕ∞↑ = (const ℕ true , λ _ → star)
+```
+
+### The successor function
+
+```agda
+succ-ℕ∞↑ : ℕ∞↑ → ℕ∞↑
+succ-ℕ∞↑ (x , H) =
+ ( rec-ℕ false (λ n _ → x n) , ind-ℕ (leq-false-bool {x 0}) (λ n _ → H n))
+```
+
+### The predecessor function
+
+```agda
+shift-left-ℕ∞↑ : ℕ∞↑ → ℕ∞↑
+shift-left-ℕ∞↑ (x , H) = (x ∘ succ-ℕ , H ∘ succ-ℕ)
+
+decons-ℕ∞↑ : ℕ∞↑ → Maybe ℕ∞↑
+decons-ℕ∞↑ (x , H) =
+ rec-bool exception-Maybe (unit-Maybe (shift-left-ℕ∞↑ (x , H))) (x 0)
+```
+
+### The constructor function
+
+```agda
+cons-ℕ∞↑ : Maybe ℕ∞↑ → ℕ∞↑
+cons-ℕ∞↑ (inl x) = succ-ℕ∞↑ x
+cons-ℕ∞↑ (inr x) = zero-ℕ∞↑
+```
+
+### Some other constants
+
+```agda
+one-ℕ∞↑ : ℕ∞↑
+one-ℕ∞↑ = succ-ℕ∞↑ zero-ℕ∞↑
+
+two-ℕ∞↑ : ℕ∞↑
+two-ℕ∞↑ = succ-ℕ∞↑ one-ℕ∞↑
+
+three-ℕ∞↑ : ℕ∞↑
+three-ℕ∞↑ = succ-ℕ∞↑ two-ℕ∞↑
+```
+
+## Properties
+
+### Equality on elements of increasing binary sequences
+
+```agda
+Eq-ℕ∞↑ : ℕ∞↑ → ℕ∞↑ → UU lzero
+Eq-ℕ∞↑ x y = pr1 x ~ pr1 y
+
+refl-Eq-ℕ∞↑ : (x : ℕ∞↑) → Eq-ℕ∞↑ x x
+refl-Eq-ℕ∞↑ x = refl-htpy
+
+extensionality-ℕ∞↑ : (x y : ℕ∞↑) → (x = y) ≃ Eq-ℕ∞↑ x y
+extensionality-ℕ∞↑ x y =
+ equiv-funext ∘e equiv-ap-inclusion-subtype is-increasing-binary-sequence-Prop
+
+Eq-eq-ℕ∞↑ : {x y : ℕ∞↑} → x = y → Eq-ℕ∞↑ x y
+Eq-eq-ℕ∞↑ {x} {y} = map-equiv (extensionality-ℕ∞↑ x y)
+
+eq-Eq-ℕ∞↑ : {x y : ℕ∞↑} → Eq-ℕ∞↑ x y → x = y
+eq-Eq-ℕ∞↑ {x} {y} = map-inv-equiv (extensionality-ℕ∞↑ x y)
+```
+
+### The tight apartness relation on increasing binary sequences
+
+```agda
+tight-apartness-relation-ℕ∞↑ : Tight-Apartness-Relation lzero ℕ∞↑
+tight-apartness-relation-ℕ∞↑ =
+ type-subtype-Tight-Apartness-Relation
+ is-increasing-binary-sequence-Prop
+ tight-apartness-relation-cantor-space
+
+ℕ∞↑-Type-With-Tight-Apartness : Type-With-Tight-Apartness lzero lzero
+ℕ∞↑-Type-With-Tight-Apartness =
+ subtype-Type-With-Tight-Apartness
+ cantor-space-Type-With-Tight-Apartness
+ is-increasing-binary-sequence-Prop
+```
+
+### The type of increasing binary sequences has double negation stable equality
+
+```agda
+has-double-negation-stable-equality-ℕ∞↑ :
+ has-double-negation-stable-equality ℕ∞↑
+has-double-negation-stable-equality-ℕ∞↑ =
+ has-double-negation-stable-equality-type-Type-With-Tight-Apartness
+ ( ℕ∞↑-Type-With-Tight-Apartness)
+```
+
+### The type of increasing binary sequences is a set
+
+```agda
+abstract
+ is-set-ℕ∞↑ : is-set ℕ∞↑
+ is-set-ℕ∞↑ =
+ is-set-type-Type-With-Tight-Apartness ℕ∞↑-Type-With-Tight-Apartness
+```
+
+### The successor function is an embedding
+
+```agda
+is-injective-succ-ℕ∞↑ : is-injective succ-ℕ∞↑
+is-injective-succ-ℕ∞↑ p = eq-Eq-ℕ∞↑ (Eq-eq-ℕ∞↑ p ∘ succ-ℕ)
+
+abstract
+ is-emb-succ-ℕ∞↑ : is-emb succ-ℕ∞↑
+ is-emb-succ-ℕ∞↑ = is-emb-is-injective is-set-ℕ∞↑ is-injective-succ-ℕ∞↑
+
+emb-succ-ℕ∞↑ : ℕ∞↑ ↪ ℕ∞↑
+emb-succ-ℕ∞↑ = (succ-ℕ∞↑ , is-emb-succ-ℕ∞↑)
+```
+
+### Zero is not a successor of any increasing binary sequence
+
+```agda
+abstract
+ neq-zero-succ-ℕ∞↑ : {x : ℕ∞↑} → zero-ℕ∞↑ ≠ succ-ℕ∞↑ x
+ neq-zero-succ-ℕ∞↑ p = neq-true-false-bool (Eq-eq-ℕ∞↑ p 0)
+
+abstract
+ neq-succ-zero-ℕ∞↑ : {x : ℕ∞↑} → succ-ℕ∞↑ x ≠ zero-ℕ∞↑
+ neq-succ-zero-ℕ∞↑ p = neq-false-true-bool (Eq-eq-ℕ∞↑ p 0)
+```
+
+### The constructor is a section of the destructor function
+
+```agda
+is-section-cons-ℕ∞↑ : is-section decons-ℕ∞↑ cons-ℕ∞↑
+is-section-cons-ℕ∞↑ (inl x) = refl
+is-section-cons-ℕ∞↑ (inr x) = refl
+
+is-injective-cons-ℕ∞↑ : is-injective cons-ℕ∞↑
+is-injective-cons-ℕ∞↑ =
+ is-injective-has-retraction cons-ℕ∞↑ decons-ℕ∞↑ is-section-cons-ℕ∞↑
+```
+
+### The type of increasing binary sequences as a retract of the cantor space
+
+```agda
+force-ℕ∞↑' : cantor-space → cantor-space
+force-ℕ∞↑' x zero-ℕ = x zero-ℕ
+force-ℕ∞↑' x (succ-ℕ n) = or-bool (x (succ-ℕ n)) (force-ℕ∞↑' x n)
+
+abstract
+ is-increasing-force-ℕ∞↑ :
+ (x : cantor-space) → is-increasing-binary-sequence (force-ℕ∞↑' x)
+ is-increasing-force-ℕ∞↑ x n = leq-or-bool' {x (succ-ℕ n)} {force-ℕ∞↑' x n}
+
+force-ℕ∞↑ : cantor-space → ℕ∞↑
+force-ℕ∞↑ x = (force-ℕ∞↑' x , is-increasing-force-ℕ∞↑ x)
+
+abstract
+ compute-force-ℕ∞↑' :
+ (x : cantor-space) → is-increasing-binary-sequence x → force-ℕ∞↑' x ~ x
+ compute-force-ℕ∞↑' x H zero-ℕ = refl
+ compute-force-ℕ∞↑' x H (succ-ℕ n) =
+ ( ap
+ ( or-bool (x (succ-ℕ n)))
+ ( compute-force-ℕ∞↑' x H n)) ∙
+ ( antisymmetric-leq-bool
+ ( leq-right-or-bool {x n} {x (succ-ℕ n)} (H n))
+ ( leq-or-bool {x (succ-ℕ n)} {x n}))
+
+abstract
+ is-retraction-force-ℕ∞↑ : is-retraction sequence-ℕ∞↑ force-ℕ∞↑
+ is-retraction-force-ℕ∞↑ (x , H) = eq-Eq-ℕ∞↑ (compute-force-ℕ∞↑' x H)
+
+retraction-sequence-ℕ∞↑ : retraction sequence-ℕ∞↑
+retraction-sequence-ℕ∞↑ = (force-ℕ∞↑ , is-retraction-force-ℕ∞↑)
+
+retract-cantor-space-ℕ∞↑ : ℕ∞↑ retract-of cantor-space
+retract-cantor-space-ℕ∞↑ = (sequence-ℕ∞↑ , retraction-sequence-ℕ∞↑)
+```
+
+### Increasing binary sequences are order preserving maps
+
+```agda
+abstract
+ preserves-order-ℕ∞↑ :
+ {x : ℕ∞↑} → preserves-order-Poset ℕ-Poset bool-Poset (sequence-ℕ∞↑ x)
+ preserves-order-ℕ∞↑ {x} =
+ preserves-order-ind-ℕ-Poset bool-Poset
+ ( sequence-ℕ∞↑ x)
+ ( is-increasing-sequence-ℕ∞↑ x)
+
+abstract
+ is-increasing-preserves-order-binary-sequence :
+ {x : cantor-space} →
+ preserves-order-Poset ℕ-Poset bool-Poset x →
+ is-increasing-binary-sequence x
+ is-increasing-preserves-order-binary-sequence H n =
+ H n (succ-ℕ n) (succ-leq-ℕ n)
+```
+
+### If an increasing binary sequence is true at the first position, then it is the zero element
+
+```agda
+abstract
+ Eq-zero-is-zero-ℕ∞↑ :
+ (x : ℕ∞↑) → is-true (sequence-ℕ∞↑ x 0) → sequence-ℕ∞↑ x ~ const ℕ true
+ Eq-zero-is-zero-ℕ∞↑ x p zero-ℕ = p
+ Eq-zero-is-zero-ℕ∞↑ x p (succ-ℕ n) =
+ eq-leq-true-bool
+ ( transitive-leq-bool
+ { true}
+ { sequence-ℕ∞↑ x n}
+ { sequence-ℕ∞↑ x (succ-ℕ n)}
+ ( is-increasing-sequence-ℕ∞↑ x n)
+ ( leq-eq-bool (inv (Eq-zero-is-zero-ℕ∞↑ x p n))))
+
+abstract
+ eq-zero-is-zero-ℕ∞↑ : (x : ℕ∞↑) → is-true (sequence-ℕ∞↑ x 0) → x = zero-ℕ∞↑
+ eq-zero-is-zero-ℕ∞↑ x p = eq-Eq-ℕ∞↑ (Eq-zero-is-zero-ℕ∞↑ x p)
+```
+
+## See also
+
+- [The conatural numbers](elementary-number-theory.conatural-numbers.md)
+- [Initial segments of the natural numbers](elementary-number-theory.initial-segments-natural-numbers.md)
+
+## References
+
+{{#bibliography}}
+
+## External links
+
+- [CoNaturals](https://martinescardo.github.io/TypeTopology/CoNaturals.index.html)
+ at TypeTopology
+- [extended natural numbers](https://ncatlab.org/nlab/show/extended+natural+number)
+ at $n$Lab
diff --git a/src/set-theory/inequality-increasing-binary-sequences.lagda.md b/src/set-theory/inequality-increasing-binary-sequences.lagda.md
new file mode 100644
index 0000000000..9a1ad0e4c4
--- /dev/null
+++ b/src/set-theory/inequality-increasing-binary-sequences.lagda.md
@@ -0,0 +1,164 @@
+# Inequality of increasing binary sequences
+
+```agda
+module set-theory.inequality-increasing-binary-sequences where
+```
+
+Imports
+
+```agda
+open import elementary-number-theory.natural-numbers
+
+open import foundation.dependent-pair-types
+open import foundation.function-types
+open import foundation.homotopies
+open import foundation.inequality-booleans
+open import foundation.propositions
+open import foundation.unit-type
+open import foundation.universe-levels
+
+open import foundation-core.identity-types
+
+open import order-theory.posets
+open import order-theory.preorders
+
+open import set-theory.increasing-binary-sequences
+```
+
+
+
+## Idea
+
+Given two
+[increasing binary sequences](set-theory.inequality-increasing-binary-sequences.md)
+`x` and `y`, then `x` is _less than or equal_ to `y` if `yᵢ ≤ xᵢ` for every
+`i : ℕ`. This defines the
+{{#concept "standard inequality" Disambiguation="on increasing binary sequences" Agda=leq-ℕ∞↑}}
+relation on increasing binary sequences.
+
+## Definitions
+
+```agda
+leq-ℕ∞↑ : ℕ∞↑ → ℕ∞↑ → UU lzero
+leq-ℕ∞↑ x y = (n : ℕ) → leq-bool (sequence-ℕ∞↑ y n) (sequence-ℕ∞↑ x n)
+
+infix 30 _≤-ℕ∞↑_
+_≤-ℕ∞↑_ : ℕ∞↑ → ℕ∞↑ → UU lzero
+_≤-ℕ∞↑_ = leq-ℕ∞↑
+
+is-prop-leq-ℕ∞↑ : (x y : ℕ∞↑) → is-prop (x ≤-ℕ∞↑ y)
+is-prop-leq-ℕ∞↑ x y =
+ is-prop-Π (λ n → is-prop-leq-bool {sequence-ℕ∞↑ y n} {sequence-ℕ∞↑ x n})
+
+leq-prop-ℕ∞↑ : ℕ∞↑ → ℕ∞↑ → Prop lzero
+leq-prop-ℕ∞↑ x y = (leq-ℕ∞↑ x y , is-prop-leq-ℕ∞↑ x y)
+```
+
+## Properties
+
+### Inequality of increasing binary sequences is reflexive
+
+```agda
+abstract
+ refl-leq-ℕ∞↑ : (x : ℕ∞↑) → leq-ℕ∞↑ x x
+ refl-leq-ℕ∞↑ x n = refl-leq-bool {sequence-ℕ∞↑ x n}
+
+abstract
+ leq-Eq-ℕ∞↑' : (x y : ℕ∞↑) → Eq-ℕ∞↑ y x → leq-ℕ∞↑ x y
+ leq-Eq-ℕ∞↑' x y H = leq-eq-bool ∘ H
+
+abstract
+ leq-Eq-ℕ∞↑ : (x y : ℕ∞↑) → Eq-ℕ∞↑ x y → leq-ℕ∞↑ x y
+ leq-Eq-ℕ∞↑ x y H = leq-Eq-ℕ∞↑' x y (inv-htpy H)
+
+abstract
+ leq-eq-ℕ∞↑ : (x y : ℕ∞↑) → x = y → leq-ℕ∞↑ x y
+ leq-eq-ℕ∞↑ x .x refl = refl-leq-ℕ∞↑ x
+```
+
+### Inequality of increasing binary sequences is transitive
+
+```agda
+transitive-leq-ℕ∞↑ :
+ (x y z : ℕ∞↑) → y ≤-ℕ∞↑ z → x ≤-ℕ∞↑ y → x ≤-ℕ∞↑ z
+transitive-leq-ℕ∞↑ x y z p q n =
+ transitive-leq-bool
+ { sequence-ℕ∞↑ z n}
+ { sequence-ℕ∞↑ y n}
+ { sequence-ℕ∞↑ x n}
+ ( q n)
+ ( p n)
+```
+
+### Inequality of increasing binary sequences is antisymmetric
+
+```agda
+antisymmetric-leq-ℕ∞↑ :
+ (x y : ℕ∞↑) → x ≤-ℕ∞↑ y → y ≤-ℕ∞↑ x → x = y
+antisymmetric-leq-ℕ∞↑ x y p q =
+ eq-Eq-ℕ∞↑
+ ( λ n →
+ antisymmetric-leq-bool
+ { sequence-ℕ∞↑ x n}
+ { sequence-ℕ∞↑ y n}
+ ( q n)
+ ( p n))
+```
+
+### The poset of increasing binary sequences
+
+```agda
+is-preorder-leq-ℕ∞↑ :
+ is-preorder-Relation-Prop leq-prop-ℕ∞↑
+is-preorder-leq-ℕ∞↑ = (refl-leq-ℕ∞↑ , transitive-leq-ℕ∞↑)
+
+ℕ∞↑-Preorder : Preorder lzero lzero
+ℕ∞↑-Preorder = (ℕ∞↑ , leq-prop-ℕ∞↑ , is-preorder-leq-ℕ∞↑)
+
+ℕ∞↑-Poset : Poset lzero lzero
+ℕ∞↑-Poset = (ℕ∞↑-Preorder , antisymmetric-leq-ℕ∞↑)
+```
+
+### The successor function preserves order
+
+```agda
+preserves-order-succ-ℕ∞↑ :
+ (x y : ℕ∞↑) → x ≤-ℕ∞↑ y → (succ-ℕ∞↑ x) ≤-ℕ∞↑ (succ-ℕ∞↑ y)
+preserves-order-succ-ℕ∞↑ x y p zero-ℕ = star
+preserves-order-succ-ℕ∞↑ x y p (succ-ℕ n) = p n
+```
+
+### The successor function is inflationary
+
+```agda
+leq-succ-ℕ∞↑ : (x : ℕ∞↑) → x ≤-ℕ∞↑ (succ-ℕ∞↑ x)
+leq-succ-ℕ∞↑ x zero-ℕ = star
+leq-succ-ℕ∞↑ x (succ-ℕ n) = is-increasing-sequence-ℕ∞↑ x n
+```
+
+### Zero is the smallest element
+
+```agda
+leq-zero-ℕ∞↑ : (x : ℕ∞↑) → zero-ℕ∞↑ ≤-ℕ∞↑ x
+leq-zero-ℕ∞↑ x n = leq-true-bool {sequence-ℕ∞↑ x n}
+
+Eq-leq-zero-ℕ∞↑ :
+ (x : ℕ∞↑) → x ≤-ℕ∞↑ zero-ℕ∞↑ → Eq-ℕ∞↑ x zero-ℕ∞↑
+Eq-leq-zero-ℕ∞↑ x p = eq-leq-true-bool ∘ p
+
+eq-leq-zero-ℕ∞↑ : (x : ℕ∞↑) → x ≤-ℕ∞↑ zero-ℕ∞↑ → x = zero-ℕ∞↑
+eq-leq-zero-ℕ∞↑ x p = eq-Eq-ℕ∞↑ (Eq-leq-zero-ℕ∞↑ x p)
+```
+
+### Infinity is the largest element
+
+```agda
+infinity-leq-ℕ∞↑ : (x : ℕ∞↑) → x ≤-ℕ∞↑ infinity-ℕ∞↑
+infinity-leq-ℕ∞↑ x n = leq-false-bool {sequence-ℕ∞↑ x n}
+
+Eq-leq-infinity-ℕ∞↑ : (x : ℕ∞↑) → infinity-ℕ∞↑ ≤-ℕ∞↑ x → Eq-ℕ∞↑ x infinity-ℕ∞↑
+Eq-leq-infinity-ℕ∞↑ x p = eq-leq-false-bool ∘ p
+
+eq-leq-infinity-ℕ∞↑ : (x : ℕ∞↑) → infinity-ℕ∞↑ ≤-ℕ∞↑ x → x = infinity-ℕ∞↑
+eq-leq-infinity-ℕ∞↑ x p = eq-Eq-ℕ∞↑ (Eq-leq-infinity-ℕ∞↑ x p)
+```
diff --git a/src/synthetic-homotopy-theory/homotopy-groups.lagda.md b/src/synthetic-homotopy-theory/homotopy-groups.lagda.md
index 5d30f801f9..e6f739ed10 100644
--- a/src/synthetic-homotopy-theory/homotopy-groups.lagda.md
+++ b/src/synthetic-homotopy-theory/homotopy-groups.lagda.md
@@ -37,8 +37,8 @@ where
- `π₀ A` is the set of
[connected components](foundation.connected-components.md) of `A`, and
- `πᵢ₊₁ A` is the set `πᵢ ΩA` equipped with the
- [group structure](group-theory.groups.md) obtained from the [loop
- space](synthetic-homotopy theory.loop-spaces.md).
+ [group structure](group-theory.groups.md) obtained from the
+ [loop space](synthetic-homotopy-theory.loop-spaces.md).
For `i ≥ 2`, the `i`-th homotopy group `πᵢ A` of `A` is
[abelian](group-theory.abelian-groups.md) by the
diff --git a/src/trees.lagda.md b/src/trees.lagda.md
index 4da5e8d445..f3dd773448 100644
--- a/src/trees.lagda.md
+++ b/src/trees.lagda.md
@@ -4,7 +4,7 @@
{-# OPTIONS --guardedness #-}
```
-## Files in the `trees` module
+## Modules in the trees namespace
```agda
module trees where
diff --git a/src/univalent-combinatorics/counting.lagda.md b/src/univalent-combinatorics/counting.lagda.md
index b9c4fa6d19..79b55c6a18 100644
--- a/src/univalent-combinatorics/counting.lagda.md
+++ b/src/univalent-combinatorics/counting.lagda.md
@@ -26,6 +26,8 @@ open import foundation.sets
open import foundation.unit-type
open import foundation.universe-levels
+open import logic.propositionally-decidable-types
+
open import univalent-combinatorics.equality-standard-finite-types
open import univalent-combinatorics.standard-finite-types
```
diff --git a/src/univalent-combinatorics/decidable-dependent-function-types.lagda.md b/src/univalent-combinatorics/decidable-dependent-function-types.lagda.md
index 5f6cfff00c..c9e717f084 100644
--- a/src/univalent-combinatorics/decidable-dependent-function-types.lagda.md
+++ b/src/univalent-combinatorics/decidable-dependent-function-types.lagda.md
@@ -62,7 +62,7 @@ is-decidable-Π-is-finite :
((x : A) → is-decidable (B x)) → is-decidable ((x : A) → B x)
is-decidable-Π-is-finite {l1} {l2} {A} {B} H d =
is-decidable-iff
- ( map-Π (λ x → elim-trunc-Prop-is-decidable (d x)))
+ ( map-Π (λ x → ε-operator-is-decidable (d x)))
( map-Π (λ x → unit-trunc-Prop))
( is-decidable-iff
( α)
@@ -77,7 +77,7 @@ is-decidable-Π-is-finite {l1} {l2} {A} {B} H d =
( λ x →
is-decidable-iff
( unit-trunc-Prop)
- ( elim-trunc-Prop-is-decidable (d x))
+ ( ε-operator-is-decidable (d x))
( d x))))))
where
α : type-trunc-Prop ((x : A) → B x) → (x : A) → type-trunc-Prop (B x)
diff --git a/src/univalent-combinatorics/dependent-pair-types.lagda.md b/src/univalent-combinatorics/dependent-pair-types.lagda.md
index 491d05e318..8656055338 100644
--- a/src/univalent-combinatorics/dependent-pair-types.lagda.md
+++ b/src/univalent-combinatorics/dependent-pair-types.lagda.md
@@ -31,6 +31,8 @@ open import foundation.type-arithmetic-coproduct-types
open import foundation.type-arithmetic-dependent-pair-types
open import foundation.universe-levels
+open import logic.propositionally-decidable-types
+
open import univalent-combinatorics.coproduct-types
open import univalent-combinatorics.counting
open import univalent-combinatorics.counting-dependent-pair-types
diff --git a/src/univalent-combinatorics/finite-types.lagda.md b/src/univalent-combinatorics/finite-types.lagda.md
index 0ddff4cb5a..ab9b151fe7 100644
--- a/src/univalent-combinatorics/finite-types.lagda.md
+++ b/src/univalent-combinatorics/finite-types.lagda.md
@@ -42,6 +42,8 @@ open import foundation.universe-levels
open import foundation-core.torsorial-type-families
+open import logic.propositionally-decidable-types
+
open import univalent-combinatorics.counting
open import univalent-combinatorics.double-counting
open import univalent-combinatorics.standard-finite-types