From 71282b51d9b52b995c106344db7f9262e2251365 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 18 Oct 2024 17:13:12 +0200 Subject: [PATCH 01/83] move some lemmas for decidable dependent types --- .../decidable-propositions.lagda.md | 3 ++ ...ecidable-dependent-function-types.lagda.md | 25 ++++++++++++++-- .../decidable-dependent-pair-types.lagda.md | 30 ++++++++++++++++++- src/foundation/decidable-types.lagda.md | 30 ------------------- 4 files changed, 55 insertions(+), 33 deletions(-) diff --git a/src/foundation-core/decidable-propositions.lagda.md b/src/foundation-core/decidable-propositions.lagda.md index 3f6eb2e2ce..e47d870b22 100644 --- a/src/foundation-core/decidable-propositions.lagda.md +++ b/src/foundation-core/decidable-propositions.lagda.md @@ -59,6 +59,9 @@ is-prop-is-decidable-prop X = ( is-prop-is-prop X) ( is-prop-is-decidable (pr1 H))) +is-decidable-type-Prop : {l : Level} → Prop l → UU l +is-decidable-type-Prop P = is-decidable (type-Prop P) + is-decidable-prop-Prop : {l : Level} (A : UU l) → Prop l pr1 (is-decidable-prop-Prop A) = is-decidable-prop A diff --git a/src/foundation/decidable-dependent-function-types.lagda.md b/src/foundation/decidable-dependent-function-types.lagda.md index f0045ab035..e1a6c019be 100644 --- a/src/foundation/decidable-dependent-function-types.lagda.md +++ b/src/foundation/decidable-dependent-function-types.lagda.md @@ -22,7 +22,27 @@ open import foundation-core.equivalences ## Idea -We describe conditions under which dependent products are decidable. +We describe conditions under which +[dependent function types](foundation.dependent-function-types.md) are +[decidable](foundation.decidable-types.md). + +## Properties + +### Decidability of dependent products of uniformly decidable families + +```agda +is-decidable-Π-uniformly-decidable-family : + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → + is-decidable A → + (((a : A) → B a) + ((a : A) → ¬ (B a))) → + is-decidable ((a : A) → (B a)) +is-decidable-Π-uniformly-decidable-family (inl a) (inl b) = + inl b +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) +``` ### Decidablitilty of dependent products over coproducts @@ -42,7 +62,8 @@ is-decidable-Π-coproduct {C = C} dA dB = ```agda is-decidable-Π-Maybe : {l1 l2 : Level} {A : UU l1} {B : Maybe A → UU l2} → - is-decidable ((x : A) → B (unit-Maybe x)) → is-decidable (B exception-Maybe) → + is-decidable ((x : A) → B (unit-Maybe x)) → + is-decidable (B exception-Maybe) → is-decidable ((x : Maybe A) → B x) is-decidable-Π-Maybe {B = B} du de = is-decidable-equiv diff --git a/src/foundation/decidable-dependent-pair-types.lagda.md b/src/foundation/decidable-dependent-pair-types.lagda.md index 1632117634..789d08c03f 100644 --- a/src/foundation/decidable-dependent-pair-types.lagda.md +++ b/src/foundation/decidable-dependent-pair-types.lagda.md @@ -24,7 +24,27 @@ open import foundation-core.functoriality-dependent-pair-types ## Idea -We describe conditions under which dependent sums are decidable. +We describe conditions under which +[dependent sums](foundation.dependent-pair-types.md) are +[decidable](foundation.decidable-types.md) + +## Properites + +### Dependent sums of a uniformly decidable family of types + +```agda +is-decidable-Σ-uniformly-decidable-family : + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → + is-decidable A → (((a : A) → B a) + ((a : A) → ¬ B a)) → is-decidable (Σ A B) +is-decidable-Σ-uniformly-decidable-family (inl a) (inl b) = + inl (a , b a) +is-decidable-Σ-uniformly-decidable-family (inl a) (inr b) = + inr (λ x → b (pr1 x) (pr2 x)) +is-decidable-Σ-uniformly-decidable-family (inr a) _ = + inr (λ x → a (pr1 x)) +``` + +### Decidability of dependent sums over coproducts ```agda is-decidable-Σ-coproduct : @@ -35,7 +55,11 @@ is-decidable-Σ-coproduct {l1} {l2} {l3} {A} {B} C dA dB = is-decidable-equiv ( right-distributive-Σ-coproduct A B C) ( is-decidable-coproduct dA dB) +``` + +### Decidability of dependent sums over `Maybe` +```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) → @@ -45,7 +69,11 @@ is-decidable-Σ-Maybe {l1} {l2} {A} {B} dA de = ( is-decidable-equiv ( left-unit-law-Σ (B ∘ inr)) ( de)) +``` + +### Decidability of dependent sums over equivalences +```agda is-decidable-Σ-equiv : {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)) → diff --git a/src/foundation/decidable-types.lagda.md b/src/foundation/decidable-types.lagda.md index 2f34bdc31f..ea18245fa4 100644 --- a/src/foundation/decidable-types.lagda.md +++ b/src/foundation/decidable-types.lagda.md @@ -154,36 +154,6 @@ is-decidable-function-type' (inl a) d with d a is-decidable-function-type' (inr na) d = inl (ex-falso ∘ na) ``` -### Dependent sums of a uniformly decidable family of types over a decidable base is decidable - -```agda -is-decidable-Σ-uniformly-decidable-family : - {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → - is-decidable A → (((a : A) → B a) + ((a : A) → ¬ B a)) → is-decidable (Σ A B) -is-decidable-Σ-uniformly-decidable-family (inl a) (inl b) = - inl (a , b a) -is-decidable-Σ-uniformly-decidable-family (inl a) (inr b) = - inr (λ x → b (pr1 x) (pr2 x)) -is-decidable-Σ-uniformly-decidable-family (inr a) _ = - inr (λ x → a (pr1 x)) -``` - -### Dependent products of uniformly decidable families over decidable bases are decidable - -```agda -is-decidable-Π-uniformly-decidable-family : - {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → - is-decidable A → - (((a : A) → B a) + ((a : A) → ¬ (B a))) → - is-decidable ((a : A) → (B a)) -is-decidable-Π-uniformly-decidable-family (inl a) (inl b) = - inl b -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) -``` - ### The negation of a decidable type is decidable ```agda From 39535e40b515ddff9a1c66a790165a9e3580e6e3 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 19 Oct 2024 19:43:37 +0200 Subject: [PATCH 02/83] edits --- .../decidable-propositions.lagda.md | 20 ++++++++++- src/foundation-core/propositions.lagda.md | 4 +++ ...roduct-decompositions-subuniverse.lagda.md | 2 +- ...ecidable-dependent-function-types.lagda.md | 3 ++ .../decidable-dependent-pair-types.lagda.md | 3 +- .../decidable-propositions.lagda.md | 3 +- .../irrefutable-propositions.lagda.md | 28 +++++++-------- src/foundation/iterating-functions.lagda.md | 34 +++++++++++++++++++ src/foundation/propositions.lagda.md | 21 ++++++++++++ 9 files changed, 99 insertions(+), 19 deletions(-) diff --git a/src/foundation-core/decidable-propositions.lagda.md b/src/foundation-core/decidable-propositions.lagda.md index e47d870b22..f7972252a9 100644 --- a/src/foundation-core/decidable-propositions.lagda.md +++ b/src/foundation-core/decidable-propositions.lagda.md @@ -17,6 +17,7 @@ open import foundation.unit-type open import foundation.universe-levels open import foundation-core.cartesian-product-types +open import foundation-core.contractible-types open import foundation-core.empty-types open import foundation-core.function-types open import foundation-core.functoriality-dependent-pair-types @@ -96,7 +97,8 @@ module _ is-decidable-prop-type-Decidable-Prop = pr2 P is-decidable-prop-Decidable-Prop : Prop l - pr1 is-decidable-prop-Decidable-Prop = is-decidable type-Decidable-Prop + pr1 is-decidable-prop-Decidable-Prop = + is-decidable type-Decidable-Prop pr2 is-decidable-prop-Decidable-Prop = is-prop-is-decidable is-prop-type-Decidable-Prop ``` @@ -113,6 +115,14 @@ pr1 empty-Decidable-Prop = empty pr2 empty-Decidable-Prop = is-decidable-prop-empty ``` +### Empty types are decidable propositions + +```agda +is-decidable-prop-is-empty : + {l : Level} {A : UU l} → is-empty A → is-decidable-prop A +is-decidable-prop-is-empty H = is-prop-is-empty H , inr H +``` + ### The unit type is a decidable proposition ```agda @@ -125,6 +135,14 @@ pr1 unit-Decidable-Prop = unit pr2 unit-Decidable-Prop = is-decidable-prop-unit ``` +### Contractible types are decidable propositions + +```agda +is-decidable-prop-is-contr : + {l : Level} {A : UU l} → is-contr A → is-decidable-prop A +is-decidable-prop-is-contr H = is-prop-is-contr H , inl (center H) +``` + ### The product of two decidable propositions is a decidable proposition ```agda diff --git a/src/foundation-core/propositions.lagda.md b/src/foundation-core/propositions.lagda.md index 041ce6881d..0b5e5878b3 100644 --- a/src/foundation-core/propositions.lagda.md +++ b/src/foundation-core/propositions.lagda.md @@ -126,6 +126,10 @@ module _ abstract eq-is-proof-irrelevant : is-proof-irrelevant A → all-elements-equal A eq-is-proof-irrelevant = eq-is-prop' ∘ is-prop-is-proof-irrelevant + +abstract + eq-type-Prop : {l : Level} (P : Prop l) → {x y : type-Prop P} → x = y + eq-type-Prop P = eq-is-prop (is-prop-type-Prop P) ``` ### Propositions are closed under equivalences diff --git a/src/foundation/coproduct-decompositions-subuniverse.lagda.md b/src/foundation/coproduct-decompositions-subuniverse.lagda.md index 02e54fd742..f521f9f46b 100644 --- a/src/foundation/coproduct-decompositions-subuniverse.lagda.md +++ b/src/foundation/coproduct-decompositions-subuniverse.lagda.md @@ -503,7 +503,7 @@ module _ eq-pair-Σ ( eq-pair-Σ ( eq-equiv (equiv-is-empty is-empty-raise-empty (pr2 x))) - ( eq-is-prop (is-prop-type-Prop (P _)))) + ( eq-type-Prop (P _))) ( eq-is-prop is-property-is-empty))) ( ( raise-empty l1 , C1) , is-empty-raise-empty)) ∘e ( ( inv-associative-Σ _ _ _) ∘e diff --git a/src/foundation/decidable-dependent-function-types.lagda.md b/src/foundation/decidable-dependent-function-types.lagda.md index e1a6c019be..3cd5d80d2b 100644 --- a/src/foundation/decidable-dependent-function-types.lagda.md +++ b/src/foundation/decidable-dependent-function-types.lagda.md @@ -15,7 +15,10 @@ open import foundation.universal-property-maybe open import foundation.universe-levels 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 ``` diff --git a/src/foundation/decidable-dependent-pair-types.lagda.md b/src/foundation/decidable-dependent-pair-types.lagda.md index 789d08c03f..fdd0736644 100644 --- a/src/foundation/decidable-dependent-pair-types.lagda.md +++ b/src/foundation/decidable-dependent-pair-types.lagda.md @@ -18,6 +18,7 @@ open import foundation-core.coproduct-types open import foundation-core.equivalences open import foundation-core.function-types open import foundation-core.functoriality-dependent-pair-types +open import foundation-core.negation ``` @@ -51,7 +52,7 @@ is-decidable-Σ-coproduct : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : A + B → UU l3) → is-decidable (Σ A (C ∘ inl)) → is-decidable (Σ B (C ∘ inr)) → is-decidable (Σ (A + B) C) -is-decidable-Σ-coproduct {l1} {l2} {l3} {A} {B} C dA dB = +is-decidable-Σ-coproduct {A = A} {B} C dA dB = is-decidable-equiv ( right-distributive-Σ-coproduct A B C) ( is-decidable-coproduct dA dB) diff --git a/src/foundation/decidable-propositions.lagda.md b/src/foundation/decidable-propositions.lagda.md index 9369cc6140..904f6dc3f2 100644 --- a/src/foundation/decidable-propositions.lagda.md +++ b/src/foundation/decidable-propositions.lagda.md @@ -114,8 +114,7 @@ module _ is-retraction-map-inv-equiv-bool-Decidable-Prop' equiv-bool-Decidable-Prop' : - ((Σ (Prop l) type-Prop) + (Σ (Prop l) (λ Q → ¬ (type-Prop Q)))) ≃ - bool + ((Σ (Prop l) type-Prop) + (Σ (Prop l) (λ Q → ¬ (type-Prop Q)))) ≃ bool pr1 equiv-bool-Decidable-Prop' = map-equiv-bool-Decidable-Prop' pr2 equiv-bool-Decidable-Prop' = is-equiv-map-equiv-bool-Decidable-Prop' diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md index 7e0dd013dc..2ad9b6b22d 100644 --- a/src/foundation/irrefutable-propositions.lagda.md +++ b/src/foundation/irrefutable-propositions.lagda.md @@ -80,6 +80,20 @@ module _ ## Properties +### Provable propositions are irrefutable + +```agda +module _ + {l : Level} (P : Prop l) + where + + is-irrefutable-is-inhabited : type-Prop P → is-irrefutable P + is-irrefutable-is-inhabited = intro-double-negation + +is-irrefutable-unit : is-irrefutable unit-Prop +is-irrefutable-unit = is-irrefutable-is-inhabited unit-Prop star +``` + ### If it is irrefutable that a proposition is irrefutable, then the proposition is irrefutable ```agda @@ -110,17 +124,3 @@ module _ is-decidable-prop-Irrefutable-Prop = make-Irrefutable-Prop (is-decidable-Prop P) is-irrefutable-is-decidable-Prop ``` - -### Provable propositions are irrefutable - -```agda -module _ - {l : Level} (P : Prop l) - where - - is-irrefutable-is-inhabited : type-Prop P → is-irrefutable P - is-irrefutable-is-inhabited = intro-double-negation - -is-irrefutable-unit : is-irrefutable unit-Prop -is-irrefutable-unit = is-irrefutable-is-inhabited unit-Prop star -``` diff --git a/src/foundation/iterating-functions.lagda.md b/src/foundation/iterating-functions.lagda.md index edf0a3ddd1..18ea8c42a7 100644 --- a/src/foundation/iterating-functions.lagda.md +++ b/src/foundation/iterating-functions.lagda.md @@ -17,10 +17,12 @@ open import foundation.action-on-higher-identifications-functions open import foundation.action-on-identifications-functions open import foundation.dependent-pair-types open import foundation.function-extensionality +open import foundation.subtypes open import foundation.universe-levels open import foundation-core.commuting-squares-of-maps open import foundation-core.endomorphisms +open import foundation-core.function-types open import foundation-core.homotopies open import foundation-core.identity-types open import foundation-core.sets @@ -162,3 +164,35 @@ module _ eq-htpy (λ f → eq-htpy (λ x → iterate-mul-ℕ k l f x)) pr2 (pr2 iterative-action-Monoid) = refl ``` + +### 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/propositions.lagda.md b/src/foundation/propositions.lagda.md index cc36431139..e4bf1eb773 100644 --- a/src/foundation/propositions.lagda.md +++ b/src/foundation/propositions.lagda.md @@ -11,12 +11,15 @@ open import foundation-core.propositions public ```agda open import foundation.contractible-types open import foundation.dependent-pair-types +open import foundation.fibers-of-maps open import foundation.logical-equivalences open import foundation.retracts-of-types +open import foundation.unit-type open import foundation.universe-levels open import foundation-core.embeddings open import foundation-core.equivalences +open import foundation-core.propositional-maps open import foundation-core.truncated-types open import foundation-core.truncation-levels ``` @@ -64,6 +67,24 @@ abstract is-prop-emb = is-trunc-emb neg-two-𝕋 ``` +### A type is a proposition if and only if it embeds into the unit type + +```agda +module _ + {l : Level} {A : UU l} + where + + abstract + is-prop-is-emb-terminal-map : is-emb (terminal-map A) → is-prop A + is-prop-is-emb-terminal-map H = + is-prop-is-emb (terminal-map A) H is-prop-unit + + abstract + is-emb-terminal-map-is-prop : is-prop A → is-emb (terminal-map A) + is-emb-terminal-map-is-prop H = + is-emb-is-prop-map (λ y → is-prop-equiv (equiv-fiber-terminal-map y) H) +``` + ### Two equivalent types are equivalently propositions ```agda From 7dd26b3fb0e7eb30ae4763c574b300352fe02851 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 19 Oct 2024 19:44:54 +0200 Subject: [PATCH 03/83] additions double negation elimination --- src/foundation.lagda.md | 1 + src/foundation/decidable-embeddings.lagda.md | 157 +++++++++++--- ...uble-negation-stable-propositions.lagda.md | 201 +++++++++++++++++- src/foundation/double-negation.lagda.md | 35 +-- ...cated-double-negation-elimination.lagda.md | 184 ++++++++++++++++ 5 files changed, 504 insertions(+), 74 deletions(-) create mode 100644 src/foundation/untruncated-double-negation-elimination.lagda.md diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 9d2c66f3a9..af99498656 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -463,6 +463,7 @@ open import foundation.unordered-pairs public open import foundation.unordered-pairs-of-types public open import foundation.unordered-tuples public open import foundation.unordered-tuples-of-types public +open import foundation.untruncated-double-negation-elimination public open import foundation.vectors-set-quotients public open import foundation.weak-function-extensionality public open import foundation.weak-limited-principle-of-omniscience public diff --git a/src/foundation/decidable-embeddings.lagda.md b/src/foundation/decidable-embeddings.lagda.md index fc452b45c0..a84cfa637d 100644 --- a/src/foundation/decidable-embeddings.lagda.md +++ b/src/foundation/decidable-embeddings.lagda.md @@ -14,6 +14,7 @@ open import foundation.decidable-propositions open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.embeddings +open import foundation.fibers-of-maps open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-coproduct-types open import foundation.fundamental-theorem-of-identity-types @@ -21,9 +22,11 @@ open import foundation.homotopy-induction open import foundation.identity-types open import foundation.logical-equivalences 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 @@ -31,12 +34,10 @@ 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.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.propositions open import foundation-core.torsorial-type-families ``` @@ -79,20 +80,30 @@ is-decidable-map-is-decidable-emb = pr2 ### Decidably propositional maps ```agda -is-decidable-prop-map : - {l1 l2 : Level} {X : UU l1} {Y : UU l2} → (X → Y) → UU (l1 ⊔ l2) -is-decidable-prop-map {Y = Y} f = (y : Y) → is-decidable-prop (fiber f y) +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} + where -abstract - is-prop-map-is-decidable-prop-map : - {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → - is-decidable-prop-map f → is-prop-map f - is-prop-map-is-decidable-prop-map H y = pr1 (H y) + is-decidable-prop-map : (X → Y) → UU (l1 ⊔ l2) + is-decidable-prop-map f = (y : Y) → is-decidable-prop (fiber f y) -is-decidable-map-is-decidable-prop-map : - {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → - is-decidable-prop-map f → is-decidable-map f -is-decidable-map-is-decidable-prop-map H y = pr2 (H y) + is-prop-is-decidable-prop-map : + (f : X → Y) → is-prop (is-decidable-prop-map f) + is-prop-is-decidable-prop-map f = + is-prop-Π (λ y → is-prop-is-decidable-prop (fiber f y)) + + is-decidable-prop-map-Prop : (X → Y) → Prop (l1 ⊔ l2) + is-decidable-prop-map-Prop f = + ( is-decidable-prop-map f , is-prop-is-decidable-prop-map f) + + abstract + is-prop-map-is-decidable-prop-map : + {f : X → Y} → is-decidable-prop-map f → is-prop-map f + is-prop-map-is-decidable-prop-map H y = pr1 (H y) + + is-decidable-map-is-decidable-prop-map : + {f : X → Y} → is-decidable-prop-map f → is-decidable-map f + is-decidable-map-is-decidable-prop-map H y = pr2 (H y) ``` ### The type of decidable embeddings @@ -135,17 +146,6 @@ pr2 (emb-decidable-emb e) = is-emb-map-decidable-emb e ## Properties -### Being a decidably propositional map is a proposition - -```agda -abstract - is-prop-is-decidable-prop-map : - {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X → Y) → - is-prop (is-decidable-prop-map f) - is-prop-is-decidable-prop-map f = - is-prop-Π (λ y → is-prop-is-decidable-prop (fiber f y)) -``` - ### Any map of which the fibers are decidable propositions is a decidable embedding ```agda @@ -175,6 +175,26 @@ module _ is-decidable-map-is-decidable-emb H y ``` +### The first projection map of a dependent sum of decidable propositions is a decidable embedding + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (Q : A → Decidable-Prop l2) + where + + is-decidable-prop-map-pr1 : + is-decidable-prop-map (pr1 {B = type-Decidable-Prop ∘ Q}) + is-decidable-prop-map-pr1 y = + is-decidable-prop-equiv + ( equiv-fiber-pr1 (type-Decidable-Prop ∘ Q) y) + ( is-decidable-prop-type-Decidable-Prop (Q y)) + + is-decidable-emb-pr1 : + is-decidable-emb (pr1 {B = type-Decidable-Prop ∘ Q}) + is-decidable-emb-pr1 = + is-decidable-emb-is-decidable-prop-map is-decidable-prop-map-pr1 +``` + ### Equivalences are decidable embeddings ```agda @@ -189,13 +209,16 @@ abstract ### Identity maps are decidable embeddings ```agda -abstract - is-decidable-emb-id : - {l1 : Level} {A : UU l1} → is-decidable-emb (id {A = A}) - is-decidable-emb-id = (is-emb-id , is-decidable-map-id) +is-decidable-emb-id : + {l : Level} {A : UU l} → is-decidable-emb (id {A = A}) +is-decidable-emb-id = (is-emb-id , is-decidable-map-id) -decidable-emb-id : {l1 : Level} {A : UU l1} → A ↪ᵈ A +decidable-emb-id : {l : Level} {A : UU l} → A ↪ᵈ A decidable-emb-id = (id , is-decidable-emb-id) + +is-decidable-prop-map-id : + {l : Level} {A : UU l} → is-decidable-prop-map (id {A = A}) +is-decidable-prop-map-id y = is-decidable-prop-is-contr (is-torsorial-Id' y) ``` ### Being a decidable embedding is a property @@ -250,6 +273,17 @@ module _ is-decidable-emb-comp K H = ( is-emb-comp _ _ (pr1 K) (pr1 H) , is-decidable-map-comp-is-decidable-emb K H) + + abstract + is-decidable-prop-map-comp : + is-decidable-prop-map g → + is-decidable-prop-map f → + is-decidable-prop-map (g ∘ f) + is-decidable-prop-map-comp K H = + is-decidable-prop-map-is-decidable-emb + ( is-decidable-emb-comp + ( is-decidable-emb-is-decidable-prop-map K) + ( is-decidable-emb-is-decidable-prop-map H)) ``` ### Left cancellation for decidable embeddings @@ -360,9 +394,9 @@ abstract ( htpy-eq-decidable-emb f) eq-htpy-decidable-emb : - {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A ↪ᵈ B} → + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪ᵈ B) → htpy-decidable-emb f g → f = g -eq-htpy-decidable-emb {f = f} {g} = +eq-htpy-decidable-emb f g = map-inv-is-equiv (is-equiv-htpy-eq-decidable-emb f g) ``` @@ -561,3 +595,62 @@ module _ ( is-decidable-prop-map-retract-map R ( is-decidable-prop-map-is-decidable-emb G)) ``` + +### A type is a decidable proposition if and only if its terminal map is a decidable embedding + +```agda +module _ + {l : Level} {A : UU l} + where + + is-decidable-prop-is-decidable-emb-terminal-map : + is-decidable-emb (terminal-map A) → is-decidable-prop A + is-decidable-prop-is-decidable-emb-terminal-map H = + is-decidable-prop-equiv' + ( equiv-fiber-terminal-map star) + ( is-decidable-prop-map-is-decidable-emb H star) + + is-decidable-emb-terminal-map-is-decidable-prop : + is-decidable-prop A → is-decidable-emb (terminal-map A) + is-decidable-emb-terminal-map-is-decidable-prop H = + is-decidable-emb-is-decidable-prop-map + ( λ y → is-decidable-prop-equiv (equiv-fiber-terminal-map y) H) +``` + +### If a dependent sum of propositions over a proposition is decidable, then the family is a family of decidable propositions + +```agda +module _ + {l1 l2 : Level} (P : Prop l1) (Q : type-Prop P → Prop l2) + where + + is-decidable-prop-family-is-decidable-Σ : + is-decidable (Σ (type-Prop P) (type-Prop ∘ Q)) → + (p : type-Prop P) → is-decidable (type-Prop (Q p)) + is-decidable-prop-family-is-decidable-Σ H p = + is-decidable-equiv' + ( equiv-fiber-pr1 (type-Prop ∘ Q) p) + ( is-decidable-map-is-decidable-emb + ( is-decidable-emb-right-factor' + ( is-decidable-emb-terminal-map-is-decidable-prop + ( is-prop-Σ (is-prop-type-Prop P) (is-prop-type-Prop ∘ Q) , H)) + ( is-emb-terminal-map-is-prop (is-prop-type-Prop P))) + ( p)) +``` + +### A dependent sum of decidable propositions over a decidable proposition is a decidable proposition + +```agda +module _ + {l1 l2 : Level} (P : UU l1) (Q : P → UU l2) + where + + is-decidable-prop-Σ : + is-decidable-prop P → ((x : P) → is-decidable-prop (Q x)) → + is-decidable-prop (Σ P Q) + is-decidable-prop-Σ p q = + is-decidable-prop-is-decidable-emb-terminal-map + ( is-decidable-emb-comp + ( is-decidable-emb-terminal-map-is-decidable-prop p) + ( is-decidable-emb-pr1 (λ x → Q x , q x))) +``` diff --git a/src/foundation/double-negation-stable-propositions.lagda.md b/src/foundation/double-negation-stable-propositions.lagda.md index 760c158524..d8c73b64dd 100644 --- a/src/foundation/double-negation-stable-propositions.lagda.md +++ b/src/foundation/double-negation-stable-propositions.lagda.md @@ -7,12 +7,24 @@ module foundation.double-negation-stable-propositions where
Imports ```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.empty-types +open import foundation.existential-quantification open import foundation.negation +open import foundation.transport-along-identifications open import foundation.unit-type +open import foundation.universal-quantification open import foundation.universe-levels +open import foundation.untruncated-double-negation-elimination +open import foundation-core.contractible-types open import foundation-core.function-types open import foundation-core.propositions ``` @@ -52,32 +64,203 @@ module _ is-prop-type-Prop is-double-negation-stable-Prop ``` +### The predicate on a type of being a double negation stable proposition + +```agda +is-double-negation-stable-prop : {l : Level} → UU l → UU l +is-double-negation-stable-prop X = (is-prop X) × (¬¬ X → X) + +is-prop-is-double-negation-stable-prop : + {l : Level} (X : UU l) → is-prop (is-double-negation-stable-prop X) +is-prop-is-double-negation-stable-prop X = + is-prop-Σ + ( is-prop-is-prop X) + ( λ is-prop-X → is-prop-is-double-negation-stable (X , is-prop-X)) + +is-double-negation-stable-prop-Prop : {l : Level} → UU l → Prop l +is-double-negation-stable-prop-Prop X = + ( is-double-negation-stable-prop X , is-prop-is-double-negation-stable-prop X) + +module _ + {l : Level} {A : UU l} (H : is-double-negation-stable-prop A) + where + + is-prop-type-is-double-negation-stable-prop : is-prop A + is-prop-type-is-double-negation-stable-prop = pr1 H + + has-double-negation-elim-is-double-negation-stable-prop : + has-double-negation-elim A + has-double-negation-elim-is-double-negation-stable-prop = pr2 H +``` + +### The subuniverse of double negation stable propositions + +```agda +Double-Negation-Stable-Prop : (l : Level) → UU (lsuc l) +Double-Negation-Stable-Prop l = Σ (UU l) (is-double-negation-stable-prop) + +module _ + {l : Level} (P : Double-Negation-Stable-Prop l) + where + + type-Double-Negation-Stable-Prop : UU l + type-Double-Negation-Stable-Prop = pr1 P + + is-double-negation-stable-prop-type-Double-Negation-Stable-Prop : + is-double-negation-stable-prop type-Double-Negation-Stable-Prop + is-double-negation-stable-prop-type-Double-Negation-Stable-Prop = pr2 P + + is-prop-type-Double-Negation-Stable-Prop : + is-prop type-Double-Negation-Stable-Prop + is-prop-type-Double-Negation-Stable-Prop = + is-prop-type-is-double-negation-stable-prop + ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop) + + has-double-negation-elim-type-Double-Negation-Stable-Prop : + has-double-negation-elim type-Double-Negation-Stable-Prop + has-double-negation-elim-type-Double-Negation-Stable-Prop = + has-double-negation-elim-is-double-negation-stable-prop + ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop) +``` + ## Properties ### The empty proposition is double negation stable ```agda -is-double-negation-stable-empty : is-double-negation-stable empty-Prop -is-double-negation-stable-empty e = e id +empty-Double-Negation-Stable-Prop : Double-Negation-Stable-Prop lzero +empty-Double-Negation-Stable-Prop = + empty , is-prop-empty , double-negation-elim-empty ``` ### The unit proposition is double negation stable ```agda -is-double-negation-stable-unit : is-double-negation-stable unit-Prop -is-double-negation-stable-unit _ = star +unit-Double-Negation-Stable-Prop : Double-Negation-Stable-Prop lzero +unit-Double-Negation-Stable-Prop = + unit , is-prop-unit , double-negation-elim-unit +``` + +### Decidable propositions are double negation stable + +```agda +decidable-prop-Double-Negation-Stable-Prop : + {l : Level} → Decidable-Prop l → Double-Negation-Stable-Prop l +decidable-prop-Double-Negation-Stable-Prop (A , H , d) = + ( A , H , double-negation-elim-is-decidable d) +``` + +### Universal quantification over double negation stable propositions is double negation stable + +```agda +is-double-negation-stable-prop-Π : + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → + ((a : A) → is-double-negation-stable-prop (B a)) → + 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 + ( has-double-negation-elim-is-double-negation-stable-prop ∘ b)) + +Π-Double-Negation-Stable-Prop : + {l1 l2 : Level} + (A : UU l1) (B : A → Double-Negation-Stable-Prop l2) → + Double-Negation-Stable-Prop (l1 ⊔ l2) +Π-Double-Negation-Stable-Prop A B = + ( (a : A) → type-Double-Negation-Stable-Prop (B a)) , + ( is-double-negation-stable-prop-Π + ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop ∘ B)) +``` + +### Implication into double negation stable propositions is double negation stable + +```agda +is-double-negation-stable-prop-exp : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + is-double-negation-stable-prop B → + is-double-negation-stable-prop (A → B) +is-double-negation-stable-prop-exp b = + is-double-negation-stable-prop-Π (λ _ → b) + +exp-Double-Negation-Stable-Prop : + {l1 l2 : Level} + (A : UU l1) (B : Double-Negation-Stable-Prop l2) → + Double-Negation-Stable-Prop (l1 ⊔ l2) +exp-Double-Negation-Stable-Prop A B = Π-Double-Negation-Stable-Prop A (λ _ → B) +``` + +### Dependent sums of double negation stable types over a decidable proposition are double negation stable + +```agda +is-double-negation-stable-prop-Σ : + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → + is-double-negation-stable-prop A → + ((a : A) → is-double-negation-stable-prop (B a)) → + is-double-negation-stable-prop (Σ A B) +is-double-negation-stable-prop-Σ a b = + ( is-prop-Σ + ( is-prop-type-is-double-negation-stable-prop a) + ( is-prop-type-is-double-negation-stable-prop ∘ b)) , + ( double-negation-elim-Σ-is-prop-base + ( is-prop-type-is-double-negation-stable-prop a) + ( has-double-negation-elim-is-double-negation-stable-prop a) + ( has-double-negation-elim-is-double-negation-stable-prop ∘ b)) + +Σ-Double-Negation-Stable-Prop : + {l1 l2 : Level} + (A : Double-Negation-Stable-Prop l1) + (B : type-Double-Negation-Stable-Prop A → Double-Negation-Stable-Prop l2) → + Double-Negation-Stable-Prop (l1 ⊔ l2) +Σ-Double-Negation-Stable-Prop A B = + ( Σ ( type-Double-Negation-Stable-Prop A) + ( type-Double-Negation-Stable-Prop ∘ B)) , + ( is-double-negation-stable-prop-Σ + ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop A) + ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop ∘ B)) +``` + +### The conjunction of two double negation stable propositions is double negation stable + +```agda +is-double-negation-stable-prop-product : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + is-double-negation-stable-prop A → + is-double-negation-stable-prop B → + is-double-negation-stable-prop (A × B) +is-double-negation-stable-prop-product a b = + ( is-prop-product + ( is-prop-type-is-double-negation-stable-prop a) + ( is-prop-type-is-double-negation-stable-prop b)) , + ( double-negation-elim-product + ( has-double-negation-elim-is-double-negation-stable-prop a) + ( has-double-negation-elim-is-double-negation-stable-prop b)) + +product-Double-Negation-Stable-Prop : + {l1 l2 : Level} → + Double-Negation-Stable-Prop l1 → + Double-Negation-Stable-Prop l2 → + Double-Negation-Stable-Prop (l1 ⊔ l2) +product-Double-Negation-Stable-Prop A B = + ( ( type-Double-Negation-Stable-Prop A) × + ( type-Double-Negation-Stable-Prop B)) , + ( is-double-negation-stable-prop-product + ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop A) + ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop B)) ``` -### The negation of a type is double negation stable +### Existential quantification over a double negation stable predicate is double negation stable ```agda -is-double-negation-stable-neg : - {l : Level} (A : UU l) → is-double-negation-stable (neg-type-Prop A) -is-double-negation-stable-neg = double-negation-elim-neg +double-negation-elim-∃ : + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → + ((a : A) → has-double-negation-elim (B a)) → + has-double-negation-elim (exists-structure A B) +double-negation-elim-∃ b nn∃ = + intro-exists {! !} (b {! !} λ nb → nn∃ (λ ab → {! !})) ``` ## See also - [The double negation modality](foundation.double-negation-modality.md) - [Irrefutable propositions](foundation.irrefutable-propositions.md) are double - negation stable. + negation connected types. diff --git a/src/foundation/double-negation.lagda.md b/src/foundation/double-negation.lagda.md index 4529283ca7..588e130404 100644 --- a/src/foundation/double-negation.lagda.md +++ b/src/foundation/double-negation.lagda.md @@ -8,6 +8,7 @@ module foundation.double-negation where ```agda open import foundation.dependent-pair-types +open import foundation.evaluation-functions open import foundation.negation open import foundation.propositional-truncations open import foundation.universe-levels @@ -94,45 +95,13 @@ double-negation-linearity-implication {P = P} {Q = Q} f = ( λ (p : P) → map-neg (inr {A = P → Q} {B = Q → P}) f (λ _ → p)) ``` -### Cases of double negation elimination - -```agda -double-negation-elim-neg : {l : Level} (P : UU l) → ¬¬¬ P → ¬ P -double-negation-elim-neg P f p = f (λ g → g p) - -double-negation-elim-product : - {l1 l2 : Level} {P : UU l1} {Q : UU l2} → - ¬¬ ((¬¬ P) × (¬¬ Q)) → (¬¬ P) × (¬¬ Q) -pr1 (double-negation-elim-product {P = P} {Q = Q} f) = - double-negation-elim-neg (¬ P) (map-double-negation pr1 f) -pr2 (double-negation-elim-product {P = P} {Q = Q} f) = - double-negation-elim-neg (¬ Q) (map-double-negation pr2 f) - -double-negation-elim-exp : - {l1 l2 : Level} {P : UU l1} {Q : UU l2} → - ¬¬ (P → ¬¬ Q) → (P → ¬¬ Q) -double-negation-elim-exp {P = P} {Q = Q} f p = - double-negation-elim-neg - ( ¬ Q) - ( map-double-negation (λ (g : P → ¬¬ Q) → g p) f) - -double-negation-elim-for-all : - {l1 l2 : Level} {P : UU l1} {Q : P → UU l2} → - ¬¬ ((p : P) → ¬¬ (Q p)) → (p : P) → ¬¬ (Q p) -double-negation-elim-for-all {P = P} {Q = Q} f p = - double-negation-elim-neg - ( ¬ (Q p)) - ( map-double-negation (λ (g : (u : P) → ¬¬ (Q u)) → g p) f) -``` - ### Maps into double negations extend along `intro-double-negation` ```agda double-negation-extend : {l1 l2 : Level} {P : UU l1} {Q : UU l2} → (P → ¬¬ Q) → (¬¬ P → ¬¬ Q) -double-negation-extend {P = P} {Q = Q} f = - double-negation-elim-neg (¬ Q) ∘ (map-double-negation f) +double-negation-extend {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 diff --git a/src/foundation/untruncated-double-negation-elimination.lagda.md b/src/foundation/untruncated-double-negation-elimination.lagda.md new file mode 100644 index 0000000000..8fe26e8a35 --- /dev/null +++ b/src/foundation/untruncated-double-negation-elimination.lagda.md @@ -0,0 +1,184 @@ +# Double negation elimination + +```agda +module foundation.untruncated-double-negation-elimination where +``` + +
Imports + +```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.empty-types +open import foundation.evaluation-functions +open import foundation.existential-quantification +open import foundation.negation +open import foundation.transport-along-identifications +open import foundation.unit-type +open import foundation.universal-quantification +open import foundation.universe-levels + +open import foundation-core.contractible-types +open import foundation-core.function-types +open import foundation-core.propositions +``` + +
+ +## Idea + +We say a type `A` satisfies +{{#concept "untruncated double negation elimination" Agda=has-double-negation-elim}} +if there is a map + +```text + ¬¬A → A +``` + +## Definitions + +### Untruncated double negation elimination + +```agda +module _ + {l : Level} (A : UU l) + where + + has-double-negation-elim : UU l + has-double-negation-elim = ¬¬ A → A +``` + +## Properties + +### The empty proposition has double negation elimination + +```agda +double-negation-elim-empty : has-double-negation-elim empty +double-negation-elim-empty e = e id +``` + +### Empty types are double negation stable propositions + +```agda +double-negation-elim-is-empty : + {l : Level} {A : UU l} → is-empty A → has-double-negation-elim A +double-negation-elim-is-empty H q = ex-falso (q H) +``` + +### The unit proposition has double negation elimination + +```agda +double-negation-elim-unit : has-double-negation-elim unit +double-negation-elim-unit _ = star +``` + +### Contractible types are double negation stable + +```agda +double-negation-elim-is-contr : + {l : Level} {A : UU l} → is-contr A → has-double-negation-elim A +double-negation-elim-is-contr H _ = center H +``` + +### The negation of a type has double negation elimination + +```agda +double-negation-elim-neg : + {l : Level} (A : UU l) → has-double-negation-elim (¬ A) +double-negation-elim-neg A f p = f (ev p) +``` + +### Function types into double negations have double negation elimination + +```agda +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 f p = + double-negation-elim-neg + ( ¬ Q) + ( map-double-negation (λ (g : P → ¬¬ Q) → g p) f) + + double-negation-elim-exp : + has-double-negation-elim Q → + has-double-negation-elim (P → Q) + double-negation-elim-exp H f p = H (λ nq → f (λ g → nq (g p))) +``` + +### Universal quantification over double negations have double negation elimination + +```agda +module _ + {l1 l2 : Level} {P : UU l1} {Q : P → UU l2} + where + + double-negation-elim-for-all-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-for-all : + ((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))) +``` + +### Decidable propositions are double negation stable + +```text +double-negation-elim-is-decidable : + {l : Level} {A : UU l} → is-decidable A → has-double-negation-elim A +double-negation-elim-is-decidable = double-negation-elim-is-decidable +``` + +### Dependent sums of types with double negation elimination over a double negation stable proposition have double negation elimination + +```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) +``` + +### The product of two types with double negation elimination has 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)) +``` + +## See also + +- [The double negation modality](foundation.double-negation-modality.md) +- [Irrefutable propositions](foundation.irrefutable-propositions.md) are double + negation connected types. From c96818b46ff487dd8ae4855f2ce4a3a9f44a17f6 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 19 Oct 2024 19:52:27 +0200 Subject: [PATCH 04/83] =?UTF-8?q?Knaster=E2=80=93Tarski=20fixed=20point=20?= =?UTF-8?q?theorem=20for=20suplattices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...naster-tarski-fixed-point-theorem.lagda.md | 131 ++++++++++++++++++ src/order-theory/suplattices.lagda.md | 15 +- 2 files changed, 144 insertions(+), 2 deletions(-) create mode 100644 src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md diff --git a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md new file mode 100644 index 0000000000..58749a8f11 --- /dev/null +++ b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md @@ -0,0 +1,131 @@ +# The Knaster–Tarski fixed point theorem + +```agda +module order-theory.knaster-tarski-fixed-point-theorem where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.large-binary-relations +open import foundation.sets +open import foundation.logical-equivalences +open import foundation.fixed-points-endofunctions +open import foundation.universe-levels + +open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.large-meet-semilattices +open import order-theory.large-posets +open import order-theory.large-preorders +open import order-theory.large-suplattices +open import order-theory.order-preserving-maps-posets +open import order-theory.least-upper-bounds-large-posets +open import order-theory.meet-semilattices +open import order-theory.posets +open import order-theory.preorders +open import order-theory.suplattices +open import order-theory.top-elements-large-posets +open import order-theory.upper-bounds-large-posets +``` + +
+ +## Idea + +The +{{#concept "Knaster–Tarski fixed point theorem" WD="Knaster–Tarski theorem" WDID=Q609612}} +states that every order preserving endomap `f : 𝒜 → 𝒜` on a complete lattice has +a least and a greatest [fixed point](foundation.fixed-points-endofunctions.md). + +## Theorem + +### The Knaster–Tarski fixed point theorem for suplattices + +```agda +module _ + {l1 l2 l3 : Level} + (𝒜 : Suplattice l1 l2 (l1 ⊔ l2)) + (f : type-Suplattice 𝒜 → type-Suplattice 𝒜) + (F : preserves-order-Poset (poset-Suplattice 𝒜) (poset-Suplattice 𝒜) f) + where + + indexing-type-family-of-elements-knaster-tarski-Suplattice : UU (l1 ⊔ l2) + indexing-type-family-of-elements-knaster-tarski-Suplattice = + Σ ( type-Suplattice 𝒜) (λ x → leq-Suplattice 𝒜 x (f x)) + + family-of-elements-knaster-tarski-Suplattice : + indexing-type-family-of-elements-knaster-tarski-Suplattice → + type-Suplattice 𝒜 + family-of-elements-knaster-tarski-Suplattice = pr1 + + point-knaster-tarski-Suplattice : type-Suplattice 𝒜 + point-knaster-tarski-Suplattice = + sup-Suplattice 𝒜 family-of-elements-knaster-tarski-Suplattice + + leq-point-knaster-tarski-Suplattice : + leq-Suplattice 𝒜 + ( point-knaster-tarski-Suplattice) + ( f point-knaster-tarski-Suplattice) + leq-point-knaster-tarski-Suplattice = + forward-implication + ( is-least-upper-bound-sup-Suplattice 𝒜 + ( family-of-elements-knaster-tarski-Suplattice) + ( f point-knaster-tarski-Suplattice)) + ( λ w → + transitive-leq-Suplattice 𝒜 _ _ _ + ( F ( pr1 w) + ( point-knaster-tarski-Suplattice) + ( leq-sup-Suplattice 𝒜 _ w)) + ( pr2 w)) + + geq-point-knaster-tarski-Suplattice : + leq-Suplattice 𝒜 + ( f point-knaster-tarski-Suplattice) + ( point-knaster-tarski-Suplattice) + geq-point-knaster-tarski-Suplattice = + leq-sup-Suplattice 𝒜 family-of-elements-knaster-tarski-Suplattice + ( f point-knaster-tarski-Suplattice , + F point-knaster-tarski-Suplattice + ( f point-knaster-tarski-Suplattice) + ( leq-point-knaster-tarski-Suplattice)) + + is-fixed-point-knaster-tarski-Suplattice : + f ( point-knaster-tarski-Suplattice) = + point-knaster-tarski-Suplattice + is-fixed-point-knaster-tarski-Suplattice = + antisymmetric-leq-Suplattice 𝒜 + ( f (point-knaster-tarski-Suplattice)) + ( point-knaster-tarski-Suplattice) + ( geq-point-knaster-tarski-Suplattice) + ( leq-point-knaster-tarski-Suplattice) + + fixed-point-knaster-tarski-Suplattice : fixed-point f + fixed-point-knaster-tarski-Suplattice = + point-knaster-tarski-Suplattice , + is-fixed-point-knaster-tarski-Suplattice + + greatest-fixed-point-knaster-tarski-Suplattice : + (x : fixed-point f) → + leq-Suplattice 𝒜 (pr1 x) point-knaster-tarski-Suplattice + greatest-fixed-point-knaster-tarski-Suplattice (x , p) = + leq-sup-Suplattice 𝒜 _ + ( x , + concatenate-leq-eq-Poset + ( poset-Suplattice 𝒜) + ( refl-leq-Suplattice 𝒜 x) + ( inv p)) +``` + +## References + +- by Reed + Mullanix + +## External links + +- [Knaster–Tarski theorem](https://en.wikipedia.org/wiki/Knaster%E2%80%93Tarski_theorem) + at Wikipedia +- [Tarski's Fixed Point Theorem](https://mathworld.wolfram.com/TarskisFixedPointTheorem.html) + at Wolfram MathWorld diff --git a/src/order-theory/suplattices.lagda.md b/src/order-theory/suplattices.lagda.md index 23b0a56327..9216950c11 100644 --- a/src/order-theory/suplattices.lagda.md +++ b/src/order-theory/suplattices.lagda.md @@ -9,6 +9,7 @@ module order-theory.suplattices where ```agda open import foundation.binary-relations open import foundation.dependent-pair-types +open import foundation.logical-equivalences open import foundation.propositions open import foundation.sets open import foundation.universe-levels @@ -37,7 +38,7 @@ module _ is-suplattice-Poset-Prop = Π-Prop (UU l3) - (λ I → + ( λ I → Π-Prop ( I → type-Poset P) ( λ f → has-least-upper-bound-family-of-elements-Poset-Prop P f)) @@ -119,10 +120,20 @@ module _ is-least-upper-bound-sup-Suplattice : {I : UU l3} (x : I → type-Suplattice) → - is-least-upper-bound-family-of-elements-Poset poset-Suplattice x + is-least-upper-bound-family-of-elements-Poset + ( poset-Suplattice) + ( x) ( sup-Suplattice x) is-least-upper-bound-sup-Suplattice = is-least-upper-bound-sup-is-suplattice-Poset ( poset-Suplattice) ( is-suplattice-Suplattice) + + leq-sup-Suplattice : + {I : UU l3} (x : I → type-Suplattice) (i : I) → + leq-Suplattice (x i) (sup-Suplattice x) + leq-sup-Suplattice x = + backward-implication + ( is-least-upper-bound-sup-Suplattice x (sup-Suplattice x)) + ( refl-leq-Suplattice (sup-Suplattice x)) ``` From 478a321ba7b95ee00d3ed47c1577d6f713731f46 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 19 Oct 2024 19:52:47 +0200 Subject: [PATCH 05/83] pre-commit --- src/order-theory.lagda.md | 1 + .../knaster-tarski-fixed-point-theorem.lagda.md | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index fdb7cae0eb..c092e09ca7 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -52,6 +52,7 @@ open import order-theory.ideals-preorders public open import order-theory.inhabited-finite-total-orders public open import order-theory.interval-subposets public open import order-theory.join-semilattices public +open import order-theory.knaster-tarski-fixed-point-theorem public open import order-theory.large-frames public open import order-theory.large-locales public open import order-theory.large-meet-semilattices public diff --git a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md index 58749a8f11..68018c4d6c 100644 --- a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md +++ b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md @@ -8,11 +8,11 @@ module order-theory.knaster-tarski-fixed-point-theorem where ```agda open import foundation.dependent-pair-types +open import foundation.fixed-points-endofunctions open import foundation.identity-types open import foundation.large-binary-relations -open import foundation.sets open import foundation.logical-equivalences -open import foundation.fixed-points-endofunctions +open import foundation.sets open import foundation.universe-levels open import order-theory.greatest-lower-bounds-large-posets @@ -20,9 +20,9 @@ open import order-theory.large-meet-semilattices open import order-theory.large-posets open import order-theory.large-preorders open import order-theory.large-suplattices -open import order-theory.order-preserving-maps-posets open import order-theory.least-upper-bounds-large-posets open import order-theory.meet-semilattices +open import order-theory.order-preserving-maps-posets open import order-theory.posets open import order-theory.preorders open import order-theory.suplattices From 76af9293ef18a58e548ecbfcdf9e9536a940e0e8 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 19 Oct 2024 20:00:22 +0200 Subject: [PATCH 06/83] inflattices --- src/order-theory.lagda.md | 1 + src/order-theory/inflattices.lagda.md | 146 ++++++++++++++++++++++++++ src/order-theory/suplattices.lagda.md | 11 +- 3 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 src/order-theory/inflattices.lagda.md diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index c092e09ca7..7eed5b4b5b 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -49,6 +49,7 @@ open import order-theory.homomorphisms-meet-semilattices public open import order-theory.homomorphisms-meet-sup-lattices public open import order-theory.homomorphisms-sup-lattices public open import order-theory.ideals-preorders public +open import order-theory.inflattices public open import order-theory.inhabited-finite-total-orders public open import order-theory.interval-subposets public open import order-theory.join-semilattices public diff --git a/src/order-theory/inflattices.lagda.md b/src/order-theory/inflattices.lagda.md new file mode 100644 index 0000000000..82ce33afe8 --- /dev/null +++ b/src/order-theory/inflattices.lagda.md @@ -0,0 +1,146 @@ +# Inflattices + +```agda +module order-theory.inflattices where +``` + +
Imports + +```agda +open import foundation.binary-relations +open import foundation.dependent-pair-types +open import foundation.logical-equivalences +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.greatest-lower-bounds-posets +open import order-theory.posets +``` + +
+ +## Idea + +An `l`-{{#concept "inflattice" Agda=Inflattice}} is a +[poset](order-theory.posets.md) which has all +[greatest lower bounds](order-theory.greatest-lower-bounds-posets.md) of +families of elements indexed by a type of +[universe level](foundation.universe-levels.md) `l`. + +## Definitions + +### The predicate on posets of being an `l`-inflattice + +```agda +module _ + {l1 l2 : Level} (l3 : Level) (P : Poset l1 l2) + where + + is-inflattice-Poset-Prop : Prop (l1 ⊔ l2 ⊔ lsuc l3) + is-inflattice-Poset-Prop = + Π-Prop + (UU l3) + ( λ I → + Π-Prop + ( I → type-Poset P) + ( λ f → has-greatest-lower-bound-family-of-elements-Poset-Prop P f)) + + is-inflattice-Poset : UU (l1 ⊔ l2 ⊔ lsuc l3) + is-inflattice-Poset = type-Prop is-inflattice-Poset-Prop + + is-prop-inflattice-Poset : is-prop is-inflattice-Poset + is-prop-inflattice-Poset = is-prop-type-Prop is-inflattice-Poset-Prop + +module _ + {l1 l2 l3 : Level} (P : Poset l1 l2) (H : is-inflattice-Poset l3 P) + where + + inf-is-inflattice-Poset : + {I : UU l3} → (I → type-Poset P) → type-Poset P + inf-is-inflattice-Poset {I} x = pr1 (H I x) + + is-greatest-lower-bound-inf-is-inflattice-Poset : + {I : UU l3} (x : I → type-Poset P) → + is-greatest-lower-bound-family-of-elements-Poset P x + ( inf-is-inflattice-Poset x) + is-greatest-lower-bound-inf-is-inflattice-Poset {I} x = pr2 (H I x) +``` + +### `l`-Inflattices + +```agda +Inflattice : (l1 l2 l3 : Level) → UU (lsuc l1 ⊔ lsuc l2 ⊔ lsuc l3) +Inflattice l1 l2 l3 = Σ (Poset l1 l2) (λ P → is-inflattice-Poset l3 P) + +module _ + {l1 l2 l3 : Level} (A : Inflattice l1 l2 l3) + where + + poset-Inflattice : Poset l1 l2 + poset-Inflattice = pr1 A + + type-Inflattice : UU l1 + type-Inflattice = type-Poset poset-Inflattice + + leq-Inflattice-Prop : (x y : type-Inflattice) → Prop l2 + leq-Inflattice-Prop = leq-Poset-Prop poset-Inflattice + + leq-Inflattice : (x y : type-Inflattice) → UU l2 + leq-Inflattice = leq-Poset poset-Inflattice + + is-prop-leq-Inflattice : + (x y : type-Inflattice) → is-prop (leq-Inflattice x y) + is-prop-leq-Inflattice = is-prop-leq-Poset poset-Inflattice + + refl-leq-Inflattice : + (x : type-Inflattice) → leq-Inflattice x x + refl-leq-Inflattice = refl-leq-Poset poset-Inflattice + + antisymmetric-leq-Inflattice : is-antisymmetric leq-Inflattice + antisymmetric-leq-Inflattice = + antisymmetric-leq-Poset poset-Inflattice + + transitive-leq-Inflattice : is-transitive leq-Inflattice + transitive-leq-Inflattice = transitive-leq-Poset poset-Inflattice + + is-set-type-Inflattice : is-set type-Inflattice + is-set-type-Inflattice = is-set-type-Poset poset-Inflattice + + set-Inflattice : Set l1 + set-Inflattice = set-Poset poset-Inflattice + + is-inflattice-Inflattice : + is-inflattice-Poset l3 poset-Inflattice + is-inflattice-Inflattice = pr2 A + + inf-Inflattice : + {I : UU l3} → (I → type-Inflattice) → type-Inflattice + inf-Inflattice = + inf-is-inflattice-Poset + ( poset-Inflattice) + ( is-inflattice-Inflattice) + + is-greatest-lower-bound-inf-Inflattice : + {I : UU l3} (x : I → type-Inflattice) → + is-greatest-lower-bound-family-of-elements-Poset + ( poset-Inflattice) + ( x) + ( inf-Inflattice x) + is-greatest-lower-bound-inf-Inflattice = + is-greatest-lower-bound-inf-is-inflattice-Poset + ( poset-Inflattice) + ( is-inflattice-Inflattice) + + leq-inf-Inflattice : + {I : UU l3} (x : I → type-Inflattice) (i : I) → + leq-Inflattice (inf-Inflattice x) (x i) + leq-inf-Inflattice x = + backward-implication + ( is-greatest-lower-bound-inf-Inflattice x (inf-Inflattice x)) + ( refl-leq-Inflattice (inf-Inflattice x)) +``` + +## External links + +- [inflattice](https://ncatlab.org/nlab/show/inflattice) at $n$Lab diff --git a/src/order-theory/suplattices.lagda.md b/src/order-theory/suplattices.lagda.md index 9216950c11..6854f38d21 100644 --- a/src/order-theory/suplattices.lagda.md +++ b/src/order-theory/suplattices.lagda.md @@ -22,8 +22,11 @@ open import order-theory.posets ## Idea -An **`l`-suplattice** is a poset which has all least upper bounds of families of -elements indexed by a type of universe level `l`. +An `l`-{{#concept "suplattice" Agda=Suplattice}} is a +[poset](order-theory.posets.md) which has all +[least upper bounds](order-theory.least-upper-bounds-posets.md) of families of +elements indexed by a type of [universe level](foundation.universe-levels.md) +`l`. ## Definitions @@ -137,3 +140,7 @@ module _ ( is-least-upper-bound-sup-Suplattice x (sup-Suplattice x)) ( refl-leq-Suplattice (sup-Suplattice x)) ``` + +## External links + +- [suplattice](https://ncatlab.org/nlab/show/suplattice) at $n$Lab From a2b91a5be8f223021c8b4833128fcaa6d3add1b5 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 19 Oct 2024 20:10:11 +0200 Subject: [PATCH 07/83] =?UTF-8?q?Knaster=E2=80=93Tarski=20fixed=20point=20?= =?UTF-8?q?theorem=20for=20inflattices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...naster-tarski-fixed-point-theorem.lagda.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md index 68018c4d6c..4b447a4ab1 100644 --- a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md +++ b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md @@ -16,6 +16,7 @@ open import foundation.sets open import foundation.universe-levels open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.inflattices open import order-theory.large-meet-semilattices open import order-theory.large-posets open import order-theory.large-preorders @@ -118,6 +119,81 @@ module _ ( inv p)) ``` +### The Knaster–Tarski fixed point theorem for inflattices + +```agda +module _ + {l1 l2 l3 : Level} + (𝒜 : Inflattice l1 l2 (l1 ⊔ l2)) + (f : type-Inflattice 𝒜 → type-Inflattice 𝒜) + (F : preserves-order-Poset (poset-Inflattice 𝒜) (poset-Inflattice 𝒜) f) + where + + indexing-type-family-of-elements-knaster-tarski-Inflattice : UU (l1 ⊔ l2) + indexing-type-family-of-elements-knaster-tarski-Inflattice = + Σ ( type-Inflattice 𝒜) (λ x → leq-Inflattice 𝒜 (f x) x) + + family-of-elements-knaster-tarski-Inflattice : + indexing-type-family-of-elements-knaster-tarski-Inflattice → + type-Inflattice 𝒜 + family-of-elements-knaster-tarski-Inflattice = pr1 + + point-knaster-tarski-Inflattice : type-Inflattice 𝒜 + point-knaster-tarski-Inflattice = + inf-Inflattice 𝒜 family-of-elements-knaster-tarski-Inflattice + + geq-point-knaster-tarski-Inflattice : + leq-Inflattice 𝒜 + ( f point-knaster-tarski-Inflattice) + ( point-knaster-tarski-Inflattice) + geq-point-knaster-tarski-Inflattice = + forward-implication + ( is-greatest-lower-bound-inf-Inflattice 𝒜 + ( family-of-elements-knaster-tarski-Inflattice) + ( f point-knaster-tarski-Inflattice)) + ( λ w → + transitive-leq-Inflattice 𝒜 _ _ _ + ( pr2 w) + ( F _ _ (leq-inf-Inflattice 𝒜 _ w))) + + leq-point-knaster-tarski-Inflattice : + leq-Inflattice 𝒜 + ( point-knaster-tarski-Inflattice) + ( f point-knaster-tarski-Inflattice) + leq-point-knaster-tarski-Inflattice = + leq-inf-Inflattice 𝒜 family-of-elements-knaster-tarski-Inflattice + ( f point-knaster-tarski-Inflattice , + F (f point-knaster-tarski-Inflattice) + ( point-knaster-tarski-Inflattice) + ( geq-point-knaster-tarski-Inflattice)) + + is-fixed-point-knaster-tarski-Inflattice : + f ( point-knaster-tarski-Inflattice) = + point-knaster-tarski-Inflattice + is-fixed-point-knaster-tarski-Inflattice = + antisymmetric-leq-Inflattice 𝒜 + ( f (point-knaster-tarski-Inflattice)) + ( point-knaster-tarski-Inflattice) + ( geq-point-knaster-tarski-Inflattice) + ( leq-point-knaster-tarski-Inflattice) + + fixed-point-knaster-tarski-Inflattice : fixed-point f + fixed-point-knaster-tarski-Inflattice = + point-knaster-tarski-Inflattice , + is-fixed-point-knaster-tarski-Inflattice + + least-fixed-point-knaster-tarski-Inflattice : + (x : fixed-point f) → + leq-Inflattice 𝒜 point-knaster-tarski-Inflattice (pr1 x) + least-fixed-point-knaster-tarski-Inflattice (x , p) = + leq-inf-Inflattice 𝒜 _ + ( x , + concatenate-eq-leq-Poset + ( poset-Inflattice 𝒜) + ( p) + ( refl-leq-Inflattice 𝒜 x)) +``` + ## References - by Reed From 2931aa20ae67b70efb2e11315704c0f6a3d2cfed Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 19 Oct 2024 21:00:02 +0200 Subject: [PATCH 08/83] edits --- src/foundation.lagda.md | 1 + .../locale-of-propositions.lagda.md | 134 ++++++++++++++++++ ...naster-tarski-fixed-point-theorem.lagda.md | 4 +- 3 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 src/foundation/locale-of-propositions.lagda.md diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index af99498656..a7694fc99f 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -250,6 +250,7 @@ open import foundation.lawveres-fixed-point-theorem public open import foundation.lesser-limited-principle-of-omniscience public open import foundation.lifts-types public 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.maps-in-global-subuniverses public diff --git a/src/foundation/locale-of-propositions.lagda.md b/src/foundation/locale-of-propositions.lagda.md new file mode 100644 index 0000000000..5b6d179dae --- /dev/null +++ b/src/foundation/locale-of-propositions.lagda.md @@ -0,0 +1,134 @@ +# The locale of propositions + +```agda +module foundation.locale-of-propositions where +``` + +
Imports + +```agda +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.large-locale-of-propositions +open import foundation.logical-equivalences +open import foundation.propositional-extensionality +open import foundation.unit-type +open import foundation.universal-property-cartesian-product-types +open import foundation.universe-levels + +open import foundation-core.function-types +open import foundation-core.propositions + +open import order-theory.frames +open import order-theory.large-posets +open import order-theory.large-preorders +open import order-theory.least-upper-bounds-posets +open import order-theory.locales +open import order-theory.meet-semilattices +open import order-theory.posets +open import order-theory.preorders +open import order-theory.suplattices +open import order-theory.top-elements-posets +``` + +
+ +## Idea + +The [locale](order-theory.locales.md) of +[propositions](foundation-core.propositions.md) consists of all the propositions +of any [universe level](foundation.universe-levels.md) and is ordered by the +implications between them. [Conjunction](foundation.conjunction.md) gives this +[poset](order-theory.posets.md) the structure of a +[meet-semilattice](order-theory.meet-semilattices.md), and +[existential quantification](foundation.existential-quantification.md) gives it +the structure of a [suplattice](order-theory.suplattices.md). + +**Note.** The collection of all propositions is because we do not assume +[propositional resizing](foundation.propositional-resizing.md). + +## Definitions + +### The preorder of propositions + +```agda +Prop-Preorder : (l : Level) → Preorder (lsuc l) l +Prop-Preorder = preorder-Large-Preorder Prop-Large-Preorder +``` + +### The poset of propositions + +```agda +Prop-Poset : (l : Level) → Poset (lsuc l) l +Prop-Poset = poset-Large-Poset Prop-Large-Poset +``` + +### Meets in the poset of propositions + +```text +has-meets-Prop-Locale : + has-meets-Poset Prop-Poset +meet-has-meets-Poset has-meets-Prop-Locale = conjunction-Prop +is-greatest-binary-lower-bound-meet-has-meets-Poset + has-meets-Prop-Locale P Q R = + is-greatest-binary-lower-bound-conjunction-Prop P Q R +``` + +### The largest element in the poset of propositions + +```text +has-top-element-Prop-Locale : + has-top-element-Poset Prop-Poset +top-has-top-element-Poset + has-top-element-Prop-Locale = unit-Prop +is-top-element-top-has-top-element-Poset + has-top-element-Prop-Locale P p = + star +``` + +### The poset of propositions is a meet-semilattice + +```text +is-meet-semilattice-Prop-Locale : + is-meet-semilattice-Poset Prop-Poset +has-meets-is-meet-semilattice-Poset + is-meet-semilattice-Prop-Locale = + has-meets-Prop-Locale +has-top-element-is-meet-semilattice-Poset + is-meet-semilattice-Prop-Locale = + has-top-element-Prop-Locale +``` + +### Suprema in the poset of propositions + +```agda +is-suplattice-Prop-Locale : + (l : Level) → is-suplattice-Poset l (Prop-Poset l) +is-suplattice-Prop-Locale l I P = (∃ I P , inv-iff ∘ up-exists) +``` + +### The frame of propositions + +```text +Prop-Frame : Frame lsuc (_⊔_) lzero +poset-Frame Prop-Frame = + Prop-Poset +is-meet-semilattice-Frame Prop-Frame = + is-meet-semilattice-Prop-Locale +is-suplattice-Frame Prop-Frame = + is-suplattice-Prop-Locale +distributive-meet-sup-Frame Prop-Frame = + eq-distributive-conjunction-exists +``` + +### The locale of propositions + +```text +Prop-Locale : Locale lsuc (_⊔_) lzero +Prop-Locale = Prop-Frame +``` + +## See also + +- [Propositional resizing](foundation.propositional-resizing.md) diff --git a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md index 4b447a4ab1..0dee7211ef 100644 --- a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md +++ b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md @@ -46,7 +46,7 @@ a least and a greatest [fixed point](foundation.fixed-points-endofunctions.md). ```agda module _ - {l1 l2 l3 : Level} + {l1 l2 : Level} (𝒜 : Suplattice l1 l2 (l1 ⊔ l2)) (f : type-Suplattice 𝒜 → type-Suplattice 𝒜) (F : preserves-order-Poset (poset-Suplattice 𝒜) (poset-Suplattice 𝒜) f) @@ -123,7 +123,7 @@ module _ ```agda module _ - {l1 l2 l3 : Level} + {l1 l2 : Level} (𝒜 : Inflattice l1 l2 (l1 ⊔ l2)) (f : type-Inflattice 𝒜 → type-Inflattice 𝒜) (F : preserves-order-Poset (poset-Inflattice 𝒜) (poset-Inflattice 𝒜) f) From ebe30a4fb2e881648288cef088927106d23782d4 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 00:39:13 +0200 Subject: [PATCH 09/83] =?UTF-8?q?imrpove=20proof=20`is-decidable-prop-?= =?UTF-8?q?=CE=A3`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../decidable-propositions.lagda.md | 60 ++++++++++++++++--- src/foundation/decidable-embeddings.lagda.md | 17 ------ 2 files changed, 53 insertions(+), 24 deletions(-) diff --git a/src/foundation-core/decidable-propositions.lagda.md b/src/foundation-core/decidable-propositions.lagda.md index f7972252a9..d665b18c0e 100644 --- a/src/foundation-core/decidable-propositions.lagda.md +++ b/src/foundation-core/decidable-propositions.lagda.md @@ -13,6 +13,7 @@ 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.universe-levels @@ -35,12 +36,9 @@ A {{#concept "decidable proposition" Agda=is-decidable-Prop}} is a ## Definition -### The subtype of decidable propositions +### The property a proposition of being decidable ```agda -is-decidable-prop : {l : Level} → UU l → UU l -is-decidable-prop A = is-prop A × is-decidable A - is-prop-is-decidable : {l : Level} {A : UU l} → is-prop A → is-prop (is-decidable A) is-prop-is-decidable is-prop-A = @@ -51,6 +49,16 @@ is-decidable-Prop : pr1 (is-decidable-Prop P) = is-decidable (type-Prop P) pr2 (is-decidable-Prop P) = is-prop-is-decidable (is-prop-type-Prop P) +is-decidable-type-Prop : {l : Level} → Prop l → UU l +is-decidable-type-Prop P = is-decidable (type-Prop P) +``` + +### The subuniverse of decidable propositions + +```agda +is-decidable-prop : {l : Level} → UU l → UU l +is-decidable-prop A = is-prop A × is-decidable A + is-prop-is-decidable-prop : {l : Level} (X : UU l) → is-prop (is-decidable-prop X) is-prop-is-decidable-prop X = @@ -60,13 +68,20 @@ is-prop-is-decidable-prop X = ( is-prop-is-prop X) ( is-prop-is-decidable (pr1 H))) -is-decidable-type-Prop : {l : Level} → Prop l → UU l -is-decidable-type-Prop P = is-decidable (type-Prop P) - is-decidable-prop-Prop : {l : Level} (A : UU l) → Prop l pr1 (is-decidable-prop-Prop A) = is-decidable-prop A pr2 (is-decidable-prop-Prop A) = is-prop-is-decidable-prop A + +module _ + {l : Level} {A : UU l} (H : is-decidable-prop A) + where + + is-prop-type-is-decidable-prop : is-prop A + is-prop-type-is-decidable-prop = pr1 H + + is-decidable-type-is-decidable-prop : is-decidable A + is-decidable-type-is-decidable-prop = pr2 H ``` ### Decidable propositions @@ -175,6 +190,37 @@ module _ pr2 product-Decidable-Prop = is-decidable-prop-product-Decidable-Prop ``` +### The dependent sum of a family of decidable propositions over a decidable proposition + +```agda +module _ + {l1 l2 : Level} {P : UU l1} {Q : P → UU l2} + (H : is-decidable-prop P) (K : (x : P) → is-decidable-prop (Q x)) + where + + is-prop-is-decidable-prop-Σ : is-prop (Σ P Q) + is-prop-is-decidable-prop-Σ = + is-prop-Σ + ( is-prop-type-is-decidable-prop H) + ( is-prop-type-is-decidable-prop ∘ K) + + is-decidable-is-decidable-prop-Σ : is-decidable (Σ P Q) + is-decidable-is-decidable-prop-Σ with is-decidable-type-is-decidable-prop H + ... | inl 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)) + ... | inr nx = inr (λ xy → nx (pr1 xy)) + + is-decidable-prop-Σ : is-decidable-prop (Σ P Q) + is-decidable-prop-Σ = + ( is-prop-is-decidable-prop-Σ , is-decidable-is-decidable-prop-Σ) +``` + ### The negation operation on decidable propositions ```agda diff --git a/src/foundation/decidable-embeddings.lagda.md b/src/foundation/decidable-embeddings.lagda.md index a84cfa637d..6dbb27d0e8 100644 --- a/src/foundation/decidable-embeddings.lagda.md +++ b/src/foundation/decidable-embeddings.lagda.md @@ -637,20 +637,3 @@ module _ ( is-emb-terminal-map-is-prop (is-prop-type-Prop P))) ( p)) ``` - -### A dependent sum of decidable propositions over a decidable proposition is a decidable proposition - -```agda -module _ - {l1 l2 : Level} (P : UU l1) (Q : P → UU l2) - where - - is-decidable-prop-Σ : - is-decidable-prop P → ((x : P) → is-decidable-prop (Q x)) → - is-decidable-prop (Σ P Q) - is-decidable-prop-Σ p q = - is-decidable-prop-is-decidable-emb-terminal-map - ( is-decidable-emb-comp - ( is-decidable-emb-terminal-map-is-decidable-prop p) - ( is-decidable-emb-pr1 (λ x → Q x , q x))) -``` From d6a81a38bf6baffbc6a21563e1d6fe07bb693f9b Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 01:18:15 +0200 Subject: [PATCH 10/83] edits --- src/foundation/decidable-embeddings.lagda.md | 24 +++++------ src/foundation/double-negation.lagda.md | 4 -- .../locale-of-propositions.lagda.md | 22 +++------- ...cated-double-negation-elimination.lagda.md | 42 ++++++++++++++++--- ...naster-tarski-fixed-point-theorem.lagda.md | 12 ------ 5 files changed, 54 insertions(+), 50 deletions(-) diff --git a/src/foundation/decidable-embeddings.lagda.md b/src/foundation/decidable-embeddings.lagda.md index 6dbb27d0e8..1c56245e9b 100644 --- a/src/foundation/decidable-embeddings.lagda.md +++ b/src/foundation/decidable-embeddings.lagda.md @@ -237,6 +237,18 @@ abstract ( λ y → is-prop-is-decidable (is-prop-map-is-emb (pr1 H) y)))) ``` +### Decidable embeddings are closed under homotopies + +```agda +abstract + is-decidable-emb-htpy : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} → + f ~ g → is-decidable-emb g → is-decidable-emb f + is-decidable-emb-htpy {f = f} {g} H K = + ( is-emb-htpy H (is-emb-is-decidable-emb K) , + is-decidable-map-htpy H (is-decidable-map-is-decidable-emb K)) +``` + ### Decidable embeddings are closed under composition ```agda @@ -307,18 +319,6 @@ module _ is-decidable-emb-right-factor' GH (is-emb-is-decidable-emb G) ``` -### Decidable embeddings are closed under homotopies - -```agda -abstract - is-decidable-emb-htpy : - {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} → - f ~ g → is-decidable-emb g → is-decidable-emb f - is-decidable-emb-htpy {f = f} {g} H K = - ( is-emb-htpy H (is-emb-is-decidable-emb K) , - is-decidable-map-htpy H (is-decidable-map-is-decidable-emb K)) -``` - ### In a commuting triangle of maps, if the top and right maps are decidable embeddings so is the left map ```agda diff --git a/src/foundation/double-negation.lagda.md b/src/foundation/double-negation.lagda.md index 588e130404..7a8c9f02e0 100644 --- a/src/foundation/double-negation.lagda.md +++ b/src/foundation/double-negation.lagda.md @@ -7,16 +7,12 @@ module foundation.double-negation where
Imports ```agda -open import foundation.dependent-pair-types -open import foundation.evaluation-functions open import foundation.negation open import foundation.propositional-truncations 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.function-types open import foundation-core.propositions ``` diff --git a/src/foundation/locale-of-propositions.lagda.md b/src/foundation/locale-of-propositions.lagda.md index 5b6d179dae..15657a04de 100644 --- a/src/foundation/locale-of-propositions.lagda.md +++ b/src/foundation/locale-of-propositions.lagda.md @@ -7,29 +7,21 @@ module foundation.locale-of-propositions where
Imports ```agda -open import foundation.conjunction open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.large-locale-of-propositions -open import foundation.logical-equivalences -open import foundation.propositional-extensionality open import foundation.unit-type -open import foundation.universal-property-cartesian-product-types +open import foundation.logical-equivalences open import foundation.universe-levels open import foundation-core.function-types -open import foundation-core.propositions -open import order-theory.frames open import order-theory.large-posets open import order-theory.large-preorders -open import order-theory.least-upper-bounds-posets -open import order-theory.locales -open import order-theory.meet-semilattices open import order-theory.posets +open import order-theory.top-elements-posets open import order-theory.preorders open import order-theory.suplattices -open import order-theory.top-elements-posets ```
@@ -77,14 +69,10 @@ is-greatest-binary-lower-bound-meet-has-meets-Poset ### The largest element in the poset of propositions -```text +```agda has-top-element-Prop-Locale : - has-top-element-Poset Prop-Poset -top-has-top-element-Poset - has-top-element-Prop-Locale = unit-Prop -is-top-element-top-has-top-element-Poset - has-top-element-Prop-Locale P p = - star + {l : Level} → has-top-element-Poset (Prop-Poset l) +has-top-element-Prop-Locale {l} = (raise-unit-Prop l , λ _ _ → raise-star) ``` ### The poset of propositions is a meet-semilattice diff --git a/src/foundation/untruncated-double-negation-elimination.lagda.md b/src/foundation/untruncated-double-negation-elimination.lagda.md index 8fe26e8a35..df7938b6db 100644 --- a/src/foundation/untruncated-double-negation-elimination.lagda.md +++ b/src/foundation/untruncated-double-negation-elimination.lagda.md @@ -8,23 +8,20 @@ module foundation.untruncated-double-negation-elimination 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.empty-types open import foundation.evaluation-functions -open import foundation.existential-quantification +open import foundation.logical-equivalences open import foundation.negation open import foundation.transport-along-identifications open import foundation.unit-type -open import foundation.universal-quantification open import foundation.universe-levels open import foundation-core.contractible-types +open import foundation-core.equivalences open import foundation-core.function-types open import foundation-core.propositions ``` @@ -56,6 +53,41 @@ module _ ## Properties +### Double negation elimination is preserved by logical equivalences + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + has-double-negation-elim-iff : + A ↔ B → has-double-negation-elim B → has-double-negation-elim A + has-double-negation-elim-iff e H = + backward-implication e ∘ H ∘ map-double-negation (forward-implication e) + + has-double-negation-elim-iff' : + B ↔ A → has-double-negation-elim B → has-double-negation-elim A + has-double-negation-elim-iff' e = has-double-negation-elim-iff (inv-iff e) +``` + +### Double negation elimination is preserved by equivalences + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + has-double-negation-elim-equiv : + A ≃ B → has-double-negation-elim B → has-double-negation-elim A + has-double-negation-elim-equiv e = + has-double-negation-elim-iff (iff-equiv e) + + has-double-negation-elim-equiv' : + B ≃ A → has-double-negation-elim B → has-double-negation-elim A + has-double-negation-elim-equiv' e = + has-double-negation-elim-iff' (iff-equiv e) +``` + ### The empty proposition has double negation elimination ```agda diff --git a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md index 0dee7211ef..6d7ce2e93c 100644 --- a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md +++ b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md @@ -10,25 +10,13 @@ module order-theory.knaster-tarski-fixed-point-theorem where open import foundation.dependent-pair-types open import foundation.fixed-points-endofunctions open import foundation.identity-types -open import foundation.large-binary-relations open import foundation.logical-equivalences -open import foundation.sets open import foundation.universe-levels -open import order-theory.greatest-lower-bounds-large-posets open import order-theory.inflattices -open import order-theory.large-meet-semilattices -open import order-theory.large-posets -open import order-theory.large-preorders -open import order-theory.large-suplattices -open import order-theory.least-upper-bounds-large-posets -open import order-theory.meet-semilattices open import order-theory.order-preserving-maps-posets open import order-theory.posets -open import order-theory.preorders open import order-theory.suplattices -open import order-theory.top-elements-large-posets -open import order-theory.upper-bounds-large-posets ```
From 1fa059daadc4b747dcfdf27fcbce013149d93491 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 02:02:09 +0200 Subject: [PATCH 11/83] double negation eliminating --- src/foundation.lagda.md | 1 + .../double-negation-eliminating-maps.lagda.md | 251 ++++++++++++++++++ .../locale-of-propositions.lagda.md | 4 +- src/foundation/retracts-of-types.lagda.md | 14 + 4 files changed, 268 insertions(+), 2 deletions(-) create mode 100644 src/foundation/double-negation-eliminating-maps.lagda.md diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index a7694fc99f..8ee4bceed7 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -135,6 +135,7 @@ open import foundation.discrete-types public open import foundation.disjunction public open import foundation.double-arrows public open import foundation.double-negation public +open import foundation.double-negation-eliminating-maps public open import foundation.double-negation-modality public open import foundation.double-negation-stable-propositions public open import foundation.double-powersets public diff --git a/src/foundation/double-negation-eliminating-maps.lagda.md b/src/foundation/double-negation-eliminating-maps.lagda.md new file mode 100644 index 0000000000..9e764ea273 --- /dev/null +++ b/src/foundation/double-negation-eliminating-maps.lagda.md @@ -0,0 +1,251 @@ +# Double negation eliminating maps + +```agda +module foundation.double-negation-eliminating-maps where +``` + +
Imports + +```agda +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 +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.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 +open import foundation.untruncated-double-negation-elimination + +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.functoriality-dependent-pair-types +open import foundation-core.homotopies +``` + +
+ +## Definition + +A [map](foundation-core.function-types.md) is said to be +{{#concept "double negation eliminating" Disambiguation="map of types" Agda=is-double-negation-eliminating-map}} +if its [fibers](foundation-core.fibers-of-maps.md) satisfy +[untruncated double negation elimination](foundation.untruncated-double-negation-elimination.md). + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-double-negation-eliminating-map : (A → B) → UU (l1 ⊔ l2) + is-double-negation-eliminating-map f = + (y : B) → has-double-negation-elim (fiber f y) +``` + +## Properties + +### Double negation eliminating maps are closed under homotopy + +```agda +abstract + is-double-negation-eliminating-map-htpy : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} → + f ~ g → + is-double-negation-eliminating-map g → + is-double-negation-eliminating-map f + is-double-negation-eliminating-map-htpy H K b = + has-double-negation-elim-equiv + ( equiv-tot (λ a → equiv-concat (inv (H a)) b)) + ( K b) +``` + +### Decidable maps are double negation eliminating + +```agda +is-double-negation-eliminating-map-is-decidable-map : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-decidable-map f → is-double-negation-eliminating-map f +is-double-negation-eliminating-map-is-decidable-map H y = + double-negation-elim-is-decidable (H y) +``` + +### Left cancellation for double negation eliminating maps + +If a composite `g ∘ f` is double negation eliminating and the left factor `g` is +injective, then the right factor `f` is double negation eliminating. + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} + (GF : is-double-negation-eliminating-map (g ∘ f)) + where + + fiber-comp-is-double-negation-eliminating-map-right-factor' : + (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)))) + + is-double-negation-eliminating-map-right-factor' : + is-injective g → is-double-negation-eliminating-map f + is-double-negation-eliminating-map-right-factor' G y nnfy = + tr + ( fiber f) + ( G ( pr2 + ( pr1 + ( fiber-comp-is-double-negation-eliminating-map-right-factor' + ( y) + ( nnfy))))) + ( pr2 + ( fiber-comp-is-double-negation-eliminating-map-right-factor' y nnfy)) +``` + +### Any map out of the empty type is double negation eliminating + +```agda +abstract + is-double-negation-eliminating-map-ex-falso : + {l : Level} {X : UU l} → + is-double-negation-eliminating-map (ex-falso {l} {X}) + is-double-negation-eliminating-map-ex-falso x f = ex-falso (f λ ()) +``` + +### The identity map is double negation eliminating + +```agda +abstract + is-double-negation-eliminating-map-id : + {l : Level} {X : UU l} → is-double-negation-eliminating-map (id {l} {X}) + is-double-negation-eliminating-map-id x y = (x , refl) +``` + +### Equivalences are double negation eliminating maps + +```agda +abstract + is-double-negation-eliminating-map-is-equiv : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-equiv f → is-double-negation-eliminating-map f + is-double-negation-eliminating-map-is-equiv H x = + double-negation-elim-is-contr (is-contr-map-is-equiv H x) +``` + +### The map on total spaces induced by a family of double negation eliminating maps is double negation eliminating + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} + where + + is-double-negation-eliminating-map-tot : + {f : (x : A) → B x → C x} → + ((x : A) → is-double-negation-eliminating-map (f x)) → + is-double-negation-eliminating-map (tot f) + is-double-negation-eliminating-map-tot {f} H x = + has-double-negation-elim-equiv (compute-fiber-tot f x) (H (pr1 x) (pr2 x)) +``` + +### The map on total spaces induced by a double negation eliminating map on the base is double negation eliminating + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) + where + + is-double-negation-eliminating-map-Σ-map-base : + {f : A → B} → + is-double-negation-eliminating-map f → + is-double-negation-eliminating-map (map-Σ-map-base f C) + is-double-negation-eliminating-map-Σ-map-base {f} H x = + has-double-negation-elim-equiv' + ( compute-fiber-map-Σ-map-base f C x) + ( H (pr1 x)) +``` + +### Products of double negation eliminating maps are double negation eliminating + +```agda +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-double-negation-eliminating-map-product : + {f : A → B} {g : C → D} → + is-double-negation-eliminating-map f → + is-double-negation-eliminating-map g → + is-double-negation-eliminating-map (map-product f g) + is-double-negation-eliminating-map-product {f} {g} F G x = + has-double-negation-elim-equiv + ( compute-fiber-map-product f g x) + ( double-negation-elim-product (F (pr1 x)) (G (pr2 x))) +``` + +### Coproducts of double negation eliminating maps are double negation eliminating + +```agda +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-double-negation-eliminating-map-coproduct : + {f : A → B} {g : C → D} → + is-double-negation-eliminating-map f → + is-double-negation-eliminating-map g → + is-double-negation-eliminating-map (map-coproduct f g) + is-double-negation-eliminating-map-coproduct {f} {g} F G (inl x) = + has-double-negation-elim-equiv' + ( compute-fiber-inl-map-coproduct f g x) + ( F x) + is-double-negation-eliminating-map-coproduct {f} {g} F G (inr y) = + has-double-negation-elim-equiv' + ( compute-fiber-inr-map-coproduct f g y) + ( G y) +``` + +### Double negation eliminating maps are closed under base change + +```agda +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + {f : A → B} {g : C → D} + where + + is-double-negation-eliminating-map-base-change : + cartesian-hom-arrow g f → + is-double-negation-eliminating-map f → + is-double-negation-eliminating-map g + is-double-negation-eliminating-map-base-change α F d = + has-double-negation-elim-equiv + ( equiv-fibers-cartesian-hom-arrow g f α d) + ( F (map-codomain-cartesian-hom-arrow g f α d)) +``` + +### Double negation eliminating maps are closed under retracts of maps + +```agda +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} + {f : A → B} {g : X → Y} + where + + has-double-negation-elim-retract-map : + f retract-of-map g → + is-double-negation-eliminating-map g → + is-double-negation-eliminating-map f + has-double-negation-elim-retract-map R G x = + has-double-negation-elim-iff + ( iff-retract (retract-fiber-retract-map f g R x)) + ( G (map-codomain-inclusion-retract-map f g R x)) +``` diff --git a/src/foundation/locale-of-propositions.lagda.md b/src/foundation/locale-of-propositions.lagda.md index 15657a04de..bcfa73ae1c 100644 --- a/src/foundation/locale-of-propositions.lagda.md +++ b/src/foundation/locale-of-propositions.lagda.md @@ -10,8 +10,8 @@ module foundation.locale-of-propositions where open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.large-locale-of-propositions -open import foundation.unit-type open import foundation.logical-equivalences +open import foundation.unit-type open import foundation.universe-levels open import foundation-core.function-types @@ -19,9 +19,9 @@ open import foundation-core.function-types open import order-theory.large-posets open import order-theory.large-preorders open import order-theory.posets -open import order-theory.top-elements-posets open import order-theory.preorders open import order-theory.suplattices +open import order-theory.top-elements-posets ```
diff --git a/src/foundation/retracts-of-types.lagda.md b/src/foundation/retracts-of-types.lagda.md index ce0fa62ff3..56c7476a61 100644 --- a/src/foundation/retracts-of-types.lagda.md +++ b/src/foundation/retracts-of-types.lagda.md @@ -15,12 +15,14 @@ open import foundation.fundamental-theorem-of-identity-types open import foundation.homotopies open import foundation.homotopy-algebra open import foundation.homotopy-induction +open import foundation.logical-equivalences open import foundation.structure-identity-principle open import foundation.univalence open import foundation.universe-levels open import foundation.whiskering-homotopies-composition open import foundation-core.contractible-types +open import foundation-core.function-types open import foundation-core.functoriality-dependent-pair-types open import foundation-core.identity-types open import foundation-core.torsorial-type-families @@ -166,6 +168,18 @@ module _ eq-equiv-retracts R S = map-inv-is-equiv (is-equiv-equiv-eq-retracts R S) ``` +### The underlying logical equivalence associated to a retract + +```agda +iff-retract : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → A retract-of B → A ↔ B +iff-retract R = inclusion-retract R , map-retraction-retract R + +iff-retract' : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → A retract-of B → B ↔ A +iff-retract' = inv-iff ∘ iff-retract +``` + ## See also - [Retracts of maps](foundation.retracts-of-maps.md) From b40c770e878d63079fb4dbb3a735cb1c1e6646ec Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 02:24:07 +0200 Subject: [PATCH 12/83] wip double negation stable embeddings --- src/foundation.lagda.md | 1 + ...double-negation-stable-embeddings.lagda.md | 657 ++++++++++++++++++ ...uble-negation-stable-propositions.lagda.md | 58 +- ...cated-double-negation-elimination.lagda.md | 27 + 4 files changed, 731 insertions(+), 12 deletions(-) create mode 100644 src/foundation/double-negation-stable-embeddings.lagda.md diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 8ee4bceed7..baa3135e05 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -137,6 +137,7 @@ open import foundation.double-arrows public open import foundation.double-negation public open import foundation.double-negation-eliminating-maps public open import foundation.double-negation-modality public +open import foundation.double-negation-stable-embeddings public open import foundation.double-negation-stable-propositions public open import foundation.double-powersets public open import foundation.dubuc-penon-compact-types public diff --git a/src/foundation/double-negation-stable-embeddings.lagda.md b/src/foundation/double-negation-stable-embeddings.lagda.md new file mode 100644 index 0000000000..f005136550 --- /dev/null +++ b/src/foundation/double-negation-stable-embeddings.lagda.md @@ -0,0 +1,657 @@ +# Double negation stable embeddings + +```agda +module foundation.double-negation-stable-embeddings where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.cartesian-morphisms-arrows +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-eliminating-maps +open import foundation.double-negation-stable-propositions +open import foundation.embeddings +open import foundation.fibers-of-maps +open import foundation.functoriality-cartesian-product-types +open import foundation.functoriality-coproduct-types +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.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.untruncated-double-negation-elimination + +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 +open import foundation-core.functoriality-dependent-pair-types +open import foundation-core.homotopies +open import foundation-core.injective-maps +open import foundation-core.torsorial-type-families +``` + +
+ +## Idea + +A [map](foundation-core.function-types.md) is said to be a +{{#concept "double negation stable embedding" Disambiguation="of types" Agda=is-double-negation-stable-emb}} +if it is an [embedding](foundation-core.embeddings.md) and its +[fibers](foundation-core.fibers-of-maps.md) are +[decidable types](foundation.decidable-types.md). + +Equivalently, a double negation stable embedding is a map whose fibers are +[decidable propositions](foundation-core.decidable-propositions.md). We refer to +this condition as being a +{{#concept "decidably propositional map" Disambiguation="of types" Agda=is-double-negation-stable-prop-map}}. + +## Definitions + +### The condition on a map of being a double negation stable embedding + +```agda +is-double-negation-stable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} → (X → Y) → UU (l1 ⊔ l2) +is-double-negation-stable-emb f = + is-emb f × is-double-negation-eliminating-map f + +abstract + is-emb-is-double-negation-stable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → + is-double-negation-stable-emb f → is-emb f + is-emb-is-double-negation-stable-emb = pr1 + +is-double-negation-eliminating-map-is-double-negation-stable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → + is-double-negation-stable-emb f → is-double-negation-eliminating-map f +is-double-negation-eliminating-map-is-double-negation-stable-emb = pr2 +``` + +### Double negation stable propositional maps + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} + where + + is-double-negation-stable-prop-map : (X → Y) → UU (l1 ⊔ l2) + is-double-negation-stable-prop-map f = + (y : Y) → is-double-negation-stable-prop (fiber f y) + + is-prop-is-double-negation-stable-prop-map : + (f : X → Y) → is-prop (is-double-negation-stable-prop-map f) + is-prop-is-double-negation-stable-prop-map f = + is-prop-Π (λ y → is-prop-is-double-negation-stable-prop (fiber f y)) + + is-double-negation-stable-prop-map-Prop : (X → Y) → Prop (l1 ⊔ l2) + is-double-negation-stable-prop-map-Prop f = + ( is-double-negation-stable-prop-map f , + is-prop-is-double-negation-stable-prop-map f) + + abstract + is-prop-map-is-double-negation-stable-prop-map : + {f : X → Y} → is-double-negation-stable-prop-map f → is-prop-map f + is-prop-map-is-double-negation-stable-prop-map H y = pr1 (H y) + + is-double-negation-eliminating-map-is-double-negation-stable-prop-map : + {f : X → Y} → + is-double-negation-stable-prop-map f → + is-double-negation-eliminating-map f + is-double-negation-eliminating-map-is-double-negation-stable-prop-map H y = + pr2 (H y) +``` + +### The type of double negation stable embeddings + +```agda +infix 5 _↪¬¬_ +_↪¬¬_ : + {l1 l2 : Level} (X : UU l1) (Y : UU l2) → UU (l1 ⊔ l2) +X ↪¬¬ Y = Σ (X → Y) is-double-negation-stable-emb + +map-decidable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ↪¬¬ Y → X → Y +map-decidable-emb e = pr1 e + +abstract + is-double-negation-stable-emb-map-decidable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (e : X ↪¬¬ Y) → + is-double-negation-stable-emb (map-decidable-emb e) + is-double-negation-stable-emb-map-decidable-emb e = pr2 e + +abstract + is-emb-map-decidable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (e : X ↪¬¬ Y) → + is-emb (map-decidable-emb e) + is-emb-map-decidable-emb e = + is-emb-is-double-negation-stable-emb + ( is-double-negation-stable-emb-map-decidable-emb e) + +abstract + is-double-negation-eliminating-map-map-decidable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (e : X ↪¬¬ Y) → + is-double-negation-eliminating-map (map-decidable-emb e) + is-double-negation-eliminating-map-map-decidable-emb e = + is-double-negation-eliminating-map-is-double-negation-stable-emb + ( is-double-negation-stable-emb-map-decidable-emb e) + +emb-decidable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ↪¬¬ Y → X ↪ Y +pr1 (emb-decidable-emb e) = map-decidable-emb e +pr2 (emb-decidable-emb e) = is-emb-map-decidable-emb e +``` + +## Properties + +### Any map of which the fibers are decidable propositions is a double negation stable embedding + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} + where + + abstract + is-double-negation-stable-emb-is-double-negation-stable-prop-map : + is-double-negation-stable-prop-map f → is-double-negation-stable-emb f + pr1 (is-double-negation-stable-emb-is-double-negation-stable-prop-map H) = + is-emb-is-prop-map (is-prop-map-is-double-negation-stable-prop-map H) + pr2 (is-double-negation-stable-emb-is-double-negation-stable-prop-map H) = + is-double-negation-eliminating-map-is-double-negation-stable-prop-map H + + abstract + is-prop-map-is-double-negation-stable-emb : + is-double-negation-stable-emb f → is-prop-map f + is-prop-map-is-double-negation-stable-emb H = + is-prop-map-is-emb (is-emb-is-double-negation-stable-emb H) + + abstract + is-double-negation-stable-prop-map-is-double-negation-stable-emb : + is-double-negation-stable-emb f → is-double-negation-stable-prop-map f + pr1 (is-double-negation-stable-prop-map-is-double-negation-stable-emb H y) = + is-prop-map-is-double-negation-stable-emb H y + pr2 (is-double-negation-stable-prop-map-is-double-negation-stable-emb H y) = + is-double-negation-eliminating-map-is-double-negation-stable-emb H y +``` + +### The first projection map of a dependent sum of decidable propositions is a double negation stable embedding + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (Q : A → Double-Negation-Stable-Prop l2) + where + + is-double-negation-stable-prop-map-pr1 : + is-double-negation-stable-prop-map + ( pr1 {B = type-Double-Negation-Stable-Prop ∘ Q}) + is-double-negation-stable-prop-map-pr1 y = + is-double-negation-stable-prop-equiv + ( equiv-fiber-pr1 (type-Double-Negation-Stable-Prop ∘ Q) y) + ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop (Q y)) + + is-double-negation-stable-emb-pr1 : + is-double-negation-stable-emb + ( pr1 {B = type-Double-Negation-Stable-Prop ∘ Q}) + is-double-negation-stable-emb-pr1 = + is-double-negation-stable-emb-is-double-negation-stable-prop-map + ( is-double-negation-stable-prop-map-pr1) +``` + +### Equivalences are double negation stable embeddings + +```agda +abstract + is-double-negation-stable-emb-is-equiv : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-equiv f → is-double-negation-stable-emb f + is-double-negation-stable-emb-is-equiv H = + ( is-emb-is-equiv H , is-double-negation-eliminating-map-is-equiv H) +``` + +### Identity maps are double negation stable embeddings + +```agda +is-double-negation-stable-emb-id : + {l : Level} {A : UU l} → is-double-negation-stable-emb (id {A = A}) +is-double-negation-stable-emb-id = + ( is-emb-id , is-double-negation-eliminating-map-id) + +decidable-emb-id : {l : Level} {A : UU l} → A ↪¬¬ A +decidable-emb-id = (id , is-double-negation-stable-emb-id) + +is-double-negation-stable-prop-map-id : + {l : Level} {A : UU l} → is-double-negation-stable-prop-map (id {A = A}) +is-double-negation-stable-prop-map-id y = + is-double-negation-stable-prop-is-contr (is-torsorial-Id' y) +``` + +### Being a double negation stable embedding is a property + +```agda +abstract + is-prop-is-double-negation-stable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) → + is-prop (is-double-negation-stable-emb f) + is-prop-is-double-negation-stable-emb f = + is-prop-has-element + ( λ H → + is-prop-product + ( is-property-is-emb f) + ( is-prop-Π + ( is-prop-has-double-negation-elim ∘ is-prop-map-is-emb (pr1 H)))) +``` + +### Double negation stable embeddings are closed under homotopies + +```agda +abstract + is-double-negation-stable-emb-htpy : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} → + f ~ g → is-double-negation-stable-emb g → is-double-negation-stable-emb f + is-double-negation-stable-emb-htpy {f = f} {g} H K = + ( is-emb-htpy H (is-emb-is-double-negation-stable-emb K) , + is-double-negation-eliminating-map-htpy H + ( is-double-negation-eliminating-map-is-double-negation-stable-emb K)) +``` + +### Double negation stable embeddings are closed under composition + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {g : B → C} {f : A → B} + where + + abstract + is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' : + is-double-negation-stable-emb g → is-double-negation-eliminating-map f → is-double-negation-eliminating-map (g ∘ f) + is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' K H x = + rec-coproduct + ( λ u → + is-decidable-equiv + ( ( left-unit-law-Σ-is-contr + ( is-proof-irrelevant-is-prop + ( is-prop-map-is-emb (is-emb-is-double-negation-stable-emb K) x) u) + ( u)) ∘e + ( compute-fiber-comp g f x)) + ( H (pr1 u))) + ( λ α → inr (λ t → α (f (pr1 t) , pr2 t))) + ( is-double-negation-eliminating-map-is-double-negation-stable-emb K x) + + is-double-negation-eliminating-map-comp-is-double-negation-stable-emb : + is-double-negation-stable-emb g → is-double-negation-stable-emb f → is-double-negation-eliminating-map (g ∘ f) + is-double-negation-eliminating-map-comp-is-double-negation-stable-emb K H = + is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' + ( K) + ( is-double-negation-eliminating-map-is-double-negation-stable-emb H) + + is-double-negation-stable-emb-comp : + is-double-negation-stable-emb g → is-double-negation-stable-emb f → is-double-negation-stable-emb (g ∘ f) + is-double-negation-stable-emb-comp K H = + ( is-emb-comp _ _ (pr1 K) (pr1 H) , + is-double-negation-eliminating-map-comp-is-double-negation-stable-emb K H) + + abstract + is-double-negation-stable-prop-map-comp : + is-double-negation-stable-prop-map g → + is-double-negation-stable-prop-map f → + is-double-negation-stable-prop-map (g ∘ f) + is-double-negation-stable-prop-map-comp K H = + is-double-negation-stable-prop-map-is-double-negation-stable-emb + ( is-double-negation-stable-emb-comp + ( is-double-negation-stable-emb-is-double-negation-stable-prop-map K) + ( is-double-negation-stable-emb-is-double-negation-stable-prop-map H)) +``` + +### Left cancellation for double negation stable embeddings + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} + where + + is-double-negation-stable-emb-right-factor' : + is-double-negation-stable-emb (g ∘ f) → is-emb g → is-double-negation-stable-emb f + is-double-negation-stable-emb-right-factor' GH G = + ( is-emb-right-factor g f G (is-emb-is-double-negation-stable-emb GH) , + is-double-negation-eliminating-map-right-factor' + ( is-double-negation-eliminating-map-is-double-negation-stable-emb GH) + ( is-injective-is-emb G)) + + is-double-negation-stable-emb-right-factor : + is-double-negation-stable-emb (g ∘ f) → is-double-negation-stable-emb g → is-double-negation-stable-emb f + is-double-negation-stable-emb-right-factor GH G = + is-double-negation-stable-emb-right-factor' GH (is-emb-is-double-negation-stable-emb G) +``` + +### In a commuting triangle of maps, if the top and right maps are double negation stable embeddings so is the left map + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {top : A → B} {left : A → C} {right : B → C} + (H : left ~ right ∘ top) + where + + is-double-negation-stable-emb-left-map-triangle : + is-double-negation-stable-emb top → is-double-negation-stable-emb right → is-double-negation-stable-emb left + is-double-negation-stable-emb-left-map-triangle T R = + is-double-negation-stable-emb-htpy H (is-double-negation-stable-emb-comp R T) +``` + +### In a commuting triangle of maps, if the left and right maps are double negation stable embeddings so is the top map + +In fact, the right map need only be an embedding. + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {top : A → B} {left : A → C} {right : B → C} + (H : left ~ right ∘ top) + where + + is-double-negation-stable-emb-top-map-triangle' : + is-emb right → is-double-negation-stable-emb left → is-double-negation-stable-emb top + is-double-negation-stable-emb-top-map-triangle' R' L = + is-double-negation-stable-emb-right-factor' (is-double-negation-stable-emb-htpy (inv-htpy H) L) R' + + is-double-negation-stable-emb-top-map-triangle : + is-double-negation-stable-emb right → is-double-negation-stable-emb left → is-double-negation-stable-emb top + is-double-negation-stable-emb-top-map-triangle R L = + is-double-negation-stable-emb-right-factor (is-double-negation-stable-emb-htpy (inv-htpy H) L) R +``` + +### Characterizing equality in the type of double negation stable embeddings + +```text +htpy-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪¬¬ B) → UU (l1 ⊔ l2) +htpy-decidable-emb f g = map-decidable-emb f ~ map-decidable-emb g + +refl-htpy-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪¬¬ B) → htpy-decidable-emb f f +refl-htpy-decidable-emb f = refl-htpy + +htpy-eq-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪¬¬ B) → + f = g → htpy-decidable-emb f g +htpy-eq-decidable-emb f .f refl = refl-htpy-decidable-emb f + +abstract + is-torsorial-htpy-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪¬¬ B) → + is-torsorial (htpy-decidable-emb f) + is-torsorial-htpy-decidable-emb f = + is-torsorial-Eq-subtype + ( is-torsorial-htpy (map-decidable-emb f)) + ( is-prop-is-double-negation-stable-emb) + ( map-decidable-emb f) + ( refl-htpy) + ( is-double-negation-stable-emb-map-decidable-emb f) + +abstract + is-equiv-htpy-eq-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪¬¬ B) → + is-equiv (htpy-eq-decidable-emb f g) + is-equiv-htpy-eq-decidable-emb f = + fundamental-theorem-id + ( is-torsorial-htpy-decidable-emb f) + ( htpy-eq-decidable-emb f) + +eq-htpy-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪¬¬ B) → + htpy-decidable-emb f g → f = g +eq-htpy-decidable-emb f g = + map-inv-is-equiv (is-equiv-htpy-eq-decidable-emb f g) +``` + +### Precomposing double negation stable embeddings with equivalences + +```text +equiv-precomp-decidable-emb-equiv : + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) → + (C : UU l3) → (B ↪¬¬ C) ≃ (A ↪¬¬ C) +equiv-precomp-decidable-emb-equiv e C = + equiv-Σ + ( is-double-negation-stable-emb) + ( equiv-precomp e C) + ( λ g → + equiv-iff-is-prop + ( is-prop-is-double-negation-stable-emb g) + ( is-prop-is-double-negation-stable-emb (g ∘ map-equiv e)) + ( λ H → is-double-negation-stable-emb-comp H (is-double-negation-stable-emb-is-equiv (pr2 e))) + ( λ d → + is-double-negation-stable-emb-htpy + ( λ b → ap g (inv (is-section-map-inv-equiv e b))) + ( is-double-negation-stable-emb-comp + ( d) + ( is-double-negation-stable-emb-is-equiv (is-equiv-map-inv-equiv e))))) +``` + +### Any map out of the empty type is a double negation stable embedding + +```text +abstract + is-double-negation-stable-emb-ex-falso : + {l : Level} {X : UU l} → is-double-negation-stable-emb (ex-falso {l} {X}) + is-double-negation-stable-emb-ex-falso = (is-emb-ex-falso , is-double-negation-eliminating-map-ex-falso) + +decidable-emb-ex-falso : + {l : Level} {X : UU l} → empty ↪¬¬ X +decidable-emb-ex-falso = (ex-falso , is-double-negation-stable-emb-ex-falso) + +decidable-emb-is-empty : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → is-empty A → A ↪¬¬ B +decidable-emb-is-empty {A = A} f = + map-equiv + ( equiv-precomp-decidable-emb-equiv (equiv-is-empty f id) _) + ( decidable-emb-ex-falso) +``` + +### The map on total spaces induced by a family of double negation stable embeddings is a double negation stable embedding + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} + where + + is-double-negation-stable-emb-tot : + {f : (x : A) → B x → C x} → + ((x : A) → is-double-negation-stable-emb (f x)) → is-double-negation-stable-emb (tot f) + is-double-negation-stable-emb-tot H = + ( is-emb-tot (λ x → is-emb-is-double-negation-stable-emb (H x)) , + is-double-negation-eliminating-map-tot (λ x → is-double-negation-eliminating-map-is-double-negation-stable-emb (H x))) + + decidable-emb-tot : ((x : A) → B x ↪¬¬ C x) → Σ A B ↪¬¬ Σ A C + decidable-emb-tot f = + ( tot (λ x → map-decidable-emb (f x)) , + is-double-negation-stable-emb-tot (λ x → is-double-negation-stable-emb-map-decidable-emb (f x))) +``` + +### The map on total spaces induced by a double negation stable embedding on the base is a double negation stable embedding + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) + where + + is-double-negation-stable-emb-map-Σ-map-base : + {f : A → B} → is-double-negation-stable-emb f → is-double-negation-stable-emb (map-Σ-map-base f C) + is-double-negation-stable-emb-map-Σ-map-base {f} H = + ( is-emb-map-Σ-map-base C (is-emb-is-double-negation-stable-emb H) , + is-double-negation-eliminating-map-Σ-map-base C (is-double-negation-eliminating-map-is-double-negation-stable-emb H)) + + decidable-emb-map-Σ-map-base : + (f : A ↪¬¬ B) → Σ A (C ∘ map-decidable-emb f) ↪¬¬ Σ B C + decidable-emb-map-Σ-map-base f = + ( map-Σ-map-base (map-decidable-emb f) C , + is-double-negation-stable-emb-map-Σ-map-base ((is-double-negation-stable-emb-map-decidable-emb f))) +``` + +### The functoriality of dependent pair types preserves double negation stable embeddings + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : A → UU l3} (D : B → UU l4) + where + + is-double-negation-stable-emb-map-Σ : + {f : A → B} {g : (x : A) → C x → D (f x)} → + is-double-negation-stable-emb f → + ((x : A) → is-double-negation-stable-emb (g x)) → + is-double-negation-stable-emb (map-Σ D f g) + is-double-negation-stable-emb-map-Σ {f} {g} F G = + is-double-negation-stable-emb-left-map-triangle + ( triangle-map-Σ D f g) + ( is-double-negation-stable-emb-tot G) + ( is-double-negation-stable-emb-map-Σ-map-base D F) + + decidable-emb-Σ : + (f : A ↪¬¬ B) → + ((x : A) → C x ↪¬¬ D (map-decidable-emb f x)) → + Σ A C ↪¬¬ Σ B D + decidable-emb-Σ f g = + ( ( map-Σ D (map-decidable-emb f) (λ x → map-decidable-emb (g x))) , + ( is-double-negation-stable-emb-map-Σ + ( is-double-negation-stable-emb-map-decidable-emb f) + ( λ x → is-double-negation-stable-emb-map-decidable-emb (g x)))) +``` + +### Products of double negation stable embeddings are double negation stable embeddings + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-double-negation-stable-emb-map-product : + {f : A → B} {g : C → D} → + is-double-negation-stable-emb f → is-double-negation-stable-emb g → is-double-negation-stable-emb (map-product f g) + is-double-negation-stable-emb-map-product (eF , dF) (eG , dG) = + ( is-emb-map-product eF eG , is-double-negation-eliminating-map-product dF dG) + + decidable-emb-product : + A ↪¬¬ B → C ↪¬¬ D → A × C ↪¬¬ B × D + decidable-emb-product (f , F) (g , G) = + (map-product f g , is-double-negation-stable-emb-map-product F G) +``` + +### Coproducts of double negation stable embeddings are double negation stable embeddings + +```text +module _ + {l1 l2 l1' l2' : Level} {A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'} + where + +abstract + is-double-negation-stable-emb-map-coproduct : + {l1 l2 l3 l4 : Level} + {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} + {f : A → B} {g : X → Y} → + is-double-negation-stable-emb f → + is-double-negation-stable-emb g → + is-double-negation-stable-emb (map-coproduct f g) + is-double-negation-stable-emb-map-coproduct {f = f} {g} (eF , dF) (eG , dG) = + ( is-emb-map-coproduct eF eG , is-double-negation-eliminating-map-coproduct dF dG) +``` + +### Double negation stable embeddings are closed under base change + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + {f : A → B} {g : C → D} + where + + is-double-negation-stable-prop-map-base-change : + cartesian-hom-arrow g f → is-double-negation-stable-prop-map f → is-double-negation-stable-prop-map g + is-double-negation-stable-prop-map-base-change α F d = + is-double-negation-stable-prop-equiv + ( equiv-fibers-cartesian-hom-arrow g f α d) + ( F (map-codomain-cartesian-hom-arrow g f α d)) + + is-double-negation-stable-emb-base-change : + cartesian-hom-arrow g f → is-double-negation-stable-emb f → is-double-negation-stable-emb g + is-double-negation-stable-emb-base-change α F = + is-double-negation-stable-emb-is-double-negation-stable-prop-map + ( is-double-negation-stable-prop-map-base-change α + ( is-double-negation-stable-prop-map-is-double-negation-stable-emb F)) +``` + +### Double negation stable embeddings are closed under retracts of maps + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} + {f : A → B} {g : X → Y} + where + + is-double-negation-stable-prop-map-retract-map : + f retract-of-map g → is-double-negation-stable-prop-map g → is-double-negation-stable-prop-map f + is-double-negation-stable-prop-map-retract-map R G x = + is-double-negation-stable-prop-retract-of + ( retract-fiber-retract-map f g R x) + ( G (map-codomain-inclusion-retract-map f g R x)) + + is-double-negation-stable-emb-retract-map : + f retract-of-map g → is-double-negation-stable-emb g → is-double-negation-stable-emb f + is-double-negation-stable-emb-retract-map R G = + is-double-negation-stable-emb-is-double-negation-stable-prop-map + ( is-double-negation-stable-prop-map-retract-map R + ( is-double-negation-stable-prop-map-is-double-negation-stable-emb G)) +``` + +### A type is a decidable proposition if and only if its terminal map is a double negation stable embedding + +```text +module _ + {l : Level} {A : UU l} + where + + is-double-negation-stable-prop-is-double-negation-stable-emb-terminal-map : + is-double-negation-stable-emb (terminal-map A) → is-double-negation-stable-prop A + is-double-negation-stable-prop-is-double-negation-stable-emb-terminal-map H = + is-double-negation-stable-prop-equiv' + ( equiv-fiber-terminal-map star) + ( is-double-negation-stable-prop-map-is-double-negation-stable-emb H star) + + is-double-negation-stable-emb-terminal-map-is-double-negation-stable-prop : + is-double-negation-stable-prop A → is-double-negation-stable-emb (terminal-map A) + is-double-negation-stable-emb-terminal-map-is-double-negation-stable-prop H = + is-double-negation-stable-emb-is-double-negation-stable-prop-map + ( λ y → is-double-negation-stable-prop-equiv (equiv-fiber-terminal-map y) H) +``` + +### If a dependent sum of propositions over a proposition is decidable, then the family is a family of decidable propositions + +```text +module _ + {l1 l2 : Level} (P : Prop l1) (Q : type-Prop P → Prop l2) + where + + is-double-negation-stable-prop-family-is-decidable-Σ : + is-decidable (Σ (type-Prop P) (type-Prop ∘ Q)) → + (p : type-Prop P) → is-decidable (type-Prop (Q p)) + is-double-negation-stable-prop-family-is-decidable-Σ H p = + is-decidable-equiv' + ( equiv-fiber-pr1 (type-Prop ∘ Q) p) + ( is-double-negation-eliminating-map-is-double-negation-stable-emb + ( is-double-negation-stable-emb-right-factor' + ( is-double-negation-stable-emb-terminal-map-is-double-negation-stable-prop + ( is-prop-Σ (is-prop-type-Prop P) (is-prop-type-Prop ∘ Q) , H)) + ( is-emb-terminal-map-is-prop (is-prop-type-Prop P))) + ( p)) +``` diff --git a/src/foundation/double-negation-stable-propositions.lagda.md b/src/foundation/double-negation-stable-propositions.lagda.md index d8c73b64dd..f27c319bf9 100644 --- a/src/foundation/double-negation-stable-propositions.lagda.md +++ b/src/foundation/double-negation-stable-propositions.lagda.md @@ -16,8 +16,10 @@ open import foundation.dependent-pair-types open import foundation.disjunction open import foundation.double-negation open import foundation.empty-types +open import foundation.equivalences open import foundation.existential-quantification open import foundation.negation +open import foundation.propositions open import foundation.transport-along-identifications open import foundation.unit-type open import foundation.universal-quantification @@ -26,7 +28,7 @@ open import foundation.untruncated-double-negation-elimination open import foundation-core.contractible-types open import foundation-core.function-types -open import foundation-core.propositions +open import foundation-core.retracts-of-types ``` @@ -125,6 +127,42 @@ module _ ## Properties +### Double negation elimination is preserved by retracts + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-double-negation-stable-prop-retract : + A retract-of B → + is-double-negation-stable-prop B → + is-double-negation-stable-prop A + is-double-negation-stable-prop-retract e H = + ( is-prop-retract-of e + ( is-prop-type-is-double-negation-stable-prop H)) , + ( has-double-negation-elim-retract e + ( has-double-negation-elim-is-double-negation-stable-prop H)) +``` + +### Double negation elimination is preserved by equivalences + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-double-negation-stable-prop-equiv : + A ≃ B → is-double-negation-stable-prop B → is-double-negation-stable-prop A + is-double-negation-stable-prop-equiv e = + is-double-negation-stable-prop-retract (retract-equiv e) + + is-double-negation-stable-prop-equiv' : + B ≃ A → is-double-negation-stable-prop B → is-double-negation-stable-prop A + is-double-negation-stable-prop-equiv' e = + is-double-negation-stable-prop-retract (retract-inv-equiv e) +``` + ### The empty proposition is double negation stable ```agda @@ -141,6 +179,13 @@ unit-Double-Negation-Stable-Prop = unit , is-prop-unit , double-negation-elim-unit ``` +```agda +is-double-negation-stable-prop-is-contr : + {l : Level} {A : UU l} → is-contr A → is-double-negation-stable-prop A +is-double-negation-stable-prop-is-contr H = + (is-prop-is-contr H , double-negation-elim-is-contr H) +``` + ### Decidable propositions are double negation stable ```agda @@ -248,17 +293,6 @@ product-Double-Negation-Stable-Prop A B = ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop B)) ``` -### Existential quantification over a double negation stable predicate is double negation stable - -```agda -double-negation-elim-∃ : - {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → - ((a : A) → has-double-negation-elim (B a)) → - has-double-negation-elim (exists-structure A B) -double-negation-elim-∃ b nn∃ = - intro-exists {! !} (b {! !} λ nb → nn∃ (λ ab → {! !})) -``` - ## See also - [The double negation modality](foundation.double-negation-modality.md) diff --git a/src/foundation/untruncated-double-negation-elimination.lagda.md b/src/foundation/untruncated-double-negation-elimination.lagda.md index df7938b6db..0c5fadbfeb 100644 --- a/src/foundation/untruncated-double-negation-elimination.lagda.md +++ b/src/foundation/untruncated-double-negation-elimination.lagda.md @@ -16,6 +16,7 @@ open import foundation.empty-types open import foundation.evaluation-functions open import foundation.logical-equivalences 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 @@ -53,6 +54,14 @@ module _ ## Properties +### If the type is a propositon, then having double negation elimination is a property + +```agda +is-prop-has-double-negation-elim : + {l : Level} {A : UU l} → is-prop A → is-prop (has-double-negation-elim A) +is-prop-has-double-negation-elim = is-prop-function-type +``` + ### Double negation elimination is preserved by logical equivalences ```agda @@ -88,6 +97,24 @@ module _ has-double-negation-elim-iff' (iff-equiv e) ``` +### Double negation elimination is preserved by retracts + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + has-double-negation-elim-retract : + A retract-of B → has-double-negation-elim B → has-double-negation-elim A + has-double-negation-elim-retract e = + has-double-negation-elim-iff (iff-retract e) + + has-double-negation-elim-retract' : + B retract-of A → has-double-negation-elim B → has-double-negation-elim A + has-double-negation-elim-retract' e = + has-double-negation-elim-iff' (iff-retract e) +``` + ### The empty proposition has double negation elimination ```agda From c8d64e65223069ac73ea60b63965610f1ee49487 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 02:44:45 +0200 Subject: [PATCH 13/83] wip double negation stable embeddings --- ...double-negation-stable-embeddings.lagda.md | 321 +++++++++++------- ...uble-negation-stable-propositions.lagda.md | 4 +- 2 files changed, 202 insertions(+), 123 deletions(-) diff --git a/src/foundation/double-negation-stable-embeddings.lagda.md b/src/foundation/double-negation-stable-embeddings.lagda.md index f005136550..82e13d759c 100644 --- a/src/foundation/double-negation-stable-embeddings.lagda.md +++ b/src/foundation/double-negation-stable-embeddings.lagda.md @@ -9,6 +9,7 @@ module foundation.double-negation-stable-embeddings where ```agda 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 @@ -123,36 +124,36 @@ _↪¬¬_ : {l1 l2 : Level} (X : UU l1) (Y : UU l2) → UU (l1 ⊔ l2) X ↪¬¬ Y = Σ (X → Y) is-double-negation-stable-emb -map-decidable-emb : +map-double-negation-stable-emb : {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ↪¬¬ Y → X → Y -map-decidable-emb e = pr1 e +map-double-negation-stable-emb e = pr1 e abstract - is-double-negation-stable-emb-map-decidable-emb : + is-double-negation-stable-emb-map-double-negation-stable-emb : {l1 l2 : Level} {X : UU l1} {Y : UU l2} (e : X ↪¬¬ Y) → - is-double-negation-stable-emb (map-decidable-emb e) - is-double-negation-stable-emb-map-decidable-emb e = pr2 e + is-double-negation-stable-emb (map-double-negation-stable-emb e) + is-double-negation-stable-emb-map-double-negation-stable-emb e = pr2 e abstract - is-emb-map-decidable-emb : + is-emb-map-double-negation-stable-emb : {l1 l2 : Level} {X : UU l1} {Y : UU l2} (e : X ↪¬¬ Y) → - is-emb (map-decidable-emb e) - is-emb-map-decidable-emb e = + is-emb (map-double-negation-stable-emb e) + is-emb-map-double-negation-stable-emb e = is-emb-is-double-negation-stable-emb - ( is-double-negation-stable-emb-map-decidable-emb e) + ( is-double-negation-stable-emb-map-double-negation-stable-emb e) abstract - is-double-negation-eliminating-map-map-decidable-emb : + is-double-negation-eliminating-map-map-double-negation-stable-emb : {l1 l2 : Level} {X : UU l1} {Y : UU l2} (e : X ↪¬¬ Y) → - is-double-negation-eliminating-map (map-decidable-emb e) - is-double-negation-eliminating-map-map-decidable-emb e = + is-double-negation-eliminating-map (map-double-negation-stable-emb e) + is-double-negation-eliminating-map-map-double-negation-stable-emb e = is-double-negation-eliminating-map-is-double-negation-stable-emb - ( is-double-negation-stable-emb-map-decidable-emb e) + ( is-double-negation-stable-emb-map-double-negation-stable-emb e) -emb-decidable-emb : +emb-double-negation-stable-emb : {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ↪¬¬ Y → X ↪ Y -pr1 (emb-decidable-emb e) = map-decidable-emb e -pr2 (emb-decidable-emb e) = is-emb-map-decidable-emb e +pr1 (emb-double-negation-stable-emb e) = map-double-negation-stable-emb e +pr2 (emb-double-negation-stable-emb e) = is-emb-map-double-negation-stable-emb e ``` ## Properties @@ -210,6 +211,25 @@ module _ ( is-double-negation-stable-prop-map-pr1) ``` +### Decidable embeddings are double negation stable + +```agda +is-double-negation-eliminating-map-is-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-decidable-emb f → is-double-negation-eliminating-map f +is-double-negation-eliminating-map-is-decidable-emb H = + is-double-negation-eliminating-map-is-decidable-map + ( is-decidable-map-is-decidable-emb H) + +abstract + is-double-negation-stable-emb-is-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-decidable-emb f → is-double-negation-stable-emb f + is-double-negation-stable-emb-is-decidable-emb H = + ( is-emb-is-decidable-emb H , + is-double-negation-eliminating-map-is-decidable-emb H) +``` + ### Equivalences are double negation stable embeddings ```agda @@ -229,8 +249,8 @@ is-double-negation-stable-emb-id : is-double-negation-stable-emb-id = ( is-emb-id , is-double-negation-eliminating-map-id) -decidable-emb-id : {l : Level} {A : UU l} → A ↪¬¬ A -decidable-emb-id = (id , is-double-negation-stable-emb-id) +double-negation-stable-emb-id : {l : Level} {A : UU l} → A ↪¬¬ A +double-negation-stable-emb-id = (id , is-double-negation-stable-emb-id) is-double-negation-stable-prop-map-id : {l : Level} {A : UU l} → is-double-negation-stable-prop-map (id {A = A}) @@ -277,14 +297,20 @@ module _ abstract is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' : - is-double-negation-stable-emb g → is-double-negation-eliminating-map f → is-double-negation-eliminating-map (g ∘ f) - is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' K H x = + is-double-negation-stable-emb g → + is-double-negation-eliminating-map f → + is-double-negation-eliminating-map (g ∘ f) + is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' + K H x = rec-coproduct ( λ u → is-decidable-equiv ( ( left-unit-law-Σ-is-contr ( is-proof-irrelevant-is-prop - ( is-prop-map-is-emb (is-emb-is-double-negation-stable-emb K) x) u) + ( is-prop-map-is-emb + ( is-emb-is-double-negation-stable-emb K) + ( x)) + ( u)) ( u)) ∘e ( compute-fiber-comp g f x)) ( H (pr1 u))) @@ -292,14 +318,18 @@ module _ ( is-double-negation-eliminating-map-is-double-negation-stable-emb K x) is-double-negation-eliminating-map-comp-is-double-negation-stable-emb : - is-double-negation-stable-emb g → is-double-negation-stable-emb f → is-double-negation-eliminating-map (g ∘ f) + is-double-negation-stable-emb g → + is-double-negation-stable-emb f → + is-double-negation-eliminating-map (g ∘ f) is-double-negation-eliminating-map-comp-is-double-negation-stable-emb K H = is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' ( K) ( is-double-negation-eliminating-map-is-double-negation-stable-emb H) is-double-negation-stable-emb-comp : - is-double-negation-stable-emb g → is-double-negation-stable-emb f → is-double-negation-stable-emb (g ∘ f) + is-double-negation-stable-emb g → + is-double-negation-stable-emb f → + is-double-negation-stable-emb (g ∘ f) is-double-negation-stable-emb-comp K H = ( is-emb-comp _ _ (pr1 K) (pr1 H) , is-double-negation-eliminating-map-comp-is-double-negation-stable-emb K H) @@ -318,13 +348,15 @@ module _ ### Left cancellation for double negation stable embeddings -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} where is-double-negation-stable-emb-right-factor' : - is-double-negation-stable-emb (g ∘ f) → is-emb g → is-double-negation-stable-emb f + is-double-negation-stable-emb (g ∘ f) → + is-emb g → + is-double-negation-stable-emb f is-double-negation-stable-emb-right-factor' GH G = ( is-emb-right-factor g f G (is-emb-is-double-negation-stable-emb GH) , is-double-negation-eliminating-map-right-factor' @@ -332,9 +364,13 @@ module _ ( is-injective-is-emb G)) is-double-negation-stable-emb-right-factor : - is-double-negation-stable-emb (g ∘ f) → is-double-negation-stable-emb g → is-double-negation-stable-emb f + is-double-negation-stable-emb (g ∘ f) → + is-double-negation-stable-emb g → + is-double-negation-stable-emb f is-double-negation-stable-emb-right-factor GH G = - is-double-negation-stable-emb-right-factor' GH (is-emb-is-double-negation-stable-emb G) + is-double-negation-stable-emb-right-factor' + ( GH) + ( is-emb-is-double-negation-stable-emb G) ``` ### In a commuting triangle of maps, if the top and right maps are double negation stable embeddings so is the left map @@ -347,16 +383,19 @@ module _ where is-double-negation-stable-emb-left-map-triangle : - is-double-negation-stable-emb top → is-double-negation-stable-emb right → is-double-negation-stable-emb left + is-double-negation-stable-emb top → + is-double-negation-stable-emb right → + is-double-negation-stable-emb left is-double-negation-stable-emb-left-map-triangle T R = - is-double-negation-stable-emb-htpy H (is-double-negation-stable-emb-comp R T) + is-double-negation-stable-emb-htpy H + ( is-double-negation-stable-emb-comp R T) ``` ### In a commuting triangle of maps, if the left and right maps are double negation stable embeddings so is the top map In fact, the right map need only be an embedding. -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {top : A → B} {left : A → C} {right : B → C} @@ -364,67 +403,78 @@ module _ where is-double-negation-stable-emb-top-map-triangle' : - is-emb right → is-double-negation-stable-emb left → is-double-negation-stable-emb top + is-emb right → + is-double-negation-stable-emb left → + is-double-negation-stable-emb top is-double-negation-stable-emb-top-map-triangle' R' L = - is-double-negation-stable-emb-right-factor' (is-double-negation-stable-emb-htpy (inv-htpy H) L) R' + is-double-negation-stable-emb-right-factor' + ( is-double-negation-stable-emb-htpy (inv-htpy H) L) + ( R') is-double-negation-stable-emb-top-map-triangle : - is-double-negation-stable-emb right → is-double-negation-stable-emb left → is-double-negation-stable-emb top + is-double-negation-stable-emb right → + is-double-negation-stable-emb left → + is-double-negation-stable-emb top is-double-negation-stable-emb-top-map-triangle R L = - is-double-negation-stable-emb-right-factor (is-double-negation-stable-emb-htpy (inv-htpy H) L) R + is-double-negation-stable-emb-right-factor + ( is-double-negation-stable-emb-htpy (inv-htpy H) L) + ( R) ``` ### Characterizing equality in the type of double negation stable embeddings -```text -htpy-decidable-emb : +```agda +htpy-double-negation-stable-emb : {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪¬¬ B) → UU (l1 ⊔ l2) -htpy-decidable-emb f g = map-decidable-emb f ~ map-decidable-emb g +htpy-double-negation-stable-emb f g = + map-double-negation-stable-emb f ~ map-double-negation-stable-emb g -refl-htpy-decidable-emb : - {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪¬¬ B) → htpy-decidable-emb f f -refl-htpy-decidable-emb f = refl-htpy +refl-htpy-double-negation-stable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪¬¬ B) → + htpy-double-negation-stable-emb f f +refl-htpy-double-negation-stable-emb f = refl-htpy -htpy-eq-decidable-emb : +htpy-eq-double-negation-stable-emb : {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪¬¬ B) → - f = g → htpy-decidable-emb f g -htpy-eq-decidable-emb f .f refl = refl-htpy-decidable-emb f + f = g → htpy-double-negation-stable-emb f g +htpy-eq-double-negation-stable-emb f .f refl = + refl-htpy-double-negation-stable-emb f abstract - is-torsorial-htpy-decidable-emb : + is-torsorial-htpy-double-negation-stable-emb : {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪¬¬ B) → - is-torsorial (htpy-decidable-emb f) - is-torsorial-htpy-decidable-emb f = + is-torsorial (htpy-double-negation-stable-emb f) + is-torsorial-htpy-double-negation-stable-emb f = is-torsorial-Eq-subtype - ( is-torsorial-htpy (map-decidable-emb f)) + ( is-torsorial-htpy (map-double-negation-stable-emb f)) ( is-prop-is-double-negation-stable-emb) - ( map-decidable-emb f) + ( map-double-negation-stable-emb f) ( refl-htpy) - ( is-double-negation-stable-emb-map-decidable-emb f) + ( is-double-negation-stable-emb-map-double-negation-stable-emb f) abstract - is-equiv-htpy-eq-decidable-emb : + is-equiv-htpy-eq-double-negation-stable-emb : {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪¬¬ B) → - is-equiv (htpy-eq-decidable-emb f g) - is-equiv-htpy-eq-decidable-emb f = + is-equiv (htpy-eq-double-negation-stable-emb f g) + is-equiv-htpy-eq-double-negation-stable-emb f = fundamental-theorem-id - ( is-torsorial-htpy-decidable-emb f) - ( htpy-eq-decidable-emb f) + ( is-torsorial-htpy-double-negation-stable-emb f) + ( htpy-eq-double-negation-stable-emb f) -eq-htpy-decidable-emb : +eq-htpy-double-negation-stable-emb : {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪¬¬ B) → - htpy-decidable-emb f g → f = g -eq-htpy-decidable-emb f g = - map-inv-is-equiv (is-equiv-htpy-eq-decidable-emb f g) + htpy-double-negation-stable-emb f g → f = g +eq-htpy-double-negation-stable-emb f g = + map-inv-is-equiv (is-equiv-htpy-eq-double-negation-stable-emb f g) ``` ### Precomposing double negation stable embeddings with equivalences ```text -equiv-precomp-decidable-emb-equiv : +equiv-precomp-double-negation-stable-emb-equiv : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) → (C : UU l3) → (B ↪¬¬ C) ≃ (A ↪¬¬ C) -equiv-precomp-decidable-emb-equiv e C = +equiv-precomp-double-negation-stable-emb-equiv e C = equiv-Σ ( is-double-negation-stable-emb) ( equiv-precomp e C) @@ -432,13 +482,16 @@ equiv-precomp-decidable-emb-equiv e C = equiv-iff-is-prop ( is-prop-is-double-negation-stable-emb g) ( is-prop-is-double-negation-stable-emb (g ∘ map-equiv e)) - ( λ H → is-double-negation-stable-emb-comp H (is-double-negation-stable-emb-is-equiv (pr2 e))) + ( λ H → + is-double-negation-stable-emb-comp H + ( is-double-negation-stable-emb-is-equiv (pr2 e))) ( λ d → is-double-negation-stable-emb-htpy ( λ b → ap g (inv (is-section-map-inv-equiv e b))) ( is-double-negation-stable-emb-comp ( d) - ( is-double-negation-stable-emb-is-equiv (is-equiv-map-inv-equiv e))))) + ( is-double-negation-stable-emb-is-equiv + ( is-equiv-map-inv-equiv e))))) ``` ### Any map out of the empty type is a double negation stable embedding @@ -447,58 +500,67 @@ equiv-precomp-decidable-emb-equiv e C = abstract is-double-negation-stable-emb-ex-falso : {l : Level} {X : UU l} → is-double-negation-stable-emb (ex-falso {l} {X}) - is-double-negation-stable-emb-ex-falso = (is-emb-ex-falso , is-double-negation-eliminating-map-ex-falso) + is-double-negation-stable-emb-ex-falso = + ( is-emb-ex-falso , is-double-negation-eliminating-map-ex-falso) -decidable-emb-ex-falso : +double-negation-stable-emb-ex-falso : {l : Level} {X : UU l} → empty ↪¬¬ X -decidable-emb-ex-falso = (ex-falso , is-double-negation-stable-emb-ex-falso) +double-negation-stable-emb-ex-falso = + ( ex-falso , is-double-negation-stable-emb-ex-falso) -decidable-emb-is-empty : +double-negation-stable-emb-is-empty : {l1 l2 : Level} {A : UU l1} {B : UU l2} → is-empty A → A ↪¬¬ B -decidable-emb-is-empty {A = A} f = +double-negation-stable-emb-is-empty {A = A} f = map-equiv - ( equiv-precomp-decidable-emb-equiv (equiv-is-empty f id) _) - ( decidable-emb-ex-falso) + ( equiv-precomp-double-negation-stable-emb-equiv (equiv-is-empty f id) _) + ( double-negation-stable-emb-ex-falso) ``` ### The map on total spaces induced by a family of double negation stable embeddings is a double negation stable embedding -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} where is-double-negation-stable-emb-tot : {f : (x : A) → B x → C x} → - ((x : A) → is-double-negation-stable-emb (f x)) → is-double-negation-stable-emb (tot f) + ((x : A) → is-double-negation-stable-emb (f x)) → + is-double-negation-stable-emb (tot f) is-double-negation-stable-emb-tot H = - ( is-emb-tot (λ x → is-emb-is-double-negation-stable-emb (H x)) , - is-double-negation-eliminating-map-tot (λ x → is-double-negation-eliminating-map-is-double-negation-stable-emb (H x))) - - decidable-emb-tot : ((x : A) → B x ↪¬¬ C x) → Σ A B ↪¬¬ Σ A C - decidable-emb-tot f = - ( tot (λ x → map-decidable-emb (f x)) , - is-double-negation-stable-emb-tot (λ x → is-double-negation-stable-emb-map-decidable-emb (f x))) + ( is-emb-tot (is-emb-is-double-negation-stable-emb ∘ H) , + is-double-negation-eliminating-map-tot + ( is-double-negation-eliminating-map-is-double-negation-stable-emb ∘ H)) + + double-negation-stable-emb-tot : ((x : A) → B x ↪¬¬ C x) → Σ A B ↪¬¬ Σ A C + double-negation-stable-emb-tot f = + ( tot (map-double-negation-stable-emb ∘ f) , + is-double-negation-stable-emb-tot + ( is-double-negation-stable-emb-map-double-negation-stable-emb ∘ f)) ``` ### The map on total spaces induced by a double negation stable embedding on the base is a double negation stable embedding -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) where is-double-negation-stable-emb-map-Σ-map-base : - {f : A → B} → is-double-negation-stable-emb f → is-double-negation-stable-emb (map-Σ-map-base f C) - is-double-negation-stable-emb-map-Σ-map-base {f} H = + {f : A → B} → + is-double-negation-stable-emb f → + is-double-negation-stable-emb (map-Σ-map-base f C) + is-double-negation-stable-emb-map-Σ-map-base H = ( is-emb-map-Σ-map-base C (is-emb-is-double-negation-stable-emb H) , - is-double-negation-eliminating-map-Σ-map-base C (is-double-negation-eliminating-map-is-double-negation-stable-emb H)) - - decidable-emb-map-Σ-map-base : - (f : A ↪¬¬ B) → Σ A (C ∘ map-decidable-emb f) ↪¬¬ Σ B C - decidable-emb-map-Σ-map-base f = - ( map-Σ-map-base (map-decidable-emb f) C , - is-double-negation-stable-emb-map-Σ-map-base ((is-double-negation-stable-emb-map-decidable-emb f))) + is-double-negation-eliminating-map-Σ-map-base C + ( is-double-negation-eliminating-map-is-double-negation-stable-emb H)) + + double-negation-stable-emb-map-Σ-map-base : + (f : A ↪¬¬ B) → Σ A (C ∘ map-double-negation-stable-emb f) ↪¬¬ Σ B C + double-negation-stable-emb-map-Σ-map-base f = + ( map-Σ-map-base (map-double-negation-stable-emb f) C , + is-double-negation-stable-emb-map-Σ-map-base + ( is-double-negation-stable-emb-map-double-negation-stable-emb f)) ``` ### The functoriality of dependent pair types preserves double negation stable embeddings @@ -519,39 +581,44 @@ module _ ( is-double-negation-stable-emb-tot G) ( is-double-negation-stable-emb-map-Σ-map-base D F) - decidable-emb-Σ : + double-negation-stable-emb-Σ : (f : A ↪¬¬ B) → - ((x : A) → C x ↪¬¬ D (map-decidable-emb f x)) → + ((x : A) → C x ↪¬¬ D (map-double-negation-stable-emb f x)) → Σ A C ↪¬¬ Σ B D - decidable-emb-Σ f g = - ( ( map-Σ D (map-decidable-emb f) (λ x → map-decidable-emb (g x))) , + double-negation-stable-emb-Σ f g = + ( ( map-Σ D + ( map-double-negation-stable-emb f) + ( map-double-negation-stable-emb ∘ g)) , ( is-double-negation-stable-emb-map-Σ - ( is-double-negation-stable-emb-map-decidable-emb f) - ( λ x → is-double-negation-stable-emb-map-decidable-emb (g x)))) + ( is-double-negation-stable-emb-map-double-negation-stable-emb f) + ( is-double-negation-stable-emb-map-double-negation-stable-emb ∘ g))) ``` ### Products of double negation stable embeddings are double negation stable embeddings -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} where is-double-negation-stable-emb-map-product : {f : A → B} {g : C → D} → - is-double-negation-stable-emb f → is-double-negation-stable-emb g → is-double-negation-stable-emb (map-product f g) + is-double-negation-stable-emb f → + is-double-negation-stable-emb g → + is-double-negation-stable-emb (map-product f g) is-double-negation-stable-emb-map-product (eF , dF) (eG , dG) = - ( is-emb-map-product eF eG , is-double-negation-eliminating-map-product dF dG) + ( is-emb-map-product eF eG , + is-double-negation-eliminating-map-product dF dG) - decidable-emb-product : + double-negation-stable-emb-product : A ↪¬¬ B → C ↪¬¬ D → A × C ↪¬¬ B × D - decidable-emb-product (f , F) (g , G) = - (map-product f g , is-double-negation-stable-emb-map-product F G) + double-negation-stable-emb-product (f , F) (g , G) = + ( map-product f g , is-double-negation-stable-emb-map-product F G) ``` ### Coproducts of double negation stable embeddings are double negation stable embeddings -```text +```agda module _ {l1 l2 l1' l2' : Level} {A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'} where @@ -564,27 +631,32 @@ abstract is-double-negation-stable-emb f → is-double-negation-stable-emb g → is-double-negation-stable-emb (map-coproduct f g) - is-double-negation-stable-emb-map-coproduct {f = f} {g} (eF , dF) (eG , dG) = - ( is-emb-map-coproduct eF eG , is-double-negation-eliminating-map-coproduct dF dG) + is-double-negation-stable-emb-map-coproduct (eF , dF) (eG , dG) = + ( is-emb-map-coproduct eF eG , + is-double-negation-eliminating-map-coproduct dF dG) ``` ### Double negation stable embeddings are closed under base change -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} {f : A → B} {g : C → D} where is-double-negation-stable-prop-map-base-change : - cartesian-hom-arrow g f → is-double-negation-stable-prop-map f → is-double-negation-stable-prop-map g + cartesian-hom-arrow g f → + is-double-negation-stable-prop-map f → + is-double-negation-stable-prop-map g is-double-negation-stable-prop-map-base-change α F d = is-double-negation-stable-prop-equiv ( equiv-fibers-cartesian-hom-arrow g f α d) ( F (map-codomain-cartesian-hom-arrow g f α d)) is-double-negation-stable-emb-base-change : - cartesian-hom-arrow g f → is-double-negation-stable-emb f → is-double-negation-stable-emb g + cartesian-hom-arrow g f → + is-double-negation-stable-emb f → + is-double-negation-stable-emb g is-double-negation-stable-emb-base-change α F = is-double-negation-stable-emb-is-double-negation-stable-prop-map ( is-double-negation-stable-prop-map-base-change α @@ -593,60 +665,67 @@ module _ ### Double negation stable embeddings are closed under retracts of maps -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} {f : A → B} {g : X → Y} where is-double-negation-stable-prop-map-retract-map : - f retract-of-map g → is-double-negation-stable-prop-map g → is-double-negation-stable-prop-map f + f retract-of-map g → + is-double-negation-stable-prop-map g → + is-double-negation-stable-prop-map f is-double-negation-stable-prop-map-retract-map R G x = - is-double-negation-stable-prop-retract-of + is-double-negation-stable-prop-retract ( retract-fiber-retract-map f g R x) ( G (map-codomain-inclusion-retract-map f g R x)) is-double-negation-stable-emb-retract-map : - f retract-of-map g → is-double-negation-stable-emb g → is-double-negation-stable-emb f + f retract-of-map g → + is-double-negation-stable-emb g → + is-double-negation-stable-emb f is-double-negation-stable-emb-retract-map R G = is-double-negation-stable-emb-is-double-negation-stable-prop-map ( is-double-negation-stable-prop-map-retract-map R ( is-double-negation-stable-prop-map-is-double-negation-stable-emb G)) ``` -### A type is a decidable proposition if and only if its terminal map is a double negation stable embedding +### A type is a double negation stable proposition if and only if its terminal map is a double negation stable embedding -```text +```agda module _ {l : Level} {A : UU l} where is-double-negation-stable-prop-is-double-negation-stable-emb-terminal-map : - is-double-negation-stable-emb (terminal-map A) → is-double-negation-stable-prop A + is-double-negation-stable-emb (terminal-map A) → + is-double-negation-stable-prop A is-double-negation-stable-prop-is-double-negation-stable-emb-terminal-map H = is-double-negation-stable-prop-equiv' ( equiv-fiber-terminal-map star) ( is-double-negation-stable-prop-map-is-double-negation-stable-emb H star) is-double-negation-stable-emb-terminal-map-is-double-negation-stable-prop : - is-double-negation-stable-prop A → is-double-negation-stable-emb (terminal-map A) + is-double-negation-stable-prop A → + is-double-negation-stable-emb (terminal-map A) is-double-negation-stable-emb-terminal-map-is-double-negation-stable-prop H = is-double-negation-stable-emb-is-double-negation-stable-prop-map - ( λ y → is-double-negation-stable-prop-equiv (equiv-fiber-terminal-map y) H) + ( λ y → + is-double-negation-stable-prop-equiv (equiv-fiber-terminal-map y) H) ``` ### If a dependent sum of propositions over a proposition is decidable, then the family is a family of decidable propositions -```text +```agda module _ {l1 l2 : Level} (P : Prop l1) (Q : type-Prop P → Prop l2) where - is-double-negation-stable-prop-family-is-decidable-Σ : - is-decidable (Σ (type-Prop P) (type-Prop ∘ Q)) → - (p : type-Prop P) → is-decidable (type-Prop (Q p)) - is-double-negation-stable-prop-family-is-decidable-Σ H p = - is-decidable-equiv' + is-double-negation-stable-prop-family-has-double-negation-elim-Σ : + has-double-negation-elim (Σ (type-Prop P) (type-Prop ∘ Q)) → + (p : type-Prop P) → has-double-negation-elim (type-Prop (Q p)) + is-double-negation-stable-prop-family-has-double-negation-elim-Σ H p = + has-double-negation-elim-equiv' ( equiv-fiber-pr1 (type-Prop ∘ Q) p) ( is-double-negation-eliminating-map-is-double-negation-stable-emb ( is-double-negation-stable-emb-right-factor' diff --git a/src/foundation/double-negation-stable-propositions.lagda.md b/src/foundation/double-negation-stable-propositions.lagda.md index f27c319bf9..7cbda3edd4 100644 --- a/src/foundation/double-negation-stable-propositions.lagda.md +++ b/src/foundation/double-negation-stable-propositions.lagda.md @@ -168,7 +168,7 @@ module _ ```agda empty-Double-Negation-Stable-Prop : Double-Negation-Stable-Prop lzero empty-Double-Negation-Stable-Prop = - empty , is-prop-empty , double-negation-elim-empty + ( empty , is-prop-empty , double-negation-elim-empty) ``` ### The unit proposition is double negation stable @@ -176,7 +176,7 @@ empty-Double-Negation-Stable-Prop = ```agda unit-Double-Negation-Stable-Prop : Double-Negation-Stable-Prop lzero unit-Double-Negation-Stable-Prop = - unit , is-prop-unit , double-negation-elim-unit + ( unit , is-prop-unit , double-negation-elim-unit) ``` ```agda From 215cff5ec3dd0d5952d5adb5baffe34609ddb595 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 03:00:23 +0200 Subject: [PATCH 14/83] wip double negation stable embeddings --- ...double-negation-stable-embeddings.lagda.md | 101 +++++++++--------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/src/foundation/double-negation-stable-embeddings.lagda.md b/src/foundation/double-negation-stable-embeddings.lagda.md index 82e13d759c..62204253d4 100644 --- a/src/foundation/double-negation-stable-embeddings.lagda.md +++ b/src/foundation/double-negation-stable-embeddings.lagda.md @@ -24,6 +24,7 @@ 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 @@ -289,61 +290,65 @@ abstract ### Double negation stable embeddings are closed under composition -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {g : B → C} {f : A → B} where - abstract - is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' : - is-double-negation-stable-emb g → - is-double-negation-eliminating-map f → - is-double-negation-eliminating-map (g ∘ f) - is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' - K H x = - rec-coproduct - ( λ u → - is-decidable-equiv - ( ( left-unit-law-Σ-is-contr - ( is-proof-irrelevant-is-prop - ( is-prop-map-is-emb - ( is-emb-is-double-negation-stable-emb K) - ( x)) - ( u)) - ( u)) ∘e - ( compute-fiber-comp g f x)) - ( H (pr1 u))) - ( λ α → inr (λ t → α (f (pr1 t) , pr2 t))) - ( is-double-negation-eliminating-map-is-double-negation-stable-emb K x) - - is-double-negation-eliminating-map-comp-is-double-negation-stable-emb : - is-double-negation-stable-emb g → - is-double-negation-stable-emb f → - is-double-negation-eliminating-map (g ∘ f) - is-double-negation-eliminating-map-comp-is-double-negation-stable-emb K H = - is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' - ( K) - ( is-double-negation-eliminating-map-is-double-negation-stable-emb H) + -- abstract + -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' : + -- is-double-negation-stable-emb g → + -- is-double-negation-eliminating-map f → + -- is-double-negation-eliminating-map (g ∘ f) + -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' + -- K H z nngfz = + -- map-inv-compute-fiber-comp g f z + -- ( is-double-negation-eliminating-map-is-double-negation-stable-emb K z + -- ( λ x → nngfz λ w → x (f (pr1 w) , pr2 w)) , + -- H (pr1 (pr2 K z (λ x → nngfz (λ w → x (f (pr1 w) , pr2 w))))) λ x → x ({! !} , {! !})) + -- rec-coproduct + -- ( λ u → + -- is-decidable-equiv + -- ( ( left-unit-law-Σ-is-contr + -- ( is-proof-irrelevant-is-prop + -- ( is-prop-map-is-emb + -- ( is-emb-is-double-negation-stable-emb K) + -- ( x)) + -- ( u)) + -- ( u)) ∘e + -- ( compute-fiber-comp g f x)) + -- ( H (pr1 u))) + -- ( λ α → inr (λ t → α (f (pr1 t) , pr2 t))) + -- ( is-double-negation-eliminating-map-is-double-negation-stable-emb K x) + + -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb : + -- is-double-negation-stable-emb g → + -- is-double-negation-stable-emb f → + -- is-double-negation-eliminating-map (g ∘ f) + -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb K H = + -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' + -- ( K) + -- ( is-double-negation-eliminating-map-is-double-negation-stable-emb H) + + is-double-negation-stable-prop-map-comp : + is-double-negation-stable-prop-map g → + is-double-negation-stable-prop-map f → + is-double-negation-stable-prop-map (g ∘ f) + is-double-negation-stable-prop-map-comp K H z = + is-double-negation-stable-prop-equiv + ( compute-fiber-comp g f z) + ( is-double-negation-stable-prop-Σ (K z) (H ∘ pr1)) is-double-negation-stable-emb-comp : is-double-negation-stable-emb g → is-double-negation-stable-emb f → is-double-negation-stable-emb (g ∘ f) is-double-negation-stable-emb-comp K H = - ( is-emb-comp _ _ (pr1 K) (pr1 H) , - is-double-negation-eliminating-map-comp-is-double-negation-stable-emb K H) - - abstract - is-double-negation-stable-prop-map-comp : - is-double-negation-stable-prop-map g → - is-double-negation-stable-prop-map f → - is-double-negation-stable-prop-map (g ∘ f) - is-double-negation-stable-prop-map-comp K H = - is-double-negation-stable-prop-map-is-double-negation-stable-emb - ( is-double-negation-stable-emb-comp - ( is-double-negation-stable-emb-is-double-negation-stable-prop-map K) - ( is-double-negation-stable-emb-is-double-negation-stable-prop-map H)) + is-double-negation-stable-emb-is-double-negation-stable-prop-map + ( is-double-negation-stable-prop-map-comp + ( is-double-negation-stable-prop-map-is-double-negation-stable-emb K) + ( is-double-negation-stable-prop-map-is-double-negation-stable-emb H)) ``` ### Left cancellation for double negation stable embeddings @@ -375,7 +380,7 @@ module _ ### In a commuting triangle of maps, if the top and right maps are double negation stable embeddings so is the left map -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {top : A → B} {left : A → C} {right : B → C} @@ -470,7 +475,7 @@ eq-htpy-double-negation-stable-emb f g = ### Precomposing double negation stable embeddings with equivalences -```text +```agda equiv-precomp-double-negation-stable-emb-equiv : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) → (C : UU l3) → (B ↪¬¬ C) ≃ (A ↪¬¬ C) @@ -496,7 +501,7 @@ equiv-precomp-double-negation-stable-emb-equiv e C = ### Any map out of the empty type is a double negation stable embedding -```text +```agda abstract is-double-negation-stable-emb-ex-falso : {l : Level} {X : UU l} → is-double-negation-stable-emb (ex-falso {l} {X}) @@ -565,7 +570,7 @@ module _ ### The functoriality of dependent pair types preserves double negation stable embeddings -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : A → UU l3} (D : B → UU l4) where From 06c3ca7cc4987ac441643df531a2c98fb10a84b3 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 03:09:00 +0200 Subject: [PATCH 15/83] just edits --- .../double-negation-eliminating-maps.lagda.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/foundation/double-negation-eliminating-maps.lagda.md b/src/foundation/double-negation-eliminating-maps.lagda.md index 9e764ea273..28663911fa 100644 --- a/src/foundation/double-negation-eliminating-maps.lagda.md +++ b/src/foundation/double-negation-eliminating-maps.lagda.md @@ -37,12 +37,21 @@ open import foundation-core.homotopies -## Definition +## Idea A [map](foundation-core.function-types.md) is said to be {{#concept "double negation eliminating" Disambiguation="map of types" Agda=is-double-negation-eliminating-map}} if its [fibers](foundation-core.fibers-of-maps.md) satisfy [untruncated double negation elimination](foundation.untruncated-double-negation-elimination.md). +I.e., for every `y : B`, if `fiber f y` is +[irrefutable](foundation.irrefutable-propositions.md), then we do in fact have +an element of the fiber `p : fiber f y`. So we have a map + +```text + (y : B) → ¬¬ (fiber f y) → fiber f y. +``` + +## Definintion ```agda module _ @@ -240,12 +249,12 @@ module _ {f : A → B} {g : X → Y} where - has-double-negation-elim-retract-map : + is-double-negation-eliminating-retract-map : f retract-of-map g → is-double-negation-eliminating-map g → is-double-negation-eliminating-map f - has-double-negation-elim-retract-map R G x = - has-double-negation-elim-iff - ( iff-retract (retract-fiber-retract-map f g R x)) + is-double-negation-eliminating-retract-map R G x = + has-double-negation-elim-retract + ( retract-fiber-retract-map f g R x) ( G (map-codomain-inclusion-retract-map f g R x)) ``` From d06ea12b680120f737579723c79016a636679313 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 13:16:58 +0200 Subject: [PATCH 16/83] constructive analysis of perfect images --- ...cantor-schroder-bernstein-escardo.lagda.md | 219 +++++++------ .../irrefutable-propositions.lagda.md | 1 + src/foundation/perfect-images.lagda.md | 299 ++++++++++++++---- 3 files changed, 337 insertions(+), 182 deletions(-) diff --git a/src/foundation/cantor-schroder-bernstein-escardo.lagda.md b/src/foundation/cantor-schroder-bernstein-escardo.lagda.md index 0b731f760f..6e6efbc522 100644 --- a/src/foundation/cantor-schroder-bernstein-escardo.lagda.md +++ b/src/foundation/cantor-schroder-bernstein-escardo.lagda.md @@ -53,124 +53,119 @@ type-Cantor-Schröder-Bernstein-Escardó l1 l2 = ```agda module _ {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) + {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) where - module _ - {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) + map-Cantor-Schröder-Bernstein-Escardó' : + (x : X) → is-decidable (is-perfect-image (map-emb f) (map-emb g) x) → Y + map-Cantor-Schröder-Bernstein-Escardó' x (inl y) = + inverse-of-perfect-image x y + map-Cantor-Schröder-Bernstein-Escardó' x (inr y) = + map-emb f x + + map-Cantor-Schröder-Bernstein-Escardó : X → Y + map-Cantor-Schröder-Bernstein-Escardó x = + map-Cantor-Schröder-Bernstein-Escardó' x + ( is-decidable-is-perfect-image-is-emb-LEM lem (is-emb-map-emb g) x) + + is-injective-map-Cantor-Schröder-Bernstein-Escardó : + is-injective map-Cantor-Schröder-Bernstein-Escardó + is-injective-map-Cantor-Schröder-Bernstein-Escardó {x} {x'} = + l (is-decidable-is-perfect-image-is-emb-LEM lem (is-emb-map-emb g) x) + (is-decidable-is-perfect-image-is-emb-LEM lem (is-emb-map-emb g) x') where - - map-Cantor-Schröder-Bernstein-Escardó' : - (x : X) → is-decidable (is-perfect-image (map-emb f) (map-emb g) x) → Y - map-Cantor-Schröder-Bernstein-Escardó' x (inl y) = - inverse-of-perfect-image x y - map-Cantor-Schröder-Bernstein-Escardó' x (inr y) = - map-emb f x - - map-Cantor-Schröder-Bernstein-Escardó : - X → Y - map-Cantor-Schröder-Bernstein-Escardó x = - map-Cantor-Schröder-Bernstein-Escardó' x - ( is-decidable-is-perfect-image-is-emb (is-emb-map-emb g) lem x) - - is-injective-map-Cantor-Schröder-Bernstein-Escardó : - is-injective map-Cantor-Schröder-Bernstein-Escardó - is-injective-map-Cantor-Schröder-Bernstein-Escardó {x} {x'} = - l (is-decidable-is-perfect-image-is-emb (is-emb-map-emb g) lem x) - (is-decidable-is-perfect-image-is-emb (is-emb-map-emb g) lem x') + l : + (d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) + (d' : is-decidable (is-perfect-image (map-emb f) (map-emb g) x')) → + ( map-Cantor-Schröder-Bernstein-Escardó' x d) = + ( map-Cantor-Schröder-Bernstein-Escardó' x' d') → + x = x' + l (inl ρ) (inl ρ') p = + ( inv (is-section-inverse-of-perfect-image x ρ)) ∙ + ( ap (map-emb g) p ∙ is-section-inverse-of-perfect-image x' ρ') + l (inl ρ) (inr nρ') p = + ex-falso (perfect-image-has-distinct-image x' x nρ' ρ (inv p)) + l (inr nρ) (inl ρ') p = + ex-falso (perfect-image-has-distinct-image x x' nρ ρ' p) + l (inr nρ) (inr nρ') p = + is-injective-is-emb (is-emb-map-emb f) p + + is-split-surjective-map-Cantor-Schröder-Bernstein-Escardó : + is-split-surjective map-Cantor-Schröder-Bernstein-Escardó + is-split-surjective-map-Cantor-Schröder-Bernstein-Escardó y = + pair x p + where + a : + is-decidable + ( is-perfect-image (map-emb f) (map-emb g) (map-emb g y)) → + Σ ( X) + ( λ x → + ( (d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) → + map-Cantor-Schröder-Bernstein-Escardó' x d = y)) + a (inl γ) = + pair (map-emb g y) ψ where - l : - (d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) - (d' : is-decidable (is-perfect-image (map-emb f) (map-emb g) x')) → - ( map-Cantor-Schröder-Bernstein-Escardó' x d) = - ( map-Cantor-Schröder-Bernstein-Escardó' x' d') → - x = x' - l (inl ρ) (inl ρ') p = - inv (is-section-inverse-of-perfect-image x ρ) ∙ - (ap (map-emb g) p ∙ is-section-inverse-of-perfect-image x' ρ') - l (inl ρ) (inr nρ') p = - ex-falso (perfect-image-has-distinct-image x' x nρ' ρ (inv p)) - l (inr nρ) (inl ρ') p = - ex-falso (perfect-image-has-distinct-image x x' nρ ρ' p) - l (inr nρ) (inr nρ') p = - is-injective-is-emb (is-emb-map-emb f) p - - is-split-surjective-map-Cantor-Schröder-Bernstein-Escardó : - is-split-surjective map-Cantor-Schröder-Bernstein-Escardó - is-split-surjective-map-Cantor-Schröder-Bernstein-Escardó y = - pair x p + ψ : + ( d : + is-decidable + ( is-perfect-image (map-emb f) (map-emb g) (map-emb g y))) → + map-Cantor-Schröder-Bernstein-Escardó' (map-emb g y) d = y + ψ (inl v') = + is-retraction-inverse-of-perfect-image + { is-emb-g = is-emb-map-emb g} + ( y) + ( v') + ψ (inr v) = ex-falso (v γ) + a (inr γ) = + pair x ψ where - a : - is-decidable - ( is-perfect-image (map-emb f) (map-emb g) (map-emb g y)) → - Σ ( X) - ( λ x → - ( (d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) → - map-Cantor-Schröder-Bernstein-Escardó' x d = y)) - a (inl γ) = - pair (map-emb g y) ψ - where - ψ : - ( d : - is-decidable - ( is-perfect-image (map-emb f) (map-emb g) (map-emb g y))) → - map-Cantor-Schröder-Bernstein-Escardó' (map-emb g y) d = y - ψ (inl v') = - is-retraction-inverse-of-perfect-image - { is-emb-g = is-emb-map-emb g} - ( y) - ( v') - ψ (inr v) = ex-falso (v γ) - a (inr γ) = - pair x ψ - where - w : - Σ ( fiber (map-emb f) y) - ( λ s → ¬ (is-perfect-image (map-emb f) (map-emb g) (pr1 s))) - w = - not-perfect-image-has-not-perfect-fiber - ( is-emb-map-emb f) - ( is-emb-map-emb g) - ( lem) - ( y) - ( γ) - x : X - x = pr1 (pr1 w) - p : map-emb f x = y - p = pr2 (pr1 w) - ψ : - ( d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) → - map-Cantor-Schröder-Bernstein-Escardó' x d = y - ψ (inl v) = ex-falso ((pr2 w) v) - ψ (inr v) = p - b : - Σ ( X) - ( λ x → - ( (d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) → - map-Cantor-Schröder-Bernstein-Escardó' x d = y)) - b = - a ( is-decidable-is-perfect-image-is-emb - ( is-emb-map-emb g) - ( lem) - ( map-emb g y)) + w : + Σ ( fiber (map-emb f) y) + ( λ s → ¬ (is-perfect-image (map-emb f) (map-emb g) (pr1 s))) + w = + has-not-perfect-fiber-is-not-perfect-image-LEM lem + ( is-emb-map-emb f) + ( is-emb-map-emb g) + ( y) + ( γ) x : X - x = pr1 b - p : map-Cantor-Schröder-Bernstein-Escardó x = y - p = pr2 b (is-decidable-is-perfect-image-is-emb (is-emb-map-emb g) lem x) - - is-equiv-map-Cantor-Schröder-Bernstein-Escardó : - is-equiv map-Cantor-Schröder-Bernstein-Escardó - is-equiv-map-Cantor-Schröder-Bernstein-Escardó = - is-equiv-is-split-surjective-is-injective - map-Cantor-Schröder-Bernstein-Escardó - is-injective-map-Cantor-Schröder-Bernstein-Escardó - is-split-surjective-map-Cantor-Schröder-Bernstein-Escardó - - Cantor-Schröder-Bernstein-Escardó : - type-Cantor-Schröder-Bernstein-Escardó l1 l2 - pr1 (Cantor-Schröder-Bernstein-Escardó f g) = - map-Cantor-Schröder-Bernstein-Escardó f g - pr2 (Cantor-Schröder-Bernstein-Escardó f g) = - is-equiv-map-Cantor-Schröder-Bernstein-Escardó f g + x = pr1 (pr1 w) + p : map-emb f x = y + p = pr2 (pr1 w) + ψ : + ( d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) → + map-Cantor-Schröder-Bernstein-Escardó' x d = y + ψ (inl v) = ex-falso ((pr2 w) v) + ψ (inr v) = p + b : + Σ ( X) + ( λ x → + ( (d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) → + map-Cantor-Schröder-Bernstein-Escardó' x d = y)) + b = + a ( is-decidable-is-perfect-image-is-emb-LEM lem + ( is-emb-map-emb g) + ( map-emb g y)) + x : X + x = pr1 b + p : map-Cantor-Schröder-Bernstein-Escardó x = y + p = + pr2 b (is-decidable-is-perfect-image-is-emb-LEM lem (is-emb-map-emb g) x) + + is-equiv-map-Cantor-Schröder-Bernstein-Escardó : + is-equiv map-Cantor-Schröder-Bernstein-Escardó + is-equiv-map-Cantor-Schröder-Bernstein-Escardó = + is-equiv-is-split-surjective-is-injective + map-Cantor-Schröder-Bernstein-Escardó + is-injective-map-Cantor-Schröder-Bernstein-Escardó + is-split-surjective-map-Cantor-Schröder-Bernstein-Escardó + +Cantor-Schröder-Bernstein-Escardó : + {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) → + type-Cantor-Schröder-Bernstein-Escardó l1 l2 +Cantor-Schröder-Bernstein-Escardó lem f g = + ( map-Cantor-Schröder-Bernstein-Escardó lem f g , + is-equiv-map-Cantor-Schröder-Bernstein-Escardó lem f g) ``` ## Corollaries diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md index 2ad9b6b22d..e1686a8e68 100644 --- a/src/foundation/irrefutable-propositions.lagda.md +++ b/src/foundation/irrefutable-propositions.lagda.md @@ -17,6 +17,7 @@ open import foundation.negation open import foundation.subuniverses open import foundation.unit-type open import foundation.universe-levels +open import foundation.untruncated-double-negation-elimination open import foundation-core.propositions ``` diff --git a/src/foundation/perfect-images.lagda.md b/src/foundation/perfect-images.lagda.md index 73b8c53e54..fcc532f10b 100644 --- a/src/foundation/perfect-images.lagda.md +++ b/src/foundation/perfect-images.lagda.md @@ -10,20 +10,28 @@ module foundation.perfect-images where open import elementary-number-theory.natural-numbers open import foundation.action-on-identifications-functions +open import foundation.decidable-maps open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation +open import foundation.double-negation-eliminating-maps +open import foundation.double-negation-stable-propositions +open import foundation.functoriality-dependent-function-types open import foundation.iterated-dependent-product-types open import foundation.iterating-functions open import foundation.law-of-excluded-middle open import foundation.negated-equality open import foundation.negation +open import foundation.type-arithmetic-dependent-function-types +open import foundation.universal-property-dependent-pair-types open import foundation.universe-levels +open import foundation.untruncated-double-negation-elimination open import foundation-core.cartesian-product-types open import foundation-core.coproduct-types open import foundation-core.embeddings open import foundation-core.empty-types +open import foundation-core.equivalences open import foundation-core.fibers-of-maps open import foundation-core.function-types open import foundation-core.identity-types @@ -49,7 +57,9 @@ We say `a₀` is an {{#concept "origin"}} for `a`, and `a` is a {{#concept "perfect image" Agda=is-perfect-image}} for `g` if any origin of `a` is in the [image](foundation.images.md) of `g`. -## Definition +## Definitions + +### Perfect images ```agda module _ @@ -58,17 +68,82 @@ module _ is-perfect-image : (a : A) → UU (l1 ⊔ l2) is-perfect-image a = - (a₀ : A) (n : ℕ) → (iterate n (g ∘ f)) a₀ = a → fiber g a₀ + (a₀ : A) (n : ℕ) → iterate n (g ∘ f) a₀ = a → fiber g a₀ +``` + +An alternative but equivalent definition. + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) (g : B → A) + where + + is-perfect-image' : (a : A) → UU (l1 ⊔ l2) + is-perfect-image' a = + (n : ℕ) → (p : fiber (iterate n (g ∘ f)) a) → fiber g (pr1 p) + + equiv-is-perfect-image-is-perfect-image' : + (a : A) → + is-perfect-image' a ≃ + is-perfect-image f g a + equiv-is-perfect-image-is-perfect-image' a = + equivalence-reasoning + ((n : ℕ) (p : fiber (iterate n (g ∘ f)) a) → fiber g (pr1 p)) + ≃ ((n : ℕ) (a₀ : A) → iterate n (g ∘ f) a₀ = a → fiber g a₀) + by equiv-Π-equiv-family (λ n → equiv-ev-pair) + ≃ ((a₀ : A) (n : ℕ) → iterate n (g ∘ f) a₀ = a → fiber g a₀) + by equiv-swap-Π +``` + +### Nonperfect images + +We can talk about origins of `a` which are not images of `g`. + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + where + + is-nonperfect-image : (a : A) → UU (l1 ⊔ l2) + is-nonperfect-image a = + Σ A (λ a₀ → Σ ℕ (λ n → (iterate n (g ∘ f) a₀ = a) × ¬ (fiber g a₀))) +``` + +### Not perfect fibers over an element + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + (f : A → B) (g : B → A) + where + + has-not-perfect-fiber : (b : B) → UU (l1 ⊔ l2) + has-not-perfect-fiber b = + Σ (fiber f b) (λ s → ¬ (is-perfect-image f g (pr1 s))) + + is-prop-has-not-perfect-fiber' : + is-prop-map f → (b : B) → is-prop (has-not-perfect-fiber b) + is-prop-has-not-perfect-fiber' F b = is-prop-Σ (F b) (λ _ → is-prop-neg) + + is-prop-has-not-perfect-fiber : + is-emb f → (b : B) → is-prop (has-not-perfect-fiber b) + is-prop-has-not-perfect-fiber F = + is-prop-has-not-perfect-fiber' (is-prop-map-is-emb F) + + has-not-perfect-fiber-Prop' : + is-prop-map f → (b : B) → Prop (l1 ⊔ l2) + has-not-perfect-fiber-Prop' F b = + ( has-not-perfect-fiber b , is-prop-has-not-perfect-fiber' F b) + + has-not-perfect-fiber-Prop : + is-emb f → (b : B) → Prop (l1 ⊔ l2) + has-not-perfect-fiber-Prop F b = + ( has-not-perfect-fiber b , is-prop-has-not-perfect-fiber F b) ``` ## Properties -If `g` is an [embedding](foundation-core.embeddings.md), then -`is-perfect-image a` is a [proposition](foundation-core.propositions.md). In -this case, if we assume the -[law of exluded middle](foundation.law-of-excluded-middle.md), we can show -`is-perfect-image a` is a [decidable type](foundation.decidable-types.md) for -any `a : A`. +TODO: prose here ```agda module _ @@ -84,11 +159,6 @@ module _ is-perfect-image-Prop : A → Prop (l1 ⊔ l2) pr1 (is-perfect-image-Prop a) = is-perfect-image f g a pr2 (is-perfect-image-Prop a) = is-prop-is-perfect-image-is-emb a - - is-decidable-is-perfect-image-is-emb : - LEM (l1 ⊔ l2) → (a : A) → is-decidable (is-perfect-image f g a) - is-decidable-is-perfect-image-is-emb lem a = - lem (is-perfect-image-Prop a) ``` If `a` is a perfect image for `g`, then `a` has a preimage under `g`. Just take @@ -116,7 +186,7 @@ module _ where inverse-of-perfect-image : - (a : A) → (is-perfect-image f g a) → B + (a : A) → is-perfect-image f g a → B inverse-of-perfect-image a ρ = pr1 (is-perfect-image-is-fiber a ρ) @@ -165,7 +235,9 @@ module _ where perfect-image-has-distinct-image : - (a a₀ : A) → ¬ (is-perfect-image f g a) → (ρ : is-perfect-image f g a₀) → + (a a₀ : A) → + ¬ (is-perfect-image f g a) → + (ρ : is-perfect-image f g a₀) → f a ≠ inverse-of-perfect-image a₀ ρ perfect-image-has-distinct-image a a₀ nρ ρ p = v ρ @@ -177,39 +249,152 @@ module _ s = λ η → nρ (previous-perfect-image a η) v : ¬ (is-perfect-image f g a₀) - v = tr (λ _ → ¬ (is-perfect-image f g _)) q s + v = tr (λ a' → ¬ (is-perfect-image f g a')) q s ``` -Using the property above, we can talk about origins of `a` which are not images -of `g`. +### The constructive story + +If we assume that `g` is a double negation eliminating map, we can prove that if +`is-nonperfect-image a` does not hold, we have `is-perfect-image a`. ```agda module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + {l1 l2 : Level} {A : UU l1} {B : UU l2} + {f : A → B} {g : B → A} (G : is-double-negation-eliminating-map g) where - is-not-perfect-image : (a : A) → UU (l1 ⊔ l2) - is-not-perfect-image a = - Σ A (λ a₀ → (Σ ℕ (λ n → ((iterate n (g ∘ f)) a₀ = a) × ¬ (fiber g a₀)))) + double-negation-elim-is-perfect-image : + (a : A) → ¬ (is-nonperfect-image a) → is-perfect-image f g a + double-negation-elim-is-perfect-image a nρ a₀ n p = + G a₀ (λ a₁ → nρ (a₀ , n , p , a₁)) ``` -If we assume the law of excluded middle and `g` is an embedding, we can prove -that if `is-not-perfect-image a` does not hold, we have `is-perfect-image a`. +The following property states that if `g (b)` is not a perfect image, then `b` +has an `f` fiber `a` that is not a perfect image for `g`. Again, we need to +assume law of excluded middle and that both `g` and `f` are embedding. ```agda module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} + {f : A → B} {g : B → A} + (G : is-double-negation-eliminating-map g) + (b : B) + (nρ : ¬ (is-perfect-image f g (g b))) + where + + not-not-is-nonperfect-image : ¬¬ (is-nonperfect-image {f = f} (g b)) + not-not-is-nonperfect-image nμ = + nρ (double-negation-elim-is-perfect-image G (g b) nμ) + +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (is-injective-g : is-injective g) (b : B) + where + + has-not-perfect-fiber-is-nonperfect-image : + is-nonperfect-image {f = f} (g b) → has-not-perfect-fiber f g b + has-not-perfect-fiber-is-nonperfect-image (x₀ , zero-ℕ , u) = + ex-falso (pr2 u (b , inv (pr1 u))) + has-not-perfect-fiber-is-nonperfect-image (x₀ , succ-ℕ n , u) = + ( iterate n (g ∘ f) x₀ , is-injective-g (pr1 u)) , + ( λ s → pr2 u (s x₀ n refl)) + +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + {f : A → B} {g : B → A} + (is-double-negation-eliminating-g : is-double-negation-eliminating-map g) + (is-injective-g : is-injective g) + (b : B) + (nρ : ¬ (is-perfect-image f g (g b))) + where + + not-not-has-has-not-perfect-fiber-is-not-perfect-image' : + ¬¬ (has-not-perfect-fiber f g b) + not-not-has-has-not-perfect-fiber-is-not-perfect-image' t = + not-not-is-nonperfect-image + ( is-double-negation-eliminating-g) + ( b) + ( nρ) + ( λ s → t (has-not-perfect-fiber-is-nonperfect-image is-injective-g b s)) + +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + {f : A → B} {g : B → A} + (is-double-negation-eliminating-f : is-double-negation-eliminating-map f) + (is-prop-map-f : is-prop-map f) + (b : B) + where + + is-double-negation-stable-has-not-perfect-fiber : + is-double-negation-stable (has-not-perfect-fiber-Prop' f g is-prop-map-f b) + is-double-negation-stable-has-not-perfect-fiber = + double-negation-elim-Σ-is-prop-base + ( is-prop-map-f b) + ( is-double-negation-eliminating-f b) + ( λ p → double-negation-elim-neg (is-perfect-image f g (pr1 p))) + +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + {f : A → B} {g : B → A} + (is-double-negation-eliminating-g : is-double-negation-eliminating-map g) + (is-injective-g : is-injective g) + (is-double-negation-eliminating-f : is-double-negation-eliminating-map f) + (is-prop-map-f : is-prop-map f) + (b : B) + (nρ : ¬ (is-perfect-image f g (g b))) + where + + has-not-perfect-fiber-is-not-perfect-image' : + has-not-perfect-fiber f g b + has-not-perfect-fiber-is-not-perfect-image' = + is-double-negation-stable-has-not-perfect-fiber + ( is-double-negation-eliminating-f) + ( is-prop-map-f) + ( b) + ( not-not-has-has-not-perfect-fiber-is-not-perfect-image' + ( is-double-negation-eliminating-g) + ( is-injective-g) + ( b) + ( nρ)) +``` + +### The classical story + +If `g` is an [embedding](foundation-core.embeddings.md), then +`is-perfect-image a` is a [proposition](foundation-core.propositions.md). In +this case, if we assume the +[law of exluded middle](foundation.law-of-excluded-middle.md), we can show +`is-perfect-image a` is a [decidable type](foundation.decidable-types.md) for +any `a : A`. + +```agda +module _ + {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} (is-emb-g : is-emb g) - (lem : LEM (l1 ⊔ l2)) where - is-perfect-not-not-is-perfect-image : - (a : A) → ¬ (is-not-perfect-image a) → is-perfect-image f g a - is-perfect-not-not-is-perfect-image a nρ a₀ n p = - rec-coproduct - ( id) - ( λ a₁ → ex-falso (nρ (a₀ , n , p , a₁))) - ( lem (fiber g a₀ , is-prop-map-is-emb is-emb-g a₀)) + is-decidable-is-perfect-image-is-emb-LEM : + (a : A) → is-decidable (is-perfect-image f g a) + is-decidable-is-perfect-image-is-emb-LEM a = + lem (is-perfect-image-Prop is-emb-g a) +``` + +If we assume the law of excluded middle and `g` is an embedding, we can prove +that if `is-nonperfect-image a` does not hold, we have `is-perfect-image a`. + +```agda +module _ + {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (is-emb-g : is-emb g) + where + + double-negation-elim-is-perfect-image-LEM : + (a : A) → ¬ (is-nonperfect-image a) → is-perfect-image f g a + double-negation-elim-is-perfect-image-LEM = + double-negation-elim-is-perfect-image + ( is-double-negation-eliminating-map-is-decidable-map + ( λ y → lem (fiber g y , is-prop-map-is-emb is-emb-g y))) ``` The following property states that if `g (b)` is not a perfect image, then `b` @@ -218,47 +403,21 @@ assume law of excluded middle and that both `g` and `f` are embedding. ```agda module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} + {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} (is-emb-f : is-emb f) (is-emb-g : is-emb g) - (lem : LEM (l1 ⊔ l2)) where - not-perfect-image-has-not-perfect-fiber : + has-not-perfect-fiber-is-not-perfect-image-LEM : (b : B) → ¬ (is-perfect-image f g (g b)) → - Σ (fiber f b) (λ s → ¬ (is-perfect-image f g (pr1 s))) - not-perfect-image-has-not-perfect-fiber b nρ = v - where - i : ¬¬ (is-not-perfect-image {f = f} (g b)) - i = λ nμ → nρ (is-perfect-not-not-is-perfect-image is-emb-g lem (g b) nμ) - - ii : - is-not-perfect-image (g b) → - Σ (fiber f b) (λ s → ¬ (is-perfect-image f g (pr1 s))) - ii (x₀ , 0 , u) = - ex-falso (pr2 u (b , inv (pr1 u))) - ii (x₀ , succ-ℕ n , u) = - a , w - where - q : f (iterate n (g ∘ f) x₀) = b - q = is-injective-is-emb is-emb-g (pr1 u) - - a : fiber f b - a = iterate n (g ∘ f) x₀ , q - - w : ¬ (is-perfect-image f g ((iterate n (g ∘ f)) x₀)) - w = λ s → pr2 u (s x₀ n refl) - - iii : ¬¬ (Σ (fiber f b) (λ s → ¬ (is-perfect-image f g (pr1 s)))) - iii = λ t → i (λ s → t (ii s)) - - iv : is-prop (Σ (fiber f b) (λ s → ¬ (is-perfect-image f g (pr1 s)))) - iv = - is-prop-Σ - (is-prop-map-is-emb is-emb-f b) - (λ s → is-prop-neg {A = is-perfect-image f g (pr1 s)}) - - v : Σ (fiber f b) (λ s → ¬ (is-perfect-image f g (pr1 s))) - v = double-negation-elim-is-decidable (lem (_ , iv)) iii + has-not-perfect-fiber f g b + has-not-perfect-fiber-is-not-perfect-image-LEM = + has-not-perfect-fiber-is-not-perfect-image' + ( is-double-negation-eliminating-map-is-decidable-map + ( λ y → lem (fiber g y , is-prop-map-is-emb is-emb-g y))) + ( is-injective-is-emb is-emb-g) + ( is-double-negation-eliminating-map-is-decidable-map + ( λ y → lem (fiber f y , is-prop-map-is-emb is-emb-f y))) + ( is-prop-map-is-emb is-emb-f) ``` From 34a45e73fb8026675fb5477276c0e1db8e05c388 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 13:18:05 +0200 Subject: [PATCH 17/83] `untruncated-double-negation-elimination` -> `double-negation-elimination` --- src/foundation.lagda.md | 2 +- src/foundation/double-negation-eliminating-maps.lagda.md | 4 ++-- ...mination.lagda.md => double-negation-elimination.lagda.md} | 2 +- src/foundation/double-negation-stable-embeddings.lagda.md | 2 +- src/foundation/double-negation-stable-propositions.lagda.md | 2 +- src/foundation/irrefutable-propositions.lagda.md | 2 +- src/foundation/perfect-images.lagda.md | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) rename src/foundation/{untruncated-double-negation-elimination.lagda.md => double-negation-elimination.lagda.md} (99%) diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index baa3135e05..b6fe0248a9 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -136,6 +136,7 @@ open import foundation.disjunction public open import foundation.double-arrows public open import foundation.double-negation public open import foundation.double-negation-eliminating-maps public +open import foundation.double-negation-elimination public open import foundation.double-negation-modality public open import foundation.double-negation-stable-embeddings public open import foundation.double-negation-stable-propositions public @@ -466,7 +467,6 @@ open import foundation.unordered-pairs public open import foundation.unordered-pairs-of-types public open import foundation.unordered-tuples public open import foundation.unordered-tuples-of-types public -open import foundation.untruncated-double-negation-elimination public open import foundation.vectors-set-quotients public open import foundation.weak-function-extensionality public open import foundation.weak-limited-principle-of-omniscience public diff --git a/src/foundation/double-negation-eliminating-maps.lagda.md b/src/foundation/double-negation-eliminating-maps.lagda.md index 28663911fa..19ccf8cd82 100644 --- a/src/foundation/double-negation-eliminating-maps.lagda.md +++ b/src/foundation/double-negation-eliminating-maps.lagda.md @@ -15,6 +15,7 @@ open import foundation.decidable-maps open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation +open import foundation.double-negation-elimination open import foundation.empty-types open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-coproduct-types @@ -25,7 +26,6 @@ open import foundation.retracts-of-maps open import foundation.retracts-of-types open import foundation.transport-along-identifications open import foundation.universe-levels -open import foundation.untruncated-double-negation-elimination open import foundation-core.contractible-maps open import foundation-core.equivalences @@ -42,7 +42,7 @@ open import foundation-core.homotopies A [map](foundation-core.function-types.md) is said to be {{#concept "double negation eliminating" Disambiguation="map of types" Agda=is-double-negation-eliminating-map}} if its [fibers](foundation-core.fibers-of-maps.md) satisfy -[untruncated double negation elimination](foundation.untruncated-double-negation-elimination.md). +[untruncated double negation elimination](foundation.double-negation-elimination.md). I.e., for every `y : B`, if `fiber f y` is [irrefutable](foundation.irrefutable-propositions.md), then we do in fact have an element of the fiber `p : fiber f y`. So we have a map diff --git a/src/foundation/untruncated-double-negation-elimination.lagda.md b/src/foundation/double-negation-elimination.lagda.md similarity index 99% rename from src/foundation/untruncated-double-negation-elimination.lagda.md rename to src/foundation/double-negation-elimination.lagda.md index 0c5fadbfeb..493f9ddb33 100644 --- a/src/foundation/untruncated-double-negation-elimination.lagda.md +++ b/src/foundation/double-negation-elimination.lagda.md @@ -1,7 +1,7 @@ # Double negation elimination ```agda -module foundation.untruncated-double-negation-elimination where +module foundation.double-negation-elimination where ```
Imports diff --git a/src/foundation/double-negation-stable-embeddings.lagda.md b/src/foundation/double-negation-stable-embeddings.lagda.md index 62204253d4..99410b28c5 100644 --- a/src/foundation/double-negation-stable-embeddings.lagda.md +++ b/src/foundation/double-negation-stable-embeddings.lagda.md @@ -15,6 +15,7 @@ open import foundation.decidable-propositions open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation-eliminating-maps +open import foundation.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.embeddings open import foundation.fibers-of-maps @@ -33,7 +34,6 @@ 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.untruncated-double-negation-elimination open import foundation-core.cartesian-product-types open import foundation-core.coproduct-types diff --git a/src/foundation/double-negation-stable-propositions.lagda.md b/src/foundation/double-negation-stable-propositions.lagda.md index 7cbda3edd4..ce389e78c0 100644 --- a/src/foundation/double-negation-stable-propositions.lagda.md +++ b/src/foundation/double-negation-stable-propositions.lagda.md @@ -15,6 +15,7 @@ open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.disjunction open import foundation.double-negation +open import foundation.double-negation-elimination open import foundation.empty-types open import foundation.equivalences open import foundation.existential-quantification @@ -24,7 +25,6 @@ open import foundation.transport-along-identifications open import foundation.unit-type open import foundation.universal-quantification open import foundation.universe-levels -open import foundation.untruncated-double-negation-elimination open import foundation-core.contractible-types open import foundation-core.function-types diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md index e1686a8e68..921745545d 100644 --- a/src/foundation/irrefutable-propositions.lagda.md +++ b/src/foundation/irrefutable-propositions.lagda.md @@ -12,12 +12,12 @@ open import foundation.decidable-propositions open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation +open import foundation.double-negation-elimination open import foundation.function-types open import foundation.negation open import foundation.subuniverses open import foundation.unit-type open import foundation.universe-levels -open import foundation.untruncated-double-negation-elimination open import foundation-core.propositions ``` diff --git a/src/foundation/perfect-images.lagda.md b/src/foundation/perfect-images.lagda.md index fcc532f10b..b5aa69c968 100644 --- a/src/foundation/perfect-images.lagda.md +++ b/src/foundation/perfect-images.lagda.md @@ -15,6 +15,7 @@ open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation open import foundation.double-negation-eliminating-maps +open import foundation.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.functoriality-dependent-function-types open import foundation.iterated-dependent-product-types @@ -25,7 +26,6 @@ open import foundation.negation open import foundation.type-arithmetic-dependent-function-types open import foundation.universal-property-dependent-pair-types open import foundation.universe-levels -open import foundation.untruncated-double-negation-elimination open import foundation-core.cartesian-product-types open import foundation-core.coproduct-types From 109c026124071edaf7754c8447c96024a2615154 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 14:08:36 +0200 Subject: [PATCH 18/83] Composition of double negation eliminating maps --- .../double-negation-eliminating-maps.lagda.md | 47 ++++++++++ ...double-negation-stable-embeddings.lagda.md | 85 +++++++------------ 2 files changed, 78 insertions(+), 54 deletions(-) diff --git a/src/foundation/double-negation-eliminating-maps.lagda.md b/src/foundation/double-negation-eliminating-maps.lagda.md index 19ccf8cd82..a64908213a 100644 --- a/src/foundation/double-negation-eliminating-maps.lagda.md +++ b/src/foundation/double-negation-eliminating-maps.lagda.md @@ -90,6 +90,53 @@ is-double-negation-eliminating-map-is-decidable-map H y = double-negation-elim-is-decidable (H y) ``` +### Composition of double negation eliminating maps + +Given a composition `g ∘ f` of double negation eliminating maps where the left +factor `g` is injective, then the composition is double negation eliminating. + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {g : B → C} {f : A → B} + where + + fiber-left-is-double-negation-eliminating-map-left : + is-double-negation-eliminating-map g → + (z : C) → ¬¬ (fiber (g ∘ f) z) → fiber g z + fiber-left-is-double-negation-eliminating-map-left G z nngfz = + G z (λ x → nngfz (λ w → x (f (pr1 w) , pr2 w))) + + fiber-right-is-double-negation-eliminating-map-comp : + is-injective g → + (G : is-double-negation-eliminating-map g) → + is-double-negation-eliminating-map f → + (z : C) (nngfz : ¬¬ (fiber (g ∘ f) z)) → + fiber f (pr1 (fiber-left-is-double-negation-eliminating-map-left G z nngfz)) + fiber-right-is-double-negation-eliminating-map-comp H G F z nngfz = + F ( pr1 + ( fiber-left-is-double-negation-eliminating-map-left G z nngfz)) + ( λ x → + nngfz + ( λ w → + x ( pr1 w , + H ( pr2 w ∙ + inv + ( pr2 + ( fiber-left-is-double-negation-eliminating-map-left + G z nngfz)))))) + + is-double-negation-eliminating-map-comp : + is-injective g → + is-double-negation-eliminating-map g → + is-double-negation-eliminating-map f → + is-double-negation-eliminating-map (g ∘ f) + is-double-negation-eliminating-map-comp H G F z nngfz = + map-inv-compute-fiber-comp g f z + ( ( fiber-left-is-double-negation-eliminating-map-left G z nngfz) , + ( fiber-right-is-double-negation-eliminating-map-comp H G F z nngfz)) +``` + ### Left cancellation for double negation eliminating maps If a composite `g ∘ f` is double negation eliminating and the left factor `g` is diff --git a/src/foundation/double-negation-stable-embeddings.lagda.md b/src/foundation/double-negation-stable-embeddings.lagda.md index 99410b28c5..215397ee4e 100644 --- a/src/foundation/double-negation-stable-embeddings.lagda.md +++ b/src/foundation/double-negation-stable-embeddings.lagda.md @@ -71,16 +71,25 @@ is-double-negation-stable-emb : is-double-negation-stable-emb f = is-emb f × is-double-negation-eliminating-map f -abstract - is-emb-is-double-negation-stable-emb : - {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → - is-double-negation-stable-emb f → is-emb f - is-emb-is-double-negation-stable-emb = pr1 - -is-double-negation-eliminating-map-is-double-negation-stable-emb : - {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → - is-double-negation-stable-emb f → is-double-negation-eliminating-map f -is-double-negation-eliminating-map-is-double-negation-stable-emb = pr2 +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} + (F : is-double-negation-stable-emb f) + where + + is-emb-is-double-negation-stable-emb : is-emb f + is-emb-is-double-negation-stable-emb = pr1 F + + is-double-negation-eliminating-map-is-double-negation-stable-emb : + is-double-negation-eliminating-map f + is-double-negation-eliminating-map-is-double-negation-stable-emb = pr2 F + + is-prop-map-is-double-negation-stable-emb : is-prop-map f + is-prop-map-is-double-negation-stable-emb = + is-prop-map-is-emb is-emb-is-double-negation-stable-emb + + is-injective-is-double-negation-stable-emb : is-injective f + is-injective-is-double-negation-stable-emb = + is-injective-is-emb is-emb-is-double-negation-stable-emb ``` ### Double negation stable propositional maps @@ -104,10 +113,9 @@ module _ ( is-double-negation-stable-prop-map f , is-prop-is-double-negation-stable-prop-map f) - abstract - is-prop-map-is-double-negation-stable-prop-map : - {f : X → Y} → is-double-negation-stable-prop-map f → is-prop-map f - is-prop-map-is-double-negation-stable-prop-map H y = pr1 (H y) + is-prop-map-is-double-negation-stable-prop-map : + {f : X → Y} → is-double-negation-stable-prop-map f → is-prop-map f + is-prop-map-is-double-negation-stable-prop-map H y = pr1 (H y) is-double-negation-eliminating-map-is-double-negation-stable-prop-map : {f : X → Y} → @@ -174,12 +182,6 @@ module _ pr2 (is-double-negation-stable-emb-is-double-negation-stable-prop-map H) = is-double-negation-eliminating-map-is-double-negation-stable-prop-map H - abstract - is-prop-map-is-double-negation-stable-emb : - is-double-negation-stable-emb f → is-prop-map f - is-prop-map-is-double-negation-stable-emb H = - is-prop-map-is-emb (is-emb-is-double-negation-stable-emb H) - abstract is-double-negation-stable-prop-map-is-double-negation-stable-emb : is-double-negation-stable-emb f → is-double-negation-stable-prop-map f @@ -296,40 +298,15 @@ module _ {g : B → C} {f : A → B} where - -- abstract - -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' : - -- is-double-negation-stable-emb g → - -- is-double-negation-eliminating-map f → - -- is-double-negation-eliminating-map (g ∘ f) - -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' - -- K H z nngfz = - -- map-inv-compute-fiber-comp g f z - -- ( is-double-negation-eliminating-map-is-double-negation-stable-emb K z - -- ( λ x → nngfz λ w → x (f (pr1 w) , pr2 w)) , - -- H (pr1 (pr2 K z (λ x → nngfz (λ w → x (f (pr1 w) , pr2 w))))) λ x → x ({! !} , {! !})) - -- rec-coproduct - -- ( λ u → - -- is-decidable-equiv - -- ( ( left-unit-law-Σ-is-contr - -- ( is-proof-irrelevant-is-prop - -- ( is-prop-map-is-emb - -- ( is-emb-is-double-negation-stable-emb K) - -- ( x)) - -- ( u)) - -- ( u)) ∘e - -- ( compute-fiber-comp g f x)) - -- ( H (pr1 u))) - -- ( λ α → inr (λ t → α (f (pr1 t) , pr2 t))) - -- ( is-double-negation-eliminating-map-is-double-negation-stable-emb K x) - - -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb : - -- is-double-negation-stable-emb g → - -- is-double-negation-stable-emb f → - -- is-double-negation-eliminating-map (g ∘ f) - -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb K H = - -- is-double-negation-eliminating-map-comp-is-double-negation-stable-emb' - -- ( K) - -- ( is-double-negation-eliminating-map-is-double-negation-stable-emb H) + is-double-negation-eliminating-map-comp-is-double-negation-stable-emb : + is-double-negation-stable-emb g → + is-double-negation-eliminating-map f → + is-double-negation-eliminating-map (g ∘ f) + is-double-negation-eliminating-map-comp-is-double-negation-stable-emb G F = + is-double-negation-eliminating-map-comp + ( is-injective-is-double-negation-stable-emb G) + ( is-double-negation-eliminating-map-is-double-negation-stable-emb G) + ( F) is-double-negation-stable-prop-map-comp : is-double-negation-stable-prop-map g → From 488c9baf6b3f54ea65d65ecc99e0f24724e1fea6 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 14:33:15 +0200 Subject: [PATCH 19/83] double negation stable subtypes --- src/foundation.lagda.md | 1 + .../double-negation-elimination.lagda.md | 2 +- ...uble-negation-stable-propositions.lagda.md | 92 ++++- .../double-negation-stable-subtypes.lagda.md | 327 ++++++++++++++++++ 4 files changed, 417 insertions(+), 5 deletions(-) create mode 100644 src/foundation/double-negation-stable-subtypes.lagda.md diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index b6fe0248a9..522c70774a 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -140,6 +140,7 @@ open import foundation.double-negation-elimination public open import foundation.double-negation-modality public open import foundation.double-negation-stable-embeddings public open import foundation.double-negation-stable-propositions public +open import foundation.double-negation-stable-subtypes public open import foundation.double-powersets public open import foundation.dubuc-penon-compact-types public open import foundation.effective-maps-equivalence-relations public diff --git a/src/foundation/double-negation-elimination.lagda.md b/src/foundation/double-negation-elimination.lagda.md index 493f9ddb33..328d4265be 100644 --- a/src/foundation/double-negation-elimination.lagda.md +++ b/src/foundation/double-negation-elimination.lagda.md @@ -36,7 +36,7 @@ We say a type `A` satisfies if there is a map ```text - ¬¬A → A + ¬¬A → A. ``` ## Definitions diff --git a/src/foundation/double-negation-stable-propositions.lagda.md b/src/foundation/double-negation-stable-propositions.lagda.md index ce389e78c0..ca1b044568 100644 --- a/src/foundation/double-negation-stable-propositions.lagda.md +++ b/src/foundation/double-negation-stable-propositions.lagda.md @@ -16,18 +16,25 @@ open import foundation.dependent-pair-types open import foundation.disjunction open import foundation.double-negation open import foundation.double-negation-elimination +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 open import foundation-core.function-types +open import foundation-core.identity-types open import foundation-core.retracts-of-types ``` @@ -118,6 +125,11 @@ module _ is-prop-type-is-double-negation-stable-prop ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop) + prop-Double-Negation-Stable-Prop : Prop l + prop-Double-Negation-Stable-Prop = + ( type-Double-Negation-Stable-Prop , + is-prop-type-Double-Negation-Stable-Prop) + has-double-negation-elim-type-Double-Negation-Stable-Prop : has-double-negation-elim type-Double-Negation-Stable-Prop has-double-negation-elim-type-Double-Negation-Stable-Prop = @@ -127,7 +139,68 @@ module _ ## Properties -### Double negation elimination is preserved by retracts +### The forgetful map from double negation stable propositions to propositions is an embedding + +```agda +is-emb-prop-Double-Negation-Stable-Prop : + {l : Level} → is-emb (prop-Double-Negation-Stable-Prop {l}) +is-emb-prop-Double-Negation-Stable-Prop = + is-emb-tot + ( λ X → + is-emb-inclusion-subtype + ( λ H → + has-double-negation-elim X , is-prop-has-double-negation-elim H)) + +emb-prop-Double-Negation-Stable-Prop : + {l : Level} → Double-Negation-Stable-Prop l ↪ Prop l +emb-prop-Double-Negation-Stable-Prop = + ( prop-Double-Negation-Stable-Prop , is-emb-prop-Double-Negation-Stable-Prop) +``` + +### The subuniverse of double negation stable propositions is a set + +```agda +is-set-Double-Negation-Stable-Prop : + {l : Level} → is-set (Double-Negation-Stable-Prop l) +is-set-Double-Negation-Stable-Prop {l} = + is-set-emb emb-prop-Double-Negation-Stable-Prop is-set-type-Prop + +set-Double-Negation-Stable-Prop : (l : Level) → Set (lsuc l) +set-Double-Negation-Stable-Prop l = + ( Double-Negation-Stable-Prop l , is-set-Double-Negation-Stable-Prop) +``` + +### Extensionality of double negation stable propositions + +```agda +module _ + {l : Level} (P Q : Double-Negation-Stable-Prop l) + where + + extensionality-Double-Negation-Stable-Prop : + ( P = Q) ≃ + ( type-Double-Negation-Stable-Prop P ↔ type-Double-Negation-Stable-Prop Q) + extensionality-Double-Negation-Stable-Prop = + ( propositional-extensionality + ( prop-Double-Negation-Stable-Prop P) + ( prop-Double-Negation-Stable-Prop Q)) ∘e + ( equiv-ap-emb emb-prop-Double-Negation-Stable-Prop) + + iff-eq-Double-Negation-Stable-Prop : + P = Q → + type-Double-Negation-Stable-Prop P ↔ type-Double-Negation-Stable-Prop Q + iff-eq-Double-Negation-Stable-Prop = + map-equiv extensionality-Double-Negation-Stable-Prop + + eq-iff-Double-Negation-Stable-Prop : + (type-Double-Negation-Stable-Prop P → type-Double-Negation-Stable-Prop Q) → + (type-Double-Negation-Stable-Prop Q → type-Double-Negation-Stable-Prop P) → + P = Q + eq-iff-Double-Negation-Stable-Prop f g = + map-inv-equiv extensionality-Double-Negation-Stable-Prop (pair f g) +``` + +### Double negation stable propositions are preserved by retracts ```agda module _ @@ -145,7 +218,7 @@ module _ ( has-double-negation-elim-is-double-negation-stable-prop H)) ``` -### Double negation elimination is preserved by equivalences +### Double negation stable propositions are preserved by equivalences ```agda module _ @@ -189,9 +262,9 @@ is-double-negation-stable-prop-is-contr H = ### Decidable propositions are double negation stable ```agda -decidable-prop-Double-Negation-Stable-Prop : +double-negation-stable-prop-Decidable-Prop : {l : Level} → Decidable-Prop l → Double-Negation-Stable-Prop l -decidable-prop-Double-Negation-Stable-Prop (A , H , d) = +double-negation-stable-prop-Decidable-Prop (A , H , d) = ( A , H , double-negation-elim-is-decidable d) ``` @@ -293,6 +366,17 @@ product-Double-Negation-Stable-Prop A B = ( is-double-negation-stable-prop-type-Double-Negation-Stable-Prop B)) ``` +### Negation has no fixed points on double negation stable propositions + +```agda +abstract + no-fixed-points-neg-Double-Negation-Stable-Prop : + {l : Level} (P : Double-Negation-Stable-Prop l) → + ¬ (type-Double-Negation-Stable-Prop P ↔ ¬ (type-Double-Negation-Stable-Prop P)) + no-fixed-points-neg-Double-Negation-Stable-Prop P = + no-fixed-points-neg (type-Double-Negation-Stable-Prop P) +``` + ## See also - [The double negation modality](foundation.double-negation-modality.md) diff --git a/src/foundation/double-negation-stable-subtypes.lagda.md b/src/foundation/double-negation-stable-subtypes.lagda.md new file mode 100644 index 0000000000..3936fb0a5f --- /dev/null +++ b/src/foundation/double-negation-stable-subtypes.lagda.md @@ -0,0 +1,327 @@ +# Double negation stable subtypes + +```agda +module foundation.double-negation-stable-subtypes where +``` + +
Imports + +```agda +open import foundation.1-types +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.double-negation-eliminating-maps +open import foundation.double-negation-elimination +open import foundation.double-negation-stable-embeddings +open import foundation.double-negation-stable-propositions +open import foundation.equality-dependent-function-types +open import foundation.functoriality-cartesian-product-types +open import foundation.functoriality-dependent-function-types +open import foundation.functoriality-dependent-pair-types +open import foundation.logical-equivalences +open import foundation.propositional-maps +open import foundation.sets +open import foundation.structured-type-duality +open import foundation.subtypes +open import foundation.type-theoretic-principle-of-choice +open import foundation.universe-levels + +open import foundation-core.embeddings +open import foundation-core.equivalences +open import foundation-core.fibers-of-maps +open import foundation-core.function-types +open import foundation-core.identity-types +open import foundation-core.injective-maps +open import foundation-core.propositions +open import foundation-core.transport-along-identifications +open import foundation-core.truncated-types +open import foundation-core.truncation-levels +``` + +
+ +## Idea + +A +{{#concept "double negation stable subtype" Disambiguation="of a type" Agda=is-double-negation-stable-subtype Agda=double-negation-stable-subtype}} +of a type consists of a family of +[double negation stable propositions](foundation-core.double-negation-stable-propositions.md) +over it. + +## Definitions + +### Decidable subtypes + +```agda +is-double-negation-stable-subtype-Prop : + {l1 l2 : Level} {A : UU l1} → subtype l2 A → Prop (l1 ⊔ l2) +is-double-negation-stable-subtype-Prop {A = A} P = + Π-Prop A (λ a → is-double-negation-stable-Prop (P a)) + +is-double-negation-stable-subtype : + {l1 l2 : Level} {A : UU l1} → subtype l2 A → UU (l1 ⊔ l2) +is-double-negation-stable-subtype P = + type-Prop (is-double-negation-stable-subtype-Prop P) + +is-prop-is-double-negation-stable-subtype : + {l1 l2 : Level} {A : UU l1} (P : subtype l2 A) → + is-prop (is-double-negation-stable-subtype P) +is-prop-is-double-negation-stable-subtype P = + is-prop-type-Prop (is-double-negation-stable-subtype-Prop P) + +double-negation-stable-subtype : + {l1 : Level} (l : Level) (X : UU l1) → UU (l1 ⊔ lsuc l) +double-negation-stable-subtype l X = X → Double-Negation-Stable-Prop l +``` + +### The underlying subtype of a double negation stable subtype + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (P : double-negation-stable-subtype l2 A) + where + + subtype-double-negation-stable-subtype : subtype l2 A + subtype-double-negation-stable-subtype a = + prop-Double-Negation-Stable-Prop (P a) + + is-double-negation-stable-double-negation-stable-subtype : + is-double-negation-stable-subtype subtype-double-negation-stable-subtype + is-double-negation-stable-double-negation-stable-subtype a = + has-double-negation-elim-type-Double-Negation-Stable-Prop (P a) + + is-in-double-negation-stable-subtype : A → UU l2 + is-in-double-negation-stable-subtype = + is-in-subtype subtype-double-negation-stable-subtype + + is-prop-is-in-double-negation-stable-subtype : + (a : A) → is-prop (is-in-double-negation-stable-subtype a) + is-prop-is-in-double-negation-stable-subtype = + is-prop-is-in-subtype subtype-double-negation-stable-subtype +``` + +### The underlying type of a double negation stable subtype + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (P : double-negation-stable-subtype l2 A) + where + + type-double-negation-stable-subtype : UU (l1 ⊔ l2) + type-double-negation-stable-subtype = + type-subtype (subtype-double-negation-stable-subtype P) + + inclusion-double-negation-stable-subtype : + type-double-negation-stable-subtype → A + inclusion-double-negation-stable-subtype = + inclusion-subtype (subtype-double-negation-stable-subtype P) + + is-emb-inclusion-double-negation-stable-subtype : + is-emb inclusion-double-negation-stable-subtype + is-emb-inclusion-double-negation-stable-subtype = + is-emb-inclusion-subtype (subtype-double-negation-stable-subtype P) + + is-double-negation-eliminating-map-inclusion-double-negation-stable-subtype : + is-double-negation-eliminating-map inclusion-double-negation-stable-subtype + is-double-negation-eliminating-map-inclusion-double-negation-stable-subtype + x = + has-double-negation-elim-equiv + ( equiv-fiber-pr1 (type-Double-Negation-Stable-Prop ∘ P) x) + ( has-double-negation-elim-type-Double-Negation-Stable-Prop (P x)) + + is-injective-inclusion-double-negation-stable-subtype : + is-injective inclusion-double-negation-stable-subtype + is-injective-inclusion-double-negation-stable-subtype = + is-injective-inclusion-subtype (subtype-double-negation-stable-subtype P) + + emb-double-negation-stable-subtype : type-double-negation-stable-subtype ↪ A + emb-double-negation-stable-subtype = + emb-subtype (subtype-double-negation-stable-subtype P) + + is-double-negation-stable-emb-inclusion-double-negation-stable-subtype : + is-double-negation-stable-emb inclusion-double-negation-stable-subtype + is-double-negation-stable-emb-inclusion-double-negation-stable-subtype = + ( is-emb-inclusion-double-negation-stable-subtype , + is-double-negation-eliminating-map-inclusion-double-negation-stable-subtype) + + double-negation-stable-emb-double-negation-stable-subtype : + type-double-negation-stable-subtype ↪¬¬ A + double-negation-stable-emb-double-negation-stable-subtype = + ( inclusion-double-negation-stable-subtype , + is-double-negation-stable-emb-inclusion-double-negation-stable-subtype) +``` + +### The double negation stable subtype associated to a double negation stable embedding + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪¬¬ Y) + where + + double-negation-stable-subtype-double-negation-stable-emb : + double-negation-stable-subtype (l1 ⊔ l2) Y + pr1 (double-negation-stable-subtype-double-negation-stable-emb y) = + fiber (map-double-negation-stable-emb f) y + pr2 (double-negation-stable-subtype-double-negation-stable-emb y) = + is-double-negation-stable-prop-map-is-double-negation-stable-emb + ( is-double-negation-stable-emb-map-double-negation-stable-emb f) + ( y) + + compute-type-double-negation-stable-type-double-negation-stable-emb : + type-double-negation-stable-subtype double-negation-stable-subtype-double-negation-stable-emb ≃ X + compute-type-double-negation-stable-type-double-negation-stable-emb = + equiv-total-fiber (map-double-negation-stable-emb f) + + inv-compute-type-double-negation-stable-type-double-negation-stable-emb : + X ≃ type-double-negation-stable-subtype double-negation-stable-subtype-double-negation-stable-emb + inv-compute-type-double-negation-stable-type-double-negation-stable-emb = + inv-equiv-total-fiber (map-double-negation-stable-emb f) +``` + +## Examples + +### The double negation stable subtypes of left and right elements in a coproduct type + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-double-negation-stable-is-left : + (x : A + B) → has-double-negation-elim (is-left x) + is-double-negation-stable-is-left (inl x) = double-negation-elim-unit + is-double-negation-stable-is-left (inr x) = double-negation-elim-empty + + is-left-Double-Negation-Stable-Prop : + A + B → Double-Negation-Stable-Prop lzero + pr1 (is-left-Double-Negation-Stable-Prop x) = is-left x + pr1 (pr2 (is-left-Double-Negation-Stable-Prop x)) = is-prop-is-left x + pr2 (pr2 (is-left-Double-Negation-Stable-Prop x)) = + is-double-negation-stable-is-left x + + is-double-negation-stable-is-right : + (x : A + B) → has-double-negation-elim (is-right x) + is-double-negation-stable-is-right (inl x) = double-negation-elim-empty + is-double-negation-stable-is-right (inr x) = double-negation-elim-unit + + is-right-Double-Negation-Stable-Prop : + A + B → Double-Negation-Stable-Prop lzero + pr1 (is-right-Double-Negation-Stable-Prop x) = is-right x + pr1 (pr2 (is-right-Double-Negation-Stable-Prop x)) = is-prop-is-right x + pr2 (pr2 (is-right-Double-Negation-Stable-Prop x)) = + is-double-negation-stable-is-right x +``` + +## Properties + +### A double negation stable subtype of a `k+1`-truncated type is `k+1`-truncated + +```agda +module _ + {l1 l2 : Level} (k : 𝕋) {A : UU l1} (P : double-negation-stable-subtype l2 A) + where + + abstract + is-trunc-type-double-negation-stable-subtype : + is-trunc (succ-𝕋 k) A → is-trunc (succ-𝕋 k) (type-double-negation-stable-subtype P) + is-trunc-type-double-negation-stable-subtype = + is-trunc-type-subtype k (subtype-double-negation-stable-subtype P) + +module _ + {l1 l2 : Level} {A : UU l1} (P : double-negation-stable-subtype l2 A) + where + + abstract + is-prop-type-double-negation-stable-subtype : + is-prop A → is-prop (type-double-negation-stable-subtype P) + is-prop-type-double-negation-stable-subtype = + is-prop-type-subtype (subtype-double-negation-stable-subtype P) + + abstract + is-set-type-double-negation-stable-subtype : + is-set A → is-set (type-double-negation-stable-subtype P) + is-set-type-double-negation-stable-subtype = + is-set-type-subtype (subtype-double-negation-stable-subtype P) + + abstract + is-1-type-type-double-negation-stable-subtype : + is-1-type A → is-1-type (type-double-negation-stable-subtype P) + is-1-type-type-double-negation-stable-subtype = + is-1-type-type-subtype (subtype-double-negation-stable-subtype P) + +prop-double-negation-stable-subprop : + {l1 l2 : Level} (A : Prop l1) (P : double-negation-stable-subtype l2 (type-Prop A)) → + Prop (l1 ⊔ l2) +prop-double-negation-stable-subprop A P = + prop-subprop A (subtype-double-negation-stable-subtype P) + +set-double-negation-stable-subset : + {l1 l2 : Level} (A : Set l1) (P : double-negation-stable-subtype l2 (type-Set A)) → + Set (l1 ⊔ l2) +set-double-negation-stable-subset A P = + set-subset A (subtype-double-negation-stable-subtype P) +``` + +### The type of double negation stable subtypes of a type is a set + +```agda +is-set-double-negation-stable-subtype : + {l1 l2 : Level} {X : UU l1} → is-set (double-negation-stable-subtype l2 X) +is-set-double-negation-stable-subtype = + is-set-function-type is-set-Double-Negation-Stable-Prop +``` + +### Extensionality of the type of double negation stable subtypes + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (P : double-negation-stable-subtype l2 A) + where + + has-same-elements-double-negation-stable-subtype : + {l3 : Level} → double-negation-stable-subtype l3 A → UU (l1 ⊔ l2 ⊔ l3) + has-same-elements-double-negation-stable-subtype Q = + has-same-elements-subtype + ( subtype-double-negation-stable-subtype P) + ( subtype-double-negation-stable-subtype Q) + + extensionality-double-negation-stable-subtype : + (Q : double-negation-stable-subtype l2 A) → + (P = Q) ≃ has-same-elements-double-negation-stable-subtype Q + extensionality-double-negation-stable-subtype = + extensionality-Π P + ( λ x Q → (type-Double-Negation-Stable-Prop (P x)) ↔ (type-Double-Negation-Stable-Prop Q)) + ( λ x Q → extensionality-Double-Negation-Stable-Prop (P x) Q) + + has-same-elements-eq-double-negation-stable-subtype : + (Q : double-negation-stable-subtype l2 A) → + (P = Q) → has-same-elements-double-negation-stable-subtype Q + has-same-elements-eq-double-negation-stable-subtype Q = + map-equiv (extensionality-double-negation-stable-subtype Q) + + eq-has-same-elements-double-negation-stable-subtype : + (Q : double-negation-stable-subtype l2 A) → + has-same-elements-double-negation-stable-subtype Q → P = Q + eq-has-same-elements-double-negation-stable-subtype Q = + map-inv-equiv (extensionality-double-negation-stable-subtype Q) + + refl-extensionality-double-negation-stable-subtype : + map-equiv (extensionality-double-negation-stable-subtype P) refl = (λ x → pair id id) + refl-extensionality-double-negation-stable-subtype = refl +``` + +### The type of double negation stable subtypes of `A` is equivalent to the type of all double negation stable embeddings into a type `A` + +```agda +equiv-Fiber-Double-Negation-Stable-Prop : + (l : Level) {l1 : Level} (A : UU l1) → + Σ (UU (l1 ⊔ l)) (λ X → X ↪¬¬ A) ≃ (double-negation-stable-subtype (l1 ⊔ l) A) +equiv-Fiber-Double-Negation-Stable-Prop l A = + ( equiv-Fiber-structure l is-double-negation-stable-prop A) ∘e + ( equiv-tot + ( λ X → + equiv-tot + ( λ f → + ( inv-distributive-Π-Σ) ∘e + ( equiv-product-left (equiv-is-prop-map-is-emb f))))) +``` From ac08a789647a51240897b15cd090668689601d86 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 14:39:19 +0200 Subject: [PATCH 20/83] Cantor's theorem for double negation --- src/foundation/cantors-theorem.lagda.md | 31 +++++++++++++++++++ ...uble-negation-stable-propositions.lagda.md | 17 +++++++++- .../double-negation-stable-subtypes.lagda.md | 24 +++++++++----- 3 files changed, 64 insertions(+), 8 deletions(-) diff --git a/src/foundation/cantors-theorem.lagda.md b/src/foundation/cantors-theorem.lagda.md index 920e558167..d3ecf16559 100644 --- a/src/foundation/cantors-theorem.lagda.md +++ b/src/foundation/cantors-theorem.lagda.md @@ -11,6 +11,8 @@ open import foundation.action-on-identifications-functions open import foundation.decidable-propositions open import foundation.decidable-subtypes open import foundation.dependent-pair-types +open import foundation.double-negation-stable-propositions +open import foundation.double-negation-stable-subtypes open import foundation.function-extensionality open import foundation.logical-equivalences open import foundation.negation @@ -106,6 +108,35 @@ module _ ( not-in-image-map-theorem-decidable-Cantor) ``` +### Cantor's theorem for the set of double negation stable subtypes + +```agda +module _ + {l1 l2 : Level} {X : UU l1} (f : X → double-negation-stable-subtype l2 X) + where + + map-theorem-double-negation-stable-Cantor : + double-negation-stable-subtype l2 X + 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))) + + 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) +``` + ## References A proof of Cantor's theorem first appeared in {{#cite Cantor1890/91}} where it diff --git a/src/foundation/double-negation-stable-propositions.lagda.md b/src/foundation/double-negation-stable-propositions.lagda.md index ca1b044568..9166796be6 100644 --- a/src/foundation/double-negation-stable-propositions.lagda.md +++ b/src/foundation/double-negation-stable-propositions.lagda.md @@ -268,6 +268,20 @@ double-negation-stable-prop-Decidable-Prop (A , H , d) = ( A , H , double-negation-elim-is-decidable d) ``` +### Negations of types are double negation stable propositions + +```agda +neg-type-Double-Negation-Stable-Prop : + {l : Level} → UU l → Double-Negation-Stable-Prop l +neg-type-Double-Negation-Stable-Prop A = + ( ¬ A , is-prop-neg , double-negation-elim-neg A) + +neg-Double-Negation-Stable-Prop : + {l : Level} → Double-Negation-Stable-Prop l → Double-Negation-Stable-Prop l +neg-Double-Negation-Stable-Prop P = + neg-type-Double-Negation-Stable-Prop (type-Double-Negation-Stable-Prop P) +``` + ### Universal quantification over double negation stable propositions is double negation stable ```agda @@ -372,7 +386,8 @@ product-Double-Negation-Stable-Prop A B = abstract no-fixed-points-neg-Double-Negation-Stable-Prop : {l : Level} (P : Double-Negation-Stable-Prop l) → - ¬ (type-Double-Negation-Stable-Prop P ↔ ¬ (type-Double-Negation-Stable-Prop P)) + ¬ (type-Double-Negation-Stable-Prop P ↔ + ¬ (type-Double-Negation-Stable-Prop P)) no-fixed-points-neg-Double-Negation-Stable-Prop P = no-fixed-points-neg (type-Double-Negation-Stable-Prop P) ``` diff --git a/src/foundation/double-negation-stable-subtypes.lagda.md b/src/foundation/double-negation-stable-subtypes.lagda.md index 3936fb0a5f..53a406e001 100644 --- a/src/foundation/double-negation-stable-subtypes.lagda.md +++ b/src/foundation/double-negation-stable-subtypes.lagda.md @@ -168,12 +168,16 @@ module _ ( y) compute-type-double-negation-stable-type-double-negation-stable-emb : - type-double-negation-stable-subtype double-negation-stable-subtype-double-negation-stable-emb ≃ X + type-double-negation-stable-subtype + double-negation-stable-subtype-double-negation-stable-emb ≃ + X compute-type-double-negation-stable-type-double-negation-stable-emb = equiv-total-fiber (map-double-negation-stable-emb f) inv-compute-type-double-negation-stable-type-double-negation-stable-emb : - X ≃ type-double-negation-stable-subtype double-negation-stable-subtype-double-negation-stable-emb + X ≃ + type-double-negation-stable-subtype + double-negation-stable-subtype-double-negation-stable-emb inv-compute-type-double-negation-stable-type-double-negation-stable-emb = inv-equiv-total-fiber (map-double-negation-stable-emb f) ``` @@ -223,7 +227,8 @@ module _ abstract is-trunc-type-double-negation-stable-subtype : - is-trunc (succ-𝕋 k) A → is-trunc (succ-𝕋 k) (type-double-negation-stable-subtype P) + is-trunc (succ-𝕋 k) A → is-trunc (succ-𝕋 k) + (type-double-negation-stable-subtype P) is-trunc-type-double-negation-stable-subtype = is-trunc-type-subtype k (subtype-double-negation-stable-subtype P) @@ -250,13 +255,15 @@ module _ is-1-type-type-subtype (subtype-double-negation-stable-subtype P) prop-double-negation-stable-subprop : - {l1 l2 : Level} (A : Prop l1) (P : double-negation-stable-subtype l2 (type-Prop A)) → + {l1 l2 : Level} (A : Prop l1) + (P : double-negation-stable-subtype l2 (type-Prop A)) → Prop (l1 ⊔ l2) prop-double-negation-stable-subprop A P = prop-subprop A (subtype-double-negation-stable-subtype P) set-double-negation-stable-subset : - {l1 l2 : Level} (A : Set l1) (P : double-negation-stable-subtype l2 (type-Set A)) → + {l1 l2 : Level} (A : Set l1) + (P : double-negation-stable-subtype l2 (type-Set A)) → Set (l1 ⊔ l2) set-double-negation-stable-subset A P = set-subset A (subtype-double-negation-stable-subtype P) @@ -290,7 +297,9 @@ module _ (P = Q) ≃ has-same-elements-double-negation-stable-subtype Q extensionality-double-negation-stable-subtype = extensionality-Π P - ( λ x Q → (type-Double-Negation-Stable-Prop (P x)) ↔ (type-Double-Negation-Stable-Prop Q)) + ( λ x Q → + ( type-Double-Negation-Stable-Prop (P x)) ↔ + ( type-Double-Negation-Stable-Prop Q)) ( λ x Q → extensionality-Double-Negation-Stable-Prop (P x) Q) has-same-elements-eq-double-negation-stable-subtype : @@ -306,7 +315,8 @@ module _ map-inv-equiv (extensionality-double-negation-stable-subtype Q) refl-extensionality-double-negation-stable-subtype : - map-equiv (extensionality-double-negation-stable-subtype P) refl = (λ x → pair id id) + map-equiv (extensionality-double-negation-stable-subtype P) refl = + (λ x → id , id) refl-extensionality-double-negation-stable-subtype = refl ``` From 6d05ab900225929805e68f8f2bb068bbe775b168 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 14:48:06 +0200 Subject: [PATCH 21/83] minor fixes --- src/foundation-core/decidable-propositions.lagda.md | 4 ++-- src/foundation/double-negation-elimination.lagda.md | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/foundation-core/decidable-propositions.lagda.md b/src/foundation-core/decidable-propositions.lagda.md index d665b18c0e..deb1fcfca0 100644 --- a/src/foundation-core/decidable-propositions.lagda.md +++ b/src/foundation-core/decidable-propositions.lagda.md @@ -34,9 +34,9 @@ A {{#concept "decidable proposition" Agda=is-decidable-Prop}} is a [proposition](foundation-core.propositions.md) that has a [decidable](foundation.decidable-types.md) underlying type. -## Definition +## Definitions -### The property a proposition of being decidable +### The property of a proposition of being decidable ```agda is-prop-is-decidable : diff --git a/src/foundation/double-negation-elimination.lagda.md b/src/foundation/double-negation-elimination.lagda.md index 328d4265be..21506e84fd 100644 --- a/src/foundation/double-negation-elimination.lagda.md +++ b/src/foundation/double-negation-elimination.lagda.md @@ -32,13 +32,21 @@ open import foundation-core.propositions ## Idea We say a type `A` satisfies -{{#concept "untruncated double negation elimination" Agda=has-double-negation-elim}} +{{#concept "untruncated double negation elimination" Agda="on a type" Agda=has-double-negation-elim}} if there is a map ```text ¬¬A → A. ``` +We say a type `A` satisfies +{{#concept "double negation elimination" Agda="on a type"}} if there is an +implicaton + +```text + ¬¬A ⇒ ║A║₋₁. +``` + ## Definitions ### Untruncated double negation elimination From 4524c35df66eb1a24787c680c547231493f9a88a Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 19:21:50 +0200 Subject: [PATCH 22/83] some order theory --- .../opposite-large-precategories.lagda.md | 13 +++ src/foundation/complements-subtypes.lagda.md | 18 ++- src/foundation/decidable-embeddings.lagda.md | 12 ++ ...double-negation-stable-embeddings.lagda.md | 12 ++ src/foundation/images.lagda.md | 11 +- .../large-locale-of-propositions.lagda.md | 21 ++++ .../large-locale-of-subtypes.lagda.md | 25 +++- src/foundation/powersets.lagda.md | 109 +++++++++++++++--- src/foundation/preimages-of-subtypes.lagda.md | 5 +- .../bottom-elements-large-posets.lagda.md | 79 +++++++++++++ .../bottom-elements-preorders.lagda.md | 2 +- src/order-theory/decidable-posets.lagda.md | 12 +- src/order-theory/decidable-preorders.lagda.md | 12 +- .../decidable-total-orders.lagda.md | 4 +- .../decidable-total-preorders.lagda.md | 2 +- src/order-theory/directed-families.lagda.md | 2 +- src/order-theory/finite-preorders.lagda.md | 2 +- .../finitely-graded-posets.lagda.md | 2 +- src/order-theory/frames.lagda.md | 2 +- src/order-theory/galois-connections.lagda.md | 4 +- .../greatest-lower-bounds-posets.lagda.md | 6 +- src/order-theory/inflattices.lagda.md | 4 +- src/order-theory/interval-subposets.lagda.md | 2 +- src/order-theory/join-semilattices.lagda.md | 2 +- src/order-theory/lattices.lagda.md | 2 +- .../least-upper-bounds-posets.lagda.md | 6 +- src/order-theory/lower-bounds-posets.lagda.md | 4 +- src/order-theory/meet-semilattices.lagda.md | 2 +- src/order-theory/meet-suplattices.lagda.md | 2 +- .../opposite-large-posets.lagda.md | 107 +++++++++++++++++ .../opposite-large-preorders.lagda.md | 92 +++++++++++++++ src/order-theory/opposite-posets.lagda.md | 93 +++++++++++++++ src/order-theory/opposite-preorders.lagda.md | 82 +++++++++++++ .../order-preserving-maps-preorders.lagda.md | 4 +- src/order-theory/posets.lagda.md | 4 +- src/order-theory/preorders.lagda.md | 18 +-- src/order-theory/subpreorders.lagda.md | 2 +- src/order-theory/suplattices.lagda.md | 4 +- .../top-elements-large-posets.lagda.md | 7 +- src/order-theory/top-elements-posets.lagda.md | 20 ++-- .../top-elements-preorders.lagda.md | 10 +- src/order-theory/total-orders.lagda.md | 2 +- src/order-theory/total-preorders.lagda.md | 4 +- src/order-theory/upper-bounds-posets.lagda.md | 4 +- 44 files changed, 734 insertions(+), 98 deletions(-) create mode 100644 src/order-theory/bottom-elements-large-posets.lagda.md create mode 100644 src/order-theory/opposite-large-posets.lagda.md create mode 100644 src/order-theory/opposite-large-preorders.lagda.md create mode 100644 src/order-theory/opposite-posets.lagda.md create mode 100644 src/order-theory/opposite-preorders.lagda.md diff --git a/src/category-theory/opposite-large-precategories.lagda.md b/src/category-theory/opposite-large-precategories.lagda.md index 3365e3523b..1ef20f7093 100644 --- a/src/category-theory/opposite-large-precategories.lagda.md +++ b/src/category-theory/opposite-large-precategories.lagda.md @@ -13,6 +13,7 @@ open import category-theory.large-precategories open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.homotopies +open import foundation.large-identity-types open import foundation.identity-types open import foundation.sets open import foundation.strictly-involutive-identity-types @@ -141,6 +142,18 @@ module _ ## Properties +### The opposite large precategory construction is a strict involution + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} (C : Large-Precategory α β) + where + + is-involution-opposite-Large-Precategory : + opposite-Large-Precategory (opposite-Large-Precategory C) =ω C + is-involution-opposite-Large-Precategory = reflω +``` + ### Computing the isomorphism sets of the opposite large precategory ```agda diff --git a/src/foundation/complements-subtypes.lagda.md b/src/foundation/complements-subtypes.lagda.md index f105addb16..477ce50a47 100644 --- a/src/foundation/complements-subtypes.lagda.md +++ b/src/foundation/complements-subtypes.lagda.md @@ -9,6 +9,8 @@ module foundation.complements-subtypes where ```agda open import foundation.decidable-propositions open import foundation.decidable-subtypes +open import foundation.double-negation-stable-subtypes +open import foundation.double-negation-stable-propositions open import foundation.full-subtypes open import foundation.negation open import foundation.propositional-truncations @@ -23,8 +25,10 @@ open import foundation-core.subtypes ## Idea -The **complement** of a [subtype](foundation-core.subtypes.md) `P` of `A` -consists of the elements that are not in `P`. +The +{{#concept "complement" Disambiguation="of a subtype" Agda=complement-subtype}} +of a [subtype](foundation-core.subtypes.md) `P` of `A` consists of the elements +that are not in `P`. ## Definition @@ -46,6 +50,16 @@ complement-decidable-subtype P x = neg-Decidable-Prop (P x) ## Properties +### Complements of subtypes are double negation stable + +```agda +complement-double-negation-stable-subtype' : + {l1 l2 : Level} {A : UU l1} → + subtype l2 A → double-negation-stable-subtype l2 A +complement-double-negation-stable-subtype' P x = + neg-type-Double-Negation-Stable-Prop (is-in-subtype P x) +``` + ### The union of a subtype `P` with its complement is the full subtype if and only if `P` is a decidable subtype ```agda diff --git a/src/foundation/decidable-embeddings.lagda.md b/src/foundation/decidable-embeddings.lagda.md index 1c56245e9b..f91407cc9b 100644 --- a/src/foundation/decidable-embeddings.lagda.md +++ b/src/foundation/decidable-embeddings.lagda.md @@ -296,6 +296,18 @@ module _ ( is-decidable-emb-comp ( is-decidable-emb-is-decidable-prop-map K) ( is-decidable-emb-is-decidable-prop-map H)) + +comp-decidable-emb : + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} → + B ↪ᵈ C → A ↪ᵈ B → A ↪ᵈ C +comp-decidable-emb (g , G) (f , F) = + ( g ∘ f , is-decidable-emb-comp G F) + +infixr 15 _∘ᵈ_ +_∘ᵈ_ : + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} → + B ↪ᵈ C → A ↪ᵈ B → A ↪ᵈ C +_∘ᵈ_ = comp-decidable-emb ``` ### Left cancellation for decidable embeddings diff --git a/src/foundation/double-negation-stable-embeddings.lagda.md b/src/foundation/double-negation-stable-embeddings.lagda.md index 215397ee4e..b1c87575f4 100644 --- a/src/foundation/double-negation-stable-embeddings.lagda.md +++ b/src/foundation/double-negation-stable-embeddings.lagda.md @@ -326,6 +326,18 @@ module _ ( is-double-negation-stable-prop-map-comp ( is-double-negation-stable-prop-map-is-double-negation-stable-emb K) ( is-double-negation-stable-prop-map-is-double-negation-stable-emb H)) + +comp-double-negation-stable-emb : + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} → + B ↪¬¬ C → A ↪¬¬ B → A ↪¬¬ C +comp-double-negation-stable-emb (g , G) (f , F) = + ( g ∘ f , is-double-negation-stable-emb-comp G F) + +infixr 15 _∘¬¬_ +_∘¬¬_ : + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} → + B ↪¬¬ C → A ↪¬¬ B → A ↪¬¬ C +_∘¬¬_ = comp-double-negation-stable-emb ``` ### Left cancellation for double negation stable embeddings diff --git a/src/foundation/images.lagda.md b/src/foundation/images.lagda.md index f678e73231..22502c5e02 100644 --- a/src/foundation/images.lagda.md +++ b/src/foundation/images.lagda.md @@ -36,7 +36,9 @@ open import foundation-core.truncation-levels ## Idea -The **image** of a map is a type that satisfies the +The +{{#concept "image" Disambiguation="of a map" WD="image" WDID=Q860623 Agda=im}} +of a map is a type that satisfies the [universal property of the image](foundation.universal-property-image.md) of a map. @@ -73,7 +75,7 @@ module _ ## Properties -### We characterize the identity type of im f +### We characterize the identity type of `im f` ```agda module _ @@ -216,3 +218,8 @@ im-1-Type : (f : A → type-1-Type X) → 1-Type (l1 ⊔ l2) im-1-Type X f = im-Truncated-Type zero-𝕋 X f ``` + +## External links + +- [Image (mathematics)]() at + Wikipedia diff --git a/src/foundation/large-locale-of-propositions.lagda.md b/src/foundation/large-locale-of-propositions.lagda.md index 816cd18c3d..5723aebcd1 100644 --- a/src/foundation/large-locale-of-propositions.lagda.md +++ b/src/foundation/large-locale-of-propositions.lagda.md @@ -12,6 +12,7 @@ open import foundation.existential-quantification open import foundation.logical-equivalences open import foundation.propositional-extensionality open import foundation.unit-type +open import foundation.empty-types open import foundation.universal-property-cartesian-product-types open import foundation.universe-levels @@ -26,6 +27,7 @@ open import order-theory.large-preorders open import order-theory.large-suplattices open import order-theory.least-upper-bounds-large-posets open import order-theory.top-elements-large-posets +open import order-theory.bottom-elements-large-posets ```
@@ -87,6 +89,17 @@ is-top-element-top-has-top-element-Large-Poset star ``` +### The smallest element in the large poset of propositions + +```agda +has-bottom-element-Prop-Large-Locale : + has-bottom-element-Large-Poset Prop-Large-Poset +bottom-has-bottom-element-Large-Poset + has-bottom-element-Prop-Large-Locale = empty-Prop +is-bottom-element-bottom-has-bottom-element-Large-Poset + has-bottom-element-Prop-Large-Locale P = ex-falso +``` + ### The large poset of propositions is a large meet-semilattice ```agda @@ -98,6 +111,10 @@ has-meets-is-large-meet-semilattice-Large-Poset has-top-element-is-large-meet-semilattice-Large-Poset is-large-meet-semilattice-Prop-Large-Locale = has-top-element-Prop-Large-Locale + +Prop-Large-Meet-Semilattice : Large-Meet-Semilattice lsuc (_⊔_) +Prop-Large-Meet-Semilattice = + make-Large-Meet-Semilattice Prop-Large-Poset is-large-meet-semilattice-Prop-Large-Locale ``` ### Suprema in the large poset of propositions @@ -111,6 +128,10 @@ sup-has-least-upper-bound-family-of-elements-Large-Poset is-least-upper-bound-sup-has-least-upper-bound-family-of-elements-Large-Poset ( is-large-suplattice-Prop-Large-Locale {I = I} P) R = inv-iff (up-exists R) + +Prop-Large-Suplattice : Large-Suplattice lsuc (_⊔_) lzero +Prop-Large-Suplattice = + make-Large-Suplattice Prop-Large-Poset is-large-suplattice-Prop-Large-Locale ``` ### The large frame of propositions diff --git a/src/foundation/large-locale-of-subtypes.lagda.md b/src/foundation/large-locale-of-subtypes.lagda.md index 4bec76c43e..e93e7a4fba 100644 --- a/src/foundation/large-locale-of-subtypes.lagda.md +++ b/src/foundation/large-locale-of-subtypes.lagda.md @@ -16,6 +16,9 @@ open import foundation-core.sets open import order-theory.greatest-lower-bounds-large-posets open import order-theory.large-locales +open import order-theory.large-preorders +open import order-theory.top-elements-large-posets +open import order-theory.bottom-elements-large-posets open import order-theory.large-meet-semilattices open import order-theory.large-posets open import order-theory.large-suplattices @@ -27,8 +30,9 @@ open import order-theory.powers-of-large-locales ## Idea -The **large locale of subtypes** of a type `A` is the -[power locale](order-theory.powers-of-large-locales.md) `A → Prop-Large-Locale`. +The {{#concept "large locale of subtypes" Agda=powerset-Large-Locale}} of a type +`A` is the [power locale](order-theory.powers-of-large-locales.md) +`A → Prop-Large-Locale`. ## Definition @@ -41,6 +45,11 @@ module _ Large-Locale (λ l2 → l1 ⊔ lsuc l2) (λ l2 l3 → l1 ⊔ l2 ⊔ l3) lzero powerset-Large-Locale = power-Large-Locale A Prop-Large-Locale + large-preorder-powerset-Large-Locale : + Large-Preorder (λ l2 → l1 ⊔ lsuc l2) (λ l2 l3 → l1 ⊔ l2 ⊔ l3) + large-preorder-powerset-Large-Locale = + large-preorder-Large-Locale powerset-Large-Locale + large-poset-powerset-Large-Locale : Large-Poset (λ l2 → l1 ⊔ lsuc l2) (λ l2 l3 → l1 ⊔ l2 ⊔ l3) large-poset-powerset-Large-Locale = @@ -168,4 +177,16 @@ module _ sup-powerset-Large-Locale (λ j → meet-powerset-Large-Locale x (y j)) distributive-meet-sup-powerset-Large-Locale = distributive-meet-sup-Large-Locale (powerset-Large-Locale A) + + has-top-element-powerset-Large-Locale : + has-top-element-Large-Poset (large-poset-powerset-Large-Locale A) + has-top-element-powerset-Large-Locale = + has-top-element-Large-Locale (powerset-Large-Locale A) + + has-bottom-element-powerset-Large-Locale : + has-bottom-element-Large-Poset (large-poset-powerset-Large-Locale A) + has-bottom-element-powerset-Large-Locale = + has-bottom-element-Π-Large-Poset + ( λ _ → Prop-Large-Poset) + ( λ _ → has-bottom-element-Prop-Large-Locale) ``` diff --git a/src/foundation/powersets.lagda.md b/src/foundation/powersets.lagda.md index 33631db4f1..88438e8c9a 100644 --- a/src/foundation/powersets.lagda.md +++ b/src/foundation/powersets.lagda.md @@ -8,13 +8,32 @@ module foundation.powersets where ```agda open import foundation.subtypes +open import foundation.empty-types +open import foundation.embeddings +open import foundation.large-locale-of-propositions +open import foundation.dependent-pair-types open import foundation.universe-levels open import foundation-core.sets open import order-theory.large-posets +open import order-theory.top-elements-large-posets +open import order-theory.top-elements-posets +open import order-theory.order-preserving-maps-large-preorders +open import order-theory.order-preserving-maps-large-posets +open import order-theory.dependent-products-large-preorders +open import order-theory.dependent-products-large-posets +open import order-theory.dependent-products-large-meet-semilattices +open import order-theory.large-meet-semilattices +open import order-theory.meet-semilattices +open import order-theory.dependent-products-large-suplattices +open import order-theory.large-suplattices +open import order-theory.suplattices +open import order-theory.bottom-elements-posets +open import order-theory.bottom-elements-large-posets open import order-theory.large-preorders open import order-theory.posets +open import foundation.unit-type open import order-theory.preorders ``` @@ -25,8 +44,7 @@ open import order-theory.preorders The {{#concept "powerset" Disambiguation="of a type" Agda=powerset WD="power set" WDID=Q205170}} of a type is the [set](foundation-core.sets.md) of all -[subtypes](foundation-core.subtypes.md) with respect to a given -[universe level](foundation.universe-levels.md). +[subtypes](foundation-core.subtypes.md). ## Definition @@ -61,10 +79,14 @@ module _ powerset-Large-Preorder : Large-Preorder (λ l → l1 ⊔ lsuc l) (λ l2 l3 → l1 ⊔ l2 ⊔ l3) - type-Large-Preorder powerset-Large-Preorder l = subtype l A - leq-prop-Large-Preorder powerset-Large-Preorder = leq-prop-subtype - refl-leq-Large-Preorder powerset-Large-Preorder = refl-leq-subtype - transitive-leq-Large-Preorder powerset-Large-Preorder = transitive-leq-subtype + powerset-Large-Preorder = Π-Large-Preorder {I = A} (λ _ → Prop-Large-Preorder) + +module _ + {l1 : Level} (l2 : Level) (A : UU l1) + where + + powerset-Preorder : Preorder (l1 ⊔ lsuc l2) (l1 ⊔ l2) + powerset-Preorder = preorder-Large-Preorder (powerset-Large-Preorder A) l2 ``` ### The powerset large poset @@ -76,33 +98,90 @@ module _ powerset-Large-Poset : Large-Poset (λ l → l1 ⊔ lsuc l) (λ l2 l3 → l1 ⊔ l2 ⊔ l3) - large-preorder-Large-Poset powerset-Large-Poset = powerset-Large-Preorder A - antisymmetric-leq-Large-Poset powerset-Large-Poset P Q = - antisymmetric-leq-subtype P Q + powerset-Large-Poset = Π-Large-Poset {I = A} (λ _ → Prop-Large-Poset) + +module _ + {l1 : Level} (l2 : Level) (A : UU l1) + where + + powerset-Poset : Poset (l1 ⊔ lsuc l2) (l1 ⊔ l2) + powerset-Poset = poset-Large-Poset (powerset-Large-Poset A) l2 ``` -### The powerset preorder at a universe level +### The powerset poset has a top element ```agda module _ {l1 : Level} (A : UU l1) where - powerset-Preorder : (l2 : Level) → Preorder (l1 ⊔ lsuc l2) (l1 ⊔ l2) - powerset-Preorder = preorder-Large-Preorder (powerset-Large-Preorder A) + has-top-element-powerset-Large-Poset : + has-top-element-Large-Poset (powerset-Large-Poset A) + has-top-element-powerset-Large-Poset = + has-top-element-Π-Large-Poset + ( λ _ → Prop-Large-Poset) + ( λ _ → has-top-element-Prop-Large-Locale) + + has-top-element-powerset-Poset : + {l2 : Level} → has-top-element-Poset (powerset-Poset l2 A) + has-top-element-powerset-Poset {l2} = + (λ _ → raise-unit-Prop l2) , (λ _ _ _ → raise-star) ``` -### The powerset poset at a universe level +### The powerset poset has a bottom element ```agda module _ {l1 : Level} (A : UU l1) where - powerset-Poset : (l2 : Level) → Poset (l1 ⊔ lsuc l2) (l1 ⊔ l2) - powerset-Poset = poset-Large-Poset (powerset-Large-Poset A) + has-bottom-element-powerset-Large-Poset : + has-bottom-element-Large-Poset (powerset-Large-Poset A) + has-bottom-element-powerset-Large-Poset = + has-bottom-element-Π-Large-Poset + ( λ _ → Prop-Large-Poset) + ( λ _ → has-bottom-element-Prop-Large-Locale) + + has-bottom-element-powerset-Poset : + {l2 : Level} → has-bottom-element-Poset (powerset-Poset l2 A) + has-bottom-element-powerset-Poset {l2} = + (λ _ → raise-empty-Prop l2) , (λ _ _ → raise-ex-falso l2) ``` +### The powerset meet semilattice + +```agda +module _ + {l1 : Level} (A : UU l1) + where + + powerset-Large-Meet-Semilattice : + Large-Meet-Semilattice (λ l2 → l1 ⊔ lsuc l2) (λ l2 l3 → l1 ⊔ l2 ⊔ l3) + powerset-Large-Meet-Semilattice = + Π-Large-Meet-Semilattice {I = A} (λ _ → Prop-Large-Meet-Semilattice) +``` + +### Maps of types give order preserving maps on their powersets + +```agda +hom-map-type-powerset-Large-Poset : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) → + hom-Large-Poset (λ l → l) (powerset-Large-Poset B) (powerset-Large-Poset A) +hom-map-type-powerset-Large-Poset f = + make-hom-Large-Preorder + ( λ B' x → B' (f x)) + ( λ B' B'' B'⊆B'' x B'fx → B'⊆B'' (f x) B'fx) +``` + +If `f` is an embedding, then `f(A) ≃ A`... + +## See also + +- [the locale of subtypes](foundation.locale-of-subtypes.md) +- [the large locale of subtypes](foundation.large-locale-of-subtypes.md) +- [preimages of subtypes](foundation.preimages-subtypes.md) +- [images of subtypes](foundation.images-subtypes.md) + ## External links - [power object](https://ncatlab.org/nlab/show/power+object) at $n$Lab diff --git a/src/foundation/preimages-of-subtypes.lagda.md b/src/foundation/preimages-of-subtypes.lagda.md index ac1a192b66..9811659371 100644 --- a/src/foundation/preimages-of-subtypes.lagda.md +++ b/src/foundation/preimages-of-subtypes.lagda.md @@ -16,8 +16,9 @@ open import foundation-core.subtypes ## Idea -The preimage of a subtype `S ⊆ B` under a map `f : A → B` is the subtype of `A` -consisting of elements `a` such that `f a ∈ S`. +The {{#concept "preimage" Disambiguation="of a subtype" Agda=preimage-subtype}} +of a [subtype](foundation-core.subtypes.md) `S ⊆ B` under a map `f : A → B` is +the subtype of `A` consisting of elements `a` such that `f a ∈ S`. ## Definition diff --git a/src/order-theory/bottom-elements-large-posets.lagda.md b/src/order-theory/bottom-elements-large-posets.lagda.md new file mode 100644 index 0000000000..fa60f601b4 --- /dev/null +++ b/src/order-theory/bottom-elements-large-posets.lagda.md @@ -0,0 +1,79 @@ +# Bottom elements in large posets + +```agda +module order-theory.bottom-elements-large-posets where +``` + +
Imports + +```agda +open import foundation.universe-levels + +open import order-theory.dependent-products-large-posets +open import order-theory.large-posets +``` + +
+ +## Idea + +We say that a [large poset](order-theory.large-posets.md) `P` has a +{{#concept "least element" Disambiguation="in a large poset" Agda=is-bottom-element-Large-Poset}} +if it comes equipped with an element `t : type-Large-Poset P lzero` such that +`t ≤ x` holds for every `x : P` + +## Definition + +### The predicate on elements of posets of being a bottom element + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} (P : Large-Poset α β) + where + + is-bottom-element-Large-Poset : + {l1 : Level} → type-Large-Poset P l1 → UUω + is-bottom-element-Large-Poset x = + {l : Level} (y : type-Large-Poset P l) → leq-Large-Poset P x y +``` + +### The predicate on posets of having a bottom element + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + where + + record + has-bottom-element-Large-Poset : UUω + where + field + bottom-has-bottom-element-Large-Poset : + type-Large-Poset P lzero + is-bottom-element-bottom-has-bottom-element-Large-Poset : + is-bottom-element-Large-Poset P bottom-has-bottom-element-Large-Poset + + open has-bottom-element-Large-Poset public +``` + +## Properties + +### If `P` is a family of large posets, then `Π-Large-Poset P` has a bottom element + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + {l1 : Level} {I : UU l1} (P : I → Large-Poset α β) + where + + has-bottom-element-Π-Large-Poset : + ((i : I) → has-bottom-element-Large-Poset (P i)) → + has-bottom-element-Large-Poset (Π-Large-Poset P) + bottom-has-bottom-element-Large-Poset + ( has-bottom-element-Π-Large-Poset H) i = + bottom-has-bottom-element-Large-Poset (H i) + is-bottom-element-bottom-has-bottom-element-Large-Poset + ( has-bottom-element-Π-Large-Poset H) x i = + is-bottom-element-bottom-has-bottom-element-Large-Poset (H i) (x i) +``` diff --git a/src/order-theory/bottom-elements-preorders.lagda.md b/src/order-theory/bottom-elements-preorders.lagda.md index 538fba883d..5d5c0f1b8b 100644 --- a/src/order-theory/bottom-elements-preorders.lagda.md +++ b/src/order-theory/bottom-elements-preorders.lagda.md @@ -30,7 +30,7 @@ module _ is-bottom-element-Preorder-Prop : type-Preorder X → Prop (l1 ⊔ l2) is-bottom-element-Preorder-Prop x = - Π-Prop (type-Preorder X) (leq-Preorder-Prop X x) + Π-Prop (type-Preorder X) (leq-prop-Preorder X x) is-bottom-element-Preorder : type-Preorder X → UU (l1 ⊔ l2) is-bottom-element-Preorder x = type-Prop (is-bottom-element-Preorder-Prop x) diff --git a/src/order-theory/decidable-posets.lagda.md b/src/order-theory/decidable-posets.lagda.md index ed925a3c91..b02c21afbf 100644 --- a/src/order-theory/decidable-posets.lagda.md +++ b/src/order-theory/decidable-posets.lagda.md @@ -34,15 +34,15 @@ module _ {l1 l2 : Level} (X : Poset l1 l2) where - is-decidable-leq-Poset-Prop : Prop (l1 ⊔ l2) - is-decidable-leq-Poset-Prop = - is-decidable-leq-Preorder-Prop (preorder-Poset X) + is-decidable-leq-prop-Poset : Prop (l1 ⊔ l2) + is-decidable-leq-prop-Poset = + is-decidable-leq-prop-Preorder (preorder-Poset X) is-decidable-leq-Poset : UU (l1 ⊔ l2) - is-decidable-leq-Poset = type-Prop is-decidable-leq-Poset-Prop + is-decidable-leq-Poset = type-Prop is-decidable-leq-prop-Poset is-prop-is-decidable-leq-Poset : is-prop is-decidable-leq-Poset - is-prop-is-decidable-leq-Poset = is-prop-type-Prop is-decidable-leq-Poset-Prop + is-prop-is-decidable-leq-Poset = is-prop-type-Prop is-decidable-leq-prop-Poset Decidable-Poset : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) Decidable-Poset l1 l2 = Σ (Poset l1 l2) is-decidable-leq-Poset @@ -65,7 +65,7 @@ module _ type-Decidable-Poset = type-Poset poset-Decidable-Poset leq-Decidable-Poset-Prop : (x y : type-Decidable-Poset) → Prop l2 - leq-Decidable-Poset-Prop = leq-Poset-Prop poset-Decidable-Poset + leq-Decidable-Poset-Prop = leq-prop-Poset poset-Decidable-Poset leq-Decidable-Poset : (x y : type-Decidable-Poset) → UU l2 leq-Decidable-Poset = leq-Poset poset-Decidable-Poset diff --git a/src/order-theory/decidable-preorders.lagda.md b/src/order-theory/decidable-preorders.lagda.md index 1c6a02dccc..55e5f0d4ef 100644 --- a/src/order-theory/decidable-preorders.lagda.md +++ b/src/order-theory/decidable-preorders.lagda.md @@ -30,21 +30,21 @@ module _ {l1 l2 : Level} (X : Preorder l1 l2) where - is-decidable-leq-Preorder-Prop : Prop (l1 ⊔ l2) - is-decidable-leq-Preorder-Prop = + is-decidable-leq-prop-Preorder : Prop (l1 ⊔ l2) + is-decidable-leq-prop-Preorder = Π-Prop ( type-Preorder X) ( λ x → Π-Prop ( type-Preorder X) - ( λ y → is-decidable-Prop (leq-Preorder-Prop X x y))) + ( λ y → is-decidable-Prop (leq-prop-Preorder X x y))) is-decidable-leq-Preorder : UU (l1 ⊔ l2) - is-decidable-leq-Preorder = type-Prop is-decidable-leq-Preorder-Prop + is-decidable-leq-Preorder = type-Prop is-decidable-leq-prop-Preorder is-prop-is-decidable-leq-Preorder : is-prop is-decidable-leq-Preorder is-prop-is-decidable-leq-Preorder = - is-prop-type-Prop is-decidable-leq-Preorder-Prop + is-prop-type-Prop is-decidable-leq-prop-Preorder Decidable-Preorder : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) Decidable-Preorder l1 l2 = Σ (Preorder l1 l2) is-decidable-leq-Preorder @@ -66,7 +66,7 @@ module _ leq-Decidable-Preorder-Prop : (x y : type-Decidable-Preorder) → Prop l2 leq-Decidable-Preorder-Prop = - leq-Preorder-Prop preorder-Decidable-Preorder + leq-prop-Preorder preorder-Decidable-Preorder leq-Decidable-Preorder : (x y : type-Decidable-Preorder) → UU l2 diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index 6e25cceabf..924542f3ce 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -38,7 +38,7 @@ which the inequality [relation](foundation.binary-relations.md) is ```agda is-decidable-total-prop-Poset : {l1 l2 : Level} → Poset l1 l2 → Prop (l1 ⊔ l2) is-decidable-total-prop-Poset P = - product-Prop (is-total-Poset-Prop P) (is-decidable-leq-Poset-Prop P) + product-Prop (is-total-Poset-Prop P) (is-decidable-leq-prop-Poset P) is-decidable-total-Poset : {l1 l2 : Level} → Poset l1 l2 → UU (l1 ⊔ l2) is-decidable-total-Poset P = type-Prop (is-decidable-total-prop-Poset P) @@ -75,7 +75,7 @@ module _ leq-Decidable-Total-Order-Prop : (x y : type-Decidable-Total-Order) → Prop l2 - leq-Decidable-Total-Order-Prop = leq-Poset-Prop poset-Decidable-Total-Order + leq-Decidable-Total-Order-Prop = leq-prop-Poset poset-Decidable-Total-Order leq-Decidable-Total-Order : (x y : type-Decidable-Total-Order) → UU l2 diff --git a/src/order-theory/decidable-total-preorders.lagda.md b/src/order-theory/decidable-total-preorders.lagda.md index 351b2a1d2a..5920a68fb7 100644 --- a/src/order-theory/decidable-total-preorders.lagda.md +++ b/src/order-theory/decidable-total-preorders.lagda.md @@ -67,7 +67,7 @@ module _ leq-Decidable-Total-Preorder-Prop : (x y : type-Decidable-Total-Preorder) → Prop l2 leq-Decidable-Total-Preorder-Prop = - leq-Preorder-Prop preorder-Decidable-Total-Preorder + leq-prop-Preorder preorder-Decidable-Total-Preorder leq-Decidable-Total-Preorder : (x y : type-Decidable-Total-Preorder) → UU l2 diff --git a/src/order-theory/directed-families.lagda.md b/src/order-theory/directed-families.lagda.md index e82194883e..c31b18247d 100644 --- a/src/order-theory/directed-families.lagda.md +++ b/src/order-theory/directed-families.lagda.md @@ -42,7 +42,7 @@ is-directed-family-Poset-Prop P I x = ( λ j → ∃ ( type-Inhabited-Type I) ( λ k → - leq-Poset-Prop P (x i) (x k) ∧ leq-Poset-Prop P (x j) (x k)))) + leq-prop-Poset P (x i) (x k) ∧ leq-prop-Poset P (x j) (x k)))) is-directed-family-Poset : {l1 l2 l3 : Level} (P : Poset l1 l2) (I : Inhabited-Type l3) diff --git a/src/order-theory/finite-preorders.lagda.md b/src/order-theory/finite-preorders.lagda.md index 1e5829d497..43b07c9b4e 100644 --- a/src/order-theory/finite-preorders.lagda.md +++ b/src/order-theory/finite-preorders.lagda.md @@ -48,7 +48,7 @@ module _ is-finite-Preorder-Prop = product-Prop ( is-finite-Prop (type-Preorder P)) - ( is-decidable-leq-Preorder-Prop P) + ( is-decidable-leq-prop-Preorder P) is-finite-Preorder : UU (l1 ⊔ l2) is-finite-Preorder = type-Prop is-finite-Preorder-Prop diff --git a/src/order-theory/finitely-graded-posets.lagda.md b/src/order-theory/finitely-graded-posets.lagda.md index 35ff0bedae..b4fb4a404b 100644 --- a/src/order-theory/finitely-graded-posets.lagda.md +++ b/src/order-theory/finitely-graded-posets.lagda.md @@ -403,7 +403,7 @@ module _ is-top-element-Finitely-Graded-Poset-Prop : Prop (l1 ⊔ l2) is-top-element-Finitely-Graded-Poset-Prop = - is-top-element-Poset-Prop + is-top-element-prop-Poset ( poset-Finitely-Graded-Poset X) ( element-face-Finitely-Graded-Poset X x) diff --git a/src/order-theory/frames.lagda.md b/src/order-theory/frames.lagda.md index 46e4450009..96d2f47cec 100644 --- a/src/order-theory/frames.lagda.md +++ b/src/order-theory/frames.lagda.md @@ -213,7 +213,7 @@ module _ is-set-type-Frame = is-set-type-Poset poset-Frame leq-Frame-Prop : (x y : type-Frame) → Prop l1 - leq-Frame-Prop = leq-Poset-Prop poset-Frame + leq-Frame-Prop = leq-prop-Poset poset-Frame leq-Frame : (x y : type-Frame) → UU l1 leq-Frame = leq-Poset poset-Frame diff --git a/src/order-theory/galois-connections.lagda.md b/src/order-theory/galois-connections.lagda.md index 166d4d22a0..5ae6e96259 100644 --- a/src/order-theory/galois-connections.lagda.md +++ b/src/order-theory/galois-connections.lagda.md @@ -52,8 +52,8 @@ module _ ( type-Poset Q) ( λ y → iff-Prop - ( leq-Poset-Prop Q (map-hom-Poset P Q f x) y) - ( leq-Poset-Prop P x (map-hom-Poset Q P g y)))) + ( leq-prop-Poset Q (map-hom-Poset P Q f x) y) + ( leq-prop-Poset P x (map-hom-Poset Q P g y)))) is-lower-adjoint-Galois-Connection : hom-Poset P Q → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) diff --git a/src/order-theory/greatest-lower-bounds-posets.lagda.md b/src/order-theory/greatest-lower-bounds-posets.lagda.md index c6afa32f62..4af9d5721f 100644 --- a/src/order-theory/greatest-lower-bounds-posets.lagda.md +++ b/src/order-theory/greatest-lower-bounds-posets.lagda.md @@ -56,7 +56,7 @@ module _ ( λ y → iff-Prop ( is-binary-lower-bound-Poset-Prop P a b y) - ( leq-Poset-Prop P y x)) + ( leq-prop-Poset P y x)) is-greatest-binary-lower-bound-Poset : type-Poset P → UU (l1 ⊔ l2) is-greatest-binary-lower-bound-Poset x = @@ -187,8 +187,8 @@ module _ ( type-Poset P) ( λ y → iff-Prop - ( Π-Prop I (λ i → leq-Poset-Prop P y (a i))) - ( leq-Poset-Prop P y x)) + ( Π-Prop I (λ i → leq-prop-Poset P y (a i))) + ( leq-prop-Poset P y x)) is-greatest-lower-bound-family-of-elements-Poset : type-Poset P → UU (l1 ⊔ l2 ⊔ l3) diff --git a/src/order-theory/inflattices.lagda.md b/src/order-theory/inflattices.lagda.md index 82ce33afe8..fefcf53ce8 100644 --- a/src/order-theory/inflattices.lagda.md +++ b/src/order-theory/inflattices.lagda.md @@ -83,8 +83,8 @@ module _ type-Inflattice : UU l1 type-Inflattice = type-Poset poset-Inflattice - leq-Inflattice-Prop : (x y : type-Inflattice) → Prop l2 - leq-Inflattice-Prop = leq-Poset-Prop poset-Inflattice + leq-prop-Inflattice : (x y : type-Inflattice) → Prop l2 + leq-prop-Inflattice = leq-prop-Poset poset-Inflattice leq-Inflattice : (x y : type-Inflattice) → UU l2 leq-Inflattice = leq-Poset poset-Inflattice diff --git a/src/order-theory/interval-subposets.lagda.md b/src/order-theory/interval-subposets.lagda.md index 6788934942..9daab30432 100644 --- a/src/order-theory/interval-subposets.lagda.md +++ b/src/order-theory/interval-subposets.lagda.md @@ -31,7 +31,7 @@ module _ is-in-interval-Poset : (z : type-Poset X) → Prop l2 is-in-interval-Poset z = - product-Prop (leq-Poset-Prop X x z) (leq-Poset-Prop X z y) + product-Prop (leq-prop-Poset X x z) (leq-prop-Poset X z y) poset-interval-Subposet : Poset (l1 ⊔ l2) l2 poset-interval-Subposet = poset-Subposet X is-in-interval-Poset diff --git a/src/order-theory/join-semilattices.lagda.md b/src/order-theory/join-semilattices.lagda.md index 38ae8a9889..3a2cd051aa 100644 --- a/src/order-theory/join-semilattices.lagda.md +++ b/src/order-theory/join-semilattices.lagda.md @@ -308,7 +308,7 @@ module _ leq-Order-Theoretic-Join-Semilattice-Prop : (x y : type-Order-Theoretic-Join-Semilattice) → Prop l2 leq-Order-Theoretic-Join-Semilattice-Prop = - leq-Poset-Prop poset-Order-Theoretic-Join-Semilattice + leq-prop-Poset poset-Order-Theoretic-Join-Semilattice leq-Order-Theoretic-Join-Semilattice : (x y : type-Order-Theoretic-Join-Semilattice) → UU l2 diff --git a/src/order-theory/lattices.lagda.md b/src/order-theory/lattices.lagda.md index 6334ebe73a..bc9d9bc466 100644 --- a/src/order-theory/lattices.lagda.md +++ b/src/order-theory/lattices.lagda.md @@ -61,7 +61,7 @@ module _ type-Lattice = type-Poset poset-Lattice leq-lattice-Prop : (x y : type-Lattice) → Prop l2 - leq-lattice-Prop = leq-Poset-Prop poset-Lattice + leq-lattice-Prop = leq-prop-Poset poset-Lattice leq-Lattice : (x y : type-Lattice) → UU l2 leq-Lattice = leq-Poset poset-Lattice diff --git a/src/order-theory/least-upper-bounds-posets.lagda.md b/src/order-theory/least-upper-bounds-posets.lagda.md index 7bddf850d8..fcb1b4a1f7 100644 --- a/src/order-theory/least-upper-bounds-posets.lagda.md +++ b/src/order-theory/least-upper-bounds-posets.lagda.md @@ -56,7 +56,7 @@ module _ ( λ y → iff-Prop ( is-binary-upper-bound-Poset-Prop P a b y) - ( leq-Poset-Prop P x y)) + ( leq-prop-Poset P x y)) is-least-binary-upper-bound-Poset : type-Poset P → UU (l1 ⊔ l2) is-least-binary-upper-bound-Poset x = @@ -187,8 +187,8 @@ module _ ( type-Poset P) ( λ y → iff-Prop - ( Π-Prop I (λ i → leq-Poset-Prop P (a i) y)) - ( leq-Poset-Prop P x y)) + ( Π-Prop I (λ i → leq-prop-Poset P (a i) y)) + ( leq-prop-Poset P x y)) is-least-upper-bound-family-of-elements-Poset : type-Poset P → UU (l1 ⊔ l2 ⊔ l3) diff --git a/src/order-theory/lower-bounds-posets.lagda.md b/src/order-theory/lower-bounds-posets.lagda.md index 32e062d37a..0efcbd6283 100644 --- a/src/order-theory/lower-bounds-posets.lagda.md +++ b/src/order-theory/lower-bounds-posets.lagda.md @@ -34,7 +34,7 @@ module _ is-binary-lower-bound-Poset-Prop : Prop l2 is-binary-lower-bound-Poset-Prop = - product-Prop (leq-Poset-Prop P x a) (leq-Poset-Prop P x b) + product-Prop (leq-prop-Poset P x a) (leq-prop-Poset P x b) is-binary-lower-bound-Poset : UU l2 is-binary-lower-bound-Poset = @@ -65,7 +65,7 @@ module _ is-lower-bound-family-of-elements-Poset-Prop : type-Poset P → Prop (l2 ⊔ l3) is-lower-bound-family-of-elements-Poset-Prop z = - Π-Prop I (λ i → leq-Poset-Prop P z (x i)) + Π-Prop I (λ i → leq-prop-Poset P z (x i)) is-lower-bound-family-of-elements-Poset : type-Poset P → UU (l2 ⊔ l3) is-lower-bound-family-of-elements-Poset z = diff --git a/src/order-theory/meet-semilattices.lagda.md b/src/order-theory/meet-semilattices.lagda.md index 09fd773dc2..ab9a4a7687 100644 --- a/src/order-theory/meet-semilattices.lagda.md +++ b/src/order-theory/meet-semilattices.lagda.md @@ -317,7 +317,7 @@ module _ leq-Order-Theoretic-Meet-Semilattice-Prop : (x y : type-Order-Theoretic-Meet-Semilattice) → Prop l2 leq-Order-Theoretic-Meet-Semilattice-Prop = - leq-Poset-Prop poset-Order-Theoretic-Meet-Semilattice + leq-prop-Poset poset-Order-Theoretic-Meet-Semilattice leq-Order-Theoretic-Meet-Semilattice : (x y : type-Order-Theoretic-Meet-Semilattice) → UU l2 diff --git a/src/order-theory/meet-suplattices.lagda.md b/src/order-theory/meet-suplattices.lagda.md index c9ee77f4e0..898eeb5f7a 100644 --- a/src/order-theory/meet-suplattices.lagda.md +++ b/src/order-theory/meet-suplattices.lagda.md @@ -74,7 +74,7 @@ module _ type-Poset poset-Meet-Suplattice leq-meet-suplattice-Prop : (x y : type-Meet-Suplattice) → Prop l1 - leq-meet-suplattice-Prop = leq-Poset-Prop poset-Meet-Suplattice + leq-meet-suplattice-Prop = leq-prop-Poset poset-Meet-Suplattice leq-Meet-Suplattice : (x y : type-Meet-Suplattice) → UU l1 leq-Meet-Suplattice = leq-Poset poset-Meet-Suplattice diff --git a/src/order-theory/opposite-large-posets.lagda.md b/src/order-theory/opposite-large-posets.lagda.md new file mode 100644 index 0000000000..9f56add9c4 --- /dev/null +++ b/src/order-theory/opposite-large-posets.lagda.md @@ -0,0 +1,107 @@ +# Opposite large posets + +```agda +module order-theory.opposite-large-posets where +``` + +
Imports + +```agda +open import order-theory.large-preorders +open import order-theory.opposite-large-preorders +open import order-theory.large-posets + +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.homotopies +open import foundation.identity-types +open import foundation.sets +open import foundation.large-identity-types +open import foundation.propositions +open import foundation.universe-levels +``` + +
+ +## Idea + +Let `X` be a [large poset](order-theory.large-posets.md), its +{{#concept "opposite" Disambiguation="large poset" Agda=opposite-Large-Poset}} +`Xᵒᵖ` is given by reversing the relation. + +## Definition + +### The opposite large poset + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} (P : Large-Poset α β) + where + + large-preorder-opposite-Large-Poset : + Large-Preorder α (λ l1 l2 → β l2 l1) + large-preorder-opposite-Large-Poset = + opposite-Large-Preorder (large-preorder-Large-Poset P) + + type-opposite-Large-Poset : (l : Level) → UU (α l) + type-opposite-Large-Poset = type-Large-Preorder large-preorder-opposite-Large-Poset + + leq-prop-opposite-Large-Poset : + {l1 l2 : Level} + (X : type-opposite-Large-Poset l1) + (Y : type-opposite-Large-Poset l2) → Prop (β l2 l1) + leq-prop-opposite-Large-Poset = + leq-prop-Large-Preorder large-preorder-opposite-Large-Poset + + leq-opposite-Large-Poset : + {l1 l2 : Level} + (X : type-opposite-Large-Poset l1) + (Y : type-opposite-Large-Poset l2) → UU (β l2 l1) + leq-opposite-Large-Poset = + leq-Large-Preorder large-preorder-opposite-Large-Poset + + transitive-leq-opposite-Large-Poset : + {l1 l2 l3 : Level} + (X : type-opposite-Large-Poset l1) + (Y : type-opposite-Large-Poset l2) + (Z : type-opposite-Large-Poset l3) → + leq-opposite-Large-Poset Y Z → + leq-opposite-Large-Poset X Y → + leq-opposite-Large-Poset X Z + transitive-leq-opposite-Large-Poset = + transitive-leq-Large-Preorder large-preorder-opposite-Large-Poset + + refl-leq-opposite-Large-Poset : + {l1 : Level} (X : type-opposite-Large-Poset l1) → + leq-opposite-Large-Poset X X + refl-leq-opposite-Large-Poset = + refl-leq-Large-Preorder large-preorder-opposite-Large-Poset + + antisymmetric-leq-opposite-Large-Poset : + {l1 : Level} (X Y : type-opposite-Large-Poset l1) → + leq-opposite-Large-Poset X Y → + leq-opposite-Large-Poset Y X → + X = Y + antisymmetric-leq-opposite-Large-Poset X Y p q = + antisymmetric-leq-Large-Poset P X Y q p + + opposite-Large-Poset : Large-Poset α (λ l1 l2 → β l2 l1) + opposite-Large-Poset = + make-Large-Poset + large-preorder-opposite-Large-Poset + antisymmetric-leq-opposite-Large-Poset +``` + +## Properties + +### The opposite large poset construction is a strict involution + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} (P : Large-Poset α β) + where + + is-involution-opposite-Large-Poset : + opposite-Large-Poset (opposite-Large-Poset P) =ω P + is-involution-opposite-Large-Poset = reflω +``` diff --git a/src/order-theory/opposite-large-preorders.lagda.md b/src/order-theory/opposite-large-preorders.lagda.md new file mode 100644 index 0000000000..0bbd0e21d3 --- /dev/null +++ b/src/order-theory/opposite-large-preorders.lagda.md @@ -0,0 +1,92 @@ +# Opposite large preorders + +```agda +module order-theory.opposite-large-preorders where +``` + +
Imports + +```agda +open import order-theory.large-preorders + +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.homotopies +open import foundation.identity-types +open import foundation.sets +open import foundation.large-identity-types +open import foundation.propositions +open import foundation.universe-levels +``` + +
+ +## Idea + +Let `X` be a [large preorder](order-theory.large-preorders.md), its +{{#concept "opposite" Disambiguation="large preorder" Agda=opposite-Large-Preorder}} +`Xᵒᵖ` is given by reversing the relation. + +## Definition + +### The opposite large preorder + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} (P : Large-Preorder α β) + where + + type-opposite-Large-Preorder : (l : Level) → UU (α l) + type-opposite-Large-Preorder = type-Large-Preorder P + + leq-prop-opposite-Large-Preorder : + {l1 l2 : Level} + (X : type-opposite-Large-Preorder l1) + (Y : type-opposite-Large-Preorder l2) → Prop (β l2 l1) + leq-prop-opposite-Large-Preorder X Y = leq-prop-Large-Preorder P Y X + + leq-opposite-Large-Preorder : + {l1 l2 : Level} + (X : type-opposite-Large-Preorder l1) + (Y : type-opposite-Large-Preorder l2) → UU (β l2 l1) + leq-opposite-Large-Preorder X Y = + type-Prop (leq-prop-opposite-Large-Preorder X Y) + + transitive-leq-opposite-Large-Preorder : + {l1 l2 l3 : Level} + (X : type-opposite-Large-Preorder l1) + (Y : type-opposite-Large-Preorder l2) + (Z : type-opposite-Large-Preorder l3) → + leq-opposite-Large-Preorder Y Z → + leq-opposite-Large-Preorder X Y → + leq-opposite-Large-Preorder X Z + transitive-leq-opposite-Large-Preorder X Y Z g f = + transitive-leq-Large-Preorder P Z Y X f g + + refl-leq-opposite-Large-Preorder : + {l1 : Level} (X : type-opposite-Large-Preorder l1) → + leq-opposite-Large-Preorder X X + refl-leq-opposite-Large-Preorder = refl-leq-Large-Preorder P + + opposite-Large-Preorder : Large-Preorder α (λ l1 l2 → β l2 l1) + opposite-Large-Preorder = + make-Large-Preorder + type-opposite-Large-Preorder + leq-prop-opposite-Large-Preorder + refl-leq-opposite-Large-Preorder + transitive-leq-opposite-Large-Preorder +``` + +## Properties + +### The opposite large preorder construction is a strict involution + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} (P : Large-Preorder α β) + where + + is-involution-opposite-Large-Preorder : + opposite-Large-Preorder (opposite-Large-Preorder P) =ω P + is-involution-opposite-Large-Preorder = reflω +``` diff --git a/src/order-theory/opposite-posets.lagda.md b/src/order-theory/opposite-posets.lagda.md new file mode 100644 index 0000000000..2a219e52c0 --- /dev/null +++ b/src/order-theory/opposite-posets.lagda.md @@ -0,0 +1,93 @@ +# Opposite posets + +```agda +module order-theory.opposite-posets where +``` + +
Imports + +```agda +open import order-theory.preorders +open import order-theory.opposite-preorders +open import order-theory.posets + +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.homotopies +open import foundation.identity-types +open import foundation.sets +open import foundation.identity-types +open import foundation.propositions +open import foundation.universe-levels +``` + +
+ +## Idea + +Let `X` be a [poset](order-theory.posets.md), its +{{#concept "opposite" Disambiguation="poset" Agda=opposite-Poset}} `Xᵒᵖ` is +given by reversing the relation. + +## Definition + +### The opposite poset + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) + where + + preorder-opposite-Poset : Preorder l1 l2 + preorder-opposite-Poset = + opposite-Preorder (preorder-Poset P) + + type-opposite-Poset : UU l1 + type-opposite-Poset = type-Preorder preorder-opposite-Poset + + leq-prop-opposite-Poset : (X Y : type-opposite-Poset) → Prop l2 + leq-prop-opposite-Poset = + leq-prop-Preorder preorder-opposite-Poset + + leq-opposite-Poset : (X Y : type-opposite-Poset) → UU l2 + leq-opposite-Poset = + leq-Preorder preorder-opposite-Poset + + transitive-leq-opposite-Poset : + (X Y Z : type-opposite-Poset) → + leq-opposite-Poset Y Z → + leq-opposite-Poset X Y → + leq-opposite-Poset X Z + transitive-leq-opposite-Poset = + transitive-leq-Preorder preorder-opposite-Poset + + refl-leq-opposite-Poset : + (X : type-opposite-Poset) → leq-opposite-Poset X X + refl-leq-opposite-Poset = + refl-leq-Preorder preorder-opposite-Poset + + antisymmetric-leq-opposite-Poset : + (X Y : type-opposite-Poset) → + leq-opposite-Poset X Y → + leq-opposite-Poset Y X → + X = Y + antisymmetric-leq-opposite-Poset X Y p q = + antisymmetric-leq-Poset P X Y q p + + opposite-Poset : Poset l1 l2 + opposite-Poset = + ( preorder-opposite-Poset , antisymmetric-leq-opposite-Poset) +``` + +## Properties + +### The opposite poset construction is a strict involution + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) + where + + is-involution-opposite-Poset : opposite-Poset (opposite-Poset P) = P + is-involution-opposite-Poset = refl +``` diff --git a/src/order-theory/opposite-preorders.lagda.md b/src/order-theory/opposite-preorders.lagda.md new file mode 100644 index 0000000000..c21e1dbcc9 --- /dev/null +++ b/src/order-theory/opposite-preorders.lagda.md @@ -0,0 +1,82 @@ +# Opposite preorders + +```agda +module order-theory.opposite-preorders where +``` + +
Imports + +```agda +open import order-theory.preorders + +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.homotopies +open import foundation.identity-types +open import foundation.sets +open import foundation.identity-types +open import foundation.propositions +open import foundation.universe-levels +``` + +
+ +## Idea + +Let `X` be a [preorder](order-theory.preorders.md), its +{{#concept "opposite" Disambiguation="preorder" Agda=opposite-Preorder}} `Xᵒᵖ` +is given by reversing the relation. + +## Definition + +### The opposite preorder + +```agda +module _ + {l1 l2 : Level} (P : Preorder l1 l2) + where + + type-opposite-Preorder : UU l1 + type-opposite-Preorder = type-Preorder P + + leq-prop-opposite-Preorder : + (X Y : type-opposite-Preorder) → Prop l2 + leq-prop-opposite-Preorder X Y = leq-prop-Preorder P Y X + + leq-opposite-Preorder : + (X Y : type-opposite-Preorder) → UU l2 + leq-opposite-Preorder X Y = + type-Prop (leq-prop-opposite-Preorder X Y) + + transitive-leq-opposite-Preorder : + (X Y Z : type-opposite-Preorder) → + leq-opposite-Preorder Y Z → + leq-opposite-Preorder X Y → + leq-opposite-Preorder X Z + transitive-leq-opposite-Preorder X Y Z g f = + transitive-leq-Preorder P Z Y X f g + + refl-leq-opposite-Preorder : + (X : type-opposite-Preorder) → leq-opposite-Preorder X X + refl-leq-opposite-Preorder = refl-leq-Preorder P + + opposite-Preorder : Preorder l1 l2 + opposite-Preorder = + ( type-opposite-Preorder , + leq-prop-opposite-Preorder , + refl-leq-opposite-Preorder , + transitive-leq-opposite-Preorder) +``` + +## Properties + +### The opposite preorder construction is a strict involution + +```agda +module _ + {l1 l2 : Level} (P : Preorder l1 l2) + where + + is-involution-opposite-Preorder : opposite-Preorder (opposite-Preorder P) = P + is-involution-opposite-Preorder = refl +``` diff --git a/src/order-theory/order-preserving-maps-preorders.lagda.md b/src/order-theory/order-preserving-maps-preorders.lagda.md index b3bbc7d62b..645cdc5ca2 100644 --- a/src/order-theory/order-preserving-maps-preorders.lagda.md +++ b/src/order-theory/order-preserving-maps-preorders.lagda.md @@ -49,8 +49,8 @@ module _ ( type-Preorder P) ( λ y → hom-Prop - ( leq-Preorder-Prop P x y) - ( leq-Preorder-Prop Q (f x) (f y)))) + ( leq-prop-Preorder P x y) + ( leq-prop-Preorder Q (f x) (f y)))) preserves-order-Preorder : (type-Preorder P → type-Preorder Q) → UU (l1 ⊔ l2 ⊔ l4) diff --git a/src/order-theory/posets.lagda.md b/src/order-theory/posets.lagda.md index e3e5d5e91b..eeaad7775f 100644 --- a/src/order-theory/posets.lagda.md +++ b/src/order-theory/posets.lagda.md @@ -54,8 +54,8 @@ module _ type-Poset : UU l1 type-Poset = type-Preorder preorder-Poset - leq-Poset-Prop : (x y : type-Poset) → Prop l2 - leq-Poset-Prop = leq-Preorder-Prop preorder-Poset + leq-prop-Poset : (x y : type-Poset) → Prop l2 + leq-prop-Poset = leq-prop-Preorder preorder-Poset leq-Poset : (x y : type-Poset) → UU l2 leq-Poset = leq-Preorder preorder-Poset diff --git a/src/order-theory/preorders.lagda.md b/src/order-theory/preorders.lagda.md index 2bc2aa9ba2..5a0566e303 100644 --- a/src/order-theory/preorders.lagda.md +++ b/src/order-theory/preorders.lagda.md @@ -47,14 +47,14 @@ module _ type-Preorder : UU l1 type-Preorder = pr1 X - leq-Preorder-Prop : Relation-Prop l2 type-Preorder - leq-Preorder-Prop = pr1 (pr2 X) + leq-prop-Preorder : Relation-Prop l2 type-Preorder + leq-prop-Preorder = pr1 (pr2 X) leq-Preorder : (x y : type-Preorder) → UU l2 - leq-Preorder x y = type-Prop (leq-Preorder-Prop x y) + leq-Preorder x y = type-Prop (leq-prop-Preorder x y) is-prop-leq-Preorder : (x y : type-Preorder) → is-prop (leq-Preorder x y) - is-prop-leq-Preorder = is-prop-type-Relation-Prop leq-Preorder-Prop + is-prop-leq-Preorder = is-prop-type-Relation-Prop leq-prop-Preorder concatenate-eq-leq-Preorder : {x y z : type-Preorder} → x = y → leq-Preorder y z → leq-Preorder x z @@ -66,7 +66,7 @@ module _ le-Preorder-Prop : Relation-Prop (l1 ⊔ l2) type-Preorder le-Preorder-Prop x y = - product-Prop (x ≠ y , is-prop-neg) (leq-Preorder-Prop x y) + product-Prop (x ≠ y , is-prop-neg) (leq-prop-Preorder x y) le-Preorder : Relation (l1 ⊔ l2) type-Preorder le-Preorder x y = type-Prop (le-Preorder-Prop x y) @@ -140,13 +140,13 @@ module _ precategory-Preorder = make-Precategory ( type-Preorder X) - ( λ x y → set-Prop (leq-Preorder-Prop X x y)) + ( λ x y → set-Prop (leq-prop-Preorder X x y)) ( λ {x} {y} {z} → is-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-Preorder-Prop X x w))) - ( λ {x} {y} f → eq-is-prop (is-prop-type-Prop (leq-Preorder-Prop X x y))) - ( λ {x} {y} f → eq-is-prop (is-prop-type-Prop (leq-Preorder-Prop X x y))) + eq-is-prop (is-prop-type-Prop (leq-prop-Preorder X x w))) + ( λ {x} {y} f → eq-is-prop (is-prop-type-Prop (leq-prop-Preorder X x y))) + ( λ {x} {y} f → eq-is-prop (is-prop-type-Prop (leq-prop-Preorder X x y))) module _ {l1 l2 : Level} (C : Precategory l1 l2) diff --git a/src/order-theory/subpreorders.lagda.md b/src/order-theory/subpreorders.lagda.md index 3bdd286fa6..07fc7603e7 100644 --- a/src/order-theory/subpreorders.lagda.md +++ b/src/order-theory/subpreorders.lagda.md @@ -46,7 +46,7 @@ module _ eq-type-Subpreorder x y = eq-type-subtype S leq-Subpreorder-Prop : (x y : type-Subpreorder) → Prop l2 - leq-Subpreorder-Prop x y = leq-Preorder-Prop P (pr1 x) (pr1 y) + leq-Subpreorder-Prop x y = leq-prop-Preorder P (pr1 x) (pr1 y) leq-Subpreorder : (x y : type-Subpreorder) → UU l2 leq-Subpreorder x y = type-Prop (leq-Subpreorder-Prop x y) diff --git a/src/order-theory/suplattices.lagda.md b/src/order-theory/suplattices.lagda.md index 6854f38d21..04dee69608 100644 --- a/src/order-theory/suplattices.lagda.md +++ b/src/order-theory/suplattices.lagda.md @@ -83,8 +83,8 @@ module _ type-Suplattice : UU l1 type-Suplattice = type-Poset poset-Suplattice - leq-Suplattice-Prop : (x y : type-Suplattice) → Prop l2 - leq-Suplattice-Prop = leq-Poset-Prop poset-Suplattice + leq-prop-Suplattice : (x y : type-Suplattice) → Prop l2 + leq-prop-Suplattice = leq-prop-Poset poset-Suplattice leq-Suplattice : (x y : type-Suplattice) → UU l2 leq-Suplattice = leq-Poset poset-Suplattice diff --git a/src/order-theory/top-elements-large-posets.lagda.md b/src/order-theory/top-elements-large-posets.lagda.md index 8031a04f25..8d3f8ccbae 100644 --- a/src/order-theory/top-elements-large-posets.lagda.md +++ b/src/order-theory/top-elements-large-posets.lagda.md @@ -17,9 +17,10 @@ open import order-theory.large-posets ## Idea -We say that a [large poset](order-theory.large-posets.md) `P` has a **largest -element** if it comes equipped with an element `t : type-Large-Poset P lzero` -such that `x ≤ t` holds for every `x : P` +We say that a [large poset](order-theory.large-posets.md) `P` has a +{{#concept "largest element" Disambiguation="in a large poset" Agda=is-top-element-Large-Poset}} +if it comes equipped with an element `t : type-Large-Poset P lzero` such that +`x ≤ t` holds for every `x : P` ## Definition diff --git a/src/order-theory/top-elements-posets.lagda.md b/src/order-theory/top-elements-posets.lagda.md index 0d092d4e38..e7c4797edf 100644 --- a/src/order-theory/top-elements-posets.lagda.md +++ b/src/order-theory/top-elements-posets.lagda.md @@ -20,8 +20,10 @@ open import order-theory.top-elements-preorders ## Idea -A **largest element** in a poset is an element `t` such that `x ≤ t` holds for -every `x : P`. +A +{{#concept "largest element" Disambiguation="in a poset" Agda=is-top-element-Poset}} +in a [poset](order-theory.posets.md) is an element `t` such that `x ≤ t` holds +for every `x : P`. ## Definition @@ -30,9 +32,9 @@ module _ {l1 l2 : Level} (X : Poset l1 l2) where - is-top-element-Poset-Prop : type-Poset X → Prop (l1 ⊔ l2) - is-top-element-Poset-Prop = - is-top-element-Preorder-Prop (preorder-Poset X) + is-top-element-prop-Poset : type-Poset X → Prop (l1 ⊔ l2) + is-top-element-prop-Poset = + is-top-element-prop-Preorder (preorder-Poset X) is-top-element-Poset : type-Poset X → UU (l1 ⊔ l2) is-top-element-Poset = is-top-element-Preorder (preorder-Poset X) @@ -49,14 +51,14 @@ module _ all-elements-equal has-top-element-Poset all-elements-equal-has-top-element-Poset (pair x H) (pair y K) = eq-type-subtype - ( is-top-element-Poset-Prop) + ( is-top-element-prop-Poset) ( antisymmetric-leq-Poset X x y (K x) (H y)) is-prop-has-top-element-Poset : is-prop has-top-element-Poset is-prop-has-top-element-Poset = is-prop-all-elements-equal all-elements-equal-has-top-element-Poset - has-top-element-Poset-Prop : Prop (l1 ⊔ l2) - pr1 has-top-element-Poset-Prop = has-top-element-Poset - pr2 has-top-element-Poset-Prop = is-prop-has-top-element-Poset + has-top-element-prop-Poset : Prop (l1 ⊔ l2) + pr1 has-top-element-prop-Poset = has-top-element-Poset + pr2 has-top-element-prop-Poset = is-prop-has-top-element-Poset ``` diff --git a/src/order-theory/top-elements-preorders.lagda.md b/src/order-theory/top-elements-preorders.lagda.md index 93e6197c05..b284f04591 100644 --- a/src/order-theory/top-elements-preorders.lagda.md +++ b/src/order-theory/top-elements-preorders.lagda.md @@ -28,17 +28,17 @@ module _ {l1 l2 : Level} (X : Preorder l1 l2) where - is-top-element-Preorder-Prop : type-Preorder X → Prop (l1 ⊔ l2) - is-top-element-Preorder-Prop x = - Π-Prop (type-Preorder X) (λ y → leq-Preorder-Prop X y x) + is-top-element-prop-Preorder : type-Preorder X → Prop (l1 ⊔ l2) + is-top-element-prop-Preorder x = + Π-Prop (type-Preorder X) (λ y → leq-prop-Preorder X y x) is-top-element-Preorder : type-Preorder X → UU (l1 ⊔ l2) - is-top-element-Preorder x = type-Prop (is-top-element-Preorder-Prop x) + is-top-element-Preorder x = type-Prop (is-top-element-prop-Preorder x) is-prop-is-top-element-Preorder : (x : type-Preorder X) → is-prop (is-top-element-Preorder x) is-prop-is-top-element-Preorder x = - is-prop-type-Prop (is-top-element-Preorder-Prop x) + is-prop-type-Prop (is-top-element-prop-Preorder x) has-top-element-Preorder : UU (l1 ⊔ l2) has-top-element-Preorder = Σ (type-Preorder X) is-top-element-Preorder diff --git a/src/order-theory/total-orders.lagda.md b/src/order-theory/total-orders.lagda.md index 5c6541a1c9..c73fb79abf 100644 --- a/src/order-theory/total-orders.lagda.md +++ b/src/order-theory/total-orders.lagda.md @@ -81,7 +81,7 @@ module _ type-Total-Order = type-Poset poset-Total-Order leq-Total-Order-Prop : (x y : type-Total-Order) → Prop l2 - leq-Total-Order-Prop = leq-Poset-Prop poset-Total-Order + leq-Total-Order-Prop = leq-prop-Poset poset-Total-Order leq-Total-Order : (x y : type-Total-Order) → UU l2 leq-Total-Order = leq-Poset poset-Total-Order diff --git a/src/order-theory/total-preorders.lagda.md b/src/order-theory/total-preorders.lagda.md index fdc75e0459..facdaddbd8 100644 --- a/src/order-theory/total-preorders.lagda.md +++ b/src/order-theory/total-preorders.lagda.md @@ -36,7 +36,7 @@ module _ incident-Preorder-Prop : (x y : type-Preorder X) → Prop l2 incident-Preorder-Prop x y = - (leq-Preorder-Prop X x y) ∨ (leq-Preorder-Prop X y x) + (leq-prop-Preorder X x y) ∨ (leq-prop-Preorder X y x) incident-Preorder : (x y : type-Preorder X) → UU l2 incident-Preorder x y = type-Prop (incident-Preorder-Prop x y) @@ -78,7 +78,7 @@ module _ type-Total-Preorder = type-Preorder preorder-Total-Preorder leq-Total-Preorder-Prop : (x y : type-Total-Preorder) → Prop l2 - leq-Total-Preorder-Prop = leq-Preorder-Prop preorder-Total-Preorder + leq-Total-Preorder-Prop = leq-prop-Preorder preorder-Total-Preorder leq-Total-Preorder : (x y : type-Total-Preorder) → UU l2 leq-Total-Preorder = leq-Preorder preorder-Total-Preorder diff --git a/src/order-theory/upper-bounds-posets.lagda.md b/src/order-theory/upper-bounds-posets.lagda.md index d3909c4678..f878ee5ea0 100644 --- a/src/order-theory/upper-bounds-posets.lagda.md +++ b/src/order-theory/upper-bounds-posets.lagda.md @@ -35,7 +35,7 @@ module _ is-binary-upper-bound-Poset-Prop : (x y z : type-Poset P) → Prop l2 is-binary-upper-bound-Poset-Prop x y z = - product-Prop (leq-Poset-Prop P x z) (leq-Poset-Prop P y z) + product-Prop (leq-prop-Poset P x z) (leq-prop-Poset P y z) is-binary-upper-bound-Poset : (x y z : type-Poset P) → UU l2 @@ -70,7 +70,7 @@ module _ {l : Level} {I : UU l} → (I → type-Poset P) → type-Poset P → Prop (l2 ⊔ l) is-upper-bound-family-of-elements-Poset-Prop {l} {I} f z = - Π-Prop I (λ i → leq-Poset-Prop P (f i) z) + Π-Prop I (λ i → leq-prop-Poset P (f i) z) is-upper-bound-family-of-elements-Poset : {l : Level} {I : UU l} → (I → type-Poset P) → type-Poset P → From bab6557e96894e5965e2daa7c96925931c7b2ac9 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 23:52:35 +0200 Subject: [PATCH 23/83] some order theory on powersets --- src/foundation/complements-subtypes.lagda.md | 24 + src/foundation/images-embeddings.lagda.md | 444 ++++++++++++++++++ src/foundation/powersets.lagda.md | 23 +- src/foundation/preimages-of-subtypes.lagda.md | 21 + src/order-theory/large-suplattices.lagda.md | 2 +- .../opposite-large-posets.lagda.md | 15 + .../opposite-large-preorders.lagda.md | 28 ++ ...rder-preserving-maps-large-posets.lagda.md | 23 + ...r-preserving-maps-large-preorders.lagda.md | 20 + 9 files changed, 589 insertions(+), 11 deletions(-) create mode 100644 src/foundation/images-embeddings.lagda.md diff --git a/src/foundation/complements-subtypes.lagda.md b/src/foundation/complements-subtypes.lagda.md index 477ce50a47..c0d6662679 100644 --- a/src/foundation/complements-subtypes.lagda.md +++ b/src/foundation/complements-subtypes.lagda.md @@ -13,6 +13,15 @@ open import foundation.double-negation-stable-subtypes open import foundation.double-negation-stable-propositions open import foundation.full-subtypes open import foundation.negation +open import foundation.powersets +open import foundation.postcomposition-functions +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-large-preorders +open import order-theory.opposite-large-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.order-preserving-maps-preorders +open import order-theory.posets +open import order-theory.large-posets open import foundation.propositional-truncations open import foundation.unions-subtypes open import foundation.universe-levels @@ -92,3 +101,18 @@ module _ ( subtype-decidable-subtype P) ( is-decidable-decidable-subtype P) ``` + +### Taking complements gives a contravariant endooperator on the powerset posets + +```agda +neg-hom-powerset : + {l1 : Level} {A : UU l1} → + hom-Large-Poset + ( λ l → l) + ( powerset-Large-Poset A) + ( opposite-Large-Poset (powerset-Large-Poset A)) +neg-hom-powerset = + make-hom-Large-Preorder + ( λ P x → neg-Prop (P x)) + ( λ P Q f x → map-neg (f x)) +``` diff --git a/src/foundation/images-embeddings.lagda.md b/src/foundation/images-embeddings.lagda.md new file mode 100644 index 0000000000..f8d6443c8a --- /dev/null +++ b/src/foundation/images-embeddings.lagda.md @@ -0,0 +1,444 @@ +# The image of an embedding + +```agda +module foundation.images-embeddings where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.fundamental-theorem-of-identity-types +open import foundation.propositional-truncations +open import foundation.slice +open import foundation.powersets +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.order-preserving-maps-large-preorders +open import foundation.propositional-maps +open import foundation.subtype-identity-principle +open import foundation.surjective-maps +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 +open import foundation-core.function-types +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 +``` + +
+ +## Idea + +The {{#concept "image" Disambiguation="of an embedding" Agda=im-emb}} of an +[embedding](foundation-core.embeddings.md) is a type that satisfies the +[universal property of the image](foundation.universal-property-image.md) of a +map. + +## Definitions + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) + where + + subtype-im-emb : subtype (l1 ⊔ l2) X + subtype-im-emb x = (fiber (map-emb f) x , is-prop-map-emb f x) + + is-in-subtype-im-emb : X → UU (l1 ⊔ l2) + is-in-subtype-im-emb = is-in-subtype subtype-im-emb + + im-emb : UU (l1 ⊔ l2) + im-emb = type-subtype subtype-im-emb + + inclusion-im-emb : im-emb → X + inclusion-im-emb = inclusion-subtype subtype-im-emb + + map-unit-im-emb : A → im-emb + pr1 (map-unit-im-emb a) = map-emb f a + pr2 (map-unit-im-emb a) = a , refl + + triangle-unit-im-emb : coherence-triangle-maps (map-emb f) inclusion-im-emb map-unit-im-emb + triangle-unit-im-emb a = refl + + unit-im-emb : hom-slice (map-emb f) inclusion-im-emb + pr1 unit-im-emb = map-unit-im-emb + pr2 unit-im-emb = triangle-unit-im-emb +``` + +### The direct image operator on powersets + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) + where + + direct-image-hom-emb-powerset : + hom-Large-Poset + ( λ l → l1 ⊔ l2 ⊔ l) + ( powerset-Large-Poset A) + ( powerset-Large-Poset X) + direct-image-hom-emb-powerset = + make-hom-Large-Preorder + ( λ P i → Σ-Prop (subtype-im-emb f i) (λ x → P (pr1 x))) + ( λ P Q x y w → pr1 w , x (pr1 (pr1 w)) (pr2 w)) + + direct-image-hom-emb-powerset' : + {l : Level} → + hom-Poset (powerset-Poset l A) (powerset-Poset (l1 ⊔ l2 ⊔ l) X) + direct-image-hom-emb-powerset' {l} = + ( hom-poset-hom-Large-Poset + ( powerset-Large-Poset A) + ( powerset-Large-Poset X) + ( direct-image-hom-emb-powerset) + ( l)) +``` + +## Properties + +### We characterize the identity type of `im-emb f` + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) + where + + Eq-im-emb : im-emb f → im-emb f → UU l1 + Eq-im-emb x y = (pr1 x = pr1 y) + + refl-Eq-im-emb : (x : im-emb f) → Eq-im-emb x x + refl-Eq-im-emb x = refl + + Eq-eq-im-emb : (x y : im-emb f) → x = y → Eq-im-emb x y + Eq-eq-im-emb x .x refl = refl-Eq-im-emb x + + abstract + is-torsorial-Eq-im-emb : + (x : im-emb f) → is-torsorial (Eq-im-emb x) + is-torsorial-Eq-im-emb x = + is-torsorial-Eq-subtype + ( is-torsorial-Id (pr1 x)) + ( is-prop-map-emb f) + ( pr1 x) + ( refl) + ( pr2 x) + + abstract + is-equiv-Eq-eq-im-emb : (x y : im-emb f) → is-equiv (Eq-eq-im-emb x y) + is-equiv-Eq-eq-im-emb x = + fundamental-theorem-id + ( is-torsorial-Eq-im-emb x) + ( Eq-eq-im-emb x) + + equiv-Eq-eq-im-emb : (x y : im-emb f) → (x = y) ≃ Eq-im-emb x y + pr1 (equiv-Eq-eq-im-emb x y) = Eq-eq-im-emb x y + pr2 (equiv-Eq-eq-im-emb x y) = is-equiv-Eq-eq-im-emb x y + + eq-Eq-im-emb : (x y : im-emb f) → Eq-im-emb x y → x = y + eq-Eq-im-emb x y = map-inv-is-equiv (is-equiv-Eq-eq-im-emb x y) +``` + +### The image inclusion is an embedding + +```agda +abstract + is-emb-inclusion-im-emb : + {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) → + is-emb (inclusion-im-emb f) + is-emb-inclusion-im-emb f = is-emb-inclusion-subtype (λ x → fiber (map-emb f) x , is-prop-map-emb f x) + +emb-im-emb : + {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) → im-emb f ↪ X +pr1 (emb-im-emb f) = inclusion-im-emb f +pr2 (emb-im-emb f) = is-emb-inclusion-im-emb f +``` + +### The image inclusion is injective + +```agda +abstract + is-injective-inclusion-im-emb : + {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) → + is-injective (inclusion-im-emb f) + is-injective-inclusion-im-emb f = is-injective-is-emb (is-emb-inclusion-im-emb f) +``` + +### The unit map of the image is surjective + +```text +abstract + is-surjective-map-unit-im-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪ B) → + is-surjective (map-unit-im-emb f) + is-surjective-map-unit-im-emb f (y , z) = + apply-universal-property-trunc-Prop z + ( trunc-Prop (fiber (map-unit-im-emb f) (y , z))) + ( α) + where + α : fiber (map-emb f) y → type-Prop (trunc-Prop (fiber (map-unit-im-emb f) (y , z))) + α (x , p) = unit-trunc-Prop (x , eq-type-subtype (λ w → fiber (map-emb f) w , is-prop-map-emb f w) p) +``` + +### The image of a map into a truncated type is truncated + +```agda +abstract + is-trunc-im-emb : + {l1 l2 : Level} (k : 𝕋) {X : UU l1} {A : UU l2} (f : A ↪ X) → + is-trunc (succ-𝕋 k) X → is-trunc (succ-𝕋 k) (im-emb f) + is-trunc-im-emb k f = is-trunc-emb k (emb-im-emb f) + +im-emb-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) +pr1 (im-emb-Truncated-Type k X f) = im-emb f +pr2 (im-emb-Truncated-Type k X f) = is-trunc-im-emb k f (is-trunc-type-Truncated-Type X) +``` + +## Idea + + + +Consider a map `f : A → B` and a [subtype](foundation-core.subtypes.md) `S ⊆ A`, +then the **image** of `S` under `f` is the subtype of `B` consisting of the +values of the composite `S ⊆ A → B`. In other words, the image `im f S` of a +subtype `S` under `f` satisfies the universal property that + +```text + (im f S ⊆ U) ↔ (S ⊆ U ∘ f). +``` + +The image operation on subtypes is an +[order preserving map](order-theory.order-preserving-maps-large-posets.md) from +the [powerset](foundation.powersets.md) of `A` to the powerset of `B`. Thus we +obtain a [Galois connection](order-theory.galois-connections-large-posets.md) +between the powersets of `A` and `B`: the **image-pullback Galois connection** + +```text + image-subtype f ⊣ pullback-subtype f. +``` + +## Definitions + +### The predicate of being the image of a subtype under a map + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (S : subtype l3 A) + where + + is-image-map-subtype : {l4 : Level} (T : subtype l4 B) → UUω + is-image-map-subtype T = + {l : Level} (U : subtype l B) → (T ⊆ U) ↔ (S ⊆ U ∘ f) +``` + +### The image of a subtype under a map + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (S : subtype l3 A) + where + + im-subtype : subtype (l1 ⊔ l2 ⊔ l3) B + im-subtype y = subtype-im (f ∘ inclusion-subtype S) y + + is-in-im-subtype : B → UU (l1 ⊔ l2 ⊔ l3) + is-in-im-subtype = is-in-subtype im-subtype +``` + +### The order preserving operation taking the image of a subtype under a map + +```text +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) + where + + preserves-order-im-subtype : + {l3 l4 : Level} (S : subtype l3 A) (T : subtype l4 A) → + S ⊆ T → im-subtype f S ⊆ im-subtype f T + preserves-order-im-subtype S T H y p = + apply-universal-property-trunc-Prop p + ( im-subtype f T y) + ( λ ((x , s) , q) → unit-trunc-Prop ((x , H x s) , q)) + + im-subtype-hom-Large-Poset : + hom-Large-Poset + ( λ l → l1 ⊔ l2 ⊔ l) + ( powerset-Large-Poset A) + ( powerset-Large-Poset B) + map-hom-Large-Preorder im-subtype-hom-Large-Poset = + im-subtype f + preserves-order-hom-Large-Preorder im-subtype-hom-Large-Poset = + preserves-order-im-subtype +``` + +### The image-pullback Galois connection on powersets + +```text +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) + where + + forward-implication-adjoint-relation-image-pullback-subtype : + {l3 l4 : Level} (S : subtype l3 A) (T : subtype l4 B) → + (im-subtype f S ⊆ T) → (S ⊆ pullback-subtype f T) + forward-implication-adjoint-relation-image-pullback-subtype S T H x p = + H (f x) (unit-trunc-Prop ((x , p) , refl)) + + backward-implication-adjoint-relation-image-pullback-subtype : + {l3 l4 : Level} (S : subtype l3 A) (T : subtype l4 B) → + (S ⊆ pullback-subtype f T) → (im-subtype f S ⊆ T) + backward-implication-adjoint-relation-image-pullback-subtype S T H y p = + apply-universal-property-trunc-Prop p + ( T y) + ( λ where ((x , s) , refl) → H x s) + + adjoint-relation-image-pullback-subtype : + {l3 l4 : Level} (S : subtype l3 A) (T : subtype l4 B) → + (im-subtype f S ⊆ T) ↔ (S ⊆ pullback-subtype f T) + pr1 (adjoint-relation-image-pullback-subtype S T) = + forward-implication-adjoint-relation-image-pullback-subtype S T + pr2 (adjoint-relation-image-pullback-subtype S T) = + backward-implication-adjoint-relation-image-pullback-subtype S T + + image-pullback-subtype-galois-connection-Large-Poset : + galois-connection-Large-Poset + ( λ l → l1 ⊔ l2 ⊔ l) + ( λ l → l) + ( powerset-Large-Poset A) + ( powerset-Large-Poset B) + lower-adjoint-galois-connection-Large-Poset + image-pullback-subtype-galois-connection-Large-Poset = + im-subtype-hom-Large-Poset f + upper-adjoint-galois-connection-Large-Poset + image-pullback-subtype-galois-connection-Large-Poset = + pullback-subtype-hom-Large-Poset f + adjoint-relation-galois-connection-Large-Poset + image-pullback-subtype-galois-connection-Large-Poset = + adjoint-relation-image-pullback-subtype +``` + +## Properties + +### If `S` and `T` have the same elements, then `im-subtype f S` and `im-subtype f T` have the same elements + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} (f : A → B) + (S : subtype l3 A) (T : subtype l4 A) + where + + has-same-elements-im-has-same-elements-subtype : + has-same-elements-subtype S T → + has-same-elements-subtype (im-subtype f S) (im-subtype f T) + has-same-elements-im-has-same-elements-subtype s = + has-same-elements-sim-subtype + ( im-subtype f S) + ( im-subtype f T) + ( preserves-sim-hom-Large-Poset + ( powerset-Large-Poset A) + ( powerset-Large-Poset B) + ( im-subtype-hom-Large-Poset f) + ( S) + ( T) + ( sim-has-same-elements-subtype S T s)) +``` + +### The image subtype `im f (full-subtype A)` has the same elements as the subtype `im f` + +```text +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) + where + + compute-im-full-subtype : + has-same-elements-subtype + ( im-subtype f (full-subtype lzero A)) + ( subtype-im f) + compute-im-full-subtype y = + iff-equiv + ( equiv-trunc-Prop + ( ( right-unit-law-Σ-is-contr + ( λ a → + is-contr-map-is-equiv is-equiv-inclusion-full-subtype (pr1 a))) ∘e + ( compute-fiber-comp f inclusion-full-subtype y))) +``` + +### The image subtype `im (g ∘ f) S` has the same elements as the image subtype `im g (im f S)` + +**Proof:** The asserted similarity follows at once from the similarity + +```text + pullback-subtype (g ∘ f) ≈ pullback-subtype g ∘ pullback-subtype f +``` + +via the image-pullback Galois connection. + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + (g : B → C) (f : A → B) (S : subtype l4 A) + where + + compute-im-subtype-comp : + has-same-elements-subtype + ( im-subtype (g ∘ f) S) + ( im-subtype g (im-subtype f S)) + compute-im-subtype-comp = + has-same-elements-sim-subtype + ( im-subtype (g ∘ f) S) + ( im-subtype g (im-subtype f S)) + ( lower-sim-upper-sim-galois-connection-Large-Poset + ( powerset-Large-Poset A) + ( powerset-Large-Poset C) + ( image-pullback-subtype-galois-connection-Large-Poset (g ∘ f)) + ( comp-galois-connection-Large-Poset + ( powerset-Large-Poset A) + ( powerset-Large-Poset B) + ( powerset-Large-Poset C) + ( image-pullback-subtype-galois-connection-Large-Poset g) + ( image-pullback-subtype-galois-connection-Large-Poset f)) + ( refl-sim-hom-Large-Poset + ( powerset-Large-Poset C) + ( powerset-Large-Poset A) + ( pullback-subtype-hom-Large-Poset (g ∘ f))) + ( S)) +``` + +### The image `im (g ∘ f)` has the same elements as the image subtype `im g (im f)` + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} (g : B → C) (f : A → B) + where + + compute-subtype-im-comp : + 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-subtype (g ∘ f) (full-subtype lzero A) x + by + inv-iff (compute-im-full-subtype (g ∘ f) x) + ↔ is-in-im-subtype g (im-subtype f (full-subtype lzero A)) x + by + compute-im-subtype-comp g f (full-subtype lzero A) x + ↔ is-in-im-subtype g (subtype-im f) x + by + has-same-elements-im-has-same-elements-subtype g + ( im-subtype f (full-subtype lzero A)) + ( subtype-im f) + ( compute-im-full-subtype f) + ( x) +``` diff --git a/src/foundation/powersets.lagda.md b/src/foundation/powersets.lagda.md index 88438e8c9a..e27931ce3a 100644 --- a/src/foundation/powersets.lagda.md +++ b/src/foundation/powersets.lagda.md @@ -161,19 +161,22 @@ module _ Π-Large-Meet-Semilattice {I = A} (λ _ → Prop-Large-Meet-Semilattice) ``` -### Maps of types give order preserving maps on their powersets +### The powerset suplattice ```agda -hom-map-type-powerset-Large-Poset : - {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) → - hom-Large-Poset (λ l → l) (powerset-Large-Poset B) (powerset-Large-Poset A) -hom-map-type-powerset-Large-Poset f = - make-hom-Large-Preorder - ( λ B' x → B' (f x)) - ( λ B' B'' B'⊆B'' x B'fx → B'⊆B'' (f x) B'fx) -``` +module _ + {l1 : Level} (A : UU l1) + where + + powerset-Large-Suplattice : + Large-Suplattice (λ l2 → lsuc l2 ⊔ l1) (λ l2 l3 → l2 ⊔ l3 ⊔ l1) lzero + powerset-Large-Suplattice = + Π-Large-Suplattice {I = A} (λ _ → Prop-Large-Suplattice) -If `f` is an embedding, then `f(A) ≃ A`... + powerset-Suplattice : + (l2 l3 : Level) → Suplattice (l1 ⊔ lsuc l2 ⊔ lsuc l3) (l1 ⊔ l2 ⊔ l3) l2 + powerset-Suplattice = suplattice-Large-Suplattice powerset-Large-Suplattice +``` ## See also diff --git a/src/foundation/preimages-of-subtypes.lagda.md b/src/foundation/preimages-of-subtypes.lagda.md index 9811659371..2b5196488f 100644 --- a/src/foundation/preimages-of-subtypes.lagda.md +++ b/src/foundation/preimages-of-subtypes.lagda.md @@ -7,9 +7,13 @@ module foundation.preimages-of-subtypes where
Imports ```agda +open import foundation.powersets open import foundation.universe-levels open import foundation-core.subtypes + +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-large-preorders ```
@@ -28,3 +32,20 @@ preimage-subtype : subtype l3 B → subtype l3 A preimage-subtype f S a = S (f a) ``` + +### Maps of types give order preserving maps on their powersets + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) + where + + preimage-hom-powerset : + hom-Large-Poset (λ l → l) (powerset-Large-Poset B) (powerset-Large-Poset A) + preimage-hom-powerset f = + make-hom-Large-Preorder + ( preimage-subtype f) + ( λ B' B'' B'⊆B'' x B'fx → B'⊆B'' (f x) B'fx) +``` + +If `f` is an embedding, then `f(A) ≃ A`... diff --git a/src/order-theory/large-suplattices.lagda.md b/src/order-theory/large-suplattices.lagda.md index 6f8bb90417..489330b18b 100644 --- a/src/order-theory/large-suplattices.lagda.md +++ b/src/order-theory/large-suplattices.lagda.md @@ -228,7 +228,7 @@ module _ suplattice-Large-Suplattice : (l1 l2 : Level) → - Suplattice (α (γ ⊔ l1 ⊔ l2)) (β (γ ⊔ l1 ⊔ l2) (γ ⊔ l1 ⊔ l2)) (l1) + Suplattice (α (γ ⊔ l1 ⊔ l2)) (β (γ ⊔ l1 ⊔ l2) (γ ⊔ l1 ⊔ l2)) l1 pr1 (suplattice-Large-Suplattice l1 l2) = poset-Large-Suplattice (γ ⊔ l1 ⊔ l2) pr2 (suplattice-Large-Suplattice l1 l2) = diff --git a/src/order-theory/opposite-large-posets.lagda.md b/src/order-theory/opposite-large-posets.lagda.md index 9f56add9c4..4ba4fd48f4 100644 --- a/src/order-theory/opposite-large-posets.lagda.md +++ b/src/order-theory/opposite-large-posets.lagda.md @@ -8,6 +8,7 @@ module order-theory.opposite-large-posets where ```agda open import order-theory.large-preorders +open import order-theory.order-preserving-maps-large-posets open import order-theory.opposite-large-preorders open import order-theory.large-posets @@ -92,6 +93,20 @@ module _ antisymmetric-leq-opposite-Large-Poset ``` +### The opposite functorial action on order preserving maps of large posets + +```agda +module _ + {αP αQ : Level → Level} {βP βQ : Level → Level → Level} {γ : Level → Level} + {P : Large-Poset αP βP} {Q : Large-Poset αQ βQ} + where + + opposite-hom-Large-Poset : + hom-Large-Poset γ P Q → + hom-Large-Poset γ (opposite-Large-Poset P) (opposite-Large-Poset Q) + opposite-hom-Large-Poset = opposite-hom-Large-Preorder +``` + ## Properties ### The opposite large poset construction is a strict involution diff --git a/src/order-theory/opposite-large-preorders.lagda.md b/src/order-theory/opposite-large-preorders.lagda.md index 0bbd0e21d3..e90ff797f0 100644 --- a/src/order-theory/opposite-large-preorders.lagda.md +++ b/src/order-theory/opposite-large-preorders.lagda.md @@ -8,6 +8,7 @@ module order-theory.opposite-large-preorders where ```agda open import order-theory.large-preorders +open import order-theory.order-preserving-maps-large-preorders open import foundation.dependent-pair-types open import foundation.equivalences @@ -77,6 +78,23 @@ module _ transitive-leq-opposite-Large-Preorder ``` +### The opposite functorial action on order preserving maps of large posets + +```agda +module _ + {αP αQ : Level → Level} {βP βQ : Level → Level → Level} {γ : Level → Level} + {P : Large-Preorder αP βP} {Q : Large-Preorder αQ βQ} + where + + opposite-hom-Large-Preorder : + hom-Large-Preorder γ P Q → + hom-Large-Preorder γ (opposite-Large-Preorder P) (opposite-Large-Preorder Q) + opposite-hom-Large-Preorder f = + make-hom-Large-Preorder + ( map-hom-Large-Preorder f) + ( λ x y p → preserves-order-hom-Large-Preorder f y x p) +``` + ## Properties ### The opposite large preorder construction is a strict involution @@ -89,4 +107,14 @@ module _ is-involution-opposite-Large-Preorder : opposite-Large-Preorder (opposite-Large-Preorder P) =ω P is-involution-opposite-Large-Preorder = reflω + +module _ + {αP αQ : Level → Level} {βP βQ : Level → Level → Level} {γ : Level → Level} + (P : Large-Preorder αP βP) (Q : Large-Preorder αQ βQ) + (f : hom-Large-Preorder γ P Q) + where + + is-involution-opposite-hom-Large-Preorder : + opposite-hom-Large-Preorder (opposite-hom-Large-Preorder f) =ω f + is-involution-opposite-hom-Large-Preorder = reflω ``` diff --git a/src/order-theory/order-preserving-maps-large-posets.lagda.md b/src/order-theory/order-preserving-maps-large-posets.lagda.md index f4cd9eb033..08254b6629 100644 --- a/src/order-theory/order-preserving-maps-large-posets.lagda.md +++ b/src/order-theory/order-preserving-maps-large-posets.lagda.md @@ -11,6 +11,7 @@ open import foundation.universe-levels open import order-theory.large-posets open import order-theory.order-preserving-maps-large-preorders +open import order-theory.order-preserving-maps-posets open import order-theory.similarity-of-elements-large-posets ``` @@ -81,6 +82,28 @@ module _ preserves-order-hom-Large-Preorder f ``` +### The induced order preserving maps on small posets + +```agda +module _ + {αP αQ : Level → Level} {βP βQ : Level → Level → Level} {γ : Level → Level} + (P : Large-Poset αP βP) + (Q : Large-Poset αQ βQ) + (f : hom-Large-Poset γ P Q) + where + + hom-poset-hom-Large-Poset : + (l : Level) → + hom-Poset + ( poset-Large-Poset P l) + ( poset-Large-Poset Q (γ l)) + hom-poset-hom-Large-Poset = + hom-preorder-hom-Large-Preorder + ( large-preorder-Large-Poset P) + ( large-preorder-Large-Poset Q) + ( f) +``` + ### The identity order preserving map on a large poset ```agda diff --git a/src/order-theory/order-preserving-maps-large-preorders.lagda.md b/src/order-theory/order-preserving-maps-large-preorders.lagda.md index bca9ee11b2..9197455f5e 100644 --- a/src/order-theory/order-preserving-maps-large-preorders.lagda.md +++ b/src/order-theory/order-preserving-maps-large-preorders.lagda.md @@ -14,6 +14,7 @@ open import foundation-core.function-types open import foundation-core.homotopies open import order-theory.large-preorders +open import order-theory.order-preserving-maps-preorders open import order-theory.similarity-of-elements-large-preorders ``` @@ -75,6 +76,25 @@ module _ open hom-Large-Preorder public ``` +### The induced order preserving maps on small preorders + +```agda +module _ + {αP αQ : Level → Level} {βP βQ : Level → Level → Level} {γ : Level → Level} + (P : Large-Preorder αP βP) + (Q : Large-Preorder αQ βQ) + (f : hom-Large-Preorder γ P Q) + where + + hom-preorder-hom-Large-Preorder : + (l : Level) → + hom-Preorder + ( preorder-Large-Preorder P l) + ( preorder-Large-Preorder Q (γ l)) + hom-preorder-hom-Large-Preorder l = + ( map-hom-Large-Preorder f , preserves-order-hom-Large-Preorder f) +``` + ### The identity order preserving map on a large preorder ```agda From 3e812072cde18e85f1893d5d86840277062de2ff Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 23:56:29 +0200 Subject: [PATCH 24/83] pre-commit --- .../opposite-large-precategories.lagda.md | 2 +- src/foundation.lagda.md | 1 + src/foundation/complements-subtypes.lagda.md | 19 ++++++----- src/foundation/images-embeddings.lagda.md | 23 ++++++++----- .../large-locale-of-propositions.lagda.md | 8 +++-- .../large-locale-of-subtypes.lagda.md | 6 ++-- src/foundation/powersets.lagda.md | 34 +++++++++---------- src/order-theory.lagda.md | 5 +++ .../opposite-large-posets.lagda.md | 15 ++++---- .../opposite-large-preorders.lagda.md | 8 ++--- src/order-theory/opposite-posets.lagda.md | 11 +++--- src/order-theory/opposite-preorders.lagda.md | 7 ++-- 12 files changed, 76 insertions(+), 63 deletions(-) diff --git a/src/category-theory/opposite-large-precategories.lagda.md b/src/category-theory/opposite-large-precategories.lagda.md index 1ef20f7093..99647dd2de 100644 --- a/src/category-theory/opposite-large-precategories.lagda.md +++ b/src/category-theory/opposite-large-precategories.lagda.md @@ -13,8 +13,8 @@ open import category-theory.large-precategories open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.homotopies -open import foundation.large-identity-types open import foundation.identity-types +open import foundation.large-identity-types open import foundation.sets open import foundation.strictly-involutive-identity-types open import foundation.universe-levels diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 522c70774a..7f5889259c 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -219,6 +219,7 @@ open import foundation.identity-systems public open import foundation.identity-truncated-types public open import foundation.identity-types public open import foundation.images public +open import foundation.images-embeddings public open import foundation.images-subtypes public open import foundation.implicit-function-types public open import foundation.impredicative-encodings public diff --git a/src/foundation/complements-subtypes.lagda.md b/src/foundation/complements-subtypes.lagda.md index c0d6662679..6baa799949 100644 --- a/src/foundation/complements-subtypes.lagda.md +++ b/src/foundation/complements-subtypes.lagda.md @@ -9,25 +9,26 @@ module foundation.complements-subtypes where ```agda open import foundation.decidable-propositions open import foundation.decidable-subtypes -open import foundation.double-negation-stable-subtypes open import foundation.double-negation-stable-propositions +open import foundation.double-negation-stable-subtypes open import foundation.full-subtypes open import foundation.negation -open import foundation.powersets open import foundation.postcomposition-functions -open import order-theory.order-preserving-maps-large-posets -open import order-theory.order-preserving-maps-large-preorders -open import order-theory.opposite-large-posets -open import order-theory.order-preserving-maps-posets -open import order-theory.order-preserving-maps-preorders -open import order-theory.posets -open import order-theory.large-posets +open import foundation.powersets open import foundation.propositional-truncations open import foundation.unions-subtypes open import foundation.universe-levels open import foundation-core.function-types open import foundation-core.subtypes + +open import order-theory.large-posets +open import order-theory.opposite-large-posets +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-large-preorders +open import order-theory.order-preserving-maps-posets +open import order-theory.order-preserving-maps-preorders +open import order-theory.posets ``` diff --git a/src/foundation/images-embeddings.lagda.md b/src/foundation/images-embeddings.lagda.md index f8d6443c8a..b2fdef9844 100644 --- a/src/foundation/images-embeddings.lagda.md +++ b/src/foundation/images-embeddings.lagda.md @@ -9,13 +9,10 @@ module foundation.images-embeddings where ```agda open import foundation.dependent-pair-types open import foundation.fundamental-theorem-of-identity-types -open import foundation.propositional-truncations -open import foundation.slice open import foundation.powersets -open import order-theory.order-preserving-maps-large-posets -open import order-theory.order-preserving-maps-posets -open import order-theory.order-preserving-maps-large-preorders open import foundation.propositional-maps +open import foundation.propositional-truncations +open import foundation.slice open import foundation.subtype-identity-principle open import foundation.surjective-maps open import foundation.universe-levels @@ -35,6 +32,10 @@ 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 order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-large-preorders +open import order-theory.order-preserving-maps-posets ``` @@ -69,7 +70,8 @@ module _ pr1 (map-unit-im-emb a) = map-emb f a pr2 (map-unit-im-emb a) = a , refl - triangle-unit-im-emb : coherence-triangle-maps (map-emb f) inclusion-im-emb map-unit-im-emb + triangle-unit-im-emb : + coherence-triangle-maps (map-emb f) inclusion-im-emb map-unit-im-emb triangle-unit-im-emb a = refl unit-im-emb : hom-slice (map-emb f) inclusion-im-emb @@ -156,7 +158,8 @@ abstract is-emb-inclusion-im-emb : {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) → is-emb (inclusion-im-emb f) - is-emb-inclusion-im-emb f = is-emb-inclusion-subtype (λ x → fiber (map-emb f) x , is-prop-map-emb f x) + is-emb-inclusion-im-emb f = + is-emb-inclusion-subtype (λ x → fiber (map-emb f) x , is-prop-map-emb f x) emb-im-emb : {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) → im-emb f ↪ X @@ -171,7 +174,8 @@ abstract is-injective-inclusion-im-emb : {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) → is-injective (inclusion-im-emb f) - is-injective-inclusion-im-emb f = is-injective-is-emb (is-emb-inclusion-im-emb f) + is-injective-inclusion-im-emb f = + is-injective-is-emb (is-emb-inclusion-im-emb f) ``` ### The unit map of the image is surjective @@ -203,7 +207,8 @@ im-emb-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) pr1 (im-emb-Truncated-Type k X f) = im-emb f -pr2 (im-emb-Truncated-Type k X f) = is-trunc-im-emb k f (is-trunc-type-Truncated-Type X) +pr2 (im-emb-Truncated-Type k X f) = + is-trunc-im-emb k f (is-trunc-type-Truncated-Type X) ``` ## Idea diff --git a/src/foundation/large-locale-of-propositions.lagda.md b/src/foundation/large-locale-of-propositions.lagda.md index 5723aebcd1..d5ef3ea50a 100644 --- a/src/foundation/large-locale-of-propositions.lagda.md +++ b/src/foundation/large-locale-of-propositions.lagda.md @@ -8,17 +8,18 @@ module foundation.large-locale-of-propositions where ```agda open import foundation.conjunction +open import foundation.empty-types open import foundation.existential-quantification open import foundation.logical-equivalences open import foundation.propositional-extensionality open import foundation.unit-type -open import foundation.empty-types open import foundation.universal-property-cartesian-product-types open import foundation.universe-levels open import foundation-core.function-types open import foundation-core.propositions +open import order-theory.bottom-elements-large-posets open import order-theory.large-frames open import order-theory.large-locales open import order-theory.large-meet-semilattices @@ -27,7 +28,6 @@ open import order-theory.large-preorders open import order-theory.large-suplattices open import order-theory.least-upper-bounds-large-posets open import order-theory.top-elements-large-posets -open import order-theory.bottom-elements-large-posets ``` @@ -114,7 +114,9 @@ has-top-element-is-large-meet-semilattice-Large-Poset Prop-Large-Meet-Semilattice : Large-Meet-Semilattice lsuc (_⊔_) Prop-Large-Meet-Semilattice = - make-Large-Meet-Semilattice Prop-Large-Poset is-large-meet-semilattice-Prop-Large-Locale + make-Large-Meet-Semilattice + ( Prop-Large-Poset) + ( is-large-meet-semilattice-Prop-Large-Locale) ``` ### Suprema in the large poset of propositions diff --git a/src/foundation/large-locale-of-subtypes.lagda.md b/src/foundation/large-locale-of-subtypes.lagda.md index e93e7a4fba..2661d3c83d 100644 --- a/src/foundation/large-locale-of-subtypes.lagda.md +++ b/src/foundation/large-locale-of-subtypes.lagda.md @@ -14,16 +14,16 @@ open import foundation.universe-levels open import foundation-core.identity-types open import foundation-core.sets +open import order-theory.bottom-elements-large-posets open import order-theory.greatest-lower-bounds-large-posets open import order-theory.large-locales -open import order-theory.large-preorders -open import order-theory.top-elements-large-posets -open import order-theory.bottom-elements-large-posets open import order-theory.large-meet-semilattices open import order-theory.large-posets +open import order-theory.large-preorders open import order-theory.large-suplattices open import order-theory.least-upper-bounds-large-posets open import order-theory.powers-of-large-locales +open import order-theory.top-elements-large-posets ``` diff --git a/src/foundation/powersets.lagda.md b/src/foundation/powersets.lagda.md index e27931ce3a..538bafd9f7 100644 --- a/src/foundation/powersets.lagda.md +++ b/src/foundation/powersets.lagda.md @@ -7,34 +7,34 @@ module foundation.powersets where
Imports ```agda -open import foundation.subtypes -open import foundation.empty-types +open import foundation.dependent-pair-types open import foundation.embeddings +open import foundation.empty-types open import foundation.large-locale-of-propositions -open import foundation.dependent-pair-types +open import foundation.subtypes +open import foundation.unit-type open import foundation.universe-levels open import foundation-core.sets -open import order-theory.large-posets -open import order-theory.top-elements-large-posets -open import order-theory.top-elements-posets -open import order-theory.order-preserving-maps-large-preorders -open import order-theory.order-preserving-maps-large-posets -open import order-theory.dependent-products-large-preorders -open import order-theory.dependent-products-large-posets +open import order-theory.bottom-elements-large-posets +open import order-theory.bottom-elements-posets open import order-theory.dependent-products-large-meet-semilattices -open import order-theory.large-meet-semilattices -open import order-theory.meet-semilattices +open import order-theory.dependent-products-large-posets +open import order-theory.dependent-products-large-preorders open import order-theory.dependent-products-large-suplattices -open import order-theory.large-suplattices -open import order-theory.suplattices -open import order-theory.bottom-elements-posets -open import order-theory.bottom-elements-large-posets +open import order-theory.large-meet-semilattices +open import order-theory.large-posets open import order-theory.large-preorders +open import order-theory.large-suplattices +open import order-theory.meet-semilattices +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-large-preorders open import order-theory.posets -open import foundation.unit-type open import order-theory.preorders +open import order-theory.suplattices +open import order-theory.top-elements-large-posets +open import order-theory.top-elements-posets ```
diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index 7eed5b4b5b..e27bd7b8f0 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -6,6 +6,7 @@ module order-theory where open import order-theory.accessible-elements-relations public +open import order-theory.bottom-elements-large-posets public open import order-theory.bottom-elements-posets public open import order-theory.bottom-elements-preorders public open import order-theory.chains-posets public @@ -80,6 +81,10 @@ open import order-theory.maximal-chains-preorders public open import order-theory.meet-semilattices public open import order-theory.meet-suplattices public open import order-theory.nuclei-large-locales public +open import order-theory.opposite-large-posets public +open import order-theory.opposite-large-preorders public +open import order-theory.opposite-posets public +open import order-theory.opposite-preorders public open import order-theory.order-preserving-maps-large-posets public open import order-theory.order-preserving-maps-large-preorders public open import order-theory.order-preserving-maps-posets public diff --git a/src/order-theory/opposite-large-posets.lagda.md b/src/order-theory/opposite-large-posets.lagda.md index 4ba4fd48f4..30690e598e 100644 --- a/src/order-theory/opposite-large-posets.lagda.md +++ b/src/order-theory/opposite-large-posets.lagda.md @@ -7,19 +7,19 @@ module order-theory.opposite-large-posets where
Imports ```agda -open import order-theory.large-preorders -open import order-theory.order-preserving-maps-large-posets -open import order-theory.opposite-large-preorders -open import order-theory.large-posets - open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.homotopies open import foundation.identity-types -open import foundation.sets open import foundation.large-identity-types open import foundation.propositions +open import foundation.sets open import foundation.universe-levels + +open import order-theory.large-posets +open import order-theory.large-preorders +open import order-theory.opposite-large-preorders +open import order-theory.order-preserving-maps-large-posets ```
@@ -45,7 +45,8 @@ module _ opposite-Large-Preorder (large-preorder-Large-Poset P) type-opposite-Large-Poset : (l : Level) → UU (α l) - type-opposite-Large-Poset = type-Large-Preorder large-preorder-opposite-Large-Poset + type-opposite-Large-Poset = + type-Large-Preorder large-preorder-opposite-Large-Poset leq-prop-opposite-Large-Poset : {l1 l2 : Level} diff --git a/src/order-theory/opposite-large-preorders.lagda.md b/src/order-theory/opposite-large-preorders.lagda.md index e90ff797f0..5ecbfef3d7 100644 --- a/src/order-theory/opposite-large-preorders.lagda.md +++ b/src/order-theory/opposite-large-preorders.lagda.md @@ -7,17 +7,17 @@ module order-theory.opposite-large-preorders where
Imports ```agda -open import order-theory.large-preorders -open import order-theory.order-preserving-maps-large-preorders - open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.homotopies open import foundation.identity-types -open import foundation.sets open import foundation.large-identity-types open import foundation.propositions +open import foundation.sets open import foundation.universe-levels + +open import order-theory.large-preorders +open import order-theory.order-preserving-maps-large-preorders ```
diff --git a/src/order-theory/opposite-posets.lagda.md b/src/order-theory/opposite-posets.lagda.md index 2a219e52c0..dda087a078 100644 --- a/src/order-theory/opposite-posets.lagda.md +++ b/src/order-theory/opposite-posets.lagda.md @@ -7,18 +7,17 @@ module order-theory.opposite-posets where
Imports ```agda -open import order-theory.preorders -open import order-theory.opposite-preorders -open import order-theory.posets - open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.homotopies open import foundation.identity-types -open import foundation.sets -open import foundation.identity-types open import foundation.propositions +open import foundation.sets open import foundation.universe-levels + +open import order-theory.opposite-preorders +open import order-theory.posets +open import order-theory.preorders ```
diff --git a/src/order-theory/opposite-preorders.lagda.md b/src/order-theory/opposite-preorders.lagda.md index c21e1dbcc9..1a3548fd36 100644 --- a/src/order-theory/opposite-preorders.lagda.md +++ b/src/order-theory/opposite-preorders.lagda.md @@ -7,16 +7,15 @@ module order-theory.opposite-preorders where
Imports ```agda -open import order-theory.preorders - open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.homotopies open import foundation.identity-types -open import foundation.sets -open import foundation.identity-types open import foundation.propositions +open import foundation.sets open import foundation.universe-levels + +open import order-theory.preorders ```
From 1148b004afa22bb5ae4c6240d4a5d535b754878c Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 20 Oct 2024 23:56:43 +0200 Subject: [PATCH 25/83] wip constructive csbe --- src/foundation.lagda.md | 1 + ...cantor-schroder-bernstein-escardo.lagda.md | 176 ++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 7f5889259c..2ef5b4dad3 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -84,6 +84,7 @@ open import foundation.connected-types public open import foundation.constant-maps public open import foundation.constant-span-diagrams public open import foundation.constant-type-families public +open import foundation.constructive-cantor-schroder-bernstein-escardo public open import foundation.contractible-maps public open import foundation.contractible-types public open import foundation.copartial-elements public diff --git a/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md b/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md new file mode 100644 index 0000000000..3449554332 --- /dev/null +++ b/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md @@ -0,0 +1,176 @@ +# The constructive Cantor–Schröder–Bernstein-Escardó theorem + +```agda +module foundation.constructive-cantor-schroder-bernstein-escardo where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.decidable-embeddings +open import foundation.double-negation-stable-embeddings +open import foundation.decidable-types +open import foundation.fixed-points-endofunctions +open import order-theory.opposite-large-posets +open import foundation.negation +open import foundation.complements-subtypes +open import foundation.images-embeddings +open import foundation.propositional-maps +open import foundation.powersets +open import foundation.dependent-pair-types +open import foundation.injective-maps +open import foundation.propositional-resizing + +open import order-theory.knaster-tarski-fixed-point-theorem +open import order-theory.order-preserving-maps-posets +open import order-theory.order-preserving-maps-large-posets + +open import foundation.perfect-images +open import foundation.split-surjective-maps +open import foundation.universe-levels + +open import foundation-core.coproduct-types +open import foundation-core.embeddings +open import foundation-core.empty-types +open import foundation-core.equivalences +open import foundation-core.fibers-of-maps +open import foundation-core.identity-types +open import foundation-core.negation +open import foundation-core.sets +``` + +
+ +## Idea + +The Cantor–Schröder–Bernstein-Escardó theorem asserts that, assuming +[the law of excluded middle](foundation.law-of-excluded-middle.md), every pair +of mutually [embedding](foundation-core.embeddings.md) types `f : X ↪ Y` and +`g : Y ↪ X` are equivalent. Here, we generalize this statement by dropping the +assumption of the law of excluded middle, and rather consider +[double negation stable embeddings](foundation.double-negation-stable-embeddings.md) +between `X` and `Y`. + +## Statement + +```agda +type-constructive-Cantor-Schröder-Bernstein-Escardó : + (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) +type-constructive-Cantor-Schröder-Bernstein-Escardó l1 l2 = + {X : UU l1} {Y : UU l2} → (X ↪¬¬ Y) → (Y ↪¬¬ X) → X ≃ Y +``` + +## Proof + +**Proof.** We begin by observing that given a double negation stable embedding, + +```text + f : X → Y +``` + +then the image of `f` gives a decomposition of `Y`, `Y ≃ f(X) + Y\f(X) + ε`. + +```text + X Y + _______ _______ + / \ / \ + / \ / \ + | | f | | + | | --------> | f(X) | + |~~~~~~~~~~~| | | + | | g |~~~~~~~~~~~| <-?- Y\(f(X) ∪ Y\f(X)) + | g(Y\f(X)) | <-------- | | + | | | Y\f(X) | + \ / \ / + \_______/ \_______/ +``` + +the ??? fixed point theorem says that at some point this operation stabilizes, +giving us a subtype `S ⊆ X` such that + +```text + X\g(Y\f(S)) = S. +``` + +By double negation stability we also have the equation + +```text + g(Y\f(S)) = X\S. +``` + +```text + X Y + _______ _______ + / \ / f(S) \ + / \ /~~~~~~~~~\ <--- "Y\(f(S) ∪ Y\f(S))" + | | f | | + | | --------> | | + | | | | + | | g | | + | | <-------- | | + | | | | + \~~~~~~~~~/ \ / + \___S___/ \_______/ +``` + +Dually, we also have a least fixed point `T` of the endooperator + +```text + B ↦ Y\(f(X\g(B))) +``` + +that satisfies `g(Y\f(T)) = Y\T`. But this gives us two further fixed points: + +```text + X\g(Y\f(X\g(S))) = X\g(S) and Y\f(X\g(Y\f(T))) = Y\f(T) +``` + +If we can prove that `S` and `T` are decidable, then we can finish the proof in +the classical way. + +```text + S ∪ X\S = X\g(Y\f(S)) ∪ g(Y\f(S)) +``` + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) + where + + hom-half-way-powerset-Cantor-Schröder-Bernstein-Escardó : + hom-Large-Poset (λ l → l2 ⊔ l1 ⊔ l) + ( powerset-Large-Poset X) + ( opposite-Large-Poset (powerset-Large-Poset Y)) + hom-half-way-powerset-Cantor-Schröder-Bernstein-Escardó = + comp-hom-Large-Poset + ( powerset-Large-Poset X) + ( powerset-Large-Poset Y) + ( opposite-Large-Poset (powerset-Large-Poset Y)) + ( neg-hom-powerset) + ( direct-image-hom-emb-powerset f) + +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) + where + + hom-powerset-Cantor-Schröder-Bernstein-Escardó : + hom-Large-Poset + ( λ l3 → l1 ⊔ l2 ⊔ l3) + ( powerset-Large-Poset X) + ( powerset-Large-Poset X) + hom-powerset-Cantor-Schröder-Bernstein-Escardó = + comp-hom-Large-Poset + ( powerset-Large-Poset X) + ( opposite-Large-Poset (powerset-Large-Poset Y)) + ( powerset-Large-Poset X) + ( opposite-hom-Large-Poset + { P = powerset-Large-Poset Y} + { opposite-Large-Poset (powerset-Large-Poset X)} + ( hom-half-way-powerset-Cantor-Schröder-Bernstein-Escardó g)) + ( hom-half-way-powerset-Cantor-Schröder-Bernstein-Escardó f) +``` + +### Impredicative proof using the Knaster–Tarski fixed point theorem + +TODO From bbc3136d65d5374f05acd8d7cd85a7c1e13b1368 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 21 Oct 2024 00:04:33 +0200 Subject: [PATCH 26/83] pre-commit --- ...cantor-schroder-bernstein-escardo.lagda.md | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md b/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md index 3449554332..27ba5c6d43 100644 --- a/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md +++ b/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md @@ -8,25 +8,19 @@ module foundation.constructive-cantor-schroder-bernstein-escardo where ```agda open import foundation.action-on-identifications-functions +open import foundation.complements-subtypes open import foundation.decidable-embeddings -open import foundation.double-negation-stable-embeddings open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.double-negation-stable-embeddings open import foundation.fixed-points-endofunctions -open import order-theory.opposite-large-posets -open import foundation.negation -open import foundation.complements-subtypes open import foundation.images-embeddings -open import foundation.propositional-maps -open import foundation.powersets -open import foundation.dependent-pair-types open import foundation.injective-maps -open import foundation.propositional-resizing - -open import order-theory.knaster-tarski-fixed-point-theorem -open import order-theory.order-preserving-maps-posets -open import order-theory.order-preserving-maps-large-posets - +open import foundation.negation open import foundation.perfect-images +open import foundation.powersets +open import foundation.propositional-maps +open import foundation.propositional-resizing open import foundation.split-surjective-maps open import foundation.universe-levels @@ -36,8 +30,12 @@ open import foundation-core.empty-types open import foundation-core.equivalences open import foundation-core.fibers-of-maps open import foundation-core.identity-types -open import foundation-core.negation open import foundation-core.sets + +open import order-theory.knaster-tarski-fixed-point-theorem +open import order-theory.opposite-large-posets +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-posets ``` From a477494b920cb94da2fcd671f12028d99c349f6a Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 21 Oct 2024 00:15:18 +0200 Subject: [PATCH 27/83] edits dne --- .../double-negation-eliminating-maps.lagda.md | 3 +- .../double-negation-elimination.lagda.md | 62 +++++++++---------- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/foundation/double-negation-eliminating-maps.lagda.md b/src/foundation/double-negation-eliminating-maps.lagda.md index a64908213a..f0d36e2487 100644 --- a/src/foundation/double-negation-eliminating-maps.lagda.md +++ b/src/foundation/double-negation-eliminating-maps.lagda.md @@ -45,7 +45,8 @@ if its [fibers](foundation-core.fibers-of-maps.md) satisfy [untruncated double negation elimination](foundation.double-negation-elimination.md). I.e., for every `y : B`, if `fiber f y` is [irrefutable](foundation.irrefutable-propositions.md), then we do in fact have -an element of the fiber `p : fiber f y`. So we have a map +an element of the fiber `p : fiber f y`. In other words, double negation +eliminating maps come [equipped](foundation.structure.md) with a map ```text (y : B) → ¬¬ (fiber f y) → fiber f y. diff --git a/src/foundation/double-negation-elimination.lagda.md b/src/foundation/double-negation-elimination.lagda.md index 21506e84fd..7e7a95ce88 100644 --- a/src/foundation/double-negation-elimination.lagda.md +++ b/src/foundation/double-negation-elimination.lagda.md @@ -41,7 +41,7 @@ if there is a map We say a type `A` satisfies {{#concept "double negation elimination" Agda="on a type"}} if there is an -implicaton +implication ```text ¬¬A ⇒ ║A║₋₁. @@ -62,7 +62,7 @@ module _ ## Properties -### If the type is a propositon, then having double negation elimination is a property +### Having double negation elimination is a property for propositions ```agda is-prop-has-double-negation-elim : @@ -123,29 +123,25 @@ module _ has-double-negation-elim-iff' (iff-retract e) ``` -### The empty proposition has double negation elimination +### Double negation elimination for empty types ```agda double-negation-elim-empty : has-double-negation-elim empty double-negation-elim-empty e = e id -``` - -### Empty types are double negation stable propositions -```agda double-negation-elim-is-empty : {l : Level} {A : UU l} → is-empty A → has-double-negation-elim A double-negation-elim-is-empty H q = ex-falso (q H) ``` -### The unit proposition has double negation elimination +### Double negation elimination for the unit type ```agda double-negation-elim-unit : has-double-negation-elim unit double-negation-elim-unit _ = star ``` -### Contractible types are double negation stable +### Double negation elimination for the contractible types ```agda double-negation-elim-is-contr : @@ -153,7 +149,7 @@ double-negation-elim-is-contr : double-negation-elim-is-contr H _ = center H ``` -### The negation of a type has double negation elimination +### Double negation elimination for negations of types ```agda double-negation-elim-neg : @@ -161,27 +157,7 @@ double-negation-elim-neg : double-negation-elim-neg A f p = f (ev p) ``` -### Function types into double negations have double negation elimination - -```agda -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 f p = - double-negation-elim-neg - ( ¬ Q) - ( map-double-negation (λ (g : P → ¬¬ Q) → g p) f) - - double-negation-elim-exp : - has-double-negation-elim Q → - has-double-negation-elim (P → Q) - double-negation-elim-exp H f p = H (λ nq → f (λ g → nq (g p))) -``` - -### Universal quantification over double negations have double negation elimination +### Double negation elimination for uiversal quantification over double negations ```agda module _ @@ -201,7 +177,25 @@ module _ double-negation-elim-for-all H f p = H p (λ nq → f (λ g → nq (g p))) ``` -### Decidable propositions are double negation stable +### Double negation elimination for function types into double negations + +```agda +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 : + 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 ecidable propositions ```text double-negation-elim-is-decidable : @@ -209,7 +203,7 @@ double-negation-elim-is-decidable : double-negation-elim-is-decidable = double-negation-elim-is-decidable ``` -### Dependent sums of types with double negation elimination over a double negation stable proposition have double negation elimination +### 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 : @@ -232,7 +226,7 @@ double-negation-elim-Σ-is-decidable-prop-base (H , d) = double-negation-elim-Σ-is-prop-base H (double-negation-elim-is-decidable d) ``` -### The product of two types with double negation elimination has double negation elimination +### Double negation elimination for products of types with double negation elimination ```agda double-negation-elim-product : From 8c93ca3c4b41d56a61f94b39bebe77f4c465e6a2 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 21 Oct 2024 00:24:58 +0200 Subject: [PATCH 28/83] fixes double negation stable embeddings --- .../double-negation-stable-embeddings.lagda.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/foundation/double-negation-stable-embeddings.lagda.md b/src/foundation/double-negation-stable-embeddings.lagda.md index b1c87575f4..0d9421f8ec 100644 --- a/src/foundation/double-negation-stable-embeddings.lagda.md +++ b/src/foundation/double-negation-stable-embeddings.lagda.md @@ -53,13 +53,13 @@ open import foundation-core.torsorial-type-families A [map](foundation-core.function-types.md) is said to be a {{#concept "double negation stable embedding" Disambiguation="of types" Agda=is-double-negation-stable-emb}} if it is an [embedding](foundation-core.embeddings.md) and its -[fibers](foundation-core.fibers-of-maps.md) are -[decidable types](foundation.decidable-types.md). +[fibers](foundation-core.fibers-of-maps.md) satisfy +[double negation elimination](foundation.double-negation-elimination.md). Equivalently, a double negation stable embedding is a map whose fibers are -[decidable propositions](foundation-core.decidable-propositions.md). We refer to -this condition as being a -{{#concept "decidably propositional map" Disambiguation="of types" Agda=is-double-negation-stable-prop-map}}. +[double negation stable propositions](foundation-core.double-negation-stable-propositions.md). +We refer to this condition as being a +{{#concept "double negation stable propositional map" Disambiguation="of types" Agda=is-double-negation-stable-prop-map}}. ## Definitions @@ -167,7 +167,7 @@ pr2 (emb-double-negation-stable-emb e) = is-emb-map-double-negation-stable-emb e ## Properties -### Any map of which the fibers are decidable propositions is a double negation stable embedding +### Any map of which the fibers are double negation stable propositions is a double negation stable embedding ```agda module _ @@ -191,7 +191,7 @@ module _ is-double-negation-eliminating-map-is-double-negation-stable-emb H y ``` -### The first projection map of a dependent sum of decidable propositions is a double negation stable embedding +### The first projection map of a dependent sum of double negation stable propositions is a double negation stable embedding ```agda module _ @@ -708,7 +708,7 @@ module _ is-double-negation-stable-prop-equiv (equiv-fiber-terminal-map y) H) ``` -### If a dependent sum of propositions over a proposition is decidable, then the family is a family of decidable propositions +### If a dependent sum of propositions over a proposition is double negation stable, then the family is a family of double negation stable propositions ```agda module _ From 30acb172c33ec0abab106cfaea6e7d71f3019bc5 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 21 Oct 2024 00:29:50 +0200 Subject: [PATCH 29/83] fix --- src/foundation/preimages-of-subtypes.lagda.md | 4 +--- src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/foundation/preimages-of-subtypes.lagda.md b/src/foundation/preimages-of-subtypes.lagda.md index 2b5196488f..2c6c46fd56 100644 --- a/src/foundation/preimages-of-subtypes.lagda.md +++ b/src/foundation/preimages-of-subtypes.lagda.md @@ -42,10 +42,8 @@ module _ preimage-hom-powerset : hom-Large-Poset (λ l → l) (powerset-Large-Poset B) (powerset-Large-Poset A) - preimage-hom-powerset f = + preimage-hom-powerset = make-hom-Large-Preorder ( preimage-subtype f) ( λ B' B'' B'⊆B'' x B'fx → B'⊆B'' (f x) B'fx) ``` - -If `f` is an embedding, then `f(A) ≃ A`... diff --git a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md index 6d7ce2e93c..ca86fb2d71 100644 --- a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md +++ b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md @@ -27,6 +27,10 @@ The {{#concept "Knaster–Tarski fixed point theorem" WD="Knaster–Tarski theorem" WDID=Q609612}} states that every order preserving endomap `f : 𝒜 → 𝒜` on a complete lattice has a least and a greatest [fixed point](foundation.fixed-points-endofunctions.md). +Indeed, any order preserving endomap on a +[suplattice](order-theory.suplattices.md) has a greatest fixed point andany +order preserving endomap on an [inflattice](order-theory.inflattices.md) has a +least fixed point. ## Theorem From e9421573d9db2e7355e1cc76202f1b050ad55ba5 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 21 Oct 2024 00:40:10 +0200 Subject: [PATCH 30/83] some additional opposites --- .../opposite-large-posets.lagda.md | 14 +++++++++ src/order-theory/opposite-posets.lagda.md | 28 +++++++++++++++++ src/order-theory/opposite-preorders.lagda.md | 30 +++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/src/order-theory/opposite-large-posets.lagda.md b/src/order-theory/opposite-large-posets.lagda.md index 30690e598e..cbb94d58f5 100644 --- a/src/order-theory/opposite-large-posets.lagda.md +++ b/src/order-theory/opposite-large-posets.lagda.md @@ -120,4 +120,18 @@ module _ is-involution-opposite-Large-Poset : opposite-Large-Poset (opposite-Large-Poset P) =ω P is-involution-opposite-Large-Poset = reflω + +module _ + {αP αQ : Level → Level} {βP βQ : Level → Level → Level} {γ : Level → Level} + (P : Large-Poset αP βP) (Q : Large-Poset αQ βQ) + (f : hom-Large-Poset γ P Q) + where + + is-involution-opposite-hom-Large-Poset : + opposite-hom-Large-Poset + { P = opposite-Large-Poset P} + { opposite-Large-Poset Q} + ( opposite-hom-Large-Poset {P = P} {Q} f) =ω + f + is-involution-opposite-hom-Large-Poset = reflω ``` diff --git a/src/order-theory/opposite-posets.lagda.md b/src/order-theory/opposite-posets.lagda.md index dda087a078..45b842294c 100644 --- a/src/order-theory/opposite-posets.lagda.md +++ b/src/order-theory/opposite-posets.lagda.md @@ -16,6 +16,7 @@ open import foundation.sets open import foundation.universe-levels open import order-theory.opposite-preorders +open import order-theory.order-preserving-maps-posets open import order-theory.posets open import order-theory.preorders ``` @@ -78,6 +79,19 @@ module _ ( preorder-opposite-Poset , antisymmetric-leq-opposite-Poset) ``` +### The opposite functorial action on order preserving maps of posets + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + opposite-hom-Poset : + hom-Poset P Q → hom-Poset (opposite-Poset P) (opposite-Poset Q) + opposite-hom-Poset = + opposite-hom-Preorder (preorder-Poset P) (preorder-Poset Q) +``` + ## Properties ### The opposite poset construction is a strict involution @@ -89,4 +103,18 @@ module _ is-involution-opposite-Poset : opposite-Poset (opposite-Poset P) = P is-involution-opposite-Poset = refl + +module _ + {l1 l2 l3 l4 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) + (f : hom-Poset P Q) + where + + is-involution-opposite-hom-Poset : + opposite-hom-Poset + ( opposite-Poset P) + ( opposite-Poset Q) + ( opposite-hom-Poset P Q f) = + f + is-involution-opposite-hom-Poset = refl ``` diff --git a/src/order-theory/opposite-preorders.lagda.md b/src/order-theory/opposite-preorders.lagda.md index 1a3548fd36..39c2c42ec0 100644 --- a/src/order-theory/opposite-preorders.lagda.md +++ b/src/order-theory/opposite-preorders.lagda.md @@ -15,6 +15,7 @@ open import foundation.propositions open import foundation.sets open import foundation.universe-levels +open import order-theory.order-preserving-maps-preorders open import order-theory.preorders ``` @@ -67,6 +68,21 @@ module _ transitive-leq-opposite-Preorder) ``` +### The opposite functorial action on order preserving maps of preorders + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Preorder l1 l2) (Q : Preorder l3 l4) + where + + opposite-hom-Preorder : + hom-Preorder P Q → + hom-Preorder (opposite-Preorder P) (opposite-Preorder Q) + opposite-hom-Preorder f = + ( map-hom-Preorder P Q f) , + ( λ x y p → preserves-order-map-hom-Preorder P Q f y x p) +``` + ## Properties ### The opposite preorder construction is a strict involution @@ -78,4 +94,18 @@ module _ is-involution-opposite-Preorder : opposite-Preorder (opposite-Preorder P) = P is-involution-opposite-Preorder = refl + +module _ + {l1 l2 l3 l4 : Level} + (P : Preorder l1 l2) (Q : Preorder l3 l4) + (f : hom-Preorder P Q) + where + + is-involution-opposite-hom-Preorder : + opposite-hom-Preorder + ( opposite-Preorder P) + ( opposite-Preorder Q) + ( opposite-hom-Preorder P Q f) = + f + is-involution-opposite-hom-Preorder = refl ``` From b10fd18a2d477eff1e2507370c77399c9d36261a Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 21 Oct 2024 00:57:43 +0200 Subject: [PATCH 31/83] more edits order theory --- src/foundation/locale-of-propositions.lagda.md | 3 --- src/order-theory/bottom-elements-large-posets.lagda.md | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/foundation/locale-of-propositions.lagda.md b/src/foundation/locale-of-propositions.lagda.md index bcfa73ae1c..1d610d7759 100644 --- a/src/foundation/locale-of-propositions.lagda.md +++ b/src/foundation/locale-of-propositions.lagda.md @@ -37,9 +37,6 @@ implications between them. [Conjunction](foundation.conjunction.md) gives this [existential quantification](foundation.existential-quantification.md) gives it the structure of a [suplattice](order-theory.suplattices.md). -**Note.** The collection of all propositions is because we do not assume -[propositional resizing](foundation.propositional-resizing.md). - ## Definitions ### The preorder of propositions diff --git a/src/order-theory/bottom-elements-large-posets.lagda.md b/src/order-theory/bottom-elements-large-posets.lagda.md index fa60f601b4..76262a6702 100644 --- a/src/order-theory/bottom-elements-large-posets.lagda.md +++ b/src/order-theory/bottom-elements-large-posets.lagda.md @@ -20,7 +20,7 @@ open import order-theory.large-posets We say that a [large poset](order-theory.large-posets.md) `P` has a {{#concept "least element" Disambiguation="in a large poset" Agda=is-bottom-element-Large-Poset}} if it comes equipped with an element `t : type-Large-Poset P lzero` such that -`t ≤ x` holds for every `x : P` +`t ≤ x` holds for every `x : P`. ## Definition From 2ca4c2a535a9c92cc6c61c83811ce9d319bb7367 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 21 Oct 2024 00:58:54 +0200 Subject: [PATCH 32/83] fix --- src/foundation/double-negation-elimination.lagda.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/foundation/double-negation-elimination.lagda.md b/src/foundation/double-negation-elimination.lagda.md index 7e7a95ce88..db48639b28 100644 --- a/src/foundation/double-negation-elimination.lagda.md +++ b/src/foundation/double-negation-elimination.lagda.md @@ -32,7 +32,7 @@ open import foundation-core.propositions ## Idea We say a type `A` satisfies -{{#concept "untruncated double negation elimination" Agda="on a type" Agda=has-double-negation-elim}} +{{#concept "untruncated double negation elimination" Disambiguation="on a type" Agda=has-double-negation-elim}} if there is a map ```text @@ -40,8 +40,8 @@ if there is a map ``` We say a type `A` satisfies -{{#concept "double negation elimination" Agda="on a type"}} if there is an -implication +{{#concept "double negation elimination" Disambiguation="on a type"}} if there +is an implication ```text ¬¬A ⇒ ║A║₋₁. From 91b4174583e82d01dfb0bed79cd28eca8b7fc9cd Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 21 Oct 2024 10:37:53 +0200 Subject: [PATCH 33/83] fix links --- src/foundation/double-negation-stable-embeddings.lagda.md | 2 +- src/foundation/double-negation-stable-subtypes.lagda.md | 2 +- src/foundation/powersets.lagda.md | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/foundation/double-negation-stable-embeddings.lagda.md b/src/foundation/double-negation-stable-embeddings.lagda.md index 0d9421f8ec..cbb35b2450 100644 --- a/src/foundation/double-negation-stable-embeddings.lagda.md +++ b/src/foundation/double-negation-stable-embeddings.lagda.md @@ -57,7 +57,7 @@ if it is an [embedding](foundation-core.embeddings.md) and its [double negation elimination](foundation.double-negation-elimination.md). Equivalently, a double negation stable embedding is a map whose fibers are -[double negation stable propositions](foundation-core.double-negation-stable-propositions.md). +[double negation stable propositions](foundation.double-negation-stable-propositions.md). We refer to this condition as being a {{#concept "double negation stable propositional map" Disambiguation="of types" Agda=is-double-negation-stable-prop-map}}. diff --git a/src/foundation/double-negation-stable-subtypes.lagda.md b/src/foundation/double-negation-stable-subtypes.lagda.md index 53a406e001..a0de7d9e56 100644 --- a/src/foundation/double-negation-stable-subtypes.lagda.md +++ b/src/foundation/double-negation-stable-subtypes.lagda.md @@ -45,7 +45,7 @@ open import foundation-core.truncation-levels A {{#concept "double negation stable subtype" Disambiguation="of a type" Agda=is-double-negation-stable-subtype Agda=double-negation-stable-subtype}} of a type consists of a family of -[double negation stable propositions](foundation-core.double-negation-stable-propositions.md) +[double negation stable propositions](foundation.double-negation-stable-propositions.md) over it. ## Definitions diff --git a/src/foundation/powersets.lagda.md b/src/foundation/powersets.lagda.md index 538bafd9f7..bcbc992421 100644 --- a/src/foundation/powersets.lagda.md +++ b/src/foundation/powersets.lagda.md @@ -180,9 +180,8 @@ module _ ## See also -- [the locale of subtypes](foundation.locale-of-subtypes.md) - [the large locale of subtypes](foundation.large-locale-of-subtypes.md) -- [preimages of subtypes](foundation.preimages-subtypes.md) +- [preimages of subtypes](foundation.preimages-of-subtypes.md) - [images of subtypes](foundation.images-subtypes.md) ## External links From 2ec613b3720756e9c1fd8f7ad226374e77b29741 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 21 Oct 2024 19:47:44 +0200 Subject: [PATCH 34/83] informal proof constructive csbe --- ...cantor-schroder-bernstein-escardo.lagda.md | 67 +++++++++++++------ 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md b/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md index 27ba5c6d43..a0e34024b5 100644 --- a/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md +++ b/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md @@ -56,18 +56,26 @@ between `X` and `Y`. type-constructive-Cantor-Schröder-Bernstein-Escardó : (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) type-constructive-Cantor-Schröder-Bernstein-Escardó l1 l2 = + {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈ X) → X ≃ Y + +type-constructive-Cantor-Schröder-Bernstein-Escardó' : + (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) +type-constructive-Cantor-Schröder-Bernstein-Escardó' l1 l2 = {X : UU l1} {Y : UU l2} → (X ↪¬¬ Y) → (Y ↪¬¬ X) → X ≃ Y ``` ## Proof -**Proof.** We begin by observing that given a double negation stable embedding, +**Proof.** Let us begin by assuming we have two arbitrary embeddings `f : X ↪ Y` +and `g : Y ↪ X`. In general, these need not be equivalences, so we need to +construct a "correction" so that we are left with a pair of mutual inverses. -```text - f : X → Y -``` - -then the image of `f` gives a decomposition of `Y`, `Y ≃ f(X) + Y\f(X) + ε`. +We will proceed by finding a pair of subtypes that are left fixed by a roundtrip +around taking direct images of `f` and `g` and their complements. If we begin by +considering the entirety of `X` and taking its direct image under `f`, we are +left with a subtype of `Y` that need not be full. By translating to the +complement, we have a close measure of "everything that `f` does not hit. This +is what we need to correct for... ```text X Y @@ -84,19 +92,14 @@ then the image of `f` gives a decomposition of `Y`, `Y ≃ f(X) + Y\f(X) + ε`. \_______/ \_______/ ``` -the ??? fixed point theorem says that at some point this operation stabilizes, -giving us a subtype `S ⊆ X` such that +appropriate fixed point theorems, such as the Knaster–Tarski fixed point +theorem, or Adamek's fixed point theorem?, says that at some point this +operation stabilizes, giving us a subtype `S ⊆ X` such that ```text X\g(Y\f(S)) = S. ``` -By double negation stability we also have the equation - -```text - g(Y\f(S)) = X\S. -``` - ```text X Y _______ _______ @@ -118,19 +121,45 @@ Dually, we also have a least fixed point `T` of the endooperator B ↦ Y\(f(X\g(B))) ``` -that satisfies `g(Y\f(T)) = Y\T`. But this gives us two further fixed points: +But this gives us two further fixed points: that satisfies `g(Y\f(T)) = Y\T`. ```text - X\g(Y\f(X\g(S))) = X\g(S) and Y\f(X\g(Y\f(T))) = Y\f(T) + Y\f(X\g(Y\f(S))) = Y\f(S) and X\g(Y\f(X\g(T))) = X\g(T) ``` -If we can prove that `S` and `T` are decidable, then we can finish the proof in -the classical way. +So if `S` and `T` are greatest fixed points, we have ```text - S ∪ X\S = X\g(Y\f(S)) ∪ g(Y\f(S)) + X\g(T) ⊆ S and Y\f(S) ⊆ T ``` +If `g` is double negation stable we also have the equality + +```text + g(Y\f(S)) = X\S. +``` + +This gives us an inverse map `g⁻¹ : X\S → Y` and similarly there is an inverse +map `f⁻¹ : Y\T → X`. Now, if `S` and `f(S)` were decidable subtypes, we could +define a new total map `h : X → Y` by + +```text + h(x) = f (x) if x ∈ S + h(x) = g⁻¹(x) if x ∉ S +``` + +and a converse map + +```text + h'(x) = f⁻¹(x) if x ∈ f(S) + h'(x) = g (x) if x ∉ f(S). +``` + +Clearly, this gives a pair of mutually inverse maps. + +Here we're not using the existence of `T` at all, nor that `S` is a greatest +fixed point or that `g` satisfies any decidability property. + ```agda module _ {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) From f99c780e13a78e5fdb43ba4259db303f958afc51 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 22 Oct 2024 00:12:23 +0200 Subject: [PATCH 35/83] Double negation elimination is irrefutable --- src/foundation/irrefutable-propositions.lagda.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md index 921745545d..b19c1174b5 100644 --- a/src/foundation/irrefutable-propositions.lagda.md +++ b/src/foundation/irrefutable-propositions.lagda.md @@ -15,6 +15,7 @@ open import foundation.double-negation open import foundation.double-negation-elimination open import foundation.function-types open import foundation.negation +open import foundation.empty-types open import foundation.subuniverses open import foundation.unit-type open import foundation.universe-levels @@ -108,7 +109,7 @@ module _ double-negation-elim-neg (¬ (type-Prop P)) ``` -### The decidability of a proposition is irrefutable +### Decidability is irrefutable ```agda is-irrefutable-is-decidable : {l : Level} {A : UU l} → ¬¬ (is-decidable A) @@ -125,3 +126,12 @@ module _ is-decidable-prop-Irrefutable-Prop = 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 (λ x → ex-falso (x (λ a → H (λ _ → a)))) +``` From bce668618a89a267a6cbc054f347e16942ff1fae Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 25 Oct 2024 23:07:17 +0200 Subject: [PATCH 36/83] wip logic --- src/foundation/cantors-theorem.lagda.md | 2 +- src/foundation/complements-subtypes.lagda.md | 2 +- .../double-negation-elimination.lagda.md | 21 +++ .../irrefutable-propositions.lagda.md | 2 +- src/foundation/perfect-images.lagda.md | 2 +- src/logic/de-morgan-sheaves.lagda.md | 128 +++++++++++++++ src/logic/de-morgan-types.lagda.md | 154 ++++++++++++++++++ src/logic/de-morgans-law.lagda.md | 139 ++++++++++++++++ .../double-negation-eliminating-maps.lagda.md | 2 +- ...double-negation-stable-embeddings.lagda.md | 4 +- .../double-negation-stable-subtypes.lagda.md | 6 +- .../decidable-total-orders.lagda.md | 2 +- .../decidable-total-preorders.lagda.md | 2 +- src/order-theory/posets.lagda.md | 21 ++- src/order-theory/preorders.lagda.md | 25 ++- 15 files changed, 494 insertions(+), 18 deletions(-) create mode 100644 src/logic/de-morgan-sheaves.lagda.md create mode 100644 src/logic/de-morgan-types.lagda.md create mode 100644 src/logic/de-morgans-law.lagda.md rename src/{foundation => logic}/double-negation-eliminating-maps.lagda.md (99%) rename src/{foundation => logic}/double-negation-stable-embeddings.lagda.md (99%) rename src/{foundation => logic}/double-negation-stable-subtypes.lagda.md (98%) diff --git a/src/foundation/cantors-theorem.lagda.md b/src/foundation/cantors-theorem.lagda.md index d3ecf16559..91eb8d31fb 100644 --- a/src/foundation/cantors-theorem.lagda.md +++ b/src/foundation/cantors-theorem.lagda.md @@ -12,7 +12,7 @@ open import foundation.decidable-propositions open import foundation.decidable-subtypes open import foundation.dependent-pair-types open import foundation.double-negation-stable-propositions -open import foundation.double-negation-stable-subtypes +open import logic.double-negation-stable-subtypes open import foundation.function-extensionality open import foundation.logical-equivalences open import foundation.negation diff --git a/src/foundation/complements-subtypes.lagda.md b/src/foundation/complements-subtypes.lagda.md index 6baa799949..a0212fbc59 100644 --- a/src/foundation/complements-subtypes.lagda.md +++ b/src/foundation/complements-subtypes.lagda.md @@ -10,7 +10,7 @@ module foundation.complements-subtypes where open import foundation.decidable-propositions open import foundation.decidable-subtypes open import foundation.double-negation-stable-propositions -open import foundation.double-negation-stable-subtypes +open import logic.double-negation-stable-subtypes open import foundation.full-subtypes open import foundation.negation open import foundation.postcomposition-functions diff --git a/src/foundation/double-negation-elimination.lagda.md b/src/foundation/double-negation-elimination.lagda.md index db48639b28..7450d62f55 100644 --- a/src/foundation/double-negation-elimination.lagda.md +++ b/src/foundation/double-negation-elimination.lagda.md @@ -13,6 +13,7 @@ open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation open import foundation.empty-types +open import foundation.coproduct-types open import foundation.evaluation-functions open import foundation.logical-equivalences open import foundation.negation @@ -123,6 +124,26 @@ module _ has-double-negation-elim-iff' (iff-retract e) ``` +### If the negation of a type with double negation elimination is decidable, then the type is decidable + +**Note.** 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. + +```agda +module _ + {l1 : Level} {A : UU l1} + where + + is-decidable-is-decidable-neg-has-double-negation-elim : + has-double-negation-elim A → is-decidable (¬ A) → is-decidable A + is-decidable-is-decidable-neg-has-double-negation-elim f (inl nx) = + inr nx + is-decidable-is-decidable-neg-has-double-negation-elim f (inr nnx) = + inl (f nnx) +``` + ### Double negation elimination for empty types ```agda diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md index b19c1174b5..875b3d8fee 100644 --- a/src/foundation/irrefutable-propositions.lagda.md +++ b/src/foundation/irrefutable-propositions.lagda.md @@ -133,5 +133,5 @@ module _ is-irrefutable-double-negation-elim : {l : Level} {A : UU l} → ¬¬ (has-double-negation-elim A) is-irrefutable-double-negation-elim H = - H (λ x → ex-falso (x (λ a → H (λ _ → a)))) + H (λ f → ex-falso (f (λ a → H (λ _ → a)))) ``` diff --git a/src/foundation/perfect-images.lagda.md b/src/foundation/perfect-images.lagda.md index b5aa69c968..ca725894c9 100644 --- a/src/foundation/perfect-images.lagda.md +++ b/src/foundation/perfect-images.lagda.md @@ -14,7 +14,7 @@ open import foundation.decidable-maps open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation -open import foundation.double-negation-eliminating-maps +open import logic.double-negation-eliminating-maps open import foundation.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.functoriality-dependent-function-types diff --git a/src/logic/de-morgan-sheaves.lagda.md b/src/logic/de-morgan-sheaves.lagda.md new file mode 100644 index 0000000000..68a208c7e9 --- /dev/null +++ b/src/logic/de-morgan-sheaves.lagda.md @@ -0,0 +1,128 @@ +# De Morgan sheaves + +```agda +module logic.de-morgan-sheaves where +``` + +
Imports + +```agda +open import foundation.contractible-types +open import foundation.dependent-pair-types +open import logic.de-morgans-law +open import foundation.coproduct-types +open import foundation.double-negation +open import foundation.empty-types +open import foundation.irrefutable-propositions +open import foundation.logical-equivalences +open import foundation.negation +open import foundation.type-arithmetic-cartesian-product-types +open import foundation.universal-property-coproduct-types +open import foundation.universe-levels + +open import foundation-core.equivalences +open import foundation-core.function-types +open import foundation-core.propositions + +open import orthogonal-factorization-systems.null-types +``` + +
+ +## Idea + +{{#concept "De morgan sheaves" Agda=is-de-morgan-sheaf}} are types that are +[null](orthogonal-factorization-systems.null-types.md) at propositions of the +form `¬ P ∨ ¬¬ P`. + +De Morgan sheaves are closely related to, but a strictly weaker notion than that +of +[double negation sheaves](orthogonal-factorization-systems.double-negation-sheaves.md). + +## Definitions + +### The property of being a De Morgan sheaf + +```agda +is-de-morgan-sheaf : + (l1 : Level) {l2 : Level} (A : UU l2) → UU (lsuc l1 ⊔ l2) +is-de-morgan-sheaf l1 A = + (P : Prop l1) → is-null (is-decidable (¬ P)) A + +is-prop-is-de-morgan-sheaf : + {l1 l2 : Level} {A : UU l2} → is-prop (is-de-morgan-sheaf l1 A) +is-prop-is-de-morgan-sheaf {A = A} = + is-prop-Π (λ P → is-prop-is-null (type-Irrefutable-Prop P) A) +``` + +## Properties + +### A type is a De Morgan sheaf if and only if it is local at the De Morgan implication + +A type null at `¬P ∨ ¬¬ P` for all propositions `P` if and only if it is local +at `(¬ P ∨ ¬ Q) ⇒ ¬ (P ∧ Q)` for all propositions `P` and `Q`. + +### The empty type is a De Morgan sheaf + +```agda +is-de-morgan-sheaf-empty : + {l : Level} → is-de-morgan-sheaf l empty +is-de-morgan-sheaf-empty P = + is-equiv-has-converse empty-Prop + ( hom-Prop (prop-Irrefutable-Prop P) empty-Prop) + ( is-irrefutable-Irrefutable-Prop P) +``` + +### Contractible types are De Morgan sheaves + +```agda +is-de-morgan-sheaf-is-contr : + {l1 l2 : Level} {A : UU l1} → is-contr A → is-de-morgan-sheaf l2 A +is-de-morgan-sheaf-is-contr is-contr-A P = + is-null-is-contr (type-Irrefutable-Prop P) is-contr-A +``` + +### Propositions that are De Morgan sheaves are De Morgan + +```agda +module _ + {l : Level} {A : UU l} + (is-prop-A : is-prop A) + (is-¬¬sheaf-A : is-de-morgan-sheaf l A) + where + + -- compute-is-de-morgan-sheaf-is-prop : A ≃ (¬ A → A) + -- compute-is-de-morgan-sheaf-is-prop = + -- ( left-unit-law-product-is-contr + -- ( is-proof-irrelevant-is-prop (is-prop-function-type is-prop-A) id)) ∘e + -- ( equiv-universal-property-coproduct A) ∘e + -- ( _ , is-¬¬sheaf-A (is-decidable-prop-Irrefutable-Prop (A , is-prop-A))) + + -- is-de-morgan-stable-is-de-morgan-sheaf-is-prop : + -- is-de-morgan-stable (A , is-prop-A) + -- is-de-morgan-stable-is-de-morgan-sheaf-is-prop ¬¬a = + -- map-inv-is-equiv (is-¬¬sheaf-A (A , is-prop-A , ¬¬a)) id +``` + +### Double negation stable propositions are De Morgan sheaves + +This follows from the fact that a proposition `P` is double negation stable if +and only if it is local at all double negations + +```text + (¬¬A → P) → (A → P), +``` + +and nullification at irrefutable propositions is a restriction of this. + +> This remains to be formalized. + +### The negation of a type is a De Morgan sheaf + +This is a corollary of the previous result. + +> This remains to be formalized. + +## References + +{{#bibliography}} diff --git a/src/logic/de-morgan-types.lagda.md b/src/logic/de-morgan-types.lagda.md new file mode 100644 index 0000000000..2db2d36ac7 --- /dev/null +++ b/src/logic/de-morgan-types.lagda.md @@ -0,0 +1,154 @@ +# De Morgan propositions + +```agda +module logic.de-morgan-propositions where +``` + +
Imports + +```agda +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.cartesian-product-types +open import foundation.universe-levels +open import logic.de-morgans-law + +open import foundation-core.decidable-propositions +open import foundation.negation +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.double-negation +open import foundation.conjunction +open import foundation.evaluation-functions +open import foundation.empty-types +open import foundation.disjunction +open import foundation.function-types +open import foundation.coproduct-types +open import foundation-core.propositions + +open import univalent-combinatorics.2-element-types +``` + +
+ +## Idea + +In classical logic, i.e., logic where we assume +[the law of excluded middle](foundation.law-of-excluded-middle.md), the _De +Morgan laws_ refers to the pair of logical equivalences + +```text + ¬ (P ∨ Q) ⇔ (¬ P) ∧ (¬ Q) + ¬ (P ∧ Q) ⇔ (¬ P) ∨ (¬ Q). +``` + +Out of these in total four logical implications, all but one are validated in +constructive mathematics. The odd one out is + +```text + ¬ (P ∧ Q) ⇒ (¬ P) ∨ (¬ Q). +``` + +Indeed, this would state that we could constructively deduce from a proof that +neither `P` nor `Q` is true, whether of `P` is false or `Q` is false. This +logical law is what we refer to as [De Morgan's Law](logic.de-morgans-law.md). +If a proposition `P` is such that for every other proposition `Q`, the De Morgan +implication + +```text + ¬ (P ∧ Q) ⇒ (¬ P) ∨ (¬ Q) +``` + +holds, we say `P` is {{#concept "De Morgan" Disambiguation="proposition"}}. + +## Definition + +## De Morgan types + +```agda +is-de-morgan-type-Level : + {l1 : Level} (l2 : Level) (A : UU l1) → UU (l1 ⊔ lsuc l2) +is-de-morgan-type-Level l2 A = + (B : UU l2) → ¬ (A × B) → disjunction-type (¬ A) (¬ B) + +is-de-morgan-type : {l1 : Level} (A : UU l1) → UUω +is-de-morgan-type A = + {l2 : Level} (B : UU l2) → ¬ (A × B) → disjunction-type (¬ A) (¬ B) + +is-prop-is-de-morgan-type-Level : + {l1 l2 : Level} {A : UU l1} → is-prop (is-de-morgan-type-Level l2 A) +is-prop-is-de-morgan-type-Level {A = A} = + is-prop-Π (λ B → is-prop-Π (λ p → is-prop-disjunction-type (¬ A) (¬ B))) + +is-de-morgan-type-Prop : + {l1 : Level} (l2 : Level) (A : UU l1) → Prop (l1 ⊔ lsuc l2) +is-de-morgan-type-Prop l2 A = + ( is-de-morgan-type-Level l2 A , is-prop-is-de-morgan-type-Level) +``` + +## De Morgan propositions + +## Properties + +### If a type is De Morgan then its negation is decidable + +Indeed, one need only check that `A` and `¬ A` satisfy De Morgan's law, as then +the hypothesis below is just true: + +```text + ¬ (A ∧ ¬ A) ⇒ ¬ A ∨ ¬¬ A. +``` + +```agda +module _ + {l : Level} (A : UU l) + where + + is-decidable-neg-is-de-morgan' : + ({l' : Level} (B : UU l') → ¬ (A × B) → ¬ A + ¬ B) → is-decidable (¬ A) + is-decidable-neg-is-de-morgan' H = H (¬ A) (λ f → pr2 f (pr1 f)) + + is-merely-decidable-neg-satisfies-de-morgan : + is-de-morgan-type A → is-merely-decidable (¬ A) + is-merely-decidable-neg-satisfies-de-morgan H = H (¬ A) (λ f → pr2 f (pr1 f)) + + is-decidable-neg-is-de-morgan : + is-de-morgan-type A → is-decidable (¬ A) + is-decidable-neg-is-de-morgan H = + rec-trunc-Prop + ( is-decidable-Prop (neg-type-Prop A)) + ( id) + ( H (¬ A) (λ f → pr2 f (pr1 f))) +``` + +### If the negation of a proposition is decidable then it is De Morgan + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-de-morgan-is-decidable-neg-left : + is-decidable (¬ A) → ¬ (A × B) → ¬ A + ¬ B + is-de-morgan-is-decidable-neg-left (inl na) f = + inl na + is-de-morgan-is-decidable-neg-left (inr nna) f = + inr (λ y → nna (λ x → f (x , y))) + + is-de-morgan-is-decidable-neg-right : + is-decidable (¬ B) → ¬ (A × B) → ¬ A + ¬ B + is-de-morgan-is-decidable-neg-right (inl nb) f = + inr nb + is-de-morgan-is-decidable-neg-right (inr nnb) f = + inl (λ x → nnb (λ y → f (x , y))) + +is-de-morgan-is-decidable-neg : + {l : Level} {A : UU l} → is-decidable (¬ A) → is-de-morgan-type A +is-de-morgan-is-decidable-neg x B q = + unit-trunc-Prop (is-de-morgan-is-decidable-neg-left x q) +``` + +## External links + +- [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) + at $n$Lab diff --git a/src/logic/de-morgans-law.lagda.md b/src/logic/de-morgans-law.lagda.md new file mode 100644 index 0000000000..24f9548bdc --- /dev/null +++ b/src/logic/de-morgans-law.lagda.md @@ -0,0 +1,139 @@ +# De Morgan's law + +```agda +module logic.de-morgans-law where +``` + +
Imports + +```agda +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.cartesian-product-types +open import foundation.universe-levels + +open import foundation-core.decidable-propositions +open import foundation.negation +open import foundation.logical-equivalences +open import foundation.double-negation +open import foundation.conjunction +open import foundation.empty-types +open import foundation.evaluation-functions +open import foundation.disjunction +open import foundation.function-types +open import foundation.coproduct-types +open import foundation-core.propositions + +open import univalent-combinatorics.2-element-types +``` + +
+ +## Idea + +In classical logic, i.e., logic where we assume +[the law of excluded middle](foundation.law-of-excluded-middle.md), the _De +Morgan laws_ refers to the pair of logical equivalences + +```text + ¬ (P ∨ Q) ⇔ (¬ P) ∧ (¬ Q) + ¬ (P ∧ Q) ⇔ (¬ P) ∨ (¬ Q). +``` + +Out of these in total four logical implications, all but one are validated in +constructive mathematics. The odd one out is + +```text + ¬ (P ∧ Q) ⇒ (¬ P) ∨ (¬ Q). +``` + +Indeed, this would state that we could constructively deduce from a proof that +neither `P` nor `Q` is true, which of `P` is false or `Q` is false. This logical +law is what we refer to as {{#concept "De Morgan's Law" Agda=De-Morgans-Law}}. + +## Definition + +```agda +module _ + {l1 l2 : Level} (A : UU l1) (B : UU l2) + where + + de-morgans-law-Prop' : Prop (l1 ⊔ l2) + de-morgans-law-Prop' = + neg-type-Prop (A × B) ⇒ (neg-type-Prop A) ∨ (neg-type-Prop B) + + de-morgans-law' : UU (l1 ⊔ l2) + de-morgans-law' = ¬ (A × B) → disjunction-type (¬ A) (¬ B) + +module _ + {l1 l2 : Level} (P : Prop l1) (Q : Prop l2) + where + + de-morgans-law-Prop : Prop (l1 ⊔ l2) + de-morgans-law-Prop = ¬' (P ∧ Q) ⇒ (¬' P) ∨ (¬' Q) + + de-morgans-law : UU (l1 ⊔ l2) + de-morgans-law = type-Prop de-morgans-law-Prop + +De-Morgans-Law-Level : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +De-Morgans-Law-Level l1 l2 = + (P : Prop l1) (Q : Prop l2) → de-morgans-law P Q + +prop-De-Morgans-Law-Level : (l1 l2 : Level) → Prop (lsuc l1 ⊔ lsuc l2) +prop-De-Morgans-Law-Level l1 l2 = + Π-Prop + ( Prop l1) + ( λ P → Π-Prop (Prop l2) (λ Q → de-morgans-law-Prop P Q)) + +De-Morgans-Law : UUω +De-Morgans-Law = {l1 l2 : Level} → De-Morgans-Law-Level l1 l2 +``` + +## Properties + +### The constructive De Morgan's laws + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + forward-implication-constructive-de-morgan : ¬ (A + B) → (¬ A) × (¬ B) + forward-implication-constructive-de-morgan z = (z ∘ inl) , (z ∘ inr) + + backward-implication-constructive-de-morgan : (¬ A) × (¬ B) → ¬ (A + B) + backward-implication-constructive-de-morgan (na , nb) (inl x) = na x + backward-implication-constructive-de-morgan (na , nb) (inr y) = nb y + + constructive-de-morgan : ¬ (A + B) ↔ (¬ A) × (¬ B) + constructive-de-morgan = + ( forward-implication-constructive-de-morgan , + backward-implication-constructive-de-morgan) + + backward-implication-de-morgan : ¬ A + ¬ B → ¬ (A × B) + backward-implication-de-morgan (inl na) (x , y) = na x + backward-implication-de-morgan (inr nb) (x , y) = nb y +``` + +### Given the hypothesis of De Morgan's law, the conclusion is irrefutable + +```agda +double-negation-de-morgan : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → ¬ (A × B) → ¬¬ (¬ A + ¬ B) +double-negation-de-morgan f v = + v (inl (λ x → v (inr (λ y → f (x , y))))) +``` + +### De Morgan's law is irrefutable + +```agda +is-irrefutable-de-morgans-law : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → ¬¬ (¬ (A × B) → ¬ A + ¬ B) +is-irrefutable-de-morgans-law u = + u (λ _ → inl (λ x → u (λ f → inr (λ y → f (x , y))))) +``` + +## External links + +- [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) + at $n$Lab diff --git a/src/foundation/double-negation-eliminating-maps.lagda.md b/src/logic/double-negation-eliminating-maps.lagda.md similarity index 99% rename from src/foundation/double-negation-eliminating-maps.lagda.md rename to src/logic/double-negation-eliminating-maps.lagda.md index f0d36e2487..f84f14434d 100644 --- a/src/foundation/double-negation-eliminating-maps.lagda.md +++ b/src/logic/double-negation-eliminating-maps.lagda.md @@ -1,7 +1,7 @@ # Double negation eliminating maps ```agda -module foundation.double-negation-eliminating-maps where +module logic.double-negation-eliminating-maps where ```
Imports diff --git a/src/foundation/double-negation-stable-embeddings.lagda.md b/src/logic/double-negation-stable-embeddings.lagda.md similarity index 99% rename from src/foundation/double-negation-stable-embeddings.lagda.md rename to src/logic/double-negation-stable-embeddings.lagda.md index cbb35b2450..1c788939a9 100644 --- a/src/foundation/double-negation-stable-embeddings.lagda.md +++ b/src/logic/double-negation-stable-embeddings.lagda.md @@ -1,7 +1,7 @@ # Double negation stable embeddings ```agda -module foundation.double-negation-stable-embeddings where +module logic.double-negation-stable-embeddings where ```
Imports @@ -14,7 +14,7 @@ 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-eliminating-maps +open import logic.double-negation-eliminating-maps open import foundation.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.embeddings diff --git a/src/foundation/double-negation-stable-subtypes.lagda.md b/src/logic/double-negation-stable-subtypes.lagda.md similarity index 98% rename from src/foundation/double-negation-stable-subtypes.lagda.md rename to src/logic/double-negation-stable-subtypes.lagda.md index a0de7d9e56..3924f17a78 100644 --- a/src/foundation/double-negation-stable-subtypes.lagda.md +++ b/src/logic/double-negation-stable-subtypes.lagda.md @@ -1,7 +1,7 @@ # Double negation stable subtypes ```agda -module foundation.double-negation-stable-subtypes where +module logic.double-negation-stable-subtypes where ```
Imports @@ -10,9 +10,9 @@ module foundation.double-negation-stable-subtypes where open import foundation.1-types open import foundation.coproduct-types open import foundation.dependent-pair-types -open import foundation.double-negation-eliminating-maps +open import logic.double-negation-eliminating-maps open import foundation.double-negation-elimination -open import foundation.double-negation-stable-embeddings +open import logic.double-negation-stable-embeddings open import foundation.double-negation-stable-propositions open import foundation.equality-dependent-function-types open import foundation.functoriality-cartesian-product-types diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index 924542f3ce..2aeb739708 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -90,7 +90,7 @@ module _ le-Decidable-Total-Order-Prop : (x y : type-Decidable-Total-Order) → Prop (l1 ⊔ l2) le-Decidable-Total-Order-Prop = - le-Poset-Prop poset-Decidable-Total-Order + le-prop-Poset poset-Decidable-Total-Order le-Decidable-Total-Order : (x y : type-Decidable-Total-Order) → UU (l1 ⊔ l2) diff --git a/src/order-theory/decidable-total-preorders.lagda.md b/src/order-theory/decidable-total-preorders.lagda.md index 5920a68fb7..c3385ce7ae 100644 --- a/src/order-theory/decidable-total-preorders.lagda.md +++ b/src/order-theory/decidable-total-preorders.lagda.md @@ -83,7 +83,7 @@ module _ le-Decidable-Total-Preorder-Prop : (x y : type-Decidable-Total-Preorder) → Prop (l1 ⊔ l2) le-Decidable-Total-Preorder-Prop = - le-Preorder-Prop preorder-Decidable-Total-Preorder + le-prop-Preorder preorder-Decidable-Total-Preorder le-Decidable-Total-Preorder : (x y : type-Decidable-Total-Preorder) → UU (l1 ⊔ l2) diff --git a/src/order-theory/posets.lagda.md b/src/order-theory/posets.lagda.md index eeaad7775f..ece056f7a4 100644 --- a/src/order-theory/posets.lagda.md +++ b/src/order-theory/posets.lagda.md @@ -16,6 +16,7 @@ open import foundation.cartesian-product-types open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.identity-types +open import foundation.injective-maps open import foundation.logical-equivalences open import foundation.propositions open import foundation.sets @@ -77,8 +78,8 @@ module _ transitive-leq-Poset : is-transitive leq-Poset transitive-leq-Poset = transitive-leq-Preorder preorder-Poset - le-Poset-Prop : (x y : type-Poset) → Prop (l1 ⊔ l2) - le-Poset-Prop = le-Preorder-Prop preorder-Poset + le-prop-Poset : (x y : type-Poset) → Prop (l1 ⊔ l2) + le-prop-Poset = le-prop-Preorder preorder-Poset le-Poset : (x y : type-Poset) → UU (l1 ⊔ l2) le-Poset = le-Preorder preorder-Poset @@ -188,3 +189,19 @@ module _ ``` It remains to show that these constructions form inverses to eachother. + +### Resizing the underlying type of a poset + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} + where + + resize-type-Poset : + (P : Poset l2 l3) → A ≃ type-Poset P → Poset l1 l3 + resize-type-Poset P e = + ( resize-type-Preorder (preorder-Poset P) e , + ( λ x y p q → + is-injective-equiv e + ( antisymmetric-leq-Poset P (map-equiv e x) (map-equiv e y) p q))) +``` diff --git a/src/order-theory/preorders.lagda.md b/src/order-theory/preorders.lagda.md index 5a0566e303..31e2f27ef1 100644 --- a/src/order-theory/preorders.lagda.md +++ b/src/order-theory/preorders.lagda.md @@ -13,6 +13,7 @@ open import foundation.binary-relations open import foundation.cartesian-product-types open import foundation.dependent-pair-types open import foundation.function-types +open import foundation.equivalences open import foundation.identity-types open import foundation.negated-equality open import foundation.negation @@ -64,15 +65,15 @@ module _ {x y z : type-Preorder} → leq-Preorder x y → y = z → leq-Preorder x z concatenate-leq-eq-Preorder H refl = H - le-Preorder-Prop : Relation-Prop (l1 ⊔ l2) type-Preorder - le-Preorder-Prop x y = + le-prop-Preorder : Relation-Prop (l1 ⊔ l2) type-Preorder + le-prop-Preorder x y = product-Prop (x ≠ y , is-prop-neg) (leq-prop-Preorder x y) le-Preorder : Relation (l1 ⊔ l2) type-Preorder - le-Preorder x y = type-Prop (le-Preorder-Prop x y) + le-Preorder x y = type-Prop (le-prop-Preorder x y) is-prop-le-Preorder : (x y : type-Preorder) → is-prop (le-Preorder x y) - is-prop-le-Preorder = is-prop-type-Relation-Prop le-Preorder-Prop + 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)) @@ -167,3 +168,19 @@ module _ ``` It remains to show that these constructions form inverses to eachother. + +### Resizing the underlying type of a preorder + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} + where + + resize-type-Preorder : + (P : Preorder l2 l3) → A ≃ type-Preorder P → Preorder l1 l3 + resize-type-Preorder P e = + ( ( A) , + ( λ x y → leq-prop-Preorder P (map-equiv e x) (map-equiv e y)) , + ( λ x → refl-leq-Preorder P (map-equiv e x)) , + ( λ x y z → transitive-leq-Preorder P (pr1 e x) (pr1 e y) (pr1 e z))) +``` From fb35a57548128946d57abad086b9dd3dc03b3e26 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 25 Oct 2024 23:09:55 +0200 Subject: [PATCH 37/83] wip logic --- src/foundation.lagda.md | 4 --- src/foundation/cantors-theorem.lagda.md | 3 ++- src/foundation/complements-subtypes.lagda.md | 3 ++- ...uble-negation-stable-propositions.lagda.md | 2 +- .../irrefutable-propositions.lagda.md | 4 +-- src/logic.lagda.md | 12 +++++++++ src/logic/de-morgan-sheaves.lagda.md | 5 ++-- src/logic/de-morgan-types.lagda.md | 25 ++++++++++--------- src/logic/de-morgans-law.lagda.md | 18 ++++++------- .../double-negation-eliminating-maps.lagda.md | 4 +-- .../double-negation-elimination.lagda.md | 4 +-- ...double-negation-stable-embeddings.lagda.md | 7 +++--- .../double-negation-stable-subtypes.lagda.md | 7 +++--- src/order-theory/preorders.lagda.md | 2 +- 14 files changed, 57 insertions(+), 43 deletions(-) create mode 100644 src/logic.lagda.md rename src/{foundation => logic}/double-negation-elimination.lagda.md (99%) diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 2ef5b4dad3..2d34361704 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -84,7 +84,6 @@ open import foundation.connected-types public open import foundation.constant-maps public open import foundation.constant-span-diagrams public open import foundation.constant-type-families public -open import foundation.constructive-cantor-schroder-bernstein-escardo public open import foundation.contractible-maps public open import foundation.contractible-types public open import foundation.copartial-elements public @@ -136,12 +135,9 @@ open import foundation.discrete-types public open import foundation.disjunction public open import foundation.double-arrows public open import foundation.double-negation public -open import foundation.double-negation-eliminating-maps public open import foundation.double-negation-elimination public open import foundation.double-negation-modality public -open import foundation.double-negation-stable-embeddings public open import foundation.double-negation-stable-propositions public -open import foundation.double-negation-stable-subtypes public open import foundation.double-powersets public open import foundation.dubuc-penon-compact-types public open import foundation.effective-maps-equivalence-relations public diff --git a/src/foundation/cantors-theorem.lagda.md b/src/foundation/cantors-theorem.lagda.md index 91eb8d31fb..1121765ee5 100644 --- a/src/foundation/cantors-theorem.lagda.md +++ b/src/foundation/cantors-theorem.lagda.md @@ -12,7 +12,6 @@ open import foundation.decidable-propositions open import foundation.decidable-subtypes open import foundation.dependent-pair-types open import foundation.double-negation-stable-propositions -open import logic.double-negation-stable-subtypes open import foundation.function-extensionality open import foundation.logical-equivalences open import foundation.negation @@ -24,6 +23,8 @@ 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.double-negation-stable-subtypes ```
diff --git a/src/foundation/complements-subtypes.lagda.md b/src/foundation/complements-subtypes.lagda.md index a0212fbc59..5885bcf429 100644 --- a/src/foundation/complements-subtypes.lagda.md +++ b/src/foundation/complements-subtypes.lagda.md @@ -10,7 +10,6 @@ module foundation.complements-subtypes where open import foundation.decidable-propositions open import foundation.decidable-subtypes open import foundation.double-negation-stable-propositions -open import logic.double-negation-stable-subtypes open import foundation.full-subtypes open import foundation.negation open import foundation.postcomposition-functions @@ -22,6 +21,8 @@ open import foundation.universe-levels open import foundation-core.function-types open import foundation-core.subtypes +open import logic.double-negation-stable-subtypes + open import order-theory.large-posets open import order-theory.opposite-large-posets open import order-theory.order-preserving-maps-large-posets diff --git a/src/foundation/double-negation-stable-propositions.lagda.md b/src/foundation/double-negation-stable-propositions.lagda.md index 9166796be6..d5490aab4b 100644 --- a/src/foundation/double-negation-stable-propositions.lagda.md +++ b/src/foundation/double-negation-stable-propositions.lagda.md @@ -15,7 +15,7 @@ open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.disjunction open import foundation.double-negation -open import foundation.double-negation-elimination +open import logic.double-negation-elimination open import foundation.embeddings open import foundation.empty-types open import foundation.equivalences diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md index 875b3d8fee..c674c80b54 100644 --- a/src/foundation/irrefutable-propositions.lagda.md +++ b/src/foundation/irrefutable-propositions.lagda.md @@ -12,10 +12,10 @@ open import foundation.decidable-propositions open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation -open import foundation.double-negation-elimination +open import logic.double-negation-elimination +open import foundation.empty-types open import foundation.function-types open import foundation.negation -open import foundation.empty-types open import foundation.subuniverses open import foundation.unit-type open import foundation.universe-levels diff --git a/src/logic.lagda.md b/src/logic.lagda.md new file mode 100644 index 0000000000..dbb07fff57 --- /dev/null +++ b/src/logic.lagda.md @@ -0,0 +1,12 @@ +# Logic + +```agda +module logic where + +open import logic.de-morgan-sheaves public +open import logic.de-morgan-types public +open import logic.de-morgans-law public +open import logic.double-negation-eliminating-maps public +open import logic.double-negation-stable-embeddings public +open import logic.double-negation-stable-subtypes public +``` diff --git a/src/logic/de-morgan-sheaves.lagda.md b/src/logic/de-morgan-sheaves.lagda.md index 68a208c7e9..338572598e 100644 --- a/src/logic/de-morgan-sheaves.lagda.md +++ b/src/logic/de-morgan-sheaves.lagda.md @@ -8,9 +8,8 @@ module logic.de-morgan-sheaves where ```agda open import foundation.contractible-types -open import foundation.dependent-pair-types -open import logic.de-morgans-law open import foundation.coproduct-types +open import foundation.dependent-pair-types open import foundation.double-negation open import foundation.empty-types open import foundation.irrefutable-propositions @@ -24,6 +23,8 @@ open import foundation-core.equivalences open import foundation-core.function-types open import foundation-core.propositions +open import logic.de-morgans-law + open import orthogonal-factorization-systems.null-types ``` diff --git a/src/logic/de-morgan-types.lagda.md b/src/logic/de-morgan-types.lagda.md index 2db2d36ac7..3ca194ed62 100644 --- a/src/logic/de-morgan-types.lagda.md +++ b/src/logic/de-morgan-types.lagda.md @@ -7,25 +7,26 @@ module logic.de-morgan-propositions where
Imports ```agda +open import foundation.cartesian-product-types +open import foundation.conjunction +open import foundation.coproduct-types open import foundation.decidable-types open import foundation.dependent-pair-types -open import foundation.cartesian-product-types -open import foundation.universe-levels -open import logic.de-morgans-law - -open import foundation-core.decidable-propositions -open import foundation.negation -open import foundation.logical-equivalences -open import foundation.propositional-truncations +open import foundation.disjunction open import foundation.double-negation -open import foundation.conjunction -open import foundation.evaluation-functions open import foundation.empty-types -open import foundation.disjunction +open import foundation.evaluation-functions open import foundation.function-types -open import foundation.coproduct-types +open import foundation.logical-equivalences +open import foundation.negation +open import foundation.propositional-truncations +open import foundation.universe-levels + +open import foundation-core.decidable-propositions open import foundation-core.propositions +open import logic.de-morgans-law + open import univalent-combinatorics.2-element-types ``` diff --git a/src/logic/de-morgans-law.lagda.md b/src/logic/de-morgans-law.lagda.md index 24f9548bdc..11b08f7d10 100644 --- a/src/logic/de-morgans-law.lagda.md +++ b/src/logic/de-morgans-law.lagda.md @@ -7,21 +7,21 @@ module logic.de-morgans-law where
Imports ```agda +open import foundation.cartesian-product-types +open import foundation.conjunction +open import foundation.coproduct-types open import foundation.decidable-types open import foundation.dependent-pair-types -open import foundation.cartesian-product-types -open import foundation.universe-levels - -open import foundation-core.decidable-propositions -open import foundation.negation -open import foundation.logical-equivalences +open import foundation.disjunction open import foundation.double-negation -open import foundation.conjunction open import foundation.empty-types open import foundation.evaluation-functions -open import foundation.disjunction open import foundation.function-types -open import foundation.coproduct-types +open import foundation.logical-equivalences +open import foundation.negation +open import foundation.universe-levels + +open import foundation-core.decidable-propositions open import foundation-core.propositions open import univalent-combinatorics.2-element-types diff --git a/src/logic/double-negation-eliminating-maps.lagda.md b/src/logic/double-negation-eliminating-maps.lagda.md index f84f14434d..4985effa73 100644 --- a/src/logic/double-negation-eliminating-maps.lagda.md +++ b/src/logic/double-negation-eliminating-maps.lagda.md @@ -15,7 +15,7 @@ open import foundation.decidable-maps open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation -open import foundation.double-negation-elimination +open import logic.double-negation-elimination open import foundation.empty-types open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-coproduct-types @@ -42,7 +42,7 @@ open import foundation-core.homotopies A [map](foundation-core.function-types.md) is said to be {{#concept "double negation eliminating" Disambiguation="map of types" Agda=is-double-negation-eliminating-map}} if its [fibers](foundation-core.fibers-of-maps.md) satisfy -[untruncated double negation elimination](foundation.double-negation-elimination.md). +[untruncated double negation elimination](logic.double-negation-elimination.md). I.e., for every `y : B`, if `fiber f y` is [irrefutable](foundation.irrefutable-propositions.md), then we do in fact have an element of the fiber `p : fiber f y`. In other words, double negation diff --git a/src/foundation/double-negation-elimination.lagda.md b/src/logic/double-negation-elimination.lagda.md similarity index 99% rename from src/foundation/double-negation-elimination.lagda.md rename to src/logic/double-negation-elimination.lagda.md index 7450d62f55..efcd51b62c 100644 --- a/src/foundation/double-negation-elimination.lagda.md +++ b/src/logic/double-negation-elimination.lagda.md @@ -1,19 +1,19 @@ # Double negation elimination ```agda -module foundation.double-negation-elimination where +module logic.double-negation-elimination where ```
Imports ```agda open import foundation.cartesian-product-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.coproduct-types open import foundation.evaluation-functions open import foundation.logical-equivalences open import foundation.negation diff --git a/src/logic/double-negation-stable-embeddings.lagda.md b/src/logic/double-negation-stable-embeddings.lagda.md index 1c788939a9..d30725fee5 100644 --- a/src/logic/double-negation-stable-embeddings.lagda.md +++ b/src/logic/double-negation-stable-embeddings.lagda.md @@ -14,8 +14,7 @@ open import foundation.decidable-maps open import foundation.decidable-propositions open import foundation.decidable-types open import foundation.dependent-pair-types -open import logic.double-negation-eliminating-maps -open import foundation.double-negation-elimination +open import logic.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.embeddings open import foundation.fibers-of-maps @@ -44,6 +43,8 @@ open import foundation-core.functoriality-dependent-pair-types open import foundation-core.homotopies open import foundation-core.injective-maps open import foundation-core.torsorial-type-families + +open import logic.double-negation-eliminating-maps ```
@@ -54,7 +55,7 @@ A [map](foundation-core.function-types.md) is said to be a {{#concept "double negation stable embedding" Disambiguation="of types" Agda=is-double-negation-stable-emb}} if it is an [embedding](foundation-core.embeddings.md) and its [fibers](foundation-core.fibers-of-maps.md) satisfy -[double negation elimination](foundation.double-negation-elimination.md). +[double negation elimination](logic.double-negation-elimination.md). Equivalently, a double negation stable embedding is a map whose fibers are [double negation stable propositions](foundation.double-negation-stable-propositions.md). diff --git a/src/logic/double-negation-stable-subtypes.lagda.md b/src/logic/double-negation-stable-subtypes.lagda.md index 3924f17a78..48406e7e81 100644 --- a/src/logic/double-negation-stable-subtypes.lagda.md +++ b/src/logic/double-negation-stable-subtypes.lagda.md @@ -10,9 +10,7 @@ module logic.double-negation-stable-subtypes where open import foundation.1-types open import foundation.coproduct-types open import foundation.dependent-pair-types -open import logic.double-negation-eliminating-maps -open import foundation.double-negation-elimination -open import logic.double-negation-stable-embeddings +open import logic.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.equality-dependent-function-types open import foundation.functoriality-cartesian-product-types @@ -36,6 +34,9 @@ open import foundation-core.propositions open import foundation-core.transport-along-identifications open import foundation-core.truncated-types open import foundation-core.truncation-levels + +open import logic.double-negation-eliminating-maps +open import logic.double-negation-stable-embeddings ```
diff --git a/src/order-theory/preorders.lagda.md b/src/order-theory/preorders.lagda.md index 31e2f27ef1..c2d973fd70 100644 --- a/src/order-theory/preorders.lagda.md +++ b/src/order-theory/preorders.lagda.md @@ -12,8 +12,8 @@ open import category-theory.precategories open import foundation.binary-relations open import foundation.cartesian-product-types open import foundation.dependent-pair-types -open import foundation.function-types open import foundation.equivalences +open import foundation.function-types open import foundation.identity-types open import foundation.negated-equality open import foundation.negation From 773cea5e59d4aec36aca149ccdcadc6578af4aab Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 25 Oct 2024 23:54:18 +0200 Subject: [PATCH 38/83] wip logic --- src/foundation.lagda.md | 2 +- ...cantor-schroder-bernstein-escardo.lagda.md | 203 ----------- ...ructive-cantor-schroder-bernstein.lagda.md | 321 ++++++++++++++++++ src/foundation/perfect-images.lagda.md | 5 +- src/logic/de-morgan-maps.lagda.md | 305 +++++++++++++++++ src/logic/de-morgan-sheaves.lagda.md | 60 +--- src/logic/de-morgan-types.lagda.md | 18 +- 7 files changed, 663 insertions(+), 251 deletions(-) delete mode 100644 src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md create mode 100644 src/foundation/constructive-cantor-schroder-bernstein.lagda.md create mode 100644 src/logic/de-morgan-maps.lagda.md diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 2d34361704..0743354919 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -135,7 +135,7 @@ open import foundation.discrete-types public open import foundation.disjunction public open import foundation.double-arrows public open import foundation.double-negation public -open import foundation.double-negation-elimination public +open import logic.double-negation-elimination public open import foundation.double-negation-modality public open import foundation.double-negation-stable-propositions public open import foundation.double-powersets public diff --git a/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md b/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md deleted file mode 100644 index a0e34024b5..0000000000 --- a/src/foundation/constructive-cantor-schroder-bernstein-escardo.lagda.md +++ /dev/null @@ -1,203 +0,0 @@ -# The constructive Cantor–Schröder–Bernstein-Escardó theorem - -```agda -module foundation.constructive-cantor-schroder-bernstein-escardo where -``` - -
Imports - -```agda -open import foundation.action-on-identifications-functions -open import foundation.complements-subtypes -open import foundation.decidable-embeddings -open import foundation.decidable-types -open import foundation.dependent-pair-types -open import foundation.double-negation-stable-embeddings -open import foundation.fixed-points-endofunctions -open import foundation.images-embeddings -open import foundation.injective-maps -open import foundation.negation -open import foundation.perfect-images -open import foundation.powersets -open import foundation.propositional-maps -open import foundation.propositional-resizing -open import foundation.split-surjective-maps -open import foundation.universe-levels - -open import foundation-core.coproduct-types -open import foundation-core.embeddings -open import foundation-core.empty-types -open import foundation-core.equivalences -open import foundation-core.fibers-of-maps -open import foundation-core.identity-types -open import foundation-core.sets - -open import order-theory.knaster-tarski-fixed-point-theorem -open import order-theory.opposite-large-posets -open import order-theory.order-preserving-maps-large-posets -open import order-theory.order-preserving-maps-posets -``` - -
- -## Idea - -The Cantor–Schröder–Bernstein-Escardó theorem asserts that, assuming -[the law of excluded middle](foundation.law-of-excluded-middle.md), every pair -of mutually [embedding](foundation-core.embeddings.md) types `f : X ↪ Y` and -`g : Y ↪ X` are equivalent. Here, we generalize this statement by dropping the -assumption of the law of excluded middle, and rather consider -[double negation stable embeddings](foundation.double-negation-stable-embeddings.md) -between `X` and `Y`. - -## Statement - -```agda -type-constructive-Cantor-Schröder-Bernstein-Escardó : - (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) -type-constructive-Cantor-Schröder-Bernstein-Escardó l1 l2 = - {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈ X) → X ≃ Y - -type-constructive-Cantor-Schröder-Bernstein-Escardó' : - (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) -type-constructive-Cantor-Schröder-Bernstein-Escardó' l1 l2 = - {X : UU l1} {Y : UU l2} → (X ↪¬¬ Y) → (Y ↪¬¬ X) → X ≃ Y -``` - -## Proof - -**Proof.** Let us begin by assuming we have two arbitrary embeddings `f : X ↪ Y` -and `g : Y ↪ X`. In general, these need not be equivalences, so we need to -construct a "correction" so that we are left with a pair of mutual inverses. - -We will proceed by finding a pair of subtypes that are left fixed by a roundtrip -around taking direct images of `f` and `g` and their complements. If we begin by -considering the entirety of `X` and taking its direct image under `f`, we are -left with a subtype of `Y` that need not be full. By translating to the -complement, we have a close measure of "everything that `f` does not hit. This -is what we need to correct for... - -```text - X Y - _______ _______ - / \ / \ - / \ / \ - | | f | | - | | --------> | f(X) | - |~~~~~~~~~~~| | | - | | g |~~~~~~~~~~~| <-?- Y\(f(X) ∪ Y\f(X)) - | g(Y\f(X)) | <-------- | | - | | | Y\f(X) | - \ / \ / - \_______/ \_______/ -``` - -appropriate fixed point theorems, such as the Knaster–Tarski fixed point -theorem, or Adamek's fixed point theorem?, says that at some point this -operation stabilizes, giving us a subtype `S ⊆ X` such that - -```text - X\g(Y\f(S)) = S. -``` - -```text - X Y - _______ _______ - / \ / f(S) \ - / \ /~~~~~~~~~\ <--- "Y\(f(S) ∪ Y\f(S))" - | | f | | - | | --------> | | - | | | | - | | g | | - | | <-------- | | - | | | | - \~~~~~~~~~/ \ / - \___S___/ \_______/ -``` - -Dually, we also have a least fixed point `T` of the endooperator - -```text - B ↦ Y\(f(X\g(B))) -``` - -But this gives us two further fixed points: that satisfies `g(Y\f(T)) = Y\T`. - -```text - Y\f(X\g(Y\f(S))) = Y\f(S) and X\g(Y\f(X\g(T))) = X\g(T) -``` - -So if `S` and `T` are greatest fixed points, we have - -```text - X\g(T) ⊆ S and Y\f(S) ⊆ T -``` - -If `g` is double negation stable we also have the equality - -```text - g(Y\f(S)) = X\S. -``` - -This gives us an inverse map `g⁻¹ : X\S → Y` and similarly there is an inverse -map `f⁻¹ : Y\T → X`. Now, if `S` and `f(S)` were decidable subtypes, we could -define a new total map `h : X → Y` by - -```text - h(x) = f (x) if x ∈ S - h(x) = g⁻¹(x) if x ∉ S -``` - -and a converse map - -```text - h'(x) = f⁻¹(x) if x ∈ f(S) - h'(x) = g (x) if x ∉ f(S). -``` - -Clearly, this gives a pair of mutually inverse maps. - -Here we're not using the existence of `T` at all, nor that `S` is a greatest -fixed point or that `g` satisfies any decidability property. - -```agda -module _ - {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) - where - - hom-half-way-powerset-Cantor-Schröder-Bernstein-Escardó : - hom-Large-Poset (λ l → l2 ⊔ l1 ⊔ l) - ( powerset-Large-Poset X) - ( opposite-Large-Poset (powerset-Large-Poset Y)) - hom-half-way-powerset-Cantor-Schröder-Bernstein-Escardó = - comp-hom-Large-Poset - ( powerset-Large-Poset X) - ( powerset-Large-Poset Y) - ( opposite-Large-Poset (powerset-Large-Poset Y)) - ( neg-hom-powerset) - ( direct-image-hom-emb-powerset f) - -module _ - {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) - where - - hom-powerset-Cantor-Schröder-Bernstein-Escardó : - hom-Large-Poset - ( λ l3 → l1 ⊔ l2 ⊔ l3) - ( powerset-Large-Poset X) - ( powerset-Large-Poset X) - hom-powerset-Cantor-Schröder-Bernstein-Escardó = - comp-hom-Large-Poset - ( powerset-Large-Poset X) - ( opposite-Large-Poset (powerset-Large-Poset Y)) - ( powerset-Large-Poset X) - ( opposite-hom-Large-Poset - { P = powerset-Large-Poset Y} - { opposite-Large-Poset (powerset-Large-Poset X)} - ( hom-half-way-powerset-Cantor-Schröder-Bernstein-Escardó g)) - ( hom-half-way-powerset-Cantor-Schröder-Bernstein-Escardó f) -``` - -### Impredicative proof using the Knaster–Tarski fixed point theorem - -TODO diff --git a/src/foundation/constructive-cantor-schroder-bernstein.lagda.md b/src/foundation/constructive-cantor-schroder-bernstein.lagda.md new file mode 100644 index 0000000000..e6e918f087 --- /dev/null +++ b/src/foundation/constructive-cantor-schroder-bernstein.lagda.md @@ -0,0 +1,321 @@ +# The constructive Cantor–Schröder–Bernstein theorem + +```agda +{-# OPTIONS --allow-unsolved-metas #-} +module foundation.constructive-cantor-schroder-bernstein where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.complements-subtypes +open import foundation.decidable-embeddings +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import logic.double-negation-stable-embeddings +open import foundation.fixed-points-endofunctions +open import foundation.images-embeddings +open import foundation.injective-maps +open import foundation.negation +open import foundation.perfect-images +open import foundation.powersets +open import foundation.propositional-maps +open import foundation.propositional-resizing +open import foundation.split-surjective-maps +open import foundation.universe-levels + +open import foundation-core.coproduct-types +open import foundation-core.embeddings +open import foundation-core.empty-types +open import foundation-core.equivalences +open import foundation-core.fibers-of-maps +open import foundation-core.identity-types +open import foundation-core.sets + +open import order-theory.knaster-tarski-fixed-point-theorem +open import order-theory.opposite-large-posets +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.suplattices +open import order-theory.inflattices +``` + +
+ +## Idea + +The Cantor–Schröder–Bernstein theorem asserts that, assuming +[the law of excluded middle](foundation.law-of-excluded-middle.md), every pair +of mutually [embedding](foundation-core.embeddings.md) types `f : X ↪ Y` and +`g : Y ↪ X` are equivalent. Here, we generalize this statement by dropping the +assumption of the law of excluded middle, and rather considering embeddings that +satisfy certain classicality assumptions. + +## Statement + +```agda +type-constructive-Cantor-Schröder-Bernstein : + (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) +type-constructive-Cantor-Schröder-Bernstein l1 l2 = + {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈ X) → X ≃ Y + +-- type-constructive-Cantor-Schröder-Bernstein' : +-- (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) +-- type-constructive-Cantor-Schröder-Bernstein' l1 l2 = +-- {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈᵐ X) → X ≃ Y +``` + +## Proof + +**Proof.** Let us begin by assuming we have two arbitrary embeddings `f : X ↪ Y` +and `g : Y ↪ X`. In general, these need not be equivalences, so we need to find +a "correction" so that we are left with a pair of mutual inverses. + +We will proceed by finding a pair of subtypes that are left fixed by a roundtrip +around taking direct images of `f` and `g` and their complements. + +If we begin by considering the entirety of `X` and taking its direct image under +`f`, we are left with a subtype of `Y` that need not be full. By translating to +the complement, we have a measure of "everything that `f` does not hit". +`Y\f(X)`. + +```text + X Y + _______ _______ + / \ / \ + / \ / \ + | | f | | + | | --------> | f(X) | + |~~~~~~~~~~~| | | + | | g |~~~~~~~~~~~| <-?- Y\(f(X) ∪ Y\f(X)) + | g(Y\f(X)) | <-------- | | + | | | Y\f(X) | + \ / \ / + \_______/ \_______/ +``` + +Using an appropriate fixed point theorem, such as the Knaster–Tarski fixed point +theorem, or Kleene's fixed point theorem, we may deduce that at some point this +operation stabilizes, giving us a subtype `S ⊆ X` such that + +```text + X\g(Y\f(S)) = S. +``` + +```text + X Y + _______ _______ + / \ / f(S) \ + / \ /~~~~~~~~~\ <--- "Y\(f(S) ∪ Y\f(S))" + | | f | | + | | --------> | | + | | | | + | | g | | + | | <-------- | | + | | | | + \~~~~~~~~~/ \ / + \___S___/ \_______/ +``` + +Dually, we also have a least fixed point `T` of the endooperator + +```text + B ↦ Y\(f(X\g(B))) +``` + +But this gives us two further fixed points + +```text + Y\f(X\g(Y\f(S))) = Y\f(S) and X\g(Y\f(X\g(T))) = X\g(T) +``` + +So if `S` and `T` are greatest fixed points, we have + +```text + X\g(T) ⊆ S and Y\f(S) ⊆ T +``` + +If `g` is double negation stable we also have the equality + +```text + g(Y\f(S)) = X\S. +``` + +This gives us an inverse map `g⁻¹ : X\S → Y` and similarly there is an inverse +map `f⁻¹ : Y\T → X`. Now, if `S` and `f(S)` were decidable subtypes, we could +define a new total map `h : X → Y` by + +```text + h(x) = f (x) if x ∈ S + h(x) = g⁻¹(x) if x ∉ S +``` + +and a converse map + +```text + h'(x) = f⁻¹(x) if x ∈ f(S) + h'(x) = g (x) if x ∉ f(S). +``` + +Clearly, this gives a pair of mutually inverse maps. + +Here we're not using the existence of `T` at all, nor that `S` is a greatest +fixed point or that `g` satisfies decidability, only double negation stability. + +```agda + + +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) + where + + hom-half-way-powerset-Cantor-Schröder-Bernstein : + hom-Large-Poset (λ l3 → l1 ⊔ l2 ⊔ l3) + ( powerset-Large-Poset X) + ( opposite-Large-Poset (powerset-Large-Poset Y)) + hom-half-way-powerset-Cantor-Schröder-Bernstein = + comp-hom-Large-Poset + ( powerset-Large-Poset X) + ( powerset-Large-Poset Y) + ( opposite-Large-Poset (powerset-Large-Poset Y)) + ( neg-hom-powerset) + ( direct-image-hom-emb-powerset f) + +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) + where + + hom-powerset-Cantor-Schröder-Bernstein : + hom-Large-Poset + ( λ l3 → l1 ⊔ l2 ⊔ l3) + ( powerset-Large-Poset X) + ( powerset-Large-Poset X) + hom-powerset-Cantor-Schröder-Bernstein = + comp-hom-Large-Poset + ( powerset-Large-Poset X) + ( opposite-Large-Poset (powerset-Large-Poset Y)) + ( powerset-Large-Poset X) + ( opposite-hom-Large-Poset + { P = powerset-Large-Poset Y} + { opposite-Large-Poset (powerset-Large-Poset X)} + ( hom-half-way-powerset-Cantor-Schröder-Bernstein g)) + ( hom-half-way-powerset-Cantor-Schröder-Bernstein f) + + hom-small-powerset-Cantor-Schröder-Bernstein : + (l : Level) → + hom-Poset + ( powerset-Poset l X) + ( powerset-Poset (l1 ⊔ l2 ⊔ l) X) + hom-small-powerset-Cantor-Schröder-Bernstein = + hom-poset-hom-Large-Poset + ( powerset-Large-Poset X) + ( powerset-Large-Poset X) + ( hom-powerset-Cantor-Schröder-Bernstein) + +``` + +### Impredicative proof using the Knaster–Tarski fixed point theorem + +```text +module _ + {l1 l2 : Level} (resize-prop : propositional-resizing (l1 ⊔ l2) (l1 ⊔ l2)) + {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) + where + + fixed-point-domain-Cantor-Schröder-Bernstein : + fixed-point {! !} + -- ( map-hom-Poset + -- ( powerset-Poset (l1 ⊔ l2) X) + -- ( powerset-Poset (l1 ⊔ l2) X) + -- ( hom-small-powerset-Cantor-Schröder-Bernstein f g (l1 ⊔ l2))) + fixed-point-domain-Cantor-Schröder-Bernstein = + fixed-point-knaster-tarski-Suplattice + ( resize-type-Suplattice (powerset-Suplattice X {! !} {! !}) {! !}) {! !} {! !} +``` + +Since the fixed point is an image of `g` by double negation stability, it must +be decidable. + +```text +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪¬¬ X) + (S : + fixed-point + ( map-hom-Poset + ( powerset-Poset (l1 ⊔ l2) X) + ( powerset-Poset (l1 ⊔ l2) X) + ( hom-small-powerset-Cantor-Schröder-Bernstein f g (l1 ⊔ l2)))) + where + + is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein : + is-decidable-subtype S + + map-impredicative-Cantor-Schröder-Bernstein : X → Y +``` + +We can define mutual inverse maps from the given fixed point. For the inverse +map we need decidability of `f`. + +```text +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ᵈ Y) (g : Y ↪¬¬ X) + (S : + fixed-point + ( map-hom-Poset + ( powerset-Poset (l1 ⊔ l2) X) + ( powerset-Poset (l1 ⊔ l2) X) + ( hom-small-powerset-Cantor-Schröder-Bernstein f g (l1 ⊔ l2)))) + where + + + map-inv-impredicative-Cantor-Schröder-Bernstein : Y → X + + is-section-map-inv-impredicative-Cantor-Schröder-Bernstein : + is-section + map-impredicative-Cantor-Schröder-Bernstein + map-inv-impredicative-Cantor-Schröder-Bernstein + + is-retraction-map-inv-impredicative-Cantor-Schröder-Bernstein : + is-retraction + map-impredicative-Cantor-Schröder-Bernstein + map-inv-impredicative-Cantor-Schröder-Bernstein + + is-equiv-map-impredicative-Cantor-Schröder-Bernstein : + is-equiv map-impredicative-Cantor-Schröder-Bernstein + is-equiv-map-impredicative-Cantor-Schröder-Bernstein = + is-equiv-is-invertible + map-inv-impredicative-Cantor-Schröder-Bernstein + is-section-map-inv-impredicative-Cantor-Schröder-Bernstein + is-retraction-map-inv-impredicative-Cantor-Schröder-Bernstein +``` + +### Proof using Kleene's fixed point theorem + +Assuming that `g` is a De Morgan embedding, the operator +`¬X\g(Y\f(-)) : 𝒫(X) → 𝒫(X)` is Scott continuous: + +```text + X\g(Y\f(⋃ᵢUᵢ)) = X\g(Y\(⋃ᵢfᵢ(Uᵢ))) unions commute with images + = X\g(⋂ᵢY\f(Uᵢ)) constructively valid De Morgan law + = X\(⋂ᵢg(Y\f(Uᵢ))) meets commute with images + = ⋃ᵢ(X\g(Y\f(Uᵢ))) g is De Morgan +``` + +Kleene's fixed point theorem then states that, given a starting point +`U : 𝒫(X)`, the sequence + +```text + ⋃(n : ℕ), (X\gY\f)ⁿ(U) +``` + +converges to a fixed point `S` of the operator. + +Now, again since `g` is De Morgan, every subtype of `Y` gives a decomposition of +`X`, in particular, applying it to `S`: + +```text + X ≅ X\g(Y\f(S)) ∪ X\X\g(Y\f(S)) = S ∪ X\S. +``` + +In other words, `S` is a decidable subtype of `X`. diff --git a/src/foundation/perfect-images.lagda.md b/src/foundation/perfect-images.lagda.md index ca725894c9..73c52d102a 100644 --- a/src/foundation/perfect-images.lagda.md +++ b/src/foundation/perfect-images.lagda.md @@ -14,8 +14,7 @@ open import foundation.decidable-maps open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation -open import logic.double-negation-eliminating-maps -open import foundation.double-negation-elimination +open import logic.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.functoriality-dependent-function-types open import foundation.iterated-dependent-product-types @@ -39,6 +38,8 @@ open import foundation-core.injective-maps open import foundation-core.propositional-maps open import foundation-core.propositions open import foundation-core.transport-along-identifications + +open import logic.double-negation-eliminating-maps ```
diff --git a/src/logic/de-morgan-maps.lagda.md b/src/logic/de-morgan-maps.lagda.md new file mode 100644 index 0000000000..303d5974f9 --- /dev/null +++ b/src/logic/de-morgan-maps.lagda.md @@ -0,0 +1,305 @@ +# De Morgan maps + +```agda +module logic.de-morgan-maps where +``` + +
Imports + +```agda +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.negation +open import logic.de-morgan-types +open import foundation.universal-property-equivalences +open import foundation.dependent-pair-types +open import foundation.double-negation +open import logic.double-negation-elimination +open import foundation.empty-types +open import foundation.functoriality-cartesian-product-types +open import foundation.functoriality-coproduct-types +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 + +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.functoriality-dependent-pair-types +open import foundation-core.homotopies +``` + +
+ +## Idea + +A [map](foundation-core.function-types.md) is said to be +{{#concept "De Morgan" Disambiguation="map of types" Agda=is-de-morgan-map}} if +the [negation](foundation-core.negation.md) of its +[fibers](foundation-core.fibers-of-maps.md) are +[decidable](foundation.decidable-types.md). I.e., for every `y : B`, if +`fiber f y` is either [empty](foundation.empty-types.md) or +[irrefutable](foundation.irrefutable-propositions.md). + +## Definintion + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-de-morgan-map : (A → B) → UU (l1 ⊔ l2) + is-de-morgan-map f = + (y : B) → is-decidable (¬ (fiber f y)) +``` + +## Properties + +### De Morgan maps are closed under homotopy + +```agda +abstract + is-de-morgan-map-htpy : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} → + f ~ g → + is-de-morgan-map g → + is-de-morgan-map f + is-de-morgan-map-htpy H K b = + is-decidable-equiv' + ( equiv-precomp (equiv-tot (λ a → equiv-concat (inv (H a)) b)) empty) + ( K b) +``` + +### Decidable maps are De Morgan + +```agda +is-de-morgan-map-is-decidable-map : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-decidable-map f → is-de-morgan-map f +is-de-morgan-map-is-decidable-map H y = is-decidable-neg-is-decidable (H y) +``` + +### Composition of De Morgan maps + +Given a composition `g ∘ f` of De Morgan maps where the left factor `g` is +injective, then the composition is De Morgan. + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {g : B → C} {f : A → B} + where + + -- fiber-left-is-de-morgan-map-left : + -- is-de-morgan-map g → + -- (z : C) → ¬¬ (fiber (g ∘ f) z) → fiber g z + -- fiber-left-is-de-morgan-map-left G z nngfz = ? + -- -- G z (λ x → nngfz (λ w → x (f (pr1 w) , pr2 w))) + + -- fiber-right-is-de-morgan-map-comp : + -- is-injective g → + -- (G : is-de-morgan-map g) → + -- is-de-morgan-map f → + -- (z : C) (nngfz : ¬¬ (fiber (g ∘ f) z)) → + -- fiber f (pr1 (fiber-left-is-de-morgan-map-left G z nngfz)) + -- fiber-right-is-de-morgan-map-comp H G F z nngfz = + -- F ( pr1 + -- ( fiber-left-is-de-morgan-map-left G z nngfz)) + -- ( λ x → + -- nngfz + -- ( λ w → + -- x ( pr1 w , + -- H ( pr2 w ∙ + -- inv + -- ( pr2 + -- ( fiber-left-is-de-morgan-map-left + -- G z nngfz)))))) + + is-de-morgan-map-comp : + is-injective g → + is-de-morgan-map g → + is-de-morgan-map f → + is-de-morgan-map (g ∘ f) + is-de-morgan-map-comp H G F z = {! !} + -- map-inv-compute-fiber-comp g f z + -- ( ( fiber-left-is-de-morgan-map-left G z nngfz) , + -- ( fiber-right-is-de-morgan-map-comp H G F z nngfz)) +``` + +### Left cancellation for De Morgan maps + +If a composite `g ∘ f` is De Morgan and the left factor `g` is injective, then +the right factor `f` is De Morgan. + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} + (GF : is-de-morgan-map (g ∘ f)) + where + + fiber-comp-is-de-morgan-map-right-factor' : + (y : B) → ¬¬ (fiber f y) → Σ (fiber g (g y)) (λ t → fiber f (pr1 t)) + fiber-comp-is-de-morgan-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)))) + + is-de-morgan-map-right-factor' : + is-injective g → is-de-morgan-map f + is-de-morgan-map-right-factor' G y nnfy = + tr + ( fiber f) + ( G ( pr2 + ( pr1 + ( fiber-comp-is-de-morgan-map-right-factor' + ( y) + ( nnfy))))) + ( pr2 + ( fiber-comp-is-de-morgan-map-right-factor' y nnfy)) +``` + +### Any map out of the empty type is De Morgan + +```text +abstract + is-de-morgan-map-ex-falso : + {l : Level} {X : UU l} → + is-de-morgan-map (ex-falso {l} {X}) + is-de-morgan-map-ex-falso x f = ex-falso (f λ ()) +``` + +### The identity map is De Morgan + +```text +abstract + is-de-morgan-map-id : + {l : Level} {X : UU l} → is-de-morgan-map (id {l} {X}) + is-de-morgan-map-id x y = (x , refl) +``` + +### Equivalences are De Morgan maps + +```text +abstract + is-de-morgan-map-is-equiv : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-equiv f → is-de-morgan-map f + is-de-morgan-map-is-equiv H x = + double-negation-elim-is-contr (is-contr-map-is-equiv H x) +``` + +### The map on total spaces induced by a family of De Morgan maps is De Morgan + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} + where + + is-de-morgan-map-tot : + {f : (x : A) → B x → C x} → + ((x : A) → is-de-morgan-map (f x)) → + is-de-morgan-map (tot f) + is-de-morgan-map-tot {f} H x = + has-double-negation-elim-equiv (compute-fiber-tot f x) (H (pr1 x) (pr2 x)) +``` + +### The map on total spaces induced by a De Morgan map on the base is De Morgan + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) + where + + is-de-morgan-map-Σ-map-base : + {f : A → B} → + is-de-morgan-map f → + is-de-morgan-map (map-Σ-map-base f C) + is-de-morgan-map-Σ-map-base {f} H x = + has-double-negation-elim-equiv' + ( compute-fiber-map-Σ-map-base f C x) + ( H (pr1 x)) +``` + +### Products of De Morgan maps are De Morgan + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-de-morgan-map-product : + {f : A → B} {g : C → D} → + is-de-morgan-map f → + is-de-morgan-map g → + is-de-morgan-map (map-product f g) + is-de-morgan-map-product {f} {g} F G x = + has-double-negation-elim-equiv + ( compute-fiber-map-product f g x) + ( double-negation-elim-product (F (pr1 x)) (G (pr2 x))) +``` + +### Coproducts of De Morgan maps are De Morgan + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-de-morgan-map-coproduct : + {f : A → B} {g : C → D} → + is-de-morgan-map f → + is-de-morgan-map g → + is-de-morgan-map (map-coproduct f g) + is-de-morgan-map-coproduct {f} {g} F G (inl x) = + has-double-negation-elim-equiv' + ( compute-fiber-inl-map-coproduct f g x) + ( F x) + is-de-morgan-map-coproduct {f} {g} F G (inr y) = + has-double-negation-elim-equiv' + ( compute-fiber-inr-map-coproduct f g y) + ( G y) +``` + +### De Morgan maps are closed under base change + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + {f : A → B} {g : C → D} + where + + is-de-morgan-map-base-change : + cartesian-hom-arrow g f → + is-de-morgan-map f → + is-de-morgan-map g + is-de-morgan-map-base-change α F d = + has-double-negation-elim-equiv + ( equiv-fibers-cartesian-hom-arrow g f α d) + ( F (map-codomain-cartesian-hom-arrow g f α d)) +``` + +### De Morgan maps are closed under retracts of maps + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} + {f : A → B} {g : X → Y} + where + + is-de-morgan-retract-map : + f retract-of-map g → + is-de-morgan-map g → + is-de-morgan-map f + is-de-morgan-retract-map R G x = + has-double-negation-elim-retract + ( retract-fiber-retract-map f g R x) + ( G (map-codomain-inclusion-retract-map f g R x)) +``` diff --git a/src/logic/de-morgan-sheaves.lagda.md b/src/logic/de-morgan-sheaves.lagda.md index 338572598e..5674030c6a 100644 --- a/src/logic/de-morgan-sheaves.lagda.md +++ b/src/logic/de-morgan-sheaves.lagda.md @@ -12,6 +12,7 @@ open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.double-negation open import foundation.empty-types +open import foundation.decidable-types open import foundation.irrefutable-propositions open import foundation.logical-equivalences open import foundation.negation @@ -34,7 +35,7 @@ open import orthogonal-factorization-systems.null-types {{#concept "De morgan sheaves" Agda=is-de-morgan-sheaf}} are types that are [null](orthogonal-factorization-systems.null-types.md) at propositions of the -form `¬ P ∨ ¬¬ P`. +form `¬P ∨ ¬¬P`. De Morgan sheaves are closely related to, but a strictly weaker notion than that of @@ -48,20 +49,22 @@ of is-de-morgan-sheaf : (l1 : Level) {l2 : Level} (A : UU l2) → UU (lsuc l1 ⊔ l2) is-de-morgan-sheaf l1 A = - (P : Prop l1) → is-null (is-decidable (¬ P)) A + (P : UU l1) → is-null (is-decidable (¬ P)) A is-prop-is-de-morgan-sheaf : {l1 l2 : Level} {A : UU l2} → is-prop (is-de-morgan-sheaf l1 A) is-prop-is-de-morgan-sheaf {A = A} = - is-prop-Π (λ P → is-prop-is-null (type-Irrefutable-Prop P) A) + is-prop-Π (λ P → is-prop-is-null (is-decidable (¬ P)) A) ``` ## Properties ### A type is a De Morgan sheaf if and only if it is local at the De Morgan implication -A type null at `¬P ∨ ¬¬ P` for all propositions `P` if and only if it is local -at `(¬ P ∨ ¬ Q) ⇒ ¬ (P ∧ Q)` for all propositions `P` and `Q`. +A type is null at `¬P ∨ ¬¬ P` for all types `P` if and only if it is local at +`(¬ P ∨ ¬ Q) ⇒ ¬ (P ∧ Q)` for all types `P` and `Q`. + +> TODO ### The empty type is a De Morgan sheaf @@ -70,8 +73,8 @@ is-de-morgan-sheaf-empty : {l : Level} → is-de-morgan-sheaf l empty is-de-morgan-sheaf-empty P = is-equiv-has-converse empty-Prop - ( hom-Prop (prop-Irrefutable-Prop P) empty-Prop) - ( is-irrefutable-Irrefutable-Prop P) + ( neg-type-Prop (is-decidable (¬ P))) + ( is-irrefutable-is-decidable) ``` ### Contractible types are De Morgan sheaves @@ -80,49 +83,20 @@ is-de-morgan-sheaf-empty P = is-de-morgan-sheaf-is-contr : {l1 l2 : Level} {A : UU l1} → is-contr A → is-de-morgan-sheaf l2 A is-de-morgan-sheaf-is-contr is-contr-A P = - is-null-is-contr (type-Irrefutable-Prop P) is-contr-A -``` - -### Propositions that are De Morgan sheaves are De Morgan - -```agda -module _ - {l : Level} {A : UU l} - (is-prop-A : is-prop A) - (is-¬¬sheaf-A : is-de-morgan-sheaf l A) - where - - -- compute-is-de-morgan-sheaf-is-prop : A ≃ (¬ A → A) - -- compute-is-de-morgan-sheaf-is-prop = - -- ( left-unit-law-product-is-contr - -- ( is-proof-irrelevant-is-prop (is-prop-function-type is-prop-A) id)) ∘e - -- ( equiv-universal-property-coproduct A) ∘e - -- ( _ , is-¬¬sheaf-A (is-decidable-prop-Irrefutable-Prop (A , is-prop-A))) - - -- is-de-morgan-stable-is-de-morgan-sheaf-is-prop : - -- is-de-morgan-stable (A , is-prop-A) - -- is-de-morgan-stable-is-de-morgan-sheaf-is-prop ¬¬a = - -- map-inv-is-equiv (is-¬¬sheaf-A (A , is-prop-A , ¬¬a)) id + is-null-is-contr (is-decidable (¬ P)) is-contr-A ``` -### Double negation stable propositions are De Morgan sheaves - -This follows from the fact that a proposition `P` is double negation stable if -and only if it is local at all double negations - -```text - (¬¬A → P) → (A → P), -``` +### Double negation sheaves are De Morgan sheaves -and nullification at irrefutable propositions is a restriction of this. +> TODO -> This remains to be formalized. +### Types that are De Morgan sheaves are De Morgan -### The negation of a type is a De Morgan sheaf +> TODO -This is a corollary of the previous result. +### De Morgan types are De Morgan sheaves -> This remains to be formalized. +> TODO ## References diff --git a/src/logic/de-morgan-types.lagda.md b/src/logic/de-morgan-types.lagda.md index 3ca194ed62..a4857dae1d 100644 --- a/src/logic/de-morgan-types.lagda.md +++ b/src/logic/de-morgan-types.lagda.md @@ -1,7 +1,7 @@ -# De Morgan propositions +# De Morgan types ```agda -module logic.de-morgan-propositions where +module logic.de-morgan-types where ```
Imports @@ -149,6 +149,20 @@ is-de-morgan-is-decidable-neg x B q = unit-trunc-Prop (is-de-morgan-is-decidable-neg-left x q) ``` +### Decidable types are De Morgan + +```agda +is-decidable-neg-is-decidable : + {l : Level} {A : UU l} → is-decidable A → is-decidable (¬ A) +is-decidable-neg-is-decidable (inl x) = inr (intro-double-negation x) +is-decidable-neg-is-decidable (inr x) = inl x + +is-de-morgan-is-decidable : + {l : Level} {A : UU l} → is-decidable A → is-de-morgan-type A +is-de-morgan-is-decidable H = + is-de-morgan-is-decidable-neg (is-decidable-neg-is-decidable H) +``` + ## External links - [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) From 37fc00e88555b232b5e707be888f5ce2f5c15620 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 27 Oct 2024 16:10:24 +0100 Subject: [PATCH 39/83] dcpos --- src/domain-theory.lagda.md | 7 + .../directed-complete-posets.lagda.md | 172 ++++++++++++++++++ src/logic.lagda.md | 2 + 3 files changed, 181 insertions(+) create mode 100644 src/domain-theory.lagda.md create mode 100644 src/domain-theory/directed-complete-posets.lagda.md diff --git a/src/domain-theory.lagda.md b/src/domain-theory.lagda.md new file mode 100644 index 0000000000..049ed9a726 --- /dev/null +++ b/src/domain-theory.lagda.md @@ -0,0 +1,7 @@ +# Domain theory + +```agda +module domain-theory where + +open import domain-theory.directed-complete-posets public +``` diff --git a/src/domain-theory/directed-complete-posets.lagda.md b/src/domain-theory/directed-complete-posets.lagda.md new file mode 100644 index 0000000000..dcf3216dd9 --- /dev/null +++ b/src/domain-theory/directed-complete-posets.lagda.md @@ -0,0 +1,172 @@ +# Directed complete posets + +```agda +module domain-theory.directed-complete-posets where +``` + +
Imports + +```agda +open import foundation.binary-relations +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.logical-equivalences +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.directed-families +open import order-theory.least-upper-bounds-posets +open import order-theory.posets +``` + +
+ +## Idea + +A {{#concept "directed complete poset" Agda=Directed-Complete-Poset}} is a +[poset](order-theory.posets.md) such that all +[directed families](order-theory.directed-families.md) have +[least upper bounds](order-theory.least-upper-bounds-posets.md). + +## Definitions + +### The predicate on posets of being an directed complete poset + +```agda +module _ + {l1 l2 : Level} (l3 : Level) (P : Poset l1 l2) + where + + is-directed-complete-Poset-Prop : Prop (l1 ⊔ l2 ⊔ lsuc l3) + is-directed-complete-Poset-Prop = + Π-Prop + ( directed-family-Poset l3 P) + ( λ F → + has-least-upper-bound-family-of-elements-Poset-Prop P + ( family-directed-family-Poset P F)) + + is-directed-complete-Poset : UU (l1 ⊔ l2 ⊔ lsuc l3) + is-directed-complete-Poset = + type-Prop is-directed-complete-Poset-Prop + + is-prop-is-directed-complete-Poset : is-prop is-directed-complete-Poset + is-prop-is-directed-complete-Poset = + is-prop-type-Prop is-directed-complete-Poset-Prop + +module _ + {l1 l2 l3 : Level} (P : Poset l1 l2) (H : is-directed-complete-Poset l3 P) + where + + sup-is-directed-complete-Poset : directed-family-Poset l3 P → type-Poset P + sup-is-directed-complete-Poset F = pr1 (H F) + + is-least-upper-bound-sup-is-directed-complete-Poset : + (x : directed-family-Poset l3 P) → + is-least-upper-bound-family-of-elements-Poset P + ( family-directed-family-Poset P x) + ( sup-is-directed-complete-Poset x) + is-least-upper-bound-sup-is-directed-complete-Poset F = pr2 (H F) +``` + +### Suplattices + +```agda +Directed-Complete-Poset : + (l1 l2 l3 : Level) → UU (lsuc l1 ⊔ lsuc l2 ⊔ lsuc l3) +Directed-Complete-Poset l1 l2 l3 = + Σ (Poset l1 l2) (is-directed-complete-Poset l3) + +module _ + {l1 l2 l3 : Level} (A : Directed-Complete-Poset l1 l2 l3) + where + + poset-Directed-Complete-Poset : Poset l1 l2 + poset-Directed-Complete-Poset = pr1 A + + type-Directed-Complete-Poset : UU l1 + type-Directed-Complete-Poset = + type-Poset poset-Directed-Complete-Poset + + leq-prop-Directed-Complete-Poset : + (x y : type-Directed-Complete-Poset) → Prop l2 + leq-prop-Directed-Complete-Poset = + leq-prop-Poset poset-Directed-Complete-Poset + + leq-Directed-Complete-Poset : + (x y : type-Directed-Complete-Poset) → UU l2 + leq-Directed-Complete-Poset = + leq-Poset poset-Directed-Complete-Poset + + is-prop-leq-Directed-Complete-Poset : + (x y : type-Directed-Complete-Poset) → + is-prop (leq-Directed-Complete-Poset x y) + is-prop-leq-Directed-Complete-Poset = + is-prop-leq-Poset poset-Directed-Complete-Poset + + refl-leq-Directed-Complete-Poset : + (x : type-Directed-Complete-Poset) → + leq-Directed-Complete-Poset x x + refl-leq-Directed-Complete-Poset = + refl-leq-Poset poset-Directed-Complete-Poset + + antisymmetric-leq-Directed-Complete-Poset : + is-antisymmetric leq-Directed-Complete-Poset + antisymmetric-leq-Directed-Complete-Poset = + antisymmetric-leq-Poset poset-Directed-Complete-Poset + + transitive-leq-Directed-Complete-Poset : + is-transitive leq-Directed-Complete-Poset + transitive-leq-Directed-Complete-Poset = + transitive-leq-Poset poset-Directed-Complete-Poset + + is-set-type-Directed-Complete-Poset : + is-set type-Directed-Complete-Poset + is-set-type-Directed-Complete-Poset = + is-set-type-Poset poset-Directed-Complete-Poset + + set-Directed-Complete-Poset : Set l1 + set-Directed-Complete-Poset = + set-Poset poset-Directed-Complete-Poset + + is-directed-complete-Directed-Complete-Poset : + is-directed-complete-Poset l3 poset-Directed-Complete-Poset + is-directed-complete-Directed-Complete-Poset = pr2 A + + sup-Directed-Complete-Poset : + directed-family-Poset l3 poset-Directed-Complete-Poset → + type-Directed-Complete-Poset + sup-Directed-Complete-Poset = + sup-is-directed-complete-Poset + ( poset-Directed-Complete-Poset) + ( is-directed-complete-Directed-Complete-Poset) + + is-least-upper-bound-sup-Directed-Complete-Poset : + (x : directed-family-Poset l3 poset-Directed-Complete-Poset) → + is-least-upper-bound-family-of-elements-Poset + ( poset-Directed-Complete-Poset) + ( family-directed-family-Poset poset-Directed-Complete-Poset x) + ( sup-Directed-Complete-Poset x) + is-least-upper-bound-sup-Directed-Complete-Poset = + is-least-upper-bound-sup-is-directed-complete-Poset + ( poset-Directed-Complete-Poset) + ( is-directed-complete-Directed-Complete-Poset) + + leq-sup-Directed-Complete-Poset : + (x : directed-family-Poset l3 poset-Directed-Complete-Poset) + (i : type-directed-family-Poset poset-Directed-Complete-Poset x) → + leq-Directed-Complete-Poset + ( family-directed-family-Poset poset-Directed-Complete-Poset x i) + ( sup-Directed-Complete-Poset x) + leq-sup-Directed-Complete-Poset x = + backward-implication + ( is-least-upper-bound-sup-Directed-Complete-Poset + ( x) + ( sup-Directed-Complete-Poset x)) + ( refl-leq-Directed-Complete-Poset (sup-Directed-Complete-Poset x)) +``` + +## External links + +- [dcpo](https://ncatlab.org/nlab/show/dcpo) at $n$Lab diff --git a/src/logic.lagda.md b/src/logic.lagda.md index dbb07fff57..347f384dc2 100644 --- a/src/logic.lagda.md +++ b/src/logic.lagda.md @@ -3,10 +3,12 @@ ```agda module logic where +open import logic.de-morgan-maps public open import logic.de-morgan-sheaves public open import logic.de-morgan-types public open import logic.de-morgans-law 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 ``` From 7b208951edbc435d2e6db6ae722a05639185a8d8 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 29 Oct 2024 13:24:57 +0100 Subject: [PATCH 40/83] edits --- .../double-negation-stable-propositions.lagda.md | 3 ++- src/foundation/irrefutable-propositions.lagda.md | 3 ++- src/foundation/negation.lagda.md | 14 ++++++++++---- src/foundation/perfect-images.lagda.md | 2 +- src/logic/de-morgan-sheaves.lagda.md | 7 +++---- .../double-negation-eliminating-maps.lagda.md | 3 ++- src/order-theory/directed-families.lagda.md | 10 +++++++--- .../knaster-tarski-fixed-point-theorem.lagda.md | 2 +- 8 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/foundation/double-negation-stable-propositions.lagda.md b/src/foundation/double-negation-stable-propositions.lagda.md index d5490aab4b..b6d94ae237 100644 --- a/src/foundation/double-negation-stable-propositions.lagda.md +++ b/src/foundation/double-negation-stable-propositions.lagda.md @@ -15,7 +15,6 @@ open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.disjunction open import foundation.double-negation -open import logic.double-negation-elimination open import foundation.embeddings open import foundation.empty-types open import foundation.equivalences @@ -36,6 +35,8 @@ open import foundation-core.contractible-types open import foundation-core.function-types open import foundation-core.identity-types open import foundation-core.retracts-of-types + +open import logic.double-negation-elimination ```
diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md index c674c80b54..0e67931d37 100644 --- a/src/foundation/irrefutable-propositions.lagda.md +++ b/src/foundation/irrefutable-propositions.lagda.md @@ -12,7 +12,6 @@ open import foundation.decidable-propositions open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation -open import logic.double-negation-elimination open import foundation.empty-types open import foundation.function-types open import foundation.negation @@ -21,6 +20,8 @@ open import foundation.unit-type open import foundation.universe-levels open import foundation-core.propositions + +open import logic.double-negation-elimination ```
diff --git a/src/foundation/negation.lagda.md b/src/foundation/negation.lagda.md index 3a7b5044e1..69ed9babab 100644 --- a/src/foundation/negation.lagda.md +++ b/src/foundation/negation.lagda.md @@ -58,6 +58,15 @@ reductio-ad-absurdum : {l1 l2 : Level} {P : UU l1} {Q : UU l2} → P → ¬ P reductio-ad-absurdum p np = ex-falso (np p) ``` +### Logically equivalent types have logically equivalent negations + +```agda +iff-neg : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} → + (X ↔ Y) → (¬ X ↔ ¬ Y) +iff-neg e = (map-neg (backward-implication e) , map-neg (forward-implication e)) +``` + ### Equivalent types have equivalent negations ```agda @@ -65,10 +74,7 @@ equiv-neg : {l1 l2 : Level} {X : UU l1} {Y : UU l2} → (X ≃ Y) → (¬ X ≃ ¬ Y) equiv-neg {l1} {l2} {X} {Y} e = - equiv-iff' - ( neg-type-Prop X) - ( neg-type-Prop Y) - ( pair (map-neg (map-inv-equiv e)) (map-neg (map-equiv e))) + equiv-iff' (neg-type-Prop X) (neg-type-Prop Y) (iff-neg (iff-equiv e)) ``` ### Negation has no fixed points diff --git a/src/foundation/perfect-images.lagda.md b/src/foundation/perfect-images.lagda.md index 73c52d102a..bd8ed02235 100644 --- a/src/foundation/perfect-images.lagda.md +++ b/src/foundation/perfect-images.lagda.md @@ -14,7 +14,6 @@ open import foundation.decidable-maps open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation -open import logic.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.functoriality-dependent-function-types open import foundation.iterated-dependent-product-types @@ -40,6 +39,7 @@ open import foundation-core.propositions open import foundation-core.transport-along-identifications open import logic.double-negation-eliminating-maps +open import logic.double-negation-elimination ```
diff --git a/src/logic/de-morgan-sheaves.lagda.md b/src/logic/de-morgan-sheaves.lagda.md index 5674030c6a..5aabdd6239 100644 --- a/src/logic/de-morgan-sheaves.lagda.md +++ b/src/logic/de-morgan-sheaves.lagda.md @@ -9,10 +9,10 @@ module logic.de-morgan-sheaves where ```agda 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.decidable-types open import foundation.irrefutable-propositions open import foundation.logical-equivalences open import foundation.negation @@ -37,8 +37,7 @@ open import orthogonal-factorization-systems.null-types [null](orthogonal-factorization-systems.null-types.md) at propositions of the form `¬P ∨ ¬¬P`. -De Morgan sheaves are closely related to, but a strictly weaker notion than that -of +De Morgan sheaves are closely related to, but a strictly weaker notion than [double negation sheaves](orthogonal-factorization-systems.double-negation-sheaves.md). ## Definitions @@ -64,7 +63,7 @@ is-prop-is-de-morgan-sheaf {A = A} = A type is null at `¬P ∨ ¬¬ P` for all types `P` if and only if it is local at `(¬ P ∨ ¬ Q) ⇒ ¬ (P ∧ Q)` for all types `P` and `Q`. -> TODO +> TODO: check this ### The empty type is a De Morgan sheaf diff --git a/src/logic/double-negation-eliminating-maps.lagda.md b/src/logic/double-negation-eliminating-maps.lagda.md index 4985effa73..a0924afec0 100644 --- a/src/logic/double-negation-eliminating-maps.lagda.md +++ b/src/logic/double-negation-eliminating-maps.lagda.md @@ -15,7 +15,6 @@ open import foundation.decidable-maps open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation -open import logic.double-negation-elimination open import foundation.empty-types open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-coproduct-types @@ -33,6 +32,8 @@ 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 logic.double-negation-elimination ``` diff --git a/src/order-theory/directed-families.lagda.md b/src/order-theory/directed-families.lagda.md index c31b18247d..c012788258 100644 --- a/src/order-theory/directed-families.lagda.md +++ b/src/order-theory/directed-families.lagda.md @@ -23,9 +23,13 @@ open import order-theory.posets ## Idea -A **directed family of elements** in a poset `P` consists of an inhabited type -`I` and a map `x : I → P` such that for any two elements `i j : I` there exists -an element `k : I` such that both `x i ≤ x k` and `x j ≤ x k` hold. +A +{{#concept "directed family of elements" WD="upward directed set" WDID=Q1513048 Agda=directed-family-Poset}} +in a [poset](order-theory.posets.md) `P` consists of an +[inhabited type](foundation.inhabited-types.md) `I` and a map `x : I → P` such +that for any two elements `i j : I` there +[exists](foundaiton.existential-quantification.md) an element `k : I` such that +both `x i ≤ x k` and `x j ≤ x k` hold. ## Definition diff --git a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md index ca86fb2d71..3ec53b1556 100644 --- a/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md +++ b/src/order-theory/knaster-tarski-fixed-point-theorem.lagda.md @@ -28,7 +28,7 @@ The states that every order preserving endomap `f : 𝒜 → 𝒜` on a complete lattice has a least and a greatest [fixed point](foundation.fixed-points-endofunctions.md). Indeed, any order preserving endomap on a -[suplattice](order-theory.suplattices.md) has a greatest fixed point andany +[suplattice](order-theory.suplattices.md) has a greatest fixed point and any order preserving endomap on an [inflattice](order-theory.inflattices.md) has a least fixed point. From 654571bc79038f12bdedf019631f1e5c53a9da72 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 29 Oct 2024 21:42:55 +0100 Subject: [PATCH 41/83] composition of decidable maps --- src/foundation/decidable-embeddings.lagda.md | 30 +++++++++----------- src/foundation/decidable-maps.lagda.md | 25 ++++++++++++++++ 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/src/foundation/decidable-embeddings.lagda.md b/src/foundation/decidable-embeddings.lagda.md index f91407cc9b..f968a58978 100644 --- a/src/foundation/decidable-embeddings.lagda.md +++ b/src/foundation/decidable-embeddings.lagda.md @@ -65,16 +65,20 @@ is-decidable-emb : {l1 l2 : Level} {X : UU l1} {Y : UU l2} → (X → Y) → UU (l1 ⊔ l2) is-decidable-emb f = is-emb f × is-decidable-map f -abstract - is-emb-is-decidable-emb : - {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → - is-decidable-emb f → is-emb f - is-emb-is-decidable-emb = pr1 +is-emb-is-decidable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → + is-decidable-emb f → is-emb f +is-emb-is-decidable-emb = pr1 is-decidable-map-is-decidable-emb : {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → is-decidable-emb f → is-decidable-map f is-decidable-map-is-decidable-emb = pr2 + +is-injective-is-decidable-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} → + is-decidable-emb f → is-injective f +is-injective-is-decidable-emb = is-injective-is-emb ∘ is-emb-is-decidable-emb ``` ### Decidably propositional maps @@ -260,18 +264,10 @@ module _ abstract is-decidable-map-comp-is-decidable-emb' : is-decidable-emb g → is-decidable-map f → is-decidable-map (g ∘ f) - is-decidable-map-comp-is-decidable-emb' K H x = - rec-coproduct - ( λ u → - is-decidable-equiv - ( ( left-unit-law-Σ-is-contr - ( is-proof-irrelevant-is-prop - ( is-prop-map-is-emb (is-emb-is-decidable-emb K) x) u) - ( u)) ∘e - ( compute-fiber-comp g f x)) - ( H (pr1 u))) - ( λ α → inr (λ t → α (f (pr1 t) , pr2 t))) - ( is-decidable-map-is-decidable-emb K x) + is-decidable-map-comp-is-decidable-emb' K = + is-decidable-map-comp + ( is-injective-is-decidable-emb K) + ( is-decidable-map-is-decidable-emb K) is-decidable-map-comp-is-decidable-emb : is-decidable-emb g → is-decidable-emb f → is-decidable-map (g ∘ f) diff --git a/src/foundation/decidable-maps.lagda.md b/src/foundation/decidable-maps.lagda.md index 893f11da73..b4caf4cb85 100644 --- a/src/foundation/decidable-maps.lagda.md +++ b/src/foundation/decidable-maps.lagda.md @@ -64,6 +64,31 @@ abstract ( K b) ``` +### Composition of decidable maps + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {g : B → C} {f : A → B} + where + + abstract + is-decidable-map-comp : + is-injective g → + is-decidable-map g → + is-decidable-map f → + is-decidable-map (g ∘ f) + is-decidable-map-comp H G F x = + rec-coproduct + ( λ u → + is-decidable-iff + (λ v → (pr1 v) , ap g (pr2 v) ∙ pr2 u) + (λ w → pr1 w , H (pr2 w ∙ inv (pr2 u))) + ( F (pr1 u))) + ( λ α → inr (λ t → α (f (pr1 t) , pr2 t))) + ( G x) +``` + ### Left cancellation for decidable maps If a composite `g ∘ f` is decidable and the left factor `g` is injective, then From 2da0b76334ed900e3e6cec4496413d783ed24f92 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 1 Nov 2024 22:03:05 +0100 Subject: [PATCH 42/83] a bunch of logic --- .../decidable-propositions.lagda.md | 23 +- src/foundation.lagda.md | 2 +- src/foundation/cantors-theorem.lagda.md | 27 + src/foundation/complements-subtypes.lagda.md | 43 +- src/foundation/decidable-maps.lagda.md | 25 +- src/foundation/decidable-types.lagda.md | 4 + .../irrefutable-propositions.lagda.md | 141 +++- src/foundation/logical-equivalences.lagda.md | 4 + src/foundation/surjective-maps.lagda.md | 2 +- src/logic.lagda.md | 5 + .../complements-decidable-subtypes.lagda.md | 103 +++ src/logic/de-morgan-embeddings.lagda.md | 723 ++++++++++++++++++ src/logic/de-morgan-maps.lagda.md | 196 +++-- src/logic/de-morgan-propositions.lagda.md | 250 ++++++ src/logic/de-morgan-sheaves.lagda.md | 33 +- src/logic/de-morgan-subtypes.lagda.md | 340 ++++++++ src/logic/de-morgan-types.lagda.md | 297 +++++-- src/logic/de-morgans-law.lagda.md | 2 +- ...double-negation-stable-embeddings.lagda.md | 2 +- .../double-negation-stable-subtypes.lagda.md | 2 +- .../mutually-de-morgan-families.lagda.md | 75 ++ src/order-theory/preorders.lagda.md | 6 +- src/order-theory/suplattices.lagda.md | 64 +- 23 files changed, 2117 insertions(+), 252 deletions(-) create mode 100644 src/logic/complements-decidable-subtypes.lagda.md create mode 100644 src/logic/de-morgan-embeddings.lagda.md create mode 100644 src/logic/de-morgan-propositions.lagda.md create mode 100644 src/logic/de-morgan-subtypes.lagda.md create mode 100644 src/logic/mutually-de-morgan-families.lagda.md diff --git a/src/foundation-core/decidable-propositions.lagda.md b/src/foundation-core/decidable-propositions.lagda.md index deb1fcfca0..eb48a26b7d 100644 --- a/src/foundation-core/decidable-propositions.lagda.md +++ b/src/foundation-core/decidable-propositions.lagda.md @@ -205,16 +205,21 @@ module _ ( is-prop-type-is-decidable-prop ∘ K) is-decidable-is-decidable-prop-Σ : is-decidable (Σ P Q) - is-decidable-is-decidable-prop-Σ with is-decidable-type-is-decidable-prop H - ... | inl x = + is-decidable-is-decidable-prop-Σ = 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)) - ... | inr nx = inr (λ xy → nx (pr1 xy)) + ( λ 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-type-is-decidable-prop H) is-decidable-prop-Σ : is-decidable-prop (Σ P Q) is-decidable-prop-Σ = diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 0743354919..6ddabd199a 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -84,6 +84,7 @@ open import foundation.connected-types public open import foundation.constant-maps public open import foundation.constant-span-diagrams public open import foundation.constant-type-families public +open import foundation.constructive-cantor-schroder-bernstein public open import foundation.contractible-maps public open import foundation.contractible-types public open import foundation.copartial-elements public @@ -135,7 +136,6 @@ open import foundation.discrete-types public open import foundation.disjunction public open import foundation.double-arrows public open import foundation.double-negation public -open import logic.double-negation-elimination public open import foundation.double-negation-modality public open import foundation.double-negation-stable-propositions public open import foundation.double-powersets public diff --git a/src/foundation/cantors-theorem.lagda.md b/src/foundation/cantors-theorem.lagda.md index 1121765ee5..0153293c60 100644 --- a/src/foundation/cantors-theorem.lagda.md +++ b/src/foundation/cantors-theorem.lagda.md @@ -138,6 +138,33 @@ module _ ( not-in-image-map-theorem-double-negation-stable-Cantor) ``` +### Cantor's theorem for the set of de morgan subtypes + +```agda +module _ + {l1 l2 : Level} {X : UU l1} (f : X → de-morgan-subtype l2 X) + where + + 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))) + + 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) +``` + ## References A proof of Cantor's theorem first appeared in {{#cite Cantor1890/91}} where it diff --git a/src/foundation/complements-subtypes.lagda.md b/src/foundation/complements-subtypes.lagda.md index 5885bcf429..7c538522ec 100644 --- a/src/foundation/complements-subtypes.lagda.md +++ b/src/foundation/complements-subtypes.lagda.md @@ -38,7 +38,7 @@ open import order-theory.posets The {{#concept "complement" Disambiguation="of a subtype" Agda=complement-subtype}} -of a [subtype](foundation-core.subtypes.md) `P` of `A` consists of the elements +of a [subtype](foundation-core.subtypes.md) `P ⊆ A` consists of the elements that are not in `P`. ## Definition @@ -51,14 +51,6 @@ complement-subtype : complement-subtype P x = neg-Prop (P x) ``` -### 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) -``` - ## Properties ### Complements of subtypes are double negation stable @@ -71,39 +63,6 @@ complement-double-negation-stable-subtype' P x = neg-type-Double-Negation-Stable-Prop (is-in-subtype P x) ``` -### The union of a subtype `P` with its complement is the full subtype if and only if `P` is a decidable subtype - -```agda -module _ - {l1 l2 : Level} {A : UU l1} - where - - is-full-union-subtype-complement-subtype : - (P : subtype l2 A) → is-decidable-subtype P → - is-full-subtype (union-subtype P (complement-subtype P)) - is-full-union-subtype-complement-subtype P d x = - unit-trunc-Prop (d x) - - is-decidable-subtype-is-full-union-subtype-complement-subtype : - (P : subtype l2 A) → - is-full-subtype (union-subtype P (complement-subtype P)) → - is-decidable-subtype P - is-decidable-subtype-is-full-union-subtype-complement-subtype P H x = - apply-universal-property-trunc-Prop - ( H x) - ( is-decidable-Prop (P x)) - ( id) - - is-full-union-subtype-complement-decidable-subtype : - (P : decidable-subtype l2 A) → - is-full-decidable-subtype - ( union-decidable-subtype P (complement-decidable-subtype P)) - is-full-union-subtype-complement-decidable-subtype P = - is-full-union-subtype-complement-subtype - ( subtype-decidable-subtype P) - ( is-decidable-decidable-subtype P) -``` - ### Taking complements gives a contravariant endooperator on the powerset posets ```agda diff --git a/src/foundation/decidable-maps.lagda.md b/src/foundation/decidable-maps.lagda.md index b4caf4cb85..4af5e26758 100644 --- a/src/foundation/decidable-maps.lagda.md +++ b/src/foundation/decidable-maps.lagda.md @@ -33,13 +33,17 @@ open import foundation-core.retractions -## Definition +## Idea A [map](foundation-core.function-types.md) is said to be {{#concept "decidable" Disambiguation="map of types" Agda=is-decidable-map}} if its [fibers](foundation-core.fibers-of-maps.md) are [decidable types](foundation.decidable-types.md). +## Definition + +### The structure on a map of decidability + ```agda module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} @@ -49,6 +53,17 @@ module _ is-decidable-map f = (y : B) → is-decidable (fiber f y) ``` +### The type of decidabile maps + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + decidable-map : UU (l1 ⊔ l2) + decidable-map = Σ (A → B) (is-decidable-map) +``` + ## Properties ### Decidable maps are closed under homotopy @@ -102,9 +117,11 @@ module _ abstract is-decidable-map-right-factor' : is-decidable-map (g ∘ f) → is-injective g → is-decidable-map f - is-decidable-map-right-factor' GF G y with (GF (g y)) - ... | inl q = inl (pr1 q , G (pr2 q)) - ... | inr q = inr (λ x → q ((pr1 x) , ap g (pr2 x))) + is-decidable-map-right-factor' GF G y = + rec-coproduct + ( λ q → inl (pr1 q , G (pr2 q))) + ( λ q → inr (λ x → q ((pr1 x) , ap g (pr2 x)))) + ( GF (g y)) ``` ### Retracts into types with decidable equality are decidable diff --git a/src/foundation/decidable-types.lagda.md b/src/foundation/decidable-types.lagda.md index ea18245fa4..7efee4ceba 100644 --- a/src/foundation/decidable-types.lagda.md +++ b/src/foundation/decidable-types.lagda.md @@ -173,6 +173,10 @@ module _ (A → B) → (B → A) → is-decidable A → is-decidable B is-decidable-iff f g (inl a) = inl (f a) is-decidable-iff f g (inr na) = inr (λ b → na (g b)) + + is-decidable-iff' : + (A ↔ B) → is-decidable A → is-decidable B + is-decidable-iff' (f , g) = is-decidable-iff f g ``` ### Decidable types are closed under retracts diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md index 0e67931d37..737d79a21d 100644 --- a/src/foundation/irrefutable-propositions.lagda.md +++ b/src/foundation/irrefutable-propositions.lagda.md @@ -7,6 +7,8 @@ module foundation.irrefutable-propositions where
Imports ```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 @@ -15,12 +17,11 @@ 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 foundation-core.propositions - open import logic.double-negation-elimination ``` @@ -38,26 +39,57 @@ The [subuniverse](foundation.subuniverses.md) of ### The predicate on a proposition of being irrefutable ```agda -is-irrefutable : {l : Level} → Prop l → UU l -is-irrefutable P = ¬¬ (type-Prop P) +module _ + {l : Level} (P : Prop l) + where -is-prop-is-irrefutable : {l : Level} (P : Prop l) → is-prop (is-irrefutable P) -is-prop-is-irrefutable P = is-prop-double-negation + is-irrefutable : UU l + is-irrefutable = ¬¬ (type-Prop P) -is-irrefutable-Prop : {l : Level} → Prop l → Prop l -is-irrefutable-Prop = double-negation-Prop + 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 ``` -### The subuniverse of irrefutable propositions +### The predicate on a type of being an irrefutable proposition ```agda -subuniverse-Irrefutable-Prop : (l : Level) → subuniverse l l -subuniverse-Irrefutable-Prop l A = - product-Prop (is-prop-Prop A) (double-negation-type-Prop A) +module _ + {l : Level} (P : UU l) + where + + is-irrefutable-prop : UU l + is-irrefutable-prop = is-prop P × (¬¬ P) + + is-prop-is-irrefutable-prop : is-prop is-irrefutable-prop + is-prop-is-irrefutable-prop = + is-prop-product (is-prop-is-prop P) is-prop-double-negation + + is-irrefutable-prop-Prop : Prop l + is-irrefutable-prop-Prop = is-irrefutable-prop , is-prop-is-irrefutable-prop + +module _ + {l : Level} {P : UU l} (H : is-irrefutable-prop P) + where + + is-prop-type-is-irrefutable-prop : is-prop P + is-prop-type-is-irrefutable-prop = pr1 H + + prop-is-irrefutable-prop : Prop l + 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-is-irrefutable-prop = pr2 H +``` + +### The subuniverse of irrefutable propositions +```agda Irrefutable-Prop : (l : Level) → UU (lsuc l) -Irrefutable-Prop l = - type-subuniverse (subuniverse-Irrefutable-Prop l) +Irrefutable-Prop l = type-subuniverse is-irrefutable-prop-Prop make-Irrefutable-Prop : {l : Level} (P : Prop l) → is-irrefutable P → Irrefutable-Prop l @@ -71,14 +103,20 @@ module _ type-Irrefutable-Prop : UU l type-Irrefutable-Prop = pr1 P + is-irrefutable-prop-type-Irrefutable-Prop : + is-irrefutable-prop type-Irrefutable-Prop + is-irrefutable-prop-type-Irrefutable-Prop = pr2 P + is-prop-type-Irrefutable-Prop : is-prop type-Irrefutable-Prop - is-prop-type-Irrefutable-Prop = pr1 (pr2 P) + is-prop-type-Irrefutable-Prop = + is-prop-type-is-irrefutable-prop is-irrefutable-prop-type-Irrefutable-Prop 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 = pr2 (pr2 P) + is-irrefutable-Irrefutable-Prop = + is-irrefutable-is-irrefutable-prop is-irrefutable-prop-type-Irrefutable-Prop ``` ## Properties @@ -90,11 +128,20 @@ module _ {l : Level} (P : Prop l) where - is-irrefutable-is-inhabited : type-Prop P → is-irrefutable P - is-irrefutable-is-inhabited = intro-double-negation + 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-is-inhabited unit-Prop star +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 @@ -136,3 +183,59 @@ is-irrefutable-double-negation-elim : is-irrefutable-double-negation-elim H = H (λ f → ex-falso (f (λ a → H (λ _ → a)))) ``` + +### Dependent sums of of irrefutable propositions + +```agda +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) + is-irrefutable-prop-Σ a b = + ( is-prop-Σ + ( is-prop-type-is-irrefutable-prop a) + ( is-prop-type-is-irrefutable-prop ∘ b) , + is-irrefutable-Σ + ( is-irrefutable-is-irrefutable-prop a) + ( is-irrefutable-is-irrefutable-prop ∘ b)) +``` + +### Products of irrefutable propositions + +```agda +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/logical-equivalences.lagda.md b/src/foundation/logical-equivalences.lagda.md index e6208ce084..d806e1ca3d 100644 --- a/src/foundation/logical-equivalences.lagda.md +++ b/src/foundation/logical-equivalences.lagda.md @@ -220,6 +220,10 @@ iff-equiv : {l1 l2 : Level} {A : UU l1} {B : UU l2} → (A ≃ B) → (A ↔ B) pr1 (iff-equiv e) = map-equiv e pr2 (iff-equiv e) = map-inv-equiv e +iff-equiv' : {l1 l2 : Level} {A : UU l1} {B : UU l2} → (A ≃ B) → (B ↔ A) +pr1 (iff-equiv' e) = map-inv-equiv e +pr2 (iff-equiv' e) = map-equiv e + is-injective-iff-equiv : {l1 l2 : Level} {A : UU l1} {B : UU l2} → is-injective (iff-equiv {A = A} {B}) is-injective-iff-equiv p = eq-htpy-equiv (pr1 (htpy-eq-iff p)) diff --git a/src/foundation/surjective-maps.lagda.md b/src/foundation/surjective-maps.lagda.md index 4d04c3d5db..0823b00093 100644 --- a/src/foundation/surjective-maps.lagda.md +++ b/src/foundation/surjective-maps.lagda.md @@ -445,7 +445,7 @@ module _ abstract is-surjective-left-map-triangle : - (f : A → X) (g : B → X) (h : A → B) (H : f ~ (g ∘ h)) → + (f : A → X) (g : B → X) (h : A → B) (H : f ~ g ∘ h) → is-surjective g → is-surjective h → is-surjective f is-surjective-left-map-triangle f g h H is-surj-g is-surj-h x = apply-universal-property-trunc-Prop diff --git a/src/logic.lagda.md b/src/logic.lagda.md index 347f384dc2..d7cfc35fae 100644 --- a/src/logic.lagda.md +++ b/src/logic.lagda.md @@ -3,12 +3,17 @@ ```agda module logic where +open import logic.complements-decidable-subtypes public +open import logic.de-morgan-embeddings public open import logic.de-morgan-maps public +open import logic.de-morgan-propositions public open import logic.de-morgan-sheaves 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.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.mutually-de-morgan-families public ``` diff --git a/src/logic/complements-decidable-subtypes.lagda.md b/src/logic/complements-decidable-subtypes.lagda.md new file mode 100644 index 0000000000..6ea354a422 --- /dev/null +++ b/src/logic/complements-decidable-subtypes.lagda.md @@ -0,0 +1,103 @@ +# Complements of decidable subtypes + +```agda +module logic.complements-decidable-subtypes where +``` + +
Imports + +```agda +open import foundation.decidable-propositions +open import foundation.decidable-subtypes +open import foundation.double-negation-stable-propositions +open import foundation.full-subtypes +open import foundation.negation +open import foundation.complements-subtypes +open import foundation.postcomposition-functions +open import foundation.powersets +open import foundation.propositional-truncations +open import foundation.unions-subtypes +open import foundation.universe-levels + +open import foundation-core.function-types +open import foundation-core.subtypes + +open import logic.double-negation-stable-subtypes + +open import order-theory.large-posets +open import order-theory.opposite-large-posets +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-large-preorders +open import order-theory.order-preserving-maps-posets +open import order-theory.order-preserving-maps-preorders +open import order-theory.posets +``` + +
+ +## Idea + +The +{{#concept "complement" Disambiguation="of a decidable subtype" Agda=complement-decidable-subtype}} +of a [decidable subtype](foundation.decidable-subtypes.md) `B ⊆ A` consists of +the elements that are not in `B`. + +## Definition + +### 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) +``` + +## Properties + +### The union of a subtype `P` with its complement is the full subtype if and only if `P` is a decidable subtype + +```agda +module _ + {l1 l2 : Level} {A : UU l1} + where + + is-full-union-subtype-complement-subtype : + (P : subtype l2 A) → is-decidable-subtype P → + is-full-subtype (union-subtype P (complement-subtype P)) + is-full-union-subtype-complement-subtype P d x = + unit-trunc-Prop (d x) + + is-decidable-subtype-is-full-union-subtype-complement-subtype : + (P : subtype l2 A) → + is-full-subtype (union-subtype P (complement-subtype P)) → + is-decidable-subtype P + is-decidable-subtype-is-full-union-subtype-complement-subtype P H x = + apply-universal-property-trunc-Prop + ( H x) + ( is-decidable-Prop (P x)) + ( id) + + is-full-union-subtype-complement-decidable-subtype : + (P : decidable-subtype l2 A) → + is-full-decidable-subtype + ( union-decidable-subtype P (complement-decidable-subtype P)) + is-full-union-subtype-complement-decidable-subtype P = + is-full-union-subtype-complement-subtype + ( subtype-decidable-subtype P) + ( is-decidable-decidable-subtype P) +``` + +### Taking complements gives a contravariant involution on the decidable powerset posets + +```text +neg-hom-powerset : + {l1 : Level} {A : UU l1} → + hom-Large-Poset + ( λ l → l) + ( powerset-Large-Poset A) + ( opposite-Large-Poset (powerset-Large-Poset A)) +neg-hom-powerset = + make-hom-Large-Preorder + ( λ P x → neg-Prop (P x)) + ( λ P Q f x → map-neg (f x)) +``` diff --git a/src/logic/de-morgan-embeddings.lagda.md b/src/logic/de-morgan-embeddings.lagda.md new file mode 100644 index 0000000000..db3672aaef --- /dev/null +++ b/src/logic/de-morgan-embeddings.lagda.md @@ -0,0 +1,723 @@ +# De Morgan embeddings + +```agda +module logic.de-morgan-embeddings where +``` + +
Imports + +```agda +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.embeddings +open import foundation.fibers-of-maps +open import foundation.functoriality-cartesian-product-types +open import foundation.functoriality-coproduct-types +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 +open import foundation-core.functoriality-dependent-pair-types +open import foundation-core.homotopies +open import foundation-core.injective-maps +open import foundation-core.torsorial-type-families + +open import logic.de-morgan-maps +open import logic.de-morgan-propositions +open import logic.de-morgan-types +open import logic.double-negation-eliminating-maps +open import logic.double-negation-elimination +``` + +
+ +## Idea + +A [map](foundation-core.function-types.md) is said to be a +{{#concept "De Morgan embedding" Disambiguation="of types" Agda=is-de-morgan-emb}} +if it is an [embedding](foundation-core.embeddings.md) and the +[negations](foundation-core.negation.md) of its +[fibers](foundation-core.fibers-of-maps.md) are +[decidable](foundation-core.decidable-maps.md). + +Equivalently, a De Morgan embedding is a map whose fibers are +[De Morgan propositions](foundation.de-morgan-propositions.md). We refer to this +condition as being a +{{#concept "De Morgan propositional map" Disambiguation="of types" Agda=is-de-morgan-prop-map}}. + +## Definitions + +### The condition on a map of being a De Morgan embedding + +```agda +is-de-morgan-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} → (X → Y) → UU (l1 ⊔ l2) +is-de-morgan-emb f = is-emb f × is-de-morgan-map f + +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} + (F : is-de-morgan-emb f) + where + + is-emb-is-de-morgan-emb : is-emb f + is-emb-is-de-morgan-emb = pr1 F + + is-de-morgan-map-is-de-morgan-emb : + is-de-morgan-map f + is-de-morgan-map-is-de-morgan-emb = pr2 F + + is-prop-map-is-de-morgan-emb : is-prop-map f + is-prop-map-is-de-morgan-emb = + is-prop-map-is-emb is-emb-is-de-morgan-emb + + is-injective-is-de-morgan-emb : is-injective f + is-injective-is-de-morgan-emb = + is-injective-is-emb is-emb-is-de-morgan-emb +``` + +### De Morgan propositional maps + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} + where + + is-de-morgan-prop-map : (X → Y) → UU (l1 ⊔ l2) + is-de-morgan-prop-map f = + (y : Y) → is-de-morgan-prop (fiber f y) + + is-prop-is-de-morgan-prop-map : + (f : X → Y) → is-prop (is-de-morgan-prop-map f) + is-prop-is-de-morgan-prop-map f = + is-prop-Π (λ y → is-prop-is-de-morgan-prop (fiber f y)) + + is-de-morgan-prop-map-Prop : (X → Y) → Prop (l1 ⊔ l2) + is-de-morgan-prop-map-Prop f = + ( is-de-morgan-prop-map f , is-prop-is-de-morgan-prop-map f) + + is-prop-map-is-de-morgan-prop-map : + {f : X → Y} → is-de-morgan-prop-map f → is-prop-map f + is-prop-map-is-de-morgan-prop-map H y = + is-prop-type-is-de-morgan-prop (H y) + + is-de-morgan-map-is-de-morgan-prop-map : + {f : X → Y} → is-de-morgan-prop-map f → is-de-morgan-map f + is-de-morgan-map-is-de-morgan-prop-map H y = + is-de-morgan-type-is-de-morgan-prop (H y) +``` + +### The type of De Morgan embeddings + +```agda +infix 5 _↪ᵈᵐ_ +_↪ᵈᵐ_ : + {l1 l2 : Level} (X : UU l1) (Y : UU l2) → UU (l1 ⊔ l2) +X ↪ᵈᵐ Y = Σ (X → Y) is-de-morgan-emb + +map-de-morgan-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ↪ᵈᵐ Y → X → Y +map-de-morgan-emb e = pr1 e + +abstract + is-de-morgan-emb-map-de-morgan-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (e : X ↪ᵈᵐ Y) → + is-de-morgan-emb (map-de-morgan-emb e) + is-de-morgan-emb-map-de-morgan-emb e = pr2 e + +abstract + is-emb-map-de-morgan-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (e : X ↪ᵈᵐ Y) → + is-emb (map-de-morgan-emb e) + is-emb-map-de-morgan-emb e = + is-emb-is-de-morgan-emb + ( is-de-morgan-emb-map-de-morgan-emb e) + +abstract + is-de-morgan-map-map-de-morgan-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (e : X ↪ᵈᵐ Y) → + is-de-morgan-map (map-de-morgan-emb e) + is-de-morgan-map-map-de-morgan-emb e = + is-de-morgan-map-is-de-morgan-emb + ( is-de-morgan-emb-map-de-morgan-emb e) + +emb-de-morgan-emb : + {l1 l2 : Level} {X : UU l1} {Y : UU l2} → X ↪ᵈᵐ Y → X ↪ Y +pr1 (emb-de-morgan-emb e) = map-de-morgan-emb e +pr2 (emb-de-morgan-emb e) = is-emb-map-de-morgan-emb e +``` + +## Properties + +### Any map of which the fibers are De Morgan propositions is a De Morgan embedding + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} {f : X → Y} + where + + abstract + is-de-morgan-emb-is-de-morgan-prop-map : + is-de-morgan-prop-map f → is-de-morgan-emb f + pr1 (is-de-morgan-emb-is-de-morgan-prop-map H) = + is-emb-is-prop-map (is-prop-map-is-de-morgan-prop-map H) + pr2 (is-de-morgan-emb-is-de-morgan-prop-map H) = + is-de-morgan-map-is-de-morgan-prop-map H + + abstract + is-de-morgan-prop-map-is-de-morgan-emb : + is-de-morgan-emb f → is-de-morgan-prop-map f + pr1 (is-de-morgan-prop-map-is-de-morgan-emb H y) = + is-prop-map-is-de-morgan-emb H y + pr2 (is-de-morgan-prop-map-is-de-morgan-emb H y) = + is-de-morgan-map-is-de-morgan-emb H y +``` + +### The first projection map of a dependent sum of De Morgan propositions is a De Morgan embedding + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (Q : A → De-Morgan-Prop l2) + where + + is-de-morgan-prop-map-pr1 : + is-de-morgan-prop-map + ( pr1 {B = type-De-Morgan-Prop ∘ Q}) + is-de-morgan-prop-map-pr1 y = + is-de-morgan-prop-equiv + ( equiv-fiber-pr1 (type-De-Morgan-Prop ∘ Q) y) + ( is-de-morgan-prop-type-De-Morgan-Prop (Q y)) + + is-de-morgan-emb-pr1 : + is-de-morgan-emb + ( pr1 {B = type-De-Morgan-Prop ∘ Q}) + is-de-morgan-emb-pr1 = + is-de-morgan-emb-is-de-morgan-prop-map + ( is-de-morgan-prop-map-pr1) +``` + +### Decidable embeddings are De Morgan + +```agda +is-de-morgan-map-is-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-decidable-emb f → is-de-morgan-map f +is-de-morgan-map-is-decidable-emb H = + is-de-morgan-map-is-decidable-map + ( is-decidable-map-is-decidable-emb H) + +abstract + is-de-morgan-emb-is-decidable-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-decidable-emb f → is-de-morgan-emb f + is-de-morgan-emb-is-decidable-emb H = + ( is-emb-is-decidable-emb H , + is-de-morgan-map-is-decidable-emb H) +``` + +### Equivalences are De Morgan embeddings + +```agda +abstract + is-de-morgan-emb-is-equiv : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-equiv f → is-de-morgan-emb f + is-de-morgan-emb-is-equiv H = + ( is-emb-is-equiv H , is-de-morgan-map-is-equiv H) +``` + +### Identity maps are De Morgan embeddings + +```agda +is-de-morgan-emb-id : + {l : Level} {A : UU l} → is-de-morgan-emb (id {A = A}) +is-de-morgan-emb-id = + ( is-emb-id , is-de-morgan-map-id) + +de-morgan-emb-id : {l : Level} {A : UU l} → A ↪ᵈᵐ A +de-morgan-emb-id = (id , is-de-morgan-emb-id) + +is-de-morgan-prop-map-id : + {l : Level} {A : UU l} → is-de-morgan-prop-map (id {A = A}) +is-de-morgan-prop-map-id y = + is-de-morgan-prop-is-contr (is-torsorial-Id' y) +``` + +### Being a De Morgan embedding is a property + +```agda +abstract + is-prop-is-de-morgan-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) → + is-prop (is-de-morgan-emb f) + is-prop-is-de-morgan-emb f = + is-prop-product (is-property-is-emb f) is-prop-is-de-morgan-map +``` + +### De Morgan embeddings are closed under homotopies + +```agda +abstract + is-de-morgan-emb-htpy : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f g : A → B} → + f ~ g → is-de-morgan-emb g → is-de-morgan-emb f + is-de-morgan-emb-htpy {f = f} {g} H K = + ( is-emb-htpy H (is-emb-is-de-morgan-emb K) , + is-de-morgan-map-htpy H + ( is-de-morgan-map-is-de-morgan-emb K)) +``` + +### De Morgan embeddings are closed under composition + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {g : B → C} {f : A → B} + where + + is-de-morgan-map-comp-is-de-morgan-emb : + is-de-morgan-emb g → + is-de-morgan-map f → + is-de-morgan-map (g ∘ f) + is-de-morgan-map-comp-is-de-morgan-emb G F = + is-de-morgan-map-comp + ( is-injective-is-de-morgan-emb G) + ( is-de-morgan-map-is-de-morgan-emb G) + ( F) + + is-de-morgan-prop-map-comp : + is-de-morgan-prop-map g → + is-de-morgan-prop-map f → + is-de-morgan-prop-map (g ∘ f) + is-de-morgan-prop-map-comp K H z = + is-de-morgan-prop-equiv + ( compute-fiber-comp g f z) + ( is-de-morgan-prop-Σ (K z) (H ∘ pr1)) + + is-de-morgan-emb-comp : + is-de-morgan-emb g → + is-de-morgan-emb f → + is-de-morgan-emb (g ∘ f) + is-de-morgan-emb-comp K H = + is-de-morgan-emb-is-de-morgan-prop-map + ( is-de-morgan-prop-map-comp + ( is-de-morgan-prop-map-is-de-morgan-emb K) + ( is-de-morgan-prop-map-is-de-morgan-emb H)) + +comp-de-morgan-emb : + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} → + B ↪ᵈᵐ C → A ↪ᵈᵐ B → A ↪ᵈᵐ C +comp-de-morgan-emb (g , G) (f , F) = + ( g ∘ f , is-de-morgan-emb-comp G F) + +infixr 15 _∘¬¬_ +_∘¬¬_ : + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} → + B ↪ᵈᵐ C → A ↪ᵈᵐ B → A ↪ᵈᵐ C +_∘¬¬_ = comp-de-morgan-emb +``` + +### Left cancellation for De Morgan embeddings + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} + where + + is-de-morgan-emb-right-factor' : + is-de-morgan-emb (g ∘ f) → + is-emb g → + is-de-morgan-emb f + is-de-morgan-emb-right-factor' GH G = + ( is-emb-right-factor g f G (is-emb-is-de-morgan-emb GH) , + is-de-morgan-map-right-factor' + ( is-de-morgan-map-is-de-morgan-emb GH) + ( is-injective-is-emb G)) + + is-de-morgan-emb-right-factor : + is-de-morgan-emb (g ∘ f) → + is-de-morgan-emb g → + is-de-morgan-emb f + is-de-morgan-emb-right-factor GH G = + is-de-morgan-emb-right-factor' + ( GH) + ( is-emb-is-de-morgan-emb G) +``` + +### In a commuting triangle of maps, if the top and right maps are De Morgan embeddings so is the left map + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {top : A → B} {left : A → C} {right : B → C} + (H : left ~ right ∘ top) + where + + is-de-morgan-emb-left-map-triangle : + is-de-morgan-emb top → + is-de-morgan-emb right → + is-de-morgan-emb left + is-de-morgan-emb-left-map-triangle T R = + is-de-morgan-emb-htpy H + ( is-de-morgan-emb-comp R T) +``` + +### In a commuting triangle of maps, if the left and right maps are De Morgan embeddings so is the top map + +In fact, the right map need only be an embedding. + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {top : A → B} {left : A → C} {right : B → C} + (H : left ~ right ∘ top) + where + + is-de-morgan-emb-top-map-triangle' : + is-emb right → + is-de-morgan-emb left → + is-de-morgan-emb top + is-de-morgan-emb-top-map-triangle' R' L = + is-de-morgan-emb-right-factor' + ( is-de-morgan-emb-htpy (inv-htpy H) L) + ( R') + + is-de-morgan-emb-top-map-triangle : + is-de-morgan-emb right → + is-de-morgan-emb left → + is-de-morgan-emb top + is-de-morgan-emb-top-map-triangle R L = + is-de-morgan-emb-right-factor + ( is-de-morgan-emb-htpy (inv-htpy H) L) + ( R) +``` + +### Characterizing equality in the type of De Morgan embeddings + +```agda +htpy-de-morgan-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪ᵈᵐ B) → UU (l1 ⊔ l2) +htpy-de-morgan-emb f g = + map-de-morgan-emb f ~ map-de-morgan-emb g + +refl-htpy-de-morgan-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪ᵈᵐ B) → + htpy-de-morgan-emb f f +refl-htpy-de-morgan-emb f = refl-htpy + +htpy-eq-de-morgan-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪ᵈᵐ B) → + f = g → htpy-de-morgan-emb f g +htpy-eq-de-morgan-emb f .f refl = + refl-htpy-de-morgan-emb f + +abstract + is-torsorial-htpy-de-morgan-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪ᵈᵐ B) → + is-torsorial (htpy-de-morgan-emb f) + is-torsorial-htpy-de-morgan-emb f = + is-torsorial-Eq-subtype + ( is-torsorial-htpy (map-de-morgan-emb f)) + ( is-prop-is-de-morgan-emb) + ( map-de-morgan-emb f) + ( refl-htpy) + ( is-de-morgan-emb-map-de-morgan-emb f) + +abstract + is-equiv-htpy-eq-de-morgan-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪ᵈᵐ B) → + is-equiv (htpy-eq-de-morgan-emb f g) + is-equiv-htpy-eq-de-morgan-emb f = + fundamental-theorem-id + ( is-torsorial-htpy-de-morgan-emb f) + ( htpy-eq-de-morgan-emb f) + +eq-htpy-de-morgan-emb : + {l1 l2 : Level} {A : UU l1} {B : UU l2} (f g : A ↪ᵈᵐ B) → + htpy-de-morgan-emb f g → f = g +eq-htpy-de-morgan-emb f g = + map-inv-is-equiv (is-equiv-htpy-eq-de-morgan-emb f g) +``` + +### Precomposing De Morgan embeddings with equivalences + +```text +equiv-precomp-de-morgan-emb-equiv : + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) → + (C : UU l3) → (B ↪ᵈᵐ C) ≃ (A ↪ᵈᵐ C) +equiv-precomp-de-morgan-emb-equiv e C = + equiv-Σ + ( is-de-morgan-emb) + ( equiv-precomp e C) + ( λ g → + equiv-iff-is-prop + ( is-prop-is-de-morgan-emb g) + ( is-prop-is-de-morgan-emb (g ∘ map-equiv e)) + ( λ H → + is-de-morgan-emb-comp H + ( is-de-morgan-emb-is-equiv (pr2 e))) + ( λ d → + is-de-morgan-emb-htpy + ( λ b → ap g (inv (is-section-map-inv-equiv e b))) + ( is-de-morgan-emb-comp + ( d) + ( is-de-morgan-emb-is-equiv + ( is-equiv-map-inv-equiv e))))) +``` + +### Any map out of the empty type is a De Morgan embedding + +```agda +abstract + is-de-morgan-emb-ex-falso : + {l : Level} {X : UU l} → is-de-morgan-emb (ex-falso {l} {X}) + is-de-morgan-emb-ex-falso = + ( is-emb-ex-falso , is-de-morgan-map-ex-falso) + +de-morgan-emb-ex-falso : + {l : Level} {X : UU l} → empty ↪ᵈᵐ X +de-morgan-emb-ex-falso = + ( ex-falso , is-de-morgan-emb-ex-falso) + +-- de-morgan-emb-is-empty : +-- {l1 l2 : Level} {A : UU l1} {B : UU l2} → is-empty A → A ↪ᵈᵐ B +-- de-morgan-emb-is-empty {A = A} f = ? +``` + +### The map on total spaces induced by a family of De Morgan embeddings is a De Morgan embedding + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} + where + + is-de-morgan-emb-tot : + {f : (x : A) → B x → C x} → + ((x : A) → is-de-morgan-emb (f x)) → + is-de-morgan-emb (tot f) + is-de-morgan-emb-tot H = + ( is-emb-tot (is-emb-is-de-morgan-emb ∘ H) , + is-de-morgan-map-tot + ( is-de-morgan-map-is-de-morgan-emb ∘ H)) + + de-morgan-emb-tot : ((x : A) → B x ↪ᵈᵐ C x) → Σ A B ↪ᵈᵐ Σ A C + de-morgan-emb-tot f = + ( tot (map-de-morgan-emb ∘ f) , + is-de-morgan-emb-tot + ( is-de-morgan-emb-map-de-morgan-emb ∘ f)) +``` + +### The map on total spaces induced by a De Morgan embedding on the base is a De Morgan embedding + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) + where + + is-de-morgan-emb-map-Σ-map-base : + {f : A → B} → + is-de-morgan-emb f → + is-de-morgan-emb (map-Σ-map-base f C) + is-de-morgan-emb-map-Σ-map-base H = + ( is-emb-map-Σ-map-base C (is-emb-is-de-morgan-emb H) , + is-de-morgan-map-Σ-map-base C + ( is-de-morgan-map-is-de-morgan-emb H)) + + de-morgan-emb-map-Σ-map-base : + (f : A ↪ᵈᵐ B) → Σ A (C ∘ map-de-morgan-emb f) ↪ᵈᵐ Σ B C + de-morgan-emb-map-Σ-map-base f = + ( map-Σ-map-base (map-de-morgan-emb f) C , + is-de-morgan-emb-map-Σ-map-base + ( is-de-morgan-emb-map-de-morgan-emb f)) +``` + +### The functoriality of dependent pair types preserves De Morgan embeddings + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : A → UU l3} (D : B → UU l4) + where + + is-de-morgan-emb-map-Σ : + {f : A → B} {g : (x : A) → C x → D (f x)} → + is-de-morgan-emb f → + ((x : A) → is-de-morgan-emb (g x)) → + is-de-morgan-emb (map-Σ D f g) + is-de-morgan-emb-map-Σ {f} {g} F G = + is-de-morgan-emb-left-map-triangle + ( triangle-map-Σ D f g) + ( is-de-morgan-emb-tot G) + ( is-de-morgan-emb-map-Σ-map-base D F) + + de-morgan-emb-Σ : + (f : A ↪ᵈᵐ B) → + ((x : A) → C x ↪ᵈᵐ D (map-de-morgan-emb f x)) → + Σ A C ↪ᵈᵐ Σ B D + de-morgan-emb-Σ f g = + ( ( map-Σ D + ( map-de-morgan-emb f) + ( map-de-morgan-emb ∘ g)) , + ( is-de-morgan-emb-map-Σ + ( is-de-morgan-emb-map-de-morgan-emb f) + ( is-de-morgan-emb-map-de-morgan-emb ∘ g))) +``` + +### Products of De Morgan embeddings are De Morgan embeddings + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-de-morgan-emb-map-product : + {f : A → B} {g : C → D} → + is-de-morgan-emb f → + is-de-morgan-emb g → + is-de-morgan-emb (map-product f g) + is-de-morgan-emb-map-product (eF , dF) (eG , dG) = + ( is-emb-map-product eF eG , + is-de-morgan-map-product dF dG) + + de-morgan-emb-product : + A ↪ᵈᵐ B → C ↪ᵈᵐ D → A × C ↪ᵈᵐ B × D + de-morgan-emb-product (f , F) (g , G) = + ( map-product f g , is-de-morgan-emb-map-product F G) +``` + +### Coproducts of De Morgan embeddings are De Morgan embeddings + +```agda +module _ + {l1 l2 l1' l2' : Level} {A : UU l1} {B : UU l2} {A' : UU l1'} {B' : UU l2'} + where + +abstract + is-de-morgan-emb-map-coproduct : + {l1 l2 l3 l4 : Level} + {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} + {f : A → B} {g : X → Y} → + is-de-morgan-emb f → + is-de-morgan-emb g → + is-de-morgan-emb (map-coproduct f g) + is-de-morgan-emb-map-coproduct (eF , dF) (eG , dG) = + ( is-emb-map-coproduct eF eG , + is-de-morgan-map-coproduct dF dG) +``` + +### De Morgan embeddings are closed under base change + +```agda +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + {f : A → B} {g : C → D} + where + + is-de-morgan-prop-map-base-change : + cartesian-hom-arrow g f → + is-de-morgan-prop-map f → + is-de-morgan-prop-map g + is-de-morgan-prop-map-base-change α F d = + is-de-morgan-prop-equiv + ( equiv-fibers-cartesian-hom-arrow g f α d) + ( F (map-codomain-cartesian-hom-arrow g f α d)) + + is-de-morgan-emb-base-change : + cartesian-hom-arrow g f → + is-de-morgan-emb f → + is-de-morgan-emb g + is-de-morgan-emb-base-change α F = + is-de-morgan-emb-is-de-morgan-prop-map + ( is-de-morgan-prop-map-base-change α + ( is-de-morgan-prop-map-is-de-morgan-emb F)) +``` + +### De Morgan embeddings are closed under retracts of maps + +```agda +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} + {f : A → B} {g : X → Y} + where + + is-de-morgan-prop-map-retract-map : + f retract-of-map g → + is-de-morgan-prop-map g → + is-de-morgan-prop-map f + is-de-morgan-prop-map-retract-map R G x = + is-de-morgan-prop-retract-of + ( retract-fiber-retract-map f g R x) + ( G (map-codomain-inclusion-retract-map f g R x)) + + is-de-morgan-emb-retract-map : + f retract-of-map g → + is-de-morgan-emb g → + is-de-morgan-emb f + is-de-morgan-emb-retract-map R G = + is-de-morgan-emb-is-de-morgan-prop-map + ( is-de-morgan-prop-map-retract-map R + ( is-de-morgan-prop-map-is-de-morgan-emb G)) +``` + +### A type is a De Morgan proposition if and only if its terminal map is a De Morgan embedding + +```agda +module _ + {l : Level} {A : UU l} + where + + is-de-morgan-prop-is-de-morgan-emb-terminal-map : + is-de-morgan-emb (terminal-map A) → + is-de-morgan-prop A + is-de-morgan-prop-is-de-morgan-emb-terminal-map H = + is-de-morgan-prop-equiv' + ( equiv-fiber-terminal-map star) + ( is-de-morgan-prop-map-is-de-morgan-emb H star) + + is-de-morgan-emb-terminal-map-is-de-morgan-prop : + is-de-morgan-prop A → + is-de-morgan-emb (terminal-map A) + is-de-morgan-emb-terminal-map-is-de-morgan-prop H = + is-de-morgan-emb-is-de-morgan-prop-map + ( λ y → + is-de-morgan-prop-equiv (equiv-fiber-terminal-map y) H) +``` + +### If a dependent sum of propositions over a proposition is De Morgan, then the family is a family of De Morgan propositions + +```agda +module _ + {l1 l2 : Level} (P : Prop l1) (Q : type-Prop P → Prop l2) + where + + is-de-morgan-prop-family-is-de-morgan-Σ : + is-de-morgan (Σ (type-Prop P) (type-Prop ∘ Q)) → + (p : type-Prop P) → is-de-morgan (type-Prop (Q p)) + is-de-morgan-prop-family-is-de-morgan-Σ H p = + is-de-morgan-equiv' + ( equiv-fiber-pr1 (type-Prop ∘ Q) p) + ( is-de-morgan-map-is-de-morgan-emb + ( is-de-morgan-emb-right-factor' + ( is-de-morgan-emb-terminal-map-is-de-morgan-prop + ( is-prop-Σ (is-prop-type-Prop P) (is-prop-type-Prop ∘ Q) , H)) + ( is-emb-terminal-map-is-prop (is-prop-type-Prop P))) + ( p)) +``` diff --git a/src/logic/de-morgan-maps.lagda.md b/src/logic/de-morgan-maps.lagda.md index 303d5974f9..ca7cc930d6 100644 --- a/src/logic/de-morgan-maps.lagda.md +++ b/src/logic/de-morgan-maps.lagda.md @@ -7,27 +7,31 @@ module logic.de-morgan-maps where
Imports ```agda +open import elementary-number-theory.natural-numbers + 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.negation -open import logic.de-morgan-types -open import foundation.universal-property-equivalences open import foundation.dependent-pair-types open import foundation.double-negation -open import logic.double-negation-elimination +open import foundation.embeddings open import foundation.empty-types +open import foundation.existential-quantification open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-coproduct-types open import foundation.identity-types open import foundation.injective-maps +open import foundation.negation +open import foundation.propositions 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.unit-type +open import foundation.universal-property-equivalences open import foundation.universe-levels open import foundation-core.contractible-maps @@ -36,6 +40,11 @@ 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 logic.de-morgan-types +open import logic.de-morgans-law +open import logic.double-negation-eliminating-maps +open import logic.double-negation-elimination ```
@@ -48,18 +57,51 @@ the [negation](foundation-core.negation.md) of its [fibers](foundation-core.fibers-of-maps.md) are [decidable](foundation.decidable-types.md). I.e., for every `y : B`, if `fiber f y` is either [empty](foundation.empty-types.md) or -[irrefutable](foundation.irrefutable-propositions.md). +[irrefutable](foundation.irrefutable-propositions.md). This is an equivalent, +but [small](foundation.small-types.md) condition that is equivallent to asking +that they satisfy [De Morgan's law](logic.de-morgans-law.md). ## Definintion +### De Morgan maps + ```agda module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} where is-de-morgan-map : (A → B) → UU (l1 ⊔ l2) - is-de-morgan-map f = - (y : B) → is-decidable (¬ (fiber f y)) + is-de-morgan-map f = (y : B) → is-de-morgan (fiber f y) + + is-prop-is-de-morgan-map : {f : A → B} → is-prop (is-de-morgan-map f) + is-prop-is-de-morgan-map {f} = + is-prop-Π (λ y → is-prop-is-de-morgan (fiber f y)) + + is-de-morgan-map-Prop : (A → B) → Prop (l1 ⊔ l2) + is-de-morgan-map-Prop f = is-de-morgan-map f , is-prop-is-de-morgan-map +``` + +### The type of De Morgan maps + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + de-morgan-map : UU (l1 ⊔ l2) + de-morgan-map = Σ (A → B) (is-de-morgan-map) +``` + +### Self-De-Morgan maps + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-self-de-morgan-map : (A → B) → UU (l1 ⊔ l2) + is-self-de-morgan-map f = + (y z : B) → de-morgans-law' (fiber f y) (fiber f z) ``` ## Properties @@ -85,54 +127,17 @@ abstract is-de-morgan-map-is-decidable-map : {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → is-decidable-map f → is-de-morgan-map f -is-de-morgan-map-is-decidable-map H y = is-decidable-neg-is-decidable (H y) +is-de-morgan-map-is-decidable-map H y = is-de-morgan-is-decidable (H y) ``` -### Composition of De Morgan maps - -Given a composition `g ∘ f` of De Morgan maps where the left factor `g` is -injective, then the composition is De Morgan. +### Double negation eliminating De Morgan maps are decidable ```agda -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} - {g : B → C} {f : A → B} - where - - -- fiber-left-is-de-morgan-map-left : - -- is-de-morgan-map g → - -- (z : C) → ¬¬ (fiber (g ∘ f) z) → fiber g z - -- fiber-left-is-de-morgan-map-left G z nngfz = ? - -- -- G z (λ x → nngfz (λ w → x (f (pr1 w) , pr2 w))) - - -- fiber-right-is-de-morgan-map-comp : - -- is-injective g → - -- (G : is-de-morgan-map g) → - -- is-de-morgan-map f → - -- (z : C) (nngfz : ¬¬ (fiber (g ∘ f) z)) → - -- fiber f (pr1 (fiber-left-is-de-morgan-map-left G z nngfz)) - -- fiber-right-is-de-morgan-map-comp H G F z nngfz = - -- F ( pr1 - -- ( fiber-left-is-de-morgan-map-left G z nngfz)) - -- ( λ x → - -- nngfz - -- ( λ w → - -- x ( pr1 w , - -- H ( pr2 w ∙ - -- inv - -- ( pr2 - -- ( fiber-left-is-de-morgan-map-left - -- G z nngfz)))))) - - is-de-morgan-map-comp : - is-injective g → - is-de-morgan-map g → - is-de-morgan-map f → - is-de-morgan-map (g ∘ f) - is-de-morgan-map-comp H G F z = {! !} - -- map-inv-compute-fiber-comp g f z - -- ( ( fiber-left-is-de-morgan-map-left G z nngfz) , - -- ( fiber-right-is-de-morgan-map-comp H G F z nngfz)) +is-decidable-map-is-double-negation-eliminating-de-morgan-map : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-de-morgan-map f → is-double-negation-eliminating-map f → is-decidable-map f +is-decidable-map-is-double-negation-eliminating-de-morgan-map H K y = + is-decidable-is-decidable-neg-has-double-negation-elim (K y) (H y) ``` ### Left cancellation for De Morgan maps @@ -140,65 +145,55 @@ module _ If a composite `g ∘ f` is De Morgan and the left factor `g` is injective, then the right factor `f` is De Morgan. -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} (GF : is-de-morgan-map (g ∘ f)) where - fiber-comp-is-de-morgan-map-right-factor' : - (y : B) → ¬¬ (fiber f y) → Σ (fiber g (g y)) (λ t → fiber f (pr1 t)) - fiber-comp-is-de-morgan-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)))) - is-de-morgan-map-right-factor' : is-injective g → is-de-morgan-map f - is-de-morgan-map-right-factor' G y nnfy = - tr - ( fiber f) - ( G ( pr2 - ( pr1 - ( fiber-comp-is-de-morgan-map-right-factor' - ( y) - ( nnfy))))) - ( pr2 - ( fiber-comp-is-de-morgan-map-right-factor' y nnfy)) + is-de-morgan-map-right-factor' H y = + rec-coproduct + ( λ ngfy → inl (λ p → ngfy (pr1 p , ap g (pr2 p)))) + ( λ nngfy → inr (λ nq → nngfy λ p → nq (pr1 p , H (pr2 p)))) + ( GF (g y)) ``` ### Any map out of the empty type is De Morgan -```text +```agda abstract is-de-morgan-map-ex-falso : - {l : Level} {X : UU l} → - is-de-morgan-map (ex-falso {l} {X}) - is-de-morgan-map-ex-falso x f = ex-falso (f λ ()) + {l : Level} {X : UU l} → is-de-morgan-map (ex-falso {l} {X}) + is-de-morgan-map-ex-falso = + is-de-morgan-map-is-decidable-map is-decidable-map-ex-falso ``` ### The identity map is De Morgan -```text +```agda abstract is-de-morgan-map-id : {l : Level} {X : UU l} → is-de-morgan-map (id {l} {X}) - is-de-morgan-map-id x y = (x , refl) + is-de-morgan-map-id = + is-de-morgan-map-is-decidable-map is-decidable-map-id ``` ### Equivalences are De Morgan maps -```text +```agda abstract is-de-morgan-map-is-equiv : {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → is-equiv f → is-de-morgan-map f - is-de-morgan-map-is-equiv H x = - double-negation-elim-is-contr (is-contr-map-is-equiv H x) + is-de-morgan-map-is-equiv H = + is-de-morgan-map-is-decidable-map (is-decidable-map-is-equiv H) ``` ### The map on total spaces induced by a family of De Morgan maps is De Morgan -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} where @@ -208,12 +203,12 @@ module _ ((x : A) → is-de-morgan-map (f x)) → is-de-morgan-map (tot f) is-de-morgan-map-tot {f} H x = - has-double-negation-elim-equiv (compute-fiber-tot f x) (H (pr1 x) (pr2 x)) + is-decidable-equiv (equiv-neg (compute-fiber-tot f x)) (H (pr1 x) (pr2 x)) ``` ### The map on total spaces induced by a De Morgan map on the base is De Morgan -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) where @@ -223,14 +218,14 @@ module _ is-de-morgan-map f → is-de-morgan-map (map-Σ-map-base f C) is-de-morgan-map-Σ-map-base {f} H x = - has-double-negation-elim-equiv' - ( compute-fiber-map-Σ-map-base f C x) + is-decidable-equiv' + ( equiv-neg (compute-fiber-map-Σ-map-base f C x)) ( H (pr1 x)) ``` ### Products of De Morgan maps are De Morgan -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} where @@ -240,15 +235,15 @@ module _ is-de-morgan-map f → is-de-morgan-map g → is-de-morgan-map (map-product f g) - is-de-morgan-map-product {f} {g} F G x = - has-double-negation-elim-equiv - ( compute-fiber-map-product f g x) - ( double-negation-elim-product (F (pr1 x)) (G (pr2 x))) + is-de-morgan-map-product {f} {g} F G y = + is-de-morgan-equiv + ( compute-fiber-map-product f g y) + ( is-de-morgan-product (F (pr1 y)) (G (pr2 y))) ``` ### Coproducts of De Morgan maps are De Morgan -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} where @@ -259,18 +254,18 @@ module _ is-de-morgan-map g → is-de-morgan-map (map-coproduct f g) is-de-morgan-map-coproduct {f} {g} F G (inl x) = - has-double-negation-elim-equiv' - ( compute-fiber-inl-map-coproduct f g x) + is-decidable-equiv' + ( equiv-neg (compute-fiber-inl-map-coproduct f g x)) ( F x) - is-de-morgan-map-coproduct {f} {g} F G (inr y) = - has-double-negation-elim-equiv' - ( compute-fiber-inr-map-coproduct f g y) - ( G y) + is-de-morgan-map-coproduct {f} {g} F G (inr x) = + is-decidable-equiv' + ( equiv-neg (compute-fiber-inr-map-coproduct f g x)) + ( G x) ``` ### De Morgan maps are closed under base change -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} {f : A → B} {g : C → D} @@ -281,14 +276,14 @@ module _ is-de-morgan-map f → is-de-morgan-map g is-de-morgan-map-base-change α F d = - has-double-negation-elim-equiv - ( equiv-fibers-cartesian-hom-arrow g f α d) + is-decidable-equiv + ( equiv-neg (equiv-fibers-cartesian-hom-arrow g f α d)) ( F (map-codomain-cartesian-hom-arrow g f α d)) ``` ### De Morgan maps are closed under retracts of maps -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} {f : A → B} {g : X → Y} @@ -299,7 +294,8 @@ module _ is-de-morgan-map g → is-de-morgan-map f is-de-morgan-retract-map R G x = - has-double-negation-elim-retract - ( retract-fiber-retract-map f g R x) + is-decidable-iff + ( map-neg (inclusion-retract (retract-fiber-retract-map f g R x))) + ( map-neg (map-retraction-retract (retract-fiber-retract-map f g R x))) ( G (map-codomain-inclusion-retract-map f g R x)) ``` diff --git a/src/logic/de-morgan-propositions.lagda.md b/src/logic/de-morgan-propositions.lagda.md new file mode 100644 index 0000000000..79f6141aa3 --- /dev/null +++ b/src/logic/de-morgan-propositions.lagda.md @@ -0,0 +1,250 @@ +# De Morgan propositions + +```agda +module logic.de-morgan-propositions where +``` + +
Imports + +```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 +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.evaluation-functions +open import foundation.function-types +open import foundation.functoriality-dependent-pair-types +open import foundation.identity-types +open import foundation.irrefutable-propositions +open import foundation.logical-equivalences +open import foundation.negation +open import foundation.propositional-extensionality +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.retracts-of-types +open import foundation.sets +open import foundation.subtypes +open import foundation.universe-levels + +open import foundation-core.decidable-propositions + +open import logic.de-morgan-types +open import logic.de-morgans-law +``` + +
+ +## Idea + +In classical logic, i.e., logic where we assume +[the law of excluded middle](foundation.law-of-excluded-middle.md), the _De +Morgan laws_ refers to the pair of logical equivalences + +```text + ¬ (P ∨ Q) ⇔ (¬ P) ∧ (¬ Q) + ¬ (P ∧ Q) ⇔ (¬ P) ∨ (¬ Q). +``` + +Out of these in total four logical implications, all but one are validated in +constructive mathematics. The odd one out is + +```text + ¬ (P ∧ Q) ⇒ (¬ P) ∨ (¬ Q). +``` + +Indeed, this would state that we could constructively deduce from a proof that +neither `P` nor `Q` is true, whether of `P` is false or `Q` is false. This +logical law is what we refer to as [De Morgan's Law](logic.de-morgans-law.md). +If a proposition `P` is such that for every other proposition `Q`, the De Morgan +implication + +```text + ¬ (P ∧ Q) ⇒ (¬ P) ∨ (¬ Q) +``` + +holds, we say `P` is {{#concept "De Morgan" Disambiguation="proposition"}}. + +Equivalently, a proposition is De Morgan if its negation is decidable. Since +this is a [small](foundation.small-types.md) condition, it is frequently more +convenient to use. + +## Definition + +### The predicate on propositions of being De Morgan + +```agda +module _ + {l : Level} (P : UU l) + where + + is-de-morgan-prop : UU l + is-de-morgan-prop = is-prop P × is-de-morgan P + + is-prop-is-de-morgan-prop : is-prop is-de-morgan-prop + is-prop-is-de-morgan-prop = + is-prop-product (is-prop-is-prop P) (is-prop-is-de-morgan P) + + is-de-morgan-prop-Prop : Prop l + is-de-morgan-prop-Prop = is-de-morgan-prop , is-prop-is-de-morgan-prop + +module _ + {l : Level} {P : UU l} (H : is-de-morgan-prop P) + where + + is-prop-type-is-de-morgan-prop : is-prop P + is-prop-type-is-de-morgan-prop = pr1 H + + is-de-morgan-type-is-de-morgan-prop : is-de-morgan P + is-de-morgan-type-is-de-morgan-prop = pr2 H +``` + +### The subuniverse of De Morgan propositions + +```agda +De-Morgan-Prop : (l : Level) → UU (lsuc l) +De-Morgan-Prop l = Σ (UU l) (is-de-morgan-prop) + +module _ + {l : Level} (A : De-Morgan-Prop l) + where + + type-De-Morgan-Prop : UU l + type-De-Morgan-Prop = pr1 A + + is-de-morgan-prop-type-De-Morgan-Prop : is-de-morgan-prop type-De-Morgan-Prop + is-de-morgan-prop-type-De-Morgan-Prop = pr2 A + + is-prop-type-De-Morgan-Prop : is-prop type-De-Morgan-Prop + is-prop-type-De-Morgan-Prop = + is-prop-type-is-de-morgan-prop is-de-morgan-prop-type-De-Morgan-Prop + + is-de-morgan-type-De-Morgan-Prop : is-de-morgan type-De-Morgan-Prop + is-de-morgan-type-De-Morgan-Prop = + is-de-morgan-type-is-de-morgan-prop is-de-morgan-prop-type-De-Morgan-Prop + + prop-De-Morgan-Prop : Prop l + prop-De-Morgan-Prop = type-De-Morgan-Prop , is-prop-type-De-Morgan-Prop + + de-morgan-type-De-Morgan-Prop : De-Morgan-Type l + de-morgan-type-De-Morgan-Prop = + type-De-Morgan-Prop , is-de-morgan-type-De-Morgan-Prop +``` + +## Properties + +### The forgetful map from De Morgan propositions to propositions is an embedding + +```agda +is-emb-prop-De-Morgan-Prop : + {l : Level} → is-emb (prop-De-Morgan-Prop {l}) +is-emb-prop-De-Morgan-Prop = + is-emb-tot + ( λ X → + is-emb-inclusion-subtype (λ _ → is-de-morgan X , is-prop-is-de-morgan X)) + +emb-prop-De-Morgan-Prop : + {l : Level} → De-Morgan-Prop l ↪ Prop l +emb-prop-De-Morgan-Prop = + ( prop-De-Morgan-Prop , is-emb-prop-De-Morgan-Prop) +``` + +### The subuniverse of De Morgan propositions is a set + +```agda +is-set-De-Morgan-Prop : {l : Level} → is-set (De-Morgan-Prop l) +is-set-De-Morgan-Prop {l} = + is-set-emb emb-prop-De-Morgan-Prop is-set-type-Prop + +set-De-Morgan-Prop : (l : Level) → Set (lsuc l) +set-De-Morgan-Prop l = (De-Morgan-Prop l , is-set-De-Morgan-Prop) +``` + +### Extensionality of De Morgan propositions + +```agda +module _ + {l : Level} (P Q : De-Morgan-Prop l) + where + + extensionality-De-Morgan-Prop : + (P = Q) ≃ (type-De-Morgan-Prop P ↔ type-De-Morgan-Prop Q) + extensionality-De-Morgan-Prop = + ( propositional-extensionality + ( prop-De-Morgan-Prop P) + ( prop-De-Morgan-Prop Q)) ∘e + ( equiv-ap-emb emb-prop-De-Morgan-Prop) + + iff-eq-De-Morgan-Prop : P = Q → type-De-Morgan-Prop P ↔ type-De-Morgan-Prop Q + iff-eq-De-Morgan-Prop = map-equiv extensionality-De-Morgan-Prop + + eq-iff-De-Morgan-Prop' : type-De-Morgan-Prop P ↔ type-De-Morgan-Prop Q → P = Q + eq-iff-De-Morgan-Prop' = map-inv-equiv extensionality-De-Morgan-Prop + + eq-iff-De-Morgan-Prop : + (type-De-Morgan-Prop P → type-De-Morgan-Prop Q) → + (type-De-Morgan-Prop Q → type-De-Morgan-Prop P) → + P = Q + eq-iff-De-Morgan-Prop f g = eq-iff-De-Morgan-Prop' (f , g) +``` + +### De Morgan propositions are closed under retracts + +```agda +is-de-morgan-prop-retract-of : + {l1 l2 : Level} {P : UU l1} {Q : UU l2} → + P retract-of Q → is-de-morgan-prop Q → is-de-morgan-prop P +is-de-morgan-prop-retract-of R H = + is-prop-retract-of R (is-prop-type-is-de-morgan-prop H) , + is-de-morgan-iff' (iff-retract' R) (is-de-morgan-type-is-de-morgan-prop H) +``` + +### De Morgan propositions are closed under equivalences + +```agda +is-de-morgan-prop-equiv : + {l1 l2 : Level} {P : UU l1} {Q : UU l2} → + P ≃ Q → is-de-morgan-prop Q → is-de-morgan-prop P +is-de-morgan-prop-equiv e = is-de-morgan-prop-retract-of (retract-equiv e) + +is-de-morgan-prop-equiv' : + {l1 l2 : Level} {P : UU l1} {Q : UU l2} → + Q ≃ P → is-de-morgan-prop Q → is-de-morgan-prop P +is-de-morgan-prop-equiv' e = is-de-morgan-prop-retract-of (retract-inv-equiv e) +``` + +### Irrefutable propositions are De Morgan + +```agda +is-de-morgan-prop-is-irrefutable-prop : + {l : Level} {P : UU l} → is-irrefutable-prop P → is-de-morgan-prop P +is-de-morgan-prop-is-irrefutable-prop = tot (λ _ → is-de-morgan-is-irrefutable) +``` + +### Contractible types are De Morgan propositions + +```agda +is-de-morgan-prop-is-contr : + {l : Level} {P : UU l} → is-contr P → is-de-morgan-prop P +is-de-morgan-prop-is-contr H = + is-de-morgan-prop-is-irrefutable-prop (is-irrefutable-prop-is-contr H) +``` + +### Empty types are De Morgan propositions + +```agda +is-de-morgan-prop-is-empty : + {l : Level} {P : UU l} → is-empty P → is-de-morgan-prop P +is-de-morgan-prop-is-empty H = is-prop-is-empty H , is-de-morgan-is-empty H +``` + +## External links + +- [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) + at $n$Lab diff --git a/src/logic/de-morgan-sheaves.lagda.md b/src/logic/de-morgan-sheaves.lagda.md index 5aabdd6239..ea4310792d 100644 --- a/src/logic/de-morgan-sheaves.lagda.md +++ b/src/logic/de-morgan-sheaves.lagda.md @@ -26,6 +26,7 @@ open import foundation-core.propositions open import logic.de-morgans-law +open import orthogonal-factorization-systems.double-negation-sheaves open import orthogonal-factorization-systems.null-types ``` @@ -34,8 +35,8 @@ open import orthogonal-factorization-systems.null-types ## Idea {{#concept "De morgan sheaves" Agda=is-de-morgan-sheaf}} are types that are -[null](orthogonal-factorization-systems.null-types.md) at propositions of the -form `¬P ∨ ¬¬P`. +[null](orthogonal-factorization-systems.null-types.md) at +[propositions](foundation-core.propositions.md) of the form `¬P ∨ ¬¬P`. De Morgan sheaves are closely related to, but a strictly weaker notion than [double negation sheaves](orthogonal-factorization-systems.double-negation-sheaves.md). @@ -58,13 +59,6 @@ is-prop-is-de-morgan-sheaf {A = A} = ## Properties -### A type is a De Morgan sheaf if and only if it is local at the De Morgan implication - -A type is null at `¬P ∨ ¬¬ P` for all types `P` if and only if it is local at -`(¬ P ∨ ¬ Q) ⇒ ¬ (P ∧ Q)` for all types `P` and `Q`. - -> TODO: check this - ### The empty type is a De Morgan sheaf ```agda @@ -87,16 +81,19 @@ is-de-morgan-sheaf-is-contr is-contr-A P = ### Double negation sheaves are De Morgan sheaves -> TODO - -### Types that are De Morgan sheaves are De Morgan - -> TODO - -### De Morgan types are De Morgan sheaves - -> TODO +```agda +is-de-morgan-sheaf-is-double-negation-sheaf : + {l1 l2 : Level} {A : UU l1} → + is-double-negation-sheaf l2 A → + is-de-morgan-sheaf l2 A +is-de-morgan-sheaf-is-double-negation-sheaf H P = + H (is-decidable-prop-Irrefutable-Prop (neg-type-Prop P)) +``` ## References {{#bibliography}} + +## External links + +- [De Morganization](https://ncatlab.org/nlab/show/De+Morganization) at $n$Lab diff --git a/src/logic/de-morgan-subtypes.lagda.md b/src/logic/de-morgan-subtypes.lagda.md new file mode 100644 index 0000000000..3eed983940 --- /dev/null +++ b/src/logic/de-morgan-subtypes.lagda.md @@ -0,0 +1,340 @@ +# De Morgan subtypes + +```agda +module logic.de-morgan-subtypes where +``` + +
Imports + +```agda +open import foundation.1-types +open import foundation.coproduct-types +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.equality-dependent-function-types +open import foundation.functoriality-cartesian-product-types +open import foundation.functoriality-dependent-function-types +open import foundation.functoriality-dependent-pair-types +open import foundation.logical-equivalences +open import foundation.negation +open import foundation.propositional-maps +open import foundation.sets +open import foundation.structured-type-duality +open import foundation.subtypes +open import foundation.type-theoretic-principle-of-choice +open import foundation.universe-levels + +open import foundation-core.embeddings +open import foundation-core.equivalences +open import foundation-core.fibers-of-maps +open import foundation-core.function-types +open import foundation-core.identity-types +open import foundation-core.injective-maps +open import foundation-core.propositions +open import foundation-core.transport-along-identifications +open import foundation-core.truncated-types +open import foundation-core.truncation-levels + +open import logic.de-morgan-embeddings +open import logic.de-morgan-maps +open import logic.de-morgan-propositions +open import logic.de-morgan-types +open import logic.double-negation-eliminating-maps +open import logic.double-negation-elimination +``` + +
+ +## Idea + +A +{{#concept "De Morgan subtype" Disambiguation="of a type" Agda=is-de-morgan-subtype Agda=de-morgan-subtype}} +of a type consists of a family of +[De Morgan propositions](foundation.de-morgan-propositions.md) over it. + +## Definitions + +### Decidable subtypes + +```agda +is-de-morgan-subtype-Prop : + {l1 l2 : Level} {A : UU l1} → subtype l2 A → Prop (l1 ⊔ l2) +is-de-morgan-subtype-Prop {A = A} P = + Π-Prop A (λ a → is-de-morgan-Prop (type-Prop (P a))) + +is-de-morgan-subtype : + {l1 l2 : Level} {A : UU l1} → subtype l2 A → UU (l1 ⊔ l2) +is-de-morgan-subtype P = + type-Prop (is-de-morgan-subtype-Prop P) + +is-prop-is-de-morgan-subtype : + {l1 l2 : Level} {A : UU l1} (P : subtype l2 A) → + is-prop (is-de-morgan-subtype P) +is-prop-is-de-morgan-subtype P = + is-prop-type-Prop (is-de-morgan-subtype-Prop P) + +de-morgan-subtype : + {l1 : Level} (l : Level) (X : UU l1) → UU (l1 ⊔ lsuc l) +de-morgan-subtype l X = X → De-Morgan-Prop l +``` + +### The underlying subtype of a De Morgan subtype + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (P : de-morgan-subtype l2 A) + where + + subtype-de-morgan-subtype : subtype l2 A + subtype-de-morgan-subtype a = + prop-De-Morgan-Prop (P a) + + is-de-morgan-de-morgan-subtype : + is-de-morgan-subtype subtype-de-morgan-subtype + is-de-morgan-de-morgan-subtype a = + is-de-morgan-type-De-Morgan-Prop (P a) + + is-in-de-morgan-subtype : A → UU l2 + is-in-de-morgan-subtype = + is-in-subtype subtype-de-morgan-subtype + + is-prop-is-in-de-morgan-subtype : + (a : A) → is-prop (is-in-de-morgan-subtype a) + is-prop-is-in-de-morgan-subtype = + is-prop-is-in-subtype subtype-de-morgan-subtype +``` + +### The underlying type of a De Morgan subtype + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (P : de-morgan-subtype l2 A) + where + + type-de-morgan-subtype : UU (l1 ⊔ l2) + type-de-morgan-subtype = + type-subtype (subtype-de-morgan-subtype P) + + inclusion-de-morgan-subtype : + type-de-morgan-subtype → A + inclusion-de-morgan-subtype = + inclusion-subtype (subtype-de-morgan-subtype P) + + is-emb-inclusion-de-morgan-subtype : + is-emb inclusion-de-morgan-subtype + is-emb-inclusion-de-morgan-subtype = + is-emb-inclusion-subtype (subtype-de-morgan-subtype P) + + is-de-morgan-map-inclusion-de-morgan-subtype : + is-de-morgan-map inclusion-de-morgan-subtype + is-de-morgan-map-inclusion-de-morgan-subtype x = + is-de-morgan-equiv + ( equiv-fiber-pr1 (type-De-Morgan-Prop ∘ P) x) + ( is-de-morgan-type-De-Morgan-Prop (P x)) + + is-injective-inclusion-de-morgan-subtype : + is-injective inclusion-de-morgan-subtype + is-injective-inclusion-de-morgan-subtype = + is-injective-inclusion-subtype (subtype-de-morgan-subtype P) + + emb-de-morgan-subtype : type-de-morgan-subtype ↪ A + emb-de-morgan-subtype = + emb-subtype (subtype-de-morgan-subtype P) + + is-de-morgan-emb-inclusion-de-morgan-subtype : + is-de-morgan-emb inclusion-de-morgan-subtype + is-de-morgan-emb-inclusion-de-morgan-subtype = + ( is-emb-inclusion-de-morgan-subtype , + is-de-morgan-map-inclusion-de-morgan-subtype) + + de-morgan-emb-de-morgan-subtype : + type-de-morgan-subtype ↪ᵈᵐ A + de-morgan-emb-de-morgan-subtype = + ( inclusion-de-morgan-subtype , + is-de-morgan-emb-inclusion-de-morgan-subtype) +``` + +### The De Morgan subtype associated to a De Morgan embedding + +```agda +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ᵈᵐ Y) + where + + de-morgan-subtype-de-morgan-emb : + de-morgan-subtype (l1 ⊔ l2) Y + pr1 (de-morgan-subtype-de-morgan-emb y) = + fiber (map-de-morgan-emb f) y + pr2 (de-morgan-subtype-de-morgan-emb y) = + is-de-morgan-prop-map-is-de-morgan-emb + ( is-de-morgan-emb-map-de-morgan-emb f) + ( y) + + compute-type-de-morgan-type-de-morgan-emb : + type-de-morgan-subtype + de-morgan-subtype-de-morgan-emb ≃ + X + compute-type-de-morgan-type-de-morgan-emb = + equiv-total-fiber (map-de-morgan-emb f) + + inv-compute-type-de-morgan-type-de-morgan-emb : + X ≃ + type-de-morgan-subtype + de-morgan-subtype-de-morgan-emb + inv-compute-type-de-morgan-type-de-morgan-emb = + inv-equiv-total-fiber (map-de-morgan-emb f) +``` + +## Examples + +### The De Morgan subtypes of left and right elements in a coproduct type + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-de-morgan-is-left : + (x : A + B) → is-de-morgan (is-left x) + is-de-morgan-is-left (inl x) = is-de-morgan-unit + is-de-morgan-is-left (inr x) = is-de-morgan-empty + + is-left-De-Morgan-Prop : + A + B → De-Morgan-Prop lzero + pr1 (is-left-De-Morgan-Prop x) = is-left x + pr1 (pr2 (is-left-De-Morgan-Prop x)) = is-prop-is-left x + pr2 (pr2 (is-left-De-Morgan-Prop x)) = + is-de-morgan-is-left x + + is-de-morgan-is-right : + (x : A + B) → is-de-morgan (is-right x) + is-de-morgan-is-right (inl x) = is-de-morgan-empty + is-de-morgan-is-right (inr x) = is-de-morgan-unit + + is-right-De-Morgan-Prop : + A + B → De-Morgan-Prop lzero + pr1 (is-right-De-Morgan-Prop x) = is-right x + pr1 (pr2 (is-right-De-Morgan-Prop x)) = is-prop-is-right x + pr2 (pr2 (is-right-De-Morgan-Prop x)) = + is-de-morgan-is-right x +``` + +## Properties + +### A De Morgan subtype of a `k+1`-truncated type is `k+1`-truncated + +```agda +module _ + {l1 l2 : Level} (k : 𝕋) {A : UU l1} (P : de-morgan-subtype l2 A) + where + + abstract + is-trunc-type-de-morgan-subtype : + is-trunc (succ-𝕋 k) A → is-trunc (succ-𝕋 k) + (type-de-morgan-subtype P) + is-trunc-type-de-morgan-subtype = + is-trunc-type-subtype k (subtype-de-morgan-subtype P) + +module _ + {l1 l2 : Level} {A : UU l1} (P : de-morgan-subtype l2 A) + where + + abstract + is-prop-type-de-morgan-subtype : + is-prop A → is-prop (type-de-morgan-subtype P) + is-prop-type-de-morgan-subtype = + is-prop-type-subtype (subtype-de-morgan-subtype P) + + abstract + is-set-type-de-morgan-subtype : + is-set A → is-set (type-de-morgan-subtype P) + is-set-type-de-morgan-subtype = + is-set-type-subtype (subtype-de-morgan-subtype P) + + abstract + is-1-type-type-de-morgan-subtype : + is-1-type A → is-1-type (type-de-morgan-subtype P) + is-1-type-type-de-morgan-subtype = + is-1-type-type-subtype (subtype-de-morgan-subtype P) + +prop-de-morgan-subprop : + {l1 l2 : Level} (A : Prop l1) + (P : de-morgan-subtype l2 (type-Prop A)) → + Prop (l1 ⊔ l2) +prop-de-morgan-subprop A P = + prop-subprop A (subtype-de-morgan-subtype P) + +set-de-morgan-subset : + {l1 l2 : Level} (A : Set l1) + (P : de-morgan-subtype l2 (type-Set A)) → + Set (l1 ⊔ l2) +set-de-morgan-subset A P = + set-subset A (subtype-de-morgan-subtype P) +``` + +### The type of De Morgan subtypes of a type is a set + +```agda +is-set-de-morgan-subtype : + {l1 l2 : Level} {X : UU l1} → is-set (de-morgan-subtype l2 X) +is-set-de-morgan-subtype = + is-set-function-type is-set-De-Morgan-Prop +``` + +### Extensionality of the type of De Morgan subtypes + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (P : de-morgan-subtype l2 A) + where + + has-same-elements-de-morgan-subtype : + {l3 : Level} → de-morgan-subtype l3 A → UU (l1 ⊔ l2 ⊔ l3) + has-same-elements-de-morgan-subtype Q = + has-same-elements-subtype + ( subtype-de-morgan-subtype P) + ( subtype-de-morgan-subtype Q) + + extensionality-de-morgan-subtype : + (Q : de-morgan-subtype l2 A) → + (P = Q) ≃ has-same-elements-de-morgan-subtype Q + extensionality-de-morgan-subtype = + extensionality-Π P + ( λ x Q → + ( type-De-Morgan-Prop (P x)) ↔ + ( type-De-Morgan-Prop Q)) + ( λ x Q → extensionality-De-Morgan-Prop (P x) Q) + + has-same-elements-eq-de-morgan-subtype : + (Q : de-morgan-subtype l2 A) → + (P = Q) → has-same-elements-de-morgan-subtype Q + has-same-elements-eq-de-morgan-subtype Q = + map-equiv (extensionality-de-morgan-subtype Q) + + eq-has-same-elements-de-morgan-subtype : + (Q : de-morgan-subtype l2 A) → + has-same-elements-de-morgan-subtype Q → P = Q + eq-has-same-elements-de-morgan-subtype Q = + map-inv-equiv (extensionality-de-morgan-subtype Q) + + refl-extensionality-de-morgan-subtype : + map-equiv (extensionality-de-morgan-subtype P) refl = + (λ x → id , id) + refl-extensionality-de-morgan-subtype = refl +``` + +### The type of De Morgan subtypes of `A` is equivalent to the type of all De Morgan embeddings into a type `A` + +```agda +equiv-Fiber-De-Morgan-Prop : + (l : Level) {l1 : Level} (A : UU l1) → + Σ (UU (l1 ⊔ l)) (λ X → X ↪ᵈᵐ A) ≃ (de-morgan-subtype (l1 ⊔ l) A) +equiv-Fiber-De-Morgan-Prop l A = + ( equiv-Fiber-structure l is-de-morgan-prop A) ∘e + ( equiv-tot + ( λ X → + equiv-tot + ( λ f → + ( inv-distributive-Π-Σ) ∘e + ( equiv-product-left (equiv-is-prop-map-is-emb f))))) +``` diff --git a/src/logic/de-morgan-types.lagda.md b/src/logic/de-morgan-types.lagda.md index a4857dae1d..22feda55f0 100644 --- a/src/logic/de-morgan-types.lagda.md +++ b/src/logic/de-morgan-types.lagda.md @@ -9,6 +9,7 @@ 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 open import foundation.dependent-pair-types @@ -17,17 +18,19 @@ open import foundation.double-negation open import foundation.empty-types open import foundation.evaluation-functions open import foundation.function-types +open import foundation.irrefutable-propositions open import foundation.logical-equivalences open import foundation.negation open import foundation.propositional-truncations +open import foundation.retracts-of-types +open import foundation.unit-type open import foundation.universe-levels open import foundation-core.decidable-propositions +open import foundation-core.equivalences open import foundation-core.propositions open import logic.de-morgans-law - -open import univalent-combinatorics.2-element-types ```
@@ -50,117 +53,309 @@ constructive mathematics. The odd one out is ¬ (P ∧ Q) ⇒ (¬ P) ∨ (¬ Q). ``` -Indeed, this would state that we could constructively deduce from a proof that -neither `P` nor `Q` is true, whether of `P` is false or `Q` is false. This -logical law is what we refer to as [De Morgan's Law](logic.de-morgans-law.md). -If a proposition `P` is such that for every other proposition `Q`, the De Morgan -implication +Indeed, this law would imply that we could constructively decide from a proof +that neither `P` nor `Q` is true, one of `P` and `Q` that is false. This logical +law is what we refer to as [De Morgan's Law](logic.de-morgans-law.md). If a type +`P` is such that for every other type `Q`, the De Morgan implication ```text ¬ (P ∧ Q) ⇒ (¬ P) ∨ (¬ Q) ``` -holds, we say `P` is {{#concept "De Morgan" Disambiguation="proposition"}}. +holds, we say `P` is {{#concept "De Morgan" Disambiguation="type"}}. + +Equivalently, a type is De Morgan iff its negation is decidable. Since this is a +[small](foundation.small-types.md) condition, it is frequently more convenient +to use and is what we take as the main definition. ## Definition -## De Morgan types +### The small condition of being a De Morgan type + +I.e., types whose negation is decidable. + +```agda +module _ + {l : Level} (A : UU l) + where + + is-de-morgan : UU l + is-de-morgan = is-decidable (¬ A) + + is-prop-is-de-morgan : is-prop is-de-morgan + is-prop-is-de-morgan = is-prop-is-decidable is-prop-neg + + is-de-morgan-Prop : Prop l + is-de-morgan-Prop = is-decidable-Prop (neg-type-Prop A) +``` + +### The subuniverse of De Morgan types + +We use the decidability of the negation condition to define the subuniverse of +De Morgan types. + +```agda +De-Morgan-Type : (l : Level) → UU (lsuc l) +De-Morgan-Type l = Σ (UU l) (is-de-morgan) + +module _ + {l : Level} (A : De-Morgan-Type l) + where + + type-De-Morgan-Type : UU l + type-De-Morgan-Type = pr1 A + + is-de-morgan-type-De-Morgan-Type : is-de-morgan type-De-Morgan-Type + is-de-morgan-type-De-Morgan-Type = pr2 A +``` + +### Types that satisfy De Morgan's law ```agda -is-de-morgan-type-Level : +satisfies-de-morgans-law-type-Level : {l1 : Level} (l2 : Level) (A : UU l1) → UU (l1 ⊔ lsuc l2) -is-de-morgan-type-Level l2 A = +satisfies-de-morgans-law-type-Level l2 A = (B : UU l2) → ¬ (A × B) → disjunction-type (¬ A) (¬ B) -is-de-morgan-type : {l1 : Level} (A : UU l1) → UUω -is-de-morgan-type A = +satisfies-de-morgans-law-type : {l1 : Level} (A : UU l1) → UUω +satisfies-de-morgans-law-type A = {l2 : Level} (B : UU l2) → ¬ (A × B) → disjunction-type (¬ A) (¬ B) -is-prop-is-de-morgan-type-Level : - {l1 l2 : Level} {A : UU l1} → is-prop (is-de-morgan-type-Level l2 A) -is-prop-is-de-morgan-type-Level {A = A} = +is-prop-satisfies-de-morgans-law-type-Level : + {l1 l2 : Level} {A : UU l1} → + is-prop (satisfies-de-morgans-law-type-Level l2 A) +is-prop-satisfies-de-morgans-law-type-Level {A = A} = is-prop-Π (λ B → is-prop-Π (λ p → is-prop-disjunction-type (¬ A) (¬ B))) -is-de-morgan-type-Prop : +satisfies-de-morgans-law-type-Prop : {l1 : Level} (l2 : Level) (A : UU l1) → Prop (l1 ⊔ lsuc l2) -is-de-morgan-type-Prop l2 A = - ( is-de-morgan-type-Level l2 A , is-prop-is-de-morgan-type-Level) +satisfies-de-morgans-law-type-Prop l2 A = + ( satisfies-de-morgans-law-type-Level l2 A , + is-prop-satisfies-de-morgans-law-type-Level) ``` -## De Morgan propositions +```agda +satisfies-de-morgans-law-type-Level' : + {l1 : Level} (l2 : Level) (A : UU l1) → UU (l1 ⊔ lsuc l2) +satisfies-de-morgans-law-type-Level' l2 A = + (B : UU l2) → ¬ (B × A) → disjunction-type (¬ B) (¬ A) + +satisfies-de-morgans-law-type' : {l1 : Level} (A : UU l1) → UUω +satisfies-de-morgans-law-type' A = + {l2 : Level} (B : UU l2) → ¬ (B × A) → disjunction-type (¬ B) (¬ A) + +is-prop-satisfies-de-morgans-law-type-Level' : + {l1 l2 : Level} {A : UU l1} → + is-prop (satisfies-de-morgans-law-type-Level' l2 A) +is-prop-satisfies-de-morgans-law-type-Level' {A = A} = + is-prop-Π (λ B → is-prop-Π (λ p → is-prop-disjunction-type (¬ B) (¬ A))) + +satisfies-de-morgans-law-type-Prop' : + {l1 : Level} (l2 : Level) (A : UU l1) → Prop (l1 ⊔ lsuc l2) +satisfies-de-morgans-law-type-Prop' l2 A = + ( satisfies-de-morgans-law-type-Level' l2 A , + is-prop-satisfies-de-morgans-law-type-Level') +``` ## Properties -### If a type is De Morgan then its negation is decidable +### If a type satisfies De Morgan's law then its negation is decidable Indeed, one need only check that `A` and `¬ A` satisfy De Morgan's law, as then -the hypothesis below is just true: +the hypothesis of the implication ```text - ¬ (A ∧ ¬ A) ⇒ ¬ A ∨ ¬¬ A. + ¬ (A ∧ ¬ A) ⇒ ¬ A ∨ ¬¬ A ``` +is true. + ```agda module _ {l : Level} (A : UU l) where - is-decidable-neg-is-de-morgan' : - ({l' : Level} (B : UU l') → ¬ (A × B) → ¬ A + ¬ B) → is-decidable (¬ A) - is-decidable-neg-is-de-morgan' H = H (¬ A) (λ f → pr2 f (pr1 f)) + is-de-morgan-satisfies-de-morgans-law' : + ({l' : Level} (B : UU l') → ¬ (A × B) → ¬ A + ¬ B) → is-de-morgan A + is-de-morgan-satisfies-de-morgans-law' H = H (¬ A) (λ f → pr2 f (pr1 f)) is-merely-decidable-neg-satisfies-de-morgan : - is-de-morgan-type A → is-merely-decidable (¬ A) + satisfies-de-morgans-law-type A → is-merely-decidable (¬ A) is-merely-decidable-neg-satisfies-de-morgan H = H (¬ A) (λ f → pr2 f (pr1 f)) - is-decidable-neg-is-de-morgan : - is-de-morgan-type A → is-decidable (¬ A) - is-decidable-neg-is-de-morgan H = + is-de-morgan-satisfies-de-morgans-law : + satisfies-de-morgans-law-type A → is-de-morgan A + is-de-morgan-satisfies-de-morgans-law H = rec-trunc-Prop ( is-decidable-Prop (neg-type-Prop A)) ( id) ( H (¬ A) (λ f → pr2 f (pr1 f))) ``` -### If the negation of a proposition is decidable then it is De Morgan +### If the negation of a proposition is decidable then it satisfies De Morgan's law ```agda module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} where - is-de-morgan-is-decidable-neg-left : - is-decidable (¬ A) → ¬ (A × B) → ¬ A + ¬ B - is-de-morgan-is-decidable-neg-left (inl na) f = + satisfies-de-morgans-law-is-de-morgan-left : + is-de-morgan A → ¬ (A × B) → ¬ A + ¬ B + satisfies-de-morgans-law-is-de-morgan-left (inl na) f = inl na - is-de-morgan-is-decidable-neg-left (inr nna) f = + satisfies-de-morgans-law-is-de-morgan-left (inr nna) f = inr (λ y → nna (λ x → f (x , y))) - is-de-morgan-is-decidable-neg-right : - is-decidable (¬ B) → ¬ (A × B) → ¬ A + ¬ B - is-de-morgan-is-decidable-neg-right (inl nb) f = + satisfies-de-morgans-law-is-de-morgan-right : + is-de-morgan B → ¬ (A × B) → ¬ A + ¬ B + satisfies-de-morgans-law-is-de-morgan-right (inl nb) f = inr nb - is-de-morgan-is-decidable-neg-right (inr nnb) f = + satisfies-de-morgans-law-is-de-morgan-right (inr nnb) f = inl (λ x → nnb (λ y → f (x , y))) -is-de-morgan-is-decidable-neg : - {l : Level} {A : UU l} → is-decidable (¬ A) → is-de-morgan-type A -is-de-morgan-is-decidable-neg x B q = - unit-trunc-Prop (is-de-morgan-is-decidable-neg-left x q) +satisfies-de-morgans-law-is-de-morgan : + {l : Level} {A : UU l} → is-de-morgan A → satisfies-de-morgans-law-type A +satisfies-de-morgans-law-is-de-morgan x B q = + unit-trunc-Prop (satisfies-de-morgans-law-is-de-morgan-left x q) + +satisfies-de-morgans-law-is-de-morgan' : + {l : Level} {A : UU l} → is-de-morgan A → satisfies-de-morgans-law-type' A +satisfies-de-morgans-law-is-de-morgan' x B q = + unit-trunc-Prop (satisfies-de-morgans-law-is-de-morgan-right x q) + +module _ + {l : Level} (A : De-Morgan-Type l) + where + + satisfies-de-morgans-law-type-De-Morgan-Type : + satisfies-de-morgans-law-type (type-De-Morgan-Type A) + satisfies-de-morgans-law-type-De-Morgan-Type = + satisfies-de-morgans-law-is-de-morgan (is-de-morgan-type-De-Morgan-Type A) + + satisfies-de-morgans-law-type-De-Morgan-Type' : + satisfies-de-morgans-law-type' (type-De-Morgan-Type A) + satisfies-de-morgans-law-type-De-Morgan-Type' = + satisfies-de-morgans-law-is-de-morgan' (is-de-morgan-type-De-Morgan-Type A) ``` ### Decidable types are De Morgan ```agda -is-decidable-neg-is-decidable : - {l : Level} {A : UU l} → is-decidable A → is-decidable (¬ A) -is-decidable-neg-is-decidable (inl x) = inr (intro-double-negation x) -is-decidable-neg-is-decidable (inr x) = inl x - is-de-morgan-is-decidable : - {l : Level} {A : UU l} → is-decidable A → is-de-morgan-type A -is-de-morgan-is-decidable H = - is-de-morgan-is-decidable-neg (is-decidable-neg-is-decidable H) + {l : Level} {A : UU l} → is-decidable A → is-de-morgan A +is-de-morgan-is-decidable (inl x) = inr (intro-double-negation x) +is-de-morgan-is-decidable (inr x) = inl x + +satisfies-de-morgans-law-is-decidable : + {l : Level} {A : UU l} → is-decidable A → satisfies-de-morgans-law-type A +satisfies-de-morgans-law-is-decidable H = + satisfies-de-morgans-law-is-de-morgan (is-de-morgan-is-decidable H) + +satisfies-de-morgans-law-is-decidable' : + {l : Level} {A : UU l} → is-decidable A → satisfies-de-morgans-law-type' A +satisfies-de-morgans-law-is-decidable' H = + satisfies-de-morgans-law-is-de-morgan' (is-de-morgan-is-decidable H) +``` + +### Irrefutable types are De Morgan + +```agda +is-de-morgan-is-irrefutable : + {l : Level} {A : UU l} → ¬¬ A → is-de-morgan A +is-de-morgan-is-irrefutable = inr +``` + +### Contractible types are De Morgan + +```agda +is-de-morgan-is-contr : + {l : Level} {A : UU l} → is-contr A → is-de-morgan A +is-de-morgan-is-contr H = + is-de-morgan-is-irrefutable (intro-double-negation (center H)) + +is-de-morgan-unit : is-de-morgan unit +is-de-morgan-unit = is-de-morgan-is-contr is-contr-unit +``` + +### Empty types are De Morgan + +```agda +is-de-morgan-is-empty : {l : Level} {A : UU l} → is-empty A → is-de-morgan A +is-de-morgan-is-empty = inl + +is-de-morgan-empty : is-de-morgan empty +is-de-morgan-empty = is-de-morgan-is-empty id +``` + +### De Morgan types are closed under logical equivalences + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-de-morgan-iff : + (A → B) → (B → A) → is-de-morgan A → is-de-morgan B + is-de-morgan-iff f g = is-decidable-iff (map-neg g) (map-neg f) + + is-de-morgan-iff' : + (A ↔ B) → is-de-morgan A → is-de-morgan B + is-de-morgan-iff' (f , g) = is-de-morgan-iff f g + + satisfies-de-morgans-law-iff : + (A → B) → (B → A) → + satisfies-de-morgans-law-type A → satisfies-de-morgans-law-type B + satisfies-de-morgans-law-iff f g a = + satisfies-de-morgans-law-is-de-morgan + ( is-de-morgan-iff f g (is-de-morgan-satisfies-de-morgans-law A a)) + + satisfies-de-morgans-law-iff' : + (A ↔ B) → satisfies-de-morgans-law-type A → satisfies-de-morgans-law-type B + satisfies-de-morgans-law-iff' (f , g) = satisfies-de-morgans-law-iff f g +``` + +### De Morgan types are closed under retracts + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} (R : B retract-of A) + where + + is-de-morgan-retract-of : is-de-morgan A → is-de-morgan B + is-de-morgan-retract-of = is-de-morgan-iff' (iff-retract' R) + + is-de-morgan-retract-of' : is-de-morgan B → is-de-morgan A + is-de-morgan-retract-of' = is-de-morgan-iff' (iff-retract R) +``` + +### De Morgan types are closed under equivalences + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) + where + + is-de-morgan-equiv' : is-de-morgan A → is-de-morgan B + is-de-morgan-equiv' = is-de-morgan-iff' (iff-equiv e) + + is-de-morgan-equiv : is-de-morgan B → is-de-morgan A + is-de-morgan-equiv = is-de-morgan-iff' (iff-equiv' e) +``` + +### Products of De Morgan types are De Morgan + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-de-morgan-product : is-de-morgan A → is-de-morgan B → is-de-morgan (A × B) + is-de-morgan-product (inl na) b = + inl (λ ab → na (pr1 ab)) + is-de-morgan-product (inr nna) (inl nb) = + inl (λ ab → nb (pr2 ab)) + is-de-morgan-product (inr nna) (inr nnb) = + inr (is-irrefutable-product nna nnb) ``` ## External links diff --git a/src/logic/de-morgans-law.lagda.md b/src/logic/de-morgans-law.lagda.md index 11b08f7d10..1d3c9cef13 100644 --- a/src/logic/de-morgans-law.lagda.md +++ b/src/logic/de-morgans-law.lagda.md @@ -91,7 +91,7 @@ De-Morgans-Law = {l1 l2 : Level} → De-Morgans-Law-Level l1 l2 ## Properties -### The constructive De Morgan's laws +### The constructively valid De Morgan's laws ```agda module _ diff --git a/src/logic/double-negation-stable-embeddings.lagda.md b/src/logic/double-negation-stable-embeddings.lagda.md index d30725fee5..8fe259345b 100644 --- a/src/logic/double-negation-stable-embeddings.lagda.md +++ b/src/logic/double-negation-stable-embeddings.lagda.md @@ -14,7 +14,6 @@ open import foundation.decidable-maps open import foundation.decidable-propositions open import foundation.decidable-types open import foundation.dependent-pair-types -open import logic.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.embeddings open import foundation.fibers-of-maps @@ -45,6 +44,7 @@ open import foundation-core.injective-maps open import foundation-core.torsorial-type-families open import logic.double-negation-eliminating-maps +open import logic.double-negation-elimination ``` diff --git a/src/logic/double-negation-stable-subtypes.lagda.md b/src/logic/double-negation-stable-subtypes.lagda.md index 48406e7e81..6614510a1b 100644 --- a/src/logic/double-negation-stable-subtypes.lagda.md +++ b/src/logic/double-negation-stable-subtypes.lagda.md @@ -10,7 +10,6 @@ module logic.double-negation-stable-subtypes where open import foundation.1-types open import foundation.coproduct-types open import foundation.dependent-pair-types -open import logic.double-negation-elimination open import foundation.double-negation-stable-propositions open import foundation.equality-dependent-function-types open import foundation.functoriality-cartesian-product-types @@ -36,6 +35,7 @@ open import foundation-core.truncated-types open import foundation-core.truncation-levels open import logic.double-negation-eliminating-maps +open import logic.double-negation-elimination open import logic.double-negation-stable-embeddings ``` diff --git a/src/logic/mutually-de-morgan-families.lagda.md b/src/logic/mutually-de-morgan-families.lagda.md new file mode 100644 index 0000000000..b4547059a8 --- /dev/null +++ b/src/logic/mutually-de-morgan-families.lagda.md @@ -0,0 +1,75 @@ +# Mutually De Morgan families + +```agda +module logic.mutually-de-morgan-families where +``` + +
Imports + +```agda +open import foundation.cartesian-product-types +open import foundation.conjunction +open import foundation.coproduct-types +open import foundation.decidable-types +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.existential-quantification +open import foundation.function-types +open import foundation.logical-equivalences +open import foundation.negation +open import foundation.propositional-truncations +open import foundation.universal-quantification +open import foundation.universe-levels + +open import foundation-core.decidable-propositions +open import foundation-core.propositions + +open import logic.de-morgans-law + +open import univalent-combinatorics.2-element-types +``` + +
+ +## Idea + +A family of types `P : A → 𝒰` is +{{#concept "mutually de morgan" Disambiguation="family of types" Agda=is-mutually-de-morgan-family}} + +if the logical implication + +```text + ∃x, ¬(P x) ⇒ ¬ (∀x, P x) +``` + +has a converse. + +## Definition + +### Mutually De Morgan families + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (P : A → UU l2) + where + + is-mutually-de-morgan-family : UU (l1 ⊔ l2) + is-mutually-de-morgan-family = + ¬ ((x : A) → P x) → exists-structure A (λ x → ¬ P x) + + is-prop-is-mutually-de-morgan-family : is-prop is-mutually-de-morgan-family + is-prop-is-mutually-de-morgan-family = + is-prop-function-type (is-prop-exists-structure A (λ x → ¬ P x)) + + is-mutually-de-morgan-family-Prop : Prop (l1 ⊔ l2) + is-mutually-de-morgan-family-Prop = + ( is-mutually-de-morgan-family , is-prop-is-mutually-de-morgan-family) +``` + +## External links + +- [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) + at $n$Lab diff --git a/src/order-theory/preorders.lagda.md b/src/order-theory/preorders.lagda.md index c2d973fd70..c242eb599f 100644 --- a/src/order-theory/preorders.lagda.md +++ b/src/order-theory/preorders.lagda.md @@ -182,5 +182,9 @@ module _ ( ( A) , ( λ x y → leq-prop-Preorder P (map-equiv e x) (map-equiv e y)) , ( λ x → refl-leq-Preorder P (map-equiv e x)) , - ( λ x y z → transitive-leq-Preorder P (pr1 e x) (pr1 e y) (pr1 e z))) + ( λ x y z → + transitive-leq-Preorder P + ( map-equiv e x) + ( map-equiv e y) + ( map-equiv e z))) ``` diff --git a/src/order-theory/suplattices.lagda.md b/src/order-theory/suplattices.lagda.md index 04dee69608..524983fd18 100644 --- a/src/order-theory/suplattices.lagda.md +++ b/src/order-theory/suplattices.lagda.md @@ -1,6 +1,7 @@ # Suplattices ```agda +{-# OPTIONS --allow-unsolved-metas #-} module order-theory.suplattices where ``` @@ -9,7 +10,10 @@ module order-theory.suplattices where ```agda open import foundation.binary-relations open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-types open import foundation.logical-equivalences +open import foundation.identity-types open import foundation.propositions open import foundation.sets open import foundation.universe-levels @@ -44,13 +48,13 @@ module _ ( λ I → Π-Prop ( I → type-Poset P) - ( λ f → has-least-upper-bound-family-of-elements-Poset-Prop P f)) + ( has-least-upper-bound-family-of-elements-Poset-Prop P)) is-suplattice-Poset : UU (l1 ⊔ l2 ⊔ lsuc l3) is-suplattice-Poset = type-Prop is-suplattice-Poset-Prop - is-prop-suplattice-Poset : is-prop is-suplattice-Poset - is-prop-suplattice-Poset = is-prop-type-Prop is-suplattice-Poset-Prop + is-prop-is-suplattice-Poset : is-prop is-suplattice-Poset + is-prop-is-suplattice-Poset = is-prop-type-Prop is-suplattice-Poset-Prop module _ {l1 l2 l3 : Level} (P : Poset l1 l2) (H : is-suplattice-Poset l3 P) @@ -141,6 +145,60 @@ module _ ( refl-leq-Suplattice (sup-Suplattice x)) ``` +### Resizing the underlying type of a suplattice + +```agda +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} + (P : Suplattice l2 l3 l4) (e : A ≃ type-Suplattice P) + where + + poset-resize-type-Suplattice : Poset l1 l3 + poset-resize-type-Suplattice = + resize-type-Poset (poset-Suplattice P) e + + sup-resize-type-Suplattice : + {I : UU l4} → (I → A) → A + sup-resize-type-Suplattice x = + map-inv-equiv e (sup-Suplattice P (map-equiv e ∘ x)) + + is-least-upper-bound-sup-resize-type-Suplattice : + {I : UU l4} (x : I → A) → + is-least-upper-bound-family-of-elements-Poset poset-resize-type-Suplattice x + ( sup-resize-type-Suplattice x) + is-least-upper-bound-sup-resize-type-Suplattice x u = + ( λ y → + concatenate-eq-leq-Poset + ( poset-Suplattice P) + ( is-section-map-inv-equiv e (sup-Suplattice P (map-equiv e ∘ x))) + ( pr1 + ( is-least-upper-bound-sup-Suplattice P (map-equiv e ∘ x) (map-equiv e u)) + ( y))) , + ( λ v i → + pr2 + ( is-least-upper-bound-sup-Suplattice P + ( map-equiv e ∘ x) + ( map-equiv e u)) + ( concatenate-eq-leq-Poset + ( poset-Suplattice P) + ( inv + ( is-section-map-inv-equiv e + ( sup-Suplattice P (map-equiv e ∘ x)))) + ( v)) + ( i)) + + is-suplattice-resize-type-Suplattice : + is-suplattice-Poset l4 poset-resize-type-Suplattice + is-suplattice-resize-type-Suplattice I x = + ( sup-resize-type-Suplattice x , + is-least-upper-bound-sup-resize-type-Suplattice x) + + resize-type-Suplattice : Suplattice l1 l3 l4 + resize-type-Suplattice = + ( poset-resize-type-Suplattice , + is-suplattice-resize-type-Suplattice) +``` + ## External links - [suplattice](https://ncatlab.org/nlab/show/suplattice) at $n$Lab From d902d6689f7a5210e9b0f4aa5599f0bf9a424804 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 1 Nov 2024 22:03:37 +0100 Subject: [PATCH 43/83] wip resizing orders --- .../order-preserving-maps-preorders.lagda.md | 3 +- src/order-theory/posets.lagda.md | 16 ---- src/order-theory/preorders.lagda.md | 20 ---- src/order-theory/resizing-posets.lagda.md | 87 ++++++++++++++++++ src/order-theory/resizing-preorders.lagda.md | 92 +++++++++++++++++++ src/order-theory/suplattices.lagda.md | 24 +++-- 6 files changed, 192 insertions(+), 50 deletions(-) create mode 100644 src/order-theory/resizing-posets.lagda.md create mode 100644 src/order-theory/resizing-preorders.lagda.md diff --git a/src/order-theory/order-preserving-maps-preorders.lagda.md b/src/order-theory/order-preserving-maps-preorders.lagda.md index 645cdc5ca2..c25b417ad1 100644 --- a/src/order-theory/order-preserving-maps-preorders.lagda.md +++ b/src/order-theory/order-preserving-maps-preorders.lagda.md @@ -17,9 +17,10 @@ open import foundation.identity-types open import foundation.propositions open import foundation.strictly-involutive-identity-types open import foundation.subtype-identity-principle -open import foundation.torsorial-type-families open import foundation.universe-levels +open import foundation-core.torsorial-type-families + open import order-theory.preorders ``` diff --git a/src/order-theory/posets.lagda.md b/src/order-theory/posets.lagda.md index ece056f7a4..e7105e617b 100644 --- a/src/order-theory/posets.lagda.md +++ b/src/order-theory/posets.lagda.md @@ -189,19 +189,3 @@ module _ ``` It remains to show that these constructions form inverses to eachother. - -### Resizing the underlying type of a poset - -```agda -module _ - {l1 l2 l3 : Level} {A : UU l1} - where - - resize-type-Poset : - (P : Poset l2 l3) → A ≃ type-Poset P → Poset l1 l3 - resize-type-Poset P e = - ( resize-type-Preorder (preorder-Poset P) e , - ( λ x y p q → - is-injective-equiv e - ( antisymmetric-leq-Poset P (map-equiv e x) (map-equiv e y) p q))) -``` diff --git a/src/order-theory/preorders.lagda.md b/src/order-theory/preorders.lagda.md index c242eb599f..eedc7c8781 100644 --- a/src/order-theory/preorders.lagda.md +++ b/src/order-theory/preorders.lagda.md @@ -168,23 +168,3 @@ module _ ``` It remains to show that these constructions form inverses to eachother. - -### Resizing the underlying type of a preorder - -```agda -module _ - {l1 l2 l3 : Level} {A : UU l1} - where - - resize-type-Preorder : - (P : Preorder l2 l3) → A ≃ type-Preorder P → Preorder l1 l3 - resize-type-Preorder P e = - ( ( A) , - ( λ x y → leq-prop-Preorder P (map-equiv e x) (map-equiv e y)) , - ( λ x → refl-leq-Preorder P (map-equiv e x)) , - ( λ x y z → - transitive-leq-Preorder P - ( map-equiv e x) - ( map-equiv e y) - ( map-equiv e z))) -``` diff --git a/src/order-theory/resizing-posets.lagda.md b/src/order-theory/resizing-posets.lagda.md new file mode 100644 index 0000000000..865c1d7dc3 --- /dev/null +++ b/src/order-theory/resizing-posets.lagda.md @@ -0,0 +1,87 @@ +# Resizing posets + +```agda +module order-theory.resizing-posets where +``` + +
Imports + +```agda +open import foundation.binary-relations +open import foundation.cartesian-product-types +open import foundation.dependent-pair-types +open import foundation.equivalences +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +open import order-theory.preorders +open import order-theory.resizing-preorders +open import foundation.function-types +open import foundation.identity-types +open import foundation.negated-equality +open import foundation.negation +open import foundation.injective-maps +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels +``` + +
+ +## Idea + +Given a [poset](order-theory.posets.md) `P` on a +[small](foundation.small-types.md) carrier type `X`, then there is an equivalent +{{#concept "resized poset" Agda=resize-type-Poset}} on the small equivalent. + +## Definition + +### Resizing the underlying type of a poset + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} + where + + resize-type-Poset : + (P : Poset l2 l3) → A ≃ type-Poset P → Poset l1 l3 + resize-type-Poset P e = + ( resize-type-Preorder (preorder-Poset P) e , + ( λ x y p q → + is-injective-equiv e + ( antisymmetric-leq-Poset P (map-equiv e x) (map-equiv e y) p q))) +``` + +### The resizing structure equivalence + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} (P : Poset l2 l3) (e : A ≃ type-Poset P) + where + + hom-resize-type-Poset : hom-Poset (resize-type-Poset P e) P + hom-resize-type-Poset = hom-resize-type-Preorder (preorder-Poset P) e + + hom-inv-resize-type-Poset : hom-Poset P (resize-type-Poset P e) + hom-inv-resize-type-Poset = hom-inv-resize-type-Preorder (preorder-Poset P) e + + is-right-inverse-hom-inv-resize-type-Poset : + htpy-hom-Poset P P + ( comp-hom-Poset P (resize-type-Poset P e) P + ( hom-resize-type-Poset) + ( hom-inv-resize-type-Poset)) + ( id-hom-Poset P) + is-right-inverse-hom-inv-resize-type-Poset = + is-right-inverse-hom-inv-resize-type-Preorder (preorder-Poset P) e + + is-left-inverse-hom-inv-resize-type-Poset : + htpy-hom-Poset (resize-type-Poset P e) (resize-type-Poset P e) + ( comp-hom-Poset + ( resize-type-Poset P e) + ( P) + ( resize-type-Poset P e) + ( hom-inv-resize-type-Poset) + ( hom-resize-type-Poset)) + ( id-hom-Poset (resize-type-Poset P e)) + is-left-inverse-hom-inv-resize-type-Poset = + is-left-inverse-hom-inv-resize-type-Preorder (preorder-Poset P) e +``` diff --git a/src/order-theory/resizing-preorders.lagda.md b/src/order-theory/resizing-preorders.lagda.md new file mode 100644 index 0000000000..bff1925ad8 --- /dev/null +++ b/src/order-theory/resizing-preorders.lagda.md @@ -0,0 +1,92 @@ +# Resizing preorders + +```agda +module order-theory.resizing-preorders where +``` + +
Imports + +```agda +open import foundation.binary-relations +open import foundation.cartesian-product-types +open import foundation.dependent-pair-types +open import foundation.equivalences +open import order-theory.order-preserving-maps-preorders +open import order-theory.preorders +open import foundation.function-types +open import foundation.identity-types +open import foundation.negated-equality +open import foundation.negation +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels +``` + +
+ +## Idea + +Given a [preorder](order-theory.preorders.md) `P` on a +[small](foundation.small-types.md) carrier type `X`, then there is an equivalent +{{#concept "resized preorder" Agda=resize-type-Preorder}} on the small +equivalent. + +## Definition + +### Resizing the underlying type of a preorder + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} + where + + resize-type-Preorder : + (P : Preorder l2 l3) → A ≃ type-Preorder P → Preorder l1 l3 + resize-type-Preorder P e = + ( ( A) , + ( λ x y → leq-prop-Preorder P (map-equiv e x) (map-equiv e y)) , + ( λ x → refl-leq-Preorder P (map-equiv e x)) , + ( λ x y z → + transitive-leq-Preorder P + ( map-equiv e x) + ( map-equiv e y) + ( map-equiv e z))) +``` + +### The resizing structure equivalence + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} (P : Preorder l2 l3) (e : A ≃ type-Preorder P) + where + + hom-resize-type-Preorder : hom-Preorder (resize-type-Preorder P e) P + pr1 hom-resize-type-Preorder = map-equiv e + pr2 hom-resize-type-Preorder _ _ = id + + hom-inv-resize-type-Preorder : hom-Preorder P (resize-type-Preorder P e) + pr1 hom-inv-resize-type-Preorder = map-inv-equiv e + pr2 hom-inv-resize-type-Preorder x y v = + concatenate-leq-eq-Preorder P + ( concatenate-eq-leq-Preorder P (is-section-map-inv-equiv e x) v) + ( inv (is-section-map-inv-equiv e y)) + + is-right-inverse-hom-inv-resize-type-Preorder : + htpy-hom-Preorder P P + ( comp-hom-Preorder P (resize-type-Preorder P e) P + ( hom-resize-type-Preorder) + ( hom-inv-resize-type-Preorder)) + ( id-hom-Preorder P) + is-right-inverse-hom-inv-resize-type-Preorder = is-section-map-inv-equiv e + + is-left-inverse-hom-inv-resize-type-Preorder : + htpy-hom-Preorder (resize-type-Preorder P e) (resize-type-Preorder P e) + ( comp-hom-Preorder + ( resize-type-Preorder P e) + ( P) + ( resize-type-Preorder P e) + ( hom-inv-resize-type-Preorder) + ( hom-resize-type-Preorder)) + ( id-hom-Preorder (resize-type-Preorder P e)) + is-left-inverse-hom-inv-resize-type-Preorder = is-retraction-map-inv-equiv e +``` diff --git a/src/order-theory/suplattices.lagda.md b/src/order-theory/suplattices.lagda.md index 524983fd18..b03e22c028 100644 --- a/src/order-theory/suplattices.lagda.md +++ b/src/order-theory/suplattices.lagda.md @@ -12,14 +12,15 @@ open import foundation.binary-relations open import foundation.dependent-pair-types open import foundation.equivalences open import foundation.function-types -open import foundation.logical-equivalences open import foundation.identity-types +open import foundation.logical-equivalences open import foundation.propositions open import foundation.sets open import foundation.universe-levels open import order-theory.least-upper-bounds-posets open import order-theory.posets +open import order-theory.resizing-posets ``` @@ -167,25 +168,22 @@ module _ is-least-upper-bound-family-of-elements-Poset poset-resize-type-Suplattice x ( sup-resize-type-Suplattice x) is-least-upper-bound-sup-resize-type-Suplattice x u = - ( λ y → - concatenate-eq-leq-Poset + ( concatenate-eq-leq-Poset ( poset-Suplattice P) - ( is-section-map-inv-equiv e (sup-Suplattice P (map-equiv e ∘ x))) - ( pr1 - ( is-least-upper-bound-sup-Suplattice P (map-equiv e ∘ x) (map-equiv e u)) - ( y))) , - ( λ v i → - pr2 + ( is-section-map-inv-equiv e (sup-Suplattice P (map-equiv e ∘ x))) ∘ + pr1 + ( is-least-upper-bound-sup-Suplattice P + ( map-equiv e ∘ x) + ( map-equiv e u))) , + ( pr2 ( is-least-upper-bound-sup-Suplattice P ( map-equiv e ∘ x) - ( map-equiv e u)) + ( map-equiv e u)) ∘ ( concatenate-eq-leq-Poset ( poset-Suplattice P) ( inv ( is-section-map-inv-equiv e - ( sup-Suplattice P (map-equiv e ∘ x)))) - ( v)) - ( i)) + ( sup-Suplattice P (map-equiv e ∘ x)))))) is-suplattice-resize-type-Suplattice : is-suplattice-Poset l4 poset-resize-type-Suplattice From 1e6e8bc7d746d8a7e8a8255482a5ad0a755452e4 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Fri, 1 Nov 2024 23:01:22 +0100 Subject: [PATCH 44/83] more lemmas about de morgan embeddings --- src/foundation/decidable-maps.lagda.md | 4 +- .../complements-decidable-subtypes.lagda.md | 2 +- src/logic/de-morgan-embeddings.lagda.md | 106 ++++++------------ src/logic/de-morgan-maps.lagda.md | 31 ++++- src/logic/de-morgan-propositions.lagda.md | 28 +++++ src/order-theory.lagda.md | 2 + src/order-theory/resizing-posets.lagda.md | 11 +- src/order-theory/resizing-preorders.lagda.md | 5 +- 8 files changed, 104 insertions(+), 85 deletions(-) diff --git a/src/foundation/decidable-maps.lagda.md b/src/foundation/decidable-maps.lagda.md index 4af5e26758..d1aaf2c207 100644 --- a/src/foundation/decidable-maps.lagda.md +++ b/src/foundation/decidable-maps.lagda.md @@ -97,8 +97,8 @@ module _ rec-coproduct ( λ u → is-decidable-iff - (λ v → (pr1 v) , ap g (pr2 v) ∙ pr2 u) - (λ w → pr1 w , H (pr2 w ∙ inv (pr2 u))) + ( λ v → (pr1 v) , ap g (pr2 v) ∙ pr2 u) + ( λ w → pr1 w , H (pr2 w ∙ inv (pr2 u))) ( F (pr1 u))) ( λ α → inr (λ t → α (f (pr1 t) , pr2 t))) ( G x) diff --git a/src/logic/complements-decidable-subtypes.lagda.md b/src/logic/complements-decidable-subtypes.lagda.md index 6ea354a422..917714fbde 100644 --- a/src/logic/complements-decidable-subtypes.lagda.md +++ b/src/logic/complements-decidable-subtypes.lagda.md @@ -7,12 +7,12 @@ module logic.complements-decidable-subtypes where
Imports ```agda +open import foundation.complements-subtypes open import foundation.decidable-propositions open import foundation.decidable-subtypes open import foundation.double-negation-stable-propositions open import foundation.full-subtypes open import foundation.negation -open import foundation.complements-subtypes open import foundation.postcomposition-functions open import foundation.powersets open import foundation.propositional-truncations diff --git a/src/logic/de-morgan-embeddings.lagda.md b/src/logic/de-morgan-embeddings.lagda.md index db3672aaef..102b62237e 100644 --- a/src/logic/de-morgan-embeddings.lagda.md +++ b/src/logic/de-morgan-embeddings.lagda.md @@ -288,52 +288,46 @@ abstract ### De Morgan embeddings are closed under composition -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {g : B → C} {f : A → B} where - is-de-morgan-map-comp-is-de-morgan-emb : - is-de-morgan-emb g → + is-de-morgan-map-comp-is-decidable-emb : + is-decidable-emb g → is-de-morgan-map f → is-de-morgan-map (g ∘ f) - is-de-morgan-map-comp-is-de-morgan-emb G F = - is-de-morgan-map-comp - ( is-injective-is-de-morgan-emb G) - ( is-de-morgan-map-is-de-morgan-emb G) + is-de-morgan-map-comp-is-decidable-emb G F = + is-de-morgan-map-comp-is-decidable-map + ( is-injective-is-decidable-emb G) + ( is-decidable-map-is-decidable-emb G) ( F) - is-de-morgan-prop-map-comp : - is-de-morgan-prop-map g → + is-de-morgan-prop-map-comp-is-decidable-prop-map : + is-decidable-prop-map g → is-de-morgan-prop-map f → is-de-morgan-prop-map (g ∘ f) - is-de-morgan-prop-map-comp K H z = + is-de-morgan-prop-map-comp-is-decidable-prop-map K H z = is-de-morgan-prop-equiv ( compute-fiber-comp g f z) ( is-de-morgan-prop-Σ (K z) (H ∘ pr1)) - is-de-morgan-emb-comp : - is-de-morgan-emb g → + is-de-morgan-emb-comp-is-decidable-emb : + is-decidable-emb g → is-de-morgan-emb f → is-de-morgan-emb (g ∘ f) - is-de-morgan-emb-comp K H = + is-de-morgan-emb-comp-is-decidable-emb K H = is-de-morgan-emb-is-de-morgan-prop-map - ( is-de-morgan-prop-map-comp - ( is-de-morgan-prop-map-is-de-morgan-emb K) + ( is-de-morgan-prop-map-comp-is-decidable-prop-map + ( is-decidable-prop-map-is-decidable-emb K) ( is-de-morgan-prop-map-is-de-morgan-emb H)) comp-de-morgan-emb : {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} → - B ↪ᵈᵐ C → A ↪ᵈᵐ B → A ↪ᵈᵐ C + B ↪ᵈ C → A ↪ᵈᵐ B → A ↪ᵈᵐ C comp-de-morgan-emb (g , G) (f , F) = - ( g ∘ f , is-de-morgan-emb-comp G F) - -infixr 15 _∘¬¬_ -_∘¬¬_ : - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} → - B ↪ᵈᵐ C → A ↪ᵈᵐ B → A ↪ᵈᵐ C -_∘¬¬_ = comp-de-morgan-emb + ( g ∘ f , is-de-morgan-emb-comp-is-decidable-emb G F) ``` ### Left cancellation for De Morgan embeddings @@ -350,8 +344,8 @@ module _ is-de-morgan-emb-right-factor' GH G = ( is-emb-right-factor g f G (is-emb-is-de-morgan-emb GH) , is-de-morgan-map-right-factor' - ( is-de-morgan-map-is-de-morgan-emb GH) - ( is-injective-is-emb G)) + ( is-injective-is-emb G) + ( is-de-morgan-map-is-de-morgan-emb GH)) is-de-morgan-emb-right-factor : is-de-morgan-emb (g ∘ f) → @@ -365,20 +359,20 @@ module _ ### In a commuting triangle of maps, if the top and right maps are De Morgan embeddings so is the left map -```text +```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {top : A → B} {left : A → C} {right : B → C} (H : left ~ right ∘ top) where - is-de-morgan-emb-left-map-triangle : + is-de-morgan-emb-left-map-triangle-is-decidable-emb-top : is-de-morgan-emb top → - is-de-morgan-emb right → + is-decidable-emb right → is-de-morgan-emb left - is-de-morgan-emb-left-map-triangle T R = + is-de-morgan-emb-left-map-triangle-is-decidable-emb-top T R = is-de-morgan-emb-htpy H - ( is-de-morgan-emb-comp R T) + ( is-de-morgan-emb-comp-is-decidable-emb R T) ``` ### In a commuting triangle of maps, if the left and right maps are De Morgan embeddings so is the top map @@ -458,32 +452,6 @@ eq-htpy-de-morgan-emb f g = map-inv-is-equiv (is-equiv-htpy-eq-de-morgan-emb f g) ``` -### Precomposing De Morgan embeddings with equivalences - -```text -equiv-precomp-de-morgan-emb-equiv : - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) → - (C : UU l3) → (B ↪ᵈᵐ C) ≃ (A ↪ᵈᵐ C) -equiv-precomp-de-morgan-emb-equiv e C = - equiv-Σ - ( is-de-morgan-emb) - ( equiv-precomp e C) - ( λ g → - equiv-iff-is-prop - ( is-prop-is-de-morgan-emb g) - ( is-prop-is-de-morgan-emb (g ∘ map-equiv e)) - ( λ H → - is-de-morgan-emb-comp H - ( is-de-morgan-emb-is-equiv (pr2 e))) - ( λ d → - is-de-morgan-emb-htpy - ( λ b → ap g (inv (is-section-map-inv-equiv e b))) - ( is-de-morgan-emb-comp - ( d) - ( is-de-morgan-emb-is-equiv - ( is-equiv-map-inv-equiv e))))) -``` - ### Any map out of the empty type is a De Morgan embedding ```agda @@ -497,10 +465,6 @@ de-morgan-emb-ex-falso : {l : Level} {X : UU l} → empty ↪ᵈᵐ X de-morgan-emb-ex-falso = ( ex-falso , is-de-morgan-emb-ex-falso) - --- de-morgan-emb-is-empty : --- {l1 l2 : Level} {A : UU l1} {B : UU l2} → is-empty A → A ↪ᵈᵐ B --- de-morgan-emb-is-empty {A = A} f = ? ``` ### The map on total spaces induced by a family of De Morgan embeddings is a De Morgan embedding @@ -550,40 +514,38 @@ module _ ( is-de-morgan-emb-map-de-morgan-emb f)) ``` -### The functoriality of dependent pair types preserves De Morgan embeddings +### The functoriality of dependent pair types on De Morgan embeddings -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : A → UU l3} (D : B → UU l4) where is-de-morgan-emb-map-Σ : {f : A → B} {g : (x : A) → C x → D (f x)} → - is-de-morgan-emb f → + is-decidable-emb f → ((x : A) → is-de-morgan-emb (g x)) → is-de-morgan-emb (map-Σ D f g) is-de-morgan-emb-map-Σ {f} {g} F G = - is-de-morgan-emb-left-map-triangle + is-de-morgan-emb-left-map-triangle-is-decidable-emb-top ( triangle-map-Σ D f g) ( is-de-morgan-emb-tot G) - ( is-de-morgan-emb-map-Σ-map-base D F) + ( is-decidable-emb-map-Σ-map-base D F) de-morgan-emb-Σ : - (f : A ↪ᵈᵐ B) → - ((x : A) → C x ↪ᵈᵐ D (map-de-morgan-emb f x)) → + (f : A ↪ᵈ B) → + ((x : A) → C x ↪ᵈᵐ D (map-decidable-emb f x)) → Σ A C ↪ᵈᵐ Σ B D de-morgan-emb-Σ f g = - ( ( map-Σ D - ( map-de-morgan-emb f) - ( map-de-morgan-emb ∘ g)) , + ( ( map-Σ D (map-decidable-emb f) (map-de-morgan-emb ∘ g)) , ( is-de-morgan-emb-map-Σ - ( is-de-morgan-emb-map-de-morgan-emb f) + ( is-decidable-emb-map-decidable-emb f) ( is-de-morgan-emb-map-de-morgan-emb ∘ g))) ``` ### Products of De Morgan embeddings are De Morgan embeddings -```text +```agda module _ {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} where diff --git a/src/logic/de-morgan-maps.lagda.md b/src/logic/de-morgan-maps.lagda.md index ca7cc930d6..063f4c8a3c 100644 --- a/src/logic/de-morgan-maps.lagda.md +++ b/src/logic/de-morgan-maps.lagda.md @@ -148,18 +148,43 @@ the right factor `f` is De Morgan. ```agda module _ {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} - (GF : is-de-morgan-map (g ∘ f)) where is-de-morgan-map-right-factor' : - is-injective g → is-de-morgan-map f - is-de-morgan-map-right-factor' H y = + is-injective g → + is-de-morgan-map (g ∘ f) → + is-de-morgan-map f + is-de-morgan-map-right-factor' H GF y = rec-coproduct ( λ ngfy → inl (λ p → ngfy (pr1 p , ap g (pr2 p)))) ( λ nngfy → inr (λ nq → nngfy λ p → nq (pr1 p , H (pr2 p)))) ( GF (g y)) ``` +### Composition of De Morgan maps with decidable maps + +If a composite `g ∘ f` is De Morgan and the left factor `g` is injective, then +the right factor `f` is De Morgan. + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} + where + + is-de-morgan-map-comp-is-decidable-map : + is-injective g → is-decidable-map g → is-de-morgan-map f → + is-de-morgan-map (g ∘ f) + is-de-morgan-map-comp-is-decidable-map H G F y = + rec-coproduct + ( λ u → + is-de-morgan-iff + ( λ v → (pr1 v) , ap g (pr2 v) ∙ pr2 u) + ( λ w → pr1 w , H (pr2 w ∙ inv (pr2 u))) + ( F (pr1 u))) + ( λ ng → inl (λ u → ng (f (pr1 u) , pr2 u))) + ( G y) +``` + ### Any map out of the empty type is De Morgan ```agda diff --git a/src/logic/de-morgan-propositions.lagda.md b/src/logic/de-morgan-propositions.lagda.md index 79f6141aa3..ffdb9a1509 100644 --- a/src/logic/de-morgan-propositions.lagda.md +++ b/src/logic/de-morgan-propositions.lagda.md @@ -31,6 +31,7 @@ open import foundation.propositions open import foundation.retracts-of-types open import foundation.sets open import foundation.subtypes +open import foundation.transport-along-identifications open import foundation.universe-levels open import foundation-core.decidable-propositions @@ -244,6 +245,33 @@ is-de-morgan-prop-is-empty : is-de-morgan-prop-is-empty H = is-prop-is-empty H , is-de-morgan-is-empty H ``` +### Dependent sums of De Morgan propositions over decidable propositions + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} + where + + is-de-morgan-prop-Σ' : + is-decidable-prop A → ((x : A) → is-de-morgan (B x)) → is-de-morgan (Σ A B) + is-de-morgan-prop-Σ' (is-prop-A , inl a) b = + rec-coproduct + ( λ nb → inl λ ab → nb (tr B (eq-is-prop is-prop-A) (pr2 ab))) + ( λ x → inr (λ z → x (λ b → z (a , b)))) + ( b a) + is-de-morgan-prop-Σ' (is-prop-A , inr na) b = inl (λ ab → na (pr1 ab)) + + is-de-morgan-prop-Σ : + is-decidable-prop A → + ((x : A) → is-de-morgan-prop (B x)) → + is-de-morgan-prop (Σ A B) + is-de-morgan-prop-Σ a b = + ( is-prop-Σ + ( is-prop-type-is-decidable-prop a) + ( is-prop-type-is-de-morgan-prop ∘ b)) , + ( is-de-morgan-prop-Σ' a (is-de-morgan-type-is-de-morgan-prop ∘ b)) +``` + ## External links - [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index 718a8cf46d..a1e76d929b 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -102,6 +102,8 @@ open import order-theory.preorders public open import order-theory.principal-lower-sets-large-posets public open import order-theory.principal-upper-sets-large-posets public open import order-theory.reflective-galois-connections-large-posets public +open import order-theory.resizing-posets public +open import order-theory.resizing-preorders 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-order-preserving-maps-large-posets public diff --git a/src/order-theory/resizing-posets.lagda.md b/src/order-theory/resizing-posets.lagda.md index 865c1d7dc3..b707026f4c 100644 --- a/src/order-theory/resizing-posets.lagda.md +++ b/src/order-theory/resizing-posets.lagda.md @@ -11,18 +11,19 @@ open import foundation.binary-relations open import foundation.cartesian-product-types open import foundation.dependent-pair-types open import foundation.equivalences -open import order-theory.order-preserving-maps-posets -open import order-theory.posets -open import order-theory.preorders -open import order-theory.resizing-preorders open import foundation.function-types open import foundation.identity-types +open import foundation.injective-maps open import foundation.negated-equality open import foundation.negation -open import foundation.injective-maps open import foundation.propositions open import foundation.sets open import foundation.universe-levels + +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +open import order-theory.preorders +open import order-theory.resizing-preorders ```
diff --git a/src/order-theory/resizing-preorders.lagda.md b/src/order-theory/resizing-preorders.lagda.md index bff1925ad8..1fb0ab0218 100644 --- a/src/order-theory/resizing-preorders.lagda.md +++ b/src/order-theory/resizing-preorders.lagda.md @@ -11,8 +11,6 @@ open import foundation.binary-relations open import foundation.cartesian-product-types open import foundation.dependent-pair-types open import foundation.equivalences -open import order-theory.order-preserving-maps-preorders -open import order-theory.preorders open import foundation.function-types open import foundation.identity-types open import foundation.negated-equality @@ -20,6 +18,9 @@ open import foundation.negation open import foundation.propositions open import foundation.sets open import foundation.universe-levels + +open import order-theory.order-preserving-maps-preorders +open import order-theory.preorders ``` From 2b169b1837c798662e2318e67d8015a098a84e89 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 12:00:25 +0100 Subject: [PATCH 45/83] propositional resizing --- .../propositional-resizing.lagda.md | 168 +++++++++++++++++- 1 file changed, 161 insertions(+), 7 deletions(-) diff --git a/src/foundation/propositional-resizing.lagda.md b/src/foundation/propositional-resizing.lagda.md index 46d48494aa..4abe732a36 100644 --- a/src/foundation/propositional-resizing.lagda.md +++ b/src/foundation/propositional-resizing.lagda.md @@ -10,7 +10,9 @@ module foundation.propositional-resizing where open import foundation.dependent-pair-types open import foundation.universe-levels +open import foundation-core.equivalences open import foundation-core.propositions +open import foundation-core.small-types open import foundation-core.subtypes ``` @@ -19,20 +21,172 @@ open import foundation-core.subtypes ## Idea We say that a universe `𝒱` satisfies `𝒰`-small -{{#concept "propositional resizing"}} if there is a type `Ω` in `𝒰` -[equipped](foundation.structure.md) with a +{{#concept "propositional resizing" Agda=propositional-resizing-Level}} if there +is a type `Ω` in `𝒰` [equipped](foundation.structure.md) with a [subtype](foundation-core.subtypes.md) `Q` such that for each proposition `P` in `𝒱` there is an element `u : Ω` such that `Q u ≃ P`. Such a type `Ω` is called an `𝒰`-small {{#concept "classifier" Disambiguation="of small subobjects"}} of `𝒱`-small subobjects. -## Definition +## Definitions + +### The predicate on a type of being a subtype classifier of a given universe level + +```agda +is-subtype-classifier : + {l1 l2 : Level} (l3 : Level) → Σ (UU l1) (subtype l2) → UU (l1 ⊔ l2 ⊔ lsuc l3) +is-subtype-classifier l3 Ω = + (P : Prop l3) → Σ (pr1 Ω) (λ u → type-equiv-Prop P (pr2 Ω u)) + +module _ + {l1 l2 l3 : Level} + (Ω : Σ (UU l1) (subtype l2)) (H : is-subtype-classifier l3 Ω) + (P : Prop l3) + where + + object-prop-is-subtype-classifier : pr1 Ω + object-prop-is-subtype-classifier = pr1 (H P) + + prop-is-small-prop-is-subtype-classifier : Prop l2 + prop-is-small-prop-is-subtype-classifier = + pr2 Ω object-prop-is-subtype-classifier + + type-is-small-prop-is-subtype-classifier : UU l2 + type-is-small-prop-is-subtype-classifier = + type-Prop prop-is-small-prop-is-subtype-classifier + + equiv-is-small-prop-is-subtype-classifier : + type-Prop P ≃ type-is-small-prop-is-subtype-classifier + equiv-is-small-prop-is-subtype-classifier = pr2 (H P) + + is-small-prop-is-subtype-classifier : is-small l2 (type-Prop P) + is-small-prop-is-subtype-classifier = + ( type-is-small-prop-is-subtype-classifier , + equiv-is-small-prop-is-subtype-classifier) +``` + +### Propositional resizing between specified universes + +```agda +propositional-resizing-Level' : + (l1 l2 l3 : Level) → UU (lsuc l1 ⊔ lsuc l2 ⊔ lsuc l3) +propositional-resizing-Level' l1 l2 l3 = + Σ (Σ (UU l1) (subtype l2)) (is-subtype-classifier l3) + +propositional-resizing-Level : + (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +propositional-resizing-Level l1 l2 = + propositional-resizing-Level' l1 l1 l2 +``` + +```agda +module _ + {l1 l2 l3 : Level} (ρ : propositional-resizing-Level' l1 l2 l3) + where + + subtype-classifier-propositional-resizing-Level : Σ (UU l1) (subtype l2) + subtype-classifier-propositional-resizing-Level = pr1 ρ + + type-subtype-classifier-propositional-resizing-Level : UU l1 + type-subtype-classifier-propositional-resizing-Level = + pr1 subtype-classifier-propositional-resizing-Level + + is-subtype-classifier-subtype-classifier-propositional-resizing-Level : + is-subtype-classifier l3 subtype-classifier-propositional-resizing-Level + is-subtype-classifier-subtype-classifier-propositional-resizing-Level = pr2 ρ + +module _ + {l1 l2 l3 : Level} (ρ : propositional-resizing-Level' l1 l2 l3) (P : Prop l3) + where + + object-prop-propositional-resizing-Level : + type-subtype-classifier-propositional-resizing-Level ρ + object-prop-propositional-resizing-Level = + object-prop-is-subtype-classifier + ( subtype-classifier-propositional-resizing-Level ρ) + ( is-subtype-classifier-subtype-classifier-propositional-resizing-Level ρ) + ( P) + + prop-is-small-prop-propositional-resizing-Level : Prop l2 + prop-is-small-prop-propositional-resizing-Level = + prop-is-small-prop-is-subtype-classifier + ( subtype-classifier-propositional-resizing-Level ρ) + ( is-subtype-classifier-subtype-classifier-propositional-resizing-Level ρ) + ( P) + + type-is-small-prop-propositional-resizing-Level : UU l2 + type-is-small-prop-propositional-resizing-Level = + type-is-small-prop-is-subtype-classifier + ( subtype-classifier-propositional-resizing-Level ρ) + ( is-subtype-classifier-subtype-classifier-propositional-resizing-Level ρ) + ( P) + + equiv-is-small-prop-propositional-resizing-Level : + type-Prop P ≃ type-is-small-prop-propositional-resizing-Level + equiv-is-small-prop-propositional-resizing-Level = + equiv-is-small-prop-is-subtype-classifier + ( subtype-classifier-propositional-resizing-Level ρ) + ( is-subtype-classifier-subtype-classifier-propositional-resizing-Level ρ) + ( P) + + is-small-prop-propositional-resizing-Level : is-small l2 (type-Prop P) + is-small-prop-propositional-resizing-Level = + is-small-prop-is-subtype-classifier + ( subtype-classifier-propositional-resizing-Level ρ) + ( is-subtype-classifier-subtype-classifier-propositional-resizing-Level ρ) + ( P) +``` + +### The propositional resizing axiom + +```agda +propositional-resizing : UUω +propositional-resizing = (l1 l2 : Level) → propositional-resizing-Level l1 l2 +``` ```agda -propositional-resizing : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) -propositional-resizing l1 l2 = - Σ ( Σ (UU l1) (subtype l1)) - ( λ Ω → (P : Prop l2) → Σ (pr1 Ω) (λ u → type-equiv-Prop (pr2 Ω u) P)) +module _ + (ρ : propositional-resizing) (l1 l2 : Level) + where + + subtype-classifier-propositional-resizing : Σ (UU l1) (subtype l1) + subtype-classifier-propositional-resizing = pr1 (ρ l1 l2) + + type-subtype-classifier-propositional-resizing : UU l1 + type-subtype-classifier-propositional-resizing = + type-subtype-classifier-propositional-resizing-Level (ρ l1 l2) + + is-subtype-classifier-subtype-classifier-propositional-resizing : + is-subtype-classifier l2 subtype-classifier-propositional-resizing + is-subtype-classifier-subtype-classifier-propositional-resizing = + is-subtype-classifier-subtype-classifier-propositional-resizing-Level + ( ρ l1 l2) + +module _ + (ρ : propositional-resizing) (l1 : Level) {l2 : Level} (P : Prop l2) + where + + object-prop-propositional-resizing : + type-subtype-classifier-propositional-resizing ρ l1 l2 + object-prop-propositional-resizing = + object-prop-propositional-resizing-Level (ρ l1 l2) P + + prop-is-small-prop-propositional-resizing : Prop l1 + prop-is-small-prop-propositional-resizing = + prop-is-small-prop-propositional-resizing-Level (ρ l1 l2) P + + type-is-small-prop-propositional-resizing : UU l1 + type-is-small-prop-propositional-resizing = + type-is-small-prop-propositional-resizing-Level (ρ l1 l2) P + + equiv-is-small-prop-propositional-resizing : + type-Prop P ≃ type-is-small-prop-propositional-resizing + equiv-is-small-prop-propositional-resizing = + equiv-is-small-prop-propositional-resizing-Level (ρ l1 l2) P + + is-small-prop-propositional-resizing : is-small l1 (type-Prop P) + is-small-prop-propositional-resizing = + is-small-prop-propositional-resizing-Level (ρ l1 l2) P ``` ## See also From 0bfd3c180fd40de7e59f8839f1ed02f9eb635488 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 12:19:27 +0100 Subject: [PATCH 46/83] resizing suplattices --- .../resizing-suplattices.lagda.md | 90 +++++++++++++++++++ src/order-theory/suplattices.lagda.md | 51 ----------- 2 files changed, 90 insertions(+), 51 deletions(-) create mode 100644 src/order-theory/resizing-suplattices.lagda.md diff --git a/src/order-theory/resizing-suplattices.lagda.md b/src/order-theory/resizing-suplattices.lagda.md new file mode 100644 index 0000000000..9e55d69ca4 --- /dev/null +++ b/src/order-theory/resizing-suplattices.lagda.md @@ -0,0 +1,90 @@ +# Resizing suplattices + +```agda +module order-theory.resizing-suplattices where +``` + +
Imports + +```agda +open import foundation.binary-relations +open import foundation.cartesian-product-types +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.identity-types +open import foundation.injective-maps +open import foundation.negated-equality +open import foundation.negation +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.order-preserving-maps-posets +open import order-theory.least-upper-bounds-posets +open import order-theory.posets +open import order-theory.suplattices +open import order-theory.resizing-posets +``` + +
+ +## Idea + +Given a [suplattice](order-theory.suplattices.md) `P` on a +[small](foundation.small-types.md) carrier type `X`, then there is an equivalent +{{#concept "resized suplattice" Agda=resize-type-Suplattice}} on the small +equivalent. + +## Definitions + +### Resizing the underlying type of a suplattice + +```agda +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} + (P : Suplattice l2 l3 l4) (e : A ≃ type-Suplattice P) + where + + poset-resize-type-Suplattice : Poset l1 l3 + poset-resize-type-Suplattice = + resize-type-Poset (poset-Suplattice P) e + + sup-resize-type-Suplattice : + {I : UU l4} → (I → A) → A + sup-resize-type-Suplattice x = + map-inv-equiv e (sup-Suplattice P (map-equiv e ∘ x)) + + is-least-upper-bound-sup-resize-type-Suplattice : + {I : UU l4} (x : I → A) → + is-least-upper-bound-family-of-elements-Poset poset-resize-type-Suplattice x + ( sup-resize-type-Suplattice x) + is-least-upper-bound-sup-resize-type-Suplattice x u = + ( concatenate-eq-leq-Poset + ( poset-Suplattice P) + ( is-section-map-inv-equiv e (sup-Suplattice P (map-equiv e ∘ x))) ∘ + pr1 + ( is-least-upper-bound-sup-Suplattice P + ( map-equiv e ∘ x) + ( map-equiv e u))) , + ( pr2 + ( is-least-upper-bound-sup-Suplattice P + ( map-equiv e ∘ x) + ( map-equiv e u)) ∘ + ( concatenate-eq-leq-Poset + ( poset-Suplattice P) + ( inv + ( is-section-map-inv-equiv e + ( sup-Suplattice P (map-equiv e ∘ x)))))) + + is-suplattice-resize-type-Suplattice : + is-suplattice-Poset l4 poset-resize-type-Suplattice + is-suplattice-resize-type-Suplattice I x = + ( sup-resize-type-Suplattice x , + is-least-upper-bound-sup-resize-type-Suplattice x) + + resize-type-Suplattice : Suplattice l1 l3 l4 + resize-type-Suplattice = + ( poset-resize-type-Suplattice , + is-suplattice-resize-type-Suplattice) +``` diff --git a/src/order-theory/suplattices.lagda.md b/src/order-theory/suplattices.lagda.md index b03e22c028..39798602b1 100644 --- a/src/order-theory/suplattices.lagda.md +++ b/src/order-theory/suplattices.lagda.md @@ -146,57 +146,6 @@ module _ ( refl-leq-Suplattice (sup-Suplattice x)) ``` -### Resizing the underlying type of a suplattice - -```agda -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} - (P : Suplattice l2 l3 l4) (e : A ≃ type-Suplattice P) - where - - poset-resize-type-Suplattice : Poset l1 l3 - poset-resize-type-Suplattice = - resize-type-Poset (poset-Suplattice P) e - - sup-resize-type-Suplattice : - {I : UU l4} → (I → A) → A - sup-resize-type-Suplattice x = - map-inv-equiv e (sup-Suplattice P (map-equiv e ∘ x)) - - is-least-upper-bound-sup-resize-type-Suplattice : - {I : UU l4} (x : I → A) → - is-least-upper-bound-family-of-elements-Poset poset-resize-type-Suplattice x - ( sup-resize-type-Suplattice x) - is-least-upper-bound-sup-resize-type-Suplattice x u = - ( concatenate-eq-leq-Poset - ( poset-Suplattice P) - ( is-section-map-inv-equiv e (sup-Suplattice P (map-equiv e ∘ x))) ∘ - pr1 - ( is-least-upper-bound-sup-Suplattice P - ( map-equiv e ∘ x) - ( map-equiv e u))) , - ( pr2 - ( is-least-upper-bound-sup-Suplattice P - ( map-equiv e ∘ x) - ( map-equiv e u)) ∘ - ( concatenate-eq-leq-Poset - ( poset-Suplattice P) - ( inv - ( is-section-map-inv-equiv e - ( sup-Suplattice P (map-equiv e ∘ x)))))) - - is-suplattice-resize-type-Suplattice : - is-suplattice-Poset l4 poset-resize-type-Suplattice - is-suplattice-resize-type-Suplattice I x = - ( sup-resize-type-Suplattice x , - is-least-upper-bound-sup-resize-type-Suplattice x) - - resize-type-Suplattice : Suplattice l1 l3 l4 - resize-type-Suplattice = - ( poset-resize-type-Suplattice , - is-suplattice-resize-type-Suplattice) -``` - ## External links - [suplattice](https://ncatlab.org/nlab/show/suplattice) at $n$Lab From 6806b9e6512fc03189bf9cfe34180f8854c849d9 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 12:19:37 +0100 Subject: [PATCH 47/83] pre-commit --- src/order-theory/resizing-suplattices.lagda.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/order-theory/resizing-suplattices.lagda.md b/src/order-theory/resizing-suplattices.lagda.md index 9e55d69ca4..01af236a32 100644 --- a/src/order-theory/resizing-suplattices.lagda.md +++ b/src/order-theory/resizing-suplattices.lagda.md @@ -20,11 +20,11 @@ open import foundation.propositions open import foundation.sets open import foundation.universe-levels -open import order-theory.order-preserving-maps-posets open import order-theory.least-upper-bounds-posets +open import order-theory.order-preserving-maps-posets open import order-theory.posets -open import order-theory.suplattices open import order-theory.resizing-posets +open import order-theory.suplattices ``` From f603862a72823400daa63ee175b2768016d997cb Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 12:53:45 +0100 Subject: [PATCH 48/83] supremum preserving maps posets --- src/order-theory.lagda.md | 2 + .../supremum-preserving-maps-posets.lagda.md | 243 ++++++++++++++++++ 2 files changed, 245 insertions(+) create mode 100644 src/order-theory/supremum-preserving-maps-posets.lagda.md diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index a1e76d929b..fa75687ce7 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -104,6 +104,7 @@ open import order-theory.principal-upper-sets-large-posets public open import order-theory.reflective-galois-connections-large-posets public open import order-theory.resizing-posets public 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-order-preserving-maps-large-posets public @@ -111,6 +112,7 @@ open import order-theory.similarity-of-order-preserving-maps-large-preorders pub open import order-theory.subposets public open import order-theory.subpreorders public open import order-theory.suplattices public +open import order-theory.supremum-preserving-maps-posets public open import order-theory.top-elements-large-posets public open import order-theory.top-elements-posets public open import order-theory.top-elements-preorders public diff --git a/src/order-theory/supremum-preserving-maps-posets.lagda.md b/src/order-theory/supremum-preserving-maps-posets.lagda.md new file mode 100644 index 0000000000..78600c4807 --- /dev/null +++ b/src/order-theory/supremum-preserving-maps-posets.lagda.md @@ -0,0 +1,243 @@ +# Supremum preserving maps on posets + +```agda +module order-theory.supremum-preserving-maps-posets where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.fundamental-theorem-of-identity-types +open import foundation.homotopies +open import foundation.homotopy-induction +open import foundation.identity-types +open import foundation.propositions +open import foundation.strictly-involutive-identity-types +open import foundation.subtype-identity-principle +open import foundation.torsorial-type-families +open import foundation.universe-levels + +open import order-theory.least-upper-bounds-posets +open import order-theory.posets +``` + +
+ +## Idea + +A map `f : P → Q` between the underlying types of two +[posets](order-theory.posets.md) is said to be +{{#concept "supremum preserving" Disambiguation="map of posets" Agda=preserves-suprema-Poset}} + +```text + f(⋃ᵢxᵢ) = ⋃ᵢf(xᵢ) +``` + +for every family `x₍₋₎ : I → P` with a supremum in `P`. + +## Definition + +### Supremum preserving maps + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + preserves-suprema-Poset : + (l5 : Level) → (type-Poset P → type-Poset Q) → + UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) + preserves-suprema-Poset l5 f = + {I : UU l5} (x : I → type-Poset P) + (y : has-least-upper-bound-family-of-elements-Poset P x) → + is-least-upper-bound-family-of-elements-Poset Q (f ∘ x) (f (pr1 y)) + + is-prop-preserves-suprema-Poset : + {l5 : Level} (f : type-Poset P → type-Poset Q) → + is-prop (preserves-suprema-Poset l5 f) + is-prop-preserves-suprema-Poset f = + is-prop-implicit-Π + ( λ I → + is-prop-Π + ( λ x → + is-prop-Π + ( λ y → + is-prop-is-least-upper-bound-family-of-elements-Poset Q + ( f ∘ x) + ( f (pr1 y))))) + + preserves-suprema-prop-Poset : + (l5 : Level) → + (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) + preserves-suprema-prop-Poset l5 f = + preserves-suprema-Poset l5 f , (is-prop-preserves-suprema-Poset f) + + -- preserves-suprema-Poset : + -- (type-Poset P → type-Poset Q) → UU {! !} + -- preserves-suprema-Poset f = + -- type-Prop (preserves-suprema-prop-Poset f) + + hom-sup-Poset : (l5 : Level) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) + hom-sup-Poset l5 = + Σ (type-Poset P → type-Poset Q) (preserves-suprema-Poset l5) + + map-hom-sup-Poset : + {l5 : Level} → hom-sup-Poset l5 → type-Poset P → type-Poset Q + map-hom-sup-Poset = pr1 + + preserves-suprema-map-hom-sup-Poset : + {l5 : Level} (f : hom-sup-Poset l5) → + preserves-suprema-Poset l5 (map-hom-sup-Poset f) + preserves-suprema-map-hom-sup-Poset = pr2 + + sup-map-hom-sup-Poset : + {l5 : Level} (f : hom-sup-Poset l5) → + {I : UU l5} {x : I → type-Poset P} → + has-least-upper-bound-family-of-elements-Poset P x → + has-least-upper-bound-family-of-elements-Poset Q (map-hom-sup-Poset f ∘ x) + sup-map-hom-sup-Poset f {x = x} y = + ( map-hom-sup-Poset f (pr1 y) , preserves-suprema-map-hom-sup-Poset f x y) +``` + +### Homotopies of supremum preserving maps + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + htpy-hom-sup-Poset : (f g : hom-sup-Poset P Q l5) → UU (l1 ⊔ l3) + htpy-hom-sup-Poset f g = map-hom-sup-Poset P Q f ~ map-hom-sup-Poset P Q g + + refl-htpy-hom-sup-Poset : (f : hom-sup-Poset P Q l5) → htpy-hom-sup-Poset f f + refl-htpy-hom-sup-Poset f = refl-htpy + + htpy-eq-hom-sup-Poset : + (f g : hom-sup-Poset P Q l5) → f = g → htpy-hom-sup-Poset f g + htpy-eq-hom-sup-Poset f .f refl = refl-htpy-hom-sup-Poset f + + is-torsorial-htpy-hom-sup-Poset : + (f : hom-sup-Poset P Q l5) → is-torsorial (htpy-hom-sup-Poset f) + is-torsorial-htpy-hom-sup-Poset f = + is-torsorial-Eq-subtype + ( is-torsorial-htpy (map-hom-sup-Poset P Q f)) + ( is-prop-preserves-suprema-Poset P Q) + ( map-hom-sup-Poset P Q f) + ( refl-htpy) + ( preserves-suprema-map-hom-sup-Poset P Q f) + + is-equiv-htpy-eq-hom-sup-Poset : + (f g : hom-sup-Poset P Q l5) → is-equiv (htpy-eq-hom-sup-Poset f g) + is-equiv-htpy-eq-hom-sup-Poset f = + fundamental-theorem-id + ( is-torsorial-htpy-hom-sup-Poset f) + ( htpy-eq-hom-sup-Poset f) + + extensionality-hom-sup-Poset : + (f g : hom-sup-Poset P Q l5) → (f = g) ≃ htpy-hom-sup-Poset f g + pr1 (extensionality-hom-sup-Poset f g) = htpy-eq-hom-sup-Poset f g + pr2 (extensionality-hom-sup-Poset f g) = is-equiv-htpy-eq-hom-sup-Poset f g + + eq-htpy-hom-sup-Poset : + (f g : hom-sup-Poset P Q l5) → htpy-hom-sup-Poset f g → f = g + eq-htpy-hom-sup-Poset f g = + map-inv-is-equiv (is-equiv-htpy-eq-hom-sup-Poset f g) +``` + +### The identity supremum preserving map + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) + where + + preserves-suprema-id-Poset : + {l3 : Level} → preserves-suprema-Poset P P l3 (id {A = type-Poset P}) + preserves-suprema-id-Poset x y = pr2 y + + id-hom-sup-Poset : (l3 : Level) → hom-sup-Poset P P l3 + id-hom-sup-Poset l3 = id , preserves-suprema-id-Poset +``` + +### Composing supremum preserving maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 l7 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) (R : Poset l5 l6) + where + + preserves-suprema-comp-Poset : + (g : hom-sup-Poset Q R l7) (f : hom-sup-Poset P Q l7) → + preserves-suprema-Poset P R l7 + ( map-hom-sup-Poset Q R g ∘ map-hom-sup-Poset P Q f) + preserves-suprema-comp-Poset g f x y H = + preserves-suprema-map-hom-sup-Poset Q R g + ( map-hom-sup-Poset P Q f ∘ x) + ( sup-map-hom-sup-Poset P Q f y) + ( H) + + comp-hom-sup-Poset : + (g : hom-sup-Poset Q R l7) (f : hom-sup-Poset P Q l7) → + hom-sup-Poset P R l7 + comp-hom-sup-Poset g f = + map-hom-sup-Poset Q R g ∘ map-hom-sup-Poset P Q f , + preserves-suprema-comp-Poset g f +``` + +### Unit laws for composition of supremum preserving maps + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + left-unit-law-comp-hom-sup-Poset : + (f : hom-sup-Poset P Q l5) → + ( comp-hom-sup-Poset P Q Q (id-hom-sup-Poset Q l5) f) = f + left-unit-law-comp-hom-sup-Poset f = + eq-htpy-hom-sup-Poset P Q + ( comp-hom-sup-Poset P Q Q (id-hom-sup-Poset Q l5) f) + ( f) + ( refl-htpy) + + right-unit-law-comp-hom-sup-Poset : + (f : hom-sup-Poset P Q l5) → + (comp-hom-sup-Poset P P Q f (id-hom-sup-Poset P l5)) = f + right-unit-law-comp-hom-sup-Poset f = + eq-htpy-hom-sup-Poset P Q + ( comp-hom-sup-Poset P P Q f (id-hom-sup-Poset P l5)) + ( f) + ( refl-htpy) +``` + +### Associativity of composition of supremum preserving maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 l7 l8 l9 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) + (R : Poset l5 l6) (S : Poset l7 l8) + (h : hom-sup-Poset R S l9) + (g : hom-sup-Poset Q R l9) + (f : hom-sup-Poset P Q l9) + where + + associative-comp-hom-sup-Poset : + comp-hom-sup-Poset P Q S (comp-hom-sup-Poset Q R S h g) f = + comp-hom-sup-Poset P R S h (comp-hom-sup-Poset P Q R g f) + associative-comp-hom-sup-Poset = + eq-htpy-hom-sup-Poset P S + ( comp-hom-sup-Poset P Q S (comp-hom-sup-Poset Q R S h g) f) + ( comp-hom-sup-Poset P R S h (comp-hom-sup-Poset P Q R g f)) + ( refl-htpy) + + involutive-eq-associative-comp-hom-sup-Poset : + comp-hom-sup-Poset P Q S (comp-hom-sup-Poset Q R S h g) f =ⁱ + comp-hom-sup-Poset P R S h (comp-hom-sup-Poset P Q R g f) + involutive-eq-associative-comp-hom-sup-Poset = + involutive-eq-eq associative-comp-hom-sup-Poset +``` From 3f4940e5355d74469702d7c44aff8790b3fd9f6a Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 12:55:50 +0100 Subject: [PATCH 49/83] deduplicate domain theory --- src/domain-theory.lagda.md | 1 + .../directed-complete-posets.lagda.md | 7 ++-- .../directed-families.lagda.md | 2 +- src/order-theory.lagda.md | 2 - .../directed-complete-posets.lagda.md | 40 ------------------- 5 files changed, 6 insertions(+), 46 deletions(-) rename src/{order-theory => domain-theory}/directed-families.lagda.md (98%) delete mode 100644 src/order-theory/directed-complete-posets.lagda.md diff --git a/src/domain-theory.lagda.md b/src/domain-theory.lagda.md index 049ed9a726..0002dd1cc8 100644 --- a/src/domain-theory.lagda.md +++ b/src/domain-theory.lagda.md @@ -4,4 +4,5 @@ module domain-theory where open import domain-theory.directed-complete-posets public +open import domain-theory.directed-families public ``` diff --git a/src/domain-theory/directed-complete-posets.lagda.md b/src/domain-theory/directed-complete-posets.lagda.md index dcf3216dd9..7b305444eb 100644 --- a/src/domain-theory/directed-complete-posets.lagda.md +++ b/src/domain-theory/directed-complete-posets.lagda.md @@ -7,6 +7,8 @@ module domain-theory.directed-complete-posets where
Imports ```agda +open import domain-theory.directed-families + open import foundation.binary-relations open import foundation.dependent-pair-types open import foundation.equivalences @@ -16,7 +18,6 @@ open import foundation.propositions open import foundation.sets open import foundation.universe-levels -open import order-theory.directed-families open import order-theory.least-upper-bounds-posets open import order-theory.posets ``` @@ -27,7 +28,7 @@ open import order-theory.posets A {{#concept "directed complete poset" Agda=Directed-Complete-Poset}} is a [poset](order-theory.posets.md) such that all -[directed families](order-theory.directed-families.md) have +[directed families](domain-theory.directed-families.md) have [least upper bounds](order-theory.least-upper-bounds-posets.md). ## Definitions @@ -70,7 +71,7 @@ module _ is-least-upper-bound-sup-is-directed-complete-Poset F = pr2 (H F) ``` -### Suplattices +### Directed complete posets ```agda Directed-Complete-Poset : diff --git a/src/order-theory/directed-families.lagda.md b/src/domain-theory/directed-families.lagda.md similarity index 98% rename from src/order-theory/directed-families.lagda.md rename to src/domain-theory/directed-families.lagda.md index c012788258..5a18b352ae 100644 --- a/src/order-theory/directed-families.lagda.md +++ b/src/domain-theory/directed-families.lagda.md @@ -1,7 +1,7 @@ # Directed families in posets ```agda -module order-theory.directed-families where +module domain-theory.directed-families where ```
Imports diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index fa75687ce7..2f88f8950e 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -28,8 +28,6 @@ open import order-theory.dependent-products-large-meet-semilattices public open import order-theory.dependent-products-large-posets public open import order-theory.dependent-products-large-preorders public open import order-theory.dependent-products-large-suplattices public -open import order-theory.directed-complete-posets public -open import order-theory.directed-families public open import order-theory.distributive-lattices public open import order-theory.finite-coverings-locales public open import order-theory.finite-posets public diff --git a/src/order-theory/directed-complete-posets.lagda.md b/src/order-theory/directed-complete-posets.lagda.md deleted file mode 100644 index 8f4cf11c56..0000000000 --- a/src/order-theory/directed-complete-posets.lagda.md +++ /dev/null @@ -1,40 +0,0 @@ -# Directed complete posets - -```agda -module order-theory.directed-complete-posets where -``` - -
Imports - -```agda -open import foundation.propositions -open import foundation.subtypes -open import foundation.universe-levels - -open import order-theory.directed-families -open import order-theory.least-upper-bounds-posets -open import order-theory.posets -``` - -
- -## Idea - -A **DCPO**, i.e., a **directed complete partially ordered set**, is a poset in -which each directed family of elements has a least upper bound. - -## Definition - -```agda -is-directed-complete-Poset-Prop : - {l1 l2 : Level} (l3 : Level) (P : Poset l1 l2) → Prop (l1 ⊔ l2 ⊔ lsuc l3) -is-directed-complete-Poset-Prop l3 P = - Π-Prop - ( directed-family-Poset l3 P) - ( λ x → - has-least-upper-bound-family-of-elements-Poset-Prop P - ( family-directed-family-Poset P x)) - -DCPO : (l1 l2 l3 : Level) → UU (lsuc l1 ⊔ lsuc l2 ⊔ lsuc l3) -DCPO l1 l2 l3 = type-subtype (is-directed-complete-Poset-Prop {l1} {l2} l3) -``` From 43baf83fa6322dfe4b00c4ef4744682eeda287c0 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 19:09:07 +0100 Subject: [PATCH 50/83] lemmas supremum preserving maps of posets --- src/domain-theory.lagda.md | 2 +- .../directed-complete-posets.lagda.md | 9 +- ...a.md => directed-families-posets.lagda.md} | 10 +- src/foundation/booleans.lagda.md | 14 +- .../least-upper-bounds-posets.lagda.md | 64 +++++++++ .../supremum-preserving-maps-posets.lagda.md | 128 ++++++++++++++---- 6 files changed, 188 insertions(+), 39 deletions(-) rename src/domain-theory/{directed-families.lagda.md => directed-families-posets.lagda.md} (94%) diff --git a/src/domain-theory.lagda.md b/src/domain-theory.lagda.md index 0002dd1cc8..56636fc4f5 100644 --- a/src/domain-theory.lagda.md +++ b/src/domain-theory.lagda.md @@ -4,5 +4,5 @@ module domain-theory where open import domain-theory.directed-complete-posets public -open import domain-theory.directed-families public +open import domain-theory.directed-families-posets public ``` diff --git a/src/domain-theory/directed-complete-posets.lagda.md b/src/domain-theory/directed-complete-posets.lagda.md index 7b305444eb..ed9c11d0be 100644 --- a/src/domain-theory/directed-complete-posets.lagda.md +++ b/src/domain-theory/directed-complete-posets.lagda.md @@ -7,7 +7,7 @@ module domain-theory.directed-complete-posets where
Imports ```agda -open import domain-theory.directed-families +open import domain-theory.directed-families-posets open import foundation.binary-relations open import foundation.dependent-pair-types @@ -26,9 +26,10 @@ open import order-theory.posets ## Idea -A {{#concept "directed complete poset" Agda=Directed-Complete-Poset}} is a -[poset](order-theory.posets.md) such that all -[directed families](domain-theory.directed-families.md) have +A +{{#concept "directed complete poset" WD="complete partial order" WDID=Q3082805 Agda=Directed-Complete-Poset}} +is a [poset](order-theory.posets.md) such that all +[directed families](domain-theory.directed-families-posets.md) have [least upper bounds](order-theory.least-upper-bounds-posets.md). ## Definitions diff --git a/src/domain-theory/directed-families.lagda.md b/src/domain-theory/directed-families-posets.lagda.md similarity index 94% rename from src/domain-theory/directed-families.lagda.md rename to src/domain-theory/directed-families-posets.lagda.md index 5a18b352ae..2d6f7fd501 100644 --- a/src/domain-theory/directed-families.lagda.md +++ b/src/domain-theory/directed-families-posets.lagda.md @@ -1,7 +1,7 @@ # Directed families in posets ```agda -module domain-theory.directed-families where +module domain-theory.directed-families-posets where ```
Imports @@ -31,7 +31,9 @@ that for any two elements `i j : I` there [exists](foundaiton.existential-quantification.md) an element `k : I` such that both `x i ≤ x k` and `x j ≤ x k` hold. -## Definition +## Definitions + +### The predicate on a family of being directed ```agda is-directed-family-Poset-Prop : @@ -52,7 +54,11 @@ is-directed-family-Poset : {l1 l2 l3 : Level} (P : Poset l1 l2) (I : Inhabited-Type l3) (α : type-Inhabited-Type I → type-Poset P) → UU (l2 ⊔ l3) is-directed-family-Poset P I x = type-Prop (is-directed-family-Poset-Prop P I x) +``` +### The type of directed families in a poset + +```agda directed-family-Poset : {l1 l2 : Level} (l3 : Level) → Poset l1 l2 → UU (l1 ⊔ l2 ⊔ lsuc l3) directed-family-Poset l3 P = diff --git a/src/foundation/booleans.lagda.md b/src/foundation/booleans.lagda.md index d5cd5b1222..a0fff548b5 100644 --- a/src/foundation/booleans.lagda.md +++ b/src/foundation/booleans.lagda.md @@ -65,6 +65,17 @@ module _ ind-bool pt pf false = pf ``` +### The recursion principle of the booleans + +```agda +module _ + {l : Level} {P : UU l} + where + + rec-bool : P → P → bool → P + rec-bool = ind-bool (λ _ → P) +``` + ### The `if_then_else` function ```agda @@ -73,8 +84,7 @@ module _ where if_then_else_ : bool → A → A → A - if true then x else y = x - if false then x else y = y + if b then x else y = rec-bool x y b ``` ### Raising universe levels of the booleans diff --git a/src/order-theory/least-upper-bounds-posets.lagda.md b/src/order-theory/least-upper-bounds-posets.lagda.md index fcb1b4a1f7..9b259bb0c4 100644 --- a/src/order-theory/least-upper-bounds-posets.lagda.md +++ b/src/order-theory/least-upper-bounds-posets.lagda.md @@ -8,10 +8,13 @@ module order-theory.least-upper-bounds-posets where ```agda open import foundation.action-on-identifications-functions +open import foundation.booleans open import foundation.dependent-pair-types +open import foundation.function-types open import foundation.identity-types open import foundation.logical-equivalences open import foundation.propositions +open import foundation.raising-universe-levels open import foundation.subtypes open import foundation.universe-levels @@ -289,3 +292,64 @@ module _ ( x , H) ( y , K)) ``` + +## Properties + +### Binary least upper bounds as least upper bounds of families + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) (a b : type-Poset P) + (H : has-least-binary-upper-bound-Poset P a b) + where + + family-of-elements-has-least-binary-upper-bound-Poset : + bool → type-Poset P + family-of-elements-has-least-binary-upper-bound-Poset = rec-bool a b + + least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset : + type-Poset P + least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset = + pr1 H + + is-least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset : + is-least-upper-bound-family-of-elements-Poset P + ( family-of-elements-has-least-binary-upper-bound-Poset) + ( least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset) + is-least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset x = + ( λ f → pr1 (pr2 H x) (f true , f false)) , + ( λ u → + ind-bool + ( λ z → + leq-Poset P + ( family-of-elements-has-least-binary-upper-bound-Poset z) + ( x)) + ( pr1 (pr2 (pr2 H x) u)) + ( pr2 (pr2 (pr2 H x) u))) + + has-least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset : + has-least-upper-bound-family-of-elements-Poset P + ( family-of-elements-has-least-binary-upper-bound-Poset) + has-least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset = + least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset , + is-least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset +``` + +### if $a ≤ b$ then $b$ is the least binary upper bound of $a$ and $b$ + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) (a b : type-Poset P) (p : leq-Poset P a b) + where + + is-least-binary-upper-bound-leq-Poset : + is-least-binary-upper-bound-Poset P a b b + is-least-binary-upper-bound-leq-Poset x = + ( λ f → pr2 f) , + ( λ f → transitive-leq-Poset P a b x f p , f) + + has-least-binary-upper-bound-leq-Poset : + has-least-binary-upper-bound-Poset P a b + has-least-binary-upper-bound-leq-Poset = + ( b , is-least-binary-upper-bound-leq-Poset) +``` diff --git a/src/order-theory/supremum-preserving-maps-posets.lagda.md b/src/order-theory/supremum-preserving-maps-posets.lagda.md index 78600c4807..4b6f8bff58 100644 --- a/src/order-theory/supremum-preserving-maps-posets.lagda.md +++ b/src/order-theory/supremum-preserving-maps-posets.lagda.md @@ -7,20 +7,25 @@ module order-theory.supremum-preserving-maps-posets where
Imports ```agda +open import foundation.booleans open import foundation.dependent-pair-types open import foundation.equivalences +open import foundation.evaluation-functions open import foundation.function-types open import foundation.fundamental-theorem-of-identity-types open import foundation.homotopies open import foundation.homotopy-induction open import foundation.identity-types open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.small-types open import foundation.strictly-involutive-identity-types open import foundation.subtype-identity-principle open import foundation.torsorial-type-families open import foundation.universe-levels open import order-theory.least-upper-bounds-posets +open import order-theory.order-preserving-maps-posets open import order-theory.posets ``` @@ -30,15 +35,44 @@ open import order-theory.posets A map `f : P → Q` between the underlying types of two [posets](order-theory.posets.md) is said to be -{{#concept "supremum preserving" Disambiguation="map of posets" Agda=preserves-suprema-Poset}} +{{#concept "supremum preserving" Disambiguation="map of posets" Agda=preserves-suprema-map-Poset}} ```text f(⋃ᵢxᵢ) = ⋃ᵢf(xᵢ) ``` -for every family `x₍₋₎ : I → P` with a supremum in `P`. +for every family `x₍₋₎ : I → P` with a +[supremum](order-theory.least-upper-bounds-posets.md) in `P`. -## Definition +## Definitions + +### The predicate of preserving a supremum + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + (f : type-Poset P → type-Poset Q) + {I : UU l5} (x : I → type-Poset P) + where + + preserves-supremum-map-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5) + preserves-supremum-map-Poset = + (y : has-least-upper-bound-family-of-elements-Poset P x) → + is-least-upper-bound-family-of-elements-Poset Q (f ∘ x) (f (pr1 y)) + + is-prop-preserves-supremum-map-Poset : + is-prop preserves-supremum-map-Poset + is-prop-preserves-supremum-map-Poset = + is-prop-Π + ( λ y → + is-prop-is-least-upper-bound-family-of-elements-Poset Q + ( f ∘ x) + ( f (pr1 y))) + + preserves-supremum-prop-map-Poset : Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5) + preserves-supremum-prop-map-Poset = + preserves-supremum-map-Poset , is-prop-preserves-supremum-map-Poset +``` ### Supremum preserving maps @@ -47,42 +81,30 @@ module _ {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) where - preserves-suprema-Poset : + preserves-suprema-map-Poset : (l5 : Level) → (type-Poset P → type-Poset Q) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) - preserves-suprema-Poset l5 f = + preserves-suprema-map-Poset l5 f = {I : UU l5} (x : I → type-Poset P) (y : has-least-upper-bound-family-of-elements-Poset P x) → is-least-upper-bound-family-of-elements-Poset Q (f ∘ x) (f (pr1 y)) - is-prop-preserves-suprema-Poset : + is-prop-preserves-suprema-map-Poset : {l5 : Level} (f : type-Poset P → type-Poset Q) → - is-prop (preserves-suprema-Poset l5 f) - is-prop-preserves-suprema-Poset f = + is-prop (preserves-suprema-map-Poset l5 f) + is-prop-preserves-suprema-map-Poset f = is-prop-implicit-Π - ( λ I → - is-prop-Π - ( λ x → - is-prop-Π - ( λ y → - is-prop-is-least-upper-bound-family-of-elements-Poset Q - ( f ∘ x) - ( f (pr1 y))))) - - preserves-suprema-prop-Poset : + ( λ I → is-prop-Π (is-prop-preserves-supremum-map-Poset P Q f)) + + preserves-suprema-prop-map-Poset : (l5 : Level) → (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) - preserves-suprema-prop-Poset l5 f = - preserves-suprema-Poset l5 f , (is-prop-preserves-suprema-Poset f) - - -- preserves-suprema-Poset : - -- (type-Poset P → type-Poset Q) → UU {! !} - -- preserves-suprema-Poset f = - -- type-Prop (preserves-suprema-prop-Poset f) + preserves-suprema-prop-map-Poset l5 f = + preserves-suprema-map-Poset l5 f , (is-prop-preserves-suprema-map-Poset f) hom-sup-Poset : (l5 : Level) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) hom-sup-Poset l5 = - Σ (type-Poset P → type-Poset Q) (preserves-suprema-Poset l5) + Σ (type-Poset P → type-Poset Q) (preserves-suprema-map-Poset l5) map-hom-sup-Poset : {l5 : Level} → hom-sup-Poset l5 → type-Poset P → type-Poset Q @@ -90,7 +112,7 @@ module _ preserves-suprema-map-hom-sup-Poset : {l5 : Level} (f : hom-sup-Poset l5) → - preserves-suprema-Poset l5 (map-hom-sup-Poset f) + preserves-suprema-map-Poset l5 (map-hom-sup-Poset f) preserves-suprema-map-hom-sup-Poset = pr2 sup-map-hom-sup-Poset : @@ -102,6 +124,52 @@ module _ ( map-hom-sup-Poset f (pr1 y) , preserves-suprema-map-hom-sup-Poset f x y) ``` +## Properties + +### Supremum preserving maps preserve suprema over small types + +```agda +module _ + {l1 l2 l3 l4 l5 l6 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + preserves-small-supremum-preserves-suprema-map-Poset : + {f : type-Poset P → type-Poset Q} → preserves-suprema-map-Poset P Q l5 f → + {I : UU l6} (u : is-small l5 I) (x : I → type-Poset P) → + preserves-supremum-map-Poset P Q f (x ∘ map-inv-equiv-is-small u) + preserves-small-supremum-preserves-suprema-map-Poset H u x = + H (x ∘ map-inv-equiv-is-small u) +``` + +### Supremum preserving maps preserve order + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + abstract + preserves-order-preserves-suprema-map-Poset : + {f : type-Poset P → type-Poset Q} → + preserves-suprema-map-Poset P Q l5 f → + preserves-order-Poset P Q f + preserves-order-preserves-suprema-map-Poset {f} H x y p = + pr2 + ( preserves-small-supremum-preserves-suprema-map-Poset P Q H + ( Raise l5 bool) + ( family-of-elements-has-least-binary-upper-bound-Poset P x y + ( has-least-binary-upper-bound-leq-Poset P x y p)) + ( y , + λ z → + ( ( ev (map-raise false)) , + ( λ where + u (map-raise true) → transitive-leq-Poset P x y z u p + u (map-raise false) → u))) + ( f y)) + ( refl-leq-Poset Q (f y)) + ( map-raise true) +``` + ### Homotopies of supremum preserving maps ```agda @@ -124,7 +192,7 @@ module _ is-torsorial-htpy-hom-sup-Poset f = is-torsorial-Eq-subtype ( is-torsorial-htpy (map-hom-sup-Poset P Q f)) - ( is-prop-preserves-suprema-Poset P Q) + ( is-prop-preserves-suprema-map-Poset P Q) ( map-hom-sup-Poset P Q f) ( refl-htpy) ( preserves-suprema-map-hom-sup-Poset P Q f) @@ -155,7 +223,7 @@ module _ where preserves-suprema-id-Poset : - {l3 : Level} → preserves-suprema-Poset P P l3 (id {A = type-Poset P}) + {l3 : Level} → preserves-suprema-map-Poset P P l3 (id {A = type-Poset P}) preserves-suprema-id-Poset x y = pr2 y id-hom-sup-Poset : (l3 : Level) → hom-sup-Poset P P l3 @@ -172,7 +240,7 @@ module _ preserves-suprema-comp-Poset : (g : hom-sup-Poset Q R l7) (f : hom-sup-Poset P Q l7) → - preserves-suprema-Poset P R l7 + preserves-suprema-map-Poset P R l7 ( map-hom-sup-Poset Q R g ∘ map-hom-sup-Poset P Q f) preserves-suprema-comp-Poset g f x y H = preserves-suprema-map-hom-sup-Poset Q R g From 291cde741beede1cc99ef4e9a68ca440f61eb8d7 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 20:02:27 +0100 Subject: [PATCH 51/83] Reindexing directed families in a poset --- .../directed-families-posets.lagda.md | 63 +++++++++++++++++++ src/foundation/surjective-maps.lagda.md | 21 +++++++ 2 files changed, 84 insertions(+) diff --git a/src/domain-theory/directed-families-posets.lagda.md b/src/domain-theory/directed-families-posets.lagda.md index 2d6f7fd501..97ff1b7320 100644 --- a/src/domain-theory/directed-families-posets.lagda.md +++ b/src/domain-theory/directed-families-posets.lagda.md @@ -7,12 +7,17 @@ module domain-theory.directed-families-posets where
Imports ```agda +open import foundation.action-on-identifications-functions open import foundation.cartesian-product-types open import foundation.conjunction open import foundation.dependent-pair-types open import foundation.existential-quantification +open import foundation.function-types +open import foundation.identity-types open import foundation.inhabited-types +open import foundation.propositional-truncations open import foundation.propositions +open import foundation.surjective-maps open import foundation.universal-quantification open import foundation.universe-levels @@ -92,3 +97,61 @@ module _ ( family-directed-family-Poset) is-directed-family-directed-family-Poset = pr2 (pr2 x) ``` + +### Reindexing directed families in a poset + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (x : directed-family-Poset l3 P) + {I : UU l4} (f : I ↠ type-directed-family-Poset P x) + where + + type-reindex-directed-family-Poset : UU l4 + type-reindex-directed-family-Poset = I + + is-inhabited-type-reindex-directed-family-Poset : + is-inhabited type-reindex-directed-family-Poset + is-inhabited-type-reindex-directed-family-Poset = + is-inhabited-surjects-onto f (is-inhabited-type-directed-family-Poset P x) + + inhabited-type-reindex-directed-family-Poset : Inhabited-Type l4 + inhabited-type-reindex-directed-family-Poset = + type-reindex-directed-family-Poset , + is-inhabited-type-reindex-directed-family-Poset + + family-reindex-directed-family-Poset : + type-reindex-directed-family-Poset → type-Poset P + family-reindex-directed-family-Poset = + family-directed-family-Poset P x ∘ map-surjection f + + abstract + is-directed-family-reindex-directed-family-Poset : + is-directed-family-Poset P + inhabited-type-reindex-directed-family-Poset + family-reindex-directed-family-Poset + is-directed-family-reindex-directed-family-Poset u v = + elim-exists + ( exists-structure-Prop type-reindex-directed-family-Poset _) + (λ z y → + rec-trunc-Prop + ( exists-structure-Prop type-reindex-directed-family-Poset _) + ( λ p → + intro-exists + ( pr1 p) + ( concatenate-leq-eq-Poset P + ( pr1 y) + ( ap (family-directed-family-Poset P x) (inv (pr2 p))) , + concatenate-leq-eq-Poset P + ( pr2 y) + ( ap (family-directed-family-Poset P x) (inv (pr2 p))))) + ( is-surjective-map-surjection f z)) + ( is-directed-family-directed-family-Poset P x + ( map-surjection f u) + ( map-surjection f v)) + + reindex-directed-family-Poset : directed-family-Poset l4 P + reindex-directed-family-Poset = + inhabited-type-reindex-directed-family-Poset , + family-reindex-directed-family-Poset , + is-directed-family-reindex-directed-family-Poset +``` diff --git a/src/foundation/surjective-maps.lagda.md b/src/foundation/surjective-maps.lagda.md index 0823b00093..51f1712701 100644 --- a/src/foundation/surjective-maps.lagda.md +++ b/src/foundation/surjective-maps.lagda.md @@ -18,6 +18,7 @@ open import foundation.functoriality-cartesian-product-types open import foundation.fundamental-theorem-of-identity-types open import foundation.homotopy-induction open import foundation.identity-types +open import foundation.inhabited-types open import foundation.postcomposition-dependent-functions open import foundation.propositional-truncations open import foundation.split-surjective-maps @@ -830,6 +831,26 @@ module _ ( is-emb-map-emb g) ``` +### Every type that surjects onto an inhabited type is inhabited + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-inhabited-is-surjective : + {f : A → B} → is-surjective f → is-inhabited B → is-inhabited A + is-inhabited-is-surjective F = + rec-trunc-Prop + ( is-inhabited-Prop A) + ( rec-trunc-Prop (is-inhabited-Prop A) (unit-trunc-Prop ∘ pr1) ∘ F) + + is-inhabited-surjects-onto : + A ↠ B → is-inhabited B → is-inhabited A + is-inhabited-surjects-onto f = + is-inhabited-is-surjective (is-surjective-map-surjection f) +``` + ### The type of surjections `A ↠ B` is equivalent to the type of families `P` of inhabited types over `B` equipped with an equivalence `A ≃ Σ B P` This remains to be shown. From 2d4fde22f58eaefd6c46900edfa3e9744be4ad74 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 21:13:29 +0100 Subject: [PATCH 52/83] scott continuous maps of posets --- src/domain-theory.lagda.md | 1 + .../directed-families-posets.lagda.md | 76 ++++ .../scott-continuous-maps-posets.lagda.md | 392 ++++++++++++++++++ src/foundation/surjective-maps.lagda.md | 22 +- 4 files changed, 483 insertions(+), 8 deletions(-) create mode 100644 src/domain-theory/scott-continuous-maps-posets.lagda.md diff --git a/src/domain-theory.lagda.md b/src/domain-theory.lagda.md index 56636fc4f5..1ca06374b6 100644 --- a/src/domain-theory.lagda.md +++ b/src/domain-theory.lagda.md @@ -5,4 +5,5 @@ module domain-theory where open import domain-theory.directed-complete-posets public open import domain-theory.directed-families-posets public +open import domain-theory.scott-continuous-maps-posets public ``` diff --git a/src/domain-theory/directed-families-posets.lagda.md b/src/domain-theory/directed-families-posets.lagda.md index 97ff1b7320..02618528ac 100644 --- a/src/domain-theory/directed-families-posets.lagda.md +++ b/src/domain-theory/directed-families-posets.lagda.md @@ -11,6 +11,7 @@ open import foundation.action-on-identifications-functions open import foundation.cartesian-product-types open import foundation.conjunction open import foundation.dependent-pair-types +open import foundation.equivalences open import foundation.existential-quantification open import foundation.function-types open import foundation.identity-types @@ -21,6 +22,7 @@ open import foundation.surjective-maps open import foundation.universal-quantification open import foundation.universe-levels +open import order-theory.order-preserving-maps-posets open import order-theory.posets ``` @@ -155,3 +157,77 @@ module _ family-reindex-directed-family-Poset , is-directed-family-reindex-directed-family-Poset ``` + +### Reindexing directed families in a poset by an equivalence + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (x : directed-family-Poset l3 P) + {I : UU l4} + where + + reindex-equiv-directed-family-Poset : + I ≃ type-directed-family-Poset P x → directed-family-Poset l4 P + reindex-equiv-directed-family-Poset f = + reindex-directed-family-Poset P x (surjection-equiv f) + + reindex-inv-equiv-directed-family-Poset : + type-directed-family-Poset P x ≃ I → directed-family-Poset l4 P + reindex-inv-equiv-directed-family-Poset f = + reindex-directed-family-Poset P x (surjection-inv-equiv f) +``` + +### Mapping directed families in a poset under an order preserving map + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) + (f : hom-Poset P Q) + (x : directed-family-Poset l5 P) + where + + type-directed-family-hom-Poset : UU l5 + type-directed-family-hom-Poset = type-directed-family-Poset P x + + is-inhabited-type-directed-family-hom-Poset : + is-inhabited type-directed-family-hom-Poset + is-inhabited-type-directed-family-hom-Poset = + is-inhabited-type-directed-family-Poset P x + + inhabited-type-directed-family-hom-Poset : Inhabited-Type l5 + inhabited-type-directed-family-hom-Poset = + type-directed-family-hom-Poset , + is-inhabited-type-directed-family-hom-Poset + + family-directed-family-hom-Poset : + type-directed-family-hom-Poset → type-Poset Q + family-directed-family-hom-Poset = + map-hom-Poset P Q f ∘ family-directed-family-Poset P x + + abstract + is-directed-family-directed-family-hom-Poset : + is-directed-family-Poset Q + inhabited-type-directed-family-hom-Poset + family-directed-family-hom-Poset + is-directed-family-directed-family-hom-Poset u v = + elim-exists + ( exists-structure-Prop type-directed-family-hom-Poset _) + ( λ z y → + intro-exists z + ( preserves-order-map-hom-Poset P Q f + ( family-directed-family-Poset P x u) + ( family-directed-family-Poset P x z) + ( pr1 y) , + preserves-order-map-hom-Poset P Q f + ( family-directed-family-Poset P x v) + ( family-directed-family-Poset P x z) + ( pr2 y))) + ( is-directed-family-directed-family-Poset P x u v) + + directed-family-hom-Poset : directed-family-Poset l5 Q + directed-family-hom-Poset = + inhabited-type-directed-family-hom-Poset , + family-directed-family-hom-Poset , + is-directed-family-directed-family-hom-Poset +``` diff --git a/src/domain-theory/scott-continuous-maps-posets.lagda.md b/src/domain-theory/scott-continuous-maps-posets.lagda.md new file mode 100644 index 0000000000..f6cd435498 --- /dev/null +++ b/src/domain-theory/scott-continuous-maps-posets.lagda.md @@ -0,0 +1,392 @@ +# Scott-continuous maps between posets + +```agda +module domain-theory.scott-continuous-maps-posets where +``` + +
Imports + +```agda +open import domain-theory.directed-families-posets + +open import foundation.booleans +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.evaluation-functions +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.fundamental-theorem-of-identity-types +open import foundation.homotopies +open import foundation.homotopy-induction +open import foundation.identity-types +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.small-types +open import foundation.strictly-involutive-identity-types +open import foundation.subtype-identity-principle +open import foundation.surjective-maps +open import foundation.torsorial-type-families +open import foundation.universe-levels + +open import order-theory.least-upper-bounds-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +``` + +
+ +## Idea + +A map `f : P → Q` between the underlying types of two +[posets](order-theory.posets.md) is said to be +{{#concept "Scott-continuous" Disambiguation="map of posets" WD="Scott continuity" WDID=Q895815 Agda=scott-continuous-map-Poset}} + +```text + f(⋃ᵢxᵢ) = ⋃ᵢf(xᵢ) +``` + +for every [directed family](domain-theory.directed-families-posets.md) +`x₍₋₎ : I → P` with a [supremum](order-theory.least-upper-bounds-posets.md) in +`P`. + +## Definitions + +### The predicate of preserving the supremum of a directed family + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + (f : type-Poset P → type-Poset Q) + (x : directed-family-Poset l5 P) + where + + preserves-supremum-directed-family-map-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5) + preserves-supremum-directed-family-map-Poset = + (y : + has-least-upper-bound-family-of-elements-Poset P + ( family-directed-family-Poset P x)) → + is-least-upper-bound-family-of-elements-Poset Q + ( f ∘ family-directed-family-Poset P x) + ( f (pr1 y)) + + is-prop-preserves-supremum-directed-family-map-Poset : + is-prop preserves-supremum-directed-family-map-Poset + is-prop-preserves-supremum-directed-family-map-Poset = + is-prop-Π + ( λ y → + is-prop-is-least-upper-bound-family-of-elements-Poset Q + ( f ∘ family-directed-family-Poset P x) + ( f (pr1 y))) + + preserves-supremum-directed-family-prop-map-Poset : + Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5) + preserves-supremum-directed-family-prop-map-Poset = + preserves-supremum-directed-family-map-Poset , + is-prop-preserves-supremum-directed-family-map-Poset +``` + +### The predicate on a map of posets of being Scott-continuous + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + is-scott-continuous-map-Poset : + (l5 : Level) → (type-Poset P → type-Poset Q) → + UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) + is-scott-continuous-map-Poset l5 f = + (x : directed-family-Poset l5 P) + (y : + has-least-upper-bound-family-of-elements-Poset P + ( family-directed-family-Poset P x)) → + is-least-upper-bound-family-of-elements-Poset Q + ( f ∘ family-directed-family-Poset P x) + ( f (pr1 y)) + + is-prop-is-scott-continuous-map-Poset : + {l5 : Level} (f : type-Poset P → type-Poset Q) → + is-prop (is-scott-continuous-map-Poset l5 f) + is-prop-is-scott-continuous-map-Poset f = + is-prop-Π (is-prop-preserves-supremum-directed-family-map-Poset P Q f) + + is-scott-continuous-prop-map-Poset : + (l5 : Level) → + (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) + is-scott-continuous-prop-map-Poset l5 f = + ( is-scott-continuous-map-Poset l5 f) , + ( is-prop-is-scott-continuous-map-Poset f) + + scott-continuous-hom-Poset : (l5 : Level) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) + scott-continuous-hom-Poset l5 = + Σ (type-Poset P → type-Poset Q) (is-scott-continuous-map-Poset l5) + + map-scott-continuous-hom-Poset : + {l5 : Level} → scott-continuous-hom-Poset l5 → type-Poset P → type-Poset Q + map-scott-continuous-hom-Poset = pr1 + + is-scott-continuous-map-scott-continuous-hom-Poset : + {l5 : Level} (f : scott-continuous-hom-Poset l5) → + is-scott-continuous-map-Poset l5 (map-scott-continuous-hom-Poset f) + is-scott-continuous-map-scott-continuous-hom-Poset = pr2 + + sup-map-scott-continuous-hom-Poset : + {l5 : Level} (f : scott-continuous-hom-Poset l5) → + (x : directed-family-Poset l5 P) → + has-least-upper-bound-family-of-elements-Poset P + ( family-directed-family-Poset P x) → + has-least-upper-bound-family-of-elements-Poset Q + ( map-scott-continuous-hom-Poset f ∘ family-directed-family-Poset P x) + sup-map-scott-continuous-hom-Poset f x y = + ( map-scott-continuous-hom-Poset f (pr1 y) , + is-scott-continuous-map-scott-continuous-hom-Poset f x y) +``` + +## Properties + +### Scott-continuous maps preserve suprema of directed families over small indexing types + +```agda +module _ + {l1 l2 l3 l4 l5 l6 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + preserves-small-supremum-directed-family-is-scott-continuous-map-Poset : + {f : type-Poset P → type-Poset Q} → + is-scott-continuous-map-Poset P Q l5 f → + (x : directed-family-Poset l6 P) + (u : is-small l5 (type-directed-family-Poset P x)) → + preserves-supremum-directed-family-map-Poset P Q f + ( reindex-inv-equiv-directed-family-Poset P x (equiv-is-small u)) + preserves-small-supremum-directed-family-is-scott-continuous-map-Poset H x u = + H (reindex-inv-equiv-directed-family-Poset P x (equiv-is-small u)) +``` + +### Scott-continuous maps preserve order + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + abstract + preserves-order-is-scott-continuous-map-Poset : + {f : type-Poset P → type-Poset Q} → + is-scott-continuous-map-Poset P Q l5 f → + preserves-order-Poset P Q f + preserves-order-is-scott-continuous-map-Poset {f} H x y p = + pr2 + ( preserves-small-supremum-directed-family-is-scott-continuous-map-Poset + ( P) + ( Q) + ( H) + ( ( bool , unit-trunc-Prop true) , + rec-bool x y , + λ where + true true → + intro-exists true (refl-leq-Poset P x , refl-leq-Poset P x) + true false → + intro-exists false (p , refl-leq-Poset P y) + false true → + intro-exists false (refl-leq-Poset P y , p) + false false → + intro-exists false (refl-leq-Poset P y , refl-leq-Poset P y)) + ( Raise l5 bool) + ( y , + λ z → + ( ( ev (map-raise false)) , + ( λ where + u (map-raise true) → transitive-leq-Poset P x y z u p + u (map-raise false) → u))) + ( f y)) + ( refl-leq-Poset Q (f y)) + ( map-raise true) + + hom-scott-continuous-hom-Poset : + scott-continuous-hom-Poset P Q l5 → hom-Poset P Q + hom-scott-continuous-hom-Poset f = + map-scott-continuous-hom-Poset P Q f , + preserves-order-is-scott-continuous-map-Poset + ( is-scott-continuous-map-scott-continuous-hom-Poset P Q f) +``` + +### Homotopies of Scott-continuous maps + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + htpy-scott-continuous-hom-Poset : + (f g : scott-continuous-hom-Poset P Q l5) → UU (l1 ⊔ l3) + htpy-scott-continuous-hom-Poset f g = + map-scott-continuous-hom-Poset P Q f ~ map-scott-continuous-hom-Poset P Q g + + refl-htpy-scott-continuous-hom-Poset : + (f : scott-continuous-hom-Poset P Q l5) → + htpy-scott-continuous-hom-Poset f f + refl-htpy-scott-continuous-hom-Poset f = refl-htpy + + htpy-eq-scott-continuous-hom-Poset : + (f g : scott-continuous-hom-Poset P Q l5) → + f = g → + htpy-scott-continuous-hom-Poset f g + htpy-eq-scott-continuous-hom-Poset f .f refl = + refl-htpy-scott-continuous-hom-Poset f + + is-torsorial-htpy-scott-continuous-hom-Poset : + (f : scott-continuous-hom-Poset P Q l5) → + is-torsorial (htpy-scott-continuous-hom-Poset f) + is-torsorial-htpy-scott-continuous-hom-Poset f = + is-torsorial-Eq-subtype + ( is-torsorial-htpy (map-scott-continuous-hom-Poset P Q f)) + ( is-prop-is-scott-continuous-map-Poset P Q) + ( map-scott-continuous-hom-Poset P Q f) + ( refl-htpy) + ( is-scott-continuous-map-scott-continuous-hom-Poset P Q f) + + is-equiv-htpy-eq-scott-continuous-hom-Poset : + (f g : scott-continuous-hom-Poset P Q l5) → + is-equiv (htpy-eq-scott-continuous-hom-Poset f g) + is-equiv-htpy-eq-scott-continuous-hom-Poset f = + fundamental-theorem-id + ( is-torsorial-htpy-scott-continuous-hom-Poset f) + ( htpy-eq-scott-continuous-hom-Poset f) + + extensionality-scott-continuous-hom-Poset : + (f g : scott-continuous-hom-Poset P Q l5) → + (f = g) ≃ htpy-scott-continuous-hom-Poset f g + pr1 (extensionality-scott-continuous-hom-Poset f g) = + htpy-eq-scott-continuous-hom-Poset f g + pr2 (extensionality-scott-continuous-hom-Poset f g) = + is-equiv-htpy-eq-scott-continuous-hom-Poset f g + + eq-htpy-scott-continuous-hom-Poset : + (f g : scott-continuous-hom-Poset P Q l5) → + htpy-scott-continuous-hom-Poset f g → f = g + eq-htpy-scott-continuous-hom-Poset f g = + map-inv-is-equiv (is-equiv-htpy-eq-scott-continuous-hom-Poset f g) +``` + +### The identity Scott-continuous map + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) + where + + is-scott-continuous-id-Poset : + {l3 : Level} → is-scott-continuous-map-Poset P P l3 (id {A = type-Poset P}) + is-scott-continuous-id-Poset x y = pr2 y + + id-scott-continuous-hom-Poset : + (l3 : Level) → scott-continuous-hom-Poset P P l3 + id-scott-continuous-hom-Poset l3 = id , is-scott-continuous-id-Poset +``` + +### Composing Scott-continuous maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 l7 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) (R : Poset l5 l6) + where + + is-scott-continuous-comp-Poset : + (g : scott-continuous-hom-Poset Q R l7) + (f : scott-continuous-hom-Poset P Q l7) → + is-scott-continuous-map-Poset P R l7 + ( map-scott-continuous-hom-Poset Q R g ∘ + map-scott-continuous-hom-Poset P Q f) + is-scott-continuous-comp-Poset g f x y H = + is-scott-continuous-map-scott-continuous-hom-Poset Q R g + ( directed-family-hom-Poset P Q (hom-scott-continuous-hom-Poset P Q f) x) + ( sup-map-scott-continuous-hom-Poset P Q f x y) + ( H) + + comp-scott-continuous-hom-Poset : + (g : scott-continuous-hom-Poset Q R l7) + (f : scott-continuous-hom-Poset P Q l7) → + scott-continuous-hom-Poset P R l7 + comp-scott-continuous-hom-Poset g f = + map-scott-continuous-hom-Poset Q R g ∘ + map-scott-continuous-hom-Poset P Q f , + is-scott-continuous-comp-Poset g f +``` + +### Unit laws for composition of Scott-continuous maps + +```agda +module _ + {l1 l2 l3 l4 l5 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + left-unit-law-comp-scott-continuous-hom-Poset : + (f : scott-continuous-hom-Poset P Q l5) → + ( comp-scott-continuous-hom-Poset P Q Q + ( id-scott-continuous-hom-Poset Q l5) + ( f)) = + ( f) + left-unit-law-comp-scott-continuous-hom-Poset f = + eq-htpy-scott-continuous-hom-Poset P Q + ( comp-scott-continuous-hom-Poset P Q Q + ( id-scott-continuous-hom-Poset Q l5) + ( f)) + ( f) + ( refl-htpy) + + right-unit-law-comp-scott-continuous-hom-Poset : + (f : scott-continuous-hom-Poset P Q l5) → + ( comp-scott-continuous-hom-Poset P P Q + ( f) + ( id-scott-continuous-hom-Poset P l5)) = + ( f) + right-unit-law-comp-scott-continuous-hom-Poset f = + eq-htpy-scott-continuous-hom-Poset P Q + ( comp-scott-continuous-hom-Poset P P Q + ( f) + ( id-scott-continuous-hom-Poset P l5)) + ( f) + ( refl-htpy) +``` + +### Associativity of composition of Scott-continuous maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 l7 l8 l9 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) + (R : Poset l5 l6) (S : Poset l7 l8) + (h : scott-continuous-hom-Poset R S l9) + (g : scott-continuous-hom-Poset Q R l9) + (f : scott-continuous-hom-Poset P Q l9) + where + + associative-comp-scott-continuous-hom-Poset : + comp-scott-continuous-hom-Poset P Q S + ( comp-scott-continuous-hom-Poset Q R S h g) + ( f) = + comp-scott-continuous-hom-Poset P R S + ( h) + ( comp-scott-continuous-hom-Poset P Q R g f) + associative-comp-scott-continuous-hom-Poset = + eq-htpy-scott-continuous-hom-Poset P S + ( comp-scott-continuous-hom-Poset P Q S + ( comp-scott-continuous-hom-Poset Q R S h g) + ( f)) + ( comp-scott-continuous-hom-Poset P R S + ( h) + ( comp-scott-continuous-hom-Poset P Q R g f)) + ( refl-htpy) + + involutive-eq-associative-comp-scott-continuous-hom-Poset : + comp-scott-continuous-hom-Poset P Q S + ( comp-scott-continuous-hom-Poset Q R S h g) + ( f) =ⁱ + comp-scott-continuous-hom-Poset P R S + ( h) + ( comp-scott-continuous-hom-Poset P Q R g f) + involutive-eq-associative-comp-scott-continuous-hom-Poset = + involutive-eq-eq associative-comp-scott-continuous-hom-Poset +``` diff --git a/src/foundation/surjective-maps.lagda.md b/src/foundation/surjective-maps.lagda.md index 51f1712701..a76467c310 100644 --- a/src/foundation/surjective-maps.lagda.md +++ b/src/foundation/surjective-maps.lagda.md @@ -239,15 +239,21 @@ abstract ### Any equivalence is surjective ```agda -is-surjective-is-equiv : - {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → - is-equiv f → is-surjective f -is-surjective-is-equiv H = is-surjective-has-section (pr1 H) +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-surjective-is-equiv : {f : A → B} → is-equiv f → is-surjective f + is-surjective-is-equiv H = is-surjective-has-section (pr1 H) + + is-surjective-map-equiv : (e : A ≃ B) → is-surjective (map-equiv e) + is-surjective-map-equiv e = is-surjective-is-equiv (is-equiv-map-equiv e) + + surjection-equiv : A ≃ B → A ↠ B + surjection-equiv e = map-equiv e , is-surjective-map-equiv e -is-surjective-map-equiv : - {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) → - is-surjective (map-equiv e) -is-surjective-map-equiv e = is-surjective-is-equiv (is-equiv-map-equiv e) + surjection-inv-equiv : B ≃ A → A ↠ B + surjection-inv-equiv e = surjection-equiv (inv-equiv e) ``` ### The identity function is surjective From d921b43ab0524d0ca68415c0ea1ef9b609291224 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 21:23:12 +0100 Subject: [PATCH 53/83] complements of double negation stable subtypes --- src/logic.lagda.md | 1 + ...s-double-negation-stable-subtypes.lagda.md | 75 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 src/logic/complements-double-negation-stable-subtypes.lagda.md diff --git a/src/logic.lagda.md b/src/logic.lagda.md index d7cfc35fae..957372b357 100644 --- a/src/logic.lagda.md +++ b/src/logic.lagda.md @@ -4,6 +4,7 @@ module logic where open import logic.complements-decidable-subtypes public +open import logic.complements-double-negation-stable-subtypes public open import logic.de-morgan-embeddings public open import logic.de-morgan-maps public open import logic.de-morgan-propositions public diff --git a/src/logic/complements-double-negation-stable-subtypes.lagda.md b/src/logic/complements-double-negation-stable-subtypes.lagda.md new file mode 100644 index 0000000000..5a2e938583 --- /dev/null +++ b/src/logic/complements-double-negation-stable-subtypes.lagda.md @@ -0,0 +1,75 @@ +# Complements of double negation stable subtypes + +```agda +module logic.complements-double-negation-stable-subtypes where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.double-negation +open import foundation.double-negation-stable-propositions +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.subtypes +open import foundation.unions-subtypes +open import foundation.universe-levels + +open import foundation-core.function-types + +open import logic.double-negation-stable-subtypes + +open import order-theory.large-posets +open import order-theory.opposite-large-posets +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-large-preorders +open import order-theory.order-preserving-maps-posets +open import order-theory.order-preserving-maps-preorders +open import order-theory.posets +``` + +
+ +## Idea + +The +{{#concept "complement" Disambiguation="of a double negation stable subtype" Agda=complement-double-negation-stable-subtype}} +of a +[double-negation-stable subtype](foundation.double-negation-stable-subtypes.md) +`B ⊆ A` consists of the elements that are not in `B`. + +## Definition + +### Complements of double-negation-stable subtypes + +```agda +complement-double-negation-stable-subtype : + {l1 l2 : Level} {A : UU l1} → + double-negation-stable-subtype l2 A → + double-negation-stable-subtype l2 A +complement-double-negation-stable-subtype P x = + neg-Double-Negation-Stable-Prop (P x) +``` + +## Properties + +### Taking complements is an involution on double negation stable subtypes + +```agda +is-involution-complement-double-negation-stable-subtype : + {l1 l2 : Level} {A : UU l1} → + is-involution (complement-double-negation-stable-subtype {l1} {l2} {A}) +is-involution-complement-double-negation-stable-subtype P = + eq-has-same-elements-double-negation-stable-subtype + ( complement-double-negation-stable-subtype + ( complement-double-negation-stable-subtype P)) + ( P) + ( λ x → + ( is-double-negation-stable-double-negation-stable-subtype P x , + intro-double-negation)) +``` From 5276bcc0aab9fa7b38f4edfe4d6c41d277a3b93f Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 21:23:19 +0100 Subject: [PATCH 54/83] old wip constructive csb --- ...ructive-cantor-schroder-bernstein.lagda.md | 120 ++++++++++++------ 1 file changed, 78 insertions(+), 42 deletions(-) diff --git a/src/foundation/constructive-cantor-schroder-bernstein.lagda.md b/src/foundation/constructive-cantor-schroder-bernstein.lagda.md index e6e918f087..7feb97ac16 100644 --- a/src/foundation/constructive-cantor-schroder-bernstein.lagda.md +++ b/src/foundation/constructive-cantor-schroder-bernstein.lagda.md @@ -11,10 +11,14 @@ module foundation.constructive-cantor-schroder-bernstein where open import foundation.action-on-identifications-functions open import foundation.complements-subtypes open import foundation.decidable-embeddings +open import foundation.decidable-maps +open import foundation.decidable-propositions +open import foundation.decidable-subtypes open import foundation.decidable-types open import foundation.dependent-pair-types -open import logic.double-negation-stable-embeddings open import foundation.fixed-points-endofunctions +open import foundation.function-extensionality +open import foundation.function-types open import foundation.images-embeddings open import foundation.injective-maps open import foundation.negation @@ -23,6 +27,7 @@ open import foundation.powersets open import foundation.propositional-maps open import foundation.propositional-resizing open import foundation.split-surjective-maps +open import foundation.transport-along-identifications open import foundation.universe-levels open import foundation-core.coproduct-types @@ -33,12 +38,16 @@ open import foundation-core.fibers-of-maps open import foundation-core.identity-types open import foundation-core.sets +open import logic.de-morgan-maps +open import logic.double-negation-stable-embeddings + +open import order-theory.inflattices open import order-theory.knaster-tarski-fixed-point-theorem open import order-theory.opposite-large-posets open import order-theory.order-preserving-maps-large-posets open import order-theory.order-preserving-maps-posets +open import order-theory.resizing-suplattices open import order-theory.suplattices -open import order-theory.inflattices ```
@@ -59,11 +68,6 @@ type-constructive-Cantor-Schröder-Bernstein : (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) type-constructive-Cantor-Schröder-Bernstein l1 l2 = {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈ X) → X ≃ Y - --- type-constructive-Cantor-Schröder-Bernstein' : --- (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) --- type-constructive-Cantor-Schröder-Bernstein' l1 l2 = --- {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈᵐ X) → X ≃ Y ``` ## Proof @@ -142,9 +146,9 @@ If `g` is double negation stable we also have the equality g(Y\f(S)) = X\S. ``` -This gives us an inverse map `g⁻¹ : X\S → Y` and similarly there is an inverse -map `f⁻¹ : Y\T → X`. Now, if `S` and `f(S)` were decidable subtypes, we could -define a new total map `h : X → Y` by +Since `f` and `g` are embeddings, this gives us inverse maps `g⁻¹ : X\S → Y` and +`f⁻¹ : Y\T → X`. Now, if `S` and `f(S)` were decidable subtypes, we could define +a new total map `h : X → Y` by ```text h(x) = f (x) if x ∈ S @@ -154,18 +158,16 @@ define a new total map `h : X → Y` by and a converse map ```text - h'(x) = f⁻¹(x) if x ∈ f(S) - h'(x) = g (x) if x ∉ f(S). + h⁻¹(x) = f⁻¹(x) if x ∈ f(S) + h⁻¹(x) = g (x) if x ∉ f(S). ``` -Clearly, this gives a pair of mutually inverse maps. - Here we're not using the existence of `T` at all, nor that `S` is a greatest fixed point or that `g` satisfies decidability, only double negation stability. +However, to show that `h⁻¹` is a right inverse of `h` on `Y\f(S)`, we need +decidability of `g` as well. ```agda - - module _ {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) where @@ -186,12 +188,12 @@ module _ {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) where - hom-powerset-Cantor-Schröder-Bernstein : + hom-large-powerset-Cantor-Schröder-Bernstein : hom-Large-Poset ( λ l3 → l1 ⊔ l2 ⊔ l3) ( powerset-Large-Poset X) ( powerset-Large-Poset X) - hom-powerset-Cantor-Schröder-Bernstein = + hom-large-powerset-Cantor-Schröder-Bernstein = comp-hom-Large-Poset ( powerset-Large-Poset X) ( opposite-Large-Poset (powerset-Large-Poset Y)) @@ -202,64 +204,98 @@ module _ ( hom-half-way-powerset-Cantor-Schröder-Bernstein g)) ( hom-half-way-powerset-Cantor-Schröder-Bernstein f) - hom-small-powerset-Cantor-Schröder-Bernstein : - (l : Level) → + hom-powerset-Cantor-Schröder-Bernstein : hom-Poset - ( powerset-Poset l X) - ( powerset-Poset (l1 ⊔ l2 ⊔ l) X) - hom-small-powerset-Cantor-Schröder-Bernstein = + ( powerset-Poset (l1 ⊔ l2) X) + ( powerset-Poset (l1 ⊔ l2) X) + hom-powerset-Cantor-Schröder-Bernstein = hom-poset-hom-Large-Poset ( powerset-Large-Poset X) ( powerset-Large-Poset X) - ( hom-powerset-Cantor-Schröder-Bernstein) - + ( hom-large-powerset-Cantor-Schröder-Bernstein) + ( l1 ⊔ l2) ``` ### Impredicative proof using the Knaster–Tarski fixed point theorem -```text +```agda module _ - {l1 l2 : Level} (resize-prop : propositional-resizing (l1 ⊔ l2) (l1 ⊔ l2)) + {l1 l2 : Level} + (resize-prop : propositional-resizing-Level (l1 ⊔ l2) (l1 ⊔ l2)) {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) where fixed-point-domain-Cantor-Schröder-Bernstein : - fixed-point {! !} - -- ( map-hom-Poset - -- ( powerset-Poset (l1 ⊔ l2) X) - -- ( powerset-Poset (l1 ⊔ l2) X) - -- ( hom-small-powerset-Cantor-Schröder-Bernstein f g (l1 ⊔ l2))) + fixed-point + ( map-hom-Poset + ( powerset-Poset (l1 ⊔ l2) X) + ( powerset-Poset (l1 ⊔ l2) X) + ( hom-powerset-Cantor-Schröder-Bernstein f g)) fixed-point-domain-Cantor-Schröder-Bernstein = fixed-point-knaster-tarski-Suplattice - ( resize-type-Suplattice (powerset-Suplattice X {! !} {! !}) {! !}) {! !} {! !} + ( resize-type-Suplattice + ( powerset-Suplattice X {! l1 ⊔ l2 !} lzero) + {! !}) + {! hom-powerset-Cantor-Schröder-Bernstein f g !} + {! !} + -- ( resize-type-Suplattice (powerset-Suplattice X {! !} {! !}) {! !}) {! !} {! !} ``` Since the fixed point is an image of `g` by double negation stability, it must be decidable. -```text +```agda module _ - {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪¬¬ X) + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) (S : fixed-point ( map-hom-Poset ( powerset-Poset (l1 ⊔ l2) X) ( powerset-Poset (l1 ⊔ l2) X) - ( hom-small-powerset-Cantor-Schröder-Bernstein f g (l1 ⊔ l2)))) + ( hom-powerset-Cantor-Schröder-Bernstein f g))) where is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein : - is-decidable-subtype S - - map-impredicative-Cantor-Schröder-Bernstein : X → Y + is-decidable-map (map-emb f) → + is-de-morgan-map (map-emb g) → + is-decidable-subtype (pr1 S) + is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein F G x = + tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) + ( rec-coproduct + ( λ ngx → inl (ngx ∘ pr1)) + ( λ nngx → rec-coproduct {! !} {! !} (F {! !})) + ( G x)) + + is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein' : + is-decidable-map (map-emb f) → + is-decidable-map (map-emb g) → + is-decidable-subtype (pr1 S) + is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein' F G x = + tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) + ( rec-coproduct + ( λ gx → + rec-coproduct + (λ fx → inr λ h → h (gx , {! !})) + (λ nfgx → {! !}) + ( F (pr1 gx))) + ( λ ngx → inl (ngx ∘ pr1)) + ( G x)) + + -- is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein' : + -- is-decidable-map (map-emb g) → + -- is-decidable-subtype (pr1 S) + -- is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein' G x with (G x) + -- ... | inl y = tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) (inr λ np → np (y , λ h → {! !})) + -- ... | inr y = tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) (inl (y ∘ pr1)) + -- tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) ({! !}) ``` We can define mutual inverse maps from the given fixed point. For the inverse -map we need decidability of `f`. +map we need decidability of `f` and `g`. ```text module _ - {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ᵈ Y) (g : Y ↪¬¬ X) + {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ᵈ Y) (g : Y ↪ᵈ X) (S : fixed-point ( map-hom-Poset @@ -268,8 +304,8 @@ module _ ( hom-small-powerset-Cantor-Schröder-Bernstein f g (l1 ⊔ l2)))) where - map-inv-impredicative-Cantor-Schröder-Bernstein : Y → X + map-inv-impredicative-Cantor-Schröder-Bernstein = ? is-section-map-inv-impredicative-Cantor-Schröder-Bernstein : is-section From ab0281604d2960881fc65c2bea7b96ce006fba57 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 21:32:55 +0100 Subject: [PATCH 55/83] fixes cantor's theorem de morgan --- src/foundation/cantors-theorem.lagda.md | 8 +++-- src/logic/de-morgan-propositions.lagda.md | 36 +++++++++++++++++++++++ src/logic/de-morgan-types.lagda.md | 7 +++++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/foundation/cantors-theorem.lagda.md b/src/foundation/cantors-theorem.lagda.md index 0153293c60..6e10b5c615 100644 --- a/src/foundation/cantors-theorem.lagda.md +++ b/src/foundation/cantors-theorem.lagda.md @@ -24,6 +24,8 @@ 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-stable-subtypes ``` @@ -146,15 +148,15 @@ module _ where map-theorem-de-morgan-Cantor : de-morgan-subtype l2 X - map-theorem-de-morgan-Cantor x = neg-De-morgan-Prop (f x 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 + no-fixed-points-neg-De-Morgan-Prop ( f x x) - ( iff-eq (ap prop-De-morgan-Prop (htpy-eq α x))) + ( iff-eq (ap prop-De-Morgan-Prop (htpy-eq α x))) abstract theorem-de-morgan-Cantor : ¬ (is-surjective f) diff --git a/src/logic/de-morgan-propositions.lagda.md b/src/logic/de-morgan-propositions.lagda.md index ffdb9a1509..a141582feb 100644 --- a/src/logic/de-morgan-propositions.lagda.md +++ b/src/logic/de-morgan-propositions.lagda.md @@ -272,6 +272,42 @@ module _ ( is-de-morgan-prop-Σ' a (is-de-morgan-type-is-de-morgan-prop ∘ b)) ``` +### The negation operation on decidable propositions + +```agda +is-de-morgan-prop-neg : + {l1 : Level} {A : UU l1} → is-de-morgan A → is-de-morgan-prop (¬ A) +is-de-morgan-prop-neg is-de-morgan-A = + ( is-prop-neg , is-de-morgan-neg is-de-morgan-A) + +neg-type-De-Morgan-Prop : + {l1 : Level} (A : UU l1) → is-de-morgan A → De-Morgan-Prop l1 +neg-type-De-Morgan-Prop A is-de-morgan-A = + ( ¬ A , is-de-morgan-prop-neg is-de-morgan-A) + +neg-De-Morgan-Prop : + {l1 : Level} → De-Morgan-Prop l1 → De-Morgan-Prop l1 +neg-De-Morgan-Prop P = + neg-type-De-Morgan-Prop + ( type-De-Morgan-Prop P) + ( is-de-morgan-type-De-Morgan-Prop P) + +type-neg-De-Morgan-Prop : + {l1 : Level} → De-Morgan-Prop l1 → UU l1 +type-neg-De-Morgan-Prop P = type-De-Morgan-Prop (neg-De-Morgan-Prop P) +``` + +### Negation has no fixed points on decidable propositions + +```agda +abstract + no-fixed-points-neg-De-Morgan-Prop : + {l : Level} (P : De-Morgan-Prop l) → + ¬ (type-De-Morgan-Prop P ↔ ¬ (type-De-Morgan-Prop P)) + no-fixed-points-neg-De-Morgan-Prop P = + no-fixed-points-neg (type-De-Morgan-Prop P) +``` + ## External links - [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) diff --git a/src/logic/de-morgan-types.lagda.md b/src/logic/de-morgan-types.lagda.md index 22feda55f0..72813628aa 100644 --- a/src/logic/de-morgan-types.lagda.md +++ b/src/logic/de-morgan-types.lagda.md @@ -358,6 +358,13 @@ module _ inr (is-irrefutable-product nna nnb) ``` +### The negation of a De Morgan type is De Morgan + +```agda +is-de-morgan-neg : {l : Level} {A : UU l} → is-de-morgan A → is-de-morgan (¬ A) +is-de-morgan-neg = is-decidable-neg +``` + ## External links - [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) From 15d990a9331631907a294571d62194f5e17c7701 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 21:33:40 +0100 Subject: [PATCH 56/83] remove allow unsolved metas --- src/foundation/constructive-cantor-schroder-bernstein.lagda.md | 1 - src/order-theory/suplattices.lagda.md | 1 - 2 files changed, 2 deletions(-) diff --git a/src/foundation/constructive-cantor-schroder-bernstein.lagda.md b/src/foundation/constructive-cantor-schroder-bernstein.lagda.md index 7feb97ac16..1cdba097ac 100644 --- a/src/foundation/constructive-cantor-schroder-bernstein.lagda.md +++ b/src/foundation/constructive-cantor-schroder-bernstein.lagda.md @@ -1,7 +1,6 @@ # The constructive Cantor–Schröder–Bernstein theorem ```agda -{-# OPTIONS --allow-unsolved-metas #-} module foundation.constructive-cantor-schroder-bernstein where ``` diff --git a/src/order-theory/suplattices.lagda.md b/src/order-theory/suplattices.lagda.md index 39798602b1..c5d25a5328 100644 --- a/src/order-theory/suplattices.lagda.md +++ b/src/order-theory/suplattices.lagda.md @@ -1,7 +1,6 @@ # Suplattices ```agda -{-# OPTIONS --allow-unsolved-metas #-} module order-theory.suplattices where ``` From f168e29e02601e4c472fe0c216247acffe4f53d8 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 22:20:05 +0100 Subject: [PATCH 57/83] beginnings Kleene's fixed point theorem --- src/domain-theory.lagda.md | 1 + .../kleenes-fixed-point-theorem.lagda.md | 137 ++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 src/domain-theory/kleenes-fixed-point-theorem.lagda.md diff --git a/src/domain-theory.lagda.md b/src/domain-theory.lagda.md index 1ca06374b6..cb4ed9a3c7 100644 --- a/src/domain-theory.lagda.md +++ b/src/domain-theory.lagda.md @@ -5,5 +5,6 @@ module domain-theory where open import domain-theory.directed-complete-posets public open import domain-theory.directed-families-posets public +open import domain-theory.kleenes-fixed-point-theorem public open import domain-theory.scott-continuous-maps-posets public ``` diff --git a/src/domain-theory/kleenes-fixed-point-theorem.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem.lagda.md new file mode 100644 index 0000000000..5f2af92105 --- /dev/null +++ b/src/domain-theory/kleenes-fixed-point-theorem.lagda.md @@ -0,0 +1,137 @@ +# Kleene's fixed point theorem + +```agda +module domain-theory.kleenes-fixed-point-theorem where +``` + +
Imports + +```agda +open import domain-theory.directed-complete-posets +open import domain-theory.directed-families-posets +open import domain-theory.scott-continuous-maps-posets + +open import elementary-number-theory.natural-numbers + +open import foundation.dependent-pair-types +open import foundation.fixed-points-endofunctions +open import foundation.identity-types +open import foundation.inhabited-types +open import foundation.iterating-functions +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.universe-levels + +open import order-theory.bottom-elements-posets +open import order-theory.inflattices +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +open import order-theory.suplattices +``` + +
+ +## Idea + +{{#concept "Kleene's fixed point theorem" WD="Kleene fixed-point theorem" WDID=Q3527263}} +states that every +[Scott-continuous](domain-theory.scott-continuous-maps-posets.md) endomap +`f : 𝒜 → 𝒜` on an inhabited +[directed complete poset](domain-theory.directed-complete-posets.md) `𝒜` has a +[fixed point](foundation.fixed-points-endofunctions.md), and if `𝒜` has a bottom +element, then `f` has a least fixed point. + +## Theorem + +### Kleene's fixed point theorem for suplattices + +```agda +module _ + {l1 l2 : Level} + (𝒜 : Directed-Complete-Poset l1 l2 lzero) + (f : type-Directed-Complete-Poset 𝒜 → type-Directed-Complete-Poset 𝒜) + (F : + is-scott-continuous-map-Poset + ( poset-Directed-Complete-Poset 𝒜) + ( poset-Directed-Complete-Poset 𝒜) + ( lzero) + ( f)) + (x : type-Directed-Complete-Poset 𝒜) + where + + indexing-type-kleene-Directed-Complete-Poset : UU lzero + indexing-type-kleene-Directed-Complete-Poset = ℕ + + is-inhabited-indexing-type-kleene-Directed-Complete-Poset : + is-inhabited indexing-type-kleene-Directed-Complete-Poset + is-inhabited-indexing-type-kleene-Directed-Complete-Poset = + unit-trunc-Prop zero-ℕ + + indexing-inhabited-type-kleene-Directed-Complete-Poset : Inhabited-Type lzero + indexing-inhabited-type-kleene-Directed-Complete-Poset = + indexing-type-kleene-Directed-Complete-Poset , + is-inhabited-indexing-type-kleene-Directed-Complete-Poset + + family-of-elements-kleene-Directed-Complete-Poset : + indexing-type-kleene-Directed-Complete-Poset → + type-Directed-Complete-Poset 𝒜 + family-of-elements-kleene-Directed-Complete-Poset n = iterate n f x + + is-directed-family-of-elements-kleene-Directed-Complete-Poset : + is-directed-family-Poset + ( poset-Directed-Complete-Poset 𝒜) + ( indexing-inhabited-type-kleene-Directed-Complete-Poset) + ( family-of-elements-kleene-Directed-Complete-Poset) + is-directed-family-of-elements-kleene-Directed-Complete-Poset u v = + {! !} + + directed-family-of-elements-kleene-Directed-Complete-Poset : + directed-family-Poset lzero (poset-Directed-Complete-Poset 𝒜) + directed-family-of-elements-kleene-Directed-Complete-Poset = + indexing-inhabited-type-kleene-Directed-Complete-Poset , + family-of-elements-kleene-Directed-Complete-Poset , + is-directed-family-of-elements-kleene-Directed-Complete-Poset + + point-kleene-Directed-Complete-Poset : type-Directed-Complete-Poset 𝒜 + point-kleene-Directed-Complete-Poset = + sup-Directed-Complete-Poset 𝒜 + ( directed-family-of-elements-kleene-Directed-Complete-Poset) + + leq-point-kleene-Directed-Complete-Poset : + leq-Directed-Complete-Poset 𝒜 + ( point-kleene-Directed-Complete-Poset) + ( f point-kleene-Directed-Complete-Poset) + leq-point-kleene-Directed-Complete-Poset = {! !} + + geq-point-kleene-Directed-Complete-Poset : + leq-Directed-Complete-Poset 𝒜 + ( f point-kleene-Directed-Complete-Poset) + ( point-kleene-Directed-Complete-Poset) + geq-point-kleene-Directed-Complete-Poset = {! !} + + is-fixed-point-kleene-Directed-Complete-Poset : + f ( point-kleene-Directed-Complete-Poset) = + point-kleene-Directed-Complete-Poset + is-fixed-point-kleene-Directed-Complete-Poset = + antisymmetric-leq-Directed-Complete-Poset 𝒜 + ( f (point-kleene-Directed-Complete-Poset)) + ( point-kleene-Directed-Complete-Poset) + ( geq-point-kleene-Directed-Complete-Poset) + ( leq-point-kleene-Directed-Complete-Poset) + + fixed-point-kleene-Directed-Complete-Poset : fixed-point f + fixed-point-kleene-Directed-Complete-Poset = + point-kleene-Directed-Complete-Poset , + is-fixed-point-kleene-Directed-Complete-Poset +``` + +### Kleene's fixed point theorem for directed complete posets with a bottom element + +> TODO + +## External links + +- [Kleene fixed-point theorem](https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem) + at Wikipedia +- [Kleene's fixed point theorem](https://ncatlab.org/nlab/show/Kleene%27s+fixed+point+theorem) + at $n$Lab From 2e9a891ac628ca3681eb0723ba35432d22a117a7 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sat, 2 Nov 2024 22:42:02 +0100 Subject: [PATCH 58/83] complements of de morgan subtypes --- src/foundation/decidable-subtypes.lagda.md | 22 +++++++ src/logic.lagda.md | 1 + .../complements-de-morgan-subtypes.lagda.md | 66 +++++++++++++++++++ .../complements-decidable-subtypes.lagda.md | 35 +++++----- ...s-double-negation-stable-subtypes.lagda.md | 4 +- src/logic/de-morgan-subtypes.lagda.md | 6 -- 6 files changed, 111 insertions(+), 23 deletions(-) create mode 100644 src/logic/complements-de-morgan-subtypes.lagda.md diff --git a/src/foundation/decidable-subtypes.lagda.md b/src/foundation/decidable-subtypes.lagda.md index 9a162ba9f7..1a274d55a1 100644 --- a/src/foundation/decidable-subtypes.lagda.md +++ b/src/foundation/decidable-subtypes.lagda.md @@ -36,6 +36,8 @@ open import foundation-core.propositions open import foundation-core.transport-along-identifications open import foundation-core.truncated-types open import foundation-core.truncation-levels + +open import logic.double-negation-stable-subtypes ```
@@ -227,6 +229,26 @@ module _ ( iff-universes-Decidable-Prop l l' (S x)) ``` +### Decidable subtypes are double negation stable + +```agda +is-double-negation-stable-decicable-subtype : + {l1 l2 : Level} {A : UU l1} (P : decidable-subtype l2 A) → + is-double-negation-stable-subtype (subtype-decidable-subtype P) +is-double-negation-stable-decicable-subtype P x = + double-negation-elim-is-decidable (is-decidable-decidable-subtype P x) +``` + +### Decidable subtypes are De Morgan + +```text +is-de-morgan-decicable-subtype : + {l1 l2 : Level} {A : UU l1} (P : decidable-subtype l2 A) → + is-de-morgan-subtype (subtype-decidable-subtype P) +is-de-morgan-decicable-subtype P x = + is-de-morgan-is-decidable (is-decidable-decidable-subtype P x) +``` + ### A decidable subtype of a `k+1`-truncated type is `k+1`-truncated ```agda diff --git a/src/logic.lagda.md b/src/logic.lagda.md index 957372b357..1422b2ec1b 100644 --- a/src/logic.lagda.md +++ b/src/logic.lagda.md @@ -3,6 +3,7 @@ ```agda module logic where +open import logic.complements-de-morgan-subtypes public open import logic.complements-decidable-subtypes public open import logic.complements-double-negation-stable-subtypes public open import logic.de-morgan-embeddings public diff --git a/src/logic/complements-de-morgan-subtypes.lagda.md b/src/logic/complements-de-morgan-subtypes.lagda.md new file mode 100644 index 0000000000..c8ebe924cc --- /dev/null +++ b/src/logic/complements-de-morgan-subtypes.lagda.md @@ -0,0 +1,66 @@ +# Complements of De Morgan subtypes + +```agda +module logic.complements-de-morgan-subtypes where +``` + +
Imports + +```agda +open import foundation.decidable-subtypes +open import foundation.dependent-pair-types +open import foundation.double-negation +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.subtypes +open import foundation.unions-subtypes +open import foundation.universe-levels + +open import foundation-core.function-types + +open import logic.de-morgan-propositions +open import logic.de-morgan-subtypes + +open import order-theory.large-posets +open import order-theory.opposite-large-posets +open import order-theory.order-preserving-maps-large-posets +open import order-theory.order-preserving-maps-large-preorders +open import order-theory.order-preserving-maps-posets +open import order-theory.order-preserving-maps-preorders +open import order-theory.posets +``` + +
+ +## Idea + +The +{{#concept "complement" Disambiguation="of a De Morgan subtype" Agda=complement-de-morgan-subtype}} +of a [De Morgan subtype](foundation.de-morgan-subtypes.md) `B ⊆ A` consists of +the elements that are not in `B`. + +## Definition + +### Complements of De Morgan subtypes + +```agda +complement-de-morgan-subtype : + {l1 l2 : Level} {A : UU l1} → de-morgan-subtype l2 A → de-morgan-subtype l2 A +complement-de-morgan-subtype P x = neg-De-Morgan-Prop (P x) +``` + +## Properties + +### Complement of De Morgan subtypes are decidable + +```agda +is-decidable-complement-de-morgan-subtype : + {l1 l2 : Level} {A : UU l1} (P : de-morgan-subtype l2 A) → + is-decidable-subtype + ( subtype-de-morgan-subtype (complement-de-morgan-subtype P)) +is-decidable-complement-de-morgan-subtype P = is-de-morgan-de-morgan-subtype P +``` diff --git a/src/logic/complements-decidable-subtypes.lagda.md b/src/logic/complements-decidable-subtypes.lagda.md index 917714fbde..c410ff90ff 100644 --- a/src/logic/complements-decidable-subtypes.lagda.md +++ b/src/logic/complements-decidable-subtypes.lagda.md @@ -8,10 +8,15 @@ module logic.complements-decidable-subtypes where ```agda open import foundation.complements-subtypes +open import foundation.coproduct-types 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 @@ -54,6 +59,21 @@ complement-decidable-subtype P x = neg-Decidable-Prop (P x) ## Properties +### Taking complements is an involution on decidable subtypes + +```agda +is-involution-complement-decidable-subtype : + {l1 l2 : Level} {A : UU l1} → + is-involution (complement-decidable-subtype {l1} {l2} {A}) +is-involution-complement-decidable-subtype P = + eq-has-same-elements-decidable-subtype + ( complement-decidable-subtype (complement-decidable-subtype P)) + ( P) + ( λ x → + double-negation-elim-is-decidable (is-decidable-decidable-subtype P x) , + ev) +``` + ### The union of a subtype `P` with its complement is the full subtype if and only if `P` is a decidable subtype ```agda @@ -86,18 +106,3 @@ module _ ( subtype-decidable-subtype P) ( is-decidable-decidable-subtype P) ``` - -### Taking complements gives a contravariant involution on the decidable powerset posets - -```text -neg-hom-powerset : - {l1 : Level} {A : UU l1} → - hom-Large-Poset - ( λ l → l) - ( powerset-Large-Poset A) - ( opposite-Large-Poset (powerset-Large-Poset A)) -neg-hom-powerset = - make-hom-Large-Preorder - ( λ P x → neg-Prop (P x)) - ( λ P Q f x → map-neg (f x)) -``` diff --git a/src/logic/complements-double-negation-stable-subtypes.lagda.md b/src/logic/complements-double-negation-stable-subtypes.lagda.md index 5a2e938583..be18e959f2 100644 --- a/src/logic/complements-double-negation-stable-subtypes.lagda.md +++ b/src/logic/complements-double-negation-stable-subtypes.lagda.md @@ -40,12 +40,12 @@ open import order-theory.posets The {{#concept "complement" Disambiguation="of a double negation stable subtype" Agda=complement-double-negation-stable-subtype}} of a -[double-negation-stable subtype](foundation.double-negation-stable-subtypes.md) +[double negation stable subtype](foundation.double-negation-stable-subtypes.md) `B ⊆ A` consists of the elements that are not in `B`. ## Definition -### Complements of double-negation-stable subtypes +### Complements of double negation stable subtypes ```agda complement-double-negation-stable-subtype : diff --git a/src/logic/de-morgan-subtypes.lagda.md b/src/logic/de-morgan-subtypes.lagda.md index 3eed983940..ade1645ebe 100644 --- a/src/logic/de-morgan-subtypes.lagda.md +++ b/src/logic/de-morgan-subtypes.lagda.md @@ -9,14 +9,11 @@ module logic.de-morgan-subtypes where ```agda open import foundation.1-types open import foundation.coproduct-types -open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.equality-dependent-function-types open import foundation.functoriality-cartesian-product-types -open import foundation.functoriality-dependent-function-types open import foundation.functoriality-dependent-pair-types open import foundation.logical-equivalences -open import foundation.negation open import foundation.propositional-maps open import foundation.sets open import foundation.structured-type-duality @@ -31,7 +28,6 @@ open import foundation-core.function-types open import foundation-core.identity-types open import foundation-core.injective-maps open import foundation-core.propositions -open import foundation-core.transport-along-identifications open import foundation-core.truncated-types open import foundation-core.truncation-levels @@ -39,8 +35,6 @@ open import logic.de-morgan-embeddings open import logic.de-morgan-maps open import logic.de-morgan-propositions open import logic.de-morgan-types -open import logic.double-negation-eliminating-maps -open import logic.double-negation-elimination ```
From 366d92256f2e9fe7a7450dd9429ffde8afedfafc Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 3 Nov 2024 13:34:03 +0100 Subject: [PATCH 59/83] de morgan disjunctions --- src/foundation/truncations.lagda.md | 7 +--- .../complements-de-morgan-subtypes.lagda.md | 40 +++++++++++++++++++ src/logic/de-morgan-propositions.lagda.md | 26 ++++++++++++ src/logic/de-morgan-types.lagda.md | 39 ++++++++++++++++++ 4 files changed, 107 insertions(+), 5 deletions(-) diff --git a/src/foundation/truncations.lagda.md b/src/foundation/truncations.lagda.md index 8b01d5b970..9523e78045 100644 --- a/src/foundation/truncations.lagda.md +++ b/src/foundation/truncations.lagda.md @@ -144,11 +144,8 @@ module _ unique-dependent-function-trunc B f = is-contr-equiv' ( fiber (precomp-Π-Truncated-Type unit-trunc B) f) - ( equiv-tot - ( λ h → equiv-funext)) - ( is-contr-map-is-equiv - ( dependent-universal-property-trunc B) - ( f)) + ( equiv-tot (λ h → equiv-funext)) + ( is-contr-map-is-equiv (dependent-universal-property-trunc B) f) apply-dependent-universal-property-trunc : {l2 : Level} (B : type-trunc k A → Truncated-Type l2 k) → diff --git a/src/logic/complements-de-morgan-subtypes.lagda.md b/src/logic/complements-de-morgan-subtypes.lagda.md index c8ebe924cc..fd1da58e72 100644 --- a/src/logic/complements-de-morgan-subtypes.lagda.md +++ b/src/logic/complements-de-morgan-subtypes.lagda.md @@ -7,6 +7,7 @@ module logic.complements-de-morgan-subtypes where
Imports ```agda +open import foundation.complements-subtypes open import foundation.decidable-subtypes open import foundation.dependent-pair-types open import foundation.double-negation @@ -22,6 +23,7 @@ open import foundation.universe-levels open import foundation-core.function-types +open import logic.complements-decidable-subtypes open import logic.de-morgan-propositions open import logic.de-morgan-subtypes @@ -64,3 +66,41 @@ is-decidable-complement-de-morgan-subtype : ( subtype-de-morgan-subtype (complement-de-morgan-subtype P)) is-decidable-complement-de-morgan-subtype P = is-de-morgan-de-morgan-subtype P ``` + +### The union of the complement of a subtype `P` with its double complement is the full subtype if and only if `P` is De Morgan + +```agda +module _ + {l1 l2 : Level} {A : UU l1} + where + + is-full-union-complement-subtype-double-complement-subtype : + (P : subtype l2 A) → is-de-morgan-subtype P → + is-full-subtype + ( union-subtype + ( complement-subtype P) + ( complement-subtype (complement-subtype P))) + is-full-union-complement-subtype-double-complement-subtype P = + is-full-union-subtype-complement-subtype (complement-subtype P) + + is-de-morgan-subtype-is-full-union-complement-subtype-double-complement-subtype : + (P : subtype l2 A) → + is-full-subtype + ( union-subtype + ( complement-subtype P) + ( complement-subtype (complement-subtype P))) → + is-de-morgan-subtype P + is-de-morgan-subtype-is-full-union-complement-subtype-double-complement-subtype + P = + is-decidable-subtype-is-full-union-subtype-complement-subtype + ( complement-subtype P) + + is-full-union-subtype-complement-de-morgan-subtype : + (P : de-morgan-subtype l2 A) → + is-full-subtype + ( union-de-morgan-subtype P (complement-de-morgan-subtype P)) + is-full-union-subtype-complement-de-morgan-subtype P = + is-full-union-complement-subtype-double-complement-subtype + ( subtype-de-morgan-subtype P) + ( is-de-morgan-de-morgan-subtype P) +``` diff --git a/src/logic/de-morgan-propositions.lagda.md b/src/logic/de-morgan-propositions.lagda.md index a141582feb..2c4e7ea966 100644 --- a/src/logic/de-morgan-propositions.lagda.md +++ b/src/logic/de-morgan-propositions.lagda.md @@ -297,6 +297,32 @@ type-neg-De-Morgan-Prop : type-neg-De-Morgan-Prop P = type-De-Morgan-Prop (neg-De-Morgan-Prop P) ``` +### Propositional truncations of De Morgan types are De Morgan propositions + +```agda +module _ + {l1 : Level} {A : UU l1} + where + + is-de-morgan-prop-trunc-Prop : + is-de-morgan A → is-de-morgan-prop (type-trunc-Prop A) + is-de-morgan-prop-trunc-Prop a = + ( is-prop-type-trunc-Prop , is-de-morgan-trunc a) +``` + +### Disjunctions of De Morgan types are De Morgan propositions + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-de-morgan-prop-disjunction : + is-de-morgan A → is-de-morgan B → is-de-morgan-prop (disjunction-type A B) + is-de-morgan-prop-disjunction a b = + is-de-morgan-prop-trunc-Prop (is-de-morgan-coproduct a b) +``` + ### Negation has no fixed points on decidable propositions ```agda diff --git a/src/logic/de-morgan-types.lagda.md b/src/logic/de-morgan-types.lagda.md index 72813628aa..efda90c1aa 100644 --- a/src/logic/de-morgan-types.lagda.md +++ b/src/logic/de-morgan-types.lagda.md @@ -23,6 +23,8 @@ open import foundation.logical-equivalences open import foundation.negation open import foundation.propositional-truncations open import foundation.retracts-of-types +open import foundation.truncation-levels +open import foundation.truncations open import foundation.unit-type open import foundation.universe-levels @@ -342,6 +344,22 @@ module _ is-de-morgan-equiv = is-de-morgan-iff' (iff-equiv' e) ``` +### The truncation of a De Morgan type is De Morgan + +```agda +module _ + {l1 : Level} {A : UU l1} + where + + is-de-morgan-trunc : {k : 𝕋} → is-de-morgan A → is-de-morgan (type-trunc k A) + is-de-morgan-trunc {neg-two-𝕋} a = + is-de-morgan-is-contr is-trunc-type-trunc + is-de-morgan-trunc {succ-𝕋 k} (inl na) = + inl (map-universal-property-trunc (empty-Truncated-Type k) na) + is-de-morgan-trunc {succ-𝕋 k} (inr nna) = + inr (λ nn|a| → nna (λ a → nn|a| (unit-trunc a))) +``` + ### Products of De Morgan types are De Morgan ```agda @@ -358,6 +376,27 @@ module _ inr (is-irrefutable-product nna nnb) ``` +### Coproducts of De Morgan types are De Morgan + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + is-de-morgan-coproduct : + is-de-morgan A → is-de-morgan B → is-de-morgan (A + B) + is-de-morgan-coproduct (inl na) (inl nb) = + inl (rec-coproduct na nb) + is-de-morgan-coproduct (inl na) (inr nnb) = + inr (λ nab → nnb (λ nb → nab (inr nb))) + is-de-morgan-coproduct (inr nna) _ = + inr (λ nab → nna (λ na → nab (inl na))) + + is-de-morgan-disjunction : + is-de-morgan A → is-de-morgan B → is-de-morgan (disjunction-type A B) + is-de-morgan-disjunction a b = is-de-morgan-trunc (is-de-morgan-coproduct a b) +``` + ### The negation of a De Morgan type is De Morgan ```agda From 060b6ad9a6d9cd97118e18fbd7e6be4418522a45 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 3 Nov 2024 15:11:24 +0100 Subject: [PATCH 60/83] inhabited chains --- src/order-theory.lagda.md | 2 + src/order-theory/chains-posets.lagda.md | 6 +- src/order-theory/chains-preorders.lagda.md | 2 + .../inhabited-chains-posets.lagda.md | 171 ++++++++++++++++++ .../inhabited-chains-preorders.lagda.md | 111 ++++++++++++ .../maximal-chains-posets.lagda.md | 7 +- .../maximal-chains-preorders.lagda.md | 7 +- src/order-theory/total-orders.lagda.md | 14 +- 8 files changed, 311 insertions(+), 9 deletions(-) create mode 100644 src/order-theory/inhabited-chains-posets.lagda.md create mode 100644 src/order-theory/inhabited-chains-preorders.lagda.md diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index 2f88f8950e..f204407a0e 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -49,6 +49,8 @@ open import order-theory.homomorphisms-meet-sup-lattices public open import order-theory.homomorphisms-sup-lattices public open import order-theory.ideals-preorders public open import order-theory.inflattices public +open import order-theory.inhabited-chains-posets public +open import order-theory.inhabited-chains-preorders public open import order-theory.inhabited-finite-total-orders public open import order-theory.interval-subposets public open import order-theory.join-semilattices public diff --git a/src/order-theory/chains-posets.lagda.md b/src/order-theory/chains-posets.lagda.md index 99d9811a4b..830aeead27 100644 --- a/src/order-theory/chains-posets.lagda.md +++ b/src/order-theory/chains-posets.lagda.md @@ -79,8 +79,8 @@ module _ (C : chain-Poset l3 X) (D : chain-Poset l4 X) where - inclusion-chain-prop-Poset : Prop (l1 ⊔ l3 ⊔ l4) - inclusion-chain-prop-Poset = + inclusion-prop-chain-Poset : Prop (l1 ⊔ l3 ⊔ l4) + inclusion-prop-chain-Poset = inclusion-prop-chain-Preorder (preorder-Poset X) C D inclusion-chain-Poset : UU (l1 ⊔ l3 ⊔ l4) @@ -93,5 +93,7 @@ module _ ## External links +- [Total order, chains](https://en.wikipedia.org/wiki/Total_order#Chains) at + Wikipedia - [chain, in order theory](https://ncatlab.org/nlab/show/chain#in_order_theory) at $n$Lab diff --git a/src/order-theory/chains-preorders.lagda.md b/src/order-theory/chains-preorders.lagda.md index f620d50ff1..65c1ad4c19 100644 --- a/src/order-theory/chains-preorders.lagda.md +++ b/src/order-theory/chains-preorders.lagda.md @@ -94,5 +94,7 @@ module _ ## External links +- [Total order, chains](https://en.wikipedia.org/wiki/Total_order#Chains) at + Wikipedia - [chain, in order theory](https://ncatlab.org/nlab/show/chain#in_order_theory) at $n$Lab diff --git a/src/order-theory/inhabited-chains-posets.lagda.md b/src/order-theory/inhabited-chains-posets.lagda.md new file mode 100644 index 0000000000..055bb668ac --- /dev/null +++ b/src/order-theory/inhabited-chains-posets.lagda.md @@ -0,0 +1,171 @@ +# Inhabited chains in posets + +```agda +module order-theory.inhabited-chains-posets where +``` + +
Imports + +```agda +open import domain-theory.directed-families-posets + +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.disjunction +open import foundation.existential-quantification +open import foundation.inhabited-subtypes +open import foundation.inhabited-types +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels + +open import order-theory.chains-posets +open import order-theory.posets +open import order-theory.subposets +open import order-theory.total-preorders +``` + +
+ +## Idea + +An +{{#concept "inhabited chain" Disambiguation="in a poset" Agda=inhabited-chain-Poset}} +in a [poset](order-theory.posets.md) `P` is a +[subtype](foundation-core.subtypes.md) `S` of `P` such that the ordering of `P` +restricted to `S` is [linear](order-theory.total-posets.md). + +## Definitions + +### The predicate on chains in posets of being inhabited + +```agda +module _ + {l1 l2 l3 : Level} (X : Poset l1 l2) (S : chain-Poset l3 X) + where + + is-inhabited-prop-chain-Poset : Prop (l1 ⊔ l3) + is-inhabited-prop-chain-Poset = + is-inhabited-subtype-Prop (subposet-chain-Poset X S) + + is-inhabited-chain-Poset : UU (l1 ⊔ l3) + is-inhabited-chain-Poset = + type-Prop is-inhabited-prop-chain-Poset + + is-prop-is-inhabited-chain-Poset : + is-prop is-inhabited-chain-Poset + is-prop-is-inhabited-chain-Poset = + is-prop-type-Prop is-inhabited-prop-chain-Poset +``` + +### Inhabited chains in posets + +```agda +inhabited-chain-Poset : + {l1 l2 : Level} (l : Level) (X : Poset l1 l2) → UU (l1 ⊔ l2 ⊔ lsuc l) +inhabited-chain-Poset l X = + Σ (chain-Poset l X) (is-inhabited-chain-Poset X) + +module _ + {l1 l2 l3 : Level} (X : Poset l1 l2) (C : inhabited-chain-Poset l3 X) + where + + chain-inhabited-chain-Poset : chain-Poset l3 X + chain-inhabited-chain-Poset = pr1 C + + subposet-inhabited-chain-Poset : Subposet l3 X + subposet-inhabited-chain-Poset = + subposet-chain-Poset X chain-inhabited-chain-Poset + + is-chain-inhabited-chain-Poset : + is-chain-Subposet X subposet-inhabited-chain-Poset + is-chain-inhabited-chain-Poset = + is-chain-subposet-chain-Poset X chain-inhabited-chain-Poset + + is-inhabited-inhabited-chain-Poset : + is-inhabited-chain-Poset X chain-inhabited-chain-Poset + is-inhabited-inhabited-chain-Poset = pr2 C + + type-inhabited-chain-Poset : UU (l1 ⊔ l3) + type-inhabited-chain-Poset = + type-subtype subposet-inhabited-chain-Poset + + inclusion-subposet-inhabited-chain-Poset : + type-inhabited-chain-Poset → type-Poset X + inclusion-subposet-inhabited-chain-Poset = + inclusion-subtype subposet-inhabited-chain-Poset + +module _ + {l1 l2 l3 l4 : Level} (X : Poset l1 l2) + (C : inhabited-chain-Poset l3 X) (D : inhabited-chain-Poset l4 X) + where + + inclusion-prop-inhabited-chain-Poset : Prop (l1 ⊔ l3 ⊔ l4) + inclusion-prop-inhabited-chain-Poset = + inclusion-prop-chain-Poset X + ( chain-inhabited-chain-Poset X C) + ( chain-inhabited-chain-Poset X D) + + inclusion-inhabited-chain-Poset : UU (l1 ⊔ l3 ⊔ l4) + inclusion-inhabited-chain-Poset = + type-Prop inclusion-prop-inhabited-chain-Poset + + is-prop-inclusion-inhabited-chain-Poset : + is-prop inclusion-inhabited-chain-Poset + is-prop-inclusion-inhabited-chain-Poset = + is-prop-type-Prop inclusion-prop-inhabited-chain-Poset +``` + +## Properties + +### Inhabited chains are directed families + +```agda +module _ + {l1 l2 l3 : Level} (P : Poset l1 l2) (x : inhabited-chain-Poset l3 P) + where + + type-directed-family-inhabited-chain-Poset : UU (l1 ⊔ l3) + type-directed-family-inhabited-chain-Poset = type-inhabited-chain-Poset P x + + is-inhabited-type-directed-family-inhabited-chain-Poset : + is-inhabited type-directed-family-inhabited-chain-Poset + is-inhabited-type-directed-family-inhabited-chain-Poset = + is-inhabited-inhabited-chain-Poset P x + + inhabited-type-directed-family-inhabited-chain-Poset : + Inhabited-Type (l1 ⊔ l3) + inhabited-type-directed-family-inhabited-chain-Poset = + type-directed-family-inhabited-chain-Poset , + is-inhabited-type-directed-family-inhabited-chain-Poset + + family-directed-family-inhabited-chain-Poset : + type-directed-family-inhabited-chain-Poset → type-Poset P + family-directed-family-inhabited-chain-Poset = + inclusion-subposet-inhabited-chain-Poset P x + + is-directed-family-directed-family-inhabited-chain-Poset : + is-directed-family-Poset P + inhabited-type-directed-family-inhabited-chain-Poset + family-directed-family-inhabited-chain-Poset + is-directed-family-directed-family-inhabited-chain-Poset u v = + elim-disjunction + ( ∃ ( type-directed-family-inhabited-chain-Poset) + ( λ k → + leq-prop-Poset P + ( family-directed-family-inhabited-chain-Poset u) + ( family-directed-family-inhabited-chain-Poset k) ∧ + leq-prop-Poset P + ( family-directed-family-inhabited-chain-Poset v) + ( family-directed-family-inhabited-chain-Poset k))) + ( λ p → intro-exists v (p , refl-leq-Poset P (pr1 v))) + ( λ p → intro-exists u (refl-leq-Poset P (pr1 u) , p)) + ( is-chain-inhabited-chain-Poset P x u v) + + directed-family-inhabited-chain-Poset : + directed-family-Poset (l1 ⊔ l3) P + directed-family-inhabited-chain-Poset = + inhabited-type-directed-family-inhabited-chain-Poset , + family-directed-family-inhabited-chain-Poset , + is-directed-family-directed-family-inhabited-chain-Poset +``` diff --git a/src/order-theory/inhabited-chains-preorders.lagda.md b/src/order-theory/inhabited-chains-preorders.lagda.md new file mode 100644 index 0000000000..ac1e4dfdd3 --- /dev/null +++ b/src/order-theory/inhabited-chains-preorders.lagda.md @@ -0,0 +1,111 @@ +# Inhabited chains in preorders + +```agda +module order-theory.inhabited-chains-preorders where +``` + +
Imports + +```agda +open import foundation.dependent-pair-types +open import foundation.inhabited-subtypes +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels + +open import order-theory.chains-preorders +open import order-theory.preorders +open import order-theory.subpreorders +open import order-theory.total-preorders +``` + +
+ +## Idea + +An +{{#concept "inhabited chain" Disambiguation="in a preorder" Agda=inhabited-chain-Preorder}} +in a [preorder](order-theory.preorders.md) `P` is a +[subtype](foundation-core.subtypes.md) `S` of `P` such that the ordering of `P` +restricted to `S` is [linear](order-theory.total-preorders.md). + +## Definitions + +### The predicate on chains in preorders of being inhabited + +```agda +module _ + {l1 l2 l3 : Level} (X : Preorder l1 l2) (S : chain-Preorder l3 X) + where + + is-inhabited-prop-chain-Preorder : Prop (l1 ⊔ l3) + is-inhabited-prop-chain-Preorder = + is-inhabited-subtype-Prop (subpreorder-chain-Preorder X S) + + is-inhabited-chain-Preorder : UU (l1 ⊔ l3) + is-inhabited-chain-Preorder = + type-Prop is-inhabited-prop-chain-Preorder + + is-prop-is-inhabited-chain-Preorder : + is-prop is-inhabited-chain-Preorder + is-prop-is-inhabited-chain-Preorder = + is-prop-type-Prop is-inhabited-prop-chain-Preorder +``` + +### Inhabited chains in preorders + +```agda +inhabited-chain-Preorder : + {l1 l2 : Level} (l : Level) (X : Preorder l1 l2) → UU (l1 ⊔ l2 ⊔ lsuc l) +inhabited-chain-Preorder l X = + Σ (chain-Preorder l X) (is-inhabited-chain-Preorder X) + +module _ + {l1 l2 l3 : Level} (X : Preorder l1 l2) (C : inhabited-chain-Preorder l3 X) + where + + chain-inhabited-chain-Preorder : chain-Preorder l3 X + chain-inhabited-chain-Preorder = pr1 C + + subpreorder-inhabited-chain-Preorder : Subpreorder l3 X + subpreorder-inhabited-chain-Preorder = + subpreorder-chain-Preorder X chain-inhabited-chain-Preorder + + is-chain-inhabited-chain-Preorder : + is-chain-Subpreorder X subpreorder-inhabited-chain-Preorder + is-chain-inhabited-chain-Preorder = + is-chain-subpreorder-chain-Preorder X chain-inhabited-chain-Preorder + + is-inhabited-inhabited-chain-Preorder : + is-inhabited-chain-Preorder X chain-inhabited-chain-Preorder + is-inhabited-inhabited-chain-Preorder = pr2 C + + type-inhabited-chain-Preorder : UU (l1 ⊔ l3) + type-inhabited-chain-Preorder = + type-subtype subpreorder-inhabited-chain-Preorder + + inclusion-subpreorder-inhabited-chain-Preorder : + type-inhabited-chain-Preorder → type-Preorder X + inclusion-subpreorder-inhabited-chain-Preorder = + inclusion-subtype subpreorder-inhabited-chain-Preorder + +module _ + {l1 l2 l3 l4 : Level} (X : Preorder l1 l2) + (C : inhabited-chain-Preorder l3 X) (D : inhabited-chain-Preorder l4 X) + where + + inclusion-prop-inhabited-chain-Preorder : Prop (l1 ⊔ l3 ⊔ l4) + inclusion-prop-inhabited-chain-Preorder = + inclusion-prop-chain-Preorder X + ( chain-inhabited-chain-Preorder X C) + ( chain-inhabited-chain-Preorder X D) + + inclusion-inhabited-chain-Preorder : UU (l1 ⊔ l3 ⊔ l4) + inclusion-inhabited-chain-Preorder = + type-Prop inclusion-prop-inhabited-chain-Preorder + + is-prop-inclusion-inhabited-chain-Preorder : + is-prop inclusion-inhabited-chain-Preorder + is-prop-inclusion-inhabited-chain-Preorder = + is-prop-type-Prop inclusion-prop-inhabited-chain-Preorder +``` diff --git a/src/order-theory/maximal-chains-posets.lagda.md b/src/order-theory/maximal-chains-posets.lagda.md index ce5852dbf7..e62dabcc6e 100644 --- a/src/order-theory/maximal-chains-posets.lagda.md +++ b/src/order-theory/maximal-chains-posets.lagda.md @@ -19,8 +19,11 @@ open import order-theory.posets ## Idea -A **maximal chain** in a poset `P` is a chain `C` in `P` such that for any chain -`D` we have `C ⊆ D ⇒ C = D`. +A +{{#concept "maximal chain" Disambiguation="in a poset" Agda=maximal-chain-Poset}} +in a [poset](order-theory.posets.md) `P` is a +[chain](order-theory.chains-posets.md) `C` in `P` such that for any chain `D` we +have `C ⊆ D ⇒ C = D`. ## Definition diff --git a/src/order-theory/maximal-chains-preorders.lagda.md b/src/order-theory/maximal-chains-preorders.lagda.md index f79f5015d3..0cf6169f4f 100644 --- a/src/order-theory/maximal-chains-preorders.lagda.md +++ b/src/order-theory/maximal-chains-preorders.lagda.md @@ -19,8 +19,11 @@ open import order-theory.preorders ## Idea -A **maximal chain** in a preorder `P` is a chain `C` in `P` such that for every -chain `D` in `P` we have `C ⊆ D ⇒ D ⊆ C`. +A +{{#concept "maximal chain" Disambiguation="in a preorder" Agda=maximal-chain-Preorder}} +in a [preorder](order-theory.preorders.md) `P` is a +[chain](order-theory.chains-preorders.md) `C` in `P` such that for any chain `D` +we have `C ⊆ D ⇒ C = D`. ## Definition diff --git a/src/order-theory/total-orders.lagda.md b/src/order-theory/total-orders.lagda.md index c73fb79abf..1f84d69e67 100644 --- a/src/order-theory/total-orders.lagda.md +++ b/src/order-theory/total-orders.lagda.md @@ -23,10 +23,12 @@ open import order-theory.total-preorders ## Idea -A **total order**, or a **linear order**, is a [poset](order-theory.posets.md) -`P` such that for every two elements `x` and `y` in `P` the +A +{{#concept "total order" Disambiguation="on a type" WD="total order" WDID=Q369377 Agda=Total-Order}}, +or a **linear order**, is a [poset](order-theory.posets.md) `P` such that for +every two elements `x` and `y` in `P` the [disjunction](foundation.disjunction.md) `(x ≤ y) ∨ (y ≤ x)` holds. In other -words, total orders are totally ordered in the sense that any two elements are +words, total orders are _totally ordered_ in the sense that any two elements are comparable. ## Definitions @@ -115,3 +117,9 @@ module _ set-Total-Order : Set l1 set-Total-Order = set-Poset poset-Total-Order ``` + +## External links + +- [Total order](https://en.wikipedia.org/wiki/Total_order) at Wikipedia +- [total order](https://ncatlab.org/nlab/show/total+order) at $n$Lab +- [Total orders](https://1lab.dev/Order.Total.html) at 1lab From f366bf9e9fdadabfd1bec96fa4e596f1515783a3 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 3 Nov 2024 22:26:52 +0100 Subject: [PATCH 61/83] wip --- src/domain-theory.lagda.md | 5 +- .../directed-complete-posets.lagda.md | 6 +- ...theorem-directed-complete-posets.lagda.md} | 108 +++-- ...int-theorem-omega-complete-posets.lagda.md | 169 ++++++++ .../omega-complete-posets.lagda.md | 182 +++++++++ .../omega-continuous-maps-posets.lagda.md | 375 ++++++++++++++++++ .../scott-continuous-maps-posets.lagda.md | 3 +- ...dable-total-order-natural-numbers.lagda.md | 54 +++ ...rdering-principle-natural-numbers.lagda.md | 2 +- .../hilberts-epsilon-operators.lagda.md | 15 +- src/order-theory/chains-posets.lagda.md | 63 +++ .../greatest-lower-bounds-posets.lagda.md | 16 +- src/order-theory/inflattices.lagda.md | 2 +- src/order-theory/join-semilattices.lagda.md | 2 +- .../least-upper-bounds-posets.lagda.md | 25 +- src/order-theory/lower-bounds-posets.lagda.md | 8 +- src/order-theory/posets.lagda.md | 12 + src/order-theory/preorders.lagda.md | 21 +- src/order-theory/suplattices.lagda.md | 2 +- .../upper-bounds-chains-posets.lagda.md | 2 +- src/order-theory/upper-bounds-posets.lagda.md | 8 +- 21 files changed, 1010 insertions(+), 70 deletions(-) rename src/domain-theory/{kleenes-fixed-point-theorem.lagda.md => kleenes-fixed-point-theorem-directed-complete-posets.lagda.md} (50%) create mode 100644 src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md create mode 100644 src/domain-theory/omega-complete-posets.lagda.md create mode 100644 src/domain-theory/omega-continuous-maps-posets.lagda.md diff --git a/src/domain-theory.lagda.md b/src/domain-theory.lagda.md index cb4ed9a3c7..f0af1a2e9b 100644 --- a/src/domain-theory.lagda.md +++ b/src/domain-theory.lagda.md @@ -5,6 +5,9 @@ module domain-theory where open import domain-theory.directed-complete-posets public open import domain-theory.directed-families-posets public -open import domain-theory.kleenes-fixed-point-theorem public +open import domain-theory.kleenes-fixed-point-theorem-directed-complete-posets public +open import domain-theory.kleenes-fixed-point-theorem-omega-complete-posets public +open import domain-theory.omega-complete-posets public +open import domain-theory.omega-continuous-maps-posets public open import domain-theory.scott-continuous-maps-posets public ``` diff --git a/src/domain-theory/directed-complete-posets.lagda.md b/src/domain-theory/directed-complete-posets.lagda.md index ed9c11d0be..88c512f414 100644 --- a/src/domain-theory/directed-complete-posets.lagda.md +++ b/src/domain-theory/directed-complete-posets.lagda.md @@ -27,14 +27,14 @@ open import order-theory.posets ## Idea A -{{#concept "directed complete poset" WD="complete partial order" WDID=Q3082805 Agda=Directed-Complete-Poset}} +{{#concept "directed complete poset" WD="complete partial order" WDID=Q3082805 Agda=Directed-Complete-Poset}} is a [poset](order-theory.posets.md) such that all [directed families](domain-theory.directed-families-posets.md) have [least upper bounds](order-theory.least-upper-bounds-posets.md). ## Definitions -### The predicate on posets of being an directed complete poset +### The predicate on posets of being a directed complete poset ```agda module _ @@ -46,7 +46,7 @@ module _ Π-Prop ( directed-family-Poset l3 P) ( λ F → - has-least-upper-bound-family-of-elements-Poset-Prop P + has-least-upper-bound-family-of-elements-prop-Poset P ( family-directed-family-Poset P F)) is-directed-complete-Poset : UU (l1 ⊔ l2 ⊔ lsuc l3) diff --git a/src/domain-theory/kleenes-fixed-point-theorem.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-directed-complete-posets.lagda.md similarity index 50% rename from src/domain-theory/kleenes-fixed-point-theorem.lagda.md rename to src/domain-theory/kleenes-fixed-point-theorem-directed-complete-posets.lagda.md index 5f2af92105..8e2133a78a 100644 --- a/src/domain-theory/kleenes-fixed-point-theorem.lagda.md +++ b/src/domain-theory/kleenes-fixed-point-theorem-directed-complete-posets.lagda.md @@ -1,7 +1,7 @@ -# Kleene's fixed point theorem +# Kleene's fixed point theorem for directed complete posets ```agda -module domain-theory.kleenes-fixed-point-theorem where +module domain-theory.kleenes-fixed-point-theorem-directed-complete-posets where ```
Imports @@ -11,9 +11,14 @@ open import domain-theory.directed-complete-posets open import domain-theory.directed-families-posets open import domain-theory.scott-continuous-maps-posets +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.conjunction +open import foundation.coproduct-types open import foundation.dependent-pair-types +open import foundation.existential-quantification open import foundation.fixed-points-endofunctions open import foundation.identity-types open import foundation.inhabited-types @@ -23,7 +28,10 @@ open import foundation.propositional-truncations open import foundation.universe-levels open import order-theory.bottom-elements-posets +open import order-theory.chains-posets open import order-theory.inflattices +open import order-theory.inhabited-chains-posets +open import order-theory.least-upper-bounds-posets open import order-theory.order-preserving-maps-posets open import order-theory.posets open import order-theory.suplattices @@ -43,7 +51,7 @@ element, then `f` has a least fixed point. ## Theorem -### Kleene's fixed point theorem for suplattices +### Kleene's fixed point theorem for directed complete posets ```agda module _ @@ -57,67 +65,115 @@ module _ ( lzero) ( f)) (x : type-Directed-Complete-Poset 𝒜) + (p : leq-Directed-Complete-Poset 𝒜 x (f x)) where + leq-iterate-kleene-Directed-Complete-Poset : + (n : ℕ) → + leq-Directed-Complete-Poset 𝒜 (iterate n f x) (iterate (succ-ℕ n) f x) + leq-iterate-kleene-Directed-Complete-Poset zero-ℕ = p + leq-iterate-kleene-Directed-Complete-Poset (succ-ℕ n) = + preserves-order-is-scott-continuous-map-Poset + ( poset-Directed-Complete-Poset 𝒜) + ( poset-Directed-Complete-Poset 𝒜) + ( F) + ( iterate n f x) + ( iterate (succ-ℕ n) f x) + ( leq-iterate-kleene-Directed-Complete-Poset n) + + hom-kleene-Directed-Complete-Poset : + hom-Poset ℕ-Poset (poset-Directed-Complete-Poset 𝒜) + hom-kleene-Directed-Complete-Poset = + hom-ind-ℕ-Poset + ( poset-Directed-Complete-Poset 𝒜) + ( λ n → iterate n f x) + ( leq-iterate-kleene-Directed-Complete-Poset) + indexing-type-kleene-Directed-Complete-Poset : UU lzero indexing-type-kleene-Directed-Complete-Poset = ℕ is-inhabited-indexing-type-kleene-Directed-Complete-Poset : is-inhabited indexing-type-kleene-Directed-Complete-Poset is-inhabited-indexing-type-kleene-Directed-Complete-Poset = - unit-trunc-Prop zero-ℕ + unit-trunc-Prop 0 indexing-inhabited-type-kleene-Directed-Complete-Poset : Inhabited-Type lzero indexing-inhabited-type-kleene-Directed-Complete-Poset = indexing-type-kleene-Directed-Complete-Poset , is-inhabited-indexing-type-kleene-Directed-Complete-Poset - family-of-elements-kleene-Directed-Complete-Poset : - indexing-type-kleene-Directed-Complete-Poset → - type-Directed-Complete-Poset 𝒜 - family-of-elements-kleene-Directed-Complete-Poset n = iterate n f x + family-kleene-Directed-Complete-Poset : + ℕ → type-Directed-Complete-Poset 𝒜 + family-kleene-Directed-Complete-Poset n = iterate n f x + + preserves-order-family-kleene-Directed-Complete-Poset : + preserves-order-Poset + ( ℕ-Poset) + ( poset-Directed-Complete-Poset 𝒜) + ( family-kleene-Directed-Complete-Poset) + preserves-order-family-kleene-Directed-Complete-Poset = + preserves-order-ind-ℕ-Poset + ( poset-Directed-Complete-Poset 𝒜) + ( family-kleene-Directed-Complete-Poset) + ( leq-iterate-kleene-Directed-Complete-Poset) - is-directed-family-of-elements-kleene-Directed-Complete-Poset : + is-directed-family-kleene-Directed-Complete-Poset : is-directed-family-Poset ( poset-Directed-Complete-Poset 𝒜) ( indexing-inhabited-type-kleene-Directed-Complete-Poset) - ( family-of-elements-kleene-Directed-Complete-Poset) - is-directed-family-of-elements-kleene-Directed-Complete-Poset u v = - {! !} - - directed-family-of-elements-kleene-Directed-Complete-Poset : + ( family-kleene-Directed-Complete-Poset) + is-directed-family-kleene-Directed-Complete-Poset n m = + rec-coproduct + ( λ p → + intro-exists m + ( preserves-order-family-kleene-Directed-Complete-Poset n m p , + preserves-order-family-kleene-Directed-Complete-Poset m m + ( refl-leq-ℕ m))) + ( λ p → + intro-exists n + ( preserves-order-family-kleene-Directed-Complete-Poset n n + ( refl-leq-ℕ n) , + preserves-order-family-kleene-Directed-Complete-Poset m n p)) + ( linear-leq-ℕ n m) + + directed-family-kleene-Directed-Complete-Poset : directed-family-Poset lzero (poset-Directed-Complete-Poset 𝒜) - directed-family-of-elements-kleene-Directed-Complete-Poset = + directed-family-kleene-Directed-Complete-Poset = indexing-inhabited-type-kleene-Directed-Complete-Poset , - family-of-elements-kleene-Directed-Complete-Poset , - is-directed-family-of-elements-kleene-Directed-Complete-Poset + family-kleene-Directed-Complete-Poset , + is-directed-family-kleene-Directed-Complete-Poset point-kleene-Directed-Complete-Poset : type-Directed-Complete-Poset 𝒜 point-kleene-Directed-Complete-Poset = - sup-Directed-Complete-Poset 𝒜 - ( directed-family-of-elements-kleene-Directed-Complete-Poset) + sup-Directed-Complete-Poset 𝒜 directed-family-kleene-Directed-Complete-Poset leq-point-kleene-Directed-Complete-Poset : leq-Directed-Complete-Poset 𝒜 ( point-kleene-Directed-Complete-Poset) ( f point-kleene-Directed-Complete-Poset) - leq-point-kleene-Directed-Complete-Poset = {! !} + leq-point-kleene-Directed-Complete-Poset = {! pr1 (F ? ? ?) ? !} geq-point-kleene-Directed-Complete-Poset : leq-Directed-Complete-Poset 𝒜 ( f point-kleene-Directed-Complete-Poset) ( point-kleene-Directed-Complete-Poset) - geq-point-kleene-Directed-Complete-Poset = {! !} + geq-point-kleene-Directed-Complete-Poset = + pr1 + ( F ( directed-family-kleene-Directed-Complete-Poset) + ( is-directed-complete-Directed-Complete-Poset 𝒜 + directed-family-kleene-Directed-Complete-Poset) + ( point-kleene-Directed-Complete-Poset)) + {! !} is-fixed-point-kleene-Directed-Complete-Poset : f ( point-kleene-Directed-Complete-Poset) = point-kleene-Directed-Complete-Poset is-fixed-point-kleene-Directed-Complete-Poset = - antisymmetric-leq-Directed-Complete-Poset 𝒜 - ( f (point-kleene-Directed-Complete-Poset)) - ( point-kleene-Directed-Complete-Poset) - ( geq-point-kleene-Directed-Complete-Poset) - ( leq-point-kleene-Directed-Complete-Poset) + eq-is-least-upper-bound-family-of-elements-Poset + ( poset-Directed-Complete-Poset 𝒜) + (λ where a → {! !}) + ( is-least-upper-bound-sup-Directed-Complete-Poset 𝒜 + ( directed-family-kleene-Directed-Complete-Poset)) fixed-point-kleene-Directed-Complete-Poset : fixed-point f fixed-point-kleene-Directed-Complete-Poset = diff --git a/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md new file mode 100644 index 0000000000..2fdd69379a --- /dev/null +++ b/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md @@ -0,0 +1,169 @@ +# Kleene's fixed point theorem for ω-complete posets + +```agda +module domain-theory.kleenes-fixed-point-theorem-omega-complete-posets where +``` + +
Imports + +```agda +open import domain-theory.directed-families-posets +open import domain-theory.omega-complete-posets +open import domain-theory.omega-continuous-maps-posets + +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.dependent-pair-types +open import foundation.fixed-points-endofunctions +open import foundation.identity-types +open import foundation.inhabited-types +open import foundation.iterating-functions +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.universe-levels + +open import order-theory.bottom-elements-posets +open import order-theory.chains-posets +open import order-theory.inflattices +open import order-theory.inhabited-chains-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +open import order-theory.suplattices +``` + +
+ +## Idea + +{{#concept "Kleene's fixed point theorem" Disambiguation="ω-complete posets" WD="Kleene fixed-point theorem" WDID=Q3527263}} +states that every [Scott-continuous](domain-theory.ω-continuous-maps-posets.md) +endomap `f : 𝒜 → 𝒜` on an inhabited +[ω-complete poset](domain-theory.omega-complete-posets.md) `𝒜` has a +[fixed point](foundation.fixed-points-endofunctions.md), and if `𝒜` has a bottom +element, then `f` has a least fixed point. + +## Theorem + +### Kleene's fixed point theorem for ω-complete posets + +```agda +module _ + {l1 l2 : Level} + (𝒜 : ω-Complete-Poset l1 l2) + (f : type-ω-Complete-Poset 𝒜 → type-ω-Complete-Poset 𝒜) + (F : + is-ω-continuous-map-Poset + ( poset-ω-Complete-Poset 𝒜) + ( poset-ω-Complete-Poset 𝒜) + ( f)) + (x : type-ω-Complete-Poset 𝒜) + (p : leq-ω-Complete-Poset 𝒜 x (f x)) + where + + leq-iterate-kleene-ω-Complete-Poset : + (n : ℕ) → + leq-ω-Complete-Poset 𝒜 (iterate n f x) (iterate (succ-ℕ n) f x) + leq-iterate-kleene-ω-Complete-Poset zero-ℕ = p + leq-iterate-kleene-ω-Complete-Poset (succ-ℕ n) = + preserves-order-is-ω-continuous-map-Poset + ( poset-ω-Complete-Poset 𝒜) + ( poset-ω-Complete-Poset 𝒜) + ( F) + ( iterate n f x) + ( iterate (succ-ℕ n) f x) + ( leq-iterate-kleene-ω-Complete-Poset n) + + hom-kleene-ω-Complete-Poset : + hom-Poset ℕ-Poset (poset-ω-Complete-Poset 𝒜) + hom-kleene-ω-Complete-Poset = + hom-ind-ℕ-Poset + ( poset-ω-Complete-Poset 𝒜) + ( λ n → iterate n f x) + ( leq-iterate-kleene-ω-Complete-Poset) + + chain-kleene-ω-Complete-Poset : + chain-Poset l1 (poset-ω-Complete-Poset 𝒜) + chain-kleene-ω-Complete-Poset = + chain-hom-total-order-Poset + ( poset-ω-Complete-Poset 𝒜) + ( ℕ-Total-Order) + ( hom-kleene-ω-Complete-Poset) + + is-inhabited-chain-kleene-ω-Complete-Poset : + is-inhabited-chain-Poset + ( poset-ω-Complete-Poset 𝒜) + ( chain-kleene-ω-Complete-Poset) + is-inhabited-chain-kleene-ω-Complete-Poset = + unit-trunc-Prop (x , unit-trunc-Prop (0 , refl)) + + inhabited-chain-kleene-ω-Complete-Poset : + inhabited-chain-Poset l1 (poset-ω-Complete-Poset 𝒜) + inhabited-chain-kleene-ω-Complete-Poset = + chain-kleene-ω-Complete-Poset , + is-inhabited-chain-kleene-ω-Complete-Poset + + indexing-type-kleene-ω-Complete-Poset : UU lzero + indexing-type-kleene-ω-Complete-Poset = ℕ + + is-inhabited-indexing-type-kleene-ω-Complete-Poset : + is-inhabited indexing-type-kleene-ω-Complete-Poset + is-inhabited-indexing-type-kleene-ω-Complete-Poset = + unit-trunc-Prop 0 + + indexing-inhabited-type-kleene-ω-Complete-Poset : Inhabited-Type lzero + indexing-inhabited-type-kleene-ω-Complete-Poset = + indexing-type-kleene-ω-Complete-Poset , + is-inhabited-indexing-type-kleene-ω-Complete-Poset + + directed-family-kleene-ω-Complete-Poset : + directed-family-Poset l1 (poset-ω-Complete-Poset 𝒜) + directed-family-kleene-ω-Complete-Poset = + directed-family-inhabited-chain-Poset + ( poset-ω-Complete-Poset 𝒜) + ( inhabited-chain-kleene-ω-Complete-Poset) + + point-kleene-ω-Complete-Poset : type-ω-Complete-Poset 𝒜 + point-kleene-ω-Complete-Poset = {! sup-ω-Complete-Poset 𝒜 ? !} + -- sup-ω-Complete-Poset 𝒜 + -- ( directed-family-kleene-ω-Complete-Poset) + + -- leq-point-kleene-ω-Complete-Poset : + -- leq-ω-Complete-Poset 𝒜 + -- ( point-kleene-ω-Complete-Poset) + -- ( f point-kleene-ω-Complete-Poset) + -- leq-point-kleene-ω-Complete-Poset = {! !} + + -- geq-point-kleene-ω-Complete-Poset : + -- leq-ω-Complete-Poset 𝒜 + -- ( f point-kleene-ω-Complete-Poset) + -- ( point-kleene-ω-Complete-Poset) + -- geq-point-kleene-ω-Complete-Poset = {! !} + + -- is-fixed-point-kleene-ω-Complete-Poset : + -- f ( point-kleene-ω-Complete-Poset) = + -- point-kleene-ω-Complete-Poset + -- is-fixed-point-kleene-ω-Complete-Poset = + -- antisymmetric-leq-ω-Complete-Poset 𝒜 + -- ( f (point-kleene-ω-Complete-Poset)) + -- ( point-kleene-ω-Complete-Poset) + -- ( geq-point-kleene-ω-Complete-Poset) + -- ( leq-point-kleene-ω-Complete-Poset) + + -- fixed-point-kleene-ω-Complete-Poset : fixed-point f + -- fixed-point-kleene-ω-Complete-Poset = + -- point-kleene-ω-Complete-Poset , + -- is-fixed-point-kleene-ω-Complete-Poset +``` + +### Kleene's fixed point theorem for ω-complete posets with a bottom element + +> TODO + +## External links + +- [Kleene fixed-point theorem](https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem) + at Wikipedia +- [Kleene's fixed point theorem](https://ncatlab.org/nlab/show/Kleene%27s+fixed+point+theorem) + at $n$Lab diff --git a/src/domain-theory/omega-complete-posets.lagda.md b/src/domain-theory/omega-complete-posets.lagda.md new file mode 100644 index 0000000000..5f47ad61dc --- /dev/null +++ b/src/domain-theory/omega-complete-posets.lagda.md @@ -0,0 +1,182 @@ +# ω-complete posets + +```agda +module domain-theory.omega-complete-posets 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.binary-relations +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.logical-equivalences +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.least-upper-bounds-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +``` + +
+ +## Idea + +An +{{#concept "ω-complete poset" WD="complete partial order" WDID=Q3082805 Agda=ω-Complete-Poset}} +is a [poset](order-theory.posets.md) `P` such that every ascending +[chain](order-theory.chains-posets.md) + +```text + ℕ → P +``` + +has a [supremum](order-theory.least-upper-bounds--posets.md) in `P`. + +## Definitions + +### The predicate on posets of being an ω-complete poset + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) + where + + is-ω-complete-Poset-Prop : Prop (l1 ⊔ l2) + is-ω-complete-Poset-Prop = + Π-Prop + ( hom-Poset ℕ-Poset P) + ( λ F → + has-least-upper-bound-family-of-elements-prop-Poset P + ( map-hom-Poset ℕ-Poset P F)) + + is-ω-complete-Poset : UU (l1 ⊔ l2) + is-ω-complete-Poset = + type-Prop is-ω-complete-Poset-Prop + + is-prop-is-ω-complete-Poset : is-prop is-ω-complete-Poset + is-prop-is-ω-complete-Poset = + is-prop-type-Prop is-ω-complete-Poset-Prop + +module _ + {l1 l2 : Level} (P : Poset l1 l2) (H : is-ω-complete-Poset P) + where + + sup-is-ω-complete-Poset : hom-Poset ℕ-Poset P → type-Poset P + sup-is-ω-complete-Poset F = pr1 (H F) + + is-least-upper-bound-sup-is-ω-complete-Poset : + (x : hom-Poset ℕ-Poset P) → + is-least-upper-bound-family-of-elements-Poset P + ( map-hom-Poset ℕ-Poset P x) + ( sup-is-ω-complete-Poset x) + is-least-upper-bound-sup-is-ω-complete-Poset F = pr2 (H F) +``` + +### ω-Complete posets + +```agda +ω-Complete-Poset : + (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +ω-Complete-Poset l1 l2 = + Σ (Poset l1 l2) (is-ω-complete-Poset) + +module _ + {l1 l2 : Level} (A : ω-Complete-Poset l1 l2) + where + + poset-ω-Complete-Poset : Poset l1 l2 + poset-ω-Complete-Poset = pr1 A + + type-ω-Complete-Poset : UU l1 + type-ω-Complete-Poset = + type-Poset poset-ω-Complete-Poset + + leq-prop-ω-Complete-Poset : + (x y : type-ω-Complete-Poset) → Prop l2 + leq-prop-ω-Complete-Poset = + leq-prop-Poset poset-ω-Complete-Poset + + leq-ω-Complete-Poset : + (x y : type-ω-Complete-Poset) → UU l2 + leq-ω-Complete-Poset = + leq-Poset poset-ω-Complete-Poset + + is-prop-leq-ω-Complete-Poset : + (x y : type-ω-Complete-Poset) → + is-prop (leq-ω-Complete-Poset x y) + is-prop-leq-ω-Complete-Poset = + is-prop-leq-Poset poset-ω-Complete-Poset + + refl-leq-ω-Complete-Poset : + (x : type-ω-Complete-Poset) → + leq-ω-Complete-Poset x x + refl-leq-ω-Complete-Poset = + refl-leq-Poset poset-ω-Complete-Poset + + antisymmetric-leq-ω-Complete-Poset : + is-antisymmetric leq-ω-Complete-Poset + antisymmetric-leq-ω-Complete-Poset = + antisymmetric-leq-Poset poset-ω-Complete-Poset + + transitive-leq-ω-Complete-Poset : + is-transitive leq-ω-Complete-Poset + transitive-leq-ω-Complete-Poset = + transitive-leq-Poset poset-ω-Complete-Poset + + is-set-type-ω-Complete-Poset : + is-set type-ω-Complete-Poset + is-set-type-ω-Complete-Poset = + is-set-type-Poset poset-ω-Complete-Poset + + set-ω-Complete-Poset : Set l1 + set-ω-Complete-Poset = + set-Poset poset-ω-Complete-Poset + + is-ω-complete-ω-Complete-Poset : + is-ω-complete-Poset poset-ω-Complete-Poset + is-ω-complete-ω-Complete-Poset = pr2 A + + sup-ω-Complete-Poset : + hom-Poset ℕ-Poset poset-ω-Complete-Poset → + type-ω-Complete-Poset + sup-ω-Complete-Poset = + sup-is-ω-complete-Poset + ( poset-ω-Complete-Poset) + ( is-ω-complete-ω-Complete-Poset) + + is-least-upper-bound-sup-ω-Complete-Poset : + (x : hom-Poset ℕ-Poset poset-ω-Complete-Poset) → + is-least-upper-bound-family-of-elements-Poset + ( poset-ω-Complete-Poset) + ( map-hom-Poset ℕ-Poset poset-ω-Complete-Poset x) + ( sup-ω-Complete-Poset x) + is-least-upper-bound-sup-ω-Complete-Poset = + is-least-upper-bound-sup-is-ω-complete-Poset + ( poset-ω-Complete-Poset) + ( is-ω-complete-ω-Complete-Poset) + + leq-sup-ω-Complete-Poset : + (x : hom-Poset ℕ-Poset poset-ω-Complete-Poset) + (i : ℕ) → + leq-ω-Complete-Poset + ( map-hom-Poset ℕ-Poset poset-ω-Complete-Poset x i) + ( sup-ω-Complete-Poset x) + leq-sup-ω-Complete-Poset x = + backward-implication + ( is-least-upper-bound-sup-ω-Complete-Poset + ( x) + ( sup-ω-Complete-Poset x)) + ( refl-leq-ω-Complete-Poset (sup-ω-Complete-Poset x)) +``` + +## External links + +- [dcpo](https://ncatlab.org/nlab/show/dcpo) at $n$Lab diff --git a/src/domain-theory/omega-continuous-maps-posets.lagda.md b/src/domain-theory/omega-continuous-maps-posets.lagda.md new file mode 100644 index 0000000000..aedf8cf833 --- /dev/null +++ b/src/domain-theory/omega-continuous-maps-posets.lagda.md @@ -0,0 +1,375 @@ +# ω-continuous maps between posets + +```agda +module domain-theory.omega-continuous-maps-posets where +``` + +
Imports + +```agda +open import domain-theory.directed-families-posets + +open import elementary-number-theory.decidable-total-order-natural-numbers +open import elementary-number-theory.inequality-natural-numbers + +open import foundation.booleans +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.evaluation-functions +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.fundamental-theorem-of-identity-types +open import foundation.homotopies +open import foundation.homotopy-induction +open import foundation.identity-types +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.strictly-involutive-identity-types +open import foundation.subtype-identity-principle +open import foundation.surjective-maps +open import foundation.torsorial-type-families +open import foundation.universe-levels + +open import order-theory.least-upper-bounds-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +``` + +
+ +## Idea + +A map `f : P → Q` between the underlying types of two +[posets](order-theory.posets.md) is said to be +{{#concept "ω-continuous" Disambiguation="map of posets" Agda=ω-continuous-map-Poset}} + +```text + f(⋃ᵢxᵢ) = ⋃ᵢf(xᵢ) +``` + +for every [directed family](domain-theory.directed-families-posets.md) +`x₍₋₎ : I → P` with a [supremum](order-theory.least-upper-bounds-posets.md) in +`P`. + +## Definitions + +### The predicate of preserving the supremum of a directed family + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + (f : type-Poset P → type-Poset Q) + (x : hom-Poset ℕ-Poset P) + where + + preserves-ω-supremum-map-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-ω-supremum-map-Poset = + (y : + has-least-upper-bound-family-of-elements-Poset P + ( map-hom-Poset ℕ-Poset P x)) → + is-least-upper-bound-family-of-elements-Poset Q + ( f ∘ map-hom-Poset ℕ-Poset P x) + ( f (pr1 y)) + + is-prop-preserves-ω-supremum-map-Poset : + is-prop preserves-ω-supremum-map-Poset + is-prop-preserves-ω-supremum-map-Poset = + is-prop-Π + ( λ y → + is-prop-is-least-upper-bound-family-of-elements-Poset Q + ( f ∘ map-hom-Poset ℕ-Poset P x) + ( f (pr1 y))) + + preserves-ω-supremum-prop-map-Poset : + Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-ω-supremum-prop-map-Poset = + preserves-ω-supremum-map-Poset , + is-prop-preserves-ω-supremum-map-Poset +``` + +### The predicate on a map of posets of being ω-continuous + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + is-ω-continuous-map-Poset : + (type-Poset P → type-Poset Q) → + UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + is-ω-continuous-map-Poset f = + (x : hom-Poset ℕ-Poset P) + (y : + has-least-upper-bound-family-of-elements-Poset P + ( map-hom-Poset ℕ-Poset P x)) → + is-least-upper-bound-family-of-elements-Poset Q + ( f ∘ map-hom-Poset ℕ-Poset P x) + ( f (pr1 y)) + + is-prop-is-ω-continuous-map-Poset : + (f : type-Poset P → type-Poset Q) → + is-prop (is-ω-continuous-map-Poset f) + is-prop-is-ω-continuous-map-Poset f = + is-prop-Π (is-prop-preserves-ω-supremum-map-Poset P Q f) + + is-ω-continuous-prop-map-Poset : + (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) + is-ω-continuous-prop-map-Poset f = + ( is-ω-continuous-map-Poset f) , + ( is-prop-is-ω-continuous-map-Poset f) + + ω-continuous-hom-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + ω-continuous-hom-Poset = + Σ (type-Poset P → type-Poset Q) (is-ω-continuous-map-Poset) + + map-ω-continuous-hom-Poset : + ω-continuous-hom-Poset → type-Poset P → type-Poset Q + map-ω-continuous-hom-Poset = pr1 + + is-ω-continuous-map-ω-continuous-hom-Poset : + (f : ω-continuous-hom-Poset) → + is-ω-continuous-map-Poset (map-ω-continuous-hom-Poset f) + is-ω-continuous-map-ω-continuous-hom-Poset = pr2 + + sup-map-ω-continuous-hom-Poset : + (f : ω-continuous-hom-Poset) → + (x : hom-Poset ℕ-Poset P) → + has-least-upper-bound-family-of-elements-Poset P + ( map-hom-Poset ℕ-Poset P x) → + has-least-upper-bound-family-of-elements-Poset Q + ( map-ω-continuous-hom-Poset f ∘ map-hom-Poset ℕ-Poset P x) + sup-map-ω-continuous-hom-Poset f x y = + ( map-ω-continuous-hom-Poset f (pr1 y) , + is-ω-continuous-map-ω-continuous-hom-Poset f x y) +``` + +## Properties + +### ω-Continuous maps preserve order + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + abstract + preserves-order-is-ω-continuous-map-Poset : + {f : type-Poset P → type-Poset Q} → + is-ω-continuous-map-Poset P Q f → + preserves-order-Poset P Q f + preserves-order-is-ω-continuous-map-Poset {f} H x y p = + pr2 (H ((λ n → {! !}) , {! !}) ({! !} , {! !}) (f y)) {! p !} {! !} + -- pr2 + -- ( preserves-small-supremum-omega-is-ω-continuous-map-Poset + -- ( P) + -- ( Q) + -- ( H) + -- ( ( bool , unit-trunc-Prop true) , + -- rec-bool x y , + -- λ where + -- true true → + -- intro-exists true (refl-leq-Poset P x , refl-leq-Poset P x) + -- true false → + -- intro-exists false (p , refl-leq-Poset P y) + -- false true → + -- intro-exists false (refl-leq-Poset P y , p) + -- false false → + -- intro-exists false (refl-leq-Poset P y , refl-leq-Poset P y)) + -- ( Raise l5 bool) + -- ( y , + -- λ z → + -- ( ( ev (map-raise false)) , + -- ( λ where + -- u (map-raise true) → transitive-leq-Poset P x y z u p + -- u (map-raise false) → u))) + -- ( f y)) + -- ( refl-leq-Poset Q (f y)) + -- ( map-raise true) + + hom-ω-continuous-hom-Poset : + ω-continuous-hom-Poset P Q → hom-Poset P Q + hom-ω-continuous-hom-Poset f = + map-ω-continuous-hom-Poset P Q f , + preserves-order-is-ω-continuous-map-Poset + ( is-ω-continuous-map-ω-continuous-hom-Poset P Q f) +``` + +### Homotopies of ω-continuous maps + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + htpy-ω-continuous-hom-Poset : + (f g : ω-continuous-hom-Poset P Q) → UU (l1 ⊔ l3) + htpy-ω-continuous-hom-Poset f g = + map-ω-continuous-hom-Poset P Q f ~ map-ω-continuous-hom-Poset P Q g + + refl-htpy-ω-continuous-hom-Poset : + (f : ω-continuous-hom-Poset P Q) → + htpy-ω-continuous-hom-Poset f f + refl-htpy-ω-continuous-hom-Poset f = refl-htpy + + htpy-eq-ω-continuous-hom-Poset : + (f g : ω-continuous-hom-Poset P Q) → + f = g → + htpy-ω-continuous-hom-Poset f g + htpy-eq-ω-continuous-hom-Poset f .f refl = + refl-htpy-ω-continuous-hom-Poset f + + is-torsorial-htpy-ω-continuous-hom-Poset : + (f : ω-continuous-hom-Poset P Q) → + is-torsorial (htpy-ω-continuous-hom-Poset f) + is-torsorial-htpy-ω-continuous-hom-Poset f = + is-torsorial-Eq-subtype + ( is-torsorial-htpy (map-ω-continuous-hom-Poset P Q f)) + ( is-prop-is-ω-continuous-map-Poset P Q) + ( map-ω-continuous-hom-Poset P Q f) + ( refl-htpy) + ( is-ω-continuous-map-ω-continuous-hom-Poset P Q f) + + is-equiv-htpy-eq-ω-continuous-hom-Poset : + (f g : ω-continuous-hom-Poset P Q) → + is-equiv (htpy-eq-ω-continuous-hom-Poset f g) + is-equiv-htpy-eq-ω-continuous-hom-Poset f = + fundamental-theorem-id + ( is-torsorial-htpy-ω-continuous-hom-Poset f) + ( htpy-eq-ω-continuous-hom-Poset f) + + extensionality-ω-continuous-hom-Poset : + (f g : ω-continuous-hom-Poset P Q) → + (f = g) ≃ htpy-ω-continuous-hom-Poset f g + pr1 (extensionality-ω-continuous-hom-Poset f g) = + htpy-eq-ω-continuous-hom-Poset f g + pr2 (extensionality-ω-continuous-hom-Poset f g) = + is-equiv-htpy-eq-ω-continuous-hom-Poset f g + + eq-htpy-ω-continuous-hom-Poset : + (f g : ω-continuous-hom-Poset P Q) → + htpy-ω-continuous-hom-Poset f g → f = g + eq-htpy-ω-continuous-hom-Poset f g = + map-inv-is-equiv (is-equiv-htpy-eq-ω-continuous-hom-Poset f g) +``` + +### The identity ω-continuous map + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) + where + + is-ω-continuous-id-Poset : + is-ω-continuous-map-Poset P P (id {A = type-Poset P}) + is-ω-continuous-id-Poset x y = pr2 y + + id-ω-continuous-hom-Poset : ω-continuous-hom-Poset P P + id-ω-continuous-hom-Poset = id , is-ω-continuous-id-Poset +``` + +### Composing ω-continuous maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) (R : Poset l5 l6) + where + + is-ω-continuous-comp-Poset : + (g : ω-continuous-hom-Poset Q R) + (f : ω-continuous-hom-Poset P Q) → + is-ω-continuous-map-Poset P R + ( map-ω-continuous-hom-Poset Q R g ∘ + map-ω-continuous-hom-Poset P Q f) + is-ω-continuous-comp-Poset g f c y = + is-ω-continuous-map-ω-continuous-hom-Poset Q R g + ( comp-hom-Poset ℕ-Poset P Q (hom-ω-continuous-hom-Poset P Q f) c) + ( map-ω-continuous-hom-Poset P Q f (pr1 y) , + is-ω-continuous-map-ω-continuous-hom-Poset P Q f c y) + + comp-ω-continuous-hom-Poset : + (g : ω-continuous-hom-Poset Q R) + (f : ω-continuous-hom-Poset P Q) → + ω-continuous-hom-Poset P R + comp-ω-continuous-hom-Poset g f = + map-ω-continuous-hom-Poset Q R g ∘ + map-ω-continuous-hom-Poset P Q f , + is-ω-continuous-comp-Poset g f +``` + +### Unit laws for composition of ω-continuous maps + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + left-unit-law-comp-ω-continuous-hom-Poset : + (f : ω-continuous-hom-Poset P Q) → + ( comp-ω-continuous-hom-Poset P Q Q + ( id-ω-continuous-hom-Poset Q) + ( f)) = + ( f) + left-unit-law-comp-ω-continuous-hom-Poset f = + eq-htpy-ω-continuous-hom-Poset P Q + ( comp-ω-continuous-hom-Poset P Q Q + ( id-ω-continuous-hom-Poset Q) + ( f)) + ( f) + ( refl-htpy) + + right-unit-law-comp-ω-continuous-hom-Poset : + (f : ω-continuous-hom-Poset P Q) → + ( comp-ω-continuous-hom-Poset P P Q + ( f) + ( id-ω-continuous-hom-Poset P)) = + ( f) + right-unit-law-comp-ω-continuous-hom-Poset f = + eq-htpy-ω-continuous-hom-Poset P Q + ( comp-ω-continuous-hom-Poset P P Q + ( f) + ( id-ω-continuous-hom-Poset P)) + ( f) + ( refl-htpy) +``` + +### Associativity of composition of ω-continuous maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 l7 l8 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) + (R : Poset l5 l6) (S : Poset l7 l8) + (h : ω-continuous-hom-Poset R S) + (g : ω-continuous-hom-Poset Q R) + (f : ω-continuous-hom-Poset P Q) + where + + associative-comp-ω-continuous-hom-Poset : + comp-ω-continuous-hom-Poset P Q S + ( comp-ω-continuous-hom-Poset Q R S h g) + ( f) = + comp-ω-continuous-hom-Poset P R S + ( h) + ( comp-ω-continuous-hom-Poset P Q R g f) + associative-comp-ω-continuous-hom-Poset = + eq-htpy-ω-continuous-hom-Poset P S + ( comp-ω-continuous-hom-Poset P Q S + ( comp-ω-continuous-hom-Poset Q R S h g) + ( f)) + ( comp-ω-continuous-hom-Poset P R S + ( h) + ( comp-ω-continuous-hom-Poset P Q R g f)) + ( refl-htpy) + + involutive-eq-associative-comp-ω-continuous-hom-Poset : + comp-ω-continuous-hom-Poset P Q S + ( comp-ω-continuous-hom-Poset Q R S h g) + ( f) =ⁱ + comp-ω-continuous-hom-Poset P R S + ( h) + ( comp-ω-continuous-hom-Poset P Q R g f) + involutive-eq-associative-comp-ω-continuous-hom-Poset = + involutive-eq-eq associative-comp-ω-continuous-hom-Poset +``` diff --git a/src/domain-theory/scott-continuous-maps-posets.lagda.md b/src/domain-theory/scott-continuous-maps-posets.lagda.md index f6cd435498..a51d7c0840 100644 --- a/src/domain-theory/scott-continuous-maps-posets.lagda.md +++ b/src/domain-theory/scott-continuous-maps-posets.lagda.md @@ -299,11 +299,10 @@ module _ is-scott-continuous-map-Poset P R l7 ( map-scott-continuous-hom-Poset Q R g ∘ map-scott-continuous-hom-Poset P Q f) - is-scott-continuous-comp-Poset g f x y H = + is-scott-continuous-comp-Poset g f x y = is-scott-continuous-map-scott-continuous-hom-Poset Q R g ( directed-family-hom-Poset P Q (hom-scott-continuous-hom-Poset P Q f) x) ( sup-map-scott-continuous-hom-Poset P Q f x y) - ( H) comp-scott-continuous-hom-Poset : (g : scott-continuous-hom-Poset Q R l7) diff --git a/src/elementary-number-theory/decidable-total-order-natural-numbers.lagda.md b/src/elementary-number-theory/decidable-total-order-natural-numbers.lagda.md index 218c186e1f..e1f374b7db 100644 --- a/src/elementary-number-theory/decidable-total-order-natural-numbers.lagda.md +++ b/src/elementary-number-theory/decidable-total-order-natural-numbers.lagda.md @@ -8,12 +8,19 @@ module elementary-number-theory.decidable-total-order-natural-numbers where ```agda open import elementary-number-theory.inequality-natural-numbers +open import elementary-number-theory.natural-numbers open import foundation.dependent-pair-types +open import foundation.function-types open import foundation.propositional-truncations +open import foundation.unit-type open import foundation.universe-levels open import order-theory.decidable-total-orders +open import order-theory.order-preserving-maps-posets +open import order-theory.order-preserving-maps-preorders +open import order-theory.posets +open import order-theory.preorders open import order-theory.total-orders ``` @@ -41,3 +48,50 @@ pr1 ℕ-Decidable-Total-Order = ℕ-Poset pr1 (pr2 ℕ-Decidable-Total-Order) = is-total-leq-ℕ pr2 (pr2 ℕ-Decidable-Total-Order) = is-decidable-leq-ℕ ``` + +## Properties + +### Defining order preserving maps out of the natural numbers by induction + +```agda +module _ + {l1 l2 : Level} (P : Preorder l1 l2) + where + + preserves-order-ind-ℕ-Preorder : + (f : ℕ → type-Preorder P) → + ((n : ℕ) → leq-Preorder P (f n) (f (succ-ℕ n))) → + preserves-order-Preorder ℕ-Preorder P f + preserves-order-ind-ℕ-Preorder f H zero-ℕ zero-ℕ p = + refl-leq-Preorder P (f zero-ℕ) + preserves-order-ind-ℕ-Preorder f H zero-ℕ (succ-ℕ m) p = + transitive-leq-Preorder P (f 0) (f m) (f (succ-ℕ m)) + ( H m) + ( preserves-order-ind-ℕ-Preorder f H zero-ℕ m star) + preserves-order-ind-ℕ-Preorder f H (succ-ℕ n) zero-ℕ () + preserves-order-ind-ℕ-Preorder f H (succ-ℕ n) (succ-ℕ m) = + preserves-order-ind-ℕ-Preorder (f ∘ succ-ℕ) (H ∘ succ-ℕ) n m + + hom-ind-ℕ-Preorder : + (f : ℕ → type-Preorder P) → + ((n : ℕ) → leq-Preorder P (f n) (f (succ-ℕ n))) → + hom-Preorder (ℕ-Preorder) P + hom-ind-ℕ-Preorder f H = f , preserves-order-ind-ℕ-Preorder f H + +module _ + {l1 l2 : Level} (P : Poset l1 l2) + where + + preserves-order-ind-ℕ-Poset : + (f : ℕ → type-Poset P) → + ((n : ℕ) → leq-Poset P (f n) (f (succ-ℕ n))) → + preserves-order-Poset ℕ-Poset P f + preserves-order-ind-ℕ-Poset = + preserves-order-ind-ℕ-Preorder (preorder-Poset P) + + hom-ind-ℕ-Poset : + (f : ℕ → type-Poset P) → + ((n : ℕ) → leq-Poset P (f n) (f (succ-ℕ n))) → + hom-Poset (ℕ-Poset) P + hom-ind-ℕ-Poset = hom-ind-ℕ-Preorder (preorder-Poset P) +``` 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 9c437a8708..a72905645f 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 @@ -1,4 +1,4 @@ -# The Well-Ordering Principle of the natural numbers +# The well-ordering principle of the natural numbers ```agda module elementary-number-theory.well-ordering-principle-natural-numbers where diff --git a/src/foundation/hilberts-epsilon-operators.lagda.md b/src/foundation/hilberts-epsilon-operators.lagda.md index 6ad95cd052..cb8b91e0f5 100644 --- a/src/foundation/hilberts-epsilon-operators.lagda.md +++ b/src/foundation/hilberts-epsilon-operators.lagda.md @@ -19,8 +19,10 @@ open import foundation-core.function-types ## Idea -Hilbert's $ε$-operator at a type `A` is a map `type-trunc-Prop A → A`. Contrary -to Hilbert, we will not assume that such an operator exists for each type `A`. +{{#concept "Hilbert's $ε$-operator"}} at a type `A` is a map +`type-trunc-Prop A → A`. Contrary to Hilbert, we will not assume that such an +operator exists for each type `A`. Some authors also refer to this as _split +support_. {{#cite KECA17}} ## Definition @@ -46,3 +48,12 @@ to Hilbert, we will not assume that such an operator exists for each type `A`. ε-operator-equiv' e f = (map-inv-equiv e ∘ f) ∘ (map-trunc-Prop (map-equiv e)) ``` + +## References + +{{#bibliography}} + +## External links + +- [Epsilon calculus](https://en.wikipedia.org/wiki/Epsilon_calculus) at + Wikipedia diff --git a/src/order-theory/chains-posets.lagda.md b/src/order-theory/chains-posets.lagda.md index 830aeead27..d882287302 100644 --- a/src/order-theory/chains-posets.lagda.md +++ b/src/order-theory/chains-posets.lagda.md @@ -7,16 +7,23 @@ module order-theory.chains-posets where
Imports ```agda +open import foundation.coproduct-types open import foundation.dependent-pair-types +open import foundation.disjunction open import foundation.existential-quantification open import foundation.function-types +open import foundation.identity-types +open import foundation.images +open import foundation.propositional-truncations open import foundation.propositions open import foundation.subtypes open import foundation.universe-levels open import order-theory.chains-preorders +open import order-theory.order-preserving-maps-posets open import order-theory.posets open import order-theory.subposets +open import order-theory.total-orders ```
@@ -91,6 +98,62 @@ module _ is-prop-inclusion-chain-Preorder (preorder-Poset X) C D ``` +## Properties + +### Chains in a poset from order preserving maps from a total order + +```agda +module _ + {l1 l2 l3 l4 : Level} + (X : Poset l1 l2) + (T : Total-Order l3 l4) + (f : hom-Poset (poset-Total-Order T) X) + where + + subposet-chain-hom-total-order-Poset : Subposet (l1 ⊔ l3) X + subposet-chain-hom-total-order-Poset = + subtype-im (map-hom-Poset (poset-Total-Order T) X f) + + is-chain-chain-hom-total-order-Poset : + is-chain-Subposet X subposet-chain-hom-total-order-Poset + is-chain-chain-hom-total-order-Poset (x , u) (y , v) = + rec-trunc-Prop + ( leq-prop-Poset X x y ∨ leq-prop-Poset X y x) + ( λ p → + rec-trunc-Prop + ( leq-prop-Poset X x y ∨ leq-prop-Poset X y x) + ( λ q → + rec-trunc-Prop + ( leq-prop-Poset X x y ∨ leq-prop-Poset X y x) + ( rec-coproduct + ( λ H → + inl-disjunction + ( concatenate-eq-leq-eq-Poset' X + ( pr2 p) + ( preserves-order-map-hom-Poset (poset-Total-Order T) X f + ( pr1 p) + ( pr1 q) + ( H)) + ( pr2 q))) + ( λ H → + inr-disjunction + ( concatenate-eq-leq-eq-Poset' X + ( pr2 q) + ( preserves-order-map-hom-Poset (poset-Total-Order T) X f + ( pr1 q) + ( pr1 p) + ( H)) + ( pr2 p)))) + ( is-total-Total-Order T (pr1 p) (pr1 q))) + ( v)) + ( u) + + chain-hom-total-order-Poset : chain-Poset (l1 ⊔ l3) X + chain-hom-total-order-Poset = + subposet-chain-hom-total-order-Poset , + is-chain-chain-hom-total-order-Poset +``` + ## External links - [Total order, chains](https://en.wikipedia.org/wiki/Total_order#Chains) at diff --git a/src/order-theory/greatest-lower-bounds-posets.lagda.md b/src/order-theory/greatest-lower-bounds-posets.lagda.md index 4af9d5721f..84f0675768 100644 --- a/src/order-theory/greatest-lower-bounds-posets.lagda.md +++ b/src/order-theory/greatest-lower-bounds-posets.lagda.md @@ -180,9 +180,9 @@ module _ {l1 l2 l3 : Level} (P : Poset l1 l2) {I : UU l3} (a : I → type-Poset P) where - is-greatest-lower-bound-family-of-elements-Poset-Prop : + is-greatest-lower-bound-family-of-elements-prop-Poset : type-Poset P → Prop (l1 ⊔ l2 ⊔ l3) - is-greatest-lower-bound-family-of-elements-Poset-Prop x = + is-greatest-lower-bound-family-of-elements-prop-Poset x = Π-Prop ( type-Poset P) ( λ y → @@ -193,13 +193,13 @@ module _ is-greatest-lower-bound-family-of-elements-Poset : type-Poset P → UU (l1 ⊔ l2 ⊔ l3) is-greatest-lower-bound-family-of-elements-Poset z = - type-Prop (is-greatest-lower-bound-family-of-elements-Poset-Prop z) + type-Prop (is-greatest-lower-bound-family-of-elements-prop-Poset z) is-prop-is-greatest-lower-bound-family-of-elements-Poset : (z : type-Poset P) → is-prop (is-greatest-lower-bound-family-of-elements-Poset z) is-prop-is-greatest-lower-bound-family-of-elements-Poset z = - is-prop-type-Prop (is-greatest-lower-bound-family-of-elements-Poset-Prop z) + is-prop-type-Prop (is-greatest-lower-bound-family-of-elements-prop-Poset z) module _ {l1 l2 l3 : Level} (P : Poset l1 l2) {I : UU l3} {a : I → type-Poset P} @@ -246,7 +246,7 @@ module _ all-elements-equal-has-greatest-lower-bound-family-of-elements-Poset ( x , H) (y , K) = eq-type-subtype - ( is-greatest-lower-bound-family-of-elements-Poset-Prop P a) + ( is-greatest-lower-bound-family-of-elements-prop-Poset P a) ( antisymmetric-leq-Poset P x y ( forward-implication-is-greatest-lower-bound-family-of-elements-Poset ( P) @@ -267,10 +267,10 @@ module _ is-prop-all-elements-equal all-elements-equal-has-greatest-lower-bound-family-of-elements-Poset - has-greatest-lower-bound-family-of-elements-Poset-Prop : Prop (l1 ⊔ l2 ⊔ l3) - pr1 has-greatest-lower-bound-family-of-elements-Poset-Prop = + has-greatest-lower-bound-family-of-elements-prop-Poset : Prop (l1 ⊔ l2 ⊔ l3) + pr1 has-greatest-lower-bound-family-of-elements-prop-Poset = has-greatest-lower-bound-family-of-elements-Poset - pr2 has-greatest-lower-bound-family-of-elements-Poset-Prop = + pr2 has-greatest-lower-bound-family-of-elements-prop-Poset = is-prop-has-greatest-lower-bound-family-of-elements-Poset module _ diff --git a/src/order-theory/inflattices.lagda.md b/src/order-theory/inflattices.lagda.md index fefcf53ce8..7ded028eca 100644 --- a/src/order-theory/inflattices.lagda.md +++ b/src/order-theory/inflattices.lagda.md @@ -44,7 +44,7 @@ module _ ( λ I → Π-Prop ( I → type-Poset P) - ( λ f → has-greatest-lower-bound-family-of-elements-Poset-Prop P f)) + ( λ f → has-greatest-lower-bound-family-of-elements-prop-Poset P f)) is-inflattice-Poset : UU (l1 ⊔ l2 ⊔ lsuc l3) is-inflattice-Poset = type-Prop is-inflattice-Poset-Prop diff --git a/src/order-theory/join-semilattices.lagda.md b/src/order-theory/join-semilattices.lagda.md index 3a2cd051aa..fe7f25a8cc 100644 --- a/src/order-theory/join-semilattices.lagda.md +++ b/src/order-theory/join-semilattices.lagda.md @@ -252,7 +252,7 @@ module _ ( λ x → Π-Prop ( type-Poset P) - ( has-least-binary-upper-bound-Poset-Prop P x)) + ( has-least-binary-upper-bound-prop-Poset P x)) is-join-semilattice-Poset : UU (l1 ⊔ l2) is-join-semilattice-Poset = type-Prop is-join-semilattice-Poset-Prop diff --git a/src/order-theory/least-upper-bounds-posets.lagda.md b/src/order-theory/least-upper-bounds-posets.lagda.md index 9b259bb0c4..920c96b283 100644 --- a/src/order-theory/least-upper-bounds-posets.lagda.md +++ b/src/order-theory/least-upper-bounds-posets.lagda.md @@ -137,8 +137,7 @@ module _ all-elements-equal-has-least-binary-upper-bound-Poset : all-elements-equal has-least-binary-upper-bound-Poset - all-elements-equal-has-least-binary-upper-bound-Poset - (pair u H) (pair v K) = + all-elements-equal-has-least-binary-upper-bound-Poset (u , H) (v , K) = eq-type-subtype ( is-least-binary-upper-bound-Poset-Prop P a b) ( antisymmetric-leq-Poset P u v @@ -153,10 +152,10 @@ module _ is-prop-all-elements-equal all-elements-equal-has-least-binary-upper-bound-Poset - has-least-binary-upper-bound-Poset-Prop : Prop (l1 ⊔ l2) - pr1 has-least-binary-upper-bound-Poset-Prop = + has-least-binary-upper-bound-prop-Poset : Prop (l1 ⊔ l2) + pr1 has-least-binary-upper-bound-prop-Poset = has-least-binary-upper-bound-Poset - pr2 has-least-binary-upper-bound-Poset-Prop = + pr2 has-least-binary-upper-bound-prop-Poset = is-prop-has-least-binary-upper-bound-Poset module _ @@ -183,9 +182,9 @@ module _ {l1 l2 l3 : Level} (P : Poset l1 l2) {I : UU l3} (a : I → type-Poset P) where - is-least-upper-bound-family-of-elements-Poset-Prop : + is-least-upper-bound-family-of-elements-prop-Poset : type-Poset P → Prop (l1 ⊔ l2 ⊔ l3) - is-least-upper-bound-family-of-elements-Poset-Prop x = + is-least-upper-bound-family-of-elements-prop-Poset x = Π-Prop ( type-Poset P) ( λ y → @@ -196,13 +195,13 @@ module _ is-least-upper-bound-family-of-elements-Poset : type-Poset P → UU (l1 ⊔ l2 ⊔ l3) is-least-upper-bound-family-of-elements-Poset z = - type-Prop (is-least-upper-bound-family-of-elements-Poset-Prop z) + type-Prop (is-least-upper-bound-family-of-elements-prop-Poset z) is-prop-is-least-upper-bound-family-of-elements-Poset : (z : type-Poset P) → is-prop (is-least-upper-bound-family-of-elements-Poset z) is-prop-is-least-upper-bound-family-of-elements-Poset z = - is-prop-type-Prop (is-least-upper-bound-family-of-elements-Poset-Prop z) + is-prop-type-Prop (is-least-upper-bound-family-of-elements-prop-Poset z) module _ {l1 l2 l3 : Level} (P : Poset l1 l2) {I : UU l3} {a : I → type-Poset P} @@ -247,7 +246,7 @@ module _ all-elements-equal-has-least-upper-bound-family-of-elements-Poset ( x , H) (y , K) = eq-type-subtype - ( is-least-upper-bound-family-of-elements-Poset-Prop P a) + ( is-least-upper-bound-family-of-elements-prop-Poset P a) ( antisymmetric-leq-Poset P x y ( forward-implication-is-least-upper-bound-family-of-elements-Poset ( P) @@ -268,10 +267,10 @@ module _ is-prop-all-elements-equal all-elements-equal-has-least-upper-bound-family-of-elements-Poset - has-least-upper-bound-family-of-elements-Poset-Prop : Prop (l1 ⊔ l2 ⊔ l3) - pr1 has-least-upper-bound-family-of-elements-Poset-Prop = + has-least-upper-bound-family-of-elements-prop-Poset : Prop (l1 ⊔ l2 ⊔ l3) + pr1 has-least-upper-bound-family-of-elements-prop-Poset = has-least-upper-bound-family-of-elements-Poset - pr2 has-least-upper-bound-family-of-elements-Poset-Prop = + pr2 has-least-upper-bound-family-of-elements-prop-Poset = is-prop-has-least-upper-bound-family-of-elements-Poset module _ diff --git a/src/order-theory/lower-bounds-posets.lagda.md b/src/order-theory/lower-bounds-posets.lagda.md index 0efcbd6283..5ae8f55417 100644 --- a/src/order-theory/lower-bounds-posets.lagda.md +++ b/src/order-theory/lower-bounds-posets.lagda.md @@ -63,18 +63,18 @@ module _ {l1 l2 l3 : Level} (P : Poset l1 l2) {I : UU l3} (x : I → type-Poset P) where - is-lower-bound-family-of-elements-Poset-Prop : type-Poset P → Prop (l2 ⊔ l3) - is-lower-bound-family-of-elements-Poset-Prop z = + is-lower-bound-family-of-elements-prop-Poset : type-Poset P → Prop (l2 ⊔ l3) + is-lower-bound-family-of-elements-prop-Poset z = Π-Prop I (λ i → leq-prop-Poset P z (x i)) is-lower-bound-family-of-elements-Poset : type-Poset P → UU (l2 ⊔ l3) is-lower-bound-family-of-elements-Poset z = - type-Prop (is-lower-bound-family-of-elements-Poset-Prop z) + type-Prop (is-lower-bound-family-of-elements-prop-Poset z) is-prop-is-lower-bound-family-of-elements-Poset : (z : type-Poset P) → is-prop (is-lower-bound-family-of-elements-Poset z) is-prop-is-lower-bound-family-of-elements-Poset z = - is-prop-type-Prop (is-lower-bound-family-of-elements-Poset-Prop z) + is-prop-type-Prop (is-lower-bound-family-of-elements-prop-Poset z) ``` ## Properties diff --git a/src/order-theory/posets.lagda.md b/src/order-theory/posets.lagda.md index e7105e617b..f1875f86f2 100644 --- a/src/order-theory/posets.lagda.md +++ b/src/order-theory/posets.lagda.md @@ -64,6 +64,10 @@ module _ is-prop-leq-Poset : (x y : type-Poset) → is-prop (leq-Poset x y) is-prop-leq-Poset = is-prop-leq-Preorder preorder-Poset + concatenate-eq-leq-Poset' : + {x y z : type-Poset} → x = y → leq-Poset x z → leq-Poset y z + concatenate-eq-leq-Poset' = concatenate-eq-leq-Preorder' preorder-Poset + concatenate-eq-leq-Poset : {x y z : type-Poset} → x = y → leq-Poset y z → leq-Poset x z concatenate-eq-leq-Poset = concatenate-eq-leq-Preorder preorder-Poset @@ -72,6 +76,14 @@ module _ {x y z : type-Poset} → leq-Poset x y → y = z → leq-Poset x z concatenate-leq-eq-Poset = concatenate-leq-eq-Preorder preorder-Poset + concatenate-eq-leq-eq-Poset : + {x y z w : type-Poset} → x = y → leq-Poset y z → z = w → leq-Poset x w + concatenate-eq-leq-eq-Poset = concatenate-eq-leq-eq-Preorder preorder-Poset + + concatenate-eq-leq-eq-Poset' : + {x y z w : type-Poset} → x = y → leq-Poset x z → z = w → leq-Poset y w + concatenate-eq-leq-eq-Poset' = concatenate-eq-leq-eq-Preorder' preorder-Poset + refl-leq-Poset : is-reflexive leq-Poset refl-leq-Poset = refl-leq-Preorder preorder-Poset diff --git a/src/order-theory/preorders.lagda.md b/src/order-theory/preorders.lagda.md index eedc7c8781..f7ac6b21ab 100644 --- a/src/order-theory/preorders.lagda.md +++ b/src/order-theory/preorders.lagda.md @@ -19,6 +19,7 @@ open import foundation.negated-equality open import foundation.negation open import foundation.propositions open import foundation.sets +open import foundation.transport-along-identifications open import foundation.universe-levels ``` @@ -57,13 +58,29 @@ module _ is-prop-leq-Preorder : (x y : type-Preorder) → is-prop (leq-Preorder x y) is-prop-leq-Preorder = is-prop-type-Relation-Prop leq-prop-Preorder + concatenate-eq-leq-Preorder' : + {x y z : type-Preorder} → x = y → leq-Preorder x z → leq-Preorder y z + concatenate-eq-leq-Preorder' {z = z} = tr (λ p → leq-Preorder p z) + concatenate-eq-leq-Preorder : {x y z : type-Preorder} → x = y → leq-Preorder y z → leq-Preorder x z - concatenate-eq-leq-Preorder refl = id + concatenate-eq-leq-Preorder p = concatenate-eq-leq-Preorder' (inv p) concatenate-leq-eq-Preorder : {x y z : type-Preorder} → leq-Preorder x y → y = z → leq-Preorder x z - concatenate-leq-eq-Preorder H refl = H + concatenate-leq-eq-Preorder {x} H p = tr (leq-Preorder x) p H + + concatenate-eq-leq-eq-Preorder' : + {x y z w : type-Preorder} → + x = y → leq-Preorder x z → z = w → leq-Preorder y w + concatenate-eq-leq-eq-Preorder' p H q = + concatenate-eq-leq-Preorder' p (concatenate-leq-eq-Preorder H q) + + concatenate-eq-leq-eq-Preorder : + {x y z w : type-Preorder} → + x = y → leq-Preorder y z → z = w → leq-Preorder x w + concatenate-eq-leq-eq-Preorder p H q = + concatenate-eq-leq-Preorder p (concatenate-leq-eq-Preorder H q) le-prop-Preorder : Relation-Prop (l1 ⊔ l2) type-Preorder le-prop-Preorder x y = diff --git a/src/order-theory/suplattices.lagda.md b/src/order-theory/suplattices.lagda.md index c5d25a5328..81b7916803 100644 --- a/src/order-theory/suplattices.lagda.md +++ b/src/order-theory/suplattices.lagda.md @@ -48,7 +48,7 @@ module _ ( λ I → Π-Prop ( I → type-Poset P) - ( has-least-upper-bound-family-of-elements-Poset-Prop P)) + ( has-least-upper-bound-family-of-elements-prop-Poset P)) is-suplattice-Poset : UU (l1 ⊔ l2 ⊔ lsuc l3) is-suplattice-Poset = type-Prop is-suplattice-Poset-Prop diff --git a/src/order-theory/upper-bounds-chains-posets.lagda.md b/src/order-theory/upper-bounds-chains-posets.lagda.md index 4326fd679f..3da859e4e1 100644 --- a/src/order-theory/upper-bounds-chains-posets.lagda.md +++ b/src/order-theory/upper-bounds-chains-posets.lagda.md @@ -37,7 +37,7 @@ module _ is-upper-bound-chain-prop-Poset : type-Poset X → Prop (l1 ⊔ l2 ⊔ l3) is-upper-bound-chain-prop-Poset = - is-upper-bound-family-of-elements-Poset-Prop X + is-upper-bound-family-of-elements-prop-Poset X ( inclusion-type-chain-Poset X C) is-upper-bound-chain-Poset : type-Poset X → UU (l1 ⊔ l2 ⊔ l3) diff --git a/src/order-theory/upper-bounds-posets.lagda.md b/src/order-theory/upper-bounds-posets.lagda.md index f878ee5ea0..0193ab6052 100644 --- a/src/order-theory/upper-bounds-posets.lagda.md +++ b/src/order-theory/upper-bounds-posets.lagda.md @@ -66,23 +66,23 @@ module _ {l1 l2 : Level} (P : Poset l1 l2) where - is-upper-bound-family-of-elements-Poset-Prop : + is-upper-bound-family-of-elements-prop-Poset : {l : Level} {I : UU l} → (I → type-Poset P) → type-Poset P → Prop (l2 ⊔ l) - is-upper-bound-family-of-elements-Poset-Prop {l} {I} f z = + is-upper-bound-family-of-elements-prop-Poset {l} {I} f z = Π-Prop I (λ i → leq-prop-Poset P (f i) z) is-upper-bound-family-of-elements-Poset : {l : Level} {I : UU l} → (I → type-Poset P) → type-Poset P → UU (l2 ⊔ l) is-upper-bound-family-of-elements-Poset f z = - type-Prop (is-upper-bound-family-of-elements-Poset-Prop f z) + type-Prop (is-upper-bound-family-of-elements-prop-Poset f z) is-prop-is-upper-bound-family-of-elements-Poset : {l : Level} {I : UU l} (f : I → type-Poset P) (z : type-Poset P) → is-prop (is-upper-bound-family-of-elements-Poset f z) is-prop-is-upper-bound-family-of-elements-Poset f z = - is-prop-type-Prop (is-upper-bound-family-of-elements-Poset-Prop f z) + is-prop-type-Prop (is-upper-bound-family-of-elements-prop-Poset f z) ``` ## Properties From 36fc5f37f926f8abbb603e7134bf28ceaa15fc2e Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 4 Nov 2024 14:59:07 +0100 Subject: [PATCH 62/83] =?UTF-8?q?=CF=89-Continuous=20maps=20preserve=20ord?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../omega-continuous-maps-posets.lagda.md | 59 ++-- src/order-theory.lagda.md | 1 + .../join-preserving-maps-posets.lagda.md | 282 ++++++++++++++++++ .../least-upper-bounds-posets.lagda.md | 30 ++ .../supremum-preserving-maps-posets.lagda.md | 26 +- 5 files changed, 365 insertions(+), 33 deletions(-) create mode 100644 src/order-theory/join-preserving-maps-posets.lagda.md diff --git a/src/domain-theory/omega-continuous-maps-posets.lagda.md b/src/domain-theory/omega-continuous-maps-posets.lagda.md index aedf8cf833..01aaa6bbcf 100644 --- a/src/domain-theory/omega-continuous-maps-posets.lagda.md +++ b/src/domain-theory/omega-continuous-maps-posets.lagda.md @@ -11,6 +11,7 @@ open import domain-theory.directed-families-posets 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.booleans open import foundation.dependent-pair-types @@ -31,6 +32,7 @@ open import foundation.surjective-maps open import foundation.torsorial-type-families open import foundation.universe-levels +open import order-theory.join-preserving-maps-posets open import order-theory.least-upper-bounds-posets open import order-theory.order-preserving-maps-posets open import order-theory.posets @@ -43,14 +45,25 @@ open import order-theory.posets A map `f : P → Q` between the underlying types of two [posets](order-theory.posets.md) is said to be {{#concept "ω-continuous" Disambiguation="map of posets" Agda=ω-continuous-map-Poset}} +if it maps the supremum of every ascending +[chain](order-theory.chains-posets.md) ```text - f(⋃ᵢxᵢ) = ⋃ᵢf(xᵢ) + x₀ ≤ x₁ ≤ x₂ ≤ ­… ≤ xₙ ≤ xₙ₊₁ ≤ … ≤ xω ``` -for every [directed family](domain-theory.directed-families-posets.md) -`x₍₋₎ : I → P` with a [supremum](order-theory.least-upper-bounds-posets.md) in -`P`. +to the supremum of the image of the ascending chain + +```text + f x₀ ≤ f x₁ ≤ f x₂ ≤ ­… ≤ f xₙ ≤ f xₙ₊₁ ≤ … ≤ f xω. +``` + +In other words, `f(⋃ᵢxᵢ) = ⋃ᵢf(xᵢ)` for all ascending chains `x₍₋₎ : ℕ → P`. + +The ω-continuity condition is a proper generalization of +[Scott-continuity](domain-theory.scott-continuous-functions-posets.md) for which +[Kleene's fixed point theorem](domain-theory.kleenes-fixed-point-theorem-omega-complete-posets.md) +still applies. ## Definitions @@ -159,33 +172,17 @@ module _ is-ω-continuous-map-Poset P Q f → preserves-order-Poset P Q f preserves-order-is-ω-continuous-map-Poset {f} H x y p = - pr2 (H ((λ n → {! !}) , {! !}) ({! !} , {! !}) (f y)) {! p !} {! !} - -- pr2 - -- ( preserves-small-supremum-omega-is-ω-continuous-map-Poset - -- ( P) - -- ( Q) - -- ( H) - -- ( ( bool , unit-trunc-Prop true) , - -- rec-bool x y , - -- λ where - -- true true → - -- intro-exists true (refl-leq-Poset P x , refl-leq-Poset P x) - -- true false → - -- intro-exists false (p , refl-leq-Poset P y) - -- false true → - -- intro-exists false (refl-leq-Poset P y , p) - -- false false → - -- intro-exists false (refl-leq-Poset P y , refl-leq-Poset P y)) - -- ( Raise l5 bool) - -- ( y , - -- λ z → - -- ( ( ev (map-raise false)) , - -- ( λ where - -- u (map-raise true) → transitive-leq-Poset P x y z u p - -- u (map-raise false) → u))) - -- ( f y)) - -- ( refl-leq-Poset Q (f y)) - -- ( map-raise true) + pr2 + ( H ( hom-ind-ℕ-Poset P + ( rec-ℕ x (λ _ _ → y)) + ( ind-ℕ p (λ _ _ → refl-leq-Poset P y))) + ( y , + ( λ z → + ( λ g → g 1) , + ( λ q → ind-ℕ (transitive-leq-Poset P x y z q p) (λ _ _ → q)))) + ( f y)) + ( refl-leq-Poset Q (f y)) + ( 0) hom-ω-continuous-hom-Poset : ω-continuous-hom-Poset P Q → hom-Poset P Q diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index f204407a0e..2b867a96f3 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -53,6 +53,7 @@ open import order-theory.inhabited-chains-posets public open import order-theory.inhabited-chains-preorders public open import order-theory.inhabited-finite-total-orders public open import order-theory.interval-subposets public +open import order-theory.join-preserving-maps-posets public open import order-theory.join-semilattices public open import order-theory.knaster-tarski-fixed-point-theorem public open import order-theory.large-frames public diff --git a/src/order-theory/join-preserving-maps-posets.lagda.md b/src/order-theory/join-preserving-maps-posets.lagda.md new file mode 100644 index 0000000000..e00f0e741c --- /dev/null +++ b/src/order-theory/join-preserving-maps-posets.lagda.md @@ -0,0 +1,282 @@ +# Join preserving maps on posets + +```agda +module order-theory.join-preserving-maps-posets where +``` + +
Imports + +```agda +open import foundation.booleans +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.evaluation-functions +open import foundation.function-types +open import foundation.fundamental-theorem-of-identity-types +open import foundation.homotopies +open import foundation.homotopy-induction +open import foundation.identity-types +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.small-types +open import foundation.strictly-involutive-identity-types +open import foundation.subtype-identity-principle +open import foundation.torsorial-type-families +open import foundation.universe-levels + +open import order-theory.least-upper-bounds-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +``` + +
+ +## Idea + +A map `f : P → Q` between the underlying types of two +[posets](order-theory.posets.md) is said to be +{{#concept "join preserving" Disambiguation="map of posets" Agda=preserves-joins-map-Poset}} +if for every pair of elements `x, y : P` with a +[least upper bound](order-theory.least-upper-bounds-posets.md) `z`, we have +`f z` is the least upper bound of `f x` and `f y`. + +## Definitions + +### The predicate of preserving a join + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + (f : type-Poset P → type-Poset Q) + (x y : type-Poset P) + where + + preserves-join-map-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-join-map-Poset = + (s : has-least-binary-upper-bound-Poset P x y) → + is-least-binary-upper-bound-Poset Q (f x) (f y) (f (pr1 s)) + + is-prop-preserves-join-map-Poset : + is-prop preserves-join-map-Poset + is-prop-preserves-join-map-Poset = + is-prop-Π + ( λ s → + is-prop-is-least-binary-upper-bound-Poset Q + ( f x) + ( f y) + ( f (pr1 s))) + + preserves-join-prop-map-Poset : Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-join-prop-map-Poset = + preserves-join-map-Poset , is-prop-preserves-join-map-Poset +``` + +### Join preserving maps + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + preserves-joins-map-Poset : + (type-Poset P → type-Poset Q) → + UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-joins-map-Poset f = + (x y : type-Poset P) + (s : has-least-binary-upper-bound-Poset P x y) → + is-least-binary-upper-bound-Poset Q (f x) (f y) (f (pr1 s)) + + is-prop-preserves-joins-map-Poset : + (f : type-Poset P → type-Poset Q) → + is-prop (preserves-joins-map-Poset f) + is-prop-preserves-joins-map-Poset f = + is-prop-Π + ( λ x → is-prop-Π (is-prop-preserves-join-map-Poset P Q f x)) + + preserves-joins-prop-map-Poset : + (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-joins-prop-map-Poset f = + ( preserves-joins-map-Poset f , is-prop-preserves-joins-map-Poset f) + + hom-join-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + hom-join-Poset = + Σ (type-Poset P → type-Poset Q) (preserves-joins-map-Poset) + + map-hom-join-Poset : hom-join-Poset → type-Poset P → type-Poset Q + map-hom-join-Poset = pr1 + + preserves-joins-map-hom-join-Poset : + (f : hom-join-Poset) → + preserves-joins-map-Poset (map-hom-join-Poset f) + preserves-joins-map-hom-join-Poset = pr2 + + sup-map-hom-join-Poset : + (f : hom-join-Poset) {x y : type-Poset P} → + has-least-binary-upper-bound-Poset P x y → + has-least-binary-upper-bound-Poset Q + ( map-hom-join-Poset f x) + ( map-hom-join-Poset f y) + sup-map-hom-join-Poset f {x} {y} s = + ( map-hom-join-Poset f (pr1 s) , preserves-joins-map-hom-join-Poset f x y s) +``` + +## Properties + +### Join preserving maps preserve order + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + abstract + preserves-order-preserves-joins-map-Poset : + {f : type-Poset P → type-Poset Q} → + preserves-joins-map-Poset P Q f → + preserves-order-Poset P Q f + preserves-order-preserves-joins-map-Poset {f} H x y p = + pr1 + ( pr2 + ( H x y (y , is-least-binary-upper-bound-leq-Poset P x y p) (f y)) + ( refl-leq-Poset Q (f y))) +``` + +### Homotopies of join preserving maps + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + htpy-hom-join-Poset : (f g : hom-join-Poset P Q) → UU (l1 ⊔ l3) + htpy-hom-join-Poset f g = map-hom-join-Poset P Q f ~ map-hom-join-Poset P Q g + + refl-htpy-hom-join-Poset : (f : hom-join-Poset P Q) → htpy-hom-join-Poset f f + refl-htpy-hom-join-Poset f = refl-htpy + + htpy-eq-hom-join-Poset : + (f g : hom-join-Poset P Q) → f = g → htpy-hom-join-Poset f g + htpy-eq-hom-join-Poset f .f refl = refl-htpy-hom-join-Poset f + + is-torsorial-htpy-hom-join-Poset : + (f : hom-join-Poset P Q) → is-torsorial (htpy-hom-join-Poset f) + is-torsorial-htpy-hom-join-Poset f = + is-torsorial-Eq-subtype + ( is-torsorial-htpy (map-hom-join-Poset P Q f)) + ( is-prop-preserves-joins-map-Poset P Q) + ( map-hom-join-Poset P Q f) + ( refl-htpy) + ( preserves-joins-map-hom-join-Poset P Q f) + + is-equiv-htpy-eq-hom-join-Poset : + (f g : hom-join-Poset P Q) → is-equiv (htpy-eq-hom-join-Poset f g) + is-equiv-htpy-eq-hom-join-Poset f = + fundamental-theorem-id + ( is-torsorial-htpy-hom-join-Poset f) + ( htpy-eq-hom-join-Poset f) + + extensionality-hom-join-Poset : + (f g : hom-join-Poset P Q) → (f = g) ≃ htpy-hom-join-Poset f g + pr1 (extensionality-hom-join-Poset f g) = htpy-eq-hom-join-Poset f g + pr2 (extensionality-hom-join-Poset f g) = is-equiv-htpy-eq-hom-join-Poset f g + + eq-htpy-hom-join-Poset : + (f g : hom-join-Poset P Q) → htpy-hom-join-Poset f g → f = g + eq-htpy-hom-join-Poset f g = + map-inv-is-equiv (is-equiv-htpy-eq-hom-join-Poset f g) +``` + +### The identity join preserving map + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) + where + + preserves-joins-id-Poset : + preserves-joins-map-Poset P P (id {A = type-Poset P}) + preserves-joins-id-Poset x y s = pr2 s + + id-hom-join-Poset : hom-join-Poset P P + id-hom-join-Poset = id , preserves-joins-id-Poset +``` + +### Composing join preserving maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) (R : Poset l5 l6) + where + + preserves-joins-comp-Poset : + (g : hom-join-Poset Q R) (f : hom-join-Poset P Q) → + preserves-joins-map-Poset P R + ( map-hom-join-Poset Q R g ∘ map-hom-join-Poset P Q f) + preserves-joins-comp-Poset g f x y s = + preserves-joins-map-hom-join-Poset Q R g + ( map-hom-join-Poset P Q f x) + ( map-hom-join-Poset P Q f y) + ( sup-map-hom-join-Poset P Q f s) + + comp-hom-join-Poset : + (g : hom-join-Poset Q R) (f : hom-join-Poset P Q) → + hom-join-Poset P R + comp-hom-join-Poset g f = + map-hom-join-Poset Q R g ∘ map-hom-join-Poset P Q f , + preserves-joins-comp-Poset g f +``` + +### Unit laws for composition of join preserving maps + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + left-unit-law-comp-hom-join-Poset : + (f : hom-join-Poset P Q) → + ( comp-hom-join-Poset P Q Q (id-hom-join-Poset Q) f) = f + left-unit-law-comp-hom-join-Poset f = + eq-htpy-hom-join-Poset P Q + ( comp-hom-join-Poset P Q Q (id-hom-join-Poset Q) f) + ( f) + ( refl-htpy) + + right-unit-law-comp-hom-join-Poset : + (f : hom-join-Poset P Q) → + (comp-hom-join-Poset P P Q f (id-hom-join-Poset P)) = f + right-unit-law-comp-hom-join-Poset f = + eq-htpy-hom-join-Poset P Q + ( comp-hom-join-Poset P P Q f (id-hom-join-Poset P)) + ( f) + ( refl-htpy) +``` + +### Associativity of composition of join preserving maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 l7 l8 : Level} + (P : Poset l1 l2) (Q : Poset l3 l4) + (R : Poset l5 l6) (S : Poset l7 l8) + (h : hom-join-Poset R S) + (g : hom-join-Poset Q R) + (f : hom-join-Poset P Q) + where + + associative-comp-hom-join-Poset : + comp-hom-join-Poset P Q S (comp-hom-join-Poset Q R S h g) f = + comp-hom-join-Poset P R S h (comp-hom-join-Poset P Q R g f) + associative-comp-hom-join-Poset = + eq-htpy-hom-join-Poset P S + ( comp-hom-join-Poset P Q S (comp-hom-join-Poset Q R S h g) f) + ( comp-hom-join-Poset P R S h (comp-hom-join-Poset P Q R g f)) + ( refl-htpy) + + involutive-eq-associative-comp-hom-join-Poset : + comp-hom-join-Poset P Q S (comp-hom-join-Poset Q R S h g) f =ⁱ + comp-hom-join-Poset P R S h (comp-hom-join-Poset P Q R g f) + involutive-eq-associative-comp-hom-join-Poset = + involutive-eq-eq associative-comp-hom-join-Poset +``` diff --git a/src/order-theory/least-upper-bounds-posets.lagda.md b/src/order-theory/least-upper-bounds-posets.lagda.md index 920c96b283..45eaaed587 100644 --- a/src/order-theory/least-upper-bounds-posets.lagda.md +++ b/src/order-theory/least-upper-bounds-posets.lagda.md @@ -334,6 +334,36 @@ module _ is-least-upper-bound-family-of-elements-has-least-binary-upper-bound-Poset ``` +### Least upper bounds of families over the booleans as binary least upper bounds + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) (x : bool → type-Poset P) + (H : has-least-upper-bound-family-of-elements-Poset P x) + where + + least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset : + type-Poset P + least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset = + pr1 H + + is-least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset : + is-least-binary-upper-bound-Poset P + ( x true) + ( x false) + ( least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset) + is-least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset z = + ( λ f → + pr1 (pr2 H z) (ind-bool (λ i → leq-Poset P (x i) z) (pr1 f) (pr2 f))) , + ( λ u → pr2 (pr2 H z) u true , pr2 (pr2 H z) u false) + + has-least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset : + has-least-binary-upper-bound-Poset P (x true) (x false) + has-least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset = + least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset , + is-least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset +``` + ### if $a ≤ b$ then $b$ is the least binary upper bound of $a$ and $b$ ```agda diff --git a/src/order-theory/supremum-preserving-maps-posets.lagda.md b/src/order-theory/supremum-preserving-maps-posets.lagda.md index 4b6f8bff58..146b30d6c9 100644 --- a/src/order-theory/supremum-preserving-maps-posets.lagda.md +++ b/src/order-theory/supremum-preserving-maps-posets.lagda.md @@ -24,6 +24,7 @@ open import foundation.subtype-identity-principle open import foundation.torsorial-type-families open import foundation.universe-levels +open import order-theory.join-preserving-maps-posets open import order-theory.least-upper-bounds-posets open import order-theory.order-preserving-maps-posets open import order-theory.posets @@ -36,6 +37,7 @@ open import order-theory.posets A map `f : P → Q` between the underlying types of two [posets](order-theory.posets.md) is said to be {{#concept "supremum preserving" Disambiguation="map of posets" Agda=preserves-suprema-map-Poset}} +if ```text f(⋃ᵢxᵢ) = ⋃ᵢf(xᵢ) @@ -141,6 +143,27 @@ module _ H (x ∘ map-inv-equiv-is-small u) ``` +### Supremum preserving maps preserve joins + +```text +module _ + {l1 l2 l3 l4 l5 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) + where + + abstract + preserves-joins-preserves-suprema-map-Poset : + {f : type-Poset P → type-Poset Q} → + preserves-suprema-map-Poset P Q l5 f → + preserves-joins-map-Poset P Q f + preserves-joins-preserves-suprema-map-Poset {f} H x y s = + is-least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset + ( Q) + ( rec-bool (f x) (f y)) + ( f (pr1 s) , ?) -- TODO +``` + +> From this property the next would be a simple corollary. + ### Supremum preserving maps preserve order ```agda @@ -242,11 +265,10 @@ module _ (g : hom-sup-Poset Q R l7) (f : hom-sup-Poset P Q l7) → preserves-suprema-map-Poset P R l7 ( map-hom-sup-Poset Q R g ∘ map-hom-sup-Poset P Q f) - preserves-suprema-comp-Poset g f x y H = + preserves-suprema-comp-Poset g f x y = preserves-suprema-map-hom-sup-Poset Q R g ( map-hom-sup-Poset P Q f ∘ x) ( sup-map-hom-sup-Poset P Q f y) - ( H) comp-hom-sup-Poset : (g : hom-sup-Poset Q R l7) (f : hom-sup-Poset P Q l7) → From 59ead07320c06adf7fdcd81dc6795f8121161fc5 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 4 Nov 2024 15:05:10 +0100 Subject: [PATCH 63/83] a little renaming --- .../omega-continuous-maps-posets.lagda.md | 46 +++++------ .../join-preserving-maps-posets.lagda.md | 62 +++++++------- .../supremum-preserving-maps-posets.lagda.md | 80 +++++++++---------- 3 files changed, 94 insertions(+), 94 deletions(-) diff --git a/src/domain-theory/omega-continuous-maps-posets.lagda.md b/src/domain-theory/omega-continuous-maps-posets.lagda.md index 01aaa6bbcf..5c5c7a16ed 100644 --- a/src/domain-theory/omega-continuous-maps-posets.lagda.md +++ b/src/domain-theory/omega-continuous-maps-posets.lagda.md @@ -108,10 +108,10 @@ module _ {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) where - is-ω-continuous-map-Poset : + preserves-ω-chains-Poset : (type-Poset P → type-Poset Q) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) - is-ω-continuous-map-Poset f = + preserves-ω-chains-Poset f = (x : hom-Poset ℕ-Poset P) (y : has-least-upper-bound-family-of-elements-Poset P @@ -120,30 +120,30 @@ module _ ( f ∘ map-hom-Poset ℕ-Poset P x) ( f (pr1 y)) - is-prop-is-ω-continuous-map-Poset : + is-prop-preserves-ω-chains-Poset : (f : type-Poset P → type-Poset Q) → - is-prop (is-ω-continuous-map-Poset f) - is-prop-is-ω-continuous-map-Poset f = + is-prop (preserves-ω-chains-Poset f) + is-prop-preserves-ω-chains-Poset f = is-prop-Π (is-prop-preserves-ω-supremum-map-Poset P Q f) is-ω-continuous-prop-map-Poset : (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) is-ω-continuous-prop-map-Poset f = - ( is-ω-continuous-map-Poset f) , - ( is-prop-is-ω-continuous-map-Poset f) + ( preserves-ω-chains-Poset f) , + ( is-prop-preserves-ω-chains-Poset f) ω-continuous-hom-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) ω-continuous-hom-Poset = - Σ (type-Poset P → type-Poset Q) (is-ω-continuous-map-Poset) + Σ (type-Poset P → type-Poset Q) (preserves-ω-chains-Poset) map-ω-continuous-hom-Poset : ω-continuous-hom-Poset → type-Poset P → type-Poset Q map-ω-continuous-hom-Poset = pr1 - is-ω-continuous-map-ω-continuous-hom-Poset : + preserves-ω-chains-ω-continuous-hom-Poset : (f : ω-continuous-hom-Poset) → - is-ω-continuous-map-Poset (map-ω-continuous-hom-Poset f) - is-ω-continuous-map-ω-continuous-hom-Poset = pr2 + preserves-ω-chains-Poset (map-ω-continuous-hom-Poset f) + preserves-ω-chains-ω-continuous-hom-Poset = pr2 sup-map-ω-continuous-hom-Poset : (f : ω-continuous-hom-Poset) → @@ -154,7 +154,7 @@ module _ ( map-ω-continuous-hom-Poset f ∘ map-hom-Poset ℕ-Poset P x) sup-map-ω-continuous-hom-Poset f x y = ( map-ω-continuous-hom-Poset f (pr1 y) , - is-ω-continuous-map-ω-continuous-hom-Poset f x y) + preserves-ω-chains-ω-continuous-hom-Poset f x y) ``` ## Properties @@ -167,11 +167,11 @@ module _ where abstract - preserves-order-is-ω-continuous-map-Poset : + preserves-order-preserves-ω-chains-Poset : {f : type-Poset P → type-Poset Q} → - is-ω-continuous-map-Poset P Q f → + preserves-ω-chains-Poset P Q f → preserves-order-Poset P Q f - preserves-order-is-ω-continuous-map-Poset {f} H x y p = + preserves-order-preserves-ω-chains-Poset {f} H x y p = pr2 ( H ( hom-ind-ℕ-Poset P ( rec-ℕ x (λ _ _ → y)) @@ -188,8 +188,8 @@ module _ ω-continuous-hom-Poset P Q → hom-Poset P Q hom-ω-continuous-hom-Poset f = map-ω-continuous-hom-Poset P Q f , - preserves-order-is-ω-continuous-map-Poset - ( is-ω-continuous-map-ω-continuous-hom-Poset P Q f) + preserves-order-preserves-ω-chains-Poset + ( preserves-ω-chains-ω-continuous-hom-Poset P Q f) ``` ### Homotopies of ω-continuous maps @@ -222,10 +222,10 @@ module _ is-torsorial-htpy-ω-continuous-hom-Poset f = is-torsorial-Eq-subtype ( is-torsorial-htpy (map-ω-continuous-hom-Poset P Q f)) - ( is-prop-is-ω-continuous-map-Poset P Q) + ( is-prop-preserves-ω-chains-Poset P Q) ( map-ω-continuous-hom-Poset P Q f) ( refl-htpy) - ( is-ω-continuous-map-ω-continuous-hom-Poset P Q f) + ( preserves-ω-chains-ω-continuous-hom-Poset P Q f) is-equiv-htpy-eq-ω-continuous-hom-Poset : (f g : ω-continuous-hom-Poset P Q) → @@ -258,7 +258,7 @@ module _ where is-ω-continuous-id-Poset : - is-ω-continuous-map-Poset P P (id {A = type-Poset P}) + preserves-ω-chains-Poset P P (id {A = type-Poset P}) is-ω-continuous-id-Poset x y = pr2 y id-ω-continuous-hom-Poset : ω-continuous-hom-Poset P P @@ -276,14 +276,14 @@ module _ is-ω-continuous-comp-Poset : (g : ω-continuous-hom-Poset Q R) (f : ω-continuous-hom-Poset P Q) → - is-ω-continuous-map-Poset P R + preserves-ω-chains-Poset P R ( map-ω-continuous-hom-Poset Q R g ∘ map-ω-continuous-hom-Poset P Q f) is-ω-continuous-comp-Poset g f c y = - is-ω-continuous-map-ω-continuous-hom-Poset Q R g + preserves-ω-chains-ω-continuous-hom-Poset Q R g ( comp-hom-Poset ℕ-Poset P Q (hom-ω-continuous-hom-Poset P Q f) c) ( map-ω-continuous-hom-Poset P Q f (pr1 y) , - is-ω-continuous-map-ω-continuous-hom-Poset P Q f c y) + preserves-ω-chains-ω-continuous-hom-Poset P Q f c y) comp-ω-continuous-hom-Poset : (g : ω-continuous-hom-Poset Q R) diff --git a/src/order-theory/join-preserving-maps-posets.lagda.md b/src/order-theory/join-preserving-maps-posets.lagda.md index e00f0e741c..5602aaac13 100644 --- a/src/order-theory/join-preserving-maps-posets.lagda.md +++ b/src/order-theory/join-preserving-maps-posets.lagda.md @@ -35,7 +35,7 @@ open import order-theory.posets A map `f : P → Q` between the underlying types of two [posets](order-theory.posets.md) is said to be -{{#concept "join preserving" Disambiguation="map of posets" Agda=preserves-joins-map-Poset}} +{{#concept "join preserving" Disambiguation="map of posets" Agda=preserves-joins-Poset}} if for every pair of elements `x, y : P` with a [least upper bound](order-theory.least-upper-bounds-posets.md) `z`, we have `f z` is the least upper bound of `f x` and `f y`. @@ -51,14 +51,14 @@ module _ (x y : type-Poset P) where - preserves-join-map-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) - preserves-join-map-Poset = + preserves-join-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-join-Poset = (s : has-least-binary-upper-bound-Poset P x y) → is-least-binary-upper-bound-Poset Q (f x) (f y) (f (pr1 s)) - is-prop-preserves-join-map-Poset : - is-prop preserves-join-map-Poset - is-prop-preserves-join-map-Poset = + is-prop-preserves-join-Poset : + is-prop preserves-join-Poset + is-prop-preserves-join-Poset = is-prop-Π ( λ s → is-prop-is-least-binary-upper-bound-Poset Q @@ -66,9 +66,9 @@ module _ ( f y) ( f (pr1 s))) - preserves-join-prop-map-Poset : Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) - preserves-join-prop-map-Poset = - preserves-join-map-Poset , is-prop-preserves-join-map-Poset + preserves-join-prop-Poset : Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-join-prop-Poset = + preserves-join-Poset , is-prop-preserves-join-Poset ``` ### Join preserving maps @@ -78,37 +78,37 @@ module _ {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) where - preserves-joins-map-Poset : + preserves-joins-Poset : (type-Poset P → type-Poset Q) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) - preserves-joins-map-Poset f = + preserves-joins-Poset f = (x y : type-Poset P) (s : has-least-binary-upper-bound-Poset P x y) → is-least-binary-upper-bound-Poset Q (f x) (f y) (f (pr1 s)) - is-prop-preserves-joins-map-Poset : + is-prop-preserves-joins-Poset : (f : type-Poset P → type-Poset Q) → - is-prop (preserves-joins-map-Poset f) - is-prop-preserves-joins-map-Poset f = + is-prop (preserves-joins-Poset f) + is-prop-preserves-joins-Poset f = is-prop-Π - ( λ x → is-prop-Π (is-prop-preserves-join-map-Poset P Q f x)) + ( λ x → is-prop-Π (is-prop-preserves-join-Poset P Q f x)) - preserves-joins-prop-map-Poset : + preserves-joins-prop-Poset : (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) - preserves-joins-prop-map-Poset f = - ( preserves-joins-map-Poset f , is-prop-preserves-joins-map-Poset f) + preserves-joins-prop-Poset f = + ( preserves-joins-Poset f , is-prop-preserves-joins-Poset f) hom-join-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) hom-join-Poset = - Σ (type-Poset P → type-Poset Q) (preserves-joins-map-Poset) + Σ (type-Poset P → type-Poset Q) (preserves-joins-Poset) map-hom-join-Poset : hom-join-Poset → type-Poset P → type-Poset Q map-hom-join-Poset = pr1 - preserves-joins-map-hom-join-Poset : + preserves-joins-hom-join-Poset : (f : hom-join-Poset) → - preserves-joins-map-Poset (map-hom-join-Poset f) - preserves-joins-map-hom-join-Poset = pr2 + preserves-joins-Poset (map-hom-join-Poset f) + preserves-joins-hom-join-Poset = pr2 sup-map-hom-join-Poset : (f : hom-join-Poset) {x y : type-Poset P} → @@ -117,7 +117,7 @@ module _ ( map-hom-join-Poset f x) ( map-hom-join-Poset f y) sup-map-hom-join-Poset f {x} {y} s = - ( map-hom-join-Poset f (pr1 s) , preserves-joins-map-hom-join-Poset f x y s) + ( map-hom-join-Poset f (pr1 s) , preserves-joins-hom-join-Poset f x y s) ``` ## Properties @@ -130,11 +130,11 @@ module _ where abstract - preserves-order-preserves-joins-map-Poset : + preserves-order-preserves-joins-Poset : {f : type-Poset P → type-Poset Q} → - preserves-joins-map-Poset P Q f → + preserves-joins-Poset P Q f → preserves-order-Poset P Q f - preserves-order-preserves-joins-map-Poset {f} H x y p = + preserves-order-preserves-joins-Poset {f} H x y p = pr1 ( pr2 ( H x y (y , is-least-binary-upper-bound-leq-Poset P x y p) (f y)) @@ -163,10 +163,10 @@ module _ is-torsorial-htpy-hom-join-Poset f = is-torsorial-Eq-subtype ( is-torsorial-htpy (map-hom-join-Poset P Q f)) - ( is-prop-preserves-joins-map-Poset P Q) + ( is-prop-preserves-joins-Poset P Q) ( map-hom-join-Poset P Q f) ( refl-htpy) - ( preserves-joins-map-hom-join-Poset P Q f) + ( preserves-joins-hom-join-Poset P Q f) is-equiv-htpy-eq-hom-join-Poset : (f g : hom-join-Poset P Q) → is-equiv (htpy-eq-hom-join-Poset f g) @@ -194,7 +194,7 @@ module _ where preserves-joins-id-Poset : - preserves-joins-map-Poset P P (id {A = type-Poset P}) + preserves-joins-Poset P P (id {A = type-Poset P}) preserves-joins-id-Poset x y s = pr2 s id-hom-join-Poset : hom-join-Poset P P @@ -211,10 +211,10 @@ module _ preserves-joins-comp-Poset : (g : hom-join-Poset Q R) (f : hom-join-Poset P Q) → - preserves-joins-map-Poset P R + preserves-joins-Poset P R ( map-hom-join-Poset Q R g ∘ map-hom-join-Poset P Q f) preserves-joins-comp-Poset g f x y s = - preserves-joins-map-hom-join-Poset Q R g + preserves-joins-hom-join-Poset Q R g ( map-hom-join-Poset P Q f x) ( map-hom-join-Poset P Q f y) ( sup-map-hom-join-Poset P Q f s) diff --git a/src/order-theory/supremum-preserving-maps-posets.lagda.md b/src/order-theory/supremum-preserving-maps-posets.lagda.md index 146b30d6c9..19e7480cce 100644 --- a/src/order-theory/supremum-preserving-maps-posets.lagda.md +++ b/src/order-theory/supremum-preserving-maps-posets.lagda.md @@ -36,7 +36,7 @@ open import order-theory.posets A map `f : P → Q` between the underlying types of two [posets](order-theory.posets.md) is said to be -{{#concept "supremum preserving" Disambiguation="map of posets" Agda=preserves-suprema-map-Poset}} +{{#concept "supremum preserving" Disambiguation="map of posets" Agda=preserves-suprema-Poset}} if ```text @@ -57,23 +57,23 @@ module _ {I : UU l5} (x : I → type-Poset P) where - preserves-supremum-map-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5) - preserves-supremum-map-Poset = + preserves-supremum-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5) + preserves-supremum-Poset = (y : has-least-upper-bound-family-of-elements-Poset P x) → is-least-upper-bound-family-of-elements-Poset Q (f ∘ x) (f (pr1 y)) - is-prop-preserves-supremum-map-Poset : - is-prop preserves-supremum-map-Poset - is-prop-preserves-supremum-map-Poset = + is-prop-preserves-supremum-Poset : + is-prop preserves-supremum-Poset + is-prop-preserves-supremum-Poset = is-prop-Π ( λ y → is-prop-is-least-upper-bound-family-of-elements-Poset Q ( f ∘ x) ( f (pr1 y))) - preserves-supremum-prop-map-Poset : Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5) - preserves-supremum-prop-map-Poset = - preserves-supremum-map-Poset , is-prop-preserves-supremum-map-Poset + preserves-supremum-prop-Poset : Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ l5) + preserves-supremum-prop-Poset = + preserves-supremum-Poset , is-prop-preserves-supremum-Poset ``` ### Supremum preserving maps @@ -83,39 +83,39 @@ module _ {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) where - preserves-suprema-map-Poset : + preserves-suprema-Poset : (l5 : Level) → (type-Poset P → type-Poset Q) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) - preserves-suprema-map-Poset l5 f = + preserves-suprema-Poset l5 f = {I : UU l5} (x : I → type-Poset P) (y : has-least-upper-bound-family-of-elements-Poset P x) → is-least-upper-bound-family-of-elements-Poset Q (f ∘ x) (f (pr1 y)) - is-prop-preserves-suprema-map-Poset : + is-prop-preserves-suprema-Poset : {l5 : Level} (f : type-Poset P → type-Poset Q) → - is-prop (preserves-suprema-map-Poset l5 f) - is-prop-preserves-suprema-map-Poset f = + is-prop (preserves-suprema-Poset l5 f) + is-prop-preserves-suprema-Poset f = is-prop-implicit-Π - ( λ I → is-prop-Π (is-prop-preserves-supremum-map-Poset P Q f)) + ( λ I → is-prop-Π (is-prop-preserves-supremum-Poset P Q f)) - preserves-suprema-prop-map-Poset : + preserves-suprema-prop-Poset : (l5 : Level) → (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) - preserves-suprema-prop-map-Poset l5 f = - preserves-suprema-map-Poset l5 f , (is-prop-preserves-suprema-map-Poset f) + preserves-suprema-prop-Poset l5 f = + preserves-suprema-Poset l5 f , (is-prop-preserves-suprema-Poset f) hom-sup-Poset : (l5 : Level) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) hom-sup-Poset l5 = - Σ (type-Poset P → type-Poset Q) (preserves-suprema-map-Poset l5) + Σ (type-Poset P → type-Poset Q) (preserves-suprema-Poset l5) map-hom-sup-Poset : {l5 : Level} → hom-sup-Poset l5 → type-Poset P → type-Poset Q map-hom-sup-Poset = pr1 - preserves-suprema-map-hom-sup-Poset : + preserves-suprema-hom-sup-Poset : {l5 : Level} (f : hom-sup-Poset l5) → - preserves-suprema-map-Poset l5 (map-hom-sup-Poset f) - preserves-suprema-map-hom-sup-Poset = pr2 + preserves-suprema-Poset l5 (map-hom-sup-Poset f) + preserves-suprema-hom-sup-Poset = pr2 sup-map-hom-sup-Poset : {l5 : Level} (f : hom-sup-Poset l5) → @@ -123,7 +123,7 @@ module _ has-least-upper-bound-family-of-elements-Poset P x → has-least-upper-bound-family-of-elements-Poset Q (map-hom-sup-Poset f ∘ x) sup-map-hom-sup-Poset f {x = x} y = - ( map-hom-sup-Poset f (pr1 y) , preserves-suprema-map-hom-sup-Poset f x y) + ( map-hom-sup-Poset f (pr1 y) , preserves-suprema-hom-sup-Poset f x y) ``` ## Properties @@ -135,11 +135,11 @@ module _ {l1 l2 l3 l4 l5 l6 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) where - preserves-small-supremum-preserves-suprema-map-Poset : - {f : type-Poset P → type-Poset Q} → preserves-suprema-map-Poset P Q l5 f → + preserves-small-supremum-preserves-suprema-Poset : + {f : type-Poset P → type-Poset Q} → preserves-suprema-Poset P Q l5 f → {I : UU l6} (u : is-small l5 I) (x : I → type-Poset P) → - preserves-supremum-map-Poset P Q f (x ∘ map-inv-equiv-is-small u) - preserves-small-supremum-preserves-suprema-map-Poset H u x = + preserves-supremum-Poset P Q f (x ∘ map-inv-equiv-is-small u) + preserves-small-supremum-preserves-suprema-Poset H u x = H (x ∘ map-inv-equiv-is-small u) ``` @@ -151,11 +151,11 @@ module _ where abstract - preserves-joins-preserves-suprema-map-Poset : + preserves-joins-preserves-suprema-Poset : {f : type-Poset P → type-Poset Q} → - preserves-suprema-map-Poset P Q l5 f → - preserves-joins-map-Poset P Q f - preserves-joins-preserves-suprema-map-Poset {f} H x y s = + preserves-suprema-Poset P Q l5 f → + preserves-joins-Poset P Q f + preserves-joins-preserves-suprema-Poset {f} H x y s = is-least-binary-upper-bound-has-least-upper-bound-family-of-elements-Poset ( Q) ( rec-bool (f x) (f y)) @@ -172,13 +172,13 @@ module _ where abstract - preserves-order-preserves-suprema-map-Poset : + preserves-order-preserves-suprema-Poset : {f : type-Poset P → type-Poset Q} → - preserves-suprema-map-Poset P Q l5 f → + preserves-suprema-Poset P Q l5 f → preserves-order-Poset P Q f - preserves-order-preserves-suprema-map-Poset {f} H x y p = + preserves-order-preserves-suprema-Poset {f} H x y p = pr2 - ( preserves-small-supremum-preserves-suprema-map-Poset P Q H + ( preserves-small-supremum-preserves-suprema-Poset P Q H ( Raise l5 bool) ( family-of-elements-has-least-binary-upper-bound-Poset P x y ( has-least-binary-upper-bound-leq-Poset P x y p)) @@ -215,10 +215,10 @@ module _ is-torsorial-htpy-hom-sup-Poset f = is-torsorial-Eq-subtype ( is-torsorial-htpy (map-hom-sup-Poset P Q f)) - ( is-prop-preserves-suprema-map-Poset P Q) + ( is-prop-preserves-suprema-Poset P Q) ( map-hom-sup-Poset P Q f) ( refl-htpy) - ( preserves-suprema-map-hom-sup-Poset P Q f) + ( preserves-suprema-hom-sup-Poset P Q f) is-equiv-htpy-eq-hom-sup-Poset : (f g : hom-sup-Poset P Q l5) → is-equiv (htpy-eq-hom-sup-Poset f g) @@ -246,7 +246,7 @@ module _ where preserves-suprema-id-Poset : - {l3 : Level} → preserves-suprema-map-Poset P P l3 (id {A = type-Poset P}) + {l3 : Level} → preserves-suprema-Poset P P l3 (id {A = type-Poset P}) preserves-suprema-id-Poset x y = pr2 y id-hom-sup-Poset : (l3 : Level) → hom-sup-Poset P P l3 @@ -263,10 +263,10 @@ module _ preserves-suprema-comp-Poset : (g : hom-sup-Poset Q R l7) (f : hom-sup-Poset P Q l7) → - preserves-suprema-map-Poset P R l7 + preserves-suprema-Poset P R l7 ( map-hom-sup-Poset Q R g ∘ map-hom-sup-Poset P Q f) preserves-suprema-comp-Poset g f x y = - preserves-suprema-map-hom-sup-Poset Q R g + preserves-suprema-hom-sup-Poset Q R g ( map-hom-sup-Poset P Q f ∘ x) ( sup-map-hom-sup-Poset P Q f y) From f7a2351a65da9354e13bf76b79fef27fab033d62 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 4 Nov 2024 16:10:02 +0100 Subject: [PATCH 64/83] kleene's fixed point construction --- src/domain-theory.lagda.md | 3 +- ...-theorem-directed-complete-posets.lagda.md | 193 ------------------ ...int-theorem-omega-complete-posets.lagda.md | 169 --------------- ...leenes-fixed-point-theorem-posets.lagda.md | 176 ++++++++++++++++ .../omega-complete-posets.lagda.md | 12 ++ .../omega-continuous-maps-posets.lagda.md | 50 ++--- .../scott-continuous-maps-posets.lagda.md | 44 ++-- 7 files changed, 236 insertions(+), 411 deletions(-) delete mode 100644 src/domain-theory/kleenes-fixed-point-theorem-directed-complete-posets.lagda.md delete mode 100644 src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md create mode 100644 src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md diff --git a/src/domain-theory.lagda.md b/src/domain-theory.lagda.md index f0af1a2e9b..82612b0fa3 100644 --- a/src/domain-theory.lagda.md +++ b/src/domain-theory.lagda.md @@ -5,8 +5,7 @@ module domain-theory where open import domain-theory.directed-complete-posets public open import domain-theory.directed-families-posets public -open import domain-theory.kleenes-fixed-point-theorem-directed-complete-posets public -open import domain-theory.kleenes-fixed-point-theorem-omega-complete-posets public +open import domain-theory.kleenes-fixed-point-theorem-posets public open import domain-theory.omega-complete-posets public open import domain-theory.omega-continuous-maps-posets public open import domain-theory.scott-continuous-maps-posets public diff --git a/src/domain-theory/kleenes-fixed-point-theorem-directed-complete-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-directed-complete-posets.lagda.md deleted file mode 100644 index 8e2133a78a..0000000000 --- a/src/domain-theory/kleenes-fixed-point-theorem-directed-complete-posets.lagda.md +++ /dev/null @@ -1,193 +0,0 @@ -# Kleene's fixed point theorem for directed complete posets - -```agda -module domain-theory.kleenes-fixed-point-theorem-directed-complete-posets where -``` - -
Imports - -```agda -open import domain-theory.directed-complete-posets -open import domain-theory.directed-families-posets -open import domain-theory.scott-continuous-maps-posets - -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.conjunction -open import foundation.coproduct-types -open import foundation.dependent-pair-types -open import foundation.existential-quantification -open import foundation.fixed-points-endofunctions -open import foundation.identity-types -open import foundation.inhabited-types -open import foundation.iterating-functions -open import foundation.logical-equivalences -open import foundation.propositional-truncations -open import foundation.universe-levels - -open import order-theory.bottom-elements-posets -open import order-theory.chains-posets -open import order-theory.inflattices -open import order-theory.inhabited-chains-posets -open import order-theory.least-upper-bounds-posets -open import order-theory.order-preserving-maps-posets -open import order-theory.posets -open import order-theory.suplattices -``` - -
- -## Idea - -{{#concept "Kleene's fixed point theorem" WD="Kleene fixed-point theorem" WDID=Q3527263}} -states that every -[Scott-continuous](domain-theory.scott-continuous-maps-posets.md) endomap -`f : 𝒜 → 𝒜` on an inhabited -[directed complete poset](domain-theory.directed-complete-posets.md) `𝒜` has a -[fixed point](foundation.fixed-points-endofunctions.md), and if `𝒜` has a bottom -element, then `f` has a least fixed point. - -## Theorem - -### Kleene's fixed point theorem for directed complete posets - -```agda -module _ - {l1 l2 : Level} - (𝒜 : Directed-Complete-Poset l1 l2 lzero) - (f : type-Directed-Complete-Poset 𝒜 → type-Directed-Complete-Poset 𝒜) - (F : - is-scott-continuous-map-Poset - ( poset-Directed-Complete-Poset 𝒜) - ( poset-Directed-Complete-Poset 𝒜) - ( lzero) - ( f)) - (x : type-Directed-Complete-Poset 𝒜) - (p : leq-Directed-Complete-Poset 𝒜 x (f x)) - where - - leq-iterate-kleene-Directed-Complete-Poset : - (n : ℕ) → - leq-Directed-Complete-Poset 𝒜 (iterate n f x) (iterate (succ-ℕ n) f x) - leq-iterate-kleene-Directed-Complete-Poset zero-ℕ = p - leq-iterate-kleene-Directed-Complete-Poset (succ-ℕ n) = - preserves-order-is-scott-continuous-map-Poset - ( poset-Directed-Complete-Poset 𝒜) - ( poset-Directed-Complete-Poset 𝒜) - ( F) - ( iterate n f x) - ( iterate (succ-ℕ n) f x) - ( leq-iterate-kleene-Directed-Complete-Poset n) - - hom-kleene-Directed-Complete-Poset : - hom-Poset ℕ-Poset (poset-Directed-Complete-Poset 𝒜) - hom-kleene-Directed-Complete-Poset = - hom-ind-ℕ-Poset - ( poset-Directed-Complete-Poset 𝒜) - ( λ n → iterate n f x) - ( leq-iterate-kleene-Directed-Complete-Poset) - - indexing-type-kleene-Directed-Complete-Poset : UU lzero - indexing-type-kleene-Directed-Complete-Poset = ℕ - - is-inhabited-indexing-type-kleene-Directed-Complete-Poset : - is-inhabited indexing-type-kleene-Directed-Complete-Poset - is-inhabited-indexing-type-kleene-Directed-Complete-Poset = - unit-trunc-Prop 0 - - indexing-inhabited-type-kleene-Directed-Complete-Poset : Inhabited-Type lzero - indexing-inhabited-type-kleene-Directed-Complete-Poset = - indexing-type-kleene-Directed-Complete-Poset , - is-inhabited-indexing-type-kleene-Directed-Complete-Poset - - family-kleene-Directed-Complete-Poset : - ℕ → type-Directed-Complete-Poset 𝒜 - family-kleene-Directed-Complete-Poset n = iterate n f x - - preserves-order-family-kleene-Directed-Complete-Poset : - preserves-order-Poset - ( ℕ-Poset) - ( poset-Directed-Complete-Poset 𝒜) - ( family-kleene-Directed-Complete-Poset) - preserves-order-family-kleene-Directed-Complete-Poset = - preserves-order-ind-ℕ-Poset - ( poset-Directed-Complete-Poset 𝒜) - ( family-kleene-Directed-Complete-Poset) - ( leq-iterate-kleene-Directed-Complete-Poset) - - is-directed-family-kleene-Directed-Complete-Poset : - is-directed-family-Poset - ( poset-Directed-Complete-Poset 𝒜) - ( indexing-inhabited-type-kleene-Directed-Complete-Poset) - ( family-kleene-Directed-Complete-Poset) - is-directed-family-kleene-Directed-Complete-Poset n m = - rec-coproduct - ( λ p → - intro-exists m - ( preserves-order-family-kleene-Directed-Complete-Poset n m p , - preserves-order-family-kleene-Directed-Complete-Poset m m - ( refl-leq-ℕ m))) - ( λ p → - intro-exists n - ( preserves-order-family-kleene-Directed-Complete-Poset n n - ( refl-leq-ℕ n) , - preserves-order-family-kleene-Directed-Complete-Poset m n p)) - ( linear-leq-ℕ n m) - - directed-family-kleene-Directed-Complete-Poset : - directed-family-Poset lzero (poset-Directed-Complete-Poset 𝒜) - directed-family-kleene-Directed-Complete-Poset = - indexing-inhabited-type-kleene-Directed-Complete-Poset , - family-kleene-Directed-Complete-Poset , - is-directed-family-kleene-Directed-Complete-Poset - - point-kleene-Directed-Complete-Poset : type-Directed-Complete-Poset 𝒜 - point-kleene-Directed-Complete-Poset = - sup-Directed-Complete-Poset 𝒜 directed-family-kleene-Directed-Complete-Poset - - leq-point-kleene-Directed-Complete-Poset : - leq-Directed-Complete-Poset 𝒜 - ( point-kleene-Directed-Complete-Poset) - ( f point-kleene-Directed-Complete-Poset) - leq-point-kleene-Directed-Complete-Poset = {! pr1 (F ? ? ?) ? !} - - geq-point-kleene-Directed-Complete-Poset : - leq-Directed-Complete-Poset 𝒜 - ( f point-kleene-Directed-Complete-Poset) - ( point-kleene-Directed-Complete-Poset) - geq-point-kleene-Directed-Complete-Poset = - pr1 - ( F ( directed-family-kleene-Directed-Complete-Poset) - ( is-directed-complete-Directed-Complete-Poset 𝒜 - directed-family-kleene-Directed-Complete-Poset) - ( point-kleene-Directed-Complete-Poset)) - {! !} - - is-fixed-point-kleene-Directed-Complete-Poset : - f ( point-kleene-Directed-Complete-Poset) = - point-kleene-Directed-Complete-Poset - is-fixed-point-kleene-Directed-Complete-Poset = - eq-is-least-upper-bound-family-of-elements-Poset - ( poset-Directed-Complete-Poset 𝒜) - (λ where a → {! !}) - ( is-least-upper-bound-sup-Directed-Complete-Poset 𝒜 - ( directed-family-kleene-Directed-Complete-Poset)) - - fixed-point-kleene-Directed-Complete-Poset : fixed-point f - fixed-point-kleene-Directed-Complete-Poset = - point-kleene-Directed-Complete-Poset , - is-fixed-point-kleene-Directed-Complete-Poset -``` - -### Kleene's fixed point theorem for directed complete posets with a bottom element - -> TODO - -## External links - -- [Kleene fixed-point theorem](https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem) - at Wikipedia -- [Kleene's fixed point theorem](https://ncatlab.org/nlab/show/Kleene%27s+fixed+point+theorem) - at $n$Lab diff --git a/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md deleted file mode 100644 index 2fdd69379a..0000000000 --- a/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md +++ /dev/null @@ -1,169 +0,0 @@ -# Kleene's fixed point theorem for ω-complete posets - -```agda -module domain-theory.kleenes-fixed-point-theorem-omega-complete-posets where -``` - -
Imports - -```agda -open import domain-theory.directed-families-posets -open import domain-theory.omega-complete-posets -open import domain-theory.omega-continuous-maps-posets - -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.dependent-pair-types -open import foundation.fixed-points-endofunctions -open import foundation.identity-types -open import foundation.inhabited-types -open import foundation.iterating-functions -open import foundation.logical-equivalences -open import foundation.propositional-truncations -open import foundation.universe-levels - -open import order-theory.bottom-elements-posets -open import order-theory.chains-posets -open import order-theory.inflattices -open import order-theory.inhabited-chains-posets -open import order-theory.order-preserving-maps-posets -open import order-theory.posets -open import order-theory.suplattices -``` - -
- -## Idea - -{{#concept "Kleene's fixed point theorem" Disambiguation="ω-complete posets" WD="Kleene fixed-point theorem" WDID=Q3527263}} -states that every [Scott-continuous](domain-theory.ω-continuous-maps-posets.md) -endomap `f : 𝒜 → 𝒜` on an inhabited -[ω-complete poset](domain-theory.omega-complete-posets.md) `𝒜` has a -[fixed point](foundation.fixed-points-endofunctions.md), and if `𝒜` has a bottom -element, then `f` has a least fixed point. - -## Theorem - -### Kleene's fixed point theorem for ω-complete posets - -```agda -module _ - {l1 l2 : Level} - (𝒜 : ω-Complete-Poset l1 l2) - (f : type-ω-Complete-Poset 𝒜 → type-ω-Complete-Poset 𝒜) - (F : - is-ω-continuous-map-Poset - ( poset-ω-Complete-Poset 𝒜) - ( poset-ω-Complete-Poset 𝒜) - ( f)) - (x : type-ω-Complete-Poset 𝒜) - (p : leq-ω-Complete-Poset 𝒜 x (f x)) - where - - leq-iterate-kleene-ω-Complete-Poset : - (n : ℕ) → - leq-ω-Complete-Poset 𝒜 (iterate n f x) (iterate (succ-ℕ n) f x) - leq-iterate-kleene-ω-Complete-Poset zero-ℕ = p - leq-iterate-kleene-ω-Complete-Poset (succ-ℕ n) = - preserves-order-is-ω-continuous-map-Poset - ( poset-ω-Complete-Poset 𝒜) - ( poset-ω-Complete-Poset 𝒜) - ( F) - ( iterate n f x) - ( iterate (succ-ℕ n) f x) - ( leq-iterate-kleene-ω-Complete-Poset n) - - hom-kleene-ω-Complete-Poset : - hom-Poset ℕ-Poset (poset-ω-Complete-Poset 𝒜) - hom-kleene-ω-Complete-Poset = - hom-ind-ℕ-Poset - ( poset-ω-Complete-Poset 𝒜) - ( λ n → iterate n f x) - ( leq-iterate-kleene-ω-Complete-Poset) - - chain-kleene-ω-Complete-Poset : - chain-Poset l1 (poset-ω-Complete-Poset 𝒜) - chain-kleene-ω-Complete-Poset = - chain-hom-total-order-Poset - ( poset-ω-Complete-Poset 𝒜) - ( ℕ-Total-Order) - ( hom-kleene-ω-Complete-Poset) - - is-inhabited-chain-kleene-ω-Complete-Poset : - is-inhabited-chain-Poset - ( poset-ω-Complete-Poset 𝒜) - ( chain-kleene-ω-Complete-Poset) - is-inhabited-chain-kleene-ω-Complete-Poset = - unit-trunc-Prop (x , unit-trunc-Prop (0 , refl)) - - inhabited-chain-kleene-ω-Complete-Poset : - inhabited-chain-Poset l1 (poset-ω-Complete-Poset 𝒜) - inhabited-chain-kleene-ω-Complete-Poset = - chain-kleene-ω-Complete-Poset , - is-inhabited-chain-kleene-ω-Complete-Poset - - indexing-type-kleene-ω-Complete-Poset : UU lzero - indexing-type-kleene-ω-Complete-Poset = ℕ - - is-inhabited-indexing-type-kleene-ω-Complete-Poset : - is-inhabited indexing-type-kleene-ω-Complete-Poset - is-inhabited-indexing-type-kleene-ω-Complete-Poset = - unit-trunc-Prop 0 - - indexing-inhabited-type-kleene-ω-Complete-Poset : Inhabited-Type lzero - indexing-inhabited-type-kleene-ω-Complete-Poset = - indexing-type-kleene-ω-Complete-Poset , - is-inhabited-indexing-type-kleene-ω-Complete-Poset - - directed-family-kleene-ω-Complete-Poset : - directed-family-Poset l1 (poset-ω-Complete-Poset 𝒜) - directed-family-kleene-ω-Complete-Poset = - directed-family-inhabited-chain-Poset - ( poset-ω-Complete-Poset 𝒜) - ( inhabited-chain-kleene-ω-Complete-Poset) - - point-kleene-ω-Complete-Poset : type-ω-Complete-Poset 𝒜 - point-kleene-ω-Complete-Poset = {! sup-ω-Complete-Poset 𝒜 ? !} - -- sup-ω-Complete-Poset 𝒜 - -- ( directed-family-kleene-ω-Complete-Poset) - - -- leq-point-kleene-ω-Complete-Poset : - -- leq-ω-Complete-Poset 𝒜 - -- ( point-kleene-ω-Complete-Poset) - -- ( f point-kleene-ω-Complete-Poset) - -- leq-point-kleene-ω-Complete-Poset = {! !} - - -- geq-point-kleene-ω-Complete-Poset : - -- leq-ω-Complete-Poset 𝒜 - -- ( f point-kleene-ω-Complete-Poset) - -- ( point-kleene-ω-Complete-Poset) - -- geq-point-kleene-ω-Complete-Poset = {! !} - - -- is-fixed-point-kleene-ω-Complete-Poset : - -- f ( point-kleene-ω-Complete-Poset) = - -- point-kleene-ω-Complete-Poset - -- is-fixed-point-kleene-ω-Complete-Poset = - -- antisymmetric-leq-ω-Complete-Poset 𝒜 - -- ( f (point-kleene-ω-Complete-Poset)) - -- ( point-kleene-ω-Complete-Poset) - -- ( geq-point-kleene-ω-Complete-Poset) - -- ( leq-point-kleene-ω-Complete-Poset) - - -- fixed-point-kleene-ω-Complete-Poset : fixed-point f - -- fixed-point-kleene-ω-Complete-Poset = - -- point-kleene-ω-Complete-Poset , - -- is-fixed-point-kleene-ω-Complete-Poset -``` - -### Kleene's fixed point theorem for ω-complete posets with a bottom element - -> TODO - -## External links - -- [Kleene fixed-point theorem](https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem) - at Wikipedia -- [Kleene's fixed point theorem](https://ncatlab.org/nlab/show/Kleene%27s+fixed+point+theorem) - at $n$Lab diff --git a/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md new file mode 100644 index 0000000000..a1eede9ec7 --- /dev/null +++ b/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md @@ -0,0 +1,176 @@ +# Kleene's fixed point theorem for posets + +```agda +module domain-theory.kleenes-fixed-point-theorem-posets where +``` + +
Imports + +```agda +open import domain-theory.directed-families-posets +open import domain-theory.omega-continuous-maps-posets + +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.dependent-pair-types +open import foundation.fixed-points-endofunctions +open import foundation.function-types +open import foundation.identity-types +open import foundation.inhabited-types +open import foundation.iterating-functions +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.universe-levels + +open import order-theory.bottom-elements-posets +open import order-theory.chains-posets +open import order-theory.inflattices +open import order-theory.inhabited-chains-posets +open import order-theory.least-upper-bounds-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +open import order-theory.suplattices +open import order-theory.upper-bounds-posets +``` + +
+ +## Idea + +{{#concept "Kleene's fixed point theorem" Disambiguation="posets" WD="Kleene fixed-point theorem" WDID=Q3527263}} +states that given an [ω-continuous](domain-theory.ω-continuous-maps-posets.md) +endomap `f : 𝒜 → 𝒜` on a [poset](domain-theory.posets.md) `𝒜`, then for every +`x ∈ 𝒜` such that `x ≤ f x`, the ω-transfinite application of `f` to `x`, given +that it exists, is a [fixed point](foundation.fixed-points-endofunctions.md) of +`f`: + +```text + x ≤ f(x) ≤ f²(x) ≤ … ≤ fⁿ(x) ≤ … ≤ fω(x) = f(fω(x)) = …. +``` + +If `𝒜` has a [bottom element](order-theory.bottom-elements-posets.md) `⊥`, then +this construction gives a least fixed point of `f`. + +## Theorem + +### Kleene's fixed point construction on posets + +```agda +module _ + {l1 l2 : Level} + (𝒜 : Poset l1 l2) + {f : type-Poset 𝒜 → type-Poset 𝒜} + (F : is-ω-continuous-Poset 𝒜 𝒜 f) + (x : type-Poset 𝒜) + (p : leq-Poset 𝒜 x (f x)) + where + + family-of-elements-kleene-Poset : ℕ → type-Poset 𝒜 + family-of-elements-kleene-Poset n = iterate n f x + + leq-succ-family-of-elements-kleene-Poset : + (n : ℕ) → + leq-Poset 𝒜 + ( family-of-elements-kleene-Poset n) + ( family-of-elements-kleene-Poset (succ-ℕ n)) + leq-succ-family-of-elements-kleene-Poset zero-ℕ = p + leq-succ-family-of-elements-kleene-Poset (succ-ℕ n) = + preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F + ( family-of-elements-kleene-Poset n) + ( family-of-elements-kleene-Poset (succ-ℕ n)) + ( leq-succ-family-of-elements-kleene-Poset n) + + hom-kleene-Poset : hom-Poset ℕ-Poset 𝒜 + hom-kleene-Poset = + hom-ind-ℕ-Poset 𝒜 + ( family-of-elements-kleene-Poset) + ( leq-succ-family-of-elements-kleene-Poset) + +module _ + {l1 l2 : Level} + (𝒜 : Poset l1 l2) + {f : type-Poset 𝒜 → type-Poset 𝒜} + (F : is-ω-continuous-Poset 𝒜 𝒜 f) + (x : type-Poset 𝒜) + (p : leq-Poset 𝒜 x (f x)) + (s : + has-least-upper-bound-family-of-elements-Poset 𝒜 + ( family-of-elements-kleene-Poset 𝒜 F x p)) + where + + point-kleene-Poset : type-Poset 𝒜 + point-kleene-Poset = pr1 s + + is-upper-bound-map-point-kleene-Poset : + is-upper-bound-family-of-elements-Poset 𝒜 + ( family-of-elements-kleene-Poset 𝒜 F x p) + ( f point-kleene-Poset) + is-upper-bound-map-point-kleene-Poset zero-ℕ = + transitive-leq-Poset 𝒜 x (f x) + ( f point-kleene-Poset) + ( preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F x + ( point-kleene-Poset) + ( is-upper-bound-is-least-upper-bound-family-of-elements-Poset 𝒜 + ( pr2 s) + ( 0))) + ( p) + is-upper-bound-map-point-kleene-Poset (succ-ℕ n) = + preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F + ( family-of-elements-kleene-Poset 𝒜 F x p n) + ( point-kleene-Poset) + ( is-upper-bound-is-least-upper-bound-family-of-elements-Poset 𝒜 + ( pr2 s) + ( n)) + + leq-point-kleene-Poset : + leq-Poset 𝒜 (point-kleene-Poset) (f point-kleene-Poset) + leq-point-kleene-Poset = + pr1 (pr2 s (f point-kleene-Poset)) (is-upper-bound-map-point-kleene-Poset) + + geq-point-kleene-Poset : + leq-Poset 𝒜 (f point-kleene-Poset) (point-kleene-Poset) + geq-point-kleene-Poset = + pr1 + ( F (hom-kleene-Poset 𝒜 F x p) s point-kleene-Poset) + ( is-upper-bound-is-least-upper-bound-family-of-elements-Poset 𝒜 (pr2 s) ∘ + succ-ℕ) + + is-fixed-point-kleene-Poset : f (point-kleene-Poset) = point-kleene-Poset + is-fixed-point-kleene-Poset = + antisymmetric-leq-Poset 𝒜 + ( f (point-kleene-Poset)) + ( point-kleene-Poset) + ( geq-point-kleene-Poset) + ( leq-point-kleene-Poset) + + fixed-point-kleene-Poset : fixed-point f + fixed-point-kleene-Poset = + point-kleene-Poset , is-fixed-point-kleene-Poset +``` + +### Kleene's least fixed point theorem for posets with a bottom element + +If `𝒜` has a bottom element, then Kleene's fixed point construction gives a +least fixed point of `f`. + +```agda +module _ + {l1 l2 : Level} + (𝒜 : Poset l1 l2) + {f : type-Poset 𝒜 → type-Poset 𝒜} + (F : is-ω-continuous-Poset 𝒜 𝒜 f) + (b : has-bottom-element-Poset 𝒜) + (s : + has-least-upper-bound-family-of-elements-Poset 𝒜 + ( family-of-elements-kleene-Poset 𝒜 F (pr1 b) (pr2 b (f (pr1 b))))) + where +``` + +## External links + +- [Kleene fixed-point theorem](https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem) + at Wikipedia +- [Kleene's fixed point theorem](https://ncatlab.org/nlab/show/Kleene%27s+fixed+point+theorem) + at $n$Lab diff --git a/src/domain-theory/omega-complete-posets.lagda.md b/src/domain-theory/omega-complete-posets.lagda.md index 5f47ad61dc..f75c69c510 100644 --- a/src/domain-theory/omega-complete-posets.lagda.md +++ b/src/domain-theory/omega-complete-posets.lagda.md @@ -23,6 +23,7 @@ open import foundation.universe-levels open import order-theory.least-upper-bounds-posets open import order-theory.order-preserving-maps-posets open import order-theory.posets +open import order-theory.upper-bounds-posets ```
@@ -163,6 +164,17 @@ module _ ( poset-ω-Complete-Poset) ( is-ω-complete-ω-Complete-Poset) + is-upper-bound-sup-ω-Complete-Poset : + (x : hom-Poset ℕ-Poset poset-ω-Complete-Poset) → + is-upper-bound-family-of-elements-Poset + ( poset-ω-Complete-Poset) + ( map-hom-Poset ℕ-Poset poset-ω-Complete-Poset x) + ( sup-ω-Complete-Poset x) + is-upper-bound-sup-ω-Complete-Poset x = + is-upper-bound-is-least-upper-bound-family-of-elements-Poset + ( poset-ω-Complete-Poset) + ( is-least-upper-bound-sup-ω-Complete-Poset x) + leq-sup-ω-Complete-Poset : (x : hom-Poset ℕ-Poset poset-ω-Complete-Poset) (i : ℕ) → diff --git a/src/domain-theory/omega-continuous-maps-posets.lagda.md b/src/domain-theory/omega-continuous-maps-posets.lagda.md index 5c5c7a16ed..a0ac5342c0 100644 --- a/src/domain-theory/omega-continuous-maps-posets.lagda.md +++ b/src/domain-theory/omega-continuous-maps-posets.lagda.md @@ -108,10 +108,10 @@ module _ {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) where - preserves-ω-chains-Poset : + is-ω-continuous-Poset : (type-Poset P → type-Poset Q) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) - preserves-ω-chains-Poset f = + is-ω-continuous-Poset f = (x : hom-Poset ℕ-Poset P) (y : has-least-upper-bound-family-of-elements-Poset P @@ -120,30 +120,30 @@ module _ ( f ∘ map-hom-Poset ℕ-Poset P x) ( f (pr1 y)) - is-prop-preserves-ω-chains-Poset : + is-prop-is-ω-continuous-Poset : (f : type-Poset P → type-Poset Q) → - is-prop (preserves-ω-chains-Poset f) - is-prop-preserves-ω-chains-Poset f = + is-prop (is-ω-continuous-Poset f) + is-prop-is-ω-continuous-Poset f = is-prop-Π (is-prop-preserves-ω-supremum-map-Poset P Q f) - is-ω-continuous-prop-map-Poset : + is-ω-continuous-prop-Poset : (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) - is-ω-continuous-prop-map-Poset f = - ( preserves-ω-chains-Poset f) , - ( is-prop-preserves-ω-chains-Poset f) + is-ω-continuous-prop-Poset f = + ( is-ω-continuous-Poset f) , + ( is-prop-is-ω-continuous-Poset f) ω-continuous-hom-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) ω-continuous-hom-Poset = - Σ (type-Poset P → type-Poset Q) (preserves-ω-chains-Poset) + Σ (type-Poset P → type-Poset Q) (is-ω-continuous-Poset) map-ω-continuous-hom-Poset : ω-continuous-hom-Poset → type-Poset P → type-Poset Q map-ω-continuous-hom-Poset = pr1 - preserves-ω-chains-ω-continuous-hom-Poset : + is-ω-continuous-ω-continuous-hom-Poset : (f : ω-continuous-hom-Poset) → - preserves-ω-chains-Poset (map-ω-continuous-hom-Poset f) - preserves-ω-chains-ω-continuous-hom-Poset = pr2 + is-ω-continuous-Poset (map-ω-continuous-hom-Poset f) + is-ω-continuous-ω-continuous-hom-Poset = pr2 sup-map-ω-continuous-hom-Poset : (f : ω-continuous-hom-Poset) → @@ -154,7 +154,7 @@ module _ ( map-ω-continuous-hom-Poset f ∘ map-hom-Poset ℕ-Poset P x) sup-map-ω-continuous-hom-Poset f x y = ( map-ω-continuous-hom-Poset f (pr1 y) , - preserves-ω-chains-ω-continuous-hom-Poset f x y) + is-ω-continuous-ω-continuous-hom-Poset f x y) ``` ## Properties @@ -167,11 +167,11 @@ module _ where abstract - preserves-order-preserves-ω-chains-Poset : + preserves-order-is-ω-continuous-Poset : {f : type-Poset P → type-Poset Q} → - preserves-ω-chains-Poset P Q f → + is-ω-continuous-Poset P Q f → preserves-order-Poset P Q f - preserves-order-preserves-ω-chains-Poset {f} H x y p = + preserves-order-is-ω-continuous-Poset {f} H x y p = pr2 ( H ( hom-ind-ℕ-Poset P ( rec-ℕ x (λ _ _ → y)) @@ -188,8 +188,8 @@ module _ ω-continuous-hom-Poset P Q → hom-Poset P Q hom-ω-continuous-hom-Poset f = map-ω-continuous-hom-Poset P Q f , - preserves-order-preserves-ω-chains-Poset - ( preserves-ω-chains-ω-continuous-hom-Poset P Q f) + preserves-order-is-ω-continuous-Poset + ( is-ω-continuous-ω-continuous-hom-Poset P Q f) ``` ### Homotopies of ω-continuous maps @@ -222,10 +222,10 @@ module _ is-torsorial-htpy-ω-continuous-hom-Poset f = is-torsorial-Eq-subtype ( is-torsorial-htpy (map-ω-continuous-hom-Poset P Q f)) - ( is-prop-preserves-ω-chains-Poset P Q) + ( is-prop-is-ω-continuous-Poset P Q) ( map-ω-continuous-hom-Poset P Q f) ( refl-htpy) - ( preserves-ω-chains-ω-continuous-hom-Poset P Q f) + ( is-ω-continuous-ω-continuous-hom-Poset P Q f) is-equiv-htpy-eq-ω-continuous-hom-Poset : (f g : ω-continuous-hom-Poset P Q) → @@ -258,7 +258,7 @@ module _ where is-ω-continuous-id-Poset : - preserves-ω-chains-Poset P P (id {A = type-Poset P}) + is-ω-continuous-Poset P P (id {A = type-Poset P}) is-ω-continuous-id-Poset x y = pr2 y id-ω-continuous-hom-Poset : ω-continuous-hom-Poset P P @@ -276,14 +276,14 @@ module _ is-ω-continuous-comp-Poset : (g : ω-continuous-hom-Poset Q R) (f : ω-continuous-hom-Poset P Q) → - preserves-ω-chains-Poset P R + is-ω-continuous-Poset P R ( map-ω-continuous-hom-Poset Q R g ∘ map-ω-continuous-hom-Poset P Q f) is-ω-continuous-comp-Poset g f c y = - preserves-ω-chains-ω-continuous-hom-Poset Q R g + is-ω-continuous-ω-continuous-hom-Poset Q R g ( comp-hom-Poset ℕ-Poset P Q (hom-ω-continuous-hom-Poset P Q f) c) ( map-ω-continuous-hom-Poset P Q f (pr1 y) , - preserves-ω-chains-ω-continuous-hom-Poset P Q f c y) + is-ω-continuous-ω-continuous-hom-Poset P Q f c y) comp-ω-continuous-hom-Poset : (g : ω-continuous-hom-Poset Q R) diff --git a/src/domain-theory/scott-continuous-maps-posets.lagda.md b/src/domain-theory/scott-continuous-maps-posets.lagda.md index a51d7c0840..73eee12f7a 100644 --- a/src/domain-theory/scott-continuous-maps-posets.lagda.md +++ b/src/domain-theory/scott-continuous-maps-posets.lagda.md @@ -93,10 +93,10 @@ module _ {l1 l2 l3 l4 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) where - is-scott-continuous-map-Poset : + is-scott-continuous-Poset : (l5 : Level) → (type-Poset P → type-Poset Q) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) - is-scott-continuous-map-Poset l5 f = + is-scott-continuous-Poset l5 f = (x : directed-family-Poset l5 P) (y : has-least-upper-bound-family-of-elements-Poset P @@ -105,22 +105,22 @@ module _ ( f ∘ family-directed-family-Poset P x) ( f (pr1 y)) - is-prop-is-scott-continuous-map-Poset : + is-prop-is-scott-continuous-Poset : {l5 : Level} (f : type-Poset P → type-Poset Q) → - is-prop (is-scott-continuous-map-Poset l5 f) - is-prop-is-scott-continuous-map-Poset f = + is-prop (is-scott-continuous-Poset l5 f) + is-prop-is-scott-continuous-Poset f = is-prop-Π (is-prop-preserves-supremum-directed-family-map-Poset P Q f) - is-scott-continuous-prop-map-Poset : + is-scott-continuous-prop-Poset : (l5 : Level) → (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) - is-scott-continuous-prop-map-Poset l5 f = - ( is-scott-continuous-map-Poset l5 f) , - ( is-prop-is-scott-continuous-map-Poset f) + is-scott-continuous-prop-Poset l5 f = + ( is-scott-continuous-Poset l5 f) , + ( is-prop-is-scott-continuous-Poset f) scott-continuous-hom-Poset : (l5 : Level) → UU (l1 ⊔ l2 ⊔ l3 ⊔ l4 ⊔ lsuc l5) scott-continuous-hom-Poset l5 = - Σ (type-Poset P → type-Poset Q) (is-scott-continuous-map-Poset l5) + Σ (type-Poset P → type-Poset Q) (is-scott-continuous-Poset l5) map-scott-continuous-hom-Poset : {l5 : Level} → scott-continuous-hom-Poset l5 → type-Poset P → type-Poset Q @@ -128,7 +128,7 @@ module _ is-scott-continuous-map-scott-continuous-hom-Poset : {l5 : Level} (f : scott-continuous-hom-Poset l5) → - is-scott-continuous-map-Poset l5 (map-scott-continuous-hom-Poset f) + is-scott-continuous-Poset l5 (map-scott-continuous-hom-Poset f) is-scott-continuous-map-scott-continuous-hom-Poset = pr2 sup-map-scott-continuous-hom-Poset : @@ -152,14 +152,14 @@ module _ {l1 l2 l3 l4 l5 l6 : Level} (P : Poset l1 l2) (Q : Poset l3 l4) where - preserves-small-supremum-directed-family-is-scott-continuous-map-Poset : + preserves-small-supremum-directed-family-is-scott-continuous-Poset : {f : type-Poset P → type-Poset Q} → - is-scott-continuous-map-Poset P Q l5 f → + is-scott-continuous-Poset P Q l5 f → (x : directed-family-Poset l6 P) (u : is-small l5 (type-directed-family-Poset P x)) → preserves-supremum-directed-family-map-Poset P Q f ( reindex-inv-equiv-directed-family-Poset P x (equiv-is-small u)) - preserves-small-supremum-directed-family-is-scott-continuous-map-Poset H x u = + preserves-small-supremum-directed-family-is-scott-continuous-Poset H x u = H (reindex-inv-equiv-directed-family-Poset P x (equiv-is-small u)) ``` @@ -171,13 +171,13 @@ module _ where abstract - preserves-order-is-scott-continuous-map-Poset : + preserves-order-is-scott-continuous-Poset : {f : type-Poset P → type-Poset Q} → - is-scott-continuous-map-Poset P Q l5 f → + is-scott-continuous-Poset P Q l5 f → preserves-order-Poset P Q f - preserves-order-is-scott-continuous-map-Poset {f} H x y p = + preserves-order-is-scott-continuous-Poset {f} H x y p = pr2 - ( preserves-small-supremum-directed-family-is-scott-continuous-map-Poset + ( preserves-small-supremum-directed-family-is-scott-continuous-Poset ( P) ( Q) ( H) @@ -207,7 +207,7 @@ module _ scott-continuous-hom-Poset P Q l5 → hom-Poset P Q hom-scott-continuous-hom-Poset f = map-scott-continuous-hom-Poset P Q f , - preserves-order-is-scott-continuous-map-Poset + preserves-order-is-scott-continuous-Poset ( is-scott-continuous-map-scott-continuous-hom-Poset P Q f) ``` @@ -241,7 +241,7 @@ module _ is-torsorial-htpy-scott-continuous-hom-Poset f = is-torsorial-Eq-subtype ( is-torsorial-htpy (map-scott-continuous-hom-Poset P Q f)) - ( is-prop-is-scott-continuous-map-Poset P Q) + ( is-prop-is-scott-continuous-Poset P Q) ( map-scott-continuous-hom-Poset P Q f) ( refl-htpy) ( is-scott-continuous-map-scott-continuous-hom-Poset P Q f) @@ -277,7 +277,7 @@ module _ where is-scott-continuous-id-Poset : - {l3 : Level} → is-scott-continuous-map-Poset P P l3 (id {A = type-Poset P}) + {l3 : Level} → is-scott-continuous-Poset P P l3 (id {A = type-Poset P}) is-scott-continuous-id-Poset x y = pr2 y id-scott-continuous-hom-Poset : @@ -296,7 +296,7 @@ module _ is-scott-continuous-comp-Poset : (g : scott-continuous-hom-Poset Q R l7) (f : scott-continuous-hom-Poset P Q l7) → - is-scott-continuous-map-Poset P R l7 + is-scott-continuous-Poset P R l7 ( map-scott-continuous-hom-Poset Q R g ∘ map-scott-continuous-hom-Poset P Q f) is-scott-continuous-comp-Poset g f x y = From 0f3aa23223d117c68154923bec31f3365d420062 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 4 Nov 2024 17:03:45 +0100 Subject: [PATCH 65/83] finish Kleene's fixed point theorem for posets --- ...leenes-fixed-point-theorem-posets.lagda.md | 303 ++++++++++++++---- .../omega-continuous-maps-posets.lagda.md | 20 +- .../bottom-elements-posets.lagda.md | 6 +- 3 files changed, 262 insertions(+), 67 deletions(-) diff --git a/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md index a1eede9ec7..b70de1fffa 100644 --- a/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md +++ b/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md @@ -53,104 +53,280 @@ that it exists, is a [fixed point](foundation.fixed-points-endofunctions.md) of If `𝒜` has a [bottom element](order-theory.bottom-elements-posets.md) `⊥`, then this construction gives a least fixed point of `f`. -## Theorem +**Duality.** Of course, since the structure of posets is self-dual, there is a +dual Kleene's fixed point theorem that, for every ω-cocontinuous endomap `f` and +point `y ∈ 𝒜`, if `f(y) ≤ y`, then the ω-transfinite application of `f` to `y`, +given that it exists, gives a fixed point of `f`: + +```text + … = f(fω(y)) = fω(y) ≤ … ≤ fⁿ(y) ≤ … ≤ f²(y) ≤ f(y) ≤ y. +``` + +If `𝒜` has a [top element](order-theory.top-elements-posets.md), then this +construction gives a greatest fixed point of `f`. -### Kleene's fixed point construction on posets +## Construction + +### Kleene's fixed point construction for order preserving endomaps on posets ```agda module _ {l1 l2 : Level} (𝒜 : Poset l1 l2) {f : type-Poset 𝒜 → type-Poset 𝒜} - (F : is-ω-continuous-Poset 𝒜 𝒜 f) + (H : preserves-order-Poset 𝒜 𝒜 f) (x : type-Poset 𝒜) (p : leq-Poset 𝒜 x (f x)) where - family-of-elements-kleene-Poset : ℕ → type-Poset 𝒜 - family-of-elements-kleene-Poset n = iterate n f x + family-of-elements-construction-kleene-hom-Poset : ℕ → type-Poset 𝒜 + family-of-elements-construction-kleene-hom-Poset n = iterate n f x - leq-succ-family-of-elements-kleene-Poset : + leq-succ-family-of-elements-construction-kleene-hom-Poset : (n : ℕ) → leq-Poset 𝒜 - ( family-of-elements-kleene-Poset n) - ( family-of-elements-kleene-Poset (succ-ℕ n)) - leq-succ-family-of-elements-kleene-Poset zero-ℕ = p - leq-succ-family-of-elements-kleene-Poset (succ-ℕ n) = - preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F - ( family-of-elements-kleene-Poset n) - ( family-of-elements-kleene-Poset (succ-ℕ n)) - ( leq-succ-family-of-elements-kleene-Poset n) - - hom-kleene-Poset : hom-Poset ℕ-Poset 𝒜 - hom-kleene-Poset = + ( family-of-elements-construction-kleene-hom-Poset n) + ( family-of-elements-construction-kleene-hom-Poset (succ-ℕ n)) + leq-succ-family-of-elements-construction-kleene-hom-Poset zero-ℕ = p + leq-succ-family-of-elements-construction-kleene-hom-Poset (succ-ℕ n) = + H ( family-of-elements-construction-kleene-hom-Poset n) + ( family-of-elements-construction-kleene-hom-Poset (succ-ℕ n)) + ( leq-succ-family-of-elements-construction-kleene-hom-Poset n) + + hom-construction-kleene-hom-Poset : hom-Poset ℕ-Poset 𝒜 + hom-construction-kleene-hom-Poset = hom-ind-ℕ-Poset 𝒜 - ( family-of-elements-kleene-Poset) - ( leq-succ-family-of-elements-kleene-Poset) + ( family-of-elements-construction-kleene-hom-Poset) + ( leq-succ-family-of-elements-construction-kleene-hom-Poset) module _ {l1 l2 : Level} (𝒜 : Poset l1 l2) {f : type-Poset 𝒜 → type-Poset 𝒜} - (F : is-ω-continuous-Poset 𝒜 𝒜 f) + (H : preserves-order-Poset 𝒜 𝒜 f) (x : type-Poset 𝒜) (p : leq-Poset 𝒜 x (f x)) (s : has-least-upper-bound-family-of-elements-Poset 𝒜 - ( family-of-elements-kleene-Poset 𝒜 F x p)) + ( family-of-elements-construction-kleene-hom-Poset 𝒜 H x p)) where - point-kleene-Poset : type-Poset 𝒜 - point-kleene-Poset = pr1 s + point-construction-kleene-hom-Poset : type-Poset 𝒜 + point-construction-kleene-hom-Poset = pr1 s - is-upper-bound-map-point-kleene-Poset : + is-upper-bound-map-point-construction-kleene-hom-Poset : is-upper-bound-family-of-elements-Poset 𝒜 - ( family-of-elements-kleene-Poset 𝒜 F x p) - ( f point-kleene-Poset) - is-upper-bound-map-point-kleene-Poset zero-ℕ = + ( family-of-elements-construction-kleene-hom-Poset 𝒜 H x p) + ( f point-construction-kleene-hom-Poset) + is-upper-bound-map-point-construction-kleene-hom-Poset zero-ℕ = transitive-leq-Poset 𝒜 x (f x) - ( f point-kleene-Poset) - ( preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F x - ( point-kleene-Poset) + ( f point-construction-kleene-hom-Poset) + ( H x + ( point-construction-kleene-hom-Poset) ( is-upper-bound-is-least-upper-bound-family-of-elements-Poset 𝒜 ( pr2 s) ( 0))) ( p) - is-upper-bound-map-point-kleene-Poset (succ-ℕ n) = - preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F - ( family-of-elements-kleene-Poset 𝒜 F x p n) - ( point-kleene-Poset) + is-upper-bound-map-point-construction-kleene-hom-Poset (succ-ℕ n) = + H ( family-of-elements-construction-kleene-hom-Poset 𝒜 H x p n) + ( point-construction-kleene-hom-Poset) ( is-upper-bound-is-least-upper-bound-family-of-elements-Poset 𝒜 ( pr2 s) ( n)) - leq-point-kleene-Poset : - leq-Poset 𝒜 (point-kleene-Poset) (f point-kleene-Poset) - leq-point-kleene-Poset = - pr1 (pr2 s (f point-kleene-Poset)) (is-upper-bound-map-point-kleene-Poset) + leq-point-construction-kleene-hom-Poset : + leq-Poset 𝒜 + ( point-construction-kleene-hom-Poset) + ( f point-construction-kleene-hom-Poset) + leq-point-construction-kleene-hom-Poset = + pr1 + ( pr2 s (f point-construction-kleene-hom-Poset)) + ( is-upper-bound-map-point-construction-kleene-hom-Poset) - geq-point-kleene-Poset : - leq-Poset 𝒜 (f point-kleene-Poset) (point-kleene-Poset) - geq-point-kleene-Poset = + geq-point-construction-kleene-hom-Poset : + (F : + preserves-ω-supremum-Poset 𝒜 𝒜 f + ( hom-construction-kleene-hom-Poset 𝒜 H x p)) → + leq-Poset 𝒜 + ( f point-construction-kleene-hom-Poset) + ( point-construction-kleene-hom-Poset) + geq-point-construction-kleene-hom-Poset F = pr1 - ( F (hom-kleene-Poset 𝒜 F x p) s point-kleene-Poset) + ( F s point-construction-kleene-hom-Poset) ( is-upper-bound-is-least-upper-bound-family-of-elements-Poset 𝒜 (pr2 s) ∘ succ-ℕ) - is-fixed-point-kleene-Poset : f (point-kleene-Poset) = point-kleene-Poset - is-fixed-point-kleene-Poset = + is-fixed-point-construction-kleene-hom-Poset : + (F : + preserves-ω-supremum-Poset 𝒜 𝒜 f + ( hom-construction-kleene-hom-Poset 𝒜 H x p)) → + f (point-construction-kleene-hom-Poset) = + point-construction-kleene-hom-Poset + is-fixed-point-construction-kleene-hom-Poset F = antisymmetric-leq-Poset 𝒜 - ( f (point-kleene-Poset)) - ( point-kleene-Poset) - ( geq-point-kleene-Poset) - ( leq-point-kleene-Poset) - - fixed-point-kleene-Poset : fixed-point f - fixed-point-kleene-Poset = - point-kleene-Poset , is-fixed-point-kleene-Poset + ( f point-construction-kleene-hom-Poset) + ( point-construction-kleene-hom-Poset) + ( geq-point-construction-kleene-hom-Poset F) + ( leq-point-construction-kleene-hom-Poset) + + fixed-point-construction-kleene-hom-Poset : + (F : + preserves-ω-supremum-Poset 𝒜 𝒜 f + ( hom-construction-kleene-hom-Poset 𝒜 H x p)) → + fixed-point f + fixed-point-construction-kleene-hom-Poset F = + point-construction-kleene-hom-Poset , + is-fixed-point-construction-kleene-hom-Poset F +``` + +### Kleene's fixed point construction for ω-continuous endomaps on posets + +```agda +module _ + {l1 l2 : Level} + (𝒜 : Poset l1 l2) + {f : type-Poset 𝒜 → type-Poset 𝒜} + (F : is-ω-continuous-Poset 𝒜 𝒜 f) + (x : type-Poset 𝒜) + (p : leq-Poset 𝒜 x (f x)) + where + + family-of-elements-construction-kleene-Poset : ℕ → type-Poset 𝒜 + family-of-elements-construction-kleene-Poset = + family-of-elements-construction-kleene-hom-Poset 𝒜 + ( preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F) + ( x) + ( p) + + hom-construction-kleene-Poset : hom-Poset ℕ-Poset 𝒜 + hom-construction-kleene-Poset = + hom-construction-kleene-hom-Poset 𝒜 + ( preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F) + ( x) + ( p) + +module _ + {l1 l2 : Level} + (𝒜 : Poset l1 l2) + {f : type-Poset 𝒜 → type-Poset 𝒜} + (F : is-ω-continuous-Poset 𝒜 𝒜 f) + (x : type-Poset 𝒜) + (p : leq-Poset 𝒜 x (f x)) + (s : + has-least-upper-bound-family-of-elements-Poset 𝒜 + ( family-of-elements-construction-kleene-Poset 𝒜 F x p)) + where + + point-construction-kleene-Poset : type-Poset 𝒜 + point-construction-kleene-Poset = pr1 s + + is-upper-bound-map-point-construction-kleene-Poset : + is-upper-bound-family-of-elements-Poset 𝒜 + ( family-of-elements-construction-kleene-Poset 𝒜 F x p) + ( f point-construction-kleene-Poset) + is-upper-bound-map-point-construction-kleene-Poset = + is-upper-bound-map-point-construction-kleene-hom-Poset 𝒜 + ( preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F) + ( x) + ( p) + ( s) + + leq-point-construction-kleene-Poset : + leq-Poset 𝒜 + ( point-construction-kleene-Poset) + ( f point-construction-kleene-Poset) + leq-point-construction-kleene-Poset = + leq-point-construction-kleene-hom-Poset 𝒜 + ( preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F) + ( x) + ( p) + ( s) + + geq-point-construction-kleene-Poset : + leq-Poset 𝒜 + ( f point-construction-kleene-Poset) + ( point-construction-kleene-Poset) + geq-point-construction-kleene-Poset = + geq-point-construction-kleene-hom-Poset 𝒜 + ( preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F) + ( x) + ( p) + ( s) + ( F (hom-construction-kleene-Poset 𝒜 F x p)) + + is-fixed-point-construction-kleene-Poset : + f (point-construction-kleene-Poset) = point-construction-kleene-Poset + is-fixed-point-construction-kleene-Poset = + is-fixed-point-construction-kleene-hom-Poset 𝒜 + ( preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F) + ( x) + ( p) + ( s) + ( F (hom-construction-kleene-Poset 𝒜 F x p)) + + fixed-point-construction-kleene-Poset : fixed-point f + fixed-point-construction-kleene-Poset = + point-construction-kleene-Poset , is-fixed-point-construction-kleene-Poset ``` -### Kleene's least fixed point theorem for posets with a bottom element +## Theorem + +### Kleene's least fixed point theorem for order preserving endomaps on posets with a bottom element + +If `𝒜` has a bottom element, then Kleene's fixed point construction gives a +least fixed point of `f`. + +```agda +module _ + {l1 l2 : Level} + (𝒜 : Poset l1 l2) + {f : type-Poset 𝒜 → type-Poset 𝒜} + (H : preserves-order-Poset 𝒜 𝒜 f) + (b@(⊥ , b') : has-bottom-element-Poset 𝒜) + (s : + has-least-upper-bound-family-of-elements-Poset 𝒜 + ( family-of-elements-construction-kleene-hom-Poset 𝒜 H ⊥ (b' (f ⊥)))) + (F : + preserves-ω-supremum-Poset 𝒜 𝒜 f + ( hom-construction-kleene-hom-Poset 𝒜 H ⊥ (b' (f ⊥)))) + where + + point-theorem-kleene-hom-Poset : type-Poset 𝒜 + point-theorem-kleene-hom-Poset = + point-construction-kleene-hom-Poset 𝒜 H ⊥ (b' (f ⊥)) s + + fixed-point-theorem-kleene-hom-Poset : fixed-point f + fixed-point-theorem-kleene-hom-Poset = + fixed-point-construction-kleene-hom-Poset 𝒜 H ⊥ (b' (f ⊥)) s F + + is-upper-bound-family-of-elements-is-fixed-point-theorem-kleene-hom-Poset : + {z : type-Poset 𝒜} → f z = z → + is-upper-bound-family-of-elements-Poset 𝒜 + ( family-of-elements-construction-kleene-hom-Poset 𝒜 H ⊥ (b' (f ⊥))) + ( z) + is-upper-bound-family-of-elements-is-fixed-point-theorem-kleene-hom-Poset + { z} q zero-ℕ = + b' z + is-upper-bound-family-of-elements-is-fixed-point-theorem-kleene-hom-Poset + {z} q (succ-ℕ n) = + concatenate-leq-eq-Poset 𝒜 + ( H ( iterate n f ⊥) + ( z) + ( is-upper-bound-family-of-elements-is-fixed-point-theorem-kleene-hom-Poset + ( q) + ( n))) + ( q) + + is-least-fixed-point-theorem-kleene-hom-Poset : + (q : fixed-point f) → leq-Poset 𝒜 point-theorem-kleene-hom-Poset (pr1 q) + is-least-fixed-point-theorem-kleene-hom-Poset (z , q) = + pr1 + ( pr2 s z) + ( is-upper-bound-family-of-elements-is-fixed-point-theorem-kleene-hom-Poset + ( q)) +``` + +### Kleene's least fixed point theorem for order preserving endomaps on posets with a bottom element If `𝒜` has a bottom element, then Kleene's fixed point construction gives a least fixed point of `f`. @@ -161,11 +337,28 @@ module _ (𝒜 : Poset l1 l2) {f : type-Poset 𝒜 → type-Poset 𝒜} (F : is-ω-continuous-Poset 𝒜 𝒜 f) - (b : has-bottom-element-Poset 𝒜) + (b@(⊥ , b') : has-bottom-element-Poset 𝒜) (s : has-least-upper-bound-family-of-elements-Poset 𝒜 - ( family-of-elements-kleene-Poset 𝒜 F (pr1 b) (pr2 b (f (pr1 b))))) + ( family-of-elements-construction-kleene-Poset 𝒜 F ⊥ (b' (f ⊥)))) where + + point-theorem-kleene-Poset : type-Poset 𝒜 + point-theorem-kleene-Poset = + point-construction-kleene-Poset 𝒜 F ⊥ (b' (f ⊥)) s + + fixed-point-theorem-kleene-Poset : fixed-point f + fixed-point-theorem-kleene-Poset = + fixed-point-construction-kleene-Poset 𝒜 F ⊥ (b' (f ⊥)) s + + is-least-fixed-point-theorem-kleene-Poset : + (q : fixed-point f) → leq-Poset 𝒜 point-theorem-kleene-Poset (pr1 q) + is-least-fixed-point-theorem-kleene-Poset = + is-least-fixed-point-theorem-kleene-hom-Poset 𝒜 + ( preserves-order-is-ω-continuous-Poset 𝒜 𝒜 F) + ( b) + ( s) + ( F (hom-construction-kleene-Poset 𝒜 F ⊥ (b' (f ⊥)))) ``` ## External links diff --git a/src/domain-theory/omega-continuous-maps-posets.lagda.md b/src/domain-theory/omega-continuous-maps-posets.lagda.md index a0ac5342c0..7e485de485 100644 --- a/src/domain-theory/omega-continuous-maps-posets.lagda.md +++ b/src/domain-theory/omega-continuous-maps-posets.lagda.md @@ -76,8 +76,8 @@ module _ (x : hom-Poset ℕ-Poset P) where - preserves-ω-supremum-map-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) - preserves-ω-supremum-map-Poset = + preserves-ω-supremum-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-ω-supremum-Poset = (y : has-least-upper-bound-family-of-elements-Poset P ( map-hom-Poset ℕ-Poset P x)) → @@ -85,20 +85,20 @@ module _ ( f ∘ map-hom-Poset ℕ-Poset P x) ( f (pr1 y)) - is-prop-preserves-ω-supremum-map-Poset : - is-prop preserves-ω-supremum-map-Poset - is-prop-preserves-ω-supremum-map-Poset = + is-prop-preserves-ω-supremum-Poset : + is-prop preserves-ω-supremum-Poset + is-prop-preserves-ω-supremum-Poset = is-prop-Π ( λ y → is-prop-is-least-upper-bound-family-of-elements-Poset Q ( f ∘ map-hom-Poset ℕ-Poset P x) ( f (pr1 y))) - preserves-ω-supremum-prop-map-Poset : + preserves-ω-supremum-prop-Poset : Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) - preserves-ω-supremum-prop-map-Poset = - preserves-ω-supremum-map-Poset , - is-prop-preserves-ω-supremum-map-Poset + preserves-ω-supremum-prop-Poset = + preserves-ω-supremum-Poset , + is-prop-preserves-ω-supremum-Poset ``` ### The predicate on a map of posets of being ω-continuous @@ -124,7 +124,7 @@ module _ (f : type-Poset P → type-Poset Q) → is-prop (is-ω-continuous-Poset f) is-prop-is-ω-continuous-Poset f = - is-prop-Π (is-prop-preserves-ω-supremum-map-Poset P Q f) + is-prop-Π (is-prop-preserves-ω-supremum-Poset P Q f) is-ω-continuous-prop-Poset : (type-Poset P → type-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) diff --git a/src/order-theory/bottom-elements-posets.lagda.md b/src/order-theory/bottom-elements-posets.lagda.md index 3a49794ba8..19f835b65c 100644 --- a/src/order-theory/bottom-elements-posets.lagda.md +++ b/src/order-theory/bottom-elements-posets.lagda.md @@ -20,8 +20,10 @@ open import order-theory.posets ## Idea -A **bottom element** in a poset `P` is an element `b` such that `b ≤ x` holds -for every element `x : P`. +A +{{#concept "bottom element" Disambiguation="in a poset" Agda=is-bottom-element-Poset}} +in a [poset](order-theory.posets.md) `P` is an element `b` such that `b ≤ x` +holds for every element `x : P`. ## Definition From 16edf8d44c729991383b836dfb84cbbca2d6efe2 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 4 Nov 2024 17:31:06 +0100 Subject: [PATCH 66/83] =?UTF-8?q?Kleene's=20fixed=20point=20theorem=20for?= =?UTF-8?q?=20=CF=89-complete=20posets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/domain-theory.lagda.md | 2 + ...int-theorem-omega-complete-posets.lagda.md | 299 ++++++++++++++ ...leenes-fixed-point-theorem-posets.lagda.md | 10 +- ...inuous-maps-omega-complete-posets.lagda.md | 381 ++++++++++++++++++ .../omega-continuous-maps-posets.lagda.md | 2 +- 5 files changed, 688 insertions(+), 6 deletions(-) create mode 100644 src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md create mode 100644 src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md diff --git a/src/domain-theory.lagda.md b/src/domain-theory.lagda.md index 82612b0fa3..0b0c1426a5 100644 --- a/src/domain-theory.lagda.md +++ b/src/domain-theory.lagda.md @@ -5,8 +5,10 @@ module domain-theory where open import domain-theory.directed-complete-posets public open import domain-theory.directed-families-posets public +open import domain-theory.kleenes-fixed-point-theorem-omega-complete-posets public open import domain-theory.kleenes-fixed-point-theorem-posets public open import domain-theory.omega-complete-posets public +open import domain-theory.omega-continuous-maps-omega-complete-posets public open import domain-theory.omega-continuous-maps-posets public open import domain-theory.scott-continuous-maps-posets public ``` diff --git a/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md new file mode 100644 index 0000000000..1ba951b83a --- /dev/null +++ b/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md @@ -0,0 +1,299 @@ +# Kleene's fixed point theorem for ω-complete posets + +```agda +module domain-theory.kleenes-fixed-point-theorem-omega-complete-posets where +``` + +
Imports + +```agda +open import domain-theory.directed-families-posets +open import domain-theory.kleenes-fixed-point-theorem-posets +open import domain-theory.omega-complete-posets +open import domain-theory.omega-continuous-maps-omega-complete-posets +open import domain-theory.omega-continuous-maps-posets + +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.dependent-pair-types +open import foundation.fixed-points-endofunctions +open import foundation.function-types +open import foundation.identity-types +open import foundation.inhabited-types +open import foundation.iterating-functions +open import foundation.logical-equivalences +open import foundation.propositional-truncations +open import foundation.universe-levels + +open import order-theory.bottom-elements-posets +open import order-theory.chains-posets +open import order-theory.inflattices +open import order-theory.inhabited-chains-posets +open import order-theory.least-upper-bounds-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +open import order-theory.suplattices +open import order-theory.upper-bounds-posets +``` + +
+ +## Idea + +{{#concept "Kleene's fixed point theorem" Disambiguation="ω-complete posets" WD="Kleene fixed-point theorem" WDID=Q3527263}} +states that given an +[ω-continuous](domain-theory.omega-continuous-maps-omega-complete-posets.md) +endomap `f : 𝒜 → 𝒜` on an +[ω-complete poset](domain-theoryomega-complete-posets.md) `𝒜`, then for every +`x ∈ 𝒜` such that `x ≤ f x`, the ω-transfinite application of `f` to `x`, given +that it exists, is a [fixed point](foundation.fixed-points-endofunctions.md) of +`f`: + +```text + x ≤ f(x) ≤ f²(x) ≤ … ≤ fⁿ(x) ≤ … ≤ fω(x) = f(fω(x)) = …. +``` + +If `𝒜` has a [bottom element](order-theory.bottom-elements-posets.md) `⊥`, then +this construction gives a least fixed point of `f`. + +## Construction + +### Kleene's fixed point construction for order preserving endomaps on ω-complete posets + +```agda +module _ + {l1 l2 : Level} + (𝒜 : ω-Complete-Poset l1 l2) + {f : type-ω-Complete-Poset 𝒜 → type-ω-Complete-Poset 𝒜} + (H : + preserves-order-Poset + ( poset-ω-Complete-Poset 𝒜) + ( poset-ω-Complete-Poset 𝒜) + ( f)) + (x : type-ω-Complete-Poset 𝒜) + (p : leq-ω-Complete-Poset 𝒜 x (f x)) + where + + family-of-elements-construction-kleene-hom-ω-Complete-Poset : + ℕ → type-ω-Complete-Poset 𝒜 + family-of-elements-construction-kleene-hom-ω-Complete-Poset = + family-of-elements-construction-kleene-hom-Poset + ( poset-ω-Complete-Poset 𝒜) H x p + + leq-succ-family-of-elements-construction-kleene-hom-ω-Complete-Poset : + (n : ℕ) → + leq-ω-Complete-Poset 𝒜 + ( family-of-elements-construction-kleene-hom-ω-Complete-Poset n) + ( family-of-elements-construction-kleene-hom-ω-Complete-Poset (succ-ℕ n)) + leq-succ-family-of-elements-construction-kleene-hom-ω-Complete-Poset = + leq-succ-family-of-elements-construction-kleene-hom-Poset + ( poset-ω-Complete-Poset 𝒜) H x p + + hom-construction-kleene-hom-ω-Complete-Poset : + hom-Poset ℕ-Poset (poset-ω-Complete-Poset 𝒜) + hom-construction-kleene-hom-ω-Complete-Poset = + hom-construction-kleene-hom-Poset (poset-ω-Complete-Poset 𝒜) H x p + +module _ + {l1 l2 : Level} + (𝒜 : ω-Complete-Poset l1 l2) + {f : type-ω-Complete-Poset 𝒜 → type-ω-Complete-Poset 𝒜} + (H : + preserves-order-Poset + ( poset-ω-Complete-Poset 𝒜) + ( poset-ω-Complete-Poset 𝒜) + ( f)) + (x : type-ω-Complete-Poset 𝒜) + (p : leq-ω-Complete-Poset 𝒜 x (f x)) + where + + point-construction-kleene-hom-ω-Complete-Poset : type-ω-Complete-Poset 𝒜 + point-construction-kleene-hom-ω-Complete-Poset = + point-construction-kleene-hom-Poset + ( poset-ω-Complete-Poset 𝒜) + ( H) + ( x) + ( p) + ( is-ω-complete-ω-Complete-Poset 𝒜 + ( hom-construction-kleene-hom-ω-Complete-Poset 𝒜 H x p)) + + is-fixed-point-construction-kleene-hom-ω-Complete-Poset : + (F : + preserves-ω-supremum-ω-Complete-Poset 𝒜 𝒜 f + ( hom-construction-kleene-hom-ω-Complete-Poset 𝒜 H x p)) → + f (point-construction-kleene-hom-ω-Complete-Poset) = + point-construction-kleene-hom-ω-Complete-Poset + is-fixed-point-construction-kleene-hom-ω-Complete-Poset = + is-fixed-point-construction-kleene-hom-Poset + ( poset-ω-Complete-Poset 𝒜) + ( H) + ( x) + ( p) + ( is-ω-complete-ω-Complete-Poset 𝒜 + ( hom-construction-kleene-hom-ω-Complete-Poset 𝒜 H x p)) + + fixed-point-construction-kleene-hom-ω-Complete-Poset : + (F : + preserves-ω-supremum-ω-Complete-Poset 𝒜 𝒜 f + ( hom-construction-kleene-hom-ω-Complete-Poset 𝒜 H x p)) → + fixed-point f + fixed-point-construction-kleene-hom-ω-Complete-Poset F = + point-construction-kleene-hom-ω-Complete-Poset , + is-fixed-point-construction-kleene-hom-ω-Complete-Poset F +``` + +### Kleene's fixed point construction for ω-continuous endomaps on ω-complete posets + +```agda +module _ + {l1 l2 : Level} + (𝒜 : ω-Complete-Poset l1 l2) + {f : type-ω-Complete-Poset 𝒜 → type-ω-Complete-Poset 𝒜} + (F : is-ω-continuous-ω-Complete-Poset 𝒜 𝒜 f) + (x : type-ω-Complete-Poset 𝒜) + (p : leq-ω-Complete-Poset 𝒜 x (f x)) + where + + family-of-elements-construction-kleene-ω-Complete-Poset : + ℕ → type-ω-Complete-Poset 𝒜 + family-of-elements-construction-kleene-ω-Complete-Poset = + family-of-elements-construction-kleene-hom-ω-Complete-Poset 𝒜 + ( preserves-order-is-ω-continuous-ω-Complete-Poset 𝒜 𝒜 F) + ( x) + ( p) + + hom-construction-kleene-ω-Complete-Poset : + hom-Poset ℕ-Poset (poset-ω-Complete-Poset 𝒜) + hom-construction-kleene-ω-Complete-Poset = + hom-construction-kleene-hom-ω-Complete-Poset 𝒜 + ( preserves-order-is-ω-continuous-ω-Complete-Poset 𝒜 𝒜 F) + ( x) + ( p) + +module _ + {l1 l2 : Level} + (𝒜 : ω-Complete-Poset l1 l2) + {f : type-ω-Complete-Poset 𝒜 → type-ω-Complete-Poset 𝒜} + (F : is-ω-continuous-ω-Complete-Poset 𝒜 𝒜 f) + (x : type-ω-Complete-Poset 𝒜) + (p : leq-ω-Complete-Poset 𝒜 x (f x)) + where + + point-construction-kleene-ω-Complete-Poset : type-ω-Complete-Poset 𝒜 + point-construction-kleene-ω-Complete-Poset = + point-construction-kleene-hom-ω-Complete-Poset 𝒜 + ( preserves-order-is-ω-continuous-ω-Complete-Poset 𝒜 𝒜 F) + ( x) + ( p) + + is-fixed-point-construction-kleene-ω-Complete-Poset : + f (point-construction-kleene-ω-Complete-Poset) = point-construction-kleene-ω-Complete-Poset + is-fixed-point-construction-kleene-ω-Complete-Poset = + is-fixed-point-construction-kleene-hom-ω-Complete-Poset 𝒜 + ( preserves-order-is-ω-continuous-ω-Complete-Poset 𝒜 𝒜 F) + ( x) + ( p) + ( F (hom-construction-kleene-ω-Complete-Poset 𝒜 F x p)) + + fixed-point-construction-kleene-ω-Complete-Poset : fixed-point f + fixed-point-construction-kleene-ω-Complete-Poset = + point-construction-kleene-ω-Complete-Poset , + is-fixed-point-construction-kleene-ω-Complete-Poset +``` + +## Theorem + +### Kleene's least fixed point theorem for order preserving endomaps on ω-complete posets with a bottom element + +If `𝒜` has a bottom element, then Kleene's fixed point construction gives a +least fixed point of `f`. + +```agda +module _ + {l1 l2 : Level} + (𝒜 : ω-Complete-Poset l1 l2) + {f : type-ω-Complete-Poset 𝒜 → type-ω-Complete-Poset 𝒜} + (H : preserves-order-Poset (poset-ω-Complete-Poset 𝒜) (poset-ω-Complete-Poset 𝒜) f) + (b@(⊥ , b') : has-bottom-element-Poset (poset-ω-Complete-Poset 𝒜)) + (F : + preserves-ω-supremum-ω-Complete-Poset 𝒜 𝒜 f + ( hom-construction-kleene-hom-ω-Complete-Poset 𝒜 H ⊥ (b' (f ⊥)))) + where + + point-theorem-kleene-hom-ω-Complete-Poset : type-ω-Complete-Poset 𝒜 + point-theorem-kleene-hom-ω-Complete-Poset = + point-construction-kleene-hom-ω-Complete-Poset 𝒜 H ⊥ (b' (f ⊥)) + + fixed-point-theorem-kleene-hom-ω-Complete-Poset : fixed-point f + fixed-point-theorem-kleene-hom-ω-Complete-Poset = + fixed-point-construction-kleene-hom-ω-Complete-Poset 𝒜 H ⊥ (b' (f ⊥)) F + + is-upper-bound-family-of-elements-is-fixed-point-theorem-kleene-hom-ω-Complete-Poset : + {z : type-ω-Complete-Poset 𝒜} → f z = z → + is-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset 𝒜) + ( family-of-elements-construction-kleene-hom-ω-Complete-Poset 𝒜 H + ( ⊥) + ( b' (f ⊥))) + ( z) + is-upper-bound-family-of-elements-is-fixed-point-theorem-kleene-hom-ω-Complete-Poset = + is-upper-bound-family-of-elements-is-fixed-point-theorem-kleene-hom-Poset + ( poset-ω-Complete-Poset 𝒜) + ( H) + ( b) + ( is-ω-complete-ω-Complete-Poset 𝒜 + ( hom-construction-kleene-hom-ω-Complete-Poset 𝒜 H ⊥ (b' (f ⊥)))) + ( F) + + is-least-fixed-point-theorem-kleene-hom-ω-Complete-Poset : + (q : fixed-point f) → + leq-ω-Complete-Poset 𝒜 point-theorem-kleene-hom-ω-Complete-Poset (pr1 q) + is-least-fixed-point-theorem-kleene-hom-ω-Complete-Poset = + is-least-fixed-point-theorem-kleene-hom-Poset + ( poset-ω-Complete-Poset 𝒜) + ( H) + ( b) + ( is-ω-complete-ω-Complete-Poset 𝒜 + ( hom-construction-kleene-hom-ω-Complete-Poset 𝒜 H ⊥ (b' (f ⊥)))) + ( F) +``` + +### Kleene's least fixed point theorem for order preserving endomaps on posets with a bottom element + +If `𝒜` has a bottom element, then Kleene's fixed point construction gives a +least fixed point of `f`. + +```agda +module _ + {l1 l2 : Level} + (𝒜 : ω-Complete-Poset l1 l2) + {f : type-ω-Complete-Poset 𝒜 → type-ω-Complete-Poset 𝒜} + (F : is-ω-continuous-ω-Complete-Poset 𝒜 𝒜 f) + (b@(⊥ , b') : has-bottom-element-Poset (poset-ω-Complete-Poset 𝒜)) + where + + point-theorem-kleene-ω-Complete-Poset : type-ω-Complete-Poset 𝒜 + point-theorem-kleene-ω-Complete-Poset = + point-construction-kleene-ω-Complete-Poset 𝒜 F ⊥ (b' (f ⊥)) + + fixed-point-theorem-kleene-ω-Complete-Poset : fixed-point f + fixed-point-theorem-kleene-ω-Complete-Poset = + fixed-point-construction-kleene-ω-Complete-Poset 𝒜 F ⊥ (b' (f ⊥)) + + is-least-fixed-point-theorem-kleene-ω-Complete-Poset : + (q : fixed-point f) → + leq-ω-Complete-Poset 𝒜 point-theorem-kleene-ω-Complete-Poset (pr1 q) + is-least-fixed-point-theorem-kleene-ω-Complete-Poset = + is-least-fixed-point-theorem-kleene-hom-ω-Complete-Poset 𝒜 + ( preserves-order-is-ω-continuous-ω-Complete-Poset 𝒜 𝒜 F) + ( b) + ( F (hom-construction-kleene-ω-Complete-Poset 𝒜 F ⊥ (b' (f ⊥)))) +``` + +## External links + +- [Kleene fixed-point theorem](https://en.wikipedia.org/wiki/Kleene_fixed-point_theorem) + at Wikipedia +- [Kleene's fixed point theorem](https://ncatlab.org/nlab/show/Kleene%27s+fixed+point+theorem) + at $n$Lab diff --git a/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md index b70de1fffa..be2617e679 100644 --- a/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md +++ b/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md @@ -40,11 +40,11 @@ open import order-theory.upper-bounds-posets ## Idea {{#concept "Kleene's fixed point theorem" Disambiguation="posets" WD="Kleene fixed-point theorem" WDID=Q3527263}} -states that given an [ω-continuous](domain-theory.ω-continuous-maps-posets.md) -endomap `f : 𝒜 → 𝒜` on a [poset](domain-theory.posets.md) `𝒜`, then for every -`x ∈ 𝒜` such that `x ≤ f x`, the ω-transfinite application of `f` to `x`, given -that it exists, is a [fixed point](foundation.fixed-points-endofunctions.md) of -`f`: +states that given an +[ω-continuous](domain-theory.omega-continuous-maps-posets.md) endomap +`f : 𝒜 → 𝒜` on a [poset](domain-theory.posets.md) `𝒜`, then for every `x ∈ 𝒜` +such that `x ≤ f x`, the ω-transfinite application of `f` to `x`, given that it +exists, is a [fixed point](foundation.fixed-points-endofunctions.md) of `f`: ```text x ≤ f(x) ≤ f²(x) ≤ … ≤ fⁿ(x) ≤ … ≤ fω(x) = f(fω(x)) = …. diff --git a/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md b/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md new file mode 100644 index 0000000000..df41fd08ac --- /dev/null +++ b/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md @@ -0,0 +1,381 @@ +# ω-continuous maps between ω-complete posets + +```agda +module domain-theory.omega-continuous-maps-omega-complete-posets where +``` + +
Imports + +```agda +open import domain-theory.directed-families-posets +open import domain-theory.omega-complete-posets +open import domain-theory.omega-continuous-maps-posets + +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.booleans +open import foundation.dependent-pair-types +open import foundation.equivalences +open import foundation.evaluation-functions +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.fundamental-theorem-of-identity-types +open import foundation.homotopies +open import foundation.homotopy-induction +open import foundation.identity-types +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.raising-universe-levels +open import foundation.strictly-involutive-identity-types +open import foundation.subtype-identity-principle +open import foundation.surjective-maps +open import foundation.torsorial-type-families +open import foundation.universe-levels + +open import order-theory.join-preserving-maps-posets +open import order-theory.least-upper-bounds-posets +open import order-theory.order-preserving-maps-posets +open import order-theory.posets +``` + +
+ +## Idea + +A map `f : P → Q` between the underlying types of two +[ω-complete posets](order-theory.omega-complete-posets.md) is said to be +{{#concept "ω-continuous" Disambiguation="map of ω-complete posets" Agda=ω-continuous-map-ω-Complete-Poset}} +if it maps the supremum of every ascending +[chain](order-theory.chains-posets.md) + +```text + x₀ ≤ x₁ ≤ x₂ ≤ ­… ≤ xₙ ≤ xₙ₊₁ ≤ … ≤ xω +``` + +to the supremum of the image of the ascending chain + +```text + f x₀ ≤ f x₁ ≤ f x₂ ≤ ­… ≤ f xₙ ≤ f xₙ₊₁ ≤ … ≤ f xω. +``` + +In other words, `f(⋃ᵢxᵢ) = ⋃ᵢf(xᵢ)` for all ascending chains `x₍₋₎ : ℕ → P`. + +The ω-continuity condition is a proper generalization of +[Scott-continuity](domain-theory.scott-continuous-functions-posets.md) for which +[Kleene's fixed point theorem](domain-theory.kleenes-fixed-point-theorem-omega-complete-posets.md) +still applies. + +## Definitions + +### The predicate of preserving the supremum of an ω-chain + +```agda +module _ + {l1 l2 l3 l4 : Level} + (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + (f : type-ω-Complete-Poset P → type-ω-Complete-Poset Q) + (x : hom-Poset ℕ-Poset (poset-ω-Complete-Poset P)) + where + + preserves-ω-supremum-ω-Complete-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-ω-supremum-ω-Complete-Poset = + (y : + has-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset P) + ( map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x)) → + is-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset Q) + ( f ∘ map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x) + ( f (pr1 y)) + + is-prop-preserves-ω-supremum-ω-Complete-Poset : + is-prop preserves-ω-supremum-ω-Complete-Poset + is-prop-preserves-ω-supremum-ω-Complete-Poset = + is-prop-Π + ( λ y → + is-prop-is-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset Q) + ( f ∘ map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x) + ( f (pr1 y))) + + preserves-ω-supremum-prop-ω-Complete-Poset : + Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) + preserves-ω-supremum-prop-ω-Complete-Poset = + preserves-ω-supremum-ω-Complete-Poset , + is-prop-preserves-ω-supremum-ω-Complete-Poset +``` + +### The predicate on a map of ω-complete posets of being ω-continuous + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + where + + is-ω-continuous-ω-Complete-Poset : + (type-ω-Complete-Poset P → type-ω-Complete-Poset Q) → + UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + is-ω-continuous-ω-Complete-Poset f = + (x : hom-Poset ℕ-Poset (poset-ω-Complete-Poset P)) + (y : + has-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset P) + ( map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x)) → + is-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset Q) + ( f ∘ map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x) + ( f (pr1 y)) + + is-prop-is-ω-continuous-ω-Complete-Poset : + (f : type-ω-Complete-Poset P → type-ω-Complete-Poset Q) → + is-prop (is-ω-continuous-ω-Complete-Poset f) + is-prop-is-ω-continuous-ω-Complete-Poset f = + is-prop-Π (is-prop-preserves-ω-supremum-ω-Complete-Poset P Q f) + + is-ω-continuous-prop-ω-Complete-Poset : + (type-ω-Complete-Poset P → type-ω-Complete-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) + is-ω-continuous-prop-ω-Complete-Poset f = + ( is-ω-continuous-ω-Complete-Poset f) , + ( is-prop-is-ω-continuous-ω-Complete-Poset f) + + ω-continuous-hom-ω-Complete-Poset : UU (l1 ⊔ l2 ⊔ l3 ⊔ l4) + ω-continuous-hom-ω-Complete-Poset = + ω-continuous-hom-Poset (poset-ω-Complete-Poset P) (poset-ω-Complete-Poset Q) + + map-ω-continuous-hom-ω-Complete-Poset : + ω-continuous-hom-ω-Complete-Poset → type-ω-Complete-Poset P → type-ω-Complete-Poset Q + map-ω-continuous-hom-ω-Complete-Poset = pr1 + + is-ω-continuous-ω-continuous-hom-ω-Complete-Poset : + (f : ω-continuous-hom-ω-Complete-Poset) → + is-ω-continuous-ω-Complete-Poset (map-ω-continuous-hom-ω-Complete-Poset f) + is-ω-continuous-ω-continuous-hom-ω-Complete-Poset = pr2 + + sup-map-ω-continuous-hom-ω-Complete-Poset : + (f : ω-continuous-hom-ω-Complete-Poset) → + (x : hom-Poset ℕ-Poset (poset-ω-Complete-Poset P)) → + has-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset P) + ( map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x) → + has-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset Q) + ( map-ω-continuous-hom-ω-Complete-Poset f ∘ map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x) + sup-map-ω-continuous-hom-ω-Complete-Poset f x y = + ( map-ω-continuous-hom-ω-Complete-Poset f (pr1 y) , + is-ω-continuous-ω-continuous-hom-ω-Complete-Poset f x y) +``` + +## Properties + +### ω-Continuous maps preserve order + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + where + + abstract + preserves-order-is-ω-continuous-ω-Complete-Poset : + {f : type-ω-Complete-Poset P → type-ω-Complete-Poset Q} → + is-ω-continuous-ω-Complete-Poset P Q f → + preserves-order-Poset + ( poset-ω-Complete-Poset P) + ( poset-ω-Complete-Poset Q) f + preserves-order-is-ω-continuous-ω-Complete-Poset {f} H x y p = + pr2 + ( H ( hom-ind-ℕ-Poset (poset-ω-Complete-Poset P) + ( rec-ℕ x (λ _ _ → y)) + ( ind-ℕ p (λ _ _ → refl-leq-ω-Complete-Poset P y))) + ( y , + ( λ z → + ( λ g → g 1) , + ( λ q → ind-ℕ (transitive-leq-ω-Complete-Poset P x y z q p) (λ _ _ → q)))) + ( f y)) + ( refl-leq-ω-Complete-Poset Q (f y)) + ( 0) + + hom-ω-continuous-hom-ω-Complete-Poset : + ω-continuous-hom-ω-Complete-Poset P Q → hom-Poset (poset-ω-Complete-Poset P) (poset-ω-Complete-Poset Q) + hom-ω-continuous-hom-ω-Complete-Poset f = + map-ω-continuous-hom-ω-Complete-Poset P Q f , + preserves-order-is-ω-continuous-ω-Complete-Poset + ( is-ω-continuous-ω-continuous-hom-ω-Complete-Poset P Q f) +``` + +### Homotopies of ω-continuous maps + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + where + + htpy-ω-continuous-hom-ω-Complete-Poset : + (f g : ω-continuous-hom-ω-Complete-Poset P Q) → UU (l1 ⊔ l3) + htpy-ω-continuous-hom-ω-Complete-Poset f g = + map-ω-continuous-hom-ω-Complete-Poset P Q f ~ map-ω-continuous-hom-ω-Complete-Poset P Q g + + refl-htpy-ω-continuous-hom-ω-Complete-Poset : + (f : ω-continuous-hom-ω-Complete-Poset P Q) → + htpy-ω-continuous-hom-ω-Complete-Poset f f + refl-htpy-ω-continuous-hom-ω-Complete-Poset f = refl-htpy + + htpy-eq-ω-continuous-hom-ω-Complete-Poset : + (f g : ω-continuous-hom-ω-Complete-Poset P Q) → + f = g → + htpy-ω-continuous-hom-ω-Complete-Poset f g + htpy-eq-ω-continuous-hom-ω-Complete-Poset f .f refl = + refl-htpy-ω-continuous-hom-ω-Complete-Poset f + + is-torsorial-htpy-ω-continuous-hom-ω-Complete-Poset : + (f : ω-continuous-hom-ω-Complete-Poset P Q) → + is-torsorial (htpy-ω-continuous-hom-ω-Complete-Poset f) + is-torsorial-htpy-ω-continuous-hom-ω-Complete-Poset f = + is-torsorial-Eq-subtype + ( is-torsorial-htpy (map-ω-continuous-hom-ω-Complete-Poset P Q f)) + ( is-prop-is-ω-continuous-ω-Complete-Poset P Q) + ( map-ω-continuous-hom-ω-Complete-Poset P Q f) + ( refl-htpy) + ( is-ω-continuous-ω-continuous-hom-ω-Complete-Poset P Q f) + + is-equiv-htpy-eq-ω-continuous-hom-ω-Complete-Poset : + (f g : ω-continuous-hom-ω-Complete-Poset P Q) → + is-equiv (htpy-eq-ω-continuous-hom-ω-Complete-Poset f g) + is-equiv-htpy-eq-ω-continuous-hom-ω-Complete-Poset f = + fundamental-theorem-id + ( is-torsorial-htpy-ω-continuous-hom-ω-Complete-Poset f) + ( htpy-eq-ω-continuous-hom-ω-Complete-Poset f) + + extensionality-ω-continuous-hom-ω-Complete-Poset : + (f g : ω-continuous-hom-ω-Complete-Poset P Q) → + (f = g) ≃ htpy-ω-continuous-hom-ω-Complete-Poset f g + pr1 (extensionality-ω-continuous-hom-ω-Complete-Poset f g) = + htpy-eq-ω-continuous-hom-ω-Complete-Poset f g + pr2 (extensionality-ω-continuous-hom-ω-Complete-Poset f g) = + is-equiv-htpy-eq-ω-continuous-hom-ω-Complete-Poset f g + + eq-htpy-ω-continuous-hom-ω-Complete-Poset : + (f g : ω-continuous-hom-ω-Complete-Poset P Q) → + htpy-ω-continuous-hom-ω-Complete-Poset f g → f = g + eq-htpy-ω-continuous-hom-ω-Complete-Poset f g = + map-inv-is-equiv (is-equiv-htpy-eq-ω-continuous-hom-ω-Complete-Poset f g) +``` + +### The identity ω-continuous map + +```agda +module _ + {l1 l2 : Level} (P : ω-Complete-Poset l1 l2) + where + + is-ω-continuous-id-ω-Complete-Poset : + is-ω-continuous-ω-Complete-Poset P P (id {A = type-ω-Complete-Poset P}) + is-ω-continuous-id-ω-Complete-Poset x y = pr2 y + + id-ω-continuous-hom-ω-Complete-Poset : ω-continuous-hom-ω-Complete-Poset P P + id-ω-continuous-hom-ω-Complete-Poset = + id , is-ω-continuous-id-ω-Complete-Poset +``` + +### Composing ω-continuous maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 : Level} + (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) (R : ω-Complete-Poset l5 l6) + where + + is-ω-continuous-comp-ω-Complete-Poset : + (g : ω-continuous-hom-ω-Complete-Poset Q R) + (f : ω-continuous-hom-ω-Complete-Poset P Q) → + is-ω-continuous-ω-Complete-Poset P R + ( map-ω-continuous-hom-ω-Complete-Poset Q R g ∘ + map-ω-continuous-hom-ω-Complete-Poset P Q f) + is-ω-continuous-comp-ω-Complete-Poset g f c y = + is-ω-continuous-ω-continuous-hom-ω-Complete-Poset Q R g + ( comp-hom-Poset ℕ-Poset + ( poset-ω-Complete-Poset P) + ( poset-ω-Complete-Poset Q) + ( hom-ω-continuous-hom-ω-Complete-Poset P Q f) c) + ( map-ω-continuous-hom-ω-Complete-Poset P Q f (pr1 y) , + is-ω-continuous-ω-continuous-hom-ω-Complete-Poset P Q f c y) + + comp-ω-continuous-hom-ω-Complete-Poset : + (g : ω-continuous-hom-ω-Complete-Poset Q R) + (f : ω-continuous-hom-ω-Complete-Poset P Q) → + ω-continuous-hom-ω-Complete-Poset P R + comp-ω-continuous-hom-ω-Complete-Poset g f = + map-ω-continuous-hom-ω-Complete-Poset Q R g ∘ + map-ω-continuous-hom-ω-Complete-Poset P Q f , + is-ω-continuous-comp-ω-Complete-Poset g f +``` + +### Unit laws for composition of ω-continuous maps + +```agda +module _ + {l1 l2 l3 l4 : Level} (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + where + + left-unit-law-comp-ω-continuous-hom-ω-Complete-Poset : + (f : ω-continuous-hom-ω-Complete-Poset P Q) → + ( comp-ω-continuous-hom-ω-Complete-Poset P Q Q + ( id-ω-continuous-hom-ω-Complete-Poset Q) + ( f)) = + ( f) + left-unit-law-comp-ω-continuous-hom-ω-Complete-Poset f = + eq-htpy-ω-continuous-hom-ω-Complete-Poset P Q + ( comp-ω-continuous-hom-ω-Complete-Poset P Q Q + ( id-ω-continuous-hom-ω-Complete-Poset Q) + ( f)) + ( f) + ( refl-htpy) + + right-unit-law-comp-ω-continuous-hom-ω-Complete-Poset : + (f : ω-continuous-hom-ω-Complete-Poset P Q) → + ( comp-ω-continuous-hom-ω-Complete-Poset P P Q + ( f) + ( id-ω-continuous-hom-ω-Complete-Poset P)) = + ( f) + right-unit-law-comp-ω-continuous-hom-ω-Complete-Poset f = + eq-htpy-ω-continuous-hom-ω-Complete-Poset P Q + ( comp-ω-continuous-hom-ω-Complete-Poset P P Q + ( f) + ( id-ω-continuous-hom-ω-Complete-Poset P)) + ( f) + ( refl-htpy) +``` + +### Associativity of composition of ω-continuous maps + +```agda +module _ + {l1 l2 l3 l4 l5 l6 l7 l8 : Level} + (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + (R : ω-Complete-Poset l5 l6) (S : ω-Complete-Poset l7 l8) + (h : ω-continuous-hom-ω-Complete-Poset R S) + (g : ω-continuous-hom-ω-Complete-Poset Q R) + (f : ω-continuous-hom-ω-Complete-Poset P Q) + where + + associative-comp-ω-continuous-hom-ω-Complete-Poset : + comp-ω-continuous-hom-ω-Complete-Poset P Q S + ( comp-ω-continuous-hom-ω-Complete-Poset Q R S h g) + ( f) = + comp-ω-continuous-hom-ω-Complete-Poset P R S + ( h) + ( comp-ω-continuous-hom-ω-Complete-Poset P Q R g f) + associative-comp-ω-continuous-hom-ω-Complete-Poset = + eq-htpy-ω-continuous-hom-ω-Complete-Poset P S + ( comp-ω-continuous-hom-ω-Complete-Poset P Q S + ( comp-ω-continuous-hom-ω-Complete-Poset Q R S h g) + ( f)) + ( comp-ω-continuous-hom-ω-Complete-Poset P R S + ( h) + ( comp-ω-continuous-hom-ω-Complete-Poset P Q R g f)) + ( refl-htpy) + + involutive-eq-associative-comp-ω-continuous-hom-ω-Complete-Poset : + comp-ω-continuous-hom-ω-Complete-Poset P Q S + ( comp-ω-continuous-hom-ω-Complete-Poset Q R S h g) + ( f) =ⁱ + comp-ω-continuous-hom-ω-Complete-Poset P R S + ( h) + ( comp-ω-continuous-hom-ω-Complete-Poset P Q R g f) + involutive-eq-associative-comp-ω-continuous-hom-ω-Complete-Poset = + involutive-eq-eq associative-comp-ω-continuous-hom-ω-Complete-Poset +``` diff --git a/src/domain-theory/omega-continuous-maps-posets.lagda.md b/src/domain-theory/omega-continuous-maps-posets.lagda.md index 7e485de485..a06a821648 100644 --- a/src/domain-theory/omega-continuous-maps-posets.lagda.md +++ b/src/domain-theory/omega-continuous-maps-posets.lagda.md @@ -67,7 +67,7 @@ still applies. ## Definitions -### The predicate of preserving the supremum of a directed family +### The predicate of preserving the supremum of an ω-chain ```agda module _ From 461d6c22c7289ee4212a97c480a4f229865261e5 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 4 Nov 2024 17:33:27 +0100 Subject: [PATCH 67/83] pre-commit --- ...int-theorem-omega-complete-posets.lagda.md | 11 +++-- ...inuous-maps-omega-complete-posets.lagda.md | 40 +++++++++++++------ 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md index 1ba951b83a..375ec68525 100644 --- a/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md +++ b/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md @@ -94,7 +94,7 @@ module _ hom-construction-kleene-hom-ω-Complete-Poset : hom-Poset ℕ-Poset (poset-ω-Complete-Poset 𝒜) hom-construction-kleene-hom-ω-Complete-Poset = - hom-construction-kleene-hom-Poset (poset-ω-Complete-Poset 𝒜) H x p + hom-construction-kleene-hom-Poset (poset-ω-Complete-Poset 𝒜) H x p module _ {l1 l2 : Level} @@ -189,7 +189,8 @@ module _ ( p) is-fixed-point-construction-kleene-ω-Complete-Poset : - f (point-construction-kleene-ω-Complete-Poset) = point-construction-kleene-ω-Complete-Poset + f ( point-construction-kleene-ω-Complete-Poset) = + point-construction-kleene-ω-Complete-Poset is-fixed-point-construction-kleene-ω-Complete-Poset = is-fixed-point-construction-kleene-hom-ω-Complete-Poset 𝒜 ( preserves-order-is-ω-continuous-ω-Complete-Poset 𝒜 𝒜 F) @@ -215,7 +216,11 @@ module _ {l1 l2 : Level} (𝒜 : ω-Complete-Poset l1 l2) {f : type-ω-Complete-Poset 𝒜 → type-ω-Complete-Poset 𝒜} - (H : preserves-order-Poset (poset-ω-Complete-Poset 𝒜) (poset-ω-Complete-Poset 𝒜) f) + (H : + preserves-order-Poset + ( poset-ω-Complete-Poset 𝒜) + ( poset-ω-Complete-Poset 𝒜) + ( f)) (b@(⊥ , b') : has-bottom-element-Poset (poset-ω-Complete-Poset 𝒜)) (F : preserves-ω-supremum-ω-Complete-Poset 𝒜 𝒜 f diff --git a/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md b/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md index df41fd08ac..ad2a86caa8 100644 --- a/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md +++ b/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md @@ -93,7 +93,8 @@ module _ is-prop-preserves-ω-supremum-ω-Complete-Poset = is-prop-Π ( λ y → - is-prop-is-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset Q) + is-prop-is-least-upper-bound-family-of-elements-Poset + ( poset-ω-Complete-Poset Q) ( f ∘ map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x) ( f (pr1 y))) @@ -108,7 +109,8 @@ module _ ```agda module _ - {l1 l2 l3 l4 : Level} (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + {l1 l2 l3 l4 : Level} + (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) where is-ω-continuous-ω-Complete-Poset : @@ -130,7 +132,8 @@ module _ is-prop-Π (is-prop-preserves-ω-supremum-ω-Complete-Poset P Q f) is-ω-continuous-prop-ω-Complete-Poset : - (type-ω-Complete-Poset P → type-ω-Complete-Poset Q) → Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) + (type-ω-Complete-Poset P → type-ω-Complete-Poset Q) → + Prop (l1 ⊔ l2 ⊔ l3 ⊔ l4) is-ω-continuous-prop-ω-Complete-Poset f = ( is-ω-continuous-ω-Complete-Poset f) , ( is-prop-is-ω-continuous-ω-Complete-Poset f) @@ -140,7 +143,9 @@ module _ ω-continuous-hom-Poset (poset-ω-Complete-Poset P) (poset-ω-Complete-Poset Q) map-ω-continuous-hom-ω-Complete-Poset : - ω-continuous-hom-ω-Complete-Poset → type-ω-Complete-Poset P → type-ω-Complete-Poset Q + ω-continuous-hom-ω-Complete-Poset → + type-ω-Complete-Poset P → + type-ω-Complete-Poset Q map-ω-continuous-hom-ω-Complete-Poset = pr1 is-ω-continuous-ω-continuous-hom-ω-Complete-Poset : @@ -154,7 +159,8 @@ module _ has-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset P) ( map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x) → has-least-upper-bound-family-of-elements-Poset (poset-ω-Complete-Poset Q) - ( map-ω-continuous-hom-ω-Complete-Poset f ∘ map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x) + ( map-ω-continuous-hom-ω-Complete-Poset f ∘ + map-hom-Poset ℕ-Poset (poset-ω-Complete-Poset P) x) sup-map-ω-continuous-hom-ω-Complete-Poset f x y = ( map-ω-continuous-hom-ω-Complete-Poset f (pr1 y) , is-ω-continuous-ω-continuous-hom-ω-Complete-Poset f x y) @@ -166,7 +172,8 @@ module _ ```agda module _ - {l1 l2 l3 l4 : Level} (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + {l1 l2 l3 l4 : Level} + (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) where abstract @@ -184,13 +191,17 @@ module _ ( y , ( λ z → ( λ g → g 1) , - ( λ q → ind-ℕ (transitive-leq-ω-Complete-Poset P x y z q p) (λ _ _ → q)))) + ( λ q → + ind-ℕ + ( transitive-leq-ω-Complete-Poset P x y z q p) + ( λ _ _ → q)))) ( f y)) ( refl-leq-ω-Complete-Poset Q (f y)) ( 0) hom-ω-continuous-hom-ω-Complete-Poset : - ω-continuous-hom-ω-Complete-Poset P Q → hom-Poset (poset-ω-Complete-Poset P) (poset-ω-Complete-Poset Q) + ω-continuous-hom-ω-Complete-Poset P Q → + hom-Poset (poset-ω-Complete-Poset P) (poset-ω-Complete-Poset Q) hom-ω-continuous-hom-ω-Complete-Poset f = map-ω-continuous-hom-ω-Complete-Poset P Q f , preserves-order-is-ω-continuous-ω-Complete-Poset @@ -201,13 +212,15 @@ module _ ```agda module _ - {l1 l2 l3 l4 : Level} (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + {l1 l2 l3 l4 : Level} + (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) where htpy-ω-continuous-hom-ω-Complete-Poset : (f g : ω-continuous-hom-ω-Complete-Poset P Q) → UU (l1 ⊔ l3) htpy-ω-continuous-hom-ω-Complete-Poset f g = - map-ω-continuous-hom-ω-Complete-Poset P Q f ~ map-ω-continuous-hom-ω-Complete-Poset P Q g + map-ω-continuous-hom-ω-Complete-Poset P Q f ~ + map-ω-continuous-hom-ω-Complete-Poset P Q g refl-htpy-ω-continuous-hom-ω-Complete-Poset : (f : ω-continuous-hom-ω-Complete-Poset P Q) → @@ -276,7 +289,9 @@ module _ ```agda module _ {l1 l2 l3 l4 l5 l6 : Level} - (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) (R : ω-Complete-Poset l5 l6) + (P : ω-Complete-Poset l1 l2) + (Q : ω-Complete-Poset l3 l4) + (R : ω-Complete-Poset l5 l6) where is-ω-continuous-comp-ω-Complete-Poset : @@ -308,7 +323,8 @@ module _ ```agda module _ - {l1 l2 l3 l4 : Level} (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) + {l1 l2 l3 l4 : Level} + (P : ω-Complete-Poset l1 l2) (Q : ω-Complete-Poset l3 l4) where left-unit-law-comp-ω-continuous-hom-ω-Complete-Poset : From 91c0cc54ac64d28645312edf62601a41db939d85 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 4 Nov 2024 19:10:46 +0100 Subject: [PATCH 68/83] Markov's principle --- ...inuous-maps-omega-complete-posets.lagda.md | 2 +- .../omega-continuous-maps-posets.lagda.md | 2 +- src/foundation/booleans.lagda.md | 26 ++++ ...cantor-schroder-bernstein-escardo.lagda.md | 7 +- ...ructive-cantor-schroder-bernstein.lagda.md | 33 +++-- ...-limited-principle-of-omniscience.lagda.md | 12 +- .../limited-principle-of-omniscience.lagda.md | 6 + .../principle-of-omniscience.lagda.md | 4 +- ...-limited-principle-of-omniscience.lagda.md | 12 +- src/logic.lagda.md | 1 + src/logic/markovs-principle.lagda.md | 119 ++++++++++++++++++ .../kuratowski-finite-sets.lagda.md | 5 + 12 files changed, 206 insertions(+), 23 deletions(-) create mode 100644 src/logic/markovs-principle.lagda.md diff --git a/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md b/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md index ad2a86caa8..d452677473 100644 --- a/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md +++ b/src/domain-theory/omega-continuous-maps-omega-complete-posets.lagda.md @@ -1,4 +1,4 @@ -# ω-continuous maps between ω-complete posets +# ω-Continuous maps between ω-complete posets ```agda module domain-theory.omega-continuous-maps-omega-complete-posets where diff --git a/src/domain-theory/omega-continuous-maps-posets.lagda.md b/src/domain-theory/omega-continuous-maps-posets.lagda.md index a06a821648..ef7ad141c8 100644 --- a/src/domain-theory/omega-continuous-maps-posets.lagda.md +++ b/src/domain-theory/omega-continuous-maps-posets.lagda.md @@ -1,4 +1,4 @@ -# ω-continuous maps between posets +# ω-Continuous maps between posets ```agda module domain-theory.omega-continuous-maps-posets where diff --git a/src/foundation/booleans.lagda.md b/src/foundation/booleans.lagda.md index a0fff548b5..15f67bac88 100644 --- a/src/foundation/booleans.lagda.md +++ b/src/foundation/booleans.lagda.md @@ -197,6 +197,32 @@ pr1 bool-Set = bool pr2 bool-Set = is-set-bool ``` +### The "is true" predicate on booleans + +```agda +is-true : bool → UU lzero +is-true = Eq-bool true + +is-prop-is-true : (b : bool) → is-prop (is-true b) +is-prop-is-true = is-prop-Eq-bool true + +is-true-Prop : bool → Prop lzero +is-true-Prop b = is-true b , is-prop-is-true b +``` + +### The "is false" predicate on booleans + +```agda +is-false : bool → UU lzero +is-false = Eq-bool false + +is-prop-is-false : (b : bool) → is-prop (is-false b) +is-prop-is-false = is-prop-Eq-bool false + +is-false-Prop : bool → Prop lzero +is-false-Prop b = is-false b , is-prop-is-false b +``` + ### The type of booleans is equivalent to `Fin 2` ```agda diff --git a/src/foundation/cantor-schroder-bernstein-escardo.lagda.md b/src/foundation/cantor-schroder-bernstein-escardo.lagda.md index 6e6efbc522..f83e942b4b 100644 --- a/src/foundation/cantor-schroder-bernstein-escardo.lagda.md +++ b/src/foundation/cantor-schroder-bernstein-escardo.lagda.md @@ -41,8 +41,9 @@ Escardó proved that a Cantor–Schröder–Bernstein theorem also holds for ## Statement ```agda -type-Cantor-Schröder-Bernstein-Escardó : (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) -type-Cantor-Schröder-Bernstein-Escardó l1 l2 = +statement-Cantor-Schröder-Bernstein-Escardó : + (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) +statement-Cantor-Schröder-Bernstein-Escardó l1 l2 = {X : UU l1} {Y : UU l2} → (X ↪ Y) → (Y ↪ X) → X ≃ Y ``` @@ -162,7 +163,7 @@ module _ Cantor-Schröder-Bernstein-Escardó : {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) → - type-Cantor-Schröder-Bernstein-Escardó l1 l2 + statement-Cantor-Schröder-Bernstein-Escardó l1 l2 Cantor-Schröder-Bernstein-Escardó lem f g = ( map-Cantor-Schröder-Bernstein-Escardó lem f g , is-equiv-map-Cantor-Schröder-Bernstein-Escardó lem f g) diff --git a/src/foundation/constructive-cantor-schroder-bernstein.lagda.md b/src/foundation/constructive-cantor-schroder-bernstein.lagda.md index 1cdba097ac..77841b756b 100644 --- a/src/foundation/constructive-cantor-schroder-bernstein.lagda.md +++ b/src/foundation/constructive-cantor-schroder-bernstein.lagda.md @@ -53,19 +53,21 @@ open import order-theory.suplattices ## Idea +We consider a constructive refinement of the Cantor–Schröder–Bernstein theorem. + The Cantor–Schröder–Bernstein theorem asserts that, assuming [the law of excluded middle](foundation.law-of-excluded-middle.md), every pair of mutually [embedding](foundation-core.embeddings.md) types `f : X ↪ Y` and `g : Y ↪ X` are equivalent. Here, we generalize this statement by dropping the assumption of the law of excluded middle, and rather considering embeddings that -satisfy certain classicality assumptions. +satisfy certain computability assumptions. ## Statement ```agda -type-constructive-Cantor-Schröder-Bernstein : +statement-constructive-Cantor-Schröder-Bernstein : (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) -type-constructive-Cantor-Schröder-Bernstein l1 l2 = +statement-constructive-Cantor-Schröder-Bernstein l1 l2 = {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈ X) → X ≃ Y ``` @@ -231,12 +233,13 @@ module _ ( powerset-Poset (l1 ⊔ l2) X) ( hom-powerset-Cantor-Schröder-Bernstein f g)) fixed-point-domain-Cantor-Schröder-Bernstein = - fixed-point-knaster-tarski-Suplattice - ( resize-type-Suplattice - ( powerset-Suplattice X {! l1 ⊔ l2 !} lzero) - {! !}) - {! hom-powerset-Cantor-Schröder-Bernstein f g !} - {! !} + fixed-point-knaster-tarski-Suplattice {! !} {! !} {! !} + -- ( resize-type-Suplattice + -- ( powerset-Suplattice X {! l1 ⊔ l2 !} lzero) + -- {! !}) + -- {! hom-powerset-Cantor-Schröder-Bernstein f g !} + -- {! !} + -- ( resize-type-Suplattice (powerset-Suplattice X {! !} {! !}) {! !}) {! !} {! !} ``` @@ -328,15 +331,23 @@ module _ ### Proof using Kleene's fixed point theorem Assuming that `g` is a De Morgan embedding, the operator -`¬X\g(Y\f(-)) : 𝒫(X) → 𝒫(X)` is Scott continuous: +`¬X\g(Y\f(-)) : 𝒫(X) → 𝒫(X)` is ω-continuous: ```text X\g(Y\f(⋃ᵢUᵢ)) = X\g(Y\(⋃ᵢfᵢ(Uᵢ))) unions commute with images = X\g(⋂ᵢY\f(Uᵢ)) constructively valid De Morgan law = X\(⋂ᵢg(Y\f(Uᵢ))) meets commute with images - = ⋃ᵢ(X\g(Y\f(Uᵢ))) g is De Morgan + = ⋃ᵢ(X\g(Y\f(Uᵢ))) g is De Morgan -- ? ``` +The final step is not automatic. In fact, if we were not to consider that +`U ⊆ X\g(Y\f(U))`, this would be equivalent to +[Markov's principle](logic.markovs-principle.md). + +Let us consider it in more detail. Let `Pᵢ` be a countable family of +propositions such that `Pᵢ ⇒ Pᵢ₊₁`. Then `∃ i (¬ Pᵢ) ⇒ ¬ (∀ i, Pᵢ)`. If `Pᵢ` are +De Morgan + Kleene's fixed point theorem then states that, given a starting point `U : 𝒫(X)`, the sequence diff --git a/src/foundation/lesser-limited-principle-of-omniscience.lagda.md b/src/foundation/lesser-limited-principle-of-omniscience.lagda.md index a44fa6433b..9a2ffc9aca 100644 --- a/src/foundation/lesser-limited-principle-of-omniscience.lagda.md +++ b/src/foundation/lesser-limited-principle-of-omniscience.lagda.md @@ -24,9 +24,9 @@ open import univalent-combinatorics.standard-finite-types ## Statement -The **lesser limited principle of omniscience** asserts that for any sequence -`f : ℕ → Fin 2` containing at most one `1`, either `f n = 0` for all even `n` -or `f n = 0` for all odd `n`. +The {{#concept "lesser limited principle of omniscience" Agda=LLPO}} (LLPO) +asserts that for any sequence `f : ℕ → Fin 2` containing at most one `1`, either +`f n = 0` for all even `n` or `f n = 0` for all odd `n`. ```agda LLPO : UU lzero @@ -46,3 +46,9 @@ LLPO = - [The principle of omniscience](foundation.principle-of-omniscience.md) - [The limited principle of omniscience](foundation.limited-principle-of-omniscience.md) - [The weak limited principle of omniscience](foundation.weak-limited-principle-of-omniscience.md) +- [Markov's principle](logic.markovs-principle.md) + +## External links + +- [lesser limited principle of omniscience](https://ncatlab.org/nlab/show/lesser+limited+principle+of+omniscience) + at $n$Lab diff --git a/src/foundation/limited-principle-of-omniscience.lagda.md b/src/foundation/limited-principle-of-omniscience.lagda.md index 5b6d52ed2e..d204ef55bf 100644 --- a/src/foundation/limited-principle-of-omniscience.lagda.md +++ b/src/foundation/limited-principle-of-omniscience.lagda.md @@ -45,3 +45,9 @@ LPO = - [The principle of omniscience](foundation.principle-of-omniscience.md) - [The lesser limited principle of omniscience](foundation.lesser-limited-principle-of-omniscience.md) - [The weak limited principle of omniscience](foundation.weak-limited-principle-of-omniscience.md) +- [Markov's principle](logic.markovs-principle.md) + +## External links + +- [limited principle of omniscience](https://ncatlab.org/nlab/show/limited+principle+of+omniscience) + at $n$Lab diff --git a/src/foundation/principle-of-omniscience.lagda.md b/src/foundation/principle-of-omniscience.lagda.md index e3a35258cb..eaf0f7ee1e 100644 --- a/src/foundation/principle-of-omniscience.lagda.md +++ b/src/foundation/principle-of-omniscience.lagda.md @@ -19,7 +19,8 @@ open import foundation-core.propositions ## Idea -A type `X` is said to satisfy the **principle of omniscience** if every +A type `X` is said to satisfy the +{{#concept "principle of omniscience" Agda=is-omniscient}} if every [decidable subtype](foundation.decidable-subtypes.md) of `X` is either [inhabited](foundation.inhabited-types.md) or [empty](foundation-core.empty-types.md). @@ -42,3 +43,4 @@ is-omniscient X = type-Prop (is-omniscient-Prop X) - [The limited principle of omniscience](foundation.limited-principle-of-omniscience.md) - [The lesser limited principle of omniscience](foundation.lesser-limited-principle-of-omniscience.md) - [The weak limited principle of omniscience](foundation.weak-limited-principle-of-omniscience.md) +- [Markov's principle](logic.markovs-principle.md) diff --git a/src/foundation/weak-limited-principle-of-omniscience.lagda.md b/src/foundation/weak-limited-principle-of-omniscience.lagda.md index b4a805bc24..3fbef50663 100644 --- a/src/foundation/weak-limited-principle-of-omniscience.lagda.md +++ b/src/foundation/weak-limited-principle-of-omniscience.lagda.md @@ -24,9 +24,9 @@ open import univalent-combinatorics.standard-finite-types ## Statement -The {{#concept "Weak Limited Principle of Omniscience"}} asserts that for any -[sequence](foundation.sequences.md) `f : ℕ → Fin 2` either `f n = 0` for all -`n : ℕ` or not. In particular, it is a restricted form of the +The {{#concept "weak limited principle of omniscience"}} (WLPO) asserts that for +any [sequence](foundation.sequences.md) `f : ℕ → Fin 2` either `f n = 0` for +all `n : ℕ` or not. In particular, it is a restricted form of the [law of excluded middle](foundation.law-of-excluded-middle.md). ```agda @@ -48,3 +48,9 @@ WLPO = type-Prop WLPO-Prop - [The principle of omniscience](foundation.principle-of-omniscience.md) - [The limited principle of omniscience](foundation.limited-principle-of-omniscience.md) - [The lesser limited principle of omniscience](foundation.lesser-limited-principle-of-omniscience.md) +- [Markov's principle](logic.markovs-principle.md) + +## External links + +- [weak limited principle of omniscience](https://ncatlab.org/nlab/show/weak+limited+principle+of+omniscience) + at $n$Lab diff --git a/src/logic.lagda.md b/src/logic.lagda.md index 1422b2ec1b..4187ab1fc9 100644 --- a/src/logic.lagda.md +++ b/src/logic.lagda.md @@ -17,5 +17,6 @@ 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.markovs-principle public open import logic.mutually-de-morgan-families public ``` diff --git a/src/logic/markovs-principle.lagda.md b/src/logic/markovs-principle.lagda.md new file mode 100644 index 0000000000..2f9ae283e0 --- /dev/null +++ b/src/logic/markovs-principle.lagda.md @@ -0,0 +1,119 @@ +# Markov's principle + +```agda +module logic.markovs-principle 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 +``` + +
+ +## Idea + +{{#concept "Markov's principle" WDID=Q3922074 WD="Markov's principle" Agda=Markov's-Principle}} +asserts that if a [decidable subtype](foundation.decidable-subtypes.md) `𝒫` of +the [natural numbers](elementary-number-theory.natural-numbers.md) `ℕ` is not +[full](foundation.full-subtypes.md), then +[there is](foundation.existential-quantification.md) a natural number `n` that +is not in `𝒫`. + +More generally we say a type `A` is {{#concept "Markovian" Agda=is-markovian}} +if, for every decidable subtype `𝒫` of `A`, if `𝒫` is not full then there is an +element of `A` that is not in `𝒫`. + +Markov's principle is an example of a constructive taboo. That is, it is an +example of a principle that need not be true in constructive mathematics, +although, it does not imply the +[law of excluded middle](foundation.law-of-excluded-middle.md). + +## Definitions + +### The predicate on a type of being Markovian + +We phrase the condition using booleans to obtain a small predicate. + +```agda +is-markovian : {l : Level} → UU l → UU l +is-markovian A = + (𝒫 : (x : A) → bool) → + ¬ ((x : A) → is-true (𝒫 x)) → + is-inhabited (Σ A (is-false ∘ 𝒫)) + +is-prop-is-markovian : {l : Level} (A : UU l) → is-prop (is-markovian A) +is-prop-is-markovian A = + is-prop-Π + ( λ 𝒫 → + is-prop-function-type + ( is-property-is-inhabited (Σ A (is-false ∘ 𝒫)))) +``` + +### The predicate on a type of being Markovian at a universe level + +```agda +module _ + {l1 : Level} (l2 : Level) (A : UU l1) + where + + is-markovian-prop-Level : Prop (l1 ⊔ lsuc l2) + is-markovian-prop-Level = + Π-Prop + ( decidable-subtype l2 A) + ( λ P → + ¬' (∀' A (subtype-decidable-subtype P)) ⇒ + ∃ A (¬'_ ∘ subtype-decidable-subtype P)) + + is-markovian-Level : UU (l1 ⊔ lsuc l2) + is-markovian-Level = + (P : decidable-subtype l2 A) → + ¬ ((x : A) → is-in-decidable-subtype P x) → + exists A (¬'_ ∘ subtype-decidable-subtype P) + + is-prop-is-markovian-Level : is-prop is-markovian-Level + is-prop-is-markovian-Level = is-prop-type-Prop is-markovian-prop-Level +``` + +### Markov's principle + +```agda +Markov's-Principle : UU lzero +Markov's-Principle = is-markovian ℕ +``` + +## Properties + +### A type is Markovian if and only if it is Markovian at all universe levels + +> This remains to be formalized. + +## See also + +- [The principle of omniscience](foundation.principle-of-omniscience.md) +- [The limited principle of omniscience](foundation.limited-principle-of-omniscience.md) +- [The lesser limited principle of omniscience](foundation.lesser-limited-principle-of-omniscience.md) +- [The weak limited principle of omniscience](foundation.weak-limited-principle-of-omniscience.md) + +## External links + +- [limited principle of omniscience](https://ncatlab.org/nlab/show/limited+principle+of+omniscience) + at $n$Lab diff --git a/src/univalent-combinatorics/kuratowski-finite-sets.lagda.md b/src/univalent-combinatorics/kuratowski-finite-sets.lagda.md index 8255b3ad10..26bf4b13d7 100644 --- a/src/univalent-combinatorics/kuratowski-finite-sets.lagda.md +++ b/src/univalent-combinatorics/kuratowski-finite-sets.lagda.md @@ -89,6 +89,11 @@ has-decidable-equality-is-finite-type-𝔽-Kuratowski X = has-decidable-equality-is-finite ``` +### Kuratowski finite sets are Markovian + +> This remains to be formalized. +> ([Markov's principle](logic.markovs-principle.md)) + ## See also - [Finite types](univalent-combinatorics.finite-types.md) From 328087e9bf00bdb60a7728abea2fe1a23271c170 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 5 Nov 2024 17:23:18 +0100 Subject: [PATCH 69/83] finitary De Morgan's law --- references.bib | 19 ++++ src/logic/markovs-principle.lagda.md | 19 ++++ src/univalent-combinatorics.lagda.md | 1 + .../de-morgans-law.lagda.md | 96 +++++++++++++++++++ 4 files changed, 135 insertions(+) create mode 100644 src/univalent-combinatorics/de-morgans-law.lagda.md diff --git a/references.bib b/references.bib index 548ba2d0b5..462f946b30 100644 --- a/references.bib +++ b/references.bib @@ -248,6 +248,25 @@ @article{EKMS93 keywords = {axiality,closure operation,Galois connection,interior operation,polarity} } +@article{Esc08, + author = {Escardó, Martín}, + title = {Exhaustible sets in higher-type computation}, + journal = {Logical Methods in Computer Science}, + volume = {4}, + year = {2008}, + month = {8}, + number = {3}, + issue = {3}, + publisher = {Centre pour la Communication Scientifique Directe (CCSD)}, + pages = {3:3, 37}, + issn = {1860-5974}, + doi = {10.2168/LMCS-4(3:3)2008}, + eprint = {0808.0441}, + eprinttype = {arxiv}, + eprintclass = {cs}, + primaryclass = {cs.LO} +} + @online{Esc19DefinitionsEquivalence, title = {Definitions of Equivalence Satisfying Judgmental/Strict Groupoid Laws?}, author = {Escardó, Martín Hötzel}, diff --git a/src/logic/markovs-principle.lagda.md b/src/logic/markovs-principle.lagda.md index 2f9ae283e0..aefbbff69d 100644 --- a/src/logic/markovs-principle.lagda.md +++ b/src/logic/markovs-principle.lagda.md @@ -102,10 +102,29 @@ Markov's-Principle = is-markovian ℕ ## Properties +### A type is Markovian if and only if it is Markovian at any universe level + +> This remains to be formalized. + ### A type is Markovian if and only if it is Markovian at all universe levels > This remains to be formalized. +### Markov's principle is constructively valid for ascending chains of decidable propositions + +**Proof.** Assume given a descending chain of propositions `Pᵢ ⇒ Pᵢ₊₁` indexed +by the natural numbers `ℕ`. This gives a subtype `𝒫` of `ℕ` given by `i ∈ 𝒫` iff +`Pᵢ` is true. Observe that if `i ∈ 𝒫` then every `j ≥ i` is also in `𝒫`, and +there must exist a least `k ∈ 𝒫`. Therefore, `𝒫 = Σ (m ∈ ℕ) (m ≥ k)` for some +`k`. So, if `¬∀Pᵢ` it is necessarily the case that `¬P₀`. + +```agda +markov-descending-chain-ℕ : + {l : Level} (P : ℕ → UU l) + (H : (n : ℕ) → P n → P (succ-ℕ n)) → ¬ ((n : ℕ) → P n) → Σ ℕ (¬_ ∘ P) +markov-descending-chain-ℕ P H q = (0 , λ x → q (ind-ℕ x H)) +``` + ## See also - [The principle of omniscience](foundation.principle-of-omniscience.md) diff --git a/src/univalent-combinatorics.lagda.md b/src/univalent-combinatorics.lagda.md index d7d2896487..f62d4b12c8 100644 --- a/src/univalent-combinatorics.lagda.md +++ b/src/univalent-combinatorics.lagda.md @@ -38,6 +38,7 @@ open import univalent-combinatorics.cubes public open import univalent-combinatorics.cycle-partitions public open import univalent-combinatorics.cycle-prime-decomposition-natural-numbers public open import univalent-combinatorics.cyclic-finite-types public +open import univalent-combinatorics.de-morgans-law public open import univalent-combinatorics.decidable-dependent-function-types public open import univalent-combinatorics.decidable-dependent-pair-types public open import univalent-combinatorics.decidable-equivalence-relations public diff --git a/src/univalent-combinatorics/de-morgans-law.lagda.md b/src/univalent-combinatorics/de-morgans-law.lagda.md new file mode 100644 index 0000000000..4de478614e --- /dev/null +++ b/src/univalent-combinatorics/de-morgans-law.lagda.md @@ -0,0 +1,96 @@ +# De Morgan's law for finite families of propositions + +```agda +module univalent-combinatorics.de-morgans-law 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-types +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.equivalences +open import foundation.function-types +open import foundation.functoriality-dependent-pair-types +open import foundation.negation +open import foundation.unit-type +open import foundation.universe-levels + +open import logic.de-morgan-propositions +open import logic.de-morgan-types + +open import univalent-combinatorics.counting +open import univalent-combinatorics.standard-finite-types +``` + +
+ +## Idea + +Given a finite family of [De Morgan types](logic.de-morgan-types.md) +`P : Fin k → De-Morgan-Type`, then the "finitary De Morgan's law" + +```text + ¬ (∀ i, P i) ⇒ ∃ i, ¬ (P i) +``` + +holds. + +## Result + +```agda +lemma-satisfies-de-morgan-Fin-is-de-morgan-family : + {l : Level} (k : ℕ) {P : Fin (succ-ℕ k) → UU l} → + ((x : Fin (succ-ℕ k)) → is-de-morgan (P x)) → + ¬ ((x : Fin (succ-ℕ k)) → P x) → + ¬ P (inr star) + ¬ ((x : Fin k) → P (inl x)) +lemma-satisfies-de-morgan-Fin-is-de-morgan-family k {P} H q = + rec-coproduct + ( inl) + ( λ z → inr (λ y → z (λ y' → q (ind-coproduct P y (λ _ → y'))))) + ( H (inr star)) + +satisfies-de-morgan-Fin-is-de-morgan-family : + {l : Level} (k : ℕ) {P : Fin k → UU l} → + ((x : Fin k) → is-de-morgan (P x)) → + ¬ ((x : Fin k) → P x) → + Σ (Fin k) (¬_ ∘ P) +satisfies-de-morgan-Fin-is-de-morgan-family zero-ℕ {P} H q = + q (λ ()) , (λ x → q (λ ())) +satisfies-de-morgan-Fin-is-de-morgan-family (succ-ℕ k) {P} H q = + rec-coproduct + ( inr star ,_) + ( λ q' → + map-Σ-map-base inl + ( ¬_ ∘ P) + ( satisfies-de-morgan-Fin-is-de-morgan-family k (H ∘ inl) q')) + ( lemma-satisfies-de-morgan-Fin-is-de-morgan-family k H q) +``` + +```agda +module _ + {l : Level} {k : ℕ} (P : Fin k → De-Morgan-Type l) + where + + satisfies-de-morgan-family-Fin : + ¬ ((x : Fin k) → type-De-Morgan-Type (P x)) → + Σ (Fin k) (¬_ ∘ type-De-Morgan-Type ∘ P) + satisfies-de-morgan-family-Fin = + satisfies-de-morgan-Fin-is-de-morgan-family k + ( is-de-morgan-type-De-Morgan-Type ∘ P) +``` + +## Comment + +It is likely that this "finitary De Morgan's law" can be generalized to families +of De Morgan types indexed by _searchable types_ in the sense of Escardó +{{#cite Esc08}}. + +## References + +{{#bibliography}} From 0b9ea90556983eb115d65a24fa68c68c573a4ba7 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 5 Nov 2024 18:46:34 +0100 Subject: [PATCH 70/83] some wording kleene's fixed point theorem --- ...point-theorem-omega-complete-posets.lagda.md | 10 +++++----- .../kleenes-fixed-point-theorem-posets.lagda.md | 17 +++++++++-------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md index 375ec68525..b077cb384c 100644 --- a/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md +++ b/src/domain-theory/kleenes-fixed-point-theorem-omega-complete-posets.lagda.md @@ -47,16 +47,16 @@ states that given an [ω-continuous](domain-theory.omega-continuous-maps-omega-complete-posets.md) endomap `f : 𝒜 → 𝒜` on an [ω-complete poset](domain-theoryomega-complete-posets.md) `𝒜`, then for every -`x ∈ 𝒜` such that `x ≤ f x`, the ω-transfinite application of `f` to `x`, given -that it exists, is a [fixed point](foundation.fixed-points-endofunctions.md) of -`f`: +`x ∈ 𝒜` such that `x ≤ f x`, the ω-transfinite application of `f` to `x`, +`f^ω(x)`, given that it exists, is a +[fixed point](foundation.fixed-points-endofunctions.md) of `f`: ```text - x ≤ f(x) ≤ f²(x) ≤ … ≤ fⁿ(x) ≤ … ≤ fω(x) = f(fω(x)) = …. + x ≤ f(x) ≤ f²(x) ≤ … ≤ fⁿ(x) ≤ … ≤ f^ω(x) = f(f^ω(x)) = …. ``` If `𝒜` has a [bottom element](order-theory.bottom-elements-posets.md) `⊥`, then -this construction gives a least fixed point of `f`. +this construction applied to `⊥` gives a least fixed point of `f`. ## Construction diff --git a/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md b/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md index be2617e679..033bc8f7e9 100644 --- a/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md +++ b/src/domain-theory/kleenes-fixed-point-theorem-posets.lagda.md @@ -43,27 +43,28 @@ open import order-theory.upper-bounds-posets states that given an [ω-continuous](domain-theory.omega-continuous-maps-posets.md) endomap `f : 𝒜 → 𝒜` on a [poset](domain-theory.posets.md) `𝒜`, then for every `x ∈ 𝒜` -such that `x ≤ f x`, the ω-transfinite application of `f` to `x`, given that it -exists, is a [fixed point](foundation.fixed-points-endofunctions.md) of `f`: +such that `x ≤ f x`, the ω-transfinite application of `f` to `x`,`f^ω(x)`, given +that it exists, is a [fixed point](foundation.fixed-points-endofunctions.md) of +`f`: ```text - x ≤ f(x) ≤ f²(x) ≤ … ≤ fⁿ(x) ≤ … ≤ fω(x) = f(fω(x)) = …. + x ≤ f(x) ≤ f²(x) ≤ … ≤ fⁿ(x) ≤ … ≤ f^ω(x) = f(^fω(x)) = …. ``` If `𝒜` has a [bottom element](order-theory.bottom-elements-posets.md) `⊥`, then -this construction gives a least fixed point of `f`. +this construction applied to `⊥` gives a least fixed point of `f`. **Duality.** Of course, since the structure of posets is self-dual, there is a dual Kleene's fixed point theorem that, for every ω-cocontinuous endomap `f` and point `y ∈ 𝒜`, if `f(y) ≤ y`, then the ω-transfinite application of `f` to `y`, -given that it exists, gives a fixed point of `f`: +`f^ω(y)`, given that it exists, gives a fixed point of `f`: ```text - … = f(fω(y)) = fω(y) ≤ … ≤ fⁿ(y) ≤ … ≤ f²(y) ≤ f(y) ≤ y. + … = f(f^ω(y)) = f^ω(y) ≤ … ≤ fⁿ(y) ≤ … ≤ f²(y) ≤ f(y) ≤ y. ``` -If `𝒜` has a [top element](order-theory.top-elements-posets.md), then this -construction gives a greatest fixed point of `f`. +If `𝒜` has a [top element](order-theory.top-elements-posets.md) `⊤`, then this +construction applied to `⊤` gives a greatest fixed point of `f`. ## Construction From 5b54ec738188cb07ab758f29a6bc067a00ab08f1 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 6 Nov 2024 16:42:17 +0100 Subject: [PATCH 71/83] `is-decidable-map-section` --- src/foundation/decidable-maps.lagda.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/foundation/decidable-maps.lagda.md b/src/foundation/decidable-maps.lagda.md index d1aaf2c207..e0b5a70178 100644 --- a/src/foundation/decidable-maps.lagda.md +++ b/src/foundation/decidable-maps.lagda.md @@ -29,6 +29,7 @@ open import foundation-core.functoriality-dependent-pair-types open import foundation-core.homotopies open import foundation-core.injective-maps open import foundation-core.retractions +open import foundation-core.sections ```
@@ -133,10 +134,19 @@ is-decidable-map-retraction : is-decidable-map-retraction d i (r , R) b = is-decidable-iff ( λ (p : i (r b) = b) → r b , p) - ( λ t → ap (i ∘ r) (inv (pr2 t)) ∙ (ap i (R (pr1 t)) ∙ pr2 t)) + ( λ t → ap (i ∘ r) (inv (pr2 t)) ∙ ap i (R (pr1 t)) ∙ pr2 t) ( d (i (r b)) b) ``` +### Maps with sections are decidable + +```agda +is-decidable-map-section : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + (i : A → B) → section i → is-decidable-map i +is-decidable-map-section i (s , S) b = inl (s b , S b) +``` + ### Any map out of the empty type is decidable ```agda From ce4bb002e177f75a37814eca7cdfa12d73b36af1 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 18 Nov 2024 11:24:49 +0100 Subject: [PATCH 72/83] fix a reference --- references.bib | 16 ++++++++++++++++ .../equivalence-injective-type-families.lagda.md | 8 +++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/references.bib b/references.bib index 462f946b30..93d34ced32 100644 --- a/references.bib +++ b/references.bib @@ -483,6 +483,22 @@ @online{MR23 keywords = {20B30 03B15,Mathematics - Group Theory,Mathematics - Logic} } +@article{Esc21b, + author = {Escardó, Martín Hötzel}, + title = {Injective types in univalent mathematics}, + journal = {Mathematical Structures in Computer Science}, + volume = {31}, + year = {2021}, + number = {1}, + pages = {89--111}, + issn = {0960-1295,1469-8072}, + doi = {10.1017/S0960129520000225}, + eprint = {1903.01211}, + archiveprefix = {arXiv}, + primaryclass = {math.CT}, + url = {https://martinescardo.github.io/TypeTopology/InjectiveTypes.Article.html} +} + @book{MRR88, title = {A {{Course}} in {{Constructive Algebra}}}, author = {Mines, Ray and Richman, Fred and Ruitenburg, Wim}, diff --git a/src/foundation/equivalence-injective-type-families.lagda.md b/src/foundation/equivalence-injective-type-families.lagda.md index d565eb4308..5b1ea1cb5f 100644 --- a/src/foundation/equivalence-injective-type-families.lagda.md +++ b/src/foundation/equivalence-injective-type-families.lagda.md @@ -37,9 +37,7 @@ as a map. **Note.** The concept of equivalence injective type family as considered here is unrelated to the concept of "injective type" as studied by Martín Escardó in -_Injective types in univalent mathematics_ -([arXiv:1903.01211](https://arxiv.org/abs/1903.01211), -[TypeTopology](https://www.cs.bham.ac.uk/~mhe/TypeTopology/InjectiveTypes.index.html)). +_Injective types in univalent mathematics_ {{#cite Esc21b}}. ## Definition @@ -108,3 +106,7 @@ module _ pr1 is-equivalence-injective-Prop = is-equivalence-injective P pr2 is-equivalence-injective-Prop = is-prop-is-equivalence-injective ``` + +## References + +{{#bibliography}} From e66ea7d27837366eee5c3cce403c1648c704ef85 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 18 Nov 2024 11:29:57 +0100 Subject: [PATCH 73/83] some additions to logic --- src/foundation-core/fibers-of-maps.lagda.md | 71 ++++++++++++++++++ src/foundation/decidable-types.lagda.md | 74 ++++++++++++++++--- .../irrefutable-propositions.lagda.md | 4 +- src/foundation/negation.lagda.md | 31 +++++--- .../truncation-equivalences.lagda.md | 16 ++-- src/logic/de-morgan-types.lagda.md | 55 +++++++++++++- src/logic/de-morgans-law.lagda.md | 5 ++ 7 files changed, 225 insertions(+), 31 deletions(-) diff --git a/src/foundation-core/fibers-of-maps.lagda.md b/src/foundation-core/fibers-of-maps.lagda.md index 066a033e3c..69367d3013 100644 --- a/src/foundation-core/fibers-of-maps.lagda.md +++ b/src/foundation-core/fibers-of-maps.lagda.md @@ -10,6 +10,7 @@ module foundation-core.fibers-of-maps where open import foundation.action-on-identifications-functions open import foundation.dependent-pair-types open import foundation.universe-levels +open import foundation.strictly-right-unital-concatenation-identifications open import foundation-core.equivalences open import foundation-core.function-types @@ -373,6 +374,76 @@ module _ pr2 inv-compute-fiber-comp = is-equiv-map-inv-compute-fiber-comp ``` +### Fibers of homotopic maps are equivalent + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + {f g : A → B} (H : g ~ f) (y : B) + where + + map-equiv-fiber-htpy : fiber f y → fiber g y + map-equiv-fiber-htpy (x , p) = x , H x ∙ᵣ p + + map-inv-equiv-fiber-htpy : fiber g y → fiber f y + map-inv-equiv-fiber-htpy (x , p) = x , inv (H x) ∙ᵣ p + + is-section-map-inv-equiv-fiber-htpy : + is-section map-equiv-fiber-htpy map-inv-equiv-fiber-htpy + is-section-map-inv-equiv-fiber-htpy (x , refl) = + eq-Eq-fiber g (g x) refl (inv (right-inv-right-strict-concat (H x))) + + is-retraction-map-inv-equiv-fiber-htpy : + is-retraction map-equiv-fiber-htpy map-inv-equiv-fiber-htpy + is-retraction-map-inv-equiv-fiber-htpy (x , refl) = + eq-Eq-fiber f (f x) refl (inv (left-inv-right-strict-concat (H x))) + + is-equiv-map-equiv-fiber-htpy : is-equiv map-equiv-fiber-htpy + is-equiv-map-equiv-fiber-htpy = + is-equiv-is-invertible + map-inv-equiv-fiber-htpy + is-section-map-inv-equiv-fiber-htpy + is-retraction-map-inv-equiv-fiber-htpy + + equiv-fiber-htpy : fiber f y ≃ fiber g y + equiv-fiber-htpy = map-equiv-fiber-htpy , is-equiv-map-equiv-fiber-htpy +``` + +We repeat the construction for `fiber'`. + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + {f g : A → B} (H : g ~ f) (y : B) + where + + map-equiv-fiber-htpy' : fiber' f y → fiber' g y + map-equiv-fiber-htpy' (x , p) = (x , p ∙ inv (H x)) + + map-inv-equiv-fiber-htpy' : fiber' g y → fiber' f y + map-inv-equiv-fiber-htpy' (x , p) = (x , p ∙ H x) + + is-section-map-inv-equiv-fiber-htpy' : + is-section map-equiv-fiber-htpy' map-inv-equiv-fiber-htpy' + is-section-map-inv-equiv-fiber-htpy' (x , p) = + ap (pair x) (is-retraction-inv-concat' (H x) p) + + is-retraction-map-inv-equiv-fiber-htpy' : + is-retraction map-equiv-fiber-htpy' map-inv-equiv-fiber-htpy' + is-retraction-map-inv-equiv-fiber-htpy' (x , p) = + ap (pair x) (is-section-inv-concat' (H x) p) + + is-equiv-map-equiv-fiber-htpy' : is-equiv map-equiv-fiber-htpy' + is-equiv-map-equiv-fiber-htpy' = + is-equiv-is-invertible + map-inv-equiv-fiber-htpy' + is-section-map-inv-equiv-fiber-htpy' + is-retraction-map-inv-equiv-fiber-htpy' + + equiv-fiber-htpy' : fiber' f y ≃ fiber' g y + equiv-fiber-htpy' = map-equiv-fiber-htpy' , is-equiv-map-equiv-fiber-htpy' +``` + ## Table of files about fibers of maps The following table lists files that are about fibers of maps as a general diff --git a/src/foundation/decidable-types.lagda.md b/src/foundation/decidable-types.lagda.md index 7efee4ceba..872b7120fa 100644 --- a/src/foundation/decidable-types.lagda.md +++ b/src/foundation/decidable-types.lagda.md @@ -14,6 +14,9 @@ open import foundation.empty-types open import foundation.hilberts-epsilon-operators open import foundation.logical-equivalences open import foundation.negation +open import foundation.retracts-of-types +open import foundation.equivalences +open import foundation.action-on-identifications-functions open import foundation.propositional-truncations open import foundation.raising-universe-levels open import foundation.type-arithmetic-empty-type @@ -22,6 +25,8 @@ open import foundation.universe-levels open import foundation-core.cartesian-product-types open import foundation-core.equivalences +open import foundation-core.sections +open import foundation-core.retractions open import foundation-core.function-types open import foundation-core.propositions open import foundation-core.retracts-of-types @@ -172,11 +177,18 @@ module _ is-decidable-iff : (A → B) → (B → A) → is-decidable A → is-decidable B is-decidable-iff f g (inl a) = inl (f a) - is-decidable-iff f g (inr na) = inr (λ b → na (g b)) + is-decidable-iff f g (inr na) = inr (na ∘ g) is-decidable-iff' : - (A ↔ B) → is-decidable A → is-decidable B + A ↔ B → is-decidable A → is-decidable B is-decidable-iff' (f , g) = is-decidable-iff f g + +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + iff-is-decidable : A ↔ B → is-decidable A ↔ is-decidable B + iff-is-decidable e = is-decidable-iff' e , is-decidable-iff' (inv-iff e) ``` ### Decidable types are closed under retracts @@ -188,26 +200,66 @@ module _ is-decidable-retract-of : A retract-of B → is-decidable B → is-decidable A - is-decidable-retract-of (pair i (pair r H)) (inl b) = inl (r b) - is-decidable-retract-of (pair i (pair r H)) (inr f) = inr (f ∘ i) + is-decidable-retract-of R = is-decidable-iff' (iff-retract' R) ``` ### Decidable types are closed under equivalences ```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + is-decidable-is-equiv : {f : A → B} → is-equiv f → is-decidable B → is-decidable A - is-decidable-is-equiv {f} (pair (pair g G) (pair h H)) = - is-decidable-retract-of (pair f (pair h H)) + is-decidable-is-equiv {f} H = + is-decidable-retract-of (retract-equiv (f , H)) is-decidable-equiv : - (e : A ≃ B) → is-decidable B → is-decidable A + A ≃ B → is-decidable B → is-decidable A is-decidable-equiv e = is-decidable-iff (map-inv-equiv e) (map-equiv e) -is-decidable-equiv' : - {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) → - is-decidable A → is-decidable B -is-decidable-equiv' e = is-decidable-equiv (inv-equiv e) + is-decidable-equiv' : + A ≃ B → is-decidable A → is-decidable B + is-decidable-equiv' e = is-decidable-iff (map-equiv e) (map-inv-equiv e) +``` + +### Equivalent types have equivalent decidability predicates + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} (e : A ≃ B) + where + + map-equiv-is-decidable : is-decidable A → is-decidable B + map-equiv-is-decidable = is-decidable-equiv' e + + map-inv-equiv-is-decidable : is-decidable B → is-decidable A + map-inv-equiv-is-decidable = is-decidable-equiv e + + is-section-map-inv-equiv-is-decidable : + is-section map-equiv-is-decidable map-inv-equiv-is-decidable + is-section-map-inv-equiv-is-decidable (inl x) = + ap inl (is-section-map-inv-equiv e x) + is-section-map-inv-equiv-is-decidable (inr x) = + ap inr eq-neg + + is-retraction-map-inv-equiv-is-decidable : + is-retraction map-equiv-is-decidable map-inv-equiv-is-decidable + is-retraction-map-inv-equiv-is-decidable (inl x) = + ap inl (is-retraction-map-inv-equiv e x) + is-retraction-map-inv-equiv-is-decidable (inr x) = + ap inr eq-neg + + is-equiv-map-equiv-is-decidable : is-equiv map-equiv-is-decidable + is-equiv-map-equiv-is-decidable = + is-equiv-is-invertible + map-inv-equiv-is-decidable + is-section-map-inv-equiv-is-decidable + is-retraction-map-inv-equiv-is-decidable + + equiv-is-decidable : is-decidable A ≃ is-decidable B + equiv-is-decidable = map-equiv-is-decidable , is-equiv-map-equiv-is-decidable ``` ### Decidability implies double negation elimination diff --git a/src/foundation/irrefutable-propositions.lagda.md b/src/foundation/irrefutable-propositions.lagda.md index 737d79a21d..e3101cf862 100644 --- a/src/foundation/irrefutable-propositions.lagda.md +++ b/src/foundation/irrefutable-propositions.lagda.md @@ -151,9 +151,9 @@ module _ {l : Level} (P : Prop l) where - is-irrefutable-is-irrefutable-is-irrefutable : + is-idempotent-is-irrefutable : is-irrefutable (is-irrefutable-Prop P) → is-irrefutable P - is-irrefutable-is-irrefutable-is-irrefutable = + is-idempotent-is-irrefutable = double-negation-elim-neg (¬ (type-Prop P)) ``` diff --git a/src/foundation/negation.lagda.md b/src/foundation/negation.lagda.md index 69ed9babab..273c37d133 100644 --- a/src/foundation/negation.lagda.md +++ b/src/foundation/negation.lagda.md @@ -15,6 +15,7 @@ open import foundation.universe-levels open import foundation-core.empty-types open import foundation-core.equivalences +open import foundation-core.identity-types open import foundation-core.propositions ``` @@ -34,7 +35,7 @@ using propositions as types. Thus, the negation of a type `A` is the type ```agda is-prop-neg : {l : Level} {A : UU l} → is-prop (¬ A) -is-prop-neg {A = A} = is-prop-function-type is-prop-empty +is-prop-neg = is-prop-function-type is-prop-empty neg-type-Prop : {l1 : Level} → UU l1 → Prop l1 neg-type-Prop A = ¬ A , is-prop-neg @@ -49,6 +50,9 @@ infix 25 ¬'_ ¬'_ : {l1 : Level} → Prop l1 → Prop l1 ¬'_ = neg-Prop + +eq-neg : {l : Level} {A : UU l} {p q : ¬ A} → p = q +eq-neg = eq-is-prop is-prop-neg ``` ### Reductio ad absurdum @@ -61,20 +65,27 @@ reductio-ad-absurdum p np = ex-falso (np p) ### Logically equivalent types have logically equivalent negations ```agda -iff-neg : - {l1 l2 : Level} {X : UU l1} {Y : UU l2} → - (X ↔ Y) → (¬ X ↔ ¬ Y) -iff-neg e = (map-neg (backward-implication e) , map-neg (forward-implication e)) +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} + where + + iff-neg : X ↔ Y → ¬ X ↔ ¬ Y + iff-neg e = map-neg (backward-implication e) , map-neg (forward-implication e) + + equiv-iff-neg : X ↔ Y → ¬ X ≃ ¬ Y + equiv-iff-neg e = + equiv-iff' (neg-type-Prop X) (neg-type-Prop Y) (iff-neg e) ``` ### Equivalent types have equivalent negations ```agda -equiv-neg : - {l1 l2 : Level} {X : UU l1} {Y : UU l2} → - (X ≃ Y) → (¬ X ≃ ¬ Y) -equiv-neg {l1} {l2} {X} {Y} e = - equiv-iff' (neg-type-Prop X) (neg-type-Prop Y) (iff-neg (iff-equiv e)) +module _ + {l1 l2 : Level} {X : UU l1} {Y : UU l2} + where + + equiv-neg : X ≃ Y → ¬ X ≃ ¬ Y + equiv-neg e = equiv-iff-neg (iff-equiv e) ``` ### Negation has no fixed points diff --git a/src/foundation/truncation-equivalences.lagda.md b/src/foundation/truncation-equivalences.lagda.md index 8d8ecf5786..5462a0bf32 100644 --- a/src/foundation/truncation-equivalences.lagda.md +++ b/src/foundation/truncation-equivalences.lagda.md @@ -40,8 +40,10 @@ open import foundation-core.truncation-levels ## Idea -A map `f : A → B` is said to be a `k`-equivalence if the map -`map-trunc k f : trunc k A → trunc k B` is an equivalence. +A map `f : A → B` is said to be a +{{#concept "`k`-equivalence" Disambiguation="truncations of types" Agda=truncation-equivalence}} +if the map `map-trunc k f : trunc k A → trunc k B` is an +[equivalence](foundation-core.equivalences.md). ## Definition @@ -300,11 +302,11 @@ We consider the following composition of maps ```text fiber f b = Σ A (λ a → f a = b) - → Σ A (λ a → ║ f a = b ║) - ≃ Σ A (λ a → | f a | = | b | - ≃ Σ A (λ a → ║ f ║ | a | = | b |) - → Σ ║ A ║ (λ t → ║ f ║ t = | b |) - = fiber ║ f ║ | b | + → Σ A (λ a → ║f a = b║) + ≃ Σ A (λ a → |f a| = |b|) + ≃ Σ A (λ a → ║f║ |a| = |b|) + → Σ ║A║ (λ t → ║f║ t = |b|) + = fiber ║f║ |b| ``` where the first and last maps are `k`-equivalences. diff --git a/src/logic/de-morgan-types.lagda.md b/src/logic/de-morgan-types.lagda.md index efda90c1aa..53f7136eb4 100644 --- a/src/logic/de-morgan-types.lagda.md +++ b/src/logic/de-morgan-types.lagda.md @@ -14,8 +14,11 @@ open import foundation.coproduct-types open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.disjunction +open import foundation.identity-types open import foundation.double-negation open import foundation.empty-types +open import foundation.truncations +open import foundation.precomposition-functions open import foundation.evaluation-functions open import foundation.function-types open import foundation.irrefutable-propositions @@ -194,7 +197,7 @@ module _ ( H (¬ A) (λ f → pr2 f (pr1 f))) ``` -### If the negation of a proposition is decidable then it satisfies De Morgan's law +### If the negation of a type is decidable then it satisfies De Morgan's law ```agda module _ @@ -240,6 +243,13 @@ module _ satisfies-de-morgans-law-is-de-morgan' (is-de-morgan-type-De-Morgan-Type A) ``` +### 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 = is-irrefutable-is-decidable +``` + ### Decidable types are De Morgan ```agda @@ -344,6 +354,23 @@ module _ is-de-morgan-equiv = is-de-morgan-iff' (iff-equiv' e) ``` +### Equivalent types have equivalent De Morgan predicates + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + where + + iff-is-de-morgan : A ↔ B → is-de-morgan A ↔ is-de-morgan B + iff-is-de-morgan e = iff-is-decidable (iff-neg e) + + equiv-iff-is-de-morgan : A ↔ B → is-de-morgan A ≃ is-de-morgan B + equiv-iff-is-de-morgan e = equiv-is-decidable (equiv-iff-neg e) + + equiv-is-de-morgan : A ≃ B → is-de-morgan A ≃ is-de-morgan B + equiv-is-de-morgan e = equiv-iff-is-de-morgan (iff-equiv e) +``` + ### The truncation of a De Morgan type is De Morgan ```agda @@ -360,6 +387,24 @@ module _ inr (λ nn|a| → nna (λ a → nn|a| (unit-trunc a))) ``` +### If the truncation of a type is De Morgan then the type is De Morgan + +```agda +module _ + {l1 : Level} {A : UU l1} + where + + equiv-is-de-morgan-trunc : + {k : 𝕋} → is-de-morgan (type-trunc (succ-𝕋 k) A) ≃ is-de-morgan A + equiv-is-de-morgan-trunc {k} = + equiv-is-decidable + ( map-neg unit-trunc , is-truncation-trunc (empty-Truncated-Type k)) + + is-de-morgan-is-de-morgan-trunc : + {k : 𝕋} → is-de-morgan (type-trunc (succ-𝕋 k) A) → is-de-morgan A + is-de-morgan-is-de-morgan-trunc = map-equiv equiv-is-de-morgan-trunc +``` + ### Products of De Morgan types are De Morgan ```agda @@ -404,6 +449,14 @@ is-de-morgan-neg : {l : Level} {A : UU l} → is-de-morgan A → is-de-morgan ( is-de-morgan-neg = is-decidable-neg ``` +### The identity types of De Morgan types are not generally De Morgan + +Consider any type `A`, then its suspension `ΣA` is De Morgan since it is +inhabited. However, its identity type `N = S` is equivalent to `A`, so cannot +be De Morgan unless `A` is. + +> This remains to be formalized. + ## External links - [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) diff --git a/src/logic/de-morgans-law.lagda.md b/src/logic/de-morgans-law.lagda.md index 1d3c9cef13..81cb2892e2 100644 --- a/src/logic/de-morgans-law.lagda.md +++ b/src/logic/de-morgans-law.lagda.md @@ -133,6 +133,11 @@ is-irrefutable-de-morgans-law u = u (λ _ → inl (λ x → u (λ f → inr (λ y → f (x , y))))) ``` +## See also + +- [De Morgan types](logic.de-morgan-types.md) +- [De Morgan sheaves](logic.de-morgan-sheaves.md) + ## External links - [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) From e68907d1f0e25f31a5c43ed7f36ae5d9b24008c4 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 18 Nov 2024 13:24:59 +0100 Subject: [PATCH 74/83] edits --- src/logic/de-morgan-maps.lagda.md | 21 ++++--- src/logic/de-morgan-sheaves.lagda.md | 63 +++++++++++++++++++ .../double-negation-sheaves.lagda.md | 6 +- 3 files changed, 78 insertions(+), 12 deletions(-) diff --git a/src/logic/de-morgan-maps.lagda.md b/src/logic/de-morgan-maps.lagda.md index 063f4c8a3c..1fdb864d4c 100644 --- a/src/logic/de-morgan-maps.lagda.md +++ b/src/logic/de-morgan-maps.lagda.md @@ -55,11 +55,12 @@ A [map](foundation-core.function-types.md) is said to be {{#concept "De Morgan" Disambiguation="map of types" Agda=is-de-morgan-map}} if the [negation](foundation-core.negation.md) of its [fibers](foundation-core.fibers-of-maps.md) are -[decidable](foundation.decidable-types.md). I.e., for every `y : B`, if -`fiber f y` is either [empty](foundation.empty-types.md) or -[irrefutable](foundation.irrefutable-propositions.md). This is an equivalent, -but [small](foundation.small-types.md) condition that is equivallent to asking -that they satisfy [De Morgan's law](logic.de-morgans-law.md). +[decidable](foundation.decidable-types.md). I.e., the map `f : A → B` is De +Morgan if for every `y : B`, the fiber `fiber f y` is either +[empty](foundation.empty-types.md) or +[irrefutable](foundation.irrefutable-propositions.md). This is equivalent to +asking that the fibers satisfy [De Morgan's law](logic.de-morgans-law.md), but +is a [small](foundation.small-types.md) condition. ## Definintion @@ -157,14 +158,14 @@ module _ is-de-morgan-map-right-factor' H GF y = rec-coproduct ( λ ngfy → inl (λ p → ngfy (pr1 p , ap g (pr2 p)))) - ( λ nngfy → inr (λ nq → nngfy λ p → nq (pr1 p , H (pr2 p)))) + ( λ nngfy → inr (λ nq → nngfy (λ p → nq (pr1 p , H (pr2 p))))) ( GF (g y)) ``` ### Composition of De Morgan maps with decidable maps -If a composite `g ∘ f` is De Morgan and the left factor `g` is injective, then -the right factor `f` is De Morgan. +If `g` is a decidable injection and `f` is a De Morgan map, then `g ∘ f` is De +Morgan. ```agda module _ @@ -172,7 +173,9 @@ module _ where is-de-morgan-map-comp-is-decidable-map : - is-injective g → is-decidable-map g → is-de-morgan-map f → + is-injective g → + is-decidable-map g → + is-de-morgan-map f → is-de-morgan-map (g ∘ f) is-de-morgan-map-comp-is-decidable-map H G F y = rec-coproduct diff --git a/src/logic/de-morgan-sheaves.lagda.md b/src/logic/de-morgan-sheaves.lagda.md index ea4310792d..d400b87aa1 100644 --- a/src/logic/de-morgan-sheaves.lagda.md +++ b/src/logic/de-morgan-sheaves.lagda.md @@ -12,10 +12,19 @@ open import foundation.coproduct-types open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.double-negation +open import foundation.fibers-of-maps +open import foundation.diagonal-maps-of-types +open import foundation.unit-type +open import foundation.subtypes +open import foundation.precomposition-functions open import foundation.empty-types +open import foundation.propositional-truncations +open import foundation.universal-property-propositional-truncation open import foundation.irrefutable-propositions open import foundation.logical-equivalences open import foundation.negation +open import foundation.identity-types +open import foundation.embeddings open import foundation.type-arithmetic-cartesian-product-types open import foundation.universal-property-coproduct-types open import foundation.universe-levels @@ -25,6 +34,10 @@ open import foundation-core.function-types open import foundation-core.propositions open import logic.de-morgans-law +open import logic.de-morgan-types +open import logic.double-negation-stable-subtypes +open import foundation.decidable-subtypes +open import logic.de-morgan-maps open import orthogonal-factorization-systems.double-negation-sheaves open import orthogonal-factorization-systems.null-types @@ -45,6 +58,11 @@ De Morgan sheaves are closely related to, but a strictly weaker notion than ### The property of being a De Morgan sheaf +**Note.** We present De Morgan sheaves as types that are null at `¬ P + ¬¬ P` +for all _types_ `P`, this is equivalent to being null at `¬ P ∨ ¬¬ P` for all +propositions `P`. The latter presentation demonstrates that De Morgan +sheafification is a lex accessible modality. + ```agda is-de-morgan-sheaf : (l1 : Level) {l2 : Level} (A : UU l2) → UU (lsuc l1 ⊔ l2) @@ -57,8 +75,37 @@ is-prop-is-de-morgan-sheaf {A = A} = is-prop-Π (λ P → is-prop-is-null (is-decidable (¬ P)) A) ``` +### The subuniverse of De Morgan sheaves + +```agda +De-Morgan-Sheaf : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) +De-Morgan-Sheaf l1 l2 = Σ (UU l1) (is-de-morgan-sheaf l2) + +module _ + {l1 l2 : Level} (A : De-Morgan-Sheaf l1 l2) + where + + type-De-Morgan-Sheaf : UU l1 + type-De-Morgan-Sheaf = pr1 A + + is-de-morgan-type-De-Morgan-Sheaf : is-de-morgan-sheaf l2 type-De-Morgan-Sheaf + is-de-morgan-type-De-Morgan-Sheaf = pr2 A +``` + ## Properties +### If the De Morgan predicate is idempotent at a type, then the type is De Morgan + +```agda +module _ + {l1 : Level} {A : UU l1} + where + + is-de-morgan-is-idempotent-is-de-morgan' : + (is-de-morgan (is-de-morgan A) → is-de-morgan A) → is-de-morgan A + is-de-morgan-is-idempotent-is-de-morgan' f = f (inr is-irrefutable-is-de-morgan) +``` + ### The empty type is a De Morgan sheaf ```agda @@ -90,6 +137,22 @@ is-de-morgan-sheaf-is-double-negation-sheaf H P = H (is-decidable-prop-Irrefutable-Prop (neg-type-Prop P)) ``` +### If a type is a De Morgan sheaf at propositions then it is a De Morgan sheaf at all types + +```agda +module _ + {l1 l2 : Level} {A : UU l1} + where + + is-de-morgan-sheaf-is-de-morgan-sheaf-Prop : + ((P : Prop l2) → is-null (is-decidable (¬ (type-Prop P))) A) → + is-de-morgan-sheaf l2 A + is-de-morgan-sheaf-is-de-morgan-sheaf-Prop H B = + is-null-equiv-exponent + ( inv-equiv equiv-is-de-morgan-trunc) + ( H (trunc-Prop B)) +``` + ## References {{#bibliography}} diff --git a/src/orthogonal-factorization-systems/double-negation-sheaves.lagda.md b/src/orthogonal-factorization-systems/double-negation-sheaves.lagda.md index eb2cbcdba9..f173a260c6 100644 --- a/src/orthogonal-factorization-systems/double-negation-sheaves.lagda.md +++ b/src/orthogonal-factorization-systems/double-negation-sheaves.lagda.md @@ -83,7 +83,7 @@ is-double-negation-sheaf-is-contr is-contr-A P = module _ {l : Level} {A : UU l} (is-prop-A : is-prop A) - (is-¬¬sheaf-A : is-double-negation-sheaf l A) + (is-¬¬-sheaf-A : is-double-negation-sheaf l A) where compute-is-double-negation-sheaf-is-prop : A ≃ (¬ A → A) @@ -91,12 +91,12 @@ module _ ( left-unit-law-product-is-contr ( is-proof-irrelevant-is-prop (is-prop-function-type is-prop-A) id)) ∘e ( equiv-universal-property-coproduct A) ∘e - ( _ , is-¬¬sheaf-A (is-decidable-prop-Irrefutable-Prop (A , is-prop-A))) + ( _ , is-¬¬-sheaf-A (is-decidable-prop-Irrefutable-Prop (A , is-prop-A))) is-double-negation-stable-is-double-negation-sheaf-is-prop : is-double-negation-stable (A , is-prop-A) is-double-negation-stable-is-double-negation-sheaf-is-prop ¬¬a = - map-inv-is-equiv (is-¬¬sheaf-A (A , is-prop-A , ¬¬a)) id + map-inv-is-equiv (is-¬¬-sheaf-A (A , is-prop-A , ¬¬a)) id ``` ### Double negation stable propositions are double negation sheaves From 059ad599b751e06c448febd3abc682eae416b9df Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 15 Jan 2025 01:08:03 +0100 Subject: [PATCH 75/83] fix merge issues --- src/foundation/booleans.lagda.md | 57 +------------------ src/order-theory/top-elements-posets.lagda.md | 2 +- 2 files changed, 3 insertions(+), 56 deletions(-) diff --git a/src/foundation/booleans.lagda.md b/src/foundation/booleans.lagda.md index 71ebb88477..82e07d5dfc 100644 --- a/src/foundation/booleans.lagda.md +++ b/src/foundation/booleans.lagda.md @@ -7,10 +7,7 @@ module foundation.booleans where
Imports ```agda -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 @@ -196,58 +193,8 @@ abstract ( λ x y → eq-Eq-bool) bool-Set : Set lzero -bool-Set = bool , is-set-bool -``` - -### The booleans have decidable equality - -```agda -has-decidable-equality-bool : has-decidable-equality bool -has-decidable-equality-bool true true = inl refl -has-decidable-equality-bool true false = inr neq-true-false-bool -has-decidable-equality-bool false true = inr neq-false-true-bool -has-decidable-equality-bool false false = inl refl - -bool-Discrete-Type : Discrete-Type lzero -bool-Discrete-Type = bool , has-decidable-equality-bool -``` - -### The "is true" predicate on booleans - -```agda -is-true : bool → UU lzero -is-true = _= true - -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 -``` - -### The "is false" predicate on booleans - -```agda -is-false : bool → UU lzero -is-false = _= false - -is-prop-is-false : (b : bool) → is-prop (is-false b) -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 -``` - -### 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 () +pr1 bool-Set = bool +pr2 bool-Set = is-set-bool ``` ### The "is true" predicate on booleans diff --git a/src/order-theory/top-elements-posets.lagda.md b/src/order-theory/top-elements-posets.lagda.md index 9a6bf6e233..658fc977cc 100644 --- a/src/order-theory/top-elements-posets.lagda.md +++ b/src/order-theory/top-elements-posets.lagda.md @@ -21,7 +21,7 @@ open import order-theory.top-elements-preorders ## Idea A -{{#concept "largest element" Disambiguation="in a poset" Agda=is-top-element-Poset}} +{{#concept "largest element" Disambiguation="in a poset" WD="maximal and minimal elements" WDID=Q1475294 Agda=is-top-element-Poset}} in a [poset](order-theory.posets.md) is an element `t` such that `x ≤ t` holds for every `x : P`. From 6328de8fd1edd110ea71530af20d931c0b91e241 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 15 Jan 2025 03:32:32 +0100 Subject: [PATCH 76/83] =?UTF-8?q?cantor-schr=C3=B8der-bernstein-WLPO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contractible-maps.lagda.md | 13 ++ .../decidable-propositions.lagda.md | 83 +++++++++ src/foundation.lagda.md | 1 + .../cantor-schroder-bernstein-wlpo.lagda.md | 171 ++++++++++++++++++ src/foundation/decidable-embeddings.lagda.md | 5 + src/foundation/decidable-types.lagda.md | 5 + ...-limited-principle-of-omniscience.lagda.md | 28 ++- src/foundation/perfect-images.lagda.md | 83 +++++++-- ...-limited-principle-of-omniscience.lagda.md | 31 +++- 9 files changed, 396 insertions(+), 24 deletions(-) create mode 100644 src/foundation/cantor-schroder-bernstein-wlpo.lagda.md diff --git a/src/foundation-core/contractible-maps.lagda.md b/src/foundation-core/contractible-maps.lagda.md index 2c2d1e9c41..898e0b2f67 100644 --- a/src/foundation-core/contractible-maps.lagda.md +++ b/src/foundation-core/contractible-maps.lagda.md @@ -20,6 +20,7 @@ open import foundation-core.homotopies open import foundation-core.identity-types open import foundation-core.retractions open import foundation-core.sections +open import foundation-core.torsorial-type-families ```
@@ -134,6 +135,18 @@ module _ is-contr-map-is-coherently-invertible ∘ is-coherently-invertible-is-equiv ``` +### The identity function is contractible + +```agda +module _ + {l1 : Level} {A : UU l1} + where + + abstract + is-contr-map-id : is-contr-map (id {A = A}) + is-contr-map-id = is-torsorial-Id' +``` + ## See also - For the notion of biinvertible maps see diff --git a/src/foundation-core/decidable-propositions.lagda.md b/src/foundation-core/decidable-propositions.lagda.md index eb48a26b7d..8dd8da22d9 100644 --- a/src/foundation-core/decidable-propositions.lagda.md +++ b/src/foundation-core/decidable-propositions.lagda.md @@ -15,6 +15,7 @@ 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 @@ -224,6 +225,16 @@ module _ 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,6 +262,78 @@ type-neg-Decidable-Prop : type-neg-Decidable-Prop P = type-Decidable-Prop (neg-Decidable-Prop P) ``` +### Function types between decidable propositions + +```agda +module _ + {l1 l2 : Level} {P : UU l1} {Q : UU l2} + where + + 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 K = + rec-coproduct + ( λ x → + rec-coproduct + ( λ y → + inl (λ x' → tr Q (eq-is-prop (is-prop-type-is-decidable-prop H)) y)) + ( λ ny → inr (λ f → ny (f x))) + ( is-decidable-type-is-decidable-prop (K x))) + ( λ nx → inl (λ x' → ex-falso (nx x'))) + ( is-decidable-type-is-decidable-prop H) + + 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)) +``` + ### Decidability of a propositional truncation ```agda diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index c25f036de5..b685dd20ab 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -47,6 +47,7 @@ open import foundation.binary-transport public open import foundation.binary-type-duality public open import foundation.booleans public open import foundation.cantor-schroder-bernstein-escardo public +open import foundation.cantor-schroder-bernstein-wlpo public open import foundation.cantors-theorem public open import foundation.cartesian-morphisms-arrows public open import foundation.cartesian-morphisms-span-diagrams public diff --git a/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md b/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md new file mode 100644 index 0000000000..14330936bc --- /dev/null +++ b/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md @@ -0,0 +1,171 @@ +# The Cantor–Schröder–Bernstein-WLPO theorem + +```agda +module foundation.cantor-schroder-bernstein-wlpo where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.decidable-embeddings +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.injective-maps +open import foundation.perfect-images +open import foundation.split-surjective-maps +open import foundation.universe-levels +open import foundation.weak-limited-principle-of-omniscience + +open import foundation-core.coproduct-types +open import foundation-core.embeddings +open import foundation-core.empty-types +open import foundation-core.equivalences +open import foundation-core.fibers-of-maps +open import foundation-core.identity-types +open import foundation-core.negation +open import foundation-core.sets + +open import logic.double-negation-stable-embeddings +``` + +
+ +## Idea + +> TODO + +## Statement + +```agda +statement-Cantor-Schröder-Bernstein-WLPO : + (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) +statement-Cantor-Schröder-Bernstein-WLPO l1 l2 = + {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈ X) → X ≃ Y +``` + +## Proof + +### The law of excluded middle implies Cantor-Schröder-Bernstein-WLPO + +```agda +module _ + {l1 l2 : Level} (wlpo : level-WLPO (l1 ⊔ l2)) + {X : UU l1} {Y : UU l2} (f : X ↪ᵈ Y) (g : Y ↪ᵈ X) + where + + map-Cantor-Schröder-Bernstein-WLPO' : + (x : X) → + is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x) → + Y + map-Cantor-Schröder-Bernstein-WLPO' x (inl y) = + inverse-of-perfect-image x y + map-Cantor-Schröder-Bernstein-WLPO' x (inr y) = + map-decidable-emb f x + + map-Cantor-Schröder-Bernstein-WLPO : X → Y + map-Cantor-Schröder-Bernstein-WLPO x = + map-Cantor-Schröder-Bernstein-WLPO' x + ( is-decidable-is-perfect-image-WLPO wlpo + ( is-decidable-emb-map-decidable-emb g) + ( is-decidable-emb-map-decidable-emb f) + ( x)) + + is-injective-map-Cantor-Schröder-Bernstein-WLPO : + is-injective map-Cantor-Schröder-Bernstein-WLPO + is-injective-map-Cantor-Schröder-Bernstein-WLPO {x} {x'} = + l (is-decidable-is-perfect-image-WLPO wlpo (is-decidable-emb-map-decidable-emb g) (is-decidable-emb-map-decidable-emb f) x) + (is-decidable-is-perfect-image-WLPO wlpo (is-decidable-emb-map-decidable-emb g) (is-decidable-emb-map-decidable-emb f) x') + where + l : + (d : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x)) + (d' : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x')) → + ( map-Cantor-Schröder-Bernstein-WLPO' x d) = + ( map-Cantor-Schröder-Bernstein-WLPO' x' d') → + x = x' + l (inl ρ) (inl ρ') p = + ( inv (is-section-inverse-of-perfect-image x ρ)) ∙ + ( ap (map-decidable-emb g) p ∙ is-section-inverse-of-perfect-image x' ρ') + l (inl ρ) (inr nρ') p = + ex-falso (perfect-image-has-distinct-image x' x nρ' ρ (inv p)) + l (inr nρ) (inl ρ') p = + ex-falso (perfect-image-has-distinct-image x x' nρ ρ' p) + l (inr nρ) (inr nρ') p = + is-injective-map-decidable-emb f p + + is-split-surjective-map-Cantor-Schröder-Bernstein-WLPO : + is-split-surjective map-Cantor-Schröder-Bernstein-WLPO + is-split-surjective-map-Cantor-Schröder-Bernstein-WLPO y = + pair x p + where + a : + is-decidable + ( is-perfect-image (map-decidable-emb f) (map-decidable-emb g) (map-decidable-emb g y)) → + Σ ( X) + ( λ x → + ( (d : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x)) → + map-Cantor-Schröder-Bernstein-WLPO' x d = y)) + a (inl γ) = + pair (map-decidable-emb g y) ψ + where + ψ : + ( d : + is-decidable + ( is-perfect-image (map-decidable-emb f) (map-decidable-emb g) (map-decidable-emb g y))) → + map-Cantor-Schröder-Bernstein-WLPO' (map-decidable-emb g y) d = y + ψ (inl v') = + is-retraction-inverse-of-perfect-image + { is-emb-g = is-emb-map-decidable-emb g} + ( y) + ( v') + ψ (inr v) = ex-falso (v γ) + a (inr γ) = + pair x ψ + where + w : + Σ ( fiber (map-decidable-emb f) y) + ( λ s → ¬ (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) (pr1 s))) + w = + has-not-perfect-fiber-is-not-perfect-image + (is-double-negation-stable-emb-is-decidable-emb (is-decidable-emb-map-decidable-emb g)) (is-double-negation-stable-emb-is-decidable-emb (is-decidable-emb-map-decidable-emb f)) + ( y) + ( γ) + x : X + x = pr1 (pr1 w) + p : map-decidable-emb f x = y + p = pr2 (pr1 w) + ψ : + ( d : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x)) → + map-Cantor-Schröder-Bernstein-WLPO' x d = y + ψ (inl v) = ex-falso ((pr2 w) v) + ψ (inr v) = p + b : + Σ ( X) + ( λ x → + ( (d : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x)) → + map-Cantor-Schröder-Bernstein-WLPO' x d = y)) + b = + a ( is-decidable-is-perfect-image-WLPO wlpo + (is-decidable-emb-map-decidable-emb g) (is-decidable-emb-map-decidable-emb f) + ( map-decidable-emb g y)) + x : X + x = pr1 b + p : map-Cantor-Schröder-Bernstein-WLPO x = y + p = + pr2 b (is-decidable-is-perfect-image-WLPO wlpo (is-decidable-emb-map-decidable-emb g) (is-decidable-emb-map-decidable-emb f) x) + + is-equiv-map-Cantor-Schröder-Bernstein-WLPO : + is-equiv map-Cantor-Schröder-Bernstein-WLPO + is-equiv-map-Cantor-Schröder-Bernstein-WLPO = + is-equiv-is-split-surjective-is-injective + map-Cantor-Schröder-Bernstein-WLPO + is-injective-map-Cantor-Schröder-Bernstein-WLPO + is-split-surjective-map-Cantor-Schröder-Bernstein-WLPO + +Cantor-Schröder-Bernstein-WLPO : + {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → + statement-Cantor-Schröder-Bernstein-WLPO l1 l2 +Cantor-Schröder-Bernstein-WLPO wlpo f g = + ( map-Cantor-Schröder-Bernstein-WLPO wlpo f g , + is-equiv-map-Cantor-Schröder-Bernstein-WLPO wlpo f g) +``` diff --git a/src/foundation/decidable-embeddings.lagda.md b/src/foundation/decidable-embeddings.lagda.md index f4780285bd..50261be55d 100644 --- a/src/foundation/decidable-embeddings.lagda.md +++ b/src/foundation/decidable-embeddings.lagda.md @@ -140,6 +140,11 @@ module _ is-decidable-map-map-decidable-emb = is-decidable-map-is-decidable-emb is-decidable-emb-map-decidable-emb + is-injective-map-decidable-emb : + is-injective map-decidable-emb + is-injective-map-decidable-emb = + is-injective-is-decidable-emb is-decidable-emb-map-decidable-emb + emb-decidable-emb : X ↪ Y emb-decidable-emb = map-decidable-emb , is-emb-map-decidable-emb ``` diff --git a/src/foundation/decidable-types.lagda.md b/src/foundation/decidable-types.lagda.md index 93bdd1707e..3394fe9bea 100644 --- a/src/foundation/decidable-types.lagda.md +++ b/src/foundation/decidable-types.lagda.md @@ -148,6 +148,11 @@ 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 (inr f) _ = inl (ex-falso ∘ f) +-- is-decidable-function-type'' : +-- {l1 l2 : Level} {A : UU l1} {B : UU l2} → is-decidable B → is-decidable (A → B) +-- is-decidable-function-type'' (inl b) = inl (λ _ → b) +-- is-decidable-function-type'' (inr nb) = inr λ f → {! nb !} + is-decidable-function-type' : {l1 l2 : Level} {A : UU l1} {B : UU l2} → is-decidable A → (A → is-decidable B) → is-decidable (A → B) diff --git a/src/foundation/lesser-limited-principle-of-omniscience.lagda.md b/src/foundation/lesser-limited-principle-of-omniscience.lagda.md index 242c9b27b6..9152ac746b 100644 --- a/src/foundation/lesser-limited-principle-of-omniscience.lagda.md +++ b/src/foundation/lesser-limited-principle-of-omniscience.lagda.md @@ -13,10 +13,13 @@ open import elementary-number-theory.parity-natural-numbers open import foundation.booleans open import foundation.dependent-pair-types open import foundation.disjunction +open import foundation.negation open import foundation.universal-quantification open import foundation.universe-levels +open import foundation-core.decidable-propositions open import foundation-core.fibers-of-maps +open import foundation-core.function-types open import foundation-core.propositions open import foundation-core.sets ``` @@ -32,8 +35,8 @@ asserts that for any [sequence](foundation.sequences.md) of for all even `n` or `f n` is false for all odd `n`. ```agda -prop-LLPO : Prop lzero -prop-LLPO = +prop-bool-LLPO : Prop lzero +prop-bool-LLPO = ∀' ( ℕ → bool) ( λ f → @@ -43,11 +46,24 @@ prop-LLPO = ( ∀' ℕ (λ n → function-Prop (is-even-ℕ n) (is-false-Prop (f n)))) ( ∀' ℕ (λ n → function-Prop (is-odd-ℕ n) (is-false-Prop (f n)))))) -LLPO : UU lzero -LLPO = type-Prop prop-LLPO +bool-LLPO : UU lzero +bool-LLPO = type-Prop prop-bool-LLPO -is-prop-LLPO : is-prop LLPO -is-prop-LLPO = is-prop-type-Prop prop-LLPO +is-prop-bool-LLPO : is-prop bool-LLPO +is-prop-bool-LLPO = is-prop-type-Prop prop-bool-LLPO +``` + +```agda +prop-level-LLPO : (l : Level) → Prop (lsuc l) +prop-level-LLPO l = + ∀' + ( ℕ → Decidable-Prop l) + ( λ f → + function-Prop + ( is-prop (Σ ℕ (type-Decidable-Prop ∘ f))) + ( disjunction-Prop + ( ∀' ℕ (λ n → function-Prop (is-even-ℕ n) (neg-Prop (prop-Decidable-Prop (f n))))) + ( ∀' ℕ (λ n → function-Prop (is-odd-ℕ n) (neg-Prop (prop-Decidable-Prop (f n))))))) ``` ## See also diff --git a/src/foundation/perfect-images.lagda.md b/src/foundation/perfect-images.lagda.md index bd8ed02235..027068873f 100644 --- a/src/foundation/perfect-images.lagda.md +++ b/src/foundation/perfect-images.lagda.md @@ -10,7 +10,10 @@ module foundation.perfect-images where open import elementary-number-theory.natural-numbers open import foundation.action-on-identifications-functions +open import foundation.contractible-maps +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 @@ -24,6 +27,7 @@ open import foundation.negation open import foundation.type-arithmetic-dependent-function-types open import foundation.universal-property-dependent-pair-types open import foundation.universe-levels +open import foundation.weak-limited-principle-of-omniscience open import foundation-core.cartesian-product-types open import foundation-core.coproduct-types @@ -40,6 +44,7 @@ open import foundation-core.transport-along-identifications open import logic.double-negation-eliminating-maps open import logic.double-negation-elimination +open import logic.double-negation-stable-embeddings ```
@@ -84,16 +89,14 @@ module _ (n : ℕ) → (p : fiber (iterate n (g ∘ f)) a) → fiber g (pr1 p) equiv-is-perfect-image-is-perfect-image' : - (a : A) → - is-perfect-image' a ≃ - is-perfect-image f g a + (a : A) → is-perfect-image' a ≃ is-perfect-image f g a equiv-is-perfect-image-is-perfect-image' a = equivalence-reasoning - ((n : ℕ) (p : fiber (iterate n (g ∘ f)) a) → fiber g (pr1 p)) - ≃ ((n : ℕ) (a₀ : A) → iterate n (g ∘ f) a₀ = a → fiber g a₀) - by equiv-Π-equiv-family (λ n → equiv-ev-pair) - ≃ ((a₀ : A) (n : ℕ) → iterate n (g ∘ f) a₀ = a → fiber g a₀) - by equiv-swap-Π + ((n : ℕ) (p : fiber (iterate n (g ∘ f)) a) → fiber g (pr1 p)) + ≃ ((n : ℕ) (a₀ : A) → iterate n (g ∘ f) a₀ = a → fiber g a₀) + by equiv-Π-equiv-family (λ n → equiv-ev-pair) + ≃ ((a₀ : A) (n : ℕ) → iterate n (g ∘ f) a₀ = a → fiber g a₀) + by equiv-swap-Π ``` ### Nonperfect images @@ -170,10 +173,10 @@ module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} where - is-perfect-image-is-fiber : + fiber-is-perfect-image : {f : A → B} {g : B → A} → (a : A) → is-perfect-image f g a → fiber g a - is-perfect-image-is-fiber a ρ = ρ a 0 refl + fiber-is-perfect-image a ρ = ρ a 0 refl ``` One can define a map from `A` to `B` restricting the domain to the perfect @@ -189,13 +192,13 @@ module _ inverse-of-perfect-image : (a : A) → is-perfect-image f g a → B inverse-of-perfect-image a ρ = - pr1 (is-perfect-image-is-fiber a ρ) + pr1 (fiber-is-perfect-image a ρ) is-section-inverse-of-perfect-image : (a : A) (ρ : is-perfect-image f g a) → g (inverse-of-perfect-image a ρ) = a is-section-inverse-of-perfect-image a ρ = - pr2 (is-perfect-image-is-fiber a ρ) + pr2 (fiber-is-perfect-image a ρ) ``` ```agda @@ -357,6 +360,62 @@ module _ ( is-injective-g) ( b) ( nρ)) + +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} + {f : A → B} {g : B → A} + (G : is-double-negation-stable-emb g) + (F : is-double-negation-stable-emb f) + where + + has-not-perfect-fiber-is-not-perfect-image : + (b : B) → ¬ (is-perfect-image f g (g b)) → + has-not-perfect-fiber f g b + has-not-perfect-fiber-is-not-perfect-image = + has-not-perfect-fiber-is-not-perfect-image' + ( is-double-negation-eliminating-map-is-double-negation-stable-emb G) + ( is-injective-is-double-negation-stable-emb G) + ( is-double-negation-eliminating-map-is-double-negation-stable-emb F) + ( is-prop-map-is-double-negation-stable-emb F) +``` + +### Assuming the weak limited principle of omniscience + +```agda +module _ + {l1 l2 : Level} (wlpo : level-WLPO (l1 ⊔ l2)) {A : UU l1} {B : UU l2} + {f : A → B} {g : B → A} + (is-decidable-emb-g : is-decidable-emb g) + (is-decidable-emb-f : is-decidable-emb f) + where + + is-decidable-emb-iterate-comp : (n : ℕ) → is-decidable-emb (iterate n (g ∘ f)) + is-decidable-emb-iterate-comp zero-ℕ = is-decidable-emb-id + is-decidable-emb-iterate-comp (succ-ℕ n) = + is-decidable-emb-comp + ( is-decidable-emb-comp is-decidable-emb-g is-decidable-emb-f) + ( is-decidable-emb-iterate-comp n) + + is-decidable-is-perfect-image'-WLPO : + (a : A) → is-decidable (is-perfect-image' f g a) + is-decidable-is-perfect-image'-WLPO a = + wlpo + ( λ n → + Π-Decidable-Prop + ( fiber (iterate n (g ∘ f)) a , + is-decidable-prop-map-is-decidable-emb + ( is-decidable-emb-iterate-comp n) + ( a)) + ( λ p → + fiber g (pr1 p) , + is-decidable-prop-map-is-decidable-emb is-decidable-emb-g (pr1 p))) + + is-decidable-is-perfect-image-WLPO : + (a : A) → is-decidable (is-perfect-image f g a) + is-decidable-is-perfect-image-WLPO a = + is-decidable-equiv' + ( equiv-is-perfect-image-is-perfect-image' f g a) + ( is-decidable-is-perfect-image'-WLPO a) ``` ### The classical story diff --git a/src/foundation/weak-limited-principle-of-omniscience.lagda.md b/src/foundation/weak-limited-principle-of-omniscience.lagda.md index bc9b213e06..4522874d47 100644 --- a/src/foundation/weak-limited-principle-of-omniscience.lagda.md +++ b/src/foundation/weak-limited-principle-of-omniscience.lagda.md @@ -31,15 +31,34 @@ restricted form of the [law of excluded middle](foundation.law-of-excluded-middle.md). ```agda -prop-WLPO : Prop lzero -prop-WLPO = +prop-bool-WLPO : Prop lzero +prop-bool-WLPO = ∀' (ℕ → bool) (λ f → is-decidable-Prop (∀' ℕ (λ n → is-true-Prop (f n)))) -WLPO : UU lzero -WLPO = type-Prop prop-WLPO +bool-WLPO : UU lzero +bool-WLPO = type-Prop prop-bool-WLPO -is-prop-WLPO : is-prop WLPO -is-prop-WLPO = is-prop-type-Prop prop-WLPO +is-prop-bool-WLPO : is-prop bool-WLPO +is-prop-bool-WLPO = is-prop-type-Prop prop-bool-WLPO +``` + +```agda +prop-level-WLPO : (l : Level) → Prop (lsuc l) +prop-level-WLPO l = + ∀' + ( ℕ → Decidable-Prop l) + ( λ f → is-decidable-Prop (∀' ℕ (λ n → prop-Decidable-Prop (f n)))) + +level-WLPO : (l : Level) → UU (lsuc l) +level-WLPO l = type-Prop (prop-level-WLPO l) + +is-prop-level-WLPO : {l : Level} → is-prop (level-WLPO l) +is-prop-level-WLPO {l} = is-prop-type-Prop (prop-level-WLPO l) +``` + +```agda +WLPO : UUω +WLPO = {l : Level} → level-WLPO l ``` ## See also From 75aa9a2b3d852dc49ce3eb696ca9f7af80a61b85 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Wed, 15 Jan 2025 03:37:29 +0100 Subject: [PATCH 77/83] edit --- src/foundation/cantor-schroder-bernstein-wlpo.lagda.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md b/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md index 14330936bc..0d84dff1ca 100644 --- a/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md +++ b/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md @@ -46,7 +46,7 @@ statement-Cantor-Schröder-Bernstein-WLPO l1 l2 = ## Proof -### The law of excluded middle implies Cantor-Schröder-Bernstein-WLPO +### The weak limited principle of omniscience implies Cantor-Schröder-Bernstein-WLPO ```agda module _ From 21a5a8c2e0ce2d3af8701a5731a30644f51e8391 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 20 Jan 2025 12:46:09 +0100 Subject: [PATCH 78/83] remove unused work --- src/foundation.lagda.md | 2 - src/foundation/booleans.lagda.md | 39 +- ...ructive-cantor-schroder-bernstein.lagda.md | 367 -------------- src/foundation/images-embeddings.lagda.md | 449 ------------------ src/logic.lagda.md | 2 - src/logic/de-morgan-sheaves.lagda.md | 163 ------- .../mutually-de-morgan-families.lagda.md | 75 --- 7 files changed, 33 insertions(+), 1064 deletions(-) delete mode 100644 src/foundation/constructive-cantor-schroder-bernstein.lagda.md delete mode 100644 src/foundation/images-embeddings.lagda.md delete mode 100644 src/logic/de-morgan-sheaves.lagda.md delete mode 100644 src/logic/mutually-de-morgan-families.lagda.md diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index b685dd20ab..59661f4cfb 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -90,7 +90,6 @@ open import foundation.connected-types public open import foundation.constant-maps public open import foundation.constant-span-diagrams public open import foundation.constant-type-families public -open import foundation.constructive-cantor-schroder-bernstein public open import foundation.continuations public open import foundation.contractible-maps public open import foundation.contractible-types public @@ -231,7 +230,6 @@ open import foundation.identity-systems public open import foundation.identity-truncated-types public open import foundation.identity-types public open import foundation.images public -open import foundation.images-embeddings public open import foundation.images-subtypes public open import foundation.implicit-function-types public open import foundation.impredicative-encodings public diff --git a/src/foundation/booleans.lagda.md b/src/foundation/booleans.lagda.md index 82e07d5dfc..4c8195a978 100644 --- a/src/foundation/booleans.lagda.md +++ b/src/foundation/booleans.lagda.md @@ -7,7 +7,10 @@ module foundation.booleans where
Imports ```agda +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 @@ -193,18 +196,30 @@ abstract ( λ x y → eq-Eq-bool) bool-Set : Set lzero -pr1 bool-Set = bool -pr2 bool-Set = is-set-bool +bool-Set = bool , is-set-bool +``` + +### The booleans have decidable equality + +```agda +has-decidable-equality-bool : has-decidable-equality bool +has-decidable-equality-bool true true = inl refl +has-decidable-equality-bool true false = inr neq-true-false-bool +has-decidable-equality-bool false true = inr neq-false-true-bool +has-decidable-equality-bool false false = inl refl + +bool-Discrete-Type : Discrete-Type lzero +bool-Discrete-Type = bool , has-decidable-equality-bool ``` ### The "is true" predicate on booleans ```agda is-true : bool → UU lzero -is-true = Eq-bool true +is-true = _= true is-prop-is-true : (b : bool) → is-prop (is-true b) -is-prop-is-true = is-prop-Eq-bool true +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 @@ -214,15 +229,27 @@ is-true-Prop b = is-true b , is-prop-is-true b ```agda is-false : bool → UU lzero -is-false = Eq-bool false +is-false = _= false is-prop-is-false : (b : bool) → is-prop (is-false b) -is-prop-is-false = is-prop-Eq-bool false +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 ``` +### 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 () +``` + ### The type of booleans is equivalent to `Fin 2` ```agda diff --git a/src/foundation/constructive-cantor-schroder-bernstein.lagda.md b/src/foundation/constructive-cantor-schroder-bernstein.lagda.md deleted file mode 100644 index 77841b756b..0000000000 --- a/src/foundation/constructive-cantor-schroder-bernstein.lagda.md +++ /dev/null @@ -1,367 +0,0 @@ -# The constructive Cantor–Schröder–Bernstein theorem - -```agda -module foundation.constructive-cantor-schroder-bernstein where -``` - -
Imports - -```agda -open import foundation.action-on-identifications-functions -open import foundation.complements-subtypes -open import foundation.decidable-embeddings -open import foundation.decidable-maps -open import foundation.decidable-propositions -open import foundation.decidable-subtypes -open import foundation.decidable-types -open import foundation.dependent-pair-types -open import foundation.fixed-points-endofunctions -open import foundation.function-extensionality -open import foundation.function-types -open import foundation.images-embeddings -open import foundation.injective-maps -open import foundation.negation -open import foundation.perfect-images -open import foundation.powersets -open import foundation.propositional-maps -open import foundation.propositional-resizing -open import foundation.split-surjective-maps -open import foundation.transport-along-identifications -open import foundation.universe-levels - -open import foundation-core.coproduct-types -open import foundation-core.embeddings -open import foundation-core.empty-types -open import foundation-core.equivalences -open import foundation-core.fibers-of-maps -open import foundation-core.identity-types -open import foundation-core.sets - -open import logic.de-morgan-maps -open import logic.double-negation-stable-embeddings - -open import order-theory.inflattices -open import order-theory.knaster-tarski-fixed-point-theorem -open import order-theory.opposite-large-posets -open import order-theory.order-preserving-maps-large-posets -open import order-theory.order-preserving-maps-posets -open import order-theory.resizing-suplattices -open import order-theory.suplattices -``` - -
- -## Idea - -We consider a constructive refinement of the Cantor–Schröder–Bernstein theorem. - -The Cantor–Schröder–Bernstein theorem asserts that, assuming -[the law of excluded middle](foundation.law-of-excluded-middle.md), every pair -of mutually [embedding](foundation-core.embeddings.md) types `f : X ↪ Y` and -`g : Y ↪ X` are equivalent. Here, we generalize this statement by dropping the -assumption of the law of excluded middle, and rather considering embeddings that -satisfy certain computability assumptions. - -## Statement - -```agda -statement-constructive-Cantor-Schröder-Bernstein : - (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) -statement-constructive-Cantor-Schröder-Bernstein l1 l2 = - {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈ X) → X ≃ Y -``` - -## Proof - -**Proof.** Let us begin by assuming we have two arbitrary embeddings `f : X ↪ Y` -and `g : Y ↪ X`. In general, these need not be equivalences, so we need to find -a "correction" so that we are left with a pair of mutual inverses. - -We will proceed by finding a pair of subtypes that are left fixed by a roundtrip -around taking direct images of `f` and `g` and their complements. - -If we begin by considering the entirety of `X` and taking its direct image under -`f`, we are left with a subtype of `Y` that need not be full. By translating to -the complement, we have a measure of "everything that `f` does not hit". -`Y\f(X)`. - -```text - X Y - _______ _______ - / \ / \ - / \ / \ - | | f | | - | | --------> | f(X) | - |~~~~~~~~~~~| | | - | | g |~~~~~~~~~~~| <-?- Y\(f(X) ∪ Y\f(X)) - | g(Y\f(X)) | <-------- | | - | | | Y\f(X) | - \ / \ / - \_______/ \_______/ -``` - -Using an appropriate fixed point theorem, such as the Knaster–Tarski fixed point -theorem, or Kleene's fixed point theorem, we may deduce that at some point this -operation stabilizes, giving us a subtype `S ⊆ X` such that - -```text - X\g(Y\f(S)) = S. -``` - -```text - X Y - _______ _______ - / \ / f(S) \ - / \ /~~~~~~~~~\ <--- "Y\(f(S) ∪ Y\f(S))" - | | f | | - | | --------> | | - | | | | - | | g | | - | | <-------- | | - | | | | - \~~~~~~~~~/ \ / - \___S___/ \_______/ -``` - -Dually, we also have a least fixed point `T` of the endooperator - -```text - B ↦ Y\(f(X\g(B))) -``` - -But this gives us two further fixed points - -```text - Y\f(X\g(Y\f(S))) = Y\f(S) and X\g(Y\f(X\g(T))) = X\g(T) -``` - -So if `S` and `T` are greatest fixed points, we have - -```text - X\g(T) ⊆ S and Y\f(S) ⊆ T -``` - -If `g` is double negation stable we also have the equality - -```text - g(Y\f(S)) = X\S. -``` - -Since `f` and `g` are embeddings, this gives us inverse maps `g⁻¹ : X\S → Y` and -`f⁻¹ : Y\T → X`. Now, if `S` and `f(S)` were decidable subtypes, we could define -a new total map `h : X → Y` by - -```text - h(x) = f (x) if x ∈ S - h(x) = g⁻¹(x) if x ∉ S -``` - -and a converse map - -```text - h⁻¹(x) = f⁻¹(x) if x ∈ f(S) - h⁻¹(x) = g (x) if x ∉ f(S). -``` - -Here we're not using the existence of `T` at all, nor that `S` is a greatest -fixed point or that `g` satisfies decidability, only double negation stability. -However, to show that `h⁻¹` is a right inverse of `h` on `Y\f(S)`, we need -decidability of `g` as well. - -```agda -module _ - {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) - where - - hom-half-way-powerset-Cantor-Schröder-Bernstein : - hom-Large-Poset (λ l3 → l1 ⊔ l2 ⊔ l3) - ( powerset-Large-Poset X) - ( opposite-Large-Poset (powerset-Large-Poset Y)) - hom-half-way-powerset-Cantor-Schröder-Bernstein = - comp-hom-Large-Poset - ( powerset-Large-Poset X) - ( powerset-Large-Poset Y) - ( opposite-Large-Poset (powerset-Large-Poset Y)) - ( neg-hom-powerset) - ( direct-image-hom-emb-powerset f) - -module _ - {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) - where - - hom-large-powerset-Cantor-Schröder-Bernstein : - hom-Large-Poset - ( λ l3 → l1 ⊔ l2 ⊔ l3) - ( powerset-Large-Poset X) - ( powerset-Large-Poset X) - hom-large-powerset-Cantor-Schröder-Bernstein = - comp-hom-Large-Poset - ( powerset-Large-Poset X) - ( opposite-Large-Poset (powerset-Large-Poset Y)) - ( powerset-Large-Poset X) - ( opposite-hom-Large-Poset - { P = powerset-Large-Poset Y} - { opposite-Large-Poset (powerset-Large-Poset X)} - ( hom-half-way-powerset-Cantor-Schröder-Bernstein g)) - ( hom-half-way-powerset-Cantor-Schröder-Bernstein f) - - hom-powerset-Cantor-Schröder-Bernstein : - hom-Poset - ( powerset-Poset (l1 ⊔ l2) X) - ( powerset-Poset (l1 ⊔ l2) X) - hom-powerset-Cantor-Schröder-Bernstein = - hom-poset-hom-Large-Poset - ( powerset-Large-Poset X) - ( powerset-Large-Poset X) - ( hom-large-powerset-Cantor-Schröder-Bernstein) - ( l1 ⊔ l2) -``` - -### Impredicative proof using the Knaster–Tarski fixed point theorem - -```agda -module _ - {l1 l2 : Level} - (resize-prop : propositional-resizing-Level (l1 ⊔ l2) (l1 ⊔ l2)) - {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) - where - - fixed-point-domain-Cantor-Schröder-Bernstein : - fixed-point - ( map-hom-Poset - ( powerset-Poset (l1 ⊔ l2) X) - ( powerset-Poset (l1 ⊔ l2) X) - ( hom-powerset-Cantor-Schröder-Bernstein f g)) - fixed-point-domain-Cantor-Schröder-Bernstein = - fixed-point-knaster-tarski-Suplattice {! !} {! !} {! !} - -- ( resize-type-Suplattice - -- ( powerset-Suplattice X {! l1 ⊔ l2 !} lzero) - -- {! !}) - -- {! hom-powerset-Cantor-Schröder-Bernstein f g !} - -- {! !} - - -- ( resize-type-Suplattice (powerset-Suplattice X {! !} {! !}) {! !}) {! !} {! !} -``` - -Since the fixed point is an image of `g` by double negation stability, it must -be decidable. - -```agda -module _ - {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) - (S : - fixed-point - ( map-hom-Poset - ( powerset-Poset (l1 ⊔ l2) X) - ( powerset-Poset (l1 ⊔ l2) X) - ( hom-powerset-Cantor-Schröder-Bernstein f g))) - where - - is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein : - is-decidable-map (map-emb f) → - is-de-morgan-map (map-emb g) → - is-decidable-subtype (pr1 S) - is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein F G x = - tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) - ( rec-coproduct - ( λ ngx → inl (ngx ∘ pr1)) - ( λ nngx → rec-coproduct {! !} {! !} (F {! !})) - ( G x)) - - is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein' : - is-decidable-map (map-emb f) → - is-decidable-map (map-emb g) → - is-decidable-subtype (pr1 S) - is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein' F G x = - tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) - ( rec-coproduct - ( λ gx → - rec-coproduct - (λ fx → inr λ h → h (gx , {! !})) - (λ nfgx → {! !}) - ( F (pr1 gx))) - ( λ ngx → inl (ngx ∘ pr1)) - ( G x)) - - -- is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein' : - -- is-decidable-map (map-emb g) → - -- is-decidable-subtype (pr1 S) - -- is-decidable-subtype-fixed-point-Cantor-Schröder-Bernstein' G x with (G x) - -- ... | inl y = tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) (inr λ np → np (y , λ h → {! !})) - -- ... | inr y = tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) (inl (y ∘ pr1)) - -- tr is-decidable (ap pr1 (htpy-eq (pr2 S) x)) ({! !}) -``` - -We can define mutual inverse maps from the given fixed point. For the inverse -map we need decidability of `f` and `g`. - -```text -module _ - {l1 l2 : Level} {X : UU l1} {Y : UU l2} (f : X ↪ᵈ Y) (g : Y ↪ᵈ X) - (S : - fixed-point - ( map-hom-Poset - ( powerset-Poset (l1 ⊔ l2) X) - ( powerset-Poset (l1 ⊔ l2) X) - ( hom-small-powerset-Cantor-Schröder-Bernstein f g (l1 ⊔ l2)))) - where - - map-inv-impredicative-Cantor-Schröder-Bernstein : Y → X - map-inv-impredicative-Cantor-Schröder-Bernstein = ? - - is-section-map-inv-impredicative-Cantor-Schröder-Bernstein : - is-section - map-impredicative-Cantor-Schröder-Bernstein - map-inv-impredicative-Cantor-Schröder-Bernstein - - is-retraction-map-inv-impredicative-Cantor-Schröder-Bernstein : - is-retraction - map-impredicative-Cantor-Schröder-Bernstein - map-inv-impredicative-Cantor-Schröder-Bernstein - - is-equiv-map-impredicative-Cantor-Schröder-Bernstein : - is-equiv map-impredicative-Cantor-Schröder-Bernstein - is-equiv-map-impredicative-Cantor-Schröder-Bernstein = - is-equiv-is-invertible - map-inv-impredicative-Cantor-Schröder-Bernstein - is-section-map-inv-impredicative-Cantor-Schröder-Bernstein - is-retraction-map-inv-impredicative-Cantor-Schröder-Bernstein -``` - -### Proof using Kleene's fixed point theorem - -Assuming that `g` is a De Morgan embedding, the operator -`¬X\g(Y\f(-)) : 𝒫(X) → 𝒫(X)` is ω-continuous: - -```text - X\g(Y\f(⋃ᵢUᵢ)) = X\g(Y\(⋃ᵢfᵢ(Uᵢ))) unions commute with images - = X\g(⋂ᵢY\f(Uᵢ)) constructively valid De Morgan law - = X\(⋂ᵢg(Y\f(Uᵢ))) meets commute with images - = ⋃ᵢ(X\g(Y\f(Uᵢ))) g is De Morgan -- ? -``` - -The final step is not automatic. In fact, if we were not to consider that -`U ⊆ X\g(Y\f(U))`, this would be equivalent to -[Markov's principle](logic.markovs-principle.md). - -Let us consider it in more detail. Let `Pᵢ` be a countable family of -propositions such that `Pᵢ ⇒ Pᵢ₊₁`. Then `∃ i (¬ Pᵢ) ⇒ ¬ (∀ i, Pᵢ)`. If `Pᵢ` are -De Morgan - -Kleene's fixed point theorem then states that, given a starting point -`U : 𝒫(X)`, the sequence - -```text - ⋃(n : ℕ), (X\gY\f)ⁿ(U) -``` - -converges to a fixed point `S` of the operator. - -Now, again since `g` is De Morgan, every subtype of `Y` gives a decomposition of -`X`, in particular, applying it to `S`: - -```text - X ≅ X\g(Y\f(S)) ∪ X\X\g(Y\f(S)) = S ∪ X\S. -``` - -In other words, `S` is a decidable subtype of `X`. diff --git a/src/foundation/images-embeddings.lagda.md b/src/foundation/images-embeddings.lagda.md deleted file mode 100644 index b2fdef9844..0000000000 --- a/src/foundation/images-embeddings.lagda.md +++ /dev/null @@ -1,449 +0,0 @@ -# The image of an embedding - -```agda -module foundation.images-embeddings where -``` - -
Imports - -```agda -open import foundation.dependent-pair-types -open import foundation.fundamental-theorem-of-identity-types -open import foundation.powersets -open import foundation.propositional-maps -open import foundation.propositional-truncations -open import foundation.slice -open import foundation.subtype-identity-principle -open import foundation.surjective-maps -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 -open import foundation-core.function-types -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 order-theory.order-preserving-maps-large-posets -open import order-theory.order-preserving-maps-large-preorders -open import order-theory.order-preserving-maps-posets -``` - -
- -## Idea - -The {{#concept "image" Disambiguation="of an embedding" Agda=im-emb}} of an -[embedding](foundation-core.embeddings.md) is a type that satisfies the -[universal property of the image](foundation.universal-property-image.md) of a -map. - -## Definitions - -```agda -module _ - {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) - where - - subtype-im-emb : subtype (l1 ⊔ l2) X - subtype-im-emb x = (fiber (map-emb f) x , is-prop-map-emb f x) - - is-in-subtype-im-emb : X → UU (l1 ⊔ l2) - is-in-subtype-im-emb = is-in-subtype subtype-im-emb - - im-emb : UU (l1 ⊔ l2) - im-emb = type-subtype subtype-im-emb - - inclusion-im-emb : im-emb → X - inclusion-im-emb = inclusion-subtype subtype-im-emb - - map-unit-im-emb : A → im-emb - pr1 (map-unit-im-emb a) = map-emb f a - pr2 (map-unit-im-emb a) = a , refl - - triangle-unit-im-emb : - coherence-triangle-maps (map-emb f) inclusion-im-emb map-unit-im-emb - triangle-unit-im-emb a = refl - - unit-im-emb : hom-slice (map-emb f) inclusion-im-emb - pr1 unit-im-emb = map-unit-im-emb - pr2 unit-im-emb = triangle-unit-im-emb -``` - -### The direct image operator on powersets - -```agda -module _ - {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) - where - - direct-image-hom-emb-powerset : - hom-Large-Poset - ( λ l → l1 ⊔ l2 ⊔ l) - ( powerset-Large-Poset A) - ( powerset-Large-Poset X) - direct-image-hom-emb-powerset = - make-hom-Large-Preorder - ( λ P i → Σ-Prop (subtype-im-emb f i) (λ x → P (pr1 x))) - ( λ P Q x y w → pr1 w , x (pr1 (pr1 w)) (pr2 w)) - - direct-image-hom-emb-powerset' : - {l : Level} → - hom-Poset (powerset-Poset l A) (powerset-Poset (l1 ⊔ l2 ⊔ l) X) - direct-image-hom-emb-powerset' {l} = - ( hom-poset-hom-Large-Poset - ( powerset-Large-Poset A) - ( powerset-Large-Poset X) - ( direct-image-hom-emb-powerset) - ( l)) -``` - -## Properties - -### We characterize the identity type of `im-emb f` - -```agda -module _ - {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) - where - - Eq-im-emb : im-emb f → im-emb f → UU l1 - Eq-im-emb x y = (pr1 x = pr1 y) - - refl-Eq-im-emb : (x : im-emb f) → Eq-im-emb x x - refl-Eq-im-emb x = refl - - Eq-eq-im-emb : (x y : im-emb f) → x = y → Eq-im-emb x y - Eq-eq-im-emb x .x refl = refl-Eq-im-emb x - - abstract - is-torsorial-Eq-im-emb : - (x : im-emb f) → is-torsorial (Eq-im-emb x) - is-torsorial-Eq-im-emb x = - is-torsorial-Eq-subtype - ( is-torsorial-Id (pr1 x)) - ( is-prop-map-emb f) - ( pr1 x) - ( refl) - ( pr2 x) - - abstract - is-equiv-Eq-eq-im-emb : (x y : im-emb f) → is-equiv (Eq-eq-im-emb x y) - is-equiv-Eq-eq-im-emb x = - fundamental-theorem-id - ( is-torsorial-Eq-im-emb x) - ( Eq-eq-im-emb x) - - equiv-Eq-eq-im-emb : (x y : im-emb f) → (x = y) ≃ Eq-im-emb x y - pr1 (equiv-Eq-eq-im-emb x y) = Eq-eq-im-emb x y - pr2 (equiv-Eq-eq-im-emb x y) = is-equiv-Eq-eq-im-emb x y - - eq-Eq-im-emb : (x y : im-emb f) → Eq-im-emb x y → x = y - eq-Eq-im-emb x y = map-inv-is-equiv (is-equiv-Eq-eq-im-emb x y) -``` - -### The image inclusion is an embedding - -```agda -abstract - is-emb-inclusion-im-emb : - {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) → - is-emb (inclusion-im-emb f) - is-emb-inclusion-im-emb f = - is-emb-inclusion-subtype (λ x → fiber (map-emb f) x , is-prop-map-emb f x) - -emb-im-emb : - {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) → im-emb f ↪ X -pr1 (emb-im-emb f) = inclusion-im-emb f -pr2 (emb-im-emb f) = is-emb-inclusion-im-emb f -``` - -### The image inclusion is injective - -```agda -abstract - is-injective-inclusion-im-emb : - {l1 l2 : Level} {X : UU l1} {A : UU l2} (f : A ↪ X) → - is-injective (inclusion-im-emb f) - is-injective-inclusion-im-emb f = - is-injective-is-emb (is-emb-inclusion-im-emb f) -``` - -### The unit map of the image is surjective - -```text -abstract - is-surjective-map-unit-im-emb : - {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A ↪ B) → - is-surjective (map-unit-im-emb f) - is-surjective-map-unit-im-emb f (y , z) = - apply-universal-property-trunc-Prop z - ( trunc-Prop (fiber (map-unit-im-emb f) (y , z))) - ( α) - where - α : fiber (map-emb f) y → type-Prop (trunc-Prop (fiber (map-unit-im-emb f) (y , z))) - α (x , p) = unit-trunc-Prop (x , eq-type-subtype (λ w → fiber (map-emb f) w , is-prop-map-emb f w) p) -``` - -### The image of a map into a truncated type is truncated - -```agda -abstract - is-trunc-im-emb : - {l1 l2 : Level} (k : 𝕋) {X : UU l1} {A : UU l2} (f : A ↪ X) → - is-trunc (succ-𝕋 k) X → is-trunc (succ-𝕋 k) (im-emb f) - is-trunc-im-emb k f = is-trunc-emb k (emb-im-emb f) - -im-emb-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) -pr1 (im-emb-Truncated-Type k X f) = im-emb f -pr2 (im-emb-Truncated-Type k X f) = - is-trunc-im-emb k f (is-trunc-type-Truncated-Type X) -``` - -## Idea - - - -Consider a map `f : A → B` and a [subtype](foundation-core.subtypes.md) `S ⊆ A`, -then the **image** of `S` under `f` is the subtype of `B` consisting of the -values of the composite `S ⊆ A → B`. In other words, the image `im f S` of a -subtype `S` under `f` satisfies the universal property that - -```text - (im f S ⊆ U) ↔ (S ⊆ U ∘ f). -``` - -The image operation on subtypes is an -[order preserving map](order-theory.order-preserving-maps-large-posets.md) from -the [powerset](foundation.powersets.md) of `A` to the powerset of `B`. Thus we -obtain a [Galois connection](order-theory.galois-connections-large-posets.md) -between the powersets of `A` and `B`: the **image-pullback Galois connection** - -```text - image-subtype f ⊣ pullback-subtype f. -``` - -## Definitions - -### The predicate of being the image of a subtype under a map - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (S : subtype l3 A) - where - - is-image-map-subtype : {l4 : Level} (T : subtype l4 B) → UUω - is-image-map-subtype T = - {l : Level} (U : subtype l B) → (T ⊆ U) ↔ (S ⊆ U ∘ f) -``` - -### The image of a subtype under a map - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (f : A → B) (S : subtype l3 A) - where - - im-subtype : subtype (l1 ⊔ l2 ⊔ l3) B - im-subtype y = subtype-im (f ∘ inclusion-subtype S) y - - is-in-im-subtype : B → UU (l1 ⊔ l2 ⊔ l3) - is-in-im-subtype = is-in-subtype im-subtype -``` - -### The order preserving operation taking the image of a subtype under a map - -```text -module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) - where - - preserves-order-im-subtype : - {l3 l4 : Level} (S : subtype l3 A) (T : subtype l4 A) → - S ⊆ T → im-subtype f S ⊆ im-subtype f T - preserves-order-im-subtype S T H y p = - apply-universal-property-trunc-Prop p - ( im-subtype f T y) - ( λ ((x , s) , q) → unit-trunc-Prop ((x , H x s) , q)) - - im-subtype-hom-Large-Poset : - hom-Large-Poset - ( λ l → l1 ⊔ l2 ⊔ l) - ( powerset-Large-Poset A) - ( powerset-Large-Poset B) - map-hom-Large-Preorder im-subtype-hom-Large-Poset = - im-subtype f - preserves-order-hom-Large-Preorder im-subtype-hom-Large-Poset = - preserves-order-im-subtype -``` - -### The image-pullback Galois connection on powersets - -```text -module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) - where - - forward-implication-adjoint-relation-image-pullback-subtype : - {l3 l4 : Level} (S : subtype l3 A) (T : subtype l4 B) → - (im-subtype f S ⊆ T) → (S ⊆ pullback-subtype f T) - forward-implication-adjoint-relation-image-pullback-subtype S T H x p = - H (f x) (unit-trunc-Prop ((x , p) , refl)) - - backward-implication-adjoint-relation-image-pullback-subtype : - {l3 l4 : Level} (S : subtype l3 A) (T : subtype l4 B) → - (S ⊆ pullback-subtype f T) → (im-subtype f S ⊆ T) - backward-implication-adjoint-relation-image-pullback-subtype S T H y p = - apply-universal-property-trunc-Prop p - ( T y) - ( λ where ((x , s) , refl) → H x s) - - adjoint-relation-image-pullback-subtype : - {l3 l4 : Level} (S : subtype l3 A) (T : subtype l4 B) → - (im-subtype f S ⊆ T) ↔ (S ⊆ pullback-subtype f T) - pr1 (adjoint-relation-image-pullback-subtype S T) = - forward-implication-adjoint-relation-image-pullback-subtype S T - pr2 (adjoint-relation-image-pullback-subtype S T) = - backward-implication-adjoint-relation-image-pullback-subtype S T - - image-pullback-subtype-galois-connection-Large-Poset : - galois-connection-Large-Poset - ( λ l → l1 ⊔ l2 ⊔ l) - ( λ l → l) - ( powerset-Large-Poset A) - ( powerset-Large-Poset B) - lower-adjoint-galois-connection-Large-Poset - image-pullback-subtype-galois-connection-Large-Poset = - im-subtype-hom-Large-Poset f - upper-adjoint-galois-connection-Large-Poset - image-pullback-subtype-galois-connection-Large-Poset = - pullback-subtype-hom-Large-Poset f - adjoint-relation-galois-connection-Large-Poset - image-pullback-subtype-galois-connection-Large-Poset = - adjoint-relation-image-pullback-subtype -``` - -## Properties - -### If `S` and `T` have the same elements, then `im-subtype f S` and `im-subtype f T` have the same elements - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} (f : A → B) - (S : subtype l3 A) (T : subtype l4 A) - where - - has-same-elements-im-has-same-elements-subtype : - has-same-elements-subtype S T → - has-same-elements-subtype (im-subtype f S) (im-subtype f T) - has-same-elements-im-has-same-elements-subtype s = - has-same-elements-sim-subtype - ( im-subtype f S) - ( im-subtype f T) - ( preserves-sim-hom-Large-Poset - ( powerset-Large-Poset A) - ( powerset-Large-Poset B) - ( im-subtype-hom-Large-Poset f) - ( S) - ( T) - ( sim-has-same-elements-subtype S T s)) -``` - -### The image subtype `im f (full-subtype A)` has the same elements as the subtype `im f` - -```text -module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) - where - - compute-im-full-subtype : - has-same-elements-subtype - ( im-subtype f (full-subtype lzero A)) - ( subtype-im f) - compute-im-full-subtype y = - iff-equiv - ( equiv-trunc-Prop - ( ( right-unit-law-Σ-is-contr - ( λ a → - is-contr-map-is-equiv is-equiv-inclusion-full-subtype (pr1 a))) ∘e - ( compute-fiber-comp f inclusion-full-subtype y))) -``` - -### The image subtype `im (g ∘ f) S` has the same elements as the image subtype `im g (im f S)` - -**Proof:** The asserted similarity follows at once from the similarity - -```text - pullback-subtype (g ∘ f) ≈ pullback-subtype g ∘ pullback-subtype f -``` - -via the image-pullback Galois connection. - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} - (g : B → C) (f : A → B) (S : subtype l4 A) - where - - compute-im-subtype-comp : - has-same-elements-subtype - ( im-subtype (g ∘ f) S) - ( im-subtype g (im-subtype f S)) - compute-im-subtype-comp = - has-same-elements-sim-subtype - ( im-subtype (g ∘ f) S) - ( im-subtype g (im-subtype f S)) - ( lower-sim-upper-sim-galois-connection-Large-Poset - ( powerset-Large-Poset A) - ( powerset-Large-Poset C) - ( image-pullback-subtype-galois-connection-Large-Poset (g ∘ f)) - ( comp-galois-connection-Large-Poset - ( powerset-Large-Poset A) - ( powerset-Large-Poset B) - ( powerset-Large-Poset C) - ( image-pullback-subtype-galois-connection-Large-Poset g) - ( image-pullback-subtype-galois-connection-Large-Poset f)) - ( refl-sim-hom-Large-Poset - ( powerset-Large-Poset C) - ( powerset-Large-Poset A) - ( pullback-subtype-hom-Large-Poset (g ∘ f))) - ( S)) -``` - -### The image `im (g ∘ f)` has the same elements as the image subtype `im g (im f)` - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} (g : B → C) (f : A → B) - where - - compute-subtype-im-comp : - 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-subtype (g ∘ f) (full-subtype lzero A) x - by - inv-iff (compute-im-full-subtype (g ∘ f) x) - ↔ is-in-im-subtype g (im-subtype f (full-subtype lzero A)) x - by - compute-im-subtype-comp g f (full-subtype lzero A) x - ↔ is-in-im-subtype g (subtype-im f) x - by - has-same-elements-im-has-same-elements-subtype g - ( im-subtype f (full-subtype lzero A)) - ( subtype-im f) - ( compute-im-full-subtype f) - ( x) -``` diff --git a/src/logic.lagda.md b/src/logic.lagda.md index 7b45d3897c..4f76bcf78b 100644 --- a/src/logic.lagda.md +++ b/src/logic.lagda.md @@ -11,7 +11,6 @@ open import logic.complements-double-negation-stable-subtypes public open import logic.de-morgan-embeddings public open import logic.de-morgan-maps public open import logic.de-morgan-propositions public -open import logic.de-morgan-sheaves public open import logic.de-morgan-subtypes public open import logic.de-morgan-types public open import logic.de-morgans-law public @@ -21,5 +20,4 @@ open import logic.double-negation-stable-embeddings public open import logic.double-negation-stable-subtypes public open import logic.markovian-types public open import logic.markovs-principle public -open import logic.mutually-de-morgan-families public ``` diff --git a/src/logic/de-morgan-sheaves.lagda.md b/src/logic/de-morgan-sheaves.lagda.md deleted file mode 100644 index b0b711f390..0000000000 --- a/src/logic/de-morgan-sheaves.lagda.md +++ /dev/null @@ -1,163 +0,0 @@ -# De Morgan sheaves - -```agda -module logic.de-morgan-sheaves where -``` - -
Imports - -```agda -open import foundation.contractible-types -open import foundation.coproduct-types -open import foundation.decidable-subtypes -open import foundation.decidable-types -open import foundation.dependent-pair-types -open import foundation.diagonal-maps-of-types -open import foundation.double-negation -open import foundation.embeddings -open import foundation.empty-types -open import foundation.fibers-of-maps -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.subtypes -open import foundation.type-arithmetic-cartesian-product-types -open import foundation.unit-type -open import foundation.universal-property-coproduct-types -open import foundation.universal-property-propositional-truncation -open import foundation.universe-levels - -open import foundation-core.equivalences -open import foundation-core.function-types -open import foundation-core.propositions - -open import logic.de-morgan-maps -open import logic.de-morgan-types -open import logic.de-morgans-law -open import logic.double-negation-stable-subtypes - -open import orthogonal-factorization-systems.double-negation-sheaves -open import orthogonal-factorization-systems.null-types -``` - -
- -## Idea - -{{#concept "De morgan sheaves" Agda=is-de-morgan-sheaf}} are types that are -[null](orthogonal-factorization-systems.null-types.md) at -[propositions](foundation-core.propositions.md) of the form `¬P ∨ ¬¬P`. - -De Morgan sheaves are closely related to, but a strictly weaker notion than -[double negation sheaves](orthogonal-factorization-systems.double-negation-sheaves.md). - -## Definitions - -### The property of being a De Morgan sheaf - -**Note.** We present De Morgan sheaves as types that are null at `¬ P + ¬¬ P` -for all _types_ `P`, this is equivalent to being null at `¬ P ∨ ¬¬ P` for all -propositions `P`. The latter presentation demonstrates that De Morgan -sheafification is a lex accessible modality. - -```agda -is-de-morgan-sheaf : - (l1 : Level) {l2 : Level} (A : UU l2) → UU (lsuc l1 ⊔ l2) -is-de-morgan-sheaf l1 A = - (P : UU l1) → is-null (is-decidable (¬ P)) A - -is-prop-is-de-morgan-sheaf : - {l1 l2 : Level} {A : UU l2} → is-prop (is-de-morgan-sheaf l1 A) -is-prop-is-de-morgan-sheaf {A = A} = - is-prop-Π (λ P → is-prop-is-null (is-decidable (¬ P)) A) -``` - -### The subuniverse of De Morgan sheaves - -```agda -De-Morgan-Sheaf : (l1 l2 : Level) → UU (lsuc l1 ⊔ lsuc l2) -De-Morgan-Sheaf l1 l2 = Σ (UU l1) (is-de-morgan-sheaf l2) - -module _ - {l1 l2 : Level} (A : De-Morgan-Sheaf l1 l2) - where - - type-De-Morgan-Sheaf : UU l1 - type-De-Morgan-Sheaf = pr1 A - - is-de-morgan-type-De-Morgan-Sheaf : is-de-morgan-sheaf l2 type-De-Morgan-Sheaf - is-de-morgan-type-De-Morgan-Sheaf = pr2 A -``` - -## Properties - -### If the De Morgan predicate is idempotent at a type, then the type is De Morgan - -```agda -module _ - {l1 : Level} {A : UU l1} - where - - is-de-morgan-is-idempotent-is-de-morgan' : - (is-de-morgan (is-de-morgan A) → is-de-morgan A) → is-de-morgan A - is-de-morgan-is-idempotent-is-de-morgan' f = - f (inr is-irrefutable-is-de-morgan) -``` - -### The empty type is a De Morgan sheaf - -```agda -is-de-morgan-sheaf-empty : - {l : Level} → is-de-morgan-sheaf l empty -is-de-morgan-sheaf-empty P = - is-equiv-has-converse empty-Prop - ( neg-type-Prop (is-decidable (¬ P))) - ( is-irrefutable-is-decidable) -``` - -### Contractible types are De Morgan sheaves - -```agda -is-de-morgan-sheaf-is-contr : - {l1 l2 : Level} {A : UU l1} → is-contr A → is-de-morgan-sheaf l2 A -is-de-morgan-sheaf-is-contr is-contr-A P = - is-null-is-contr (is-decidable (¬ P)) is-contr-A -``` - -### Double negation sheaves are De Morgan sheaves - -```agda -is-de-morgan-sheaf-is-double-negation-sheaf : - {l1 l2 : Level} {A : UU l1} → - is-double-negation-sheaf l2 A → - is-de-morgan-sheaf l2 A -is-de-morgan-sheaf-is-double-negation-sheaf H P = - H (is-decidable-prop-Irrefutable-Prop (neg-type-Prop P)) -``` - -### If a type is a De Morgan sheaf at propositions then it is a De Morgan sheaf at all types - -```agda -module _ - {l1 l2 : Level} {A : UU l1} - where - - is-de-morgan-sheaf-is-de-morgan-sheaf-Prop : - ((P : Prop l2) → is-null (is-decidable (¬ (type-Prop P))) A) → - is-de-morgan-sheaf l2 A - is-de-morgan-sheaf-is-de-morgan-sheaf-Prop H B = - is-null-equiv-exponent - ( inv-equiv equiv-is-de-morgan-trunc) - ( H (trunc-Prop B)) -``` - -## References - -{{#bibliography}} - -## External links - -- [De Morganization](https://ncatlab.org/nlab/show/De+Morganization) at $n$Lab diff --git a/src/logic/mutually-de-morgan-families.lagda.md b/src/logic/mutually-de-morgan-families.lagda.md deleted file mode 100644 index b4547059a8..0000000000 --- a/src/logic/mutually-de-morgan-families.lagda.md +++ /dev/null @@ -1,75 +0,0 @@ -# Mutually De Morgan families - -```agda -module logic.mutually-de-morgan-families where -``` - -
Imports - -```agda -open import foundation.cartesian-product-types -open import foundation.conjunction -open import foundation.coproduct-types -open import foundation.decidable-types -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.existential-quantification -open import foundation.function-types -open import foundation.logical-equivalences -open import foundation.negation -open import foundation.propositional-truncations -open import foundation.universal-quantification -open import foundation.universe-levels - -open import foundation-core.decidable-propositions -open import foundation-core.propositions - -open import logic.de-morgans-law - -open import univalent-combinatorics.2-element-types -``` - -
- -## Idea - -A family of types `P : A → 𝒰` is -{{#concept "mutually de morgan" Disambiguation="family of types" Agda=is-mutually-de-morgan-family}} - -if the logical implication - -```text - ∃x, ¬(P x) ⇒ ¬ (∀x, P x) -``` - -has a converse. - -## Definition - -### Mutually De Morgan families - -```agda -module _ - {l1 l2 : Level} {A : UU l1} (P : A → UU l2) - where - - is-mutually-de-morgan-family : UU (l1 ⊔ l2) - is-mutually-de-morgan-family = - ¬ ((x : A) → P x) → exists-structure A (λ x → ¬ P x) - - is-prop-is-mutually-de-morgan-family : is-prop is-mutually-de-morgan-family - is-prop-is-mutually-de-morgan-family = - is-prop-function-type (is-prop-exists-structure A (λ x → ¬ P x)) - - is-mutually-de-morgan-family-Prop : Prop (l1 ⊔ l2) - is-mutually-de-morgan-family-Prop = - ( is-mutually-de-morgan-family , is-prop-is-mutually-de-morgan-family) -``` - -## External links - -- [De Morgan laws, in constructive mathematics](https://ncatlab.org/nlab/show/De+Morgan+laws#in_constructive_mathematics) - at $n$Lab From 556ad5db3b0a9dc25d08b954faa253f1667ec200 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 21 Jan 2025 19:10:30 +0100 Subject: [PATCH 79/83] =?UTF-8?q?generalized=20`Cantor-Schr=C3=B6der-Berns?= =?UTF-8?q?tein-WLPO`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../decidable-propositions.lagda.md | 52 +-- src/foundation-core/injective-maps.lagda.md | 2 +- src/foundation.lagda.md | 1 + src/foundation/0-connected-types.lagda.md | 11 +- ...cantor-schroder-bernstein-escardo.lagda.md | 4 +- .../cantor-schroder-bernstein-wlpo.lagda.md | 362 +++++++++++------ ...ecidable-dependent-function-types.lagda.md | 66 ++++ .../decidable-dependent-pair-types.lagda.md | 53 ++- src/foundation/decidable-embeddings.lagda.md | 4 +- src/foundation/decidable-maps.lagda.md | 27 +- .../decidable-propositions.lagda.md | 1 + src/foundation/decidable-types.lagda.md | 117 +----- src/foundation/disjunction.lagda.md | 3 +- .../functoriality-truncation.lagda.md | 2 +- src/foundation/mere-equality.lagda.md | 64 ++- src/foundation/perfect-images.lagda.md | 270 +++++++------ src/foundation/pi-0-trivial-maps.lagda.md | 95 +++++ src/foundation/truncations.lagda.md | 4 + ...uniformly-decidable-type-families.lagda.md | 56 ++- src/logic.lagda.md | 2 + .../double-negation-elimination.lagda.md | 97 +++-- ...ional-double-negation-elimination.lagda.md | 265 +++++++++++++ .../propositionally-decidable-types.lagda.md | 367 ++++++++++++++++++ .../cantors-diagonal-argument.lagda.md | 2 + .../pushouts.lagda.md | 13 + src/univalent-combinatorics/counting.lagda.md | 2 + .../dependent-pair-types.lagda.md | 2 + .../finite-types.lagda.md | 2 + 28 files changed, 1513 insertions(+), 433 deletions(-) create mode 100644 src/foundation/pi-0-trivial-maps.lagda.md create mode 100644 src/logic/propositional-double-negation-elimination.lagda.md create mode 100644 src/logic/propositionally-decidable-types.lagda.md diff --git a/src/foundation-core/decidable-propositions.lagda.md b/src/foundation-core/decidable-propositions.lagda.md index 8dd8da22d9..76844c57bf 100644 --- a/src/foundation-core/decidable-propositions.lagda.md +++ b/src/foundation-core/decidable-propositions.lagda.md @@ -12,7 +12,6 @@ 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 @@ -305,16 +304,13 @@ module _ is-decidable-prop P → ((x : P) → is-decidable-prop (Q x)) → is-decidable ((x : P) → Q x) - is-decidable-Π-is-decidable-prop H K = + is-decidable-Π-is-decidable-prop (H , inl x) K = rec-coproduct - ( λ x → - rec-coproduct - ( λ y → - inl (λ x' → tr Q (eq-is-prop (is-prop-type-is-decidable-prop H)) y)) - ( λ ny → inr (λ f → ny (f x))) - ( is-decidable-type-is-decidable-prop (K x))) - ( λ nx → inl (λ x' → ex-falso (nx x'))) - ( is-decidable-type-is-decidable-prop H) + ( λ 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 → @@ -333,39 +329,3 @@ module _ ( is-decidable-prop-type-Decidable-Prop P) ( is-decidable-prop-type-Decidable-Prop ∘ Q)) ``` - -### 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-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) - 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)) -``` diff --git a/src/foundation-core/injective-maps.lagda.md b/src/foundation-core/injective-maps.lagda.md index bf6bc84c72..6692efeaed 100644 --- a/src/foundation-core/injective-maps.lagda.md +++ b/src/foundation-core/injective-maps.lagda.md @@ -127,7 +127,7 @@ module _ where is-equiv-is-injective : {f : A → B} → section f → is-injective f → is-equiv f - is-equiv-is-injective {f} (pair g G) H = + is-equiv-is-injective {f} (g , G) H = is-equiv-is-invertible g G (λ x → H (G (f x))) ``` diff --git a/src/foundation.lagda.md b/src/foundation.lagda.md index 59661f4cfb..1a479d5418 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -317,6 +317,7 @@ open import foundation.path-split-maps public open import foundation.path-split-type-families public open import foundation.perfect-images public open import foundation.permutations-spans-families-of-types public +open import foundation.pi-0-trivial-maps public open import foundation.pi-decompositions public open import foundation.pi-decompositions-subuniverse public open import foundation.pointed-torsorial-type-families public diff --git a/src/foundation/0-connected-types.lagda.md b/src/foundation/0-connected-types.lagda.md index d2bdc9203d..756f782225 100644 --- a/src/foundation/0-connected-types.lagda.md +++ b/src/foundation/0-connected-types.lagda.md @@ -41,8 +41,11 @@ open import foundation-core.truncation-levels ## Idea -A type is said to be connected if its type of connected components, i.e., its -set truncation, is contractible. +A type is said to be +{{#concept "0-connected" Disambiguation="type" Agda=is-0-connected}} if its type +of [connected components](foundation.connected-components.md), i.e., its +[set truncation](foundation.set-truncations.md), is +[contractible](foundation-core.contractible-types.md). ```agda is-0-connected-Prop : {l : Level} → UU l → Prop l @@ -65,7 +68,7 @@ abstract abstract mere-eq-is-0-connected : - {l : Level} {A : UU l} → is-0-connected A → (x y : A) → mere-eq x y + {l : Level} {A : UU l} → is-0-connected A → all-elements-merely-equal A mere-eq-is-0-connected {A = A} H x y = apply-effectiveness-unit-trunc-Set (eq-is-contr H) @@ -83,7 +86,7 @@ abstract abstract is-0-connected-mere-eq-is-inhabited : {l : Level} {A : UU l} → - is-inhabited A → ((x y : A) → mere-eq x y) → is-0-connected A + is-inhabited A → all-elements-merely-equal A → is-0-connected A is-0-connected-mere-eq-is-inhabited H K = apply-universal-property-trunc-Prop H ( is-0-connected-Prop _) diff --git a/src/foundation/cantor-schroder-bernstein-escardo.lagda.md b/src/foundation/cantor-schroder-bernstein-escardo.lagda.md index a13b105093..0d4c1023f1 100644 --- a/src/foundation/cantor-schroder-bernstein-escardo.lagda.md +++ b/src/foundation/cantor-schroder-bernstein-escardo.lagda.md @@ -117,7 +117,7 @@ module _ map-Cantor-Schröder-Bernstein-Escardó' (map-emb g y) d = y ψ (inl v') = is-retraction-inverse-of-perfect-image - { is-emb-g = is-emb-map-emb g} + ( is-injective-emb g) ( y) ( v') ψ (inr v) = ex-falso (v γ) @@ -128,7 +128,7 @@ module _ Σ ( fiber (map-emb f) y) ( λ s → ¬ (is-perfect-image (map-emb f) (map-emb g) (pr1 s))) w = - has-not-perfect-fiber-is-not-perfect-image-LEM lem + has-nonperfect-fiber-is-not-perfect-image-LEM lem ( is-emb-map-emb f) ( is-emb-map-emb g) ( y) diff --git a/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md b/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md index 0d84dff1ca..b9f1d3d885 100644 --- a/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md +++ b/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md @@ -9,10 +9,16 @@ module foundation.cantor-schroder-bernstein-wlpo where ```agda open import foundation.action-on-identifications-functions open import foundation.decidable-embeddings +open import foundation.decidable-maps open import foundation.decidable-types open import foundation.dependent-pair-types +open import foundation.function-types +open import foundation.functoriality-dependent-pair-types open import foundation.injective-maps +open import foundation.law-of-excluded-middle open import foundation.perfect-images +open import foundation.pi-0-trivial-maps +open import foundation.sections open import foundation.split-surjective-maps open import foundation.universe-levels open import foundation.weak-limited-principle-of-omniscience @@ -26,6 +32,7 @@ open import foundation-core.identity-types open import foundation-core.negation open import foundation-core.sets +open import logic.double-negation-eliminating-maps open import logic.double-negation-stable-embeddings ``` @@ -35,137 +42,252 @@ open import logic.double-negation-stable-embeddings > TODO -## Statement +## Construction -```agda -statement-Cantor-Schröder-Bernstein-WLPO : - (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) -statement-Cantor-Schröder-Bernstein-WLPO l1 l2 = - {X : UU l1} {Y : UU l2} → (X ↪ᵈ Y) → (Y ↪ᵈ X) → X ≃ Y -``` +Given a pair of mutual maps `f : A → B` and `g : B → A` such that -## Proof +1. `f` and `g` satisfy double negation elimination on their fibers +2. For every element `x : A` it is decidable wheter `x` is a perfect image of + `g` relative to `f` +3. `g` is injective +4. `f` is π₀-trivial -### The weak limited principle of omniscience implies Cantor-Schröder-Bernstein-WLPO +Then `B` is a retract of `A`. If `f` moreover is injective, then this retract is +an equivalence. ```agda module _ - {l1 l2 : Level} (wlpo : level-WLPO (l1 ⊔ l2)) - {X : UU l1} {Y : UU l2} (f : X ↪ᵈ Y) (g : Y ↪ᵈ X) + {l1 l2 : Level} + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (F : is-double-negation-eliminating-map f) + (G : is-double-negation-eliminating-map g) + (G' : is-injective g) where - map-Cantor-Schröder-Bernstein-WLPO' : - (x : X) → - is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x) → - Y - map-Cantor-Schröder-Bernstein-WLPO' x (inl y) = + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : + (x : A) → is-decidable (is-perfect-image f g x) → B + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x (inl y) = inverse-of-perfect-image x y - map-Cantor-Schröder-Bernstein-WLPO' x (inr y) = - map-decidable-emb f x - - map-Cantor-Schröder-Bernstein-WLPO : X → Y - map-Cantor-Schröder-Bernstein-WLPO x = - map-Cantor-Schröder-Bernstein-WLPO' x - ( is-decidable-is-perfect-image-WLPO wlpo - ( is-decidable-emb-map-decidable-emb g) - ( is-decidable-emb-map-decidable-emb f) - ( x)) - - is-injective-map-Cantor-Schröder-Bernstein-WLPO : - is-injective map-Cantor-Schröder-Bernstein-WLPO - is-injective-map-Cantor-Schröder-Bernstein-WLPO {x} {x'} = - l (is-decidable-is-perfect-image-WLPO wlpo (is-decidable-emb-map-decidable-emb g) (is-decidable-emb-map-decidable-emb f) x) - (is-decidable-is-perfect-image-WLPO wlpo (is-decidable-emb-map-decidable-emb g) (is-decidable-emb-map-decidable-emb f) x') - where - l : - (d : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x)) - (d' : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x')) → - ( map-Cantor-Schröder-Bernstein-WLPO' x d) = - ( map-Cantor-Schröder-Bernstein-WLPO' x' d') → - x = x' - l (inl ρ) (inl ρ') p = - ( inv (is-section-inverse-of-perfect-image x ρ)) ∙ - ( ap (map-decidable-emb g) p ∙ is-section-inverse-of-perfect-image x' ρ') - l (inl ρ) (inr nρ') p = - ex-falso (perfect-image-has-distinct-image x' x nρ' ρ (inv p)) - l (inr nρ) (inl ρ') p = - ex-falso (perfect-image-has-distinct-image x x' nρ ρ' p) - l (inr nρ) (inr nρ') p = - is-injective-map-decidable-emb f p - - is-split-surjective-map-Cantor-Schröder-Bernstein-WLPO : - is-split-surjective map-Cantor-Schröder-Bernstein-WLPO - is-split-surjective-map-Cantor-Schröder-Bernstein-WLPO y = - pair x p - where - a : + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x (inr y) = + f x + + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : + (y : B) → + (γ : is-perfect-image f g (g y)) → + (d : is-decidable (is-perfect-image f g (g y))) → + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + ( g y) d = + y + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein y γ + ( inl v') = + is-retraction-inverse-of-perfect-image G' y v' + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein y γ + ( inr v) = + ex-falso (v γ) + + compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein : + (F' : is-π₀-trivial-map' f) → + (y : B) → + (nγ : ¬ (is-perfect-image f g (g y))) → + (d : is-decidable - ( is-perfect-image (map-decidable-emb f) (map-decidable-emb g) (map-decidable-emb g y)) → - Σ ( X) - ( λ x → - ( (d : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x)) → - map-Cantor-Schröder-Bernstein-WLPO' x d = y)) - a (inl γ) = - pair (map-decidable-emb g y) ψ - where - ψ : - ( d : - is-decidable - ( is-perfect-image (map-decidable-emb f) (map-decidable-emb g) (map-decidable-emb g y))) → - map-Cantor-Schröder-Bernstein-WLPO' (map-decidable-emb g y) d = y - ψ (inl v') = - is-retraction-inverse-of-perfect-image - { is-emb-g = is-emb-map-decidable-emb g} - ( y) - ( v') - ψ (inr v) = ex-falso (v γ) - a (inr γ) = - pair x ψ - where - w : - Σ ( fiber (map-decidable-emb f) y) - ( λ s → ¬ (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) (pr1 s))) - w = - has-not-perfect-fiber-is-not-perfect-image - (is-double-negation-stable-emb-is-decidable-emb (is-decidable-emb-map-decidable-emb g)) (is-double-negation-stable-emb-is-decidable-emb (is-decidable-emb-map-decidable-emb f)) - ( y) - ( γ) - x : X - x = pr1 (pr1 w) - p : map-decidable-emb f x = y - p = pr2 (pr1 w) - ψ : - ( d : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x)) → - map-Cantor-Schröder-Bernstein-WLPO' x d = y - ψ (inl v) = ex-falso ((pr2 w) v) - ψ (inr v) = p - b : - Σ ( X) - ( λ x → - ( (d : is-decidable (is-perfect-image (map-decidable-emb f) (map-decidable-emb g) x)) → - map-Cantor-Schröder-Bernstein-WLPO' x d = y)) - b = - a ( is-decidable-is-perfect-image-WLPO wlpo - (is-decidable-emb-map-decidable-emb g) (is-decidable-emb-map-decidable-emb f) - ( map-decidable-emb g y)) - x : X - x = pr1 b - p : map-Cantor-Schröder-Bernstein-WLPO x = y - p = - pr2 b (is-decidable-is-perfect-image-WLPO wlpo (is-decidable-emb-map-decidable-emb g) (is-decidable-emb-map-decidable-emb f) x) - - is-equiv-map-Cantor-Schröder-Bernstein-WLPO : - is-equiv map-Cantor-Schröder-Bernstein-WLPO - is-equiv-map-Cantor-Schröder-Bernstein-WLPO = - is-equiv-is-split-surjective-is-injective - map-Cantor-Schröder-Bernstein-WLPO - is-injective-map-Cantor-Schröder-Bernstein-WLPO - is-split-surjective-map-Cantor-Schröder-Bernstein-WLPO + ( is-perfect-image f g + ( element-has-nonperfect-fiber-is-not-perfect-image + G G' F F' y nγ))) → + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + ( element-has-nonperfect-fiber-is-not-perfect-image G G' F F' y nγ) + ( d) = + y + compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein + F' y nγ (inl v) = + ex-falso + ( is-not-perfect-image-has-nonperfect-fiber-is-not-perfect-image + G G' F F' y nγ v) + compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein + F' y nγ (inr _) = + is-in-fiber-element-has-nonperfect-fiber-is-not-perfect-image + G G' F F' y nγ + + map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : + (F' : is-π₀-trivial-map' f) → + (y : B) → is-decidable (is-perfect-image f g (g y)) → A + map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' y (inl _) = g y + map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' y (inr nγ) = + element-has-nonperfect-fiber-is-not-perfect-image G G' F F' y nγ + + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : + (F' : is-π₀-trivial-map' f) → + (y : B) + (d : is-decidable (is-perfect-image f g (g y))) → + (d' : + is-decidable + ( is-perfect-image f g + ( map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' y d))) → + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + ( map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' y d) + ( d') = + y + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein F' y (inl γ) = + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein y γ + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein F' y (inr nγ) = + compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein + F' y nγ + + map-construction-Cantor-Schröder-Bernstein : + (D : (x : A) → is-decidable (is-perfect-image f g x)) → A → B + map-construction-Cantor-Schröder-Bernstein D x = + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x (D x) + + map-section-construction-Cantor-Schröder-Bernstein : + (F' : is-π₀-trivial-map' f) → + (D : (y : B) → is-decidable (is-perfect-image f g (g y))) → B → A + map-section-construction-Cantor-Schröder-Bernstein F' D y = + map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + ( F') + ( y) + ( D y) + + is-section-map-section-construction-Cantor-Schröder-Bernstein : + (F' : is-π₀-trivial-map' f) → + (D : (x : A) → is-decidable (is-perfect-image f g x)) → + is-section + ( map-construction-Cantor-Schröder-Bernstein D) + ( map-section-construction-Cantor-Schröder-Bernstein F' (D ∘ g)) + is-section-map-section-construction-Cantor-Schröder-Bernstein F' D y = + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + ( F') + ( y) + ( D (g y)) + ( D (map-section-construction-Cantor-Schröder-Bernstein F' (D ∘ g) y)) + + section-construction-Cantor-Schröder-Bernstein : + (F' : is-π₀-trivial-map' f) → + (D : (x : A) → is-decidable (is-perfect-image f g x)) → + section (map-construction-Cantor-Schröder-Bernstein D) + section-construction-Cantor-Schröder-Bernstein F' D = + map-section-construction-Cantor-Schröder-Bernstein F' (D ∘ g) , + is-section-map-section-construction-Cantor-Schröder-Bernstein F' D +``` + +Injectivity of the constructed map. + +```agda + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : + (F' : is-injective f) → + {x x' : A} + (d : is-decidable (is-perfect-image f g x)) + (d' : is-decidable (is-perfect-image f g x')) → + ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x d) = + ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x' d') → + x = x' + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' { x} {x'} (inl ρ) (inl ρ') p = + ( inv (is-section-inverse-of-perfect-image x ρ)) ∙ + ( ap g p ∙ + is-section-inverse-of-perfect-image x' ρ') + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' {x} {x'} (inl ρ) (inr nρ') p = + ex-falso (perfect-image-has-distinct-image x' x nρ' ρ (inv p)) + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' { x} {x'} (inr nρ) (inl ρ') p = + ex-falso (perfect-image-has-distinct-image x x' nρ ρ' p) + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' {lx} {x'} (inr nρ) (inr nρ') p = F' p -- TODO: find alternative approach avoiding `is-injective f` +``` + +Piecing it all together. + +```agda + is-equiv-map-construction-Cantor-Schröder-Bernstein : + (F' : is-π₀-trivial-map' f) → + (F'' : is-injective f) → + (D : (x : A) → is-decidable (is-perfect-image f g x)) → + is-equiv (map-construction-Cantor-Schröder-Bernstein D) + is-equiv-map-construction-Cantor-Schröder-Bernstein + F' F'' D = + is-equiv-is-injective + ( section-construction-Cantor-Schröder-Bernstein F' D) + ( λ {x} {x'} → + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + ( F'') + ( D x) + ( D x')) + + equiv-construction-Cantor-Schröder-Bernstein : + (F' : is-π₀-trivial-map' f) → + (F'' : is-injective f) → + (D : (x : A) → is-decidable (is-perfect-image f g x)) → + A ≃ B + equiv-construction-Cantor-Schröder-Bernstein F' F'' D = + map-construction-Cantor-Schröder-Bernstein D , + is-equiv-map-construction-Cantor-Schröder-Bernstein F' F'' D +``` + +## Theorem + +### The Cantor-Schröder-Bernstein-Escardó theorem assuming the weak limited principle of omniscience + +Assuming the weak limited principle of omniscience, then for every pair of +mutual decidable embeddings `f : A ↪ B` and `g : B ↪ A` it is decidable for +every element `x : A` whether it is a perfect image of `g` relative to `f`. +Therefore, `A ≃ B`. + +In fact, it suffices to assume that `f` is decidable, π₀-trivial, and injective. + +```agda +generalized-Cantor-Schröder-Bernstein-WLPO : + {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (G : is-decidable-emb g) → + (F : is-decidable-map f) (F' : is-π₀-trivial-map' f) (F'' : is-injective f) → + A ≃ B +generalized-Cantor-Schröder-Bernstein-WLPO wlpo G F F' F'' = + equiv-construction-Cantor-Schröder-Bernstein + ( is-double-negation-eliminating-map-is-decidable-map F) + ( is-double-negation-eliminating-map-is-decidable-emb G) + ( is-injective-is-decidable-emb G) + ( F') + ( F'') + ( is-decidable-is-perfect-image-WLPO wlpo + ( G) + ( F) + ( F')) + +Cantor-Schröder-Bernstein-WLPO' : + {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (G : is-decidable-emb g) (F : is-decidable-emb f) → + A ≃ B +Cantor-Schröder-Bernstein-WLPO' wlpo G F = + generalized-Cantor-Schröder-Bernstein-WLPO wlpo G + ( is-decidable-map-is-decidable-emb F) + ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb F)) + ( is-injective-is-decidable-emb F) Cantor-Schröder-Bernstein-WLPO : {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → - statement-Cantor-Schröder-Bernstein-WLPO l1 l2 -Cantor-Schröder-Bernstein-WLPO wlpo f g = - ( map-Cantor-Schröder-Bernstein-WLPO wlpo f g , - is-equiv-map-Cantor-Schröder-Bernstein-WLPO wlpo f g) + {A : UU l1} {B : UU l2} → (A ↪ᵈ B) → (B ↪ᵈ A) → A ≃ B +Cantor-Schröder-Bernstein-WLPO wlpo (f , F) (g , G) = + Cantor-Schröder-Bernstein-WLPO' wlpo G F +``` + +### The generalized Cantor-Schröder-Bernstein-Escardó theorem assuming the law of excluded middle + +Assuming the law of excluded middle, then given two types `A` and `B` such that +there is a π₀-trivial injection `A → B` and an embedding `B ↪ A`, then `A` and +`B` are equivalent. + +```text +generalized-Cantor-Schröder-Bernstein-LEM : + {l1 l2 : Level} → LEM (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (F : is-π₀-trivial-map' f) → + (F' : is-injective f) → + (G : is-emb g) → + A ≃ B +generalized-Cantor-Schröder-Bernstein-LEM lem F F' G = {! equiv-construction-Cantor-Schröder-Bernstein !} ``` diff --git a/src/foundation/decidable-dependent-function-types.lagda.md b/src/foundation/decidable-dependent-function-types.lagda.md index c63c6ddeea..3edb0a498f 100644 --- a/src/foundation/decidable-dependent-function-types.lagda.md +++ b/src/foundation/decidable-dependent-function-types.lagda.md @@ -7,9 +7,15 @@ 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.maybe +open import foundation.mere-equality +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.transport-along-identifications open import foundation.uniformly-decidable-type-families open import foundation.universal-property-coproduct-types open import foundation.universal-property-maybe @@ -20,6 +26,8 @@ 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 +54,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 +106,42 @@ is-decidable-Π-Maybe {B = B} du de = ( is-decidable-product du de) ``` +### Dependent products of decidable propositions over a π₀-trivial base are decidable propositions + +In other words, the base is empty or 0-connected. + +```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 B H 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 B H 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' B H dA) + ( 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..974d2203cd 100644 --- a/src/foundation/decidable-dependent-pair-types.lagda.md +++ b/src/foundation/decidable-dependent-pair-types.lagda.md @@ -9,7 +9,11 @@ module foundation.decidable-dependent-pair-types where ```agda open import foundation.decidable-types open import foundation.dependent-pair-types +open import foundation.empty-types open import foundation.maybe +open import foundation.mere-equality +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 @@ -32,6 +36,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 +85,34 @@ 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 π₀-trivial bases ```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) +is-decidable-Σ-all-elements-merely-equal-base : + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → + all-elements-merely-equal A → + is-decidable A → + ((x : A) → is-decidable (B x)) → + is-decidable (Σ A B) +is-decidable-Σ-all-elements-merely-equal-base {B = B} H (inl x) K = + rec-coproduct + ( λ y → inl (x , y)) + ( λ ny → + inr + ( λ ab → + rec-trunc-Prop + ( empty-Prop) + ( λ p → ny (tr B p (pr2 ab))) + ( H (pr1 ab) x))) + ( K x) +is-decidable-Σ-all-elements-merely-equal-base H (inr nx) K = + inr (map-neg pr1 nx) ``` diff --git a/src/foundation/decidable-embeddings.lagda.md b/src/foundation/decidable-embeddings.lagda.md index 50261be55d..3d6225f33b 100644 --- a/src/foundation/decidable-embeddings.lagda.md +++ b/src/foundation/decidable-embeddings.lagda.md @@ -54,7 +54,7 @@ if it is an [embedding](foundation-core.embeddings.md) and its Equivalently, a decidable embedding is a map whose fibers are [decidable propositions](foundation-core.decidable-propositions.md). We refer to this condition as being a -{{#concept "decidably propositional map" Disambiguation="of types" Agda=is-decidable-prop-map}}. +{{#concept "decidable propositional map" Disambiguation="of types" Agda=is-decidable-prop-map}}. ## Definitions @@ -81,7 +81,7 @@ is-injective-is-decidable-emb : is-injective-is-decidable-emb = is-injective-is-emb ∘ is-emb-is-decidable-emb ``` -### Decidably propositional maps +### Decidable propositional maps ```agda module _ diff --git a/src/foundation/decidable-maps.lagda.md b/src/foundation/decidable-maps.lagda.md index 926253c0dc..79f99d4b6a 100644 --- a/src/foundation/decidable-maps.lagda.md +++ b/src/foundation/decidable-maps.lagda.md @@ -10,13 +10,18 @@ module foundation.decidable-maps where open import foundation.action-on-identifications-functions open import foundation.cartesian-morphisms-arrows open import foundation.coproduct-types +open import foundation.decidable-dependent-pair-types open import foundation.decidable-equality open import foundation.decidable-types open import foundation.dependent-pair-types open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-coproduct-types open import foundation.identity-types +open import foundation.mere-equality +open import foundation.pi-0-trivial-maps +open import foundation.propositional-truncations open import foundation.retracts-of-maps +open import foundation.transport-along-identifications open import foundation.universe-levels open import foundation-core.contractible-maps @@ -41,7 +46,7 @@ A [map](foundation-core.function-types.md) is said to be its [fibers](foundation-core.fibers-of-maps.md) are [decidable types](foundation.decidable-types.md). -## Definition +## Definitions ### The structure on a map of decidability @@ -118,6 +123,26 @@ module _ ( G x) ``` +The composite `g ∘ f` of two decidable maps is decidable if `g` is π₀-trivial. + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {g : B → C} {f : A → B} + where + + abstract + is-decidable-map-comp-is-π₀-trivial-map' : + is-π₀-trivial-map' g → + is-decidable-map g → + is-decidable-map f → + is-decidable-map (g ∘ f) + is-decidable-map-comp-is-π₀-trivial-map' H G F x = + is-decidable-equiv + ( compute-fiber-comp g f x) + ( is-decidable-Σ-all-elements-merely-equal-base (H x) (G x) (F ∘ pr1)) +``` + ### Left cancellation for decidable maps If a composite `g ∘ f` is decidable and `g` is injective then `f` is decidable. diff --git a/src/foundation/decidable-propositions.lagda.md b/src/foundation/decidable-propositions.lagda.md index c6c5bfb814..433d00c75d 100644 --- a/src/foundation/decidable-propositions.lagda.md +++ b/src/foundation/decidable-propositions.lagda.md @@ -9,6 +9,7 @@ open import foundation-core.decidable-propositions public
Imports ```agda +open import foundation.0-connected-types open import foundation.action-on-identifications-functions open import foundation.booleans open import foundation.decidable-types diff --git a/src/foundation/decidable-types.lagda.md b/src/foundation/decidable-types.lagda.md index 3394fe9bea..a18f714f17 100644 --- a/src/foundation/decidable-types.lagda.md +++ b/src/foundation/decidable-types.lagda.md @@ -13,6 +13,7 @@ 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.hilberts-epsilon-operators open import foundation.logical-equivalences open import foundation.negation @@ -45,7 +46,7 @@ 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 @@ -58,29 +59,6 @@ is-decidable-fam : 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 ### The unit type and the empty type are decidable @@ -112,7 +90,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 +98,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,21 +121,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 B → is-decidable (A → B) --- is-decidable-function-type'' (inl b) = inl (λ _ → b) --- is-decidable-function-type'' (inr nb) = inr λ f → {! nb !} - 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) ``` @@ -301,23 +272,6 @@ idempotent-is-decidable P (inl (inr np)) = inr np idempotent-is-decidable P (inr np) = inr (λ p → np (inl p)) ``` -### 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 -``` - ### Any inhabited type is a fixed point for `is-decidable` ```agda @@ -338,51 +292,6 @@ module _ is-decidable-raise = is-decidable-equiv' (compute-raise l A) ``` -### 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 - -```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) -``` - ## See also - That decidablity is irrefutable is shown in 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/functoriality-truncation.lagda.md b/src/foundation/functoriality-truncation.lagda.md index 92e1760616..3708abf21b 100644 --- a/src/foundation/functoriality-truncation.lagda.md +++ b/src/foundation/functoriality-truncation.lagda.md @@ -131,7 +131,7 @@ module _ ( preserves-comp-map-trunc k (map-inv-equiv e) (map-equiv e)) ∙h ( htpy-trunc (is-retraction-map-inv-equiv e) ∙h id-map-trunc k)) - equiv-trunc : (type-trunc k A ≃ type-trunc k B) + equiv-trunc : type-trunc k A ≃ type-trunc k B pr1 equiv-trunc = map-equiv-trunc pr2 equiv-trunc = is-equiv-map-equiv-trunc ``` diff --git a/src/foundation/mere-equality.lagda.md b/src/foundation/mere-equality.lagda.md index c36b3c92e0..44b9848f13 100644 --- a/src/foundation/mere-equality.lagda.md +++ b/src/foundation/mere-equality.lagda.md @@ -10,9 +10,13 @@ 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.equality-dependent-pair-types +open import foundation.equivalences open import foundation.functoriality-propositional-truncation 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 +32,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 +49,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 @@ -54,6 +65,10 @@ abstract refl-mere-eq : {l : Level} {A : UU l} → is-reflexive (mere-eq {l} {A}) refl-mere-eq _ = unit-trunc-Prop refl + +mere-eq-eq : + {l : Level} {A : UU l} {x y : A} → x = y → mere-eq x y +mere-eq-eq = unit-trunc-Prop ``` ### Symmetry @@ -121,3 +136,50 @@ is-set-mere-eq-in-id = ( is-prop-mere-eq) ( refl-mere-eq) ``` + +### Retracts of types with mere equality + +```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 mere equality + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} + (mA : all-elements-merely-equal A) + (mB : (x : A) → all-elements-merely-equal (B x)) + where + + all-elements-merely-equal-Σ : all-elements-merely-equal (Σ A B) + all-elements-merely-equal-Σ x y = + rec-trunc-Prop + ( mere-eq-Prop x y) + ( λ p → + rec-trunc-Prop + ( mere-eq-Prop x y) + ( λ q → unit-trunc-Prop (eq-pair-Σ p q)) + ( mB (pr1 y) (tr B p (pr2 x)) (pr2 y))) + ( mA (pr1 x) (pr1 y)) +``` diff --git a/src/foundation/perfect-images.lagda.md b/src/foundation/perfect-images.lagda.md index 027068873f..63b1bb19e2 100644 --- a/src/foundation/perfect-images.lagda.md +++ b/src/foundation/perfect-images.lagda.md @@ -10,7 +10,9 @@ module foundation.perfect-images where open import elementary-number-theory.natural-numbers open import foundation.action-on-identifications-functions -open import foundation.contractible-maps +open import foundation.connected-maps +open import foundation.coproduct-types +open import foundation.decidable-dependent-function-types open import foundation.decidable-embeddings open import foundation.decidable-maps open import foundation.decidable-propositions @@ -22,15 +24,16 @@ open import foundation.functoriality-dependent-function-types open import foundation.iterated-dependent-product-types open import foundation.iterating-functions open import foundation.law-of-excluded-middle +open import foundation.mere-equality open import foundation.negated-equality open import foundation.negation +open import foundation.pi-0-trivial-maps open import foundation.type-arithmetic-dependent-function-types open import foundation.universal-property-dependent-pair-types open import foundation.universe-levels open import foundation.weak-limited-principle-of-omniscience open import foundation-core.cartesian-product-types -open import foundation-core.coproduct-types open import foundation-core.embeddings open import foundation-core.empty-types open import foundation-core.equivalences @@ -84,13 +87,16 @@ module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} (f : A → B) (g : B → A) where + is-perfect-image-at' : A → ℕ → UU (l1 ⊔ l2) + is-perfect-image-at' a n = (p : fiber (iterate n (g ∘ f)) a) → fiber g (pr1 p) + is-perfect-image' : (a : A) → UU (l1 ⊔ l2) is-perfect-image' a = - (n : ℕ) → (p : fiber (iterate n (g ∘ f)) a) → fiber g (pr1 p) + (n : ℕ) → is-perfect-image-at' a n - equiv-is-perfect-image-is-perfect-image' : + compute-is-perfect-image : (a : A) → is-perfect-image' a ≃ is-perfect-image f g a - equiv-is-perfect-image-is-perfect-image' a = + compute-is-perfect-image a = equivalence-reasoning ((n : ℕ) (p : fiber (iterate n (g ∘ f)) a) → fiber g (pr1 p)) ≃ ((n : ℕ) (a₀ : A) → iterate n (g ∘ f) a₀ = a → fiber g a₀) @@ -113,7 +119,7 @@ module _ Σ A (λ a₀ → Σ ℕ (λ n → (iterate n (g ∘ f) a₀ = a) × ¬ (fiber g a₀))) ``` -### Not perfect fibers over an element +### Nonperfect fibers over an element ```agda module _ @@ -121,28 +127,28 @@ module _ (f : A → B) (g : B → A) where - has-not-perfect-fiber : (b : B) → UU (l1 ⊔ l2) - has-not-perfect-fiber b = + has-nonperfect-fiber : (b : B) → UU (l1 ⊔ l2) + has-nonperfect-fiber b = Σ (fiber f b) (λ s → ¬ (is-perfect-image f g (pr1 s))) - is-prop-has-not-perfect-fiber' : - is-prop-map f → (b : B) → is-prop (has-not-perfect-fiber b) - is-prop-has-not-perfect-fiber' F b = is-prop-Σ (F b) (λ _ → is-prop-neg) + is-prop-has-nonperfect-fiber' : + is-prop-map f → (b : B) → is-prop (has-nonperfect-fiber b) + is-prop-has-nonperfect-fiber' F b = is-prop-Σ (F b) (λ _ → is-prop-neg) - is-prop-has-not-perfect-fiber : - is-emb f → (b : B) → is-prop (has-not-perfect-fiber b) - is-prop-has-not-perfect-fiber F = - is-prop-has-not-perfect-fiber' (is-prop-map-is-emb F) + is-prop-has-nonperfect-fiber : + is-emb f → (b : B) → is-prop (has-nonperfect-fiber b) + is-prop-has-nonperfect-fiber F = + is-prop-has-nonperfect-fiber' (is-prop-map-is-emb F) - has-not-perfect-fiber-Prop' : + has-nonperfect-fiber-Prop' : is-prop-map f → (b : B) → Prop (l1 ⊔ l2) - has-not-perfect-fiber-Prop' F b = - ( has-not-perfect-fiber b , is-prop-has-not-perfect-fiber' F b) + has-nonperfect-fiber-Prop' F b = + ( has-nonperfect-fiber b , is-prop-has-nonperfect-fiber' F b) - has-not-perfect-fiber-Prop : + has-nonperfect-fiber-Prop : is-emb f → (b : B) → Prop (l1 ⊔ l2) - has-not-perfect-fiber-Prop F b = - ( has-not-perfect-fiber b , is-prop-has-not-perfect-fiber F b) + has-nonperfect-fiber-Prop F b = + ( has-nonperfect-fiber b , is-prop-has-nonperfect-fiber F b) ``` ## Properties @@ -170,50 +176,42 @@ If `a` is a perfect image for `g`, then `a` has a preimage under `g`. Just take ```agda module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} where - fiber-is-perfect-image : - {f : A → B} {g : B → A} → (a : A) → - is-perfect-image f g a → fiber g a + fiber-is-perfect-image : (a : A) → is-perfect-image f g a → fiber g a fiber-is-perfect-image a ρ = ρ a 0 refl ``` One can define a map from `A` to `B` restricting the domain to the perfect -images of `g`. This gives a kind of [section](foundation-core.sections.md) of g. -When g is also an embedding, the map gives a kind of -[retraction](foundation-core.retractions.md) of g. +images of `g`. This gives a kind of [section](foundation-core.sections.md) of +`g`. When `g` is also an embedding, the map gives a kind of +[retraction](foundation-core.retractions.md) of `g`. ```agda module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} where - inverse-of-perfect-image : - (a : A) → is-perfect-image f g a → B - inverse-of-perfect-image a ρ = - pr1 (fiber-is-perfect-image a ρ) + inverse-of-perfect-image : (a : A) → is-perfect-image f g a → B + inverse-of-perfect-image a ρ = pr1 (fiber-is-perfect-image a ρ) is-section-inverse-of-perfect-image : - (a : A) (ρ : is-perfect-image f g a) → - g (inverse-of-perfect-image a ρ) = a - is-section-inverse-of-perfect-image a ρ = - pr2 (fiber-is-perfect-image a ρ) + (a : A) (ρ : is-perfect-image f g a) → g (inverse-of-perfect-image a ρ) = a + is-section-inverse-of-perfect-image a ρ = pr2 (fiber-is-perfect-image a ρ) ``` ```agda module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} {is-emb-g : is-emb g} + {f : A → B} {g : B → A} (G : is-injective g) where is-retraction-inverse-of-perfect-image : (b : B) (ρ : is-perfect-image f g (g b)) → inverse-of-perfect-image (g b) ρ = b is-retraction-inverse-of-perfect-image b ρ = - is-injective-is-emb - is-emb-g - (is-section-inverse-of-perfect-image (g b) ρ) + G (is-section-inverse-of-perfect-image (g b) ρ) ``` If `g(f(a))` is a perfect image for `g`, so is `a`. @@ -223,10 +221,18 @@ module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} where + previous-perfect-image-at' : + (a : A) (n : ℕ) → + is-perfect-image-at' f g (g (f a)) (succ-ℕ n) → + is-perfect-image-at' f g a n + previous-perfect-image-at' a n γ (a₀ , p) = γ (a₀ , ap (g ∘ f) p) + + previous-perfect-image' : + (a : A) → is-perfect-image' f g (g (f a)) → is-perfect-image' f g a + previous-perfect-image' a γ n = previous-perfect-image-at' a n (γ (succ-ℕ n)) + previous-perfect-image : - (a : A) → - is-perfect-image f g (g (f (a))) → - is-perfect-image f g a + (a : A) → is-perfect-image f g (g (f a)) → is-perfect-image f g a previous-perfect-image a γ a₀ n p = γ a₀ (succ-ℕ n) (ap (g ∘ f) p) ``` @@ -295,11 +301,11 @@ module _ (is-injective-g : is-injective g) (b : B) where - has-not-perfect-fiber-is-nonperfect-image : - is-nonperfect-image {f = f} (g b) → has-not-perfect-fiber f g b - has-not-perfect-fiber-is-nonperfect-image (x₀ , zero-ℕ , u) = + has-nonperfect-fiber-is-nonperfect-image : + is-nonperfect-image {f = f} (g b) → has-nonperfect-fiber f g b + has-nonperfect-fiber-is-nonperfect-image (x₀ , zero-ℕ , u) = ex-falso (pr2 u (b , inv (pr1 u))) - has-not-perfect-fiber-is-nonperfect-image (x₀ , succ-ℕ n , u) = + has-nonperfect-fiber-is-nonperfect-image (x₀ , succ-ℕ n , u) = ( iterate n (g ∘ f) x₀ , is-injective-g (pr1 u)) , ( λ s → pr2 u (s x₀ n refl)) @@ -308,32 +314,31 @@ module _ {f : A → B} {g : B → A} (is-double-negation-eliminating-g : is-double-negation-eliminating-map g) (is-injective-g : is-injective g) - (b : B) - (nρ : ¬ (is-perfect-image f g (g b))) + (b : B) (nρ : ¬ (is-perfect-image f g (g b))) where - not-not-has-has-not-perfect-fiber-is-not-perfect-image' : - ¬¬ (has-not-perfect-fiber f g b) - not-not-has-has-not-perfect-fiber-is-not-perfect-image' t = + not-not-has-nonperfect-fiber-is-not-perfect-image : + ¬¬ (has-nonperfect-fiber f g b) + not-not-has-nonperfect-fiber-is-not-perfect-image t = not-not-is-nonperfect-image ( is-double-negation-eliminating-g) ( b) ( nρ) - ( λ s → t (has-not-perfect-fiber-is-nonperfect-image is-injective-g b s)) + ( λ s → t (has-nonperfect-fiber-is-nonperfect-image is-injective-g b s)) module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} (is-double-negation-eliminating-f : is-double-negation-eliminating-map f) - (is-prop-map-f : is-prop-map f) + (is-π₀-trivial-f : is-π₀-trivial-map' f) (b : B) where - is-double-negation-stable-has-not-perfect-fiber : - is-double-negation-stable (has-not-perfect-fiber-Prop' f g is-prop-map-f b) - is-double-negation-stable-has-not-perfect-fiber = - double-negation-elim-Σ-is-prop-base - ( is-prop-map-f b) + double-negation-elim-has-nonperfect-fiber : + has-double-negation-elim (has-nonperfect-fiber f g b) + double-negation-elim-has-nonperfect-fiber = + double-negation-elim-Σ-all-elements-merely-equal-base + ( is-π₀-trivial-f b) ( is-double-negation-eliminating-f b) ( λ p → double-negation-elim-neg (is-perfect-image f g (pr1 p))) @@ -343,78 +348,127 @@ module _ (is-double-negation-eliminating-g : is-double-negation-eliminating-map g) (is-injective-g : is-injective g) (is-double-negation-eliminating-f : is-double-negation-eliminating-map f) - (is-prop-map-f : is-prop-map f) + (is-π₀-trivial-f : is-π₀-trivial-map' f) (b : B) (nρ : ¬ (is-perfect-image f g (g b))) where - has-not-perfect-fiber-is-not-perfect-image' : - has-not-perfect-fiber f g b - has-not-perfect-fiber-is-not-perfect-image' = - is-double-negation-stable-has-not-perfect-fiber + has-nonperfect-fiber-is-not-perfect-image : + has-nonperfect-fiber f g b + has-nonperfect-fiber-is-not-perfect-image = + double-negation-elim-has-nonperfect-fiber ( is-double-negation-eliminating-f) - ( is-prop-map-f) + ( is-π₀-trivial-f) ( b) - ( not-not-has-has-not-perfect-fiber-is-not-perfect-image' + ( not-not-has-nonperfect-fiber-is-not-perfect-image ( is-double-negation-eliminating-g) ( is-injective-g) ( b) ( nρ)) + fiber-has-nonperfect-fiber-is-not-perfect-image : fiber f b + fiber-has-nonperfect-fiber-is-not-perfect-image = + pr1 has-nonperfect-fiber-is-not-perfect-image + + element-has-nonperfect-fiber-is-not-perfect-image : A + element-has-nonperfect-fiber-is-not-perfect-image = + pr1 fiber-has-nonperfect-fiber-is-not-perfect-image + + is-in-fiber-element-has-nonperfect-fiber-is-not-perfect-image : + f element-has-nonperfect-fiber-is-not-perfect-image = b + is-in-fiber-element-has-nonperfect-fiber-is-not-perfect-image = + pr2 fiber-has-nonperfect-fiber-is-not-perfect-image + + is-not-perfect-image-has-nonperfect-fiber-is-not-perfect-image : + ¬ (is-perfect-image f g element-has-nonperfect-fiber-is-not-perfect-image) + is-not-perfect-image-has-nonperfect-fiber-is-not-perfect-image = + pr2 has-nonperfect-fiber-is-not-perfect-image + module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} - (G : is-double-negation-stable-emb g) - (F : is-double-negation-stable-emb f) + {l1 : Level} {A : UU l1} {f : A → A} + (is-decidable-f : is-decidable-map f) + (is-π₀-trivial-f : is-π₀-trivial-map' f) + where + + is-decidable-map-iterate-is-π₀-trivial-map' : + (n : ℕ) → is-decidable-map (iterate n f) + is-decidable-map-iterate-is-π₀-trivial-map' zero-ℕ = is-decidable-map-id + is-decidable-map-iterate-is-π₀-trivial-map' (succ-ℕ n) = + is-decidable-map-comp-is-π₀-trivial-map' + ( is-π₀-trivial-f) + ( is-decidable-f) + ( is-decidable-map-iterate-is-π₀-trivial-map' n) + +module _ + {l1 : Level} {A : UU l1} {f : A → A} + (is-π₀-trivial-f : is-π₀-trivial-map' f) + where + + is-π₀-trivial-map'-iterate : + (n : ℕ) → is-π₀-trivial-map' (iterate n f) + is-π₀-trivial-map'-iterate zero-ℕ = is-π₀-trivial-map'-id + is-π₀-trivial-map'-iterate (succ-ℕ n) = + is-π₀-trivial-map'-comp is-π₀-trivial-f (is-π₀-trivial-map'-iterate n) +``` + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (G : is-decidable-emb g) (F : is-decidable-map f) (F' : is-π₀-trivial-map' f) where - has-not-perfect-fiber-is-not-perfect-image : - (b : B) → ¬ (is-perfect-image f g (g b)) → - has-not-perfect-fiber f g b - has-not-perfect-fiber-is-not-perfect-image = - has-not-perfect-fiber-is-not-perfect-image' - ( is-double-negation-eliminating-map-is-double-negation-stable-emb G) - ( is-injective-is-double-negation-stable-emb G) - ( is-double-negation-eliminating-map-is-double-negation-stable-emb F) - ( is-prop-map-is-double-negation-stable-emb F) + is-decidable-prop-is-perfect-image-at' : + (a : A) (n : ℕ) → is-decidable-prop (is-perfect-image-at' f g a n) + is-decidable-prop-is-perfect-image-at' a n = + is-decidable-prop-Π-all-elements-merely-equal-base + ( λ x → + fiber g (pr1 x) , + is-decidable-prop-map-is-decidable-emb G (pr1 x)) + ( is-π₀-trivial-map'-iterate + ( is-π₀-trivial-map'-comp + ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb G)) + ( F')) + ( n) + ( a)) + ( is-decidable-map-iterate-is-π₀-trivial-map' + ( is-decidable-map-comp-is-π₀-trivial-map' + ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb G)) + ( is-decidable-map-is-decidable-emb G) + ( F)) + ( is-π₀-trivial-map'-comp + ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb G)) + ( F')) + ( n) + ( a)) ``` ### Assuming the weak limited principle of omniscience ```agda module _ - {l1 l2 : Level} (wlpo : level-WLPO (l1 ⊔ l2)) {A : UU l1} {B : UU l2} + {l1 l2 : Level} + (wlpo : level-WLPO (l1 ⊔ l2)) + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (is-decidable-emb-g : is-decidable-emb g) - (is-decidable-emb-f : is-decidable-emb f) + (G : is-decidable-emb g) + (F : is-decidable-map f) + (F' : is-π₀-trivial-map' f) where - is-decidable-emb-iterate-comp : (n : ℕ) → is-decidable-emb (iterate n (g ∘ f)) - is-decidable-emb-iterate-comp zero-ℕ = is-decidable-emb-id - is-decidable-emb-iterate-comp (succ-ℕ n) = - is-decidable-emb-comp - ( is-decidable-emb-comp is-decidable-emb-g is-decidable-emb-f) - ( is-decidable-emb-iterate-comp n) - - is-decidable-is-perfect-image'-WLPO : - (a : A) → is-decidable (is-perfect-image' f g a) - is-decidable-is-perfect-image'-WLPO a = - wlpo - ( λ n → - Π-Decidable-Prop - ( fiber (iterate n (g ∘ f)) a , - is-decidable-prop-map-is-decidable-emb - ( is-decidable-emb-iterate-comp n) - ( a)) - ( λ p → - fiber g (pr1 p) , - is-decidable-prop-map-is-decidable-emb is-decidable-emb-g (pr1 p))) + abstract + is-decidable-is-perfect-image'-WLPO : + (a : A) → is-decidable (is-perfect-image' f g a) + is-decidable-is-perfect-image'-WLPO a = + wlpo + ( λ n → + is-perfect-image-at' f g a n , + is-decidable-prop-is-perfect-image-at' G F F' a n) is-decidable-is-perfect-image-WLPO : (a : A) → is-decidable (is-perfect-image f g a) is-decidable-is-perfect-image-WLPO a = is-decidable-equiv' - ( equiv-is-perfect-image-is-perfect-image' f g a) + ( compute-is-perfect-image f g a) ( is-decidable-is-perfect-image'-WLPO a) ``` @@ -468,16 +522,16 @@ module _ (is-emb-f : is-emb f) (is-emb-g : is-emb g) where - has-not-perfect-fiber-is-not-perfect-image-LEM : + has-nonperfect-fiber-is-not-perfect-image-LEM : (b : B) → ¬ (is-perfect-image f g (g b)) → - has-not-perfect-fiber f g b - has-not-perfect-fiber-is-not-perfect-image-LEM = - has-not-perfect-fiber-is-not-perfect-image' + has-nonperfect-fiber f g b + has-nonperfect-fiber-is-not-perfect-image-LEM = + has-nonperfect-fiber-is-not-perfect-image ( is-double-negation-eliminating-map-is-decidable-map ( λ y → lem (fiber g y , is-prop-map-is-emb is-emb-g y))) ( is-injective-is-emb is-emb-g) ( is-double-negation-eliminating-map-is-decidable-map ( λ y → lem (fiber f y , is-prop-map-is-emb is-emb-f y))) - ( is-prop-map-is-emb is-emb-f) + ( λ y p q → mere-eq-eq (eq-is-prop (is-prop-map-is-emb is-emb-f y))) ``` diff --git a/src/foundation/pi-0-trivial-maps.lagda.md b/src/foundation/pi-0-trivial-maps.lagda.md new file mode 100644 index 0000000000..58d41d6d8b --- /dev/null +++ b/src/foundation/pi-0-trivial-maps.lagda.md @@ -0,0 +1,95 @@ +# π₀-trivial maps + +```agda +module foundation.pi-0-trivial-maps where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +open import foundation.cartesian-morphisms-arrows +open import foundation.coproduct-types +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.functoriality-cartesian-product-types +open import foundation.functoriality-coproduct-types +open import foundation.identity-types +open import foundation.iterating-functions +open import foundation.mere-equality +open import foundation.retracts-of-maps +open import foundation.universe-levels + +open import foundation-core.contractible-maps +open import foundation-core.contractible-types +open import foundation-core.embeddings +open import foundation-core.empty-types +open import foundation-core.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.injective-maps +open import foundation-core.propositional-maps +open import foundation-core.propositions +open import foundation-core.retractions +open import foundation-core.sections +``` + +
+ +## Idea + +A [map](foundation-core.function-types.md) is said to be +{{#concept "π₀-trivial" Disambiguation="map of types" Agda=is-π₀-trivial-map}} +if its [fibers](foundation-core.fibers-of-maps.md) are π₀-trivial. + +## Definitions + +### π₀-trivial maps as maps whose fibers are types with mere equality + +```agda +is-π₀-trivial-map' : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → (A → B) → UU (l1 ⊔ l2) +is-π₀-trivial-map' {B = B} f = + (y : B) → all-elements-merely-equal (fiber f y) +``` + +## Properties + +### Embeddings are π₀-trivial + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} + where + + abstract + is-π₀-trivial-map'-is-prop-map : is-prop-map f → is-π₀-trivial-map' f + is-π₀-trivial-map'-is-prop-map H b x y = mere-eq-eq (eq-is-prop (H b)) + + abstract + is-π₀-trivial-map'-is-emb : is-emb f → is-π₀-trivial-map' f + is-π₀-trivial-map'-is-emb H = + is-π₀-trivial-map'-is-prop-map (is-prop-map-is-emb H) + +is-π₀-trivial-map'-id : {l : Level} {A : UU l} → is-π₀-trivial-map' (id {A = A}) +is-π₀-trivial-map'-id = is-π₀-trivial-map'-is-emb is-emb-id +``` + +### Composition of π₀-trivial maps + +```agda +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {g : B → C} {f : A → B} + where + + abstract + is-π₀-trivial-map'-comp : + is-π₀-trivial-map' g → is-π₀-trivial-map' f → is-π₀-trivial-map' (g ∘ f) + is-π₀-trivial-map'-comp G F y = + all-elements-merely-equal-equiv + ( compute-fiber-comp g f y) + ( all-elements-merely-equal-Σ (G y) (F ∘ pr1)) +``` diff --git a/src/foundation/truncations.lagda.md b/src/foundation/truncations.lagda.md index 9523e78045..c6a01e227b 100644 --- a/src/foundation/truncations.lagda.md +++ b/src/foundation/truncations.lagda.md @@ -361,6 +361,10 @@ module _ is-equiv-unit-trunc-is-contr : is-contr A → is-equiv unit-trunc is-equiv-unit-trunc-is-contr c = is-equiv-unit-trunc (A , is-trunc-is-contr k c) + + is-contr-type-trunc : is-contr A → is-contr (type-trunc k A) + is-contr-type-trunc H = + is-contr-is-equiv' A unit-trunc (is-equiv-unit-trunc-is-contr H) H ``` ### Truncation is idempotent diff --git a/src/foundation/uniformly-decidable-type-families.lagda.md b/src/foundation/uniformly-decidable-type-families.lagda.md index 01904ea182..16e6fcc810 100644 --- a/src/foundation/uniformly-decidable-type-families.lagda.md +++ b/src/foundation/uniformly-decidable-type-families.lagda.md @@ -9,13 +9,17 @@ module foundation.uniformly-decidable-type-families where ```agda 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.equality-coproduct-types +open import foundation.functoriality-coproduct-types open import foundation.inhabited-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.truncated-types open import foundation.truncation-levels open import foundation.type-arithmetic-empty-type @@ -28,6 +32,8 @@ 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 +69,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 _ @@ -173,3 +179,51 @@ module _ ( succ-𝕋 (succ-𝕋 k)) H _ = is-trunc-succ-succ-is-uniformly-decidable-family k H ``` + +### A family of decidable propositions over a π₀-trivial decidable base are uniformly decidable + +```agda +module _ + {l1 l2 : Level} {A : UU l1} (B : A → Decidable-Prop l2) + (H : all-elements-merely-equal A) + where + + abstract + is-uniformly-decidable-family-all-elements-merely-equal-base : + is-decidable A → + is-uniformly-decidable-family (type-Decidable-Prop ∘ B) + is-uniformly-decidable-family-all-elements-merely-equal-base (inl a) = + rec-coproduct + ( λ b → + inl + ( λ x → + rec-trunc-Prop + ( prop-Decidable-Prop (B x)) + ( λ p → tr (type-Decidable-Prop ∘ B) p b) + ( H a x))) + ( λ nb → + inr + ( λ x b → + rec-trunc-Prop + ( empty-Prop) + ( λ p → nb (tr (type-Decidable-Prop ∘ B) p b)) + ( H x a))) + ( is-decidable-Decidable-Prop (B a)) + is-uniformly-decidable-family-all-elements-merely-equal-base (inr na) = + inr (ex-falso ∘ na) + + abstract + is-uniformly-decidable-family-all-elements-merely-equal-base' : + is-inhabited-or-empty A → + is-uniformly-decidable-family (type-Decidable-Prop ∘ B) + is-uniformly-decidable-family-all-elements-merely-equal-base' (inl |a|) = + rec-trunc-Prop + ( is-uniformly-decidable-family (type-Decidable-Prop ∘ B) , + is-prop-is-uniformly-decidable-family-is-inhabited-base + ( is-prop-type-Decidable-Prop ∘ B) + ( |a|)) + ( is-uniformly-decidable-family-all-elements-merely-equal-base ∘ inl) + ( |a|) + is-uniformly-decidable-family-all-elements-merely-equal-base' (inr na) = + is-uniformly-decidable-family-all-elements-merely-equal-base (inr na) +``` diff --git a/src/logic.lagda.md b/src/logic.lagda.md index 4f76bcf78b..7822966c07 100644 --- a/src/logic.lagda.md +++ b/src/logic.lagda.md @@ -20,4 +20,6 @@ open import logic.double-negation-stable-embeddings public open import logic.double-negation-stable-subtypes 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-types public ``` diff --git a/src/logic/double-negation-elimination.lagda.md b/src/logic/double-negation-elimination.lagda.md index 6fd70fe6e7..17d99c5022 100644 --- a/src/logic/double-negation-elimination.lagda.md +++ b/src/logic/double-negation-elimination.lagda.md @@ -17,7 +17,9 @@ open import foundation.empty-types open import foundation.evaluation-functions open import foundation.hilberts-epsilon-operators 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.unit-type @@ -188,7 +190,7 @@ module _ double-negation-elim-for-all : ((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-for-all H f p = H p (map-double-negation (ev p) f) ``` ### Double negation elimination for function types into double negations @@ -220,45 +222,82 @@ double-negation-elim-is-decidable = double-negation-elim-is-decidable ### 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) +module _ + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} + where + + 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 f g h = + ( f ( map-double-negation pr1 h)) , + ( g ( f ( map-double-negation pr1 h)) + ( λ nb → + h ( λ x → + rec-trunc-Prop + ( empty-Prop) + ( λ p → nb (tr B p (pr2 x))) + ( H (pr1 x) (f ( map-double-negation pr1 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 f g h = + ( f ( map-double-negation pr1 h)) , + ( g ( f ( map-double-negation pr1 h)) + ( map-double-negation (tr B (eq-is-prop is-prop-A) ∘ pr2) h)) + + double-negation-elim-Σ-is-decidable-prop-base : + is-decidable-prop A → + ((x : A) → has-double-negation-elim (B x)) → + has-double-negation-elim (Σ A 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-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 (λ nab → nnb (λ y → nab (x , y))))) ``` ### 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)) +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)) ``` ### 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 + {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 ``` 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..d558bc25e0 --- /dev/null +++ b/src/logic/propositional-double-negation-elimination.lagda.md @@ -0,0 +1,265 @@ +# 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-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.evaluation-functions +open import foundation.functoriality-propositional-truncation +open import foundation.hilberts-epsilon-operators +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.unit-type +open import foundation.universe-levels + +open import foundation-core.contractible-types +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 there is a map + +```text + ¬¬A → ║A║₋₁. +``` + +## Definitions + +### Untruncated 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-Σ-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 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 → + rec-trunc-Prop + ( empty-Prop) + ( λ p → nb (tr B p (pr2 x))) + ( H (pr1 x) a))))) + ( f (map-double-negation pr1 nnab)) + + 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-types.lagda.md b/src/logic/propositionally-decidable-types.lagda.md new file mode 100644 index 0000000000..781343e5ff --- /dev/null +++ b/src/logic/propositionally-decidable-types.lagda.md @@ -0,0 +1,367 @@ +# Propositionally decidable types + +```agda +module logic.propositionally-decidable-types where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-functions +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.double-negation +open import foundation.empty-types +open import foundation.equivalences +open import foundation.functoriality-coproduct-types +open import foundation.hilberts-epsilon-operators +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.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.decidable-propositions +open import foundation-core.function-types +open import foundation-core.propositions +open import foundation-core.retractions +open import foundation-core.sections +``` + +
+ +## 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/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/synthetic-homotopy-theory/pushouts.lagda.md b/src/synthetic-homotopy-theory/pushouts.lagda.md index 1b5112681f..668726e90b 100644 --- a/src/synthetic-homotopy-theory/pushouts.lagda.md +++ b/src/synthetic-homotopy-theory/pushouts.lagda.md @@ -175,7 +175,20 @@ module _ ( c) ( compute-inl-dependent-cogap) ( compute-inr-dependent-cogap) +``` + +For reference, the unfolded type signature for `compute-glue-dependent-cogap` is +as follows: + +```text + (s : S) → + ( apd dependent-cogap (glue-pushout f g s) ∙ + compute-inr-dependent-cogap (g s)) = + ( ap (tr P (glue-pushout f g s)) (compute-inl-dependent-cogap (f s)) ∙ + coherence-square-dependent-cocone f g (cocone-pushout f g) P c s) +``` +```agda htpy-compute-dependent-cogap : htpy-dependent-cocone f g ( cocone-pushout f g) diff --git a/src/univalent-combinatorics/counting.lagda.md b/src/univalent-combinatorics/counting.lagda.md index aec4b66b23..b03f64c4e2 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/dependent-pair-types.lagda.md b/src/univalent-combinatorics/dependent-pair-types.lagda.md index 932efc1d7a..843cd79854 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 e92ae82979..29ff3b2a18 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 From 3f4868bffcf64dbe4c76765e4628d1f9e376e9a9 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 21 Jan 2025 21:21:14 +0100 Subject: [PATCH 80/83] work --- src/foundation-core.lagda.md | 1 + .../iterating-functions.lagda.md | 123 ++++++ src/foundation.lagda.md | 1 + .../cantor-schroder-bernstein-wlpo.lagda.md | 134 +++++-- .../decidable-dependent-pair-types.lagda.md | 26 ++ src/foundation/decidable-maps.lagda.md | 92 +++-- src/foundation/iterating-functions.lagda.md | 99 +---- ...-limited-principle-of-omniscience.lagda.md | 12 +- ...ps-with-hilbert-epsilon-operators.lagda.md | 65 ++++ src/foundation/perfect-images.lagda.md | 231 +++-------- src/foundation/pi-0-trivial-maps.lagda.md | 15 +- src/logic.lagda.md | 2 + ...ional-double-negation-elimination.lagda.md | 6 +- .../propositionally-decidable-maps.lagda.md | 321 ++++++++++++++++ .../propositionally-decidable-types.lagda.md | 7 +- ...-double-negation-eliminating-maps.lagda.md | 359 ++++++++++++++++++ 16 files changed, 1160 insertions(+), 334 deletions(-) create mode 100644 src/foundation-core/iterating-functions.lagda.md create mode 100644 src/foundation/maps-with-hilbert-epsilon-operators.lagda.md create mode 100644 src/logic/propositionally-decidable-maps.lagda.md create mode 100644 src/logic/propositionally-double-negation-eliminating-maps.lagda.md diff --git a/src/foundation-core.lagda.md b/src/foundation-core.lagda.md index 9b9dd2512c..ea01876a8c 100644 --- a/src/foundation-core.lagda.md +++ b/src/foundation-core.lagda.md @@ -36,6 +36,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/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.lagda.md b/src/foundation.lagda.md index 1a479d5418..64eb838802 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -271,6 +271,7 @@ open import foundation.locally-small-types public open import foundation.logical-equivalences public open import foundation.maps-in-global-subuniverses public open import foundation.maps-in-subuniverses public +open import foundation.maps-with-hilbert-epsilon-operators public open import foundation.maybe public open import foundation.mere-embeddings public open import foundation.mere-equality public diff --git a/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md b/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md index b9f1d3d885..49a416fc04 100644 --- a/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md +++ b/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md @@ -1,4 +1,4 @@ -# The Cantor–Schröder–Bernstein-WLPO theorem +# The Cantor–Schröder–Bernstein-Escardó theorem ```agda module foundation.cantor-schroder-bernstein-wlpo where @@ -7,17 +7,24 @@ module foundation.cantor-schroder-bernstein-wlpo where
Imports ```agda +open import elementary-number-theory.natural-numbers + open import foundation.action-on-identifications-functions 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 open import foundation.function-types open import foundation.functoriality-dependent-pair-types open import foundation.injective-maps open import foundation.law-of-excluded-middle +open import foundation.maps-with-hilbert-epsilon-operators open import foundation.perfect-images open import foundation.pi-0-trivial-maps +open import foundation.propositional-truncations +open import foundation.propositions open import foundation.sections open import foundation.split-surjective-maps open import foundation.universe-levels @@ -30,6 +37,7 @@ open import foundation-core.equivalences open import foundation-core.fibers-of-maps open import foundation-core.identity-types open import foundation-core.negation +open import foundation-core.propositional-maps open import foundation-core.sets open import logic.double-negation-eliminating-maps @@ -59,16 +67,18 @@ an equivalence. module _ {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (F : is-double-negation-eliminating-map f) - (G : is-double-negation-eliminating-map g) (G' : is-injective g) + (G : is-double-negation-eliminating-map g) + (F : is-double-negation-eliminating-map f) where map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : (x : A) → is-decidable (is-perfect-image f g x) → B - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x (inl y) = - inverse-of-perfect-image x y - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x (inr y) = + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + x (inl γ) = + inverse-of-perfect-image x γ + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + x (inr nγ) = f x compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : @@ -78,11 +88,11 @@ module _ map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein ( g y) d = y - compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein y γ - ( inl v') = + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + y γ (inl v') = is-retraction-inverse-of-perfect-image G' y v' - compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein y γ - ( inr v) = + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + y γ (inr v) = ex-falso (v γ) compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein : @@ -131,16 +141,21 @@ module _ F' y d) ( d') = y - is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein F' y (inl γ) = - compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein y γ - is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein F' y (inr nγ) = + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' y (inl γ) = + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + y γ + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + F' y (inr nγ) = compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein F' y nγ map-construction-Cantor-Schröder-Bernstein : (D : (x : A) → is-decidable (is-perfect-image f g x)) → A → B map-construction-Cantor-Schröder-Bernstein D x = - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x (D x) + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + ( x) + ( D x) map-section-construction-Cantor-Schröder-Bernstein : (F' : is-π₀-trivial-map' f) → @@ -181,8 +196,12 @@ Injectivity of the constructed map. {x x' : A} (d : is-decidable (is-perfect-image f g x)) (d' : is-decidable (is-perfect-image f g x')) → - ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x d) = - ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein x' d') → + ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + ( x) + ( d)) = + ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein + ( x') + ( d')) → x = x' is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein F' { x} {x'} (inl ρ) (inl ρ') p = @@ -238,18 +257,42 @@ Therefore, `A ≃ B`. In fact, it suffices to assume that `f` is decidable, π₀-trivial, and injective. +```agda +module _ + {l1 l2 : Level} (wlpo : level-WLPO (l1 ⊔ l2)) + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (G : is-decidable-emb g) (F : is-decidable-map f) (F' : is-π₀-trivial-map' f) + where + + abstract + is-decidable-is-perfect-image'-WLPO : + (a : A) → is-decidable (is-perfect-image' f g a) + is-decidable-is-perfect-image'-WLPO a = + wlpo + ( λ n → + is-perfect-image-at' f g a n , + is-decidable-prop-is-perfect-image-at' G F F' a n) + + is-decidable-is-perfect-image-WLPO : + (a : A) → is-decidable (is-perfect-image f g a) + is-decidable-is-perfect-image-WLPO a = + is-decidable-equiv' + ( compute-is-perfect-image f g a) + ( is-decidable-is-perfect-image'-WLPO a) +``` + ```agda generalized-Cantor-Schröder-Bernstein-WLPO : {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → - {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (G : is-decidable-emb g) → - (F : is-decidable-map f) (F' : is-π₀-trivial-map' f) (F'' : is-injective f) → + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} → + is-decidable-emb g → + is-decidable-map f → is-π₀-trivial-map' f → is-injective f → A ≃ B generalized-Cantor-Schröder-Bernstein-WLPO wlpo G F F' F'' = equiv-construction-Cantor-Schröder-Bernstein - ( is-double-negation-eliminating-map-is-decidable-map F) - ( is-double-negation-eliminating-map-is-decidable-emb G) ( is-injective-is-decidable-emb G) + ( is-double-negation-eliminating-map-is-decidable-emb G) + ( is-double-negation-eliminating-map-is-decidable-map F) ( F') ( F'') ( is-decidable-is-perfect-image-WLPO wlpo @@ -275,19 +318,54 @@ Cantor-Schröder-Bernstein-WLPO wlpo (f , F) (g , G) = Cantor-Schröder-Bernstein-WLPO' wlpo G F ``` -### The generalized Cantor-Schröder-Bernstein-Escardó theorem assuming the law of excluded middle +### The slightly generalized Cantor-Schröder-Bernstein-Escardó theorem assuming the law of excluded middle -Assuming the law of excluded middle, then given two types `A` and `B` such that -there is a π₀-trivial injection `A → B` and an embedding `B ↪ A`, then `A` and -`B` are equivalent. +Assuming the [law of exluded middle](foundation.law-of-excluded-middle.md), then +given two types `A` and `B` such that there is a π₀-trivial injection `A → B` +equipped with a Hilbert ε-operator, and an embedding `B ↪ A`, then `A` and `B` +are equivalent. -```text +```agda generalized-Cantor-Schröder-Bernstein-LEM : {l1 l2 : Level} → LEM (l1 ⊔ l2) → {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (G : is-emb g) → (F : is-π₀-trivial-map' f) → (F' : is-injective f) → - (G : is-emb g) → + (εF : ε-operator-map-Hilbert f) → A ≃ B -generalized-Cantor-Schröder-Bernstein-LEM lem F F' G = {! equiv-construction-Cantor-Schröder-Bernstein !} +generalized-Cantor-Schröder-Bernstein-LEM lem {f = f} {g} G F F' εF = + equiv-construction-Cantor-Schröder-Bernstein + ( is-injective-is-emb G) + ( is-double-negation-eliminating-map-is-decidable-map + ( λ y → lem (fiber g y , is-prop-map-is-emb G y))) + ( λ y → + ( λ nnf → + εF + ( y) + ( double-negation-elim-is-decidable + ( lem (trunc-Prop (fiber f y))) + ( map-double-negation unit-trunc-Prop nnf)))) + ( F) + ( F') + ( lem ∘ is-perfect-image-Prop G) +``` + +```agda +Cantor-Schröder-Bernstein-Escardó'' : + {l1 l2 : Level} → LEM (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} → + is-emb g → is-emb f → A ≃ B +Cantor-Schröder-Bernstein-Escardó'' lem {f = f} {g} G F = + Cantor-Schröder-Bernstein-WLPO' + ( λ P → lem (Π-Prop ℕ (prop-Decidable-Prop ∘ P))) + ( G , λ y → lem (fiber g y , is-prop-map-is-emb G y)) + ( F , λ y → lem (fiber f y , is-prop-map-is-emb F y)) + +Cantor-Schröder-Bernstein-Escardó' : + {l1 l2 : Level} → LEM (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} → + A ↪ B → B ↪ A → A ≃ B +Cantor-Schröder-Bernstein-Escardó' lem (f , F) (g , G) = + Cantor-Schröder-Bernstein-Escardó'' lem G F ``` diff --git a/src/foundation/decidable-dependent-pair-types.lagda.md b/src/foundation/decidable-dependent-pair-types.lagda.md index 974d2203cd..557af60d5f 100644 --- a/src/foundation/decidable-dependent-pair-types.lagda.md +++ b/src/foundation/decidable-dependent-pair-types.lagda.md @@ -24,6 +24,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 ```
@@ -115,4 +117,28 @@ is-decidable-Σ-all-elements-merely-equal-base {B = B} H (inl x) K = ( K x) is-decidable-Σ-all-elements-merely-equal-base H (inr nx) K = inr (map-neg pr1 nx) + +is-inhabited-or-empty-Σ-all-elements-merely-equal-base : + {l1 l2 : Level} {A : UU l1} {B : A → UU l2} → + all-elements-merely-equal A → + is-inhabited-or-empty A → + ((x : A) → is-inhabited-or-empty (B x)) → + is-inhabited-or-empty (Σ A B) +is-inhabited-or-empty-Σ-all-elements-merely-equal-base {A = A} {B} H 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 → + rec-trunc-Prop + ( empty-Prop) + ( λ p → nb (tr B p (pr2 x))) + ( H (pr1 x) a))) + ( dB a)) + ( λ na → inr (map-neg pr1 na)) + ( dA) ``` diff --git a/src/foundation/decidable-maps.lagda.md b/src/foundation/decidable-maps.lagda.md index 79f99d4b6a..e1b03edc3c 100644 --- a/src/foundation/decidable-maps.lagda.md +++ b/src/foundation/decidable-maps.lagda.md @@ -7,6 +7,8 @@ module foundation.decidable-maps where
Imports ```agda +open import elementary-number-theory.natural-numbers + open import foundation.action-on-identifications-functions open import foundation.cartesian-morphisms-arrows open import foundation.coproduct-types @@ -33,6 +35,7 @@ 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 foundation-core.retractions open import foundation-core.sections ``` @@ -96,6 +99,43 @@ abstract ( K b) ``` +### Maps with sections are decidable + +```agda +is-decidable-map-section : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → + (i : A → B) → section i → is-decidable-map i +is-decidable-map-section i (s , S) b = inl (s b , S b) +``` + +### Any map out of the empty type is decidable + +```agda +abstract + is-decidable-map-ex-falso : + {l : Level} {X : UU l} → is-decidable-map (ex-falso {l} {X}) + is-decidable-map-ex-falso x = inr pr1 +``` + +### The identity map is decidable + +```agda +abstract + is-decidable-map-id : + {l : Level} {X : UU l} → is-decidable-map (id {l} {X}) + is-decidable-map-id y = inl (y , refl) +``` + +### Equivalences are decidable maps + +```agda +abstract + is-decidable-map-is-equiv : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-equiv f → is-decidable-map f + is-decidable-map-is-equiv H x = inl (center (is-contr-map-is-equiv H x)) +``` + ### Composition of decidable maps The composite `g ∘ f` of two decidable maps is decidable if `g` is injective. @@ -141,6 +181,21 @@ module _ is-decidable-equiv ( compute-fiber-comp g f x) ( is-decidable-Σ-all-elements-merely-equal-base (H x) (G x) (F ∘ pr1)) + +module _ + {l1 : Level} {A : UU l1} {f : A → A} + (is-decidable-f : is-decidable-map f) + (is-π₀-trivial-f : is-π₀-trivial-map' f) + where + + is-decidable-map-iterate-is-π₀-trivial-map' : + (n : ℕ) → is-decidable-map (iterate n f) + is-decidable-map-iterate-is-π₀-trivial-map' zero-ℕ = is-decidable-map-id + is-decidable-map-iterate-is-π₀-trivial-map' (succ-ℕ n) = + is-decidable-map-comp-is-π₀-trivial-map' + ( is-π₀-trivial-f) + ( is-decidable-f) + ( is-decidable-map-iterate-is-π₀-trivial-map' n) ``` ### Left cancellation for decidable maps @@ -175,43 +230,6 @@ is-decidable-map-retraction d i (r , R) b = ( d (i (r b)) b) ``` -### Maps with sections are decidable - -```agda -is-decidable-map-section : - {l1 l2 : Level} {A : UU l1} {B : UU l2} → - (i : A → B) → section i → is-decidable-map i -is-decidable-map-section i (s , S) b = inl (s b , S b) -``` - -### Any map out of the empty type is decidable - -```agda -abstract - is-decidable-map-ex-falso : - {l : Level} {X : UU l} → is-decidable-map (ex-falso {l} {X}) - is-decidable-map-ex-falso x = inr pr1 -``` - -### The identity map is decidable - -```agda -abstract - is-decidable-map-id : - {l : Level} {X : UU l} → is-decidable-map (id {l} {X}) - is-decidable-map-id y = inl (y , refl) -``` - -### Equivalences are decidable maps - -```agda -abstract - is-decidable-map-is-equiv : - {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → - is-equiv f → is-decidable-map f - is-decidable-map-is-equiv H x = inl (center (is-contr-map-is-equiv H x)) -``` - ### The map on total spaces induced by a family of decidable maps is decidable ```agda diff --git a/src/foundation/iterating-functions.lagda.md b/src/foundation/iterating-functions.lagda.md index d2aa2c2eb6..3898565cd9 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 @@ -34,71 +36,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 @@ -166,35 +109,3 @@ module _ eq-htpy (λ f → eq-htpy (λ x → iterate-mul-ℕ k l f x)) pr2 (pr2 iterative-action-Monoid) = refl ``` - -### 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/lesser-limited-principle-of-omniscience.lagda.md b/src/foundation/lesser-limited-principle-of-omniscience.lagda.md index 9152ac746b..176f5f34cf 100644 --- a/src/foundation/lesser-limited-principle-of-omniscience.lagda.md +++ b/src/foundation/lesser-limited-principle-of-omniscience.lagda.md @@ -62,8 +62,16 @@ prop-level-LLPO l = function-Prop ( is-prop (Σ ℕ (type-Decidable-Prop ∘ f))) ( disjunction-Prop - ( ∀' ℕ (λ n → function-Prop (is-even-ℕ n) (neg-Prop (prop-Decidable-Prop (f n))))) - ( ∀' ℕ (λ n → function-Prop (is-odd-ℕ n) (neg-Prop (prop-Decidable-Prop (f n))))))) + ( ∀' ℕ + ( λ n → + function-Prop + ( is-even-ℕ n) + ( neg-Prop (prop-Decidable-Prop (f n))))) + ( ∀' ℕ + ( λ n → + function-Prop + ( is-odd-ℕ n) + ( neg-Prop (prop-Decidable-Prop (f n))))))) ``` ## See also diff --git a/src/foundation/maps-with-hilbert-epsilon-operators.lagda.md b/src/foundation/maps-with-hilbert-epsilon-operators.lagda.md new file mode 100644 index 0000000000..5a508fd443 --- /dev/null +++ b/src/foundation/maps-with-hilbert-epsilon-operators.lagda.md @@ -0,0 +1,65 @@ +# Maps with Hilbert ε-operators + +```agda +module foundation.maps-with-hilbert-epsilon-operators where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.cartesian-morphisms-arrows +open import foundation.coproduct-types +open import foundation.decidable-dependent-pair-types +open import foundation.decidable-equality +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.functoriality-cartesian-product-types +open import foundation.functoriality-coproduct-types +open import foundation.hilberts-epsilon-operators +open import foundation.identity-types +open import foundation.mere-equality +open import foundation.pi-0-trivial-maps +open import foundation.propositional-truncations +open import foundation.retracts-of-maps +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import foundation-core.contractible-maps +open import foundation-core.contractible-types +open import foundation-core.empty-types +open import foundation-core.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.injective-maps +open import foundation-core.iterating-functions +open import foundation-core.retractions +open import foundation-core.sections +``` + +
+ +## Idea + +We consider maps `f : A → B` [equippes](foundation.structure.md) with +[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 +``` + +## Definitions + +### The structure of an Hilbert ε-operator on a map + +```agda +ε-operator-map-Hilbert : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → (A → B) → UU (l1 ⊔ l2) +ε-operator-map-Hilbert {B = B} f = (y : B) → ε-operator-Hilbert (fiber f y) +``` diff --git a/src/foundation/perfect-images.lagda.md b/src/foundation/perfect-images.lagda.md index 63b1bb19e2..7fac28b15c 100644 --- a/src/foundation/perfect-images.lagda.md +++ b/src/foundation/perfect-images.lagda.md @@ -21,6 +21,7 @@ open import foundation.dependent-pair-types open import foundation.double-negation open import foundation.double-negation-stable-propositions open import foundation.functoriality-dependent-function-types +open import foundation.inhabited-types open import foundation.iterated-dependent-product-types open import foundation.iterating-functions open import foundation.law-of-excluded-middle @@ -28,6 +29,7 @@ open import foundation.mere-equality open import foundation.negated-equality open import foundation.negation open import foundation.pi-0-trivial-maps +open import foundation.propositional-truncations open import foundation.type-arithmetic-dependent-function-types open import foundation.universal-property-dependent-pair-types open import foundation.universe-levels @@ -48,6 +50,8 @@ open import foundation-core.transport-along-identifications open import logic.double-negation-eliminating-maps open import logic.double-negation-elimination open import logic.double-negation-stable-embeddings +open import logic.propositionally-decidable-maps +open import logic.propositionally-double-negation-eliminating-maps ```
@@ -62,9 +66,10 @@ also the following chain a₀ --> f (a₀) --> g(f(a₀)) --> f(g(f(a₀))) --> ... --> (g ◦ f)ⁿ(a₀) = a ``` -We say `a₀` is an {{#concept "origin"}} for `a`, and `a` is a -{{#concept "perfect image" Agda=is-perfect-image}} for `g` if any origin of `a` -is in the [image](foundation.images.md) of `g`. +We say `a₀` is an {{#concept "origin" Disambiguation="perfect image"}} for `a`, +and `a` is a {{#concept "perfect image" Agda=is-perfect-image}} for `g` +_relative to `f`_ if any origin of `a` is in the [image](foundation.images.md) +of `g`. ## Definitions @@ -91,8 +96,7 @@ module _ is-perfect-image-at' a n = (p : fiber (iterate n (g ∘ f)) a) → fiber g (pr1 p) is-perfect-image' : (a : A) → UU (l1 ⊔ l2) - is-perfect-image' a = - (n : ℕ) → is-perfect-image-at' a n + is-perfect-image' a = (n : ℕ) → is-perfect-image-at' a n compute-is-perfect-image : (a : A) → is-perfect-image' a ≃ is-perfect-image f g a @@ -107,7 +111,8 @@ module _ ### Nonperfect images -We can talk about origins of `a` which are not images of `g`. +We can talk about origins of `a` which are not perfect images of `g` relative to +`f`. ```agda module _ @@ -153,7 +158,7 @@ module _ ## Properties -TODO: prose here +If `g` is an embedding then being a perfect image for `g` is a property. ```agda module _ @@ -262,10 +267,51 @@ module _ v = tr (λ a' → ¬ (is-perfect-image f g a')) q s ``` +### Decidability of being a perfect image at a natural number + +```agda +module _ + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + where + + is-decidable-prop-is-perfect-image-at'' : + is-decidable-emb g → is-inhabited-or-empty-map f → is-π₀-trivial-map' f → + (a : A) (n : ℕ) → is-decidable-prop (is-perfect-image-at' f g a n) + is-decidable-prop-is-perfect-image-at'' G F F' a n = + is-decidable-prop-Π-all-elements-merely-equal-base' + ( λ x → fiber g (pr1 x) , is-decidable-prop-map-is-decidable-emb G (pr1 x)) + ( is-π₀-trivial-map'-iterate + ( is-π₀-trivial-map'-comp + ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb G)) + ( F')) + ( n) + ( a)) + ( is-inhabited-or-empty-map-iterate-is-π₀-trivial-map' + ( is-inhabited-or-empty-map-comp-is-π₀-trivial-map' + ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb G)) + ( is-inhabited-or-empty-map-is-decidable-map + ( is-decidable-map-is-decidable-emb G)) + ( F)) + ( is-π₀-trivial-map'-comp + ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb G)) + ( F')) + ( n) + ( a)) + + is-decidable-prop-is-perfect-image-at' : + is-decidable-emb g → is-decidable-map f → is-π₀-trivial-map' f → + (a : A) (n : ℕ) → is-decidable-prop (is-perfect-image-at' f g a n) + is-decidable-prop-is-perfect-image-at' G F = + is-decidable-prop-is-perfect-image-at'' G + ( is-inhabited-or-empty-map-is-decidable-map F) +``` + ### The constructive story +#### Untruncated double negation elimination on nonperfect fibers + If we assume that `g` is a double negation eliminating map, we can prove that if -`is-nonperfect-image a` does not hold, we have `is-perfect-image a`. +`is-nonperfect-image a` does not hold, then we have `is-perfect-image a`. ```agda module _ @@ -292,8 +338,9 @@ module _ (nρ : ¬ (is-perfect-image f g (g b))) where - not-not-is-nonperfect-image : ¬¬ (is-nonperfect-image {f = f} (g b)) - not-not-is-nonperfect-image nμ = + is-irrefutable-is-nonperfect-image-is-not-perfect-image : + ¬¬ (is-nonperfect-image {f = f} (g b)) + is-irrefutable-is-nonperfect-image-is-not-perfect-image nμ = nρ (double-negation-elim-is-perfect-image G (g b) nμ) module _ @@ -317,10 +364,10 @@ module _ (b : B) (nρ : ¬ (is-perfect-image f g (g b))) where - not-not-has-nonperfect-fiber-is-not-perfect-image : + is-irrefutable-has-nonperfect-fiber-is-not-perfect-image : ¬¬ (has-nonperfect-fiber f g b) - not-not-has-nonperfect-fiber-is-not-perfect-image t = - not-not-is-nonperfect-image + is-irrefutable-has-nonperfect-fiber-is-not-perfect-image t = + is-irrefutable-is-nonperfect-image-is-not-perfect-image ( is-double-negation-eliminating-g) ( b) ( nρ) @@ -349,8 +396,7 @@ module _ (is-injective-g : is-injective g) (is-double-negation-eliminating-f : is-double-negation-eliminating-map f) (is-π₀-trivial-f : is-π₀-trivial-map' f) - (b : B) - (nρ : ¬ (is-perfect-image f g (g b))) + (b : B) (nρ : ¬ (is-perfect-image f g (g b))) where has-nonperfect-fiber-is-not-perfect-image : @@ -360,7 +406,7 @@ module _ ( is-double-negation-eliminating-f) ( is-π₀-trivial-f) ( b) - ( not-not-has-nonperfect-fiber-is-not-perfect-image + ( is-irrefutable-has-nonperfect-fiber-is-not-perfect-image ( is-double-negation-eliminating-g) ( is-injective-g) ( b) @@ -380,158 +426,7 @@ module _ pr2 fiber-has-nonperfect-fiber-is-not-perfect-image is-not-perfect-image-has-nonperfect-fiber-is-not-perfect-image : - ¬ (is-perfect-image f g element-has-nonperfect-fiber-is-not-perfect-image) + ¬ (is-perfect-image f g element-has-nonperfect-fiber-is-not-perfect-image) is-not-perfect-image-has-nonperfect-fiber-is-not-perfect-image = pr2 has-nonperfect-fiber-is-not-perfect-image - -module _ - {l1 : Level} {A : UU l1} {f : A → A} - (is-decidable-f : is-decidable-map f) - (is-π₀-trivial-f : is-π₀-trivial-map' f) - where - - is-decidable-map-iterate-is-π₀-trivial-map' : - (n : ℕ) → is-decidable-map (iterate n f) - is-decidable-map-iterate-is-π₀-trivial-map' zero-ℕ = is-decidable-map-id - is-decidable-map-iterate-is-π₀-trivial-map' (succ-ℕ n) = - is-decidable-map-comp-is-π₀-trivial-map' - ( is-π₀-trivial-f) - ( is-decidable-f) - ( is-decidable-map-iterate-is-π₀-trivial-map' n) - -module _ - {l1 : Level} {A : UU l1} {f : A → A} - (is-π₀-trivial-f : is-π₀-trivial-map' f) - where - - is-π₀-trivial-map'-iterate : - (n : ℕ) → is-π₀-trivial-map' (iterate n f) - is-π₀-trivial-map'-iterate zero-ℕ = is-π₀-trivial-map'-id - is-π₀-trivial-map'-iterate (succ-ℕ n) = - is-π₀-trivial-map'-comp is-π₀-trivial-f (is-π₀-trivial-map'-iterate n) -``` - -```agda -module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (G : is-decidable-emb g) (F : is-decidable-map f) (F' : is-π₀-trivial-map' f) - where - - is-decidable-prop-is-perfect-image-at' : - (a : A) (n : ℕ) → is-decidable-prop (is-perfect-image-at' f g a n) - is-decidable-prop-is-perfect-image-at' a n = - is-decidable-prop-Π-all-elements-merely-equal-base - ( λ x → - fiber g (pr1 x) , - is-decidable-prop-map-is-decidable-emb G (pr1 x)) - ( is-π₀-trivial-map'-iterate - ( is-π₀-trivial-map'-comp - ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb G)) - ( F')) - ( n) - ( a)) - ( is-decidable-map-iterate-is-π₀-trivial-map' - ( is-decidable-map-comp-is-π₀-trivial-map' - ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb G)) - ( is-decidable-map-is-decidable-emb G) - ( F)) - ( is-π₀-trivial-map'-comp - ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb G)) - ( F')) - ( n) - ( a)) -``` - -### Assuming the weak limited principle of omniscience - -```agda -module _ - {l1 l2 : Level} - (wlpo : level-WLPO (l1 ⊔ l2)) - {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} - (G : is-decidable-emb g) - (F : is-decidable-map f) - (F' : is-π₀-trivial-map' f) - where - - abstract - is-decidable-is-perfect-image'-WLPO : - (a : A) → is-decidable (is-perfect-image' f g a) - is-decidable-is-perfect-image'-WLPO a = - wlpo - ( λ n → - is-perfect-image-at' f g a n , - is-decidable-prop-is-perfect-image-at' G F F' a n) - - is-decidable-is-perfect-image-WLPO : - (a : A) → is-decidable (is-perfect-image f g a) - is-decidable-is-perfect-image-WLPO a = - is-decidable-equiv' - ( compute-is-perfect-image f g a) - ( is-decidable-is-perfect-image'-WLPO a) -``` - -### The classical story - -If `g` is an [embedding](foundation-core.embeddings.md), then -`is-perfect-image a` is a [proposition](foundation-core.propositions.md). In -this case, if we assume the -[law of exluded middle](foundation.law-of-excluded-middle.md), we can show -`is-perfect-image a` is a [decidable type](foundation.decidable-types.md) for -any `a : A`. - -```agda -module _ - {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} (is-emb-g : is-emb g) - where - - is-decidable-is-perfect-image-is-emb-LEM : - (a : A) → is-decidable (is-perfect-image f g a) - is-decidable-is-perfect-image-is-emb-LEM a = - lem (is-perfect-image-Prop is-emb-g a) -``` - -If we assume the law of excluded middle and `g` is an embedding, we can prove -that if `is-nonperfect-image a` does not hold, we have `is-perfect-image a`. - -```agda -module _ - {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) - {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (is-emb-g : is-emb g) - where - - double-negation-elim-is-perfect-image-LEM : - (a : A) → ¬ (is-nonperfect-image a) → is-perfect-image f g a - double-negation-elim-is-perfect-image-LEM = - double-negation-elim-is-perfect-image - ( is-double-negation-eliminating-map-is-decidable-map - ( λ y → lem (fiber g y , is-prop-map-is-emb is-emb-g y))) -``` - -The following property states that if `g (b)` is not a perfect image, then `b` -has an `f` fiber `a` that is not a perfect image for `g`. Again, we need to -assume law of excluded middle and that both `g` and `f` are embedding. - -```agda -module _ - {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) - {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (is-emb-f : is-emb f) (is-emb-g : is-emb g) - where - - has-nonperfect-fiber-is-not-perfect-image-LEM : - (b : B) → - ¬ (is-perfect-image f g (g b)) → - has-nonperfect-fiber f g b - has-nonperfect-fiber-is-not-perfect-image-LEM = - has-nonperfect-fiber-is-not-perfect-image - ( is-double-negation-eliminating-map-is-decidable-map - ( λ y → lem (fiber g y , is-prop-map-is-emb is-emb-g y))) - ( is-injective-is-emb is-emb-g) - ( is-double-negation-eliminating-map-is-decidable-map - ( λ y → lem (fiber f y , is-prop-map-is-emb is-emb-f y))) - ( λ y p q → mere-eq-eq (eq-is-prop (is-prop-map-is-emb is-emb-f y))) ``` diff --git a/src/foundation/pi-0-trivial-maps.lagda.md b/src/foundation/pi-0-trivial-maps.lagda.md index 58d41d6d8b..ad4f58ffe5 100644 --- a/src/foundation/pi-0-trivial-maps.lagda.md +++ b/src/foundation/pi-0-trivial-maps.lagda.md @@ -7,6 +7,8 @@ module foundation.pi-0-trivial-maps where
Imports ```agda +open import elementary-number-theory.natural-numbers + open import foundation.action-on-identifications-functions open import foundation.cartesian-morphisms-arrows open import foundation.coproduct-types @@ -15,7 +17,6 @@ open import foundation.dependent-pair-types open import foundation.functoriality-cartesian-product-types open import foundation.functoriality-coproduct-types open import foundation.identity-types -open import foundation.iterating-functions open import foundation.mere-equality open import foundation.retracts-of-maps open import foundation.universe-levels @@ -30,6 +31,7 @@ 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 foundation-core.propositional-maps open import foundation-core.propositions open import foundation-core.retractions @@ -92,4 +94,15 @@ module _ all-elements-merely-equal-equiv ( compute-fiber-comp g f y) ( all-elements-merely-equal-Σ (G y) (F ∘ pr1)) + +module _ + {l1 : Level} {A : UU l1} {f : A → A} + (is-π₀-trivial-f : is-π₀-trivial-map' f) + where + + is-π₀-trivial-map'-iterate : + (n : ℕ) → is-π₀-trivial-map' (iterate n f) + is-π₀-trivial-map'-iterate zero-ℕ = is-π₀-trivial-map'-id + is-π₀-trivial-map'-iterate (succ-ℕ n) = + is-π₀-trivial-map'-comp is-π₀-trivial-f (is-π₀-trivial-map'-iterate n) ``` diff --git a/src/logic.lagda.md b/src/logic.lagda.md index 7822966c07..15dbbafcf5 100644 --- a/src/logic.lagda.md +++ b/src/logic.lagda.md @@ -21,5 +21,7 @@ open import logic.double-negation-stable-subtypes 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/propositional-double-negation-elimination.lagda.md b/src/logic/propositional-double-negation-elimination.lagda.md index d558bc25e0..0255a374e8 100644 --- a/src/logic/propositional-double-negation-elimination.lagda.md +++ b/src/logic/propositional-double-negation-elimination.lagda.md @@ -116,12 +116,14 @@ module _ where has-prop-double-negation-elim-retract : - A retract-of B → has-prop-double-negation-elim B → has-prop-double-negation-elim A + 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 + 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) ``` diff --git a/src/logic/propositionally-decidable-maps.lagda.md b/src/logic/propositionally-decidable-maps.lagda.md new file mode 100644 index 0000000000..39b9e8bc5c --- /dev/null +++ b/src/logic/propositionally-decidable-maps.lagda.md @@ -0,0 +1,321 @@ +# Propositionally decidable maps + +```agda +module logic.propositionally-decidable-maps where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers + +open import foundation.action-on-identifications-functions +open import foundation.cartesian-morphisms-arrows +open import foundation.coproduct-types +open import foundation.decidable-dependent-pair-types +open import foundation.decidable-equality +open import foundation.decidable-maps +open import foundation.decidable-types +open import foundation.dependent-pair-types +open import foundation.functoriality-cartesian-product-types +open import foundation.functoriality-coproduct-types +open import foundation.identity-types +open import foundation.mere-equality +open import foundation.pi-0-trivial-maps +open import foundation.propositional-truncations +open import foundation.retracts-of-maps +open import foundation.transport-along-identifications +open import foundation.universe-levels + +open import foundation-core.contractible-maps +open import foundation-core.contractible-types +open import foundation-core.empty-types +open import foundation-core.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.injective-maps +open import foundation-core.iterating-functions +open import foundation-core.retractions +open import foundation-core.sections + +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). + +## Definitions + +### The structure on a map of decidability + +```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 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 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` is π₀-trivial. + +```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-π₀-trivial-map' : + is-π₀-trivial-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-is-π₀-trivial-map' H G F x = + is-inhabited-or-empty-equiv + ( compute-fiber-comp g f x) + ( is-inhabited-or-empty-Σ-all-elements-merely-equal-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) + (is-π₀-trivial-f : is-π₀-trivial-map' f) + where + + is-inhabited-or-empty-map-iterate-is-π₀-trivial-map' : + (n : ℕ) → is-inhabited-or-empty-map (iterate n f) + is-inhabited-or-empty-map-iterate-is-π₀-trivial-map' zero-ℕ = + is-inhabited-or-empty-map-id + is-inhabited-or-empty-map-iterate-is-π₀-trivial-map' (succ-ℕ n) = + is-inhabited-or-empty-map-comp-is-π₀-trivial-map' + ( is-π₀-trivial-f) + ( is-inhabited-or-empty-f) + ( is-inhabited-or-empty-map-iterate-is-π₀-trivial-map' n) +``` + +### Left cancellation for decidable maps + +If a composite `g ∘ f` is decidable and `g` is injective then `f` is decidable. + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} + where + + abstract + is-inhabited-or-empty-map-right-factor' : + is-inhabited-or-empty-map (g ∘ f) → is-injective g → is-inhabited-or-empty-map f + is-inhabited-or-empty-map-right-factor' GF G y = + rec-coproduct + ( λ q → inl (pr1 q , G (pr2 q))) + ( λ q → inr (λ x → q ((pr1 x) , ap g (pr2 x)))) + ( GF (g y)) +``` + +### Retracts into types with decidable equality are decidable + +```text +is-inhabited-or-empty-map-retraction : + {l1 l2 : Level} {A : UU l1} {B : UU l2} → has-decidable-equality B → + (i : A → B) → retraction i → is-inhabited-or-empty-map i +is-inhabited-or-empty-map-retraction d i (r , R) b = + is-decidable-iff + ( λ (p : i (r b) = b) → r b , p) + ( λ t → ap (i ∘ r) (inv (pr2 t)) ∙ ap i (R (pr1 t)) ∙ pr2 t) + ( d (i (r b)) b) +``` + +### The map on total spaces induced by a family of decidable maps is decidable + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} + where + + is-inhabited-or-empty-map-tot : + {f : (x : A) → B x → C x} → + ((x : A) → is-inhabited-or-empty-map (f x)) → is-inhabited-or-empty-map (tot f) + is-inhabited-or-empty-map-tot {f} H x = + is-decidable-equiv (compute-fiber-tot f x) (H (pr1 x) (pr2 x)) +``` + +### The map on total spaces induced by a decidable map on the base is decidable + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) + where + + is-inhabited-or-empty-map-Σ-map-base : + {f : A → B} → is-inhabited-or-empty-map f → is-inhabited-or-empty-map (map-Σ-map-base f C) + is-inhabited-or-empty-map-Σ-map-base {f} H x = + is-decidable-equiv' (compute-fiber-map-Σ-map-base f C x) (H (pr1 x)) +``` + +### Products of decidable maps are decidable + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-inhabited-or-empty-map-product : + {f : A → B} {g : C → D} → + is-inhabited-or-empty-map f → is-inhabited-or-empty-map g → is-inhabited-or-empty-map (map-product f g) + is-inhabited-or-empty-map-product {f} {g} F G x = + is-decidable-equiv + ( compute-fiber-map-product f g x) + ( is-decidable-product (F (pr1 x)) (G (pr2 x))) +``` + +### Coproducts of decidable maps are decidable + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-inhabited-or-empty-map-coproduct : + {f : A → B} {g : C → D} → + is-inhabited-or-empty-map f → + is-inhabited-or-empty-map g → + is-inhabited-or-empty-map (map-coproduct f g) + is-inhabited-or-empty-map-coproduct {f} {g} F G (inl x) = + is-decidable-equiv' (compute-fiber-inl-map-coproduct f g x) (F x) + is-inhabited-or-empty-map-coproduct {f} {g} F G (inr y) = + is-decidable-equiv' (compute-fiber-inr-map-coproduct f g y) (G y) +``` + +### Propositionally decidable maps are closed under base change + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + {f : A → B} {g : C → D} + where + + is-inhabited-or-empty-map-base-change : + cartesian-hom-arrow g f → is-inhabited-or-empty-map f → is-inhabited-or-empty-map g + is-inhabited-or-empty-map-base-change α F d = + is-decidable-equiv + ( equiv-fibers-cartesian-hom-arrow g f α d) + ( F (map-codomain-cartesian-hom-arrow g f α d)) +``` + +### Propositionally decidable maps are closed under retracts of maps + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} + {f : A → B} {g : X → Y} + where + + is-decidable-retract-map : + f retract-of-map g → is-inhabited-or-empty-map g → is-inhabited-or-empty-map f + is-decidable-retract-map R G x = + is-decidable-retract-of + ( retract-fiber-retract-map f g R x) + ( G (map-codomain-inclusion-retract-map f g R x)) +``` diff --git a/src/logic/propositionally-decidable-types.lagda.md b/src/logic/propositionally-decidable-types.lagda.md index 781343e5ff..c40898a893 100644 --- a/src/logic/propositionally-decidable-types.lagda.md +++ b/src/logic/propositionally-decidable-types.lagda.md @@ -266,7 +266,8 @@ 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 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 _) @@ -297,7 +298,9 @@ is-inhabited-or-empty-right-factor (inr nx) a = inr (λ b → nx (a , b)) ```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 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) = 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..a636ec1943 --- /dev/null +++ b/src/logic/propositionally-double-negation-eliminating-maps.lagda.md @@ -0,0 +1,359 @@ +# Propositionally double negation eliminating maps + +```agda +module logic.propositionally-double-negation-eliminating-maps where +``` + +
Imports + +```agda +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 +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.identity-types +open import foundation.injective-maps +open import foundation.propositions +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 + +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.functoriality-dependent-pair-types +open import foundation-core.homotopies + +open import logic.double-negation-eliminating-maps +open import logic.double-negation-elimination +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 do in fact 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 + +### Double negation elimination structure 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 + +### 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) +``` + +### Composition of double negation eliminating maps + +Given a composition `g ∘ f` of double negation eliminating maps where the left +factor `g` is injective, then the composition is double negation eliminating. + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} + {g : B → C} {f : A → B} + where + + fiber-left-is-prop-double-negation-eliminating-map-left : + is-prop-double-negation-eliminating-map g → + (z : C) → ¬¬ (fiber (g ∘ f) z) → fiber g z + fiber-left-is-prop-double-negation-eliminating-map-left G z nngfz = + G z (λ x → nngfz (λ w → x (f (pr1 w) , pr2 w))) + + fiber-right-is-prop-double-negation-eliminating-map-comp : + is-injective g → + (G : is-prop-double-negation-eliminating-map g) → + is-prop-double-negation-eliminating-map f → + (z : C) (nngfz : ¬¬ (fiber (g ∘ f) z)) → + fiber f (pr1 (fiber-left-is-prop-double-negation-eliminating-map-left G z nngfz)) + fiber-right-is-prop-double-negation-eliminating-map-comp H G F z nngfz = + F ( pr1 + ( fiber-left-is-prop-double-negation-eliminating-map-left G z nngfz)) + ( λ x → + nngfz + ( λ w → + x ( pr1 w , + H ( pr2 w ∙ + inv + ( pr2 + ( fiber-left-is-prop-double-negation-eliminating-map-left + G z nngfz)))))) + + is-prop-double-negation-eliminating-map-comp : + is-injective g → + is-prop-double-negation-eliminating-map g → + is-prop-double-negation-eliminating-map f → + is-prop-double-negation-eliminating-map (g ∘ f) + is-prop-double-negation-eliminating-map-comp H G F z nngfz = + map-inv-compute-fiber-comp g f z + ( ( fiber-left-is-prop-double-negation-eliminating-map-left G z nngfz) , + ( fiber-right-is-prop-double-negation-eliminating-map-comp H G F z nngfz)) +``` + +### Left cancellation for double negation eliminating maps + +If a composite `g ∘ f` is double negation eliminating and the left factor `g` is +injective, then the right factor `f` is double negation eliminating. + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} + (GF : is-prop-double-negation-eliminating-map (g ∘ f)) + where + + fiber-comp-is-prop-double-negation-eliminating-map-right-factor' : + (y : B) → ¬¬ (fiber f y) → Σ (fiber g (g y)) (λ t → fiber f (pr1 t)) + fiber-comp-is-prop-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)))) + + is-prop-double-negation-eliminating-map-right-factor' : + is-injective g → is-prop-double-negation-eliminating-map f + is-prop-double-negation-eliminating-map-right-factor' G y nnfy = + tr + ( fiber f) + ( G ( pr2 + ( pr1 + ( fiber-comp-is-prop-double-negation-eliminating-map-right-factor' + ( y) + ( nnfy))))) + ( pr2 + ( fiber-comp-is-prop-double-negation-eliminating-map-right-factor' y nnfy)) +``` + +### Any map out of the empty type is double negation eliminating + +```text +abstract + is-prop-double-negation-eliminating-map-ex-falso : + {l : Level} {X : UU l} → + is-prop-double-negation-eliminating-map (ex-falso {l} {X}) + is-prop-double-negation-eliminating-map-ex-falso x f = ex-falso (f λ ()) +``` + +### The identity map is double negation eliminating + +```text +abstract + is-prop-double-negation-eliminating-map-id : + {l : Level} {X : UU l} → is-prop-double-negation-eliminating-map (id {l} {X}) + is-prop-double-negation-eliminating-map-id x y = (x , refl) +``` + +### Equivalences are double negation eliminating maps + +```text +abstract + is-prop-double-negation-eliminating-map-is-equiv : + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → + is-equiv f → is-prop-double-negation-eliminating-map f + is-prop-double-negation-eliminating-map-is-equiv H x = + double-negation-elim-is-contr (is-contr-map-is-equiv H x) +``` + +### The map on total spaces induced by a family of double negation eliminating maps is double negation eliminating + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} + where + + is-prop-double-negation-eliminating-map-tot : + {f : (x : A) → B x → C x} → + ((x : A) → is-prop-double-negation-eliminating-map (f x)) → + is-prop-double-negation-eliminating-map (tot f) + is-prop-double-negation-eliminating-map-tot {f} H x = + has-double-negation-elim-equiv (compute-fiber-tot f x) (H (pr1 x) (pr2 x)) +``` + +### The map on total spaces induced by a double negation eliminating map on the base is double negation eliminating + +```text +module _ + {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) + where + + is-prop-double-negation-eliminating-map-Σ-map-base : + {f : A → B} → + is-prop-double-negation-eliminating-map f → + is-prop-double-negation-eliminating-map (map-Σ-map-base f C) + is-prop-double-negation-eliminating-map-Σ-map-base {f} H x = + has-double-negation-elim-equiv' + ( compute-fiber-map-Σ-map-base f C x) + ( H (pr1 x)) +``` + +### Products of double negation eliminating maps are double negation eliminating + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-prop-double-negation-eliminating-map-product : + {f : A → B} {g : C → D} → + is-prop-double-negation-eliminating-map f → + is-prop-double-negation-eliminating-map g → + is-prop-double-negation-eliminating-map (map-product f g) + is-prop-double-negation-eliminating-map-product {f} {g} F G x = + has-double-negation-elim-equiv + ( compute-fiber-map-product f g x) + ( double-negation-elim-product (F (pr1 x)) (G (pr2 x))) +``` + +### Coproducts of double negation eliminating maps are double negation eliminating + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + where + + is-prop-double-negation-eliminating-map-coproduct : + {f : A → B} {g : C → D} → + is-prop-double-negation-eliminating-map f → + is-prop-double-negation-eliminating-map g → + is-prop-double-negation-eliminating-map (map-coproduct f g) + is-prop-double-negation-eliminating-map-coproduct {f} {g} F G (inl x) = + has-double-negation-elim-equiv' + ( compute-fiber-inl-map-coproduct f g x) + ( F x) + is-prop-double-negation-eliminating-map-coproduct {f} {g} F G (inr y) = + has-double-negation-elim-equiv' + ( compute-fiber-inr-map-coproduct f g y) + ( G y) +``` + +### Double negation eliminating maps are closed under base change + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} + {f : A → B} {g : C → D} + where + + is-prop-double-negation-eliminating-map-base-change : + cartesian-hom-arrow g f → + is-prop-double-negation-eliminating-map f → + is-prop-double-negation-eliminating-map g + is-prop-double-negation-eliminating-map-base-change α F d = + has-double-negation-elim-equiv + ( equiv-fibers-cartesian-hom-arrow g f α d) + ( F (map-codomain-cartesian-hom-arrow g f α d)) +``` + +### Double negation eliminating maps are closed under retracts of maps + +```text +module _ + {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} + {f : A → B} {g : X → Y} + where + + is-prop-double-negation-eliminating-retract-map : + f retract-of-map g → + is-prop-double-negation-eliminating-map g → + is-prop-double-negation-eliminating-map f + is-prop-double-negation-eliminating-retract-map R G x = + has-double-negation-elim-retract + ( retract-fiber-retract-map f g R x) + ( G (map-codomain-inclusion-retract-map f g R x)) +``` From a357032f02aa8653c9bfadb2c7a2115af59050d4 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 21 Jan 2025 21:55:15 +0100 Subject: [PATCH 81/83] edits --- .../orbits-permutations.lagda.md | 3 +- src/foundation.lagda.md | 1 - ...cantor-schroder-bernstein-escardo.lagda.md | 455 +++++++++++++----- .../cantor-schroder-bernstein-wlpo.lagda.md | 371 -------------- src/logic/de-morgan-types.lagda.md | 1 + 5 files changed, 338 insertions(+), 493 deletions(-) delete mode 100644 src/foundation/cantor-schroder-bernstein-wlpo.lagda.md diff --git a/src/finite-group-theory/orbits-permutations.lagda.md b/src/finite-group-theory/orbits-permutations.lagda.md index 4b629bb9c1..f3a0833ae6 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 @@ -481,7 +483,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.lagda.md b/src/foundation.lagda.md index 64eb838802..47ea7e2c8d 100644 --- a/src/foundation.lagda.md +++ b/src/foundation.lagda.md @@ -47,7 +47,6 @@ open import foundation.binary-transport public open import foundation.binary-type-duality public open import foundation.booleans public open import foundation.cantor-schroder-bernstein-escardo public -open import foundation.cantor-schroder-bernstein-wlpo public open import foundation.cantors-theorem public open import foundation.cartesian-morphisms-arrows public open import foundation.cartesian-morphisms-span-diagrams public diff --git a/src/foundation/cantor-schroder-bernstein-escardo.lagda.md b/src/foundation/cantor-schroder-bernstein-escardo.lagda.md index 0d4c1023f1..477004c227 100644 --- a/src/foundation/cantor-schroder-bernstein-escardo.lagda.md +++ b/src/foundation/cantor-schroder-bernstein-escardo.lagda.md @@ -1,4 +1,4 @@ -# The Cantor–Schröder–Bernstein–Escardó theorem +# The Cantor–Schröder–Bernstein–Escardó construction ```agda module foundation.cantor-schroder-bernstein-escardo where @@ -7,14 +7,28 @@ module foundation.cantor-schroder-bernstein-escardo where
Imports ```agda +open import elementary-number-theory.natural-numbers + open import foundation.action-on-identifications-functions +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 +open import foundation.function-types +open import foundation.functoriality-dependent-pair-types open import foundation.injective-maps open import foundation.law-of-excluded-middle +open import foundation.maps-with-hilbert-epsilon-operators open import foundation.perfect-images +open import foundation.pi-0-trivial-maps +open import foundation.propositional-truncations +open import foundation.propositions +open import foundation.sections open import foundation.split-surjective-maps open import foundation.universe-levels +open import foundation.weak-limited-principle-of-omniscience open import foundation-core.coproduct-types open import foundation-core.embeddings @@ -23,7 +37,11 @@ open import foundation-core.equivalences open import foundation-core.fibers-of-maps open import foundation-core.identity-types open import foundation-core.negation +open import foundation-core.propositional-maps open import foundation-core.sets + +open import logic.double-negation-eliminating-maps +open import logic.double-negation-stable-embeddings ```
@@ -38,143 +56,340 @@ Escardó proved that a Cantor–Schröder–Bernstein theorem also holds for [embed](foundation-core.embeddings.md) into each other, then the types are [equivalent](foundation-core.equivalences.md). {{#cite Esc21}} +In this file we give a fine-grained analysis of the construction used in the +proof of this _Cantor–Schröder–Bernstein-Escardó theorem_, and use this +deconstruction to give a series of further generalizations of the theorem. + The Cantor–Schröder–Bernstein theorem is the 25th theorem on [Freek Wiedijk's](http://www.cs.ru.nl/F.Wiedijk/) list of [100 theorems](literature.100-theorems.md) {{#cite 100theorems}}. -## Statement +## The Cantor-Schröder-Bernstein-Escardó construction -```agda -statement-Cantor-Schröder-Bernstein-Escardó : - (l1 l2 : Level) → UU (lsuc (l1 ⊔ l2)) -statement-Cantor-Schröder-Bernstein-Escardó l1 l2 = - {X : UU l1} {Y : UU l2} → (X ↪ Y) → (Y ↪ X) → X ≃ Y -``` +Given a pair of mutual maps `f : A → B` and `g : B → A` such that -## Proof +1. the maps `f` and `g` satisfy double negation elimination on their fibers +2. For every element `x : A` it is decidable wheter `x` is a perfect image of + `g` relative to `f` +3. `g` is injective +4. `f` is π₀-trivial -### The law of excluded middle implies Cantor-Schröder-Bernstein-Escardó +Then `B` is a retract of `A`. If `f` moreover is injective, then this retract is +an equivalence. ```agda module _ - {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) - {X : UU l1} {Y : UU l2} (f : X ↪ Y) (g : Y ↪ X) + {l1 l2 : Level} + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (G' : is-injective g) + (G : is-double-negation-eliminating-map g) + (F : is-double-negation-eliminating-map f) where - map-Cantor-Schröder-Bernstein-Escardó' : - (x : X) → is-decidable (is-perfect-image (map-emb f) (map-emb g) x) → Y - map-Cantor-Schröder-Bernstein-Escardó' x (inl y) = - inverse-of-perfect-image x y - map-Cantor-Schröder-Bernstein-Escardó' x (inr y) = - map-emb f x - - map-Cantor-Schröder-Bernstein-Escardó : X → Y - map-Cantor-Schröder-Bernstein-Escardó x = - map-Cantor-Schröder-Bernstein-Escardó' x - ( is-decidable-is-perfect-image-is-emb-LEM lem (is-emb-map-emb g) x) - - is-injective-map-Cantor-Schröder-Bernstein-Escardó : - is-injective map-Cantor-Schröder-Bernstein-Escardó - is-injective-map-Cantor-Schröder-Bernstein-Escardó {x} {x'} = - l (is-decidable-is-perfect-image-is-emb-LEM lem (is-emb-map-emb g) x) - (is-decidable-is-perfect-image-is-emb-LEM lem (is-emb-map-emb g) x') - where - l : - (d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) - (d' : is-decidable (is-perfect-image (map-emb f) (map-emb g) x')) → - ( map-Cantor-Schröder-Bernstein-Escardó' x d) = - ( map-Cantor-Schröder-Bernstein-Escardó' x' d') → - x = x' - l (inl ρ) (inl ρ') p = - ( inv (is-section-inverse-of-perfect-image x ρ)) ∙ - ( ap (map-emb g) p ∙ is-section-inverse-of-perfect-image x' ρ') - l (inl ρ) (inr nρ') p = - ex-falso (perfect-image-has-distinct-image x' x nρ' ρ (inv p)) - l (inr nρ) (inl ρ') p = - ex-falso (perfect-image-has-distinct-image x x' nρ ρ' p) - l (inr nρ) (inr nρ') p = - is-injective-is-emb (is-emb-map-emb f) p - - is-split-surjective-map-Cantor-Schröder-Bernstein-Escardó : - is-split-surjective map-Cantor-Schröder-Bernstein-Escardó - is-split-surjective-map-Cantor-Schröder-Bernstein-Escardó y = - pair x p - where - a : + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó : + (x : A) → is-decidable (is-perfect-image f g x) → B + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + x (inl γ) = + inverse-of-perfect-image x γ + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + x (inr nγ) = + f x + + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó : + (y : B) → + (γ : is-perfect-image f g (g y)) → + (d : is-decidable (is-perfect-image f g (g y))) → + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + ( g y) d = + y + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + y γ (inl v') = + is-retraction-inverse-of-perfect-image G' y v' + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + y γ (inr v) = + ex-falso (v γ) + + compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein–Escardó : + (F' : is-π₀-trivial-map' f) → + (y : B) → + (nγ : ¬ (is-perfect-image f g (g y))) → + (d : is-decidable - ( is-perfect-image (map-emb f) (map-emb g) (map-emb g y)) → - Σ ( X) - ( λ x → - ( (d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) → - map-Cantor-Schröder-Bernstein-Escardó' x d = y)) - a (inl γ) = - pair (map-emb g y) ψ - where - ψ : - ( d : - is-decidable - ( is-perfect-image (map-emb f) (map-emb g) (map-emb g y))) → - map-Cantor-Schröder-Bernstein-Escardó' (map-emb g y) d = y - ψ (inl v') = - is-retraction-inverse-of-perfect-image - ( is-injective-emb g) - ( y) - ( v') - ψ (inr v) = ex-falso (v γ) - a (inr γ) = - pair x ψ - where - w : - Σ ( fiber (map-emb f) y) - ( λ s → ¬ (is-perfect-image (map-emb f) (map-emb g) (pr1 s))) - w = - has-nonperfect-fiber-is-not-perfect-image-LEM lem - ( is-emb-map-emb f) - ( is-emb-map-emb g) + ( is-perfect-image f g + ( element-has-nonperfect-fiber-is-not-perfect-image + G G' F F' y nγ))) → + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + ( element-has-nonperfect-fiber-is-not-perfect-image G G' F F' y nγ) + ( d) = + y + compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' y nγ (inl v) = + ex-falso + ( is-not-perfect-image-has-nonperfect-fiber-is-not-perfect-image + G G' F F' y nγ v) + compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' y nγ (inr _) = + is-in-fiber-element-has-nonperfect-fiber-is-not-perfect-image + G G' F F' y nγ + + map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó : + (F' : is-π₀-trivial-map' f) → + (y : B) → is-decidable (is-perfect-image f g (g y)) → A + map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' y (inl _) = g y + map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' y (inr nγ) = + element-has-nonperfect-fiber-is-not-perfect-image G G' F F' y nγ + + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó : + (F' : is-π₀-trivial-map' f) → + (y : B) + (d : is-decidable (is-perfect-image f g (g y))) → + (d' : + is-decidable + ( is-perfect-image f g + ( map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' y d))) → + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + ( map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' y d) + ( d') = + y + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' y (inl γ) = + compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + y γ + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' y (inr nγ) = + compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' y nγ + + map-construction-Cantor-Schröder-Bernstein–Escardó : + (D : (x : A) → is-decidable (is-perfect-image f g x)) → A → B + map-construction-Cantor-Schröder-Bernstein–Escardó D x = + map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + ( x) + ( D x) + + map-section-construction-Cantor-Schröder-Bernstein–Escardó : + (F' : is-π₀-trivial-map' f) → + (D : (y : B) → is-decidable (is-perfect-image f g (g y))) → B → A + map-section-construction-Cantor-Schröder-Bernstein–Escardó F' D y = + map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + ( F') + ( y) + ( D y) + + is-section-map-section-construction-Cantor-Schröder-Bernstein–Escardó : + (F' : is-π₀-trivial-map' f) → + (D : (x : A) → is-decidable (is-perfect-image f g x)) → + is-section + ( map-construction-Cantor-Schröder-Bernstein–Escardó D) + ( map-section-construction-Cantor-Schröder-Bernstein–Escardó F' (D ∘ g)) + is-section-map-section-construction-Cantor-Schröder-Bernstein–Escardó F' D y = + is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + ( F') + ( y) + ( D (g y)) + ( D ( map-section-construction-Cantor-Schröder-Bernstein–Escardó + F' (D ∘ g) y)) + + section-construction-Cantor-Schröder-Bernstein–Escardó : + (F' : is-π₀-trivial-map' f) → + (D : (x : A) → is-decidable (is-perfect-image f g x)) → + section (map-construction-Cantor-Schröder-Bernstein–Escardó D) + section-construction-Cantor-Schröder-Bernstein–Escardó F' D = + map-section-construction-Cantor-Schröder-Bernstein–Escardó F' (D ∘ g) , + is-section-map-section-construction-Cantor-Schröder-Bernstein–Escardó F' D +``` + +Injectivity of the constructed map. + +```agda + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó : + (F' : is-injective f) → + {x x' : A} + (d : is-decidable (is-perfect-image f g x)) + (d' : is-decidable (is-perfect-image f g x')) → + ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + ( x) + ( d)) = + ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + ( x') + ( d')) → + x = x' + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' { x} {x'} (inl ρ) (inl ρ') p = + ( inv (is-section-inverse-of-perfect-image x ρ)) ∙ + ( ap g p ∙ + is-section-inverse-of-perfect-image x' ρ') + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' {x} {x'} (inl ρ) (inr nρ') p = + ex-falso (perfect-image-has-distinct-image x' x nρ' ρ (inv p)) + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' { x} {x'} (inr nρ) (inl ρ') p = + ex-falso (perfect-image-has-distinct-image x x' nρ ρ' p) + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + F' {lx} {x'} (inr nρ) (inr nρ') p = F' p -- TODO: look for alternative approach avoiding `is-injective f` +``` + +Piecing it all together. + +```agda + is-equiv-map-construction-Cantor-Schröder-Bernstein–Escardó : + (F' : is-π₀-trivial-map' f) → + (F'' : is-injective f) → + (D : (x : A) → is-decidable (is-perfect-image f g x)) → + is-equiv (map-construction-Cantor-Schröder-Bernstein–Escardó D) + is-equiv-map-construction-Cantor-Schröder-Bernstein–Escardó + F' F'' D = + is-equiv-is-injective + ( section-construction-Cantor-Schröder-Bernstein–Escardó F' D) + ( λ {x} {x'} → + is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein–Escardó + ( F'') + ( D x) + ( D x')) + + equiv-construction-Cantor-Schröder-Bernstein–Escardó : + (F' : is-π₀-trivial-map' f) → + (F'' : is-injective f) → + (D : (x : A) → is-decidable (is-perfect-image f g x)) → + A ≃ B + equiv-construction-Cantor-Schröder-Bernstein–Escardó F' F'' D = + map-construction-Cantor-Schröder-Bernstein–Escardó D , + is-equiv-map-construction-Cantor-Schröder-Bernstein–Escardó F' F'' D +``` + +## Theorem + +### The Cantor-Schröder-Bernstein theorem assuming the weak limited principle of omniscience + +It follows from the weak limited principle of omniscience that, for every pair +of mutual decidable embeddings `f : A ↪ B` and `g : B ↪ A`, it is decidable for +every element `x : A` whether `x` is a perfect image of `g` relative to `f`. + +Applying this fact to the Cantor-Schröder-Bernstein-Escardó construction, we +conclude that every pair of types that mutually embed into oneanother via +decidable embeddings are equivalent. + +In fact, it suffices to assume that `f` is decidable, π₀-trivial, and injective. + +```agda +abstract + is-decidable-is-perfect-image'-WLPO : + {l1 l2 : Level} (wlpo : level-WLPO (l1 ⊔ l2)) + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} → + is-decidable-emb g → is-decidable-map f → is-π₀-trivial-map' f → + (a : A) → is-decidable (is-perfect-image' f g a) + is-decidable-is-perfect-image'-WLPO wlpo {f = f} {g} G F F' a = + wlpo + ( λ n → + is-perfect-image-at' f g a n , + is-decidable-prop-is-perfect-image-at' G F F' a n) + +is-decidable-is-perfect-image-WLPO : + {l1 l2 : Level} (wlpo : level-WLPO (l1 ⊔ l2)) + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} → + is-decidable-emb g → is-decidable-map f → is-π₀-trivial-map' f → + (a : A) → is-decidable (is-perfect-image f g a) +is-decidable-is-perfect-image-WLPO wlpo {f = f} {g} G F F' a = + is-decidable-equiv' + ( compute-is-perfect-image f g a) + ( is-decidable-is-perfect-image'-WLPO wlpo G F F' a) +``` + +```agda +generalized-Cantor-Schröder-Bernstein-WLPO : + {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} → + is-decidable-emb g → + is-decidable-map f → is-π₀-trivial-map' f → is-injective f → + A ≃ B +generalized-Cantor-Schröder-Bernstein-WLPO wlpo G F F' F'' = + equiv-construction-Cantor-Schröder-Bernstein–Escardó + ( is-injective-is-decidable-emb G) + ( is-double-negation-eliminating-map-is-decidable-emb G) + ( is-double-negation-eliminating-map-is-decidable-map F) + ( F') + ( F'') + ( is-decidable-is-perfect-image-WLPO wlpo + ( G) + ( F) + ( F')) + +Cantor-Schröder-Bernstein-WLPO' : + {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} → + is-decidable-emb g → is-decidable-emb f → + A ≃ B +Cantor-Schröder-Bernstein-WLPO' wlpo G F = + generalized-Cantor-Schröder-Bernstein-WLPO wlpo G + ( is-decidable-map-is-decidable-emb F) + ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb F)) + ( is-injective-is-decidable-emb F) + +Cantor-Schröder-Bernstein-WLPO : + {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} → (A ↪ᵈ B) → (B ↪ᵈ A) → A ≃ B +Cantor-Schröder-Bernstein-WLPO wlpo (f , F) (g , G) = + Cantor-Schröder-Bernstein-WLPO' wlpo G F +``` + +### The ε-generalized Cantor-Schröder-Bernstein-Escardó theorem + +Assuming the [law of exluded middle](foundation.law-of-excluded-middle.md), then +given two types `A` and `B` such that there is a π₀-trivial injection `A → B` +equipped with a Hilbert ε-operator, and an embedding `B ↪ A`, then `A` and `B` +are equivalent. + +```agda +ε-Cantor-Schröder-Bernstein-LEM : + {l1 l2 : Level} → LEM (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} + (G : is-emb g) → + (F : is-π₀-trivial-map' f) → + (F' : is-injective f) → + (εF : ε-operator-map-Hilbert f) → + A ≃ B +ε-Cantor-Schröder-Bernstein-LEM lem {f = f} {g} G F F' εF = + equiv-construction-Cantor-Schröder-Bernstein–Escardó + ( is-injective-is-emb G) + ( is-double-negation-eliminating-map-is-decidable-map + ( λ y → lem (fiber g y , is-prop-map-is-emb G y))) + ( λ y → + ( λ nnf → + εF ( y) - ( γ) - x : X - x = pr1 (pr1 w) - p : map-emb f x = y - p = pr2 (pr1 w) - ψ : - ( d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) → - map-Cantor-Schröder-Bernstein-Escardó' x d = y - ψ (inl v) = ex-falso ((pr2 w) v) - ψ (inr v) = p - b : - Σ ( X) - ( λ x → - ( (d : is-decidable (is-perfect-image (map-emb f) (map-emb g) x)) → - map-Cantor-Schröder-Bernstein-Escardó' x d = y)) - b = - a ( is-decidable-is-perfect-image-is-emb-LEM lem - ( is-emb-map-emb g) - ( map-emb g y)) - x : X - x = pr1 b - p : map-Cantor-Schröder-Bernstein-Escardó x = y - p = - pr2 b (is-decidable-is-perfect-image-is-emb-LEM lem (is-emb-map-emb g) x) - - is-equiv-map-Cantor-Schröder-Bernstein-Escardó : - is-equiv map-Cantor-Schröder-Bernstein-Escardó - is-equiv-map-Cantor-Schröder-Bernstein-Escardó = - is-equiv-is-split-surjective-is-injective - map-Cantor-Schröder-Bernstein-Escardó - is-injective-map-Cantor-Schröder-Bernstein-Escardó - is-split-surjective-map-Cantor-Schröder-Bernstein-Escardó + ( double-negation-elim-is-decidable + ( lem (trunc-Prop (fiber f y))) + ( map-double-negation unit-trunc-Prop nnf)))) + ( F) + ( F') + ( lem ∘ is-perfect-image-Prop G) +``` + +### The Cantor-Schröder-Bernstein-Escardó theorem + +```agda +Cantor-Schröder-Bernstein-Escardó' : + {l1 l2 : Level} → LEM (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} → + is-emb g → is-emb f → A ≃ B +Cantor-Schröder-Bernstein-Escardó' lem {f = f} {g} G F = + Cantor-Schröder-Bernstein-WLPO' + ( λ P → lem (Π-Prop ℕ (prop-Decidable-Prop ∘ P))) + ( G , λ y → lem (fiber g y , is-prop-map-is-emb G y)) + ( F , λ y → lem (fiber f y , is-prop-map-is-emb F y)) Cantor-Schröder-Bernstein-Escardó : - {l1 l2 : Level} (lem : LEM (l1 ⊔ l2)) → - statement-Cantor-Schröder-Bernstein-Escardó l1 l2 -Cantor-Schröder-Bernstein-Escardó lem f g = - ( map-Cantor-Schröder-Bernstein-Escardó lem f g , - is-equiv-map-Cantor-Schröder-Bernstein-Escardó lem f g) + {l1 l2 : Level} → LEM (l1 ⊔ l2) → + {A : UU l1} {B : UU l2} → + A ↪ B → B ↪ A → A ≃ B +Cantor-Schröder-Bernstein-Escardó lem (f , F) (g , G) = + Cantor-Schröder-Bernstein-Escardó' lem G F ``` -## Corollaries - ### The Cantor–Schröder–Bernstein theorem ```agda diff --git a/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md b/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md deleted file mode 100644 index 49a416fc04..0000000000 --- a/src/foundation/cantor-schroder-bernstein-wlpo.lagda.md +++ /dev/null @@ -1,371 +0,0 @@ -# The Cantor–Schröder–Bernstein-Escardó theorem - -```agda -module foundation.cantor-schroder-bernstein-wlpo where -``` - -
Imports - -```agda -open import elementary-number-theory.natural-numbers - -open import foundation.action-on-identifications-functions -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 -open import foundation.function-types -open import foundation.functoriality-dependent-pair-types -open import foundation.injective-maps -open import foundation.law-of-excluded-middle -open import foundation.maps-with-hilbert-epsilon-operators -open import foundation.perfect-images -open import foundation.pi-0-trivial-maps -open import foundation.propositional-truncations -open import foundation.propositions -open import foundation.sections -open import foundation.split-surjective-maps -open import foundation.universe-levels -open import foundation.weak-limited-principle-of-omniscience - -open import foundation-core.coproduct-types -open import foundation-core.embeddings -open import foundation-core.empty-types -open import foundation-core.equivalences -open import foundation-core.fibers-of-maps -open import foundation-core.identity-types -open import foundation-core.negation -open import foundation-core.propositional-maps -open import foundation-core.sets - -open import logic.double-negation-eliminating-maps -open import logic.double-negation-stable-embeddings -``` - -
- -## Idea - -> TODO - -## Construction - -Given a pair of mutual maps `f : A → B` and `g : B → A` such that - -1. `f` and `g` satisfy double negation elimination on their fibers -2. For every element `x : A` it is decidable wheter `x` is a perfect image of - `g` relative to `f` -3. `g` is injective -4. `f` is π₀-trivial - -Then `B` is a retract of `A`. If `f` moreover is injective, then this retract is -an equivalence. - -```agda -module _ - {l1 l2 : Level} - {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (G' : is-injective g) - (G : is-double-negation-eliminating-map g) - (F : is-double-negation-eliminating-map f) - where - - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : - (x : A) → is-decidable (is-perfect-image f g x) → B - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - x (inl γ) = - inverse-of-perfect-image x γ - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - x (inr nγ) = - f x - - compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : - (y : B) → - (γ : is-perfect-image f g (g y)) → - (d : is-decidable (is-perfect-image f g (g y))) → - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - ( g y) d = - y - compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - y γ (inl v') = - is-retraction-inverse-of-perfect-image G' y v' - compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - y γ (inr v) = - ex-falso (v γ) - - compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein : - (F' : is-π₀-trivial-map' f) → - (y : B) → - (nγ : ¬ (is-perfect-image f g (g y))) → - (d : - is-decidable - ( is-perfect-image f g - ( element-has-nonperfect-fiber-is-not-perfect-image - G G' F F' y nγ))) → - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - ( element-has-nonperfect-fiber-is-not-perfect-image G G' F F' y nγ) - ( d) = - y - compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein - F' y nγ (inl v) = - ex-falso - ( is-not-perfect-image-has-nonperfect-fiber-is-not-perfect-image - G G' F F' y nγ v) - compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein - F' y nγ (inr _) = - is-in-fiber-element-has-nonperfect-fiber-is-not-perfect-image - G G' F F' y nγ - - map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : - (F' : is-π₀-trivial-map' f) → - (y : B) → is-decidable (is-perfect-image f g (g y)) → A - map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' y (inl _) = g y - map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' y (inr nγ) = - element-has-nonperfect-fiber-is-not-perfect-image G G' F F' y nγ - - is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : - (F' : is-π₀-trivial-map' f) → - (y : B) - (d : is-decidable (is-perfect-image f g (g y))) → - (d' : - is-decidable - ( is-perfect-image f g - ( map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' y d))) → - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - ( map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' y d) - ( d') = - y - is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' y (inl γ) = - compute-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - y γ - is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' y (inr nγ) = - compute-map-construction-is-not-perfect-image-Cantor-Schröder-Bernstein - F' y nγ - - map-construction-Cantor-Schröder-Bernstein : - (D : (x : A) → is-decidable (is-perfect-image f g x)) → A → B - map-construction-Cantor-Schröder-Bernstein D x = - map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - ( x) - ( D x) - - map-section-construction-Cantor-Schröder-Bernstein : - (F' : is-π₀-trivial-map' f) → - (D : (y : B) → is-decidable (is-perfect-image f g (g y))) → B → A - map-section-construction-Cantor-Schröder-Bernstein F' D y = - map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - ( F') - ( y) - ( D y) - - is-section-map-section-construction-Cantor-Schröder-Bernstein : - (F' : is-π₀-trivial-map' f) → - (D : (x : A) → is-decidable (is-perfect-image f g x)) → - is-section - ( map-construction-Cantor-Schröder-Bernstein D) - ( map-section-construction-Cantor-Schröder-Bernstein F' (D ∘ g)) - is-section-map-section-construction-Cantor-Schröder-Bernstein F' D y = - is-section-map-section-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - ( F') - ( y) - ( D (g y)) - ( D (map-section-construction-Cantor-Schröder-Bernstein F' (D ∘ g) y)) - - section-construction-Cantor-Schröder-Bernstein : - (F' : is-π₀-trivial-map' f) → - (D : (x : A) → is-decidable (is-perfect-image f g x)) → - section (map-construction-Cantor-Schröder-Bernstein D) - section-construction-Cantor-Schröder-Bernstein F' D = - map-section-construction-Cantor-Schröder-Bernstein F' (D ∘ g) , - is-section-map-section-construction-Cantor-Schröder-Bernstein F' D -``` - -Injectivity of the constructed map. - -```agda - is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein : - (F' : is-injective f) → - {x x' : A} - (d : is-decidable (is-perfect-image f g x)) - (d' : is-decidable (is-perfect-image f g x')) → - ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - ( x) - ( d)) = - ( map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - ( x') - ( d')) → - x = x' - is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' { x} {x'} (inl ρ) (inl ρ') p = - ( inv (is-section-inverse-of-perfect-image x ρ)) ∙ - ( ap g p ∙ - is-section-inverse-of-perfect-image x' ρ') - is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' {x} {x'} (inl ρ) (inr nρ') p = - ex-falso (perfect-image-has-distinct-image x' x nρ' ρ (inv p)) - is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' { x} {x'} (inr nρ) (inl ρ') p = - ex-falso (perfect-image-has-distinct-image x x' nρ ρ' p) - is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - F' {lx} {x'} (inr nρ) (inr nρ') p = F' p -- TODO: find alternative approach avoiding `is-injective f` -``` - -Piecing it all together. - -```agda - is-equiv-map-construction-Cantor-Schröder-Bernstein : - (F' : is-π₀-trivial-map' f) → - (F'' : is-injective f) → - (D : (x : A) → is-decidable (is-perfect-image f g x)) → - is-equiv (map-construction-Cantor-Schröder-Bernstein D) - is-equiv-map-construction-Cantor-Schröder-Bernstein - F' F'' D = - is-equiv-is-injective - ( section-construction-Cantor-Schröder-Bernstein F' D) - ( λ {x} {x'} → - is-injective-map-construction-is-decidable-is-perfect-image-Cantor-Schröder-Bernstein - ( F'') - ( D x) - ( D x')) - - equiv-construction-Cantor-Schröder-Bernstein : - (F' : is-π₀-trivial-map' f) → - (F'' : is-injective f) → - (D : (x : A) → is-decidable (is-perfect-image f g x)) → - A ≃ B - equiv-construction-Cantor-Schröder-Bernstein F' F'' D = - map-construction-Cantor-Schröder-Bernstein D , - is-equiv-map-construction-Cantor-Schröder-Bernstein F' F'' D -``` - -## Theorem - -### The Cantor-Schröder-Bernstein-Escardó theorem assuming the weak limited principle of omniscience - -Assuming the weak limited principle of omniscience, then for every pair of -mutual decidable embeddings `f : A ↪ B` and `g : B ↪ A` it is decidable for -every element `x : A` whether it is a perfect image of `g` relative to `f`. -Therefore, `A ≃ B`. - -In fact, it suffices to assume that `f` is decidable, π₀-trivial, and injective. - -```agda -module _ - {l1 l2 : Level} (wlpo : level-WLPO (l1 ⊔ l2)) - {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (G : is-decidable-emb g) (F : is-decidable-map f) (F' : is-π₀-trivial-map' f) - where - - abstract - is-decidable-is-perfect-image'-WLPO : - (a : A) → is-decidable (is-perfect-image' f g a) - is-decidable-is-perfect-image'-WLPO a = - wlpo - ( λ n → - is-perfect-image-at' f g a n , - is-decidable-prop-is-perfect-image-at' G F F' a n) - - is-decidable-is-perfect-image-WLPO : - (a : A) → is-decidable (is-perfect-image f g a) - is-decidable-is-perfect-image-WLPO a = - is-decidable-equiv' - ( compute-is-perfect-image f g a) - ( is-decidable-is-perfect-image'-WLPO a) -``` - -```agda -generalized-Cantor-Schröder-Bernstein-WLPO : - {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → - {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} → - is-decidable-emb g → - is-decidable-map f → is-π₀-trivial-map' f → is-injective f → - A ≃ B -generalized-Cantor-Schröder-Bernstein-WLPO wlpo G F F' F'' = - equiv-construction-Cantor-Schröder-Bernstein - ( is-injective-is-decidable-emb G) - ( is-double-negation-eliminating-map-is-decidable-emb G) - ( is-double-negation-eliminating-map-is-decidable-map F) - ( F') - ( F'') - ( is-decidable-is-perfect-image-WLPO wlpo - ( G) - ( F) - ( F')) - -Cantor-Schröder-Bernstein-WLPO' : - {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → - {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (G : is-decidable-emb g) (F : is-decidable-emb f) → - A ≃ B -Cantor-Schröder-Bernstein-WLPO' wlpo G F = - generalized-Cantor-Schröder-Bernstein-WLPO wlpo G - ( is-decidable-map-is-decidable-emb F) - ( is-π₀-trivial-map'-is-emb (is-emb-is-decidable-emb F)) - ( is-injective-is-decidable-emb F) - -Cantor-Schröder-Bernstein-WLPO : - {l1 l2 : Level} → level-WLPO (l1 ⊔ l2) → - {A : UU l1} {B : UU l2} → (A ↪ᵈ B) → (B ↪ᵈ A) → A ≃ B -Cantor-Schröder-Bernstein-WLPO wlpo (f , F) (g , G) = - Cantor-Schröder-Bernstein-WLPO' wlpo G F -``` - -### The slightly generalized Cantor-Schröder-Bernstein-Escardó theorem assuming the law of excluded middle - -Assuming the [law of exluded middle](foundation.law-of-excluded-middle.md), then -given two types `A` and `B` such that there is a π₀-trivial injection `A → B` -equipped with a Hilbert ε-operator, and an embedding `B ↪ A`, then `A` and `B` -are equivalent. - -```agda -generalized-Cantor-Schröder-Bernstein-LEM : - {l1 l2 : Level} → LEM (l1 ⊔ l2) → - {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (G : is-emb g) → - (F : is-π₀-trivial-map' f) → - (F' : is-injective f) → - (εF : ε-operator-map-Hilbert f) → - A ≃ B -generalized-Cantor-Schröder-Bernstein-LEM lem {f = f} {g} G F F' εF = - equiv-construction-Cantor-Schröder-Bernstein - ( is-injective-is-emb G) - ( is-double-negation-eliminating-map-is-decidable-map - ( λ y → lem (fiber g y , is-prop-map-is-emb G y))) - ( λ y → - ( λ nnf → - εF - ( y) - ( double-negation-elim-is-decidable - ( lem (trunc-Prop (fiber f y))) - ( map-double-negation unit-trunc-Prop nnf)))) - ( F) - ( F') - ( lem ∘ is-perfect-image-Prop G) -``` - -```agda -Cantor-Schröder-Bernstein-Escardó'' : - {l1 l2 : Level} → LEM (l1 ⊔ l2) → - {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} → - is-emb g → is-emb f → A ≃ B -Cantor-Schröder-Bernstein-Escardó'' lem {f = f} {g} G F = - Cantor-Schröder-Bernstein-WLPO' - ( λ P → lem (Π-Prop ℕ (prop-Decidable-Prop ∘ P))) - ( G , λ y → lem (fiber g y , is-prop-map-is-emb G y)) - ( F , λ y → lem (fiber f y , is-prop-map-is-emb F y)) - -Cantor-Schröder-Bernstein-Escardó' : - {l1 l2 : Level} → LEM (l1 ⊔ l2) → - {A : UU l1} {B : UU l2} → - A ↪ B → B ↪ A → A ≃ B -Cantor-Schröder-Bernstein-Escardó' lem (f , F) (g , G) = - Cantor-Schröder-Bernstein-Escardó'' lem G F -``` diff --git a/src/logic/de-morgan-types.lagda.md b/src/logic/de-morgan-types.lagda.md index a87cd18593..30df2f4874 100644 --- a/src/logic/de-morgan-types.lagda.md +++ b/src/logic/de-morgan-types.lagda.md @@ -35,6 +35,7 @@ open import foundation-core.equivalences open import foundation-core.propositions open import logic.de-morgans-law +open import logic.propositionally-decidable-types ```
From 77381ec185f8a973875454fe064a676dda0a8dd5 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 21 Jan 2025 22:31:24 +0100 Subject: [PATCH 82/83] edits --- ...ecidable-dependent-function-types.lagda.md | 3 +- ...ps-with-hilbert-epsilon-operators.lagda.md | 28 --- src/foundation/perfect-images.lagda.md | 121 +++++----- .../propositionally-decidable-maps.lagda.md | 125 ---------- ...-double-negation-eliminating-maps.lagda.md | 216 ------------------ 5 files changed, 57 insertions(+), 436 deletions(-) diff --git a/src/foundation/decidable-dependent-function-types.lagda.md b/src/foundation/decidable-dependent-function-types.lagda.md index 3edb0a498f..36fbf97559 100644 --- a/src/foundation/decidable-dependent-function-types.lagda.md +++ b/src/foundation/decidable-dependent-function-types.lagda.md @@ -108,7 +108,8 @@ is-decidable-Π-Maybe {B = B} du de = ### Dependent products of decidable propositions over a π₀-trivial base are decidable propositions -In other words, the base is empty or 0-connected. +Assuming the base `A` is empty or 0-connected, a dependent product of decidable +propositions over `A` is again a decidable proposition. ```agda module _ diff --git a/src/foundation/maps-with-hilbert-epsilon-operators.lagda.md b/src/foundation/maps-with-hilbert-epsilon-operators.lagda.md index 5a508fd443..2d83b0d4ef 100644 --- a/src/foundation/maps-with-hilbert-epsilon-operators.lagda.md +++ b/src/foundation/maps-with-hilbert-epsilon-operators.lagda.md @@ -7,38 +7,10 @@ module foundation.maps-with-hilbert-epsilon-operators where
Imports ```agda -open import elementary-number-theory.natural-numbers - -open import foundation.action-on-identifications-functions -open import foundation.cartesian-morphisms-arrows -open import foundation.coproduct-types -open import foundation.decidable-dependent-pair-types -open import foundation.decidable-equality -open import foundation.decidable-types -open import foundation.dependent-pair-types -open import foundation.functoriality-cartesian-product-types -open import foundation.functoriality-coproduct-types open import foundation.hilberts-epsilon-operators -open import foundation.identity-types -open import foundation.mere-equality -open import foundation.pi-0-trivial-maps -open import foundation.propositional-truncations -open import foundation.retracts-of-maps -open import foundation.transport-along-identifications open import foundation.universe-levels -open import foundation-core.contractible-maps -open import foundation-core.contractible-types -open import foundation-core.empty-types -open import foundation-core.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.injective-maps -open import foundation-core.iterating-functions -open import foundation-core.retractions -open import foundation-core.sections ```
diff --git a/src/foundation/perfect-images.lagda.md b/src/foundation/perfect-images.lagda.md index 7fac28b15c..121b422985 100644 --- a/src/foundation/perfect-images.lagda.md +++ b/src/foundation/perfect-images.lagda.md @@ -158,24 +158,25 @@ module _ ## Properties -If `g` is an embedding then being a perfect image for `g` is a property. +### If `g` is an embedding then being a perfect image for `g` is a property ```agda module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} (is-emb-g : is-emb g) + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} where is-prop-is-perfect-image-is-emb : - (a : A) → is-prop (is-perfect-image f g a) - is-prop-is-perfect-image-is-emb a = - is-prop-iterated-Π 3 (λ a₀ n p → is-prop-map-is-emb is-emb-g a₀) + is-emb g → (a : A) → is-prop (is-perfect-image f g a) + is-prop-is-perfect-image-is-emb G a = + is-prop-iterated-Π 3 (λ a₀ n p → is-prop-map-is-emb G a₀) - is-perfect-image-Prop : A → Prop (l1 ⊔ l2) - pr1 (is-perfect-image-Prop a) = is-perfect-image f g a - pr2 (is-perfect-image-Prop a) = is-prop-is-perfect-image-is-emb a + is-perfect-image-Prop : is-emb g → A → Prop (l1 ⊔ l2) + pr1 (is-perfect-image-Prop G a) = is-perfect-image f g a + pr2 (is-perfect-image-Prop G a) = is-prop-is-perfect-image-is-emb G a ``` +### Fibers over perfect images + If `a` is a perfect image for `g`, then `a` has a preimage under `g`. Just take `n = zero` in the definition. @@ -206,16 +207,19 @@ module _ is-section-inverse-of-perfect-image a ρ = pr2 (fiber-is-perfect-image a ρ) ``` +When `g` is also injective, the map gives a kind of +[retraction](foundation-core.retractions.md) of `g`. + ```agda module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} (G : is-injective g) + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} where is-retraction-inverse-of-perfect-image : + is-injective g → (b : B) (ρ : is-perfect-image f g (g b)) → inverse-of-perfect-image (g b) ρ = b - is-retraction-inverse-of-perfect-image b ρ = + is-retraction-inverse-of-perfect-image G b ρ = G (is-section-inverse-of-perfect-image (g b) ρ) ``` @@ -228,8 +232,7 @@ module _ previous-perfect-image-at' : (a : A) (n : ℕ) → - is-perfect-image-at' f g (g (f a)) (succ-ℕ n) → - is-perfect-image-at' f g a n + is-perfect-image-at' f g (g (f a)) (succ-ℕ n) → is-perfect-image-at' f g a n previous-perfect-image-at' a n γ (a₀ , p) = γ (a₀ , ap (g ∘ f) p) previous-perfect-image' : @@ -241,8 +244,8 @@ module _ previous-perfect-image a γ a₀ n p = γ a₀ (succ-ℕ n) (ap (g ∘ f) p) ``` -Perfect images goes to a disjoint place under `inverse-of-perfect-image` than -`f` +Perfect images of `g` relative to `f` not mapped to the image of `f` under +`inverse-of-perfect-image`. ```agda module _ @@ -267,7 +270,12 @@ module _ v = tr (λ a' → ¬ (is-perfect-image f g a')) q s ``` -### Decidability of being a perfect image at a natural number +### Decidability of perfect images + +Assuming `g` and `f` are decidable embedding, then for every natural number +`n : ℕ` and every element `a : A` it is decidable whether `a` is a perfect image +of `g` relative to `f` after `n` iterations. In fact, the map `f` need only be +propositionally decidable and π₀-trivial. ```agda module _ @@ -306,92 +314,73 @@ module _ ( is-inhabited-or-empty-map-is-decidable-map F) ``` -### The constructive story - -#### Untruncated double negation elimination on nonperfect fibers +### Double negation elimination on nonperfect fibers If we assume that `g` is a double negation eliminating map, we can prove that if `is-nonperfect-image a` does not hold, then we have `is-perfect-image a`. ```agda module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} (G : is-double-negation-eliminating-map g) + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} where double-negation-elim-is-perfect-image : + is-double-negation-eliminating-map g → (a : A) → ¬ (is-nonperfect-image a) → is-perfect-image f g a - double-negation-elim-is-perfect-image a nρ a₀ n p = + double-negation-elim-is-perfect-image G a nρ a₀ n p = G a₀ (λ a₁ → nρ (a₀ , n , p , a₁)) ``` -The following property states that if `g (b)` is not a perfect image, then `b` -has an `f` fiber `a` that is not a perfect image for `g`. Again, we need to -assume law of excluded middle and that both `g` and `f` are embedding. +If `g(b)` is not a perfect image, then `b` has an `f`-fiber `a` that is not a +perfect image for `g`. ```agda module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} - (G : is-double-negation-eliminating-map g) - (b : B) - (nρ : ¬ (is-perfect-image f g (g b))) + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} where is-irrefutable-is-nonperfect-image-is-not-perfect-image : + (G : is-double-negation-eliminating-map g) + (b : B) (nρ : ¬ (is-perfect-image f g (g b))) → ¬¬ (is-nonperfect-image {f = f} (g b)) - is-irrefutable-is-nonperfect-image-is-not-perfect-image nμ = + is-irrefutable-is-nonperfect-image-is-not-perfect-image G b nρ nμ = nρ (double-negation-elim-is-perfect-image G (g b) nμ) -module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} - (is-injective-g : is-injective g) (b : B) - where - has-nonperfect-fiber-is-nonperfect-image : + is-injective g → (b : B) → is-nonperfect-image {f = f} (g b) → has-nonperfect-fiber f g b - has-nonperfect-fiber-is-nonperfect-image (x₀ , zero-ℕ , u) = + has-nonperfect-fiber-is-nonperfect-image G b (x₀ , zero-ℕ , u) = ex-falso (pr2 u (b , inv (pr1 u))) - has-nonperfect-fiber-is-nonperfect-image (x₀ , succ-ℕ n , u) = - ( iterate n (g ∘ f) x₀ , is-injective-g (pr1 u)) , + has-nonperfect-fiber-is-nonperfect-image G b (x₀ , succ-ℕ n , u) = + ( iterate n (g ∘ f) x₀ , G (pr1 u)) , ( λ s → pr2 u (s x₀ n refl)) -module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} - (is-double-negation-eliminating-g : is-double-negation-eliminating-map g) - (is-injective-g : is-injective g) - (b : B) (nρ : ¬ (is-perfect-image f g (g b))) - where - is-irrefutable-has-nonperfect-fiber-is-not-perfect-image : + is-double-negation-eliminating-map g → is-injective g → + (b : B) (nρ : ¬ (is-perfect-image f g (g b))) → ¬¬ (has-nonperfect-fiber f g b) - is-irrefutable-has-nonperfect-fiber-is-not-perfect-image t = - is-irrefutable-is-nonperfect-image-is-not-perfect-image - ( is-double-negation-eliminating-g) - ( b) - ( nρ) - ( λ s → t (has-nonperfect-fiber-is-nonperfect-image is-injective-g b s)) + is-irrefutable-has-nonperfect-fiber-is-not-perfect-image G G' b nρ t = + is-irrefutable-is-nonperfect-image-is-not-perfect-image G b nρ + ( λ s → t (has-nonperfect-fiber-is-nonperfect-image G' b s)) +``` +If `f` is π₀-trivial and has double negation elimination, then + +```agda module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} - (is-double-negation-eliminating-f : is-double-negation-eliminating-map f) - (is-π₀-trivial-f : is-π₀-trivial-map' f) - (b : B) + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} where double-negation-elim-has-nonperfect-fiber : - has-double-negation-elim (has-nonperfect-fiber f g b) - double-negation-elim-has-nonperfect-fiber = - double-negation-elim-Σ-all-elements-merely-equal-base - ( is-π₀-trivial-f b) - ( is-double-negation-eliminating-f b) + is-double-negation-eliminating-map f → + is-π₀-trivial-map' f → + (b : B) → has-double-negation-elim (has-nonperfect-fiber f g b) + double-negation-elim-has-nonperfect-fiber F F' b = + double-negation-elim-Σ-all-elements-merely-equal-base (F' b) (F b) ( λ p → double-negation-elim-neg (is-perfect-image f g (pr1 p))) module _ - {l1 l2 : Level} {A : UU l1} {B : UU l2} - {f : A → B} {g : B → A} + {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} {g : B → A} (is-double-negation-eliminating-g : is-double-negation-eliminating-map g) (is-injective-g : is-injective g) (is-double-negation-eliminating-f : is-double-negation-eliminating-map f) diff --git a/src/logic/propositionally-decidable-maps.lagda.md b/src/logic/propositionally-decidable-maps.lagda.md index 39b9e8bc5c..e81148285d 100644 --- a/src/logic/propositionally-decidable-maps.lagda.md +++ b/src/logic/propositionally-decidable-maps.lagda.md @@ -194,128 +194,3 @@ module _ ( is-inhabited-or-empty-f) ( is-inhabited-or-empty-map-iterate-is-π₀-trivial-map' n) ``` - -### Left cancellation for decidable maps - -If a composite `g ∘ f` is decidable and `g` is injective then `f` is decidable. - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} - where - - abstract - is-inhabited-or-empty-map-right-factor' : - is-inhabited-or-empty-map (g ∘ f) → is-injective g → is-inhabited-or-empty-map f - is-inhabited-or-empty-map-right-factor' GF G y = - rec-coproduct - ( λ q → inl (pr1 q , G (pr2 q))) - ( λ q → inr (λ x → q ((pr1 x) , ap g (pr2 x)))) - ( GF (g y)) -``` - -### Retracts into types with decidable equality are decidable - -```text -is-inhabited-or-empty-map-retraction : - {l1 l2 : Level} {A : UU l1} {B : UU l2} → has-decidable-equality B → - (i : A → B) → retraction i → is-inhabited-or-empty-map i -is-inhabited-or-empty-map-retraction d i (r , R) b = - is-decidable-iff - ( λ (p : i (r b) = b) → r b , p) - ( λ t → ap (i ∘ r) (inv (pr2 t)) ∙ ap i (R (pr1 t)) ∙ pr2 t) - ( d (i (r b)) b) -``` - -### The map on total spaces induced by a family of decidable maps is decidable - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} - where - - is-inhabited-or-empty-map-tot : - {f : (x : A) → B x → C x} → - ((x : A) → is-inhabited-or-empty-map (f x)) → is-inhabited-or-empty-map (tot f) - is-inhabited-or-empty-map-tot {f} H x = - is-decidable-equiv (compute-fiber-tot f x) (H (pr1 x) (pr2 x)) -``` - -### The map on total spaces induced by a decidable map on the base is decidable - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) - where - - is-inhabited-or-empty-map-Σ-map-base : - {f : A → B} → is-inhabited-or-empty-map f → is-inhabited-or-empty-map (map-Σ-map-base f C) - is-inhabited-or-empty-map-Σ-map-base {f} H x = - is-decidable-equiv' (compute-fiber-map-Σ-map-base f C x) (H (pr1 x)) -``` - -### Products of decidable maps are decidable - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} - where - - is-inhabited-or-empty-map-product : - {f : A → B} {g : C → D} → - is-inhabited-or-empty-map f → is-inhabited-or-empty-map g → is-inhabited-or-empty-map (map-product f g) - is-inhabited-or-empty-map-product {f} {g} F G x = - is-decidable-equiv - ( compute-fiber-map-product f g x) - ( is-decidable-product (F (pr1 x)) (G (pr2 x))) -``` - -### Coproducts of decidable maps are decidable - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} - where - - is-inhabited-or-empty-map-coproduct : - {f : A → B} {g : C → D} → - is-inhabited-or-empty-map f → - is-inhabited-or-empty-map g → - is-inhabited-or-empty-map (map-coproduct f g) - is-inhabited-or-empty-map-coproduct {f} {g} F G (inl x) = - is-decidable-equiv' (compute-fiber-inl-map-coproduct f g x) (F x) - is-inhabited-or-empty-map-coproduct {f} {g} F G (inr y) = - is-decidable-equiv' (compute-fiber-inr-map-coproduct f g y) (G y) -``` - -### Propositionally decidable maps are closed under base change - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} - {f : A → B} {g : C → D} - where - - is-inhabited-or-empty-map-base-change : - cartesian-hom-arrow g f → is-inhabited-or-empty-map f → is-inhabited-or-empty-map g - is-inhabited-or-empty-map-base-change α F d = - is-decidable-equiv - ( equiv-fibers-cartesian-hom-arrow g f α d) - ( F (map-codomain-cartesian-hom-arrow g f α d)) -``` - -### Propositionally decidable maps are closed under retracts of maps - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} - {f : A → B} {g : X → Y} - where - - is-decidable-retract-map : - f retract-of-map g → is-inhabited-or-empty-map g → is-inhabited-or-empty-map f - is-decidable-retract-map R G x = - is-decidable-retract-of - ( retract-fiber-retract-map f g R x) - ( G (map-codomain-inclusion-retract-map f g R x)) -``` diff --git a/src/logic/propositionally-double-negation-eliminating-maps.lagda.md b/src/logic/propositionally-double-negation-eliminating-maps.lagda.md index a636ec1943..633ea49a3b 100644 --- a/src/logic/propositionally-double-negation-eliminating-maps.lagda.md +++ b/src/logic/propositionally-double-negation-eliminating-maps.lagda.md @@ -141,219 +141,3 @@ is-prop-double-negation-eliminating-map-is-inhabited-or-empty-map : is-prop-double-negation-eliminating-map-is-inhabited-or-empty-map H y = prop-double-negation-elim-is-inhabited-or-empty (H y) ``` - -### Composition of double negation eliminating maps - -Given a composition `g ∘ f` of double negation eliminating maps where the left -factor `g` is injective, then the composition is double negation eliminating. - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} - {g : B → C} {f : A → B} - where - - fiber-left-is-prop-double-negation-eliminating-map-left : - is-prop-double-negation-eliminating-map g → - (z : C) → ¬¬ (fiber (g ∘ f) z) → fiber g z - fiber-left-is-prop-double-negation-eliminating-map-left G z nngfz = - G z (λ x → nngfz (λ w → x (f (pr1 w) , pr2 w))) - - fiber-right-is-prop-double-negation-eliminating-map-comp : - is-injective g → - (G : is-prop-double-negation-eliminating-map g) → - is-prop-double-negation-eliminating-map f → - (z : C) (nngfz : ¬¬ (fiber (g ∘ f) z)) → - fiber f (pr1 (fiber-left-is-prop-double-negation-eliminating-map-left G z nngfz)) - fiber-right-is-prop-double-negation-eliminating-map-comp H G F z nngfz = - F ( pr1 - ( fiber-left-is-prop-double-negation-eliminating-map-left G z nngfz)) - ( λ x → - nngfz - ( λ w → - x ( pr1 w , - H ( pr2 w ∙ - inv - ( pr2 - ( fiber-left-is-prop-double-negation-eliminating-map-left - G z nngfz)))))) - - is-prop-double-negation-eliminating-map-comp : - is-injective g → - is-prop-double-negation-eliminating-map g → - is-prop-double-negation-eliminating-map f → - is-prop-double-negation-eliminating-map (g ∘ f) - is-prop-double-negation-eliminating-map-comp H G F z nngfz = - map-inv-compute-fiber-comp g f z - ( ( fiber-left-is-prop-double-negation-eliminating-map-left G z nngfz) , - ( fiber-right-is-prop-double-negation-eliminating-map-comp H G F z nngfz)) -``` - -### Left cancellation for double negation eliminating maps - -If a composite `g ∘ f` is double negation eliminating and the left factor `g` is -injective, then the right factor `f` is double negation eliminating. - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {f : A → B} {g : B → C} - (GF : is-prop-double-negation-eliminating-map (g ∘ f)) - where - - fiber-comp-is-prop-double-negation-eliminating-map-right-factor' : - (y : B) → ¬¬ (fiber f y) → Σ (fiber g (g y)) (λ t → fiber f (pr1 t)) - fiber-comp-is-prop-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)))) - - is-prop-double-negation-eliminating-map-right-factor' : - is-injective g → is-prop-double-negation-eliminating-map f - is-prop-double-negation-eliminating-map-right-factor' G y nnfy = - tr - ( fiber f) - ( G ( pr2 - ( pr1 - ( fiber-comp-is-prop-double-negation-eliminating-map-right-factor' - ( y) - ( nnfy))))) - ( pr2 - ( fiber-comp-is-prop-double-negation-eliminating-map-right-factor' y nnfy)) -``` - -### Any map out of the empty type is double negation eliminating - -```text -abstract - is-prop-double-negation-eliminating-map-ex-falso : - {l : Level} {X : UU l} → - is-prop-double-negation-eliminating-map (ex-falso {l} {X}) - is-prop-double-negation-eliminating-map-ex-falso x f = ex-falso (f λ ()) -``` - -### The identity map is double negation eliminating - -```text -abstract - is-prop-double-negation-eliminating-map-id : - {l : Level} {X : UU l} → is-prop-double-negation-eliminating-map (id {l} {X}) - is-prop-double-negation-eliminating-map-id x y = (x , refl) -``` - -### Equivalences are double negation eliminating maps - -```text -abstract - is-prop-double-negation-eliminating-map-is-equiv : - {l1 l2 : Level} {A : UU l1} {B : UU l2} {f : A → B} → - is-equiv f → is-prop-double-negation-eliminating-map f - is-prop-double-negation-eliminating-map-is-equiv H x = - double-negation-elim-is-contr (is-contr-map-is-equiv H x) -``` - -### The map on total spaces induced by a family of double negation eliminating maps is double negation eliminating - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : A → UU l2} {C : A → UU l3} - where - - is-prop-double-negation-eliminating-map-tot : - {f : (x : A) → B x → C x} → - ((x : A) → is-prop-double-negation-eliminating-map (f x)) → - is-prop-double-negation-eliminating-map (tot f) - is-prop-double-negation-eliminating-map-tot {f} H x = - has-double-negation-elim-equiv (compute-fiber-tot f x) (H (pr1 x) (pr2 x)) -``` - -### The map on total spaces induced by a double negation eliminating map on the base is double negation eliminating - -```text -module _ - {l1 l2 l3 : Level} {A : UU l1} {B : UU l2} (C : B → UU l3) - where - - is-prop-double-negation-eliminating-map-Σ-map-base : - {f : A → B} → - is-prop-double-negation-eliminating-map f → - is-prop-double-negation-eliminating-map (map-Σ-map-base f C) - is-prop-double-negation-eliminating-map-Σ-map-base {f} H x = - has-double-negation-elim-equiv' - ( compute-fiber-map-Σ-map-base f C x) - ( H (pr1 x)) -``` - -### Products of double negation eliminating maps are double negation eliminating - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} - where - - is-prop-double-negation-eliminating-map-product : - {f : A → B} {g : C → D} → - is-prop-double-negation-eliminating-map f → - is-prop-double-negation-eliminating-map g → - is-prop-double-negation-eliminating-map (map-product f g) - is-prop-double-negation-eliminating-map-product {f} {g} F G x = - has-double-negation-elim-equiv - ( compute-fiber-map-product f g x) - ( double-negation-elim-product (F (pr1 x)) (G (pr2 x))) -``` - -### Coproducts of double negation eliminating maps are double negation eliminating - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} - where - - is-prop-double-negation-eliminating-map-coproduct : - {f : A → B} {g : C → D} → - is-prop-double-negation-eliminating-map f → - is-prop-double-negation-eliminating-map g → - is-prop-double-negation-eliminating-map (map-coproduct f g) - is-prop-double-negation-eliminating-map-coproduct {f} {g} F G (inl x) = - has-double-negation-elim-equiv' - ( compute-fiber-inl-map-coproduct f g x) - ( F x) - is-prop-double-negation-eliminating-map-coproduct {f} {g} F G (inr y) = - has-double-negation-elim-equiv' - ( compute-fiber-inr-map-coproduct f g y) - ( G y) -``` - -### Double negation eliminating maps are closed under base change - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {C : UU l3} {D : UU l4} - {f : A → B} {g : C → D} - where - - is-prop-double-negation-eliminating-map-base-change : - cartesian-hom-arrow g f → - is-prop-double-negation-eliminating-map f → - is-prop-double-negation-eliminating-map g - is-prop-double-negation-eliminating-map-base-change α F d = - has-double-negation-elim-equiv - ( equiv-fibers-cartesian-hom-arrow g f α d) - ( F (map-codomain-cartesian-hom-arrow g f α d)) -``` - -### Double negation eliminating maps are closed under retracts of maps - -```text -module _ - {l1 l2 l3 l4 : Level} {A : UU l1} {B : UU l2} {X : UU l3} {Y : UU l4} - {f : A → B} {g : X → Y} - where - - is-prop-double-negation-eliminating-retract-map : - f retract-of-map g → - is-prop-double-negation-eliminating-map g → - is-prop-double-negation-eliminating-map f - is-prop-double-negation-eliminating-retract-map R G x = - has-double-negation-elim-retract - ( retract-fiber-retract-map f g R x) - ( G (map-codomain-inclusion-retract-map f g R x)) -``` From a1042ae8f05a70d30b11748f823255bad0932eda Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Tue, 21 Jan 2025 22:37:10 +0100 Subject: [PATCH 83/83] fix links --- ...-limited-principle-of-omniscience.lagda.md | 21 ++++++++++++++++++- src/foundation/pi-0-trivial-maps.lagda.md | 7 +++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/foundation/lesser-limited-principle-of-omniscience.lagda.md b/src/foundation/lesser-limited-principle-of-omniscience.lagda.md index 176f5f34cf..e0ef1ebe49 100644 --- a/src/foundation/lesser-limited-principle-of-omniscience.lagda.md +++ b/src/foundation/lesser-limited-principle-of-omniscience.lagda.md @@ -26,7 +26,7 @@ open import foundation-core.sets
-## Statement +## Idea The {{#concept "lesser limited principle of omniscience" Agda=LLPO}} (LLPO) asserts that for any [sequence](foundation.sequences.md) of @@ -34,6 +34,10 @@ asserts that for any [sequence](foundation.sequences.md) of [at most one](foundation-core.propositions.md) `n`, then either `f n` is false for all even `n` or `f n` is false for all odd `n`. +## Definitions + +### The small lesser limited principle of omniscience + ```agda prop-bool-LLPO : Prop lzero prop-bool-LLPO = @@ -53,6 +57,8 @@ is-prop-bool-LLPO : is-prop bool-LLPO is-prop-bool-LLPO = is-prop-type-Prop prop-bool-LLPO ``` +### The lesser limited principle of omniscience with respect to a universe level + ```agda prop-level-LLPO : (l : Level) → Prop (lsuc l) prop-level-LLPO l = @@ -72,6 +78,19 @@ prop-level-LLPO l = function-Prop ( is-odd-ℕ n) ( neg-Prop (prop-Decidable-Prop (f n))))))) + +level-LLPO : (l : Level) → UU (lsuc l) +level-LLPO l = type-Prop (prop-level-LLPO l) + +is-prop-level-LLPO : {l : Level} → is-prop (level-LLPO l) +is-prop-level-LLPO {l} = is-prop-type-Prop (prop-level-LLPO l) +``` + +### The lesser limited principle of omniscience + +```agda +LLPO : UUω +LLPO = {l : Level} → level-LLPO l ``` ## See also diff --git a/src/foundation/pi-0-trivial-maps.lagda.md b/src/foundation/pi-0-trivial-maps.lagda.md index ad4f58ffe5..52a95b2dec 100644 --- a/src/foundation/pi-0-trivial-maps.lagda.md +++ b/src/foundation/pi-0-trivial-maps.lagda.md @@ -43,8 +43,11 @@ open import foundation-core.sections ## Idea A [map](foundation-core.function-types.md) is said to be -{{#concept "π₀-trivial" Disambiguation="map of types" Agda=is-π₀-trivial-map}} -if its [fibers](foundation-core.fibers-of-maps.md) are π₀-trivial. +{{#concept "π₀-trivial" Disambiguation="map of types" Agda=is-π₀-trivial-map'}} +if its [fibers](foundation-core.fibers-of-maps.md) are π₀-trivial. I.e., that +their [set of connected components](foundation.connected-components.md) is a +[proposition](foundation-core.propositions.md). Equivalently, a type is +π₀-trivial if all its elements are [merely equal](foundation.mere-equality.md). ## Definitions