From 68ffc456d64269991c1037b816266753929ea3a6 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sat, 8 Feb 2025 13:15:40 -0800 Subject: [PATCH 001/119] Associativity of min and max --- .../decidable-total-orders.lagda.md | 254 +++++++++++++++++- 1 file changed, 249 insertions(+), 5 deletions(-) diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index 96894e44f7..c183071260 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -7,6 +7,7 @@ module order-theory.decidable-total-orders where
Imports ```agda +open import foundation.action-on-identifications-functions open import foundation.binary-relations open import foundation.coproduct-types open import foundation.decidable-propositions @@ -197,11 +198,11 @@ module _ where min-Decidable-Total-Order : type-Decidable-Total-Order T - min-Decidable-Total-Order = - rec-coproduct - ( λ x≤y → x) - ( λ y Date: Sat, 8 Feb 2025 13:22:54 -0800 Subject: [PATCH 002/119] Formatting --- src/order-theory/decidable-total-orders.lagda.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index c183071260..58125369d8 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -424,7 +424,7 @@ associative-min-Decidable-Total-Order T x y z = = min-Decidable-Total-Order T y z by ap-min-z-right - (right-leq-left-min-Decidable-Total-Order T x y y≤x) + ( right-leq-left-min-Decidable-Total-Order T x y y≤x) = z by right-leq-left-min-Decidable-Total-Order T y z z≤y = min-Decidable-Total-Order T x z by @@ -517,7 +517,7 @@ associative-max-Decidable-Total-Order T x y z = = max-Decidable-Total-Order T x z by ap-max-z-right - (right-leq-left-max-Decidable-Total-Order T x y y≤x) + ( right-leq-left-max-Decidable-Total-Order T x y y≤x) = x by right-leq-left-max-Decidable-Total-Order @@ -531,7 +531,7 @@ associative-max-Decidable-Total-Order T x y z = by ap ( max-Decidable-Total-Order T x) - (inv (right-leq-left-max-Decidable-Total-Order T y z z≤y))) + ( inv (right-leq-left-max-Decidable-Total-Order T y z z≤y))) ( is-leq-or-strict-greater-Decidable-Total-Order T y z)) ( is-leq-or-strict-greater-Decidable-Total-Order T x y) where From 6a9f8370e6b7eeb750fce2777014954461265d16 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 9 Feb 2025 11:54:20 -0800 Subject: [PATCH 003/119] Define lower Dedekind cuts/reals --- .../lower-dedekind-real-numbers.lagda.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 src/real-numbers/lower-dedekind-real-numbers.lagda.md diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md new file mode 100644 index 0000000000..58b8384159 --- /dev/null +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -0,0 +1,115 @@ +# Lower Dedekind real numbers + +```agda +module real-numbers.lower-dedekind-real-numbers where +``` + +
Imports +```agda +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.dependent-pair-types +open import foundation.subtypes +open import foundation.conjunction +open import foundation.identity-types +open import foundation.existential-quantification +open import foundation.propositions +open import foundation.logical-equivalences +open import foundation.universe-levels +open import foundation.universal-quantification +``` + +
+## Idea + +A lower +{{#concept "Dedekind cut" Agda=is-dedekind-cut WD="dedekind cut" WDID=Q851333}} +consists of a +[subtype](foundation-core.subtypes.md) `L` of +[the rational numbers](elementary-number-theory.rational-numbers.md) `ℚ`, +satisfying the following two conditions: + +1. _Inhabitedness_. `L` is [inhabited](foundation.inhabited-subtypes.md). +2. _Roundedness_. A rational number `q` is in `L` + [if and only if](foundation.logical-equivalences.md) there + [exists](foundation.existential-quantification.md) `q < r` such that `r ∈ L`. + +The type of all lower Dedekind real numbers is the type of all lower Dedekind cuts. +A lower Dedekind cut is part of a [Dedekind real number](real-numbers.dedekind-real-numbers.md) + +## Definition + +### Lower Dedekind cuts + +```agda +module _ + {l : Level} + (L : subtype l ℚ) + where + + is-lower-dedekind-cut-Prop : Prop l + is-lower-dedekind-cut-Prop = + (∃ ℚ L) ∧ + (∀' ℚ (λ q → L q ⇔ (∃ ℚ (λ r → le-ℚ-Prop q r ∧ L r)))) + + is-lower-dedekind-cut : UU l + is-lower-dedekind-cut = type-Prop is-lower-dedekind-cut-Prop +``` + +## The lower Dedekind real numbers + +```agda +lower-ℝ : (l : Level) → UU (lsuc l) +lower-ℝ l = Σ (subtype l ℚ) is-lower-dedekind-cut + +module _ + {l : Level} + (x : lower-ℝ l) + where + + cut-lower-ℝ : subtype l ℚ + cut-lower-ℝ = pr1 x + + is-in-cut-lower-ℝ : ℚ → UU l + is-in-cut-lower-ℝ = is-in-subtype cut-lower-ℝ + + is-inhabited-lower-ℝ : exists ℚ cut-lower-ℝ + is-inhabited-lower-ℝ = pr1 (pr2 x) + + is-rounded-lower-ℝ : + (q : ℚ) → + is-in-cut-lower-ℝ q ↔ exists ℚ (λ r → le-ℚ-Prop q r ∧ cut-lower-ℝ r) + is-rounded-lower-ℝ = pr2 (pr2 x) +``` + +## Properties + +### Lower Dedekind cuts are closed under the standard ordering on the rationals + +```agda +module _ + {l : Level} (x : lower-ℝ l) (p q : ℚ) + where + + le-cut-lower-ℝ : le-ℚ p q → is-in-cut-lower-ℝ x q → is-in-cut-lower-ℝ x p + le-cut-lower-ℝ p Date: Sun, 9 Feb 2025 11:54:56 -0800 Subject: [PATCH 004/119] make pre-commit --- src/real-numbers.lagda.md | 1 + .../lower-dedekind-real-numbers.lagda.md | 22 ++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index b2aaa1a1f4..6fc691eef0 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -8,6 +8,7 @@ module real-numbers where open import real-numbers.arithmetically-located-dedekind-cuts public open import real-numbers.dedekind-real-numbers public open import real-numbers.inequality-real-numbers public +open import real-numbers.lower-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public open import real-numbers.negation-real-numbers public open import real-numbers.rational-real-numbers public diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index 58b8384159..5d99526167 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -5,19 +5,20 @@ module real-numbers.lower-dedekind-real-numbers where ```
Imports + ```agda open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers -open import foundation.dependent-pair-types -open import foundation.subtypes open import foundation.conjunction -open import foundation.identity-types +open import foundation.dependent-pair-types open import foundation.existential-quantification -open import foundation.propositions +open import foundation.identity-types open import foundation.logical-equivalences -open import foundation.universe-levels +open import foundation.propositions +open import foundation.subtypes open import foundation.universal-quantification +open import foundation.universe-levels ```
@@ -25,8 +26,7 @@ open import foundation.universal-quantification A lower {{#concept "Dedekind cut" Agda=is-dedekind-cut WD="dedekind cut" WDID=Q851333}} -consists of a -[subtype](foundation-core.subtypes.md) `L` of +consists of a [subtype](foundation-core.subtypes.md) `L` of [the rational numbers](elementary-number-theory.rational-numbers.md) `ℚ`, satisfying the following two conditions: @@ -35,8 +35,9 @@ satisfying the following two conditions: [if and only if](foundation.logical-equivalences.md) there [exists](foundation.existential-quantification.md) `q < r` such that `r ∈ L`. -The type of all lower Dedekind real numbers is the type of all lower Dedekind cuts. -A lower Dedekind cut is part of a [Dedekind real number](real-numbers.dedekind-real-numbers.md) +The type of all lower Dedekind real numbers is the type of all lower Dedekind +cuts. A lower Dedekind cut is part of a +[Dedekind real number](real-numbers.dedekind-real-numbers.md) ## Definition @@ -110,6 +111,7 @@ module _ ## References -This page follows the terminology used in the exercises of Section 11 in {{#cite UF13}}. +This page follows the terminology used in the exercises of Section 11 in +{{#cite UF13}}. {{#bibliography}} From 59195c9edc8dfc2117df76628621a2767981ea31 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 9 Feb 2025 11:59:55 -0800 Subject: [PATCH 005/119] Define upper Dedekind reals --- .../lower-dedekind-real-numbers.lagda.md | 10 +- .../upper-dedekind-real-numbers.lagda.md | 124 ++++++++++++++++++ 2 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 src/real-numbers/upper-dedekind-real-numbers.lagda.md diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index 5d99526167..f603657ab7 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -36,8 +36,7 @@ satisfying the following two conditions: [exists](foundation.existential-quantification.md) `q < r` such that `r ∈ L`. The type of all lower Dedekind real numbers is the type of all lower Dedekind -cuts. A lower Dedekind cut is part of a -[Dedekind real number](real-numbers.dedekind-real-numbers.md) +cuts. ## Definition @@ -109,6 +108,13 @@ module _ eq-eq-cut-lower-ℝ = eq-type-subtype is-lower-dedekind-cut-Prop ``` +## See also + +- Upper Dedekind cuts, the dual structure, are defined in + [`real-numbers.upper-dedekind-real-numbers`](real-numbers.upper-dedekind-real-numbers.md). +- Dedekind cuts, which form the usual real numbers, are defined in + [`real-numbers.dedekind-real-numbers`](real-numbers.dedekind-real-numbers.md) + ## References This page follows the terminology used in the exercises of Section 11 in diff --git a/src/real-numbers/upper-dedekind-real-numbers.lagda.md b/src/real-numbers/upper-dedekind-real-numbers.lagda.md new file mode 100644 index 0000000000..bdf0a5525f --- /dev/null +++ b/src/real-numbers/upper-dedekind-real-numbers.lagda.md @@ -0,0 +1,124 @@ +# Upper Dedekind real numbers + +```agda +module real-numbers.upper-dedekind-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.identity-types +open import foundation.logical-equivalences +open import foundation.propositions +open import foundation.subtypes +open import foundation.universal-quantification +open import foundation.universe-levels +``` + +
+ +## Idea + +A upper +{{#concept "Dedekind cut" Agda=is-dedekind-cut WD="dedekind cut" WDID=Q851333}} +consists of a [subtype](foundation-core.subtypes.md) `U` of +[the rational numbers](elementary-number-theory.rational-numbers.md) `ℚ`, +satisfying the following two conditions: + +1. _Inhabitedness_. `U` is [inhabited](foundation.inhabited-subtypes.md). +2. _Roundedness_. A rational number `q` is in `U` + [if and only if](foundation.logical-equivalences.md) there + [exists](foundation.existential-quantification.md) `p < q` such that `p ∈ U`. + +The type of all upper Dedekind real numbers is the type of all upper Dedekind +cuts. + +## Definition + +### Upper Dedekind cuts + +```agda +module _ + {l : Level} + (U : subtype l ℚ) + where + + is-upper-dedekind-cut-Prop : Prop l + is-upper-dedekind-cut-Prop = + (∃ ℚ U) ∧ + (∀' ℚ (λ q → U q ⇔ (∃ ℚ (λ p → le-ℚ-Prop p q ∧ U p)))) + + is-upper-dedekind-cut : UU l + is-upper-dedekind-cut = type-Prop is-upper-dedekind-cut-Prop +``` + +## The upper Dedekind real numbers + +```agda +upper-ℝ : (l : Level) → UU (lsuc l) +upper-ℝ l = Σ (subtype l ℚ) is-upper-dedekind-cut + +module _ + {l : Level} + (x : upper-ℝ l) + where + + cut-upper-ℝ : subtype l ℚ + cut-upper-ℝ = pr1 x + + is-in-cut-upper-ℝ : ℚ → UU l + is-in-cut-upper-ℝ = is-in-subtype cut-upper-ℝ + + is-inhabited-upper-ℝ : exists ℚ cut-upper-ℝ + is-inhabited-upper-ℝ = pr1 (pr2 x) + + is-rounded-upper-ℝ : + (q : ℚ) → + is-in-cut-upper-ℝ q ↔ exists ℚ (λ p → le-ℚ-Prop p q ∧ cut-upper-ℝ p) + is-rounded-upper-ℝ = pr2 (pr2 x) +``` + +## Properties + +### Upper Dedekind cuts are closed under the standard ordering on the rationals + +```agda +module _ + {l : Level} (x : upper-ℝ l) (p q : ℚ) + where + + le-cut-upper-ℝ : le-ℚ p q → is-in-cut-upper-ℝ x p → is-in-cut-upper-ℝ x q + le-cut-upper-ℝ p Date: Sun, 9 Feb 2025 12:00:27 -0800 Subject: [PATCH 006/119] make pre-commit --- src/real-numbers.lagda.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 6fc691eef0..b110b77299 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -14,4 +14,5 @@ open import real-numbers.negation-real-numbers public open import real-numbers.rational-real-numbers public open import real-numbers.similarity-real-numbers public open import real-numbers.strict-inequality-real-numbers public +open import real-numbers.upper-dedekind-real-numbers public ``` From 6ad62d519db2b3740365e3f0695413940e5850f8 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 9 Feb 2025 12:23:46 -0800 Subject: [PATCH 007/119] Rename things --- .../lower-dedekind-real-numbers.lagda.md | 10 +++++----- .../upper-dedekind-real-numbers.lagda.md | 12 +++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index f603657ab7..6608478238 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -74,13 +74,13 @@ module _ is-in-cut-lower-ℝ : ℚ → UU l is-in-cut-lower-ℝ = is-in-subtype cut-lower-ℝ - is-inhabited-lower-ℝ : exists ℚ cut-lower-ℝ - is-inhabited-lower-ℝ = pr1 (pr2 x) + is-inhabited-cut-lower-ℝ : exists ℚ cut-lower-ℝ + is-inhabited-cut-lower-ℝ = pr1 (pr2 x) - is-rounded-lower-ℝ : + is-rounded-cut-lower-ℝ : (q : ℚ) → is-in-cut-lower-ℝ q ↔ exists ℚ (λ r → le-ℚ-Prop q r ∧ cut-lower-ℝ r) - is-rounded-lower-ℝ = pr2 (pr2 x) + is-rounded-cut-lower-ℝ = pr2 (pr2 x) ``` ## Properties @@ -94,7 +94,7 @@ module _ le-cut-lower-ℝ : le-ℚ p q → is-in-cut-lower-ℝ x q → is-in-cut-lower-ℝ x p le-cut-lower-ℝ p Date: Sun, 9 Feb 2025 14:33:30 -0800 Subject: [PATCH 008/119] Formatting --- src/real-numbers/lower-dedekind-real-numbers.lagda.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index 6608478238..167a6805a5 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -22,6 +22,7 @@ open import foundation.universe-levels ```
+ ## Idea A lower From fd8f3846dafbef038616b7b992081d60ec276300 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 9 Feb 2025 14:44:51 -0800 Subject: [PATCH 009/119] Add new file --- ...ional-lower-dedekind-real-numbers.lagda.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/real-numbers/rational-lower-dedekind-real-numbers.lagda.md diff --git a/src/real-numbers/rational-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/rational-lower-dedekind-real-numbers.lagda.md new file mode 100644 index 0000000000..4c9fca0bf0 --- /dev/null +++ b/src/real-numbers/rational-lower-dedekind-real-numbers.lagda.md @@ -0,0 +1,59 @@ +# Rational lower Dedekind real numbers + +```agda +module real-numbers.rational-lower-dedekind-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.logical-equivalences +open import foundation.subtypes +open import foundation.universe-levels + +open import real-numbers.lower-dedekind-real-numbers +``` + +
+ +## Idea + +There is a canonical mapping from the [rational numbers](elementary-number-theory.rational-numbers.md) +to the [lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md). + +## Definition + +```agda +module _ (q : ℚ) where + cut-lower-real-ℚ : subtype lzero ℚ + cut-lower-real-ℚ p = le-ℚ-Prop p q + + is-in-cut-lower-real-ℚ : ℚ → UU lzero + is-in-cut-lower-real-ℚ p = le-ℚ p q + + is-inhabited-cut-lower-real-ℚ : exists ℚ cut-lower-real-ℚ + is-inhabited-cut-lower-real-ℚ = exists-lesser-ℚ q + + is-rounded-cut-lower-real-ℚ : + (p : ℚ) → + le-ℚ p q ↔ exists ℚ (λ r → le-ℚ-Prop p r ∧ le-ℚ-Prop r q) + pr1 (is-rounded-cut-lower-real-ℚ p) p Date: Sun, 9 Feb 2025 14:45:17 -0800 Subject: [PATCH 010/119] Fix line length --- src/real-numbers/lower-dedekind-real-numbers.lagda.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index 167a6805a5..8d9097a7ec 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -95,7 +95,9 @@ module _ le-cut-lower-ℝ : le-ℚ p q → is-in-cut-lower-ℝ x q → is-in-cut-lower-ℝ x p le-cut-lower-ℝ p Date: Sun, 9 Feb 2025 14:49:24 -0800 Subject: [PATCH 011/119] Add rational upper reals --- ...ional-upper-dedekind-real-numbers.lagda.md | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/real-numbers/rational-upper-dedekind-real-numbers.lagda.md diff --git a/src/real-numbers/rational-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/rational-upper-dedekind-real-numbers.lagda.md new file mode 100644 index 0000000000..c6e1c589de --- /dev/null +++ b/src/real-numbers/rational-upper-dedekind-real-numbers.lagda.md @@ -0,0 +1,59 @@ +# Rational upper Dedekind real numbers + +```agda +module real-numbers.rational-upper-dedekind-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.logical-equivalences +open import foundation.subtypes +open import foundation.universe-levels + +open import real-numbers.upper-dedekind-real-numbers +``` + +
+ +## Idea + +There is a canonical mapping from the [rational numbers](elementary-number-theory.rational-numbers.md) +to the [upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md). + +## Definition + +```agda +module _ (q : ℚ) where + cut-upper-real-ℚ : subtype lzero ℚ + cut-upper-real-ℚ = le-ℚ-Prop q + + is-in-cut-upper-real-ℚ : ℚ → UU lzero + is-in-cut-upper-real-ℚ = le-ℚ q + + is-inhabited-cut-upper-real-ℚ : exists ℚ cut-upper-real-ℚ + is-inhabited-cut-upper-real-ℚ = exists-greater-ℚ q + + is-rounded-cut-upper-real-ℚ : + (p : ℚ) → + le-ℚ q p ↔ exists ℚ (λ r → le-ℚ-Prop r p ∧ le-ℚ-Prop q r) + pr1 (is-rounded-cut-upper-real-ℚ p) q

Date: Sun, 9 Feb 2025 15:00:35 -0800 Subject: [PATCH 012/119] Progress --- ...ality-lower-dedekind-real-numbers.lagda.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md diff --git a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md new file mode 100644 index 0000000000..4980bd1fdb --- /dev/null +++ b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md @@ -0,0 +1,56 @@ +# Inequality on the lower Dedekind real numbers + +```agda +module real-numbers.inequality-lower-dedekind-real-numbers where +``` + +

Imports + +```agda +open import elementary-number-theory.rational-numbers + +open import foundation.powersets +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels + +open import order-theory.large-posets +open import order-theory.large-preorders + +open import real-numbers.lower-dedekind-real-numbers +``` + +
+ +## Idea + +The {{#concept "standard ordering" Disambiguation="lower Dedekind real numbers" Agda=leq-lower-ℝ}} on +the [lower real numbers](real-numbers.lower-dedekind-real-numbers.md) is defined as the +cut of one being a subset of the cut of the other. + +## Definition + +```agda +module _ + {l1 l2 : Level} + (x : lower-ℝ l1) + (y : lower-ℝ l2) + where + + leq-lower-ℝ-Prop : Prop (l1 ⊔ l2) + leq-lower-ℝ-Prop = leq-prop-subtype (cut-lower-ℝ x) (cut-lower-ℝ y) +``` + +### Inequality on lower Dedekind reals is a large poset + +```agda +lower-ℝ-Large-Preorder : Large-Preorder lsuc _⊔_ +lower-ℝ-Large-Preorder = powerset-Large-Preorder ℚ + +lower-ℝ-Large-Poset : Large-Poset lsuc _⊔_ +lower-ℝ-Large-Poset = powerset-Large-Poset ℚ +``` + +## References + +{{#bibliography}} From fb18a45e9d71a0dc482e958b7bee3aba7dfd9750 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 9 Feb 2025 15:09:04 -0800 Subject: [PATCH 013/119] Preservation of inequality --- ...ality-lower-dedekind-real-numbers.lagda.md | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md index 4980bd1fdb..52dd94fe52 100644 --- a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md @@ -7,8 +7,14 @@ module real-numbers.inequality-lower-dedekind-real-numbers where
Imports ```agda +open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.logical-equivalences open import foundation.powersets open import foundation.propositions open import foundation.subtypes @@ -18,6 +24,7 @@ open import order-theory.large-posets open import order-theory.large-preorders open import real-numbers.lower-dedekind-real-numbers +open import real-numbers.rational-lower-dedekind-real-numbers ```
@@ -39,8 +46,13 @@ module _ leq-lower-ℝ-Prop : Prop (l1 ⊔ l2) leq-lower-ℝ-Prop = leq-prop-subtype (cut-lower-ℝ x) (cut-lower-ℝ y) + + leq-lower-ℝ : UU (l1 ⊔ l2) + leq-lower-ℝ = type-Prop leq-lower-ℝ-Prop ``` +## Properties + ### Inequality on lower Dedekind reals is a large poset ```agda @@ -51,6 +63,25 @@ lower-ℝ-Large-Poset : Large-Poset lsuc _⊔_ lower-ℝ-Large-Poset = powerset-Large-Poset ℚ ``` +### The canonical map from the rational numbers to the lower reals preserves inequality + +```agda +preserves-leq-lower-real-ℚ : + (p q : ℚ) → leq-ℚ p q → leq-lower-ℝ (lower-real-ℚ p) (lower-real-ℚ q) +preserves-leq-lower-real-ℚ p q p≤q r r

Date: Sun, 9 Feb 2025 15:19:08 -0800 Subject: [PATCH 014/119] Define normal Dedekind reals in terms of lower and upper cuts --- .../dedekind-real-numbers.lagda.md | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/src/real-numbers/dedekind-real-numbers.lagda.md b/src/real-numbers/dedekind-real-numbers.lagda.md index 929862f718..0824ab205d 100644 --- a/src/real-numbers/dedekind-real-numbers.lagda.md +++ b/src/real-numbers/dedekind-real-numbers.lagda.md @@ -39,6 +39,9 @@ open import foundation.universe-levels open import foundation-core.truncation-levels open import logic.functoriality-existential-quantification + +open import real-numbers.lower-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers ``` @@ -48,19 +51,12 @@ open import logic.functoriality-existential-quantification A {{#concept "Dedekind cut" Agda=is-dedekind-cut WD="dedekind cut" WDID=Q851333}} consists of a [pair](foundation.dependent-pair-types.md) `(L , U)` of -[subtypes](foundation-core.subtypes.md) of -[the rational numbers](elementary-number-theory.rational-numbers.md) `ℚ`, -satisfying the following four conditions - -1. _Inhabitedness_. Both `L` and `U` are - [inhabited](foundation.inhabited-subtypes.md) subtypes of `ℚ`. -2. _Roundedness_. A rational number `q` is in `L` - [if and only if](foundation.logical-equivalences.md) there - [exists](foundation.existential-quantification.md) `q < r` such that `r ∈ L`, - and a rational number `r` is in `U` if and only if there exists `q < r` such - that `q ∈ U`. -3. _Disjointness_. `L` and `U` are disjoint subsets of `ℚ`. -4. _Locatedness_. If `q < r` then `q ∈ L` or `r ∈ U`. +a [lower Dedekind cut](real-numbers.lower-dedekind-real-numbers) +and an [upper Dedekind cut](real-numbers.upper-dedekind-real-numbers) +that also satisfy the following conditions: + +1. _Disjointness_. `L` and `U` are disjoint subsets of `ℚ`. +2. _Locatedness_. If `q < r` then `q ∈ L` or `r ∈ U`. The type of {{#concept "Dedekind real numbers" Agda=ℝ}} is the type of all Dedekind cuts. The Dedekind real numbers will be taken as the standard @@ -77,15 +73,10 @@ module _ is-dedekind-cut-Prop : Prop (l1 ⊔ l2) is-dedekind-cut-Prop = - conjunction-Prop - ( (∃ ℚ L) ∧ (∃ ℚ U)) - ( conjunction-Prop - ( conjunction-Prop - ( ∀' ℚ ( λ q → L q ⇔ ∃ ℚ (λ r → le-ℚ-Prop q r ∧ L r))) - ( ∀' ℚ ( λ r → U r ⇔ ∃ ℚ (λ q → le-ℚ-Prop q r ∧ U q)))) - ( conjunction-Prop - ( ∀' ℚ (λ q → ¬' (L q ∧ U q))) - ( ∀' ℚ (λ q → ∀' ℚ (λ r → le-ℚ-Prop q r ⇒ (L q ∨ U r)))))) + is-lower-dedekind-cut-Prop L ∧ + is-upper-dedekind-cut-Prop U ∧ + ( ∀' ℚ (λ q → ¬' (L q ∧ U q))) ∧ + ( ∀' ℚ (λ q → ∀' ℚ (λ r → le-ℚ-Prop q r ⇒ (L q ∨ U r)))) is-dedekind-cut : UU (l1 ⊔ l2) is-dedekind-cut = type-Prop is-dedekind-cut-Prop @@ -113,6 +104,12 @@ module _ upper-cut-ℝ : subtype l ℚ upper-cut-ℝ = pr1 (pr2 x) + lower-real-ℝ : lower-ℝ l + lower-real-ℝ = lower-cut-ℝ , pr1 (pr2 (pr2 x)) + + upper-real-ℝ : upper-ℝ l + upper-real-ℝ = upper-cut-ℝ , pr1 (pr2 (pr2 (pr2 x))) + is-in-lower-cut-ℝ : ℚ → UU l is-in-lower-cut-ℝ = is-in-subtype lower-cut-ℝ @@ -123,34 +120,30 @@ module _ is-dedekind-cut-cut-ℝ = pr2 (pr2 x) is-inhabited-lower-cut-ℝ : exists ℚ lower-cut-ℝ - is-inhabited-lower-cut-ℝ = pr1 (pr1 is-dedekind-cut-cut-ℝ) + is-inhabited-lower-cut-ℝ = is-inhabited-cut-lower-ℝ lower-real-ℝ is-inhabited-upper-cut-ℝ : exists ℚ upper-cut-ℝ - is-inhabited-upper-cut-ℝ = pr2 (pr1 is-dedekind-cut-cut-ℝ) + is-inhabited-upper-cut-ℝ = is-inhabited-cut-upper-ℝ upper-real-ℝ is-rounded-lower-cut-ℝ : (q : ℚ) → is-in-lower-cut-ℝ q ↔ exists ℚ (λ r → (le-ℚ-Prop q r) ∧ (lower-cut-ℝ r)) - is-rounded-lower-cut-ℝ = - pr1 (pr1 (pr2 is-dedekind-cut-cut-ℝ)) + is-rounded-lower-cut-ℝ = is-rounded-cut-lower-ℝ lower-real-ℝ is-rounded-upper-cut-ℝ : (r : ℚ) → is-in-upper-cut-ℝ r ↔ exists ℚ (λ q → (le-ℚ-Prop q r) ∧ (upper-cut-ℝ q)) - is-rounded-upper-cut-ℝ = - pr2 (pr1 (pr2 is-dedekind-cut-cut-ℝ)) + is-rounded-upper-cut-ℝ = is-rounded-cut-upper-ℝ upper-real-ℝ is-disjoint-cut-ℝ : (q : ℚ) → ¬ (is-in-lower-cut-ℝ q × is-in-upper-cut-ℝ q) - is-disjoint-cut-ℝ = - pr1 (pr2 (pr2 is-dedekind-cut-cut-ℝ)) + is-disjoint-cut-ℝ = pr1 (pr2 (pr2 (pr2 (pr2 x)))) is-located-lower-upper-cut-ℝ : (q r : ℚ) → le-ℚ q r → type-disjunction-Prop (lower-cut-ℝ q) (upper-cut-ℝ r) - is-located-lower-upper-cut-ℝ = - pr2 (pr2 (pr2 is-dedekind-cut-cut-ℝ)) + is-located-lower-upper-cut-ℝ = pr2 (pr2 (pr2 (pr2 (pr2 x)))) cut-ℝ : subtype l ℚ cut-ℝ q = From 7499c7c9baad51f54cb31f7f4c52733a038fdc22 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 9 Feb 2025 15:21:33 -0800 Subject: [PATCH 015/119] Start negation --- ...lower-upper-dedekind-real-numbers.lagda.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md diff --git a/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md new file mode 100644 index 0000000000..485c61bb9c --- /dev/null +++ b/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md @@ -0,0 +1,20 @@ +# Negation of lower and upper Dedekind real numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module real-numbers.negation-lower-upper-dedekind-real-numbers where +``` + +

Imports + +```agda +open import foundation.universe-levels + +open import real-numbers.lower-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers +``` + +
+ +## Idea From 2185e189ba4af56d44a7c3d5da0861682d7271de Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 9 Feb 2025 15:26:36 -0800 Subject: [PATCH 016/119] Inequality on upper reals --- ...ality-upper-dedekind-real-numbers.lagda.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md diff --git a/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md new file mode 100644 index 0000000000..4e6802b471 --- /dev/null +++ b/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md @@ -0,0 +1,83 @@ +# Inequality on the upper Dedekind real numbers + +```agda +module real-numbers.inequality-upper-dedekind-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.empty-types +open import foundation.logical-equivalences +open import foundation.powersets +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels + +open import order-theory.large-posets +open import order-theory.large-preorders + +open import real-numbers.upper-dedekind-real-numbers +open import real-numbers.rational-upper-dedekind-real-numbers +``` + +
+ +## Idea + +The {{#concept "standard ordering" Disambiguation="upper Dedekind real numbers" Agda=leq-upper-ℝ}} on +the [upper real numbers](real-numbers.upper-dedekind-real-numbers.md) is defined as the +cut of the second being a subset of the cut of the first. + +## Definition + +```agda +module _ + {l1 l2 : Level} + (x : upper-ℝ l1) + (y : upper-ℝ l2) + where + + leq-upper-ℝ-Prop : Prop (l1 ⊔ l2) + leq-upper-ℝ-Prop = leq-prop-subtype (cut-upper-ℝ y) (cut-upper-ℝ x) + + leq-upper-ℝ : UU (l1 ⊔ l2) + leq-upper-ℝ = type-Prop leq-upper-ℝ-Prop +``` + +## Properties + +### Inequality on upper Dedekind reals is a large poset + +```agda +upper-ℝ-Large-Preorder : Large-Preorder lsuc _⊔_ +upper-ℝ-Large-Preorder = powerset-Large-Preorder ℚ + +upper-ℝ-Large-Poset : Large-Poset lsuc _⊔_ +upper-ℝ-Large-Poset = powerset-Large-Poset ℚ +``` + +### The canonical map from the rational numbers to the upper reals preserves inequality + +```agda +preserves-leq-upper-real-ℚ : + (p q : ℚ) → leq-ℚ p q → leq-upper-ℝ (upper-real-ℚ p) (upper-real-ℚ q) +preserves-leq-upper-real-ℚ p q p≤q r = concatenate-leq-le-ℚ p q r p≤q + +reflects-leq-upper-real-ℚ : + (p q : ℚ) → leq-upper-ℝ (upper-real-ℚ p) (upper-real-ℚ q) → leq-ℚ p q +reflects-leq-upper-real-ℚ p q q Date: Mon, 10 Feb 2025 08:32:11 -0800 Subject: [PATCH 017/119] overhaul --- src/real-numbers.lagda.md | 5 + ...thmetically-located-dedekind-cuts.lagda.md | 76 +++---- .../dedekind-real-numbers.lagda.md | 33 ++- ...ality-lower-dedekind-real-numbers.lagda.md | 21 +- .../inequality-real-numbers.lagda.md | 31 +-- ...ality-upper-dedekind-real-numbers.lagda.md | 23 +- .../lower-dedekind-real-numbers.lagda.md | 3 + ...lower-upper-dedekind-real-numbers.lagda.md | 205 ++++++++++++++++++ .../negation-real-numbers.lagda.md | 88 ++------ ...ional-lower-dedekind-real-numbers.lagda.md | 5 +- .../rational-real-numbers.lagda.md | 31 +-- ...ional-upper-dedekind-real-numbers.lagda.md | 5 +- .../upper-dedekind-real-numbers.lagda.md | 3 + 13 files changed, 362 insertions(+), 167 deletions(-) diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index b110b77299..1cd86ceaa3 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -7,11 +7,16 @@ module real-numbers where open import real-numbers.arithmetically-located-dedekind-cuts public open import real-numbers.dedekind-real-numbers public +open import real-numbers.inequality-lower-dedekind-real-numbers public open import real-numbers.inequality-real-numbers public +open import real-numbers.inequality-upper-dedekind-real-numbers public open import real-numbers.lower-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public +open import real-numbers.negation-lower-upper-dedekind-real-numbers public open import real-numbers.negation-real-numbers public +open import real-numbers.rational-lower-dedekind-real-numbers public open import real-numbers.rational-real-numbers public +open import real-numbers.rational-upper-dedekind-real-numbers public open import real-numbers.similarity-real-numbers public open import real-numbers.strict-inequality-real-numbers public open import real-numbers.upper-dedekind-real-numbers public diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index b33f8a86fc..31d707215b 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -17,6 +17,7 @@ open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.binary-transport open import foundation.cartesian-product-types open import foundation.conjunction open import foundation.coproduct-types @@ -31,18 +32,23 @@ open import foundation.transport-along-identifications open import foundation.universe-levels open import group-theory.abelian-groups + +open import real-numbers.lower-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers +open import real-numbers.dedekind-real-numbers ``` ## Definition -A [Dedekind cut](real-numbers.dedekind-real-numbers.md) `(L, U)` is -{{#concept "arithmetically located" Disambiguation="Dedekind cut"}} if for any -positive [rational number](elementary-number-theory.rational-numbers.md) +A pair of a [lower Dedekind cut](real-numbers.lower-dedekind-real-numbers.md) +`L` and an [upper Dedekind cut](real-numbers.upper-dedekind-real-numbers.md) `U` +is {{#concept "arithmetically located" Disambiguation="Dedekind cut"}} if for +any positive [rational number](elementary-number-theory.rational-numbers.md) `ε : ℚ`, there exist `p, q : ℚ` such that `0 < q - p < ε`, `p ∈ L`, and `q ∈ U`. -Intuitively, when `L , U` represent the Dedekind cuts of a real number `x`, `p` -and `q` are rational approximations of `x` to within `ε`. This follows parts of +Intuitively, when `L , U` represent the cuts of a real number `x`, `p` and `q` +are rational approximations of `x` to within `ε`. This follows parts of Section 11 in {{#cite BauerTaylor2009}}. ## Definitions @@ -51,16 +57,17 @@ Section 11 in {{#cite BauerTaylor2009}}. ```agda module _ - {l : Level} (L : subtype l ℚ) (U : subtype l ℚ) + {l : Level} (L : lower-ℝ l) (U : upper-ℝ l) where - is-arithmetically-located-pair-of-subtypes-ℚ : UU l - is-arithmetically-located-pair-of-subtypes-ℚ = - (ε : ℚ) → - is-positive-ℚ ε → + is-arithmetically-located-pair-of-cuts-ℚ : UU l + is-arithmetically-located-pair-of-cuts-ℚ = + (ε⁺ : ℚ⁺) → exists ( ℚ × ℚ) - ( λ (p , q) → le-ℚ-Prop p q ∧ le-ℚ-Prop q (p +ℚ ε) ∧ L p ∧ U q) + ( λ (p , q) → le-ℚ-Prop q (p +ℚ rational-ℚ⁺ ε⁺) ∧ + cut-lower-ℝ L p ∧ + cut-upper-ℝ U q) ``` ## Properties @@ -72,50 +79,37 @@ rational numbers, it is also located. ```agda module _ - {l : Level} (L : subtype l ℚ) (U : subtype l ℚ) + {l : Level} (L : lower-ℝ l) (U : upper-ℝ l) where abstract - is-located-is-arithmetically-located-pair-of-subtypes-ℚ : - is-arithmetically-located-pair-of-subtypes-ℚ L U → - ((p q : ℚ) → le-ℚ p q → is-in-subtype L q → is-in-subtype L p) → - ((p q : ℚ) → le-ℚ p q → is-in-subtype U p → is-in-subtype U q) → - (p q : ℚ) → le-ℚ p q → type-disjunction-Prop (L p) (U q) - is-located-is-arithmetically-located-pair-of-subtypes-ℚ - arithmetically-located lower-closed upper-closed p q p ## Idea -The {{#concept "standard ordering" Disambiguation="upper Dedekind real numbers" Agda=leq-upper-ℝ}} on -the [upper real numbers](real-numbers.upper-dedekind-real-numbers.md) is defined as the -cut of the second being a subset of the cut of the first. +The +{{#concept "standard ordering" Disambiguation="upper Dedekind real numbers" Agda=leq-upper-ℝ}} +on the [upper real numbers](real-numbers.upper-dedekind-real-numbers.md) is +defined as the cut of the second being a subset of the cut of the first. ## Definition @@ -57,10 +58,20 @@ module _ ```agda upper-ℝ-Large-Preorder : Large-Preorder lsuc _⊔_ -upper-ℝ-Large-Preorder = powerset-Large-Preorder ℚ +type-Large-Preorder upper-ℝ-Large-Preorder = upper-ℝ +leq-prop-Large-Preorder upper-ℝ-Large-Preorder = leq-upper-ℝ-Prop +refl-leq-Large-Preorder upper-ℝ-Large-Preorder x = + refl-leq-subtype (cut-upper-ℝ x) +transitive-leq-Large-Preorder upper-ℝ-Large-Preorder x y z y≤z x≤y = + transitive-leq-subtype (cut-upper-ℝ z) (cut-upper-ℝ y) (cut-upper-ℝ x) x≤y y≤z upper-ℝ-Large-Poset : Large-Poset lsuc _⊔_ -upper-ℝ-Large-Poset = powerset-Large-Poset ℚ +large-preorder-Large-Poset upper-ℝ-Large-Poset = upper-ℝ-Large-Preorder +antisymmetric-leq-Large-Poset upper-ℝ-Large-Poset x y x≤y y≤x = + eq-eq-cut-upper-ℝ + ( x) + ( y) + ( antisymmetric-leq-subtype (cut-upper-ℝ x) (cut-upper-ℝ y) y≤x x≤y) ``` ### The canonical map from the rational numbers to the upper reals preserves inequality diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index 8d9097a7ec..6bc94cd66d 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -75,6 +75,9 @@ module _ is-in-cut-lower-ℝ : ℚ → UU l is-in-cut-lower-ℝ = is-in-subtype cut-lower-ℝ + is-lower-dedekind-cut-lower-ℝ : is-lower-dedekind-cut cut-lower-ℝ + is-lower-dedekind-cut-lower-ℝ = pr2 x + is-inhabited-cut-lower-ℝ : exists ℚ cut-lower-ℝ is-inhabited-cut-lower-ℝ = pr1 (pr2 x) diff --git a/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md index 485c61bb9c..3f6366d7ac 100644 --- a/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md @@ -9,12 +9,217 @@ module real-numbers.negation-lower-upper-dedekind-real-numbers where
Imports ```agda +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +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.identity-types +open import foundation.logical-equivalences +open import foundation.powersets +open import foundation.retractions +open import foundation.sections +open import foundation.subtypes +open import foundation.transport-along-identifications open import foundation.universe-levels +open import logic.functoriality-existential-quantification + open import real-numbers.lower-dedekind-real-numbers open import real-numbers.upper-dedekind-real-numbers +open import real-numbers.rational-lower-dedekind-real-numbers +open import real-numbers.rational-upper-dedekind-real-numbers ```
## Idea + +The negation of a lower Dedekind real is an upper Dedekind real containing +the negations of elements in the lower cut, and vice versa. + +## Definition + +### The negation of a lower Dedekind real, as an upper Dedekind real + +```agda +module _ + {l : Level} (x : lower-ℝ l) + where + + cut-neg-lower-ℝ : subtype l ℚ + cut-neg-lower-ℝ p = cut-lower-ℝ x (neg-ℚ p) + + is-in-cut-neg-lower-ℝ : ℚ → UU l + is-in-cut-neg-lower-ℝ = is-in-subtype cut-neg-lower-ℝ + + abstract + is-inhabited-cut-neg-lower-ℝ : exists ℚ cut-neg-lower-ℝ + is-inhabited-cut-neg-lower-ℝ = + map-exists + ( is-in-cut-neg-lower-ℝ) + ( neg-ℚ) + ( λ p → tr (is-in-cut-lower-ℝ x) (inv (neg-neg-ℚ p))) + ( is-inhabited-cut-lower-ℝ x) + + is-rounded-cut-neg-lower-ℝ : + (q : ℚ) → + is-in-cut-neg-lower-ℝ q ↔ + exists ℚ (λ p → le-ℚ-Prop p q ∧ cut-neg-lower-ℝ p) + pr1 (is-rounded-cut-neg-lower-ℝ q) -q @@ -50,72 +55,17 @@ module _ {l : Level} (x : ℝ l) where + lower-real-neg-ℝ : lower-ℝ l + lower-real-neg-ℝ = neg-upper-ℝ (upper-real-ℝ x) + + upper-real-neg-ℝ : upper-ℝ l + upper-real-neg-ℝ = neg-lower-ℝ (lower-real-ℝ x) + lower-cut-neg-ℝ : subtype l ℚ - lower-cut-neg-ℝ q = upper-cut-ℝ x (neg-ℚ q) + lower-cut-neg-ℝ = cut-lower-ℝ lower-real-neg-ℝ upper-cut-neg-ℝ : subtype l ℚ - upper-cut-neg-ℝ q = lower-cut-ℝ x (neg-ℚ q) - - is-inhabited-lower-cut-neg-ℝ : exists ℚ lower-cut-neg-ℝ - is-inhabited-lower-cut-neg-ℝ = - map-exists - ( is-in-subtype lower-cut-neg-ℝ) - ( neg-ℚ) - ( λ q → tr (is-in-upper-cut-ℝ x) (inv (neg-neg-ℚ q))) - ( is-inhabited-upper-cut-ℝ x) - - is-inhabited-upper-cut-neg-ℝ : exists ℚ upper-cut-neg-ℝ - is-inhabited-upper-cut-neg-ℝ = - map-exists - ( is-in-subtype upper-cut-neg-ℝ) - ( neg-ℚ) - ( λ q → tr (is-in-lower-cut-ℝ x) (inv (neg-neg-ℚ q))) - ( is-inhabited-lower-cut-ℝ x) - - is-rounded-lower-cut-neg-ℝ : - (q : ℚ) → - is-in-subtype lower-cut-neg-ℝ q ↔ - exists ℚ (λ r → (le-ℚ-Prop q r) ∧ (lower-cut-neg-ℝ r)) - pr1 (is-rounded-lower-cut-neg-ℝ q) in-neg-lower = - map-exists - ( λ r → le-ℚ q r × is-in-subtype lower-cut-neg-ℝ r) - ( neg-ℚ) - ( λ r (r<-q , in-upper-r) → - ( ( tr - ( λ x → le-ℚ x (neg-ℚ r)) - ( neg-neg-ℚ q) - ( neg-le-ℚ r (neg-ℚ q) r<-q)) , - ( tr (is-in-upper-cut-ℝ x) (inv (neg-neg-ℚ r)) in-upper-r))) - ( forward-implication (is-rounded-upper-cut-ℝ x (neg-ℚ q)) in-neg-lower) - pr2 (is-rounded-lower-cut-neg-ℝ q) exists-r = - backward-implication - ( is-rounded-upper-cut-ℝ x (neg-ℚ q)) - ( map-exists - ( λ r → le-ℚ r (neg-ℚ q) × is-in-upper-cut-ℝ x r) - ( neg-ℚ) - ( λ r (q @@ -56,28 +60,13 @@ the [image](foundation.images.md) of this embedding is-dedekind-cut-le-ℚ : (x : ℚ) → is-dedekind-cut - (λ (q : ℚ) → le-ℚ-Prop q x) - (λ (r : ℚ) → le-ℚ-Prop x r) + (cut-lower-real-ℚ x) + (cut-upper-real-ℚ x) is-dedekind-cut-le-ℚ x = - ( exists-lesser-ℚ x , exists-greater-ℚ x) , - ( ( λ (q : ℚ) → - dense-le-ℚ q x , - elim-exists - ( le-ℚ-Prop q x) - ( λ r (H , H') → transitive-le-ℚ q r x H' H)) , - ( λ (r : ℚ) → - α x r ∘ dense-le-ℚ x r , - elim-exists - ( le-ℚ-Prop x r) - ( λ q (H , H') → transitive-le-ℚ x q r H H'))) , - ( λ (q : ℚ) (H , H') → asymmetric-le-ℚ q x H H') , - ( located-le-ℚ x) - where - α : - (a b : ℚ) → - exists ℚ (λ r → le-ℚ-Prop a r ∧ le-ℚ-Prop r b) → - exists ℚ (λ r → le-ℚ-Prop r b ∧ le-ℚ-Prop a r) - α a b = map-tot-exists (λ r (p , q) → (q , p)) + is-lower-dedekind-cut-lower-ℝ (lower-real-ℚ x) , + is-upper-dedekind-cut-upper-ℝ (upper-real-ℚ x) , + (λ q (H , K) → asymmetric-le-ℚ q x H K) , + located-le-ℚ x ``` ### The canonical map from `ℚ` to `ℝ` diff --git a/src/real-numbers/rational-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/rational-upper-dedekind-real-numbers.lagda.md index c6e1c589de..9761287d50 100644 --- a/src/real-numbers/rational-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/rational-upper-dedekind-real-numbers.lagda.md @@ -24,8 +24,9 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea -There is a canonical mapping from the [rational numbers](elementary-number-theory.rational-numbers.md) -to the [upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md). +There is a canonical mapping from the +[rational numbers](elementary-number-theory.rational-numbers.md) to the +[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md). ## Definition diff --git a/src/real-numbers/upper-dedekind-real-numbers.lagda.md b/src/real-numbers/upper-dedekind-real-numbers.lagda.md index c9dbf0f8f4..264bf07633 100644 --- a/src/real-numbers/upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/upper-dedekind-real-numbers.lagda.md @@ -75,6 +75,9 @@ module _ is-in-cut-upper-ℝ : ℚ → UU l is-in-cut-upper-ℝ = is-in-subtype cut-upper-ℝ + is-upper-dedekind-cut-upper-ℝ : is-upper-dedekind-cut cut-upper-ℝ + is-upper-dedekind-cut-upper-ℝ = pr2 x + is-inhabited-cut-upper-ℝ : exists ℚ cut-upper-ℝ is-inhabited-cut-upper-ℝ = pr1 (pr2 x) From 70f181c77d39b461ed5a3b79376f9f685fb70508 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 10 Feb 2025 08:58:26 -0800 Subject: [PATCH 018/119] make pre-commit --- .../arithmetically-located-dedekind-cuts.lagda.md | 6 +++--- src/real-numbers/inequality-real-numbers.lagda.md | 6 +++--- ...egation-lower-upper-dedekind-real-numbers.lagda.md | 11 ++++++----- src/real-numbers/negation-real-numbers.lagda.md | 4 ++-- src/real-numbers/rational-real-numbers.lagda.md | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index 31d707215b..06174ce77c 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -33,9 +33,9 @@ open import foundation.universe-levels open import group-theory.abelian-groups +open import real-numbers.dedekind-real-numbers open import real-numbers.lower-dedekind-real-numbers open import real-numbers.upper-dedekind-real-numbers -open import real-numbers.dedekind-real-numbers ``` @@ -48,8 +48,8 @@ is {{#concept "arithmetically located" Disambiguation="Dedekind cut"}} if for any positive [rational number](elementary-number-theory.rational-numbers.md) `ε : ℚ`, there exist `p, q : ℚ` such that `0 < q - p < ε`, `p ∈ L`, and `q ∈ U`. Intuitively, when `L , U` represent the cuts of a real number `x`, `p` and `q` -are rational approximations of `x` to within `ε`. This follows parts of -Section 11 in {{#cite BauerTaylor2009}}. +are rational approximations of `x` to within `ε`. This follows parts of Section +11 in {{#cite BauerTaylor2009}}. ## Definitions diff --git a/src/real-numbers/inequality-real-numbers.lagda.md b/src/real-numbers/inequality-real-numbers.lagda.md index 83978ab7da..579ef75be4 100644 --- a/src/real-numbers/inequality-real-numbers.lagda.md +++ b/src/real-numbers/inequality-real-numbers.lagda.md @@ -27,14 +27,14 @@ open import order-theory.large-preorders open import order-theory.posets open import order-theory.preorders +open import real-numbers.dedekind-real-numbers open import real-numbers.inequality-lower-dedekind-real-numbers open import real-numbers.inequality-upper-dedekind-real-numbers open import real-numbers.lower-dedekind-real-numbers -open import real-numbers.upper-dedekind-real-numbers -open import real-numbers.negation-real-numbers open import real-numbers.negation-lower-upper-dedekind-real-numbers -open import real-numbers.dedekind-real-numbers +open import real-numbers.negation-real-numbers open import real-numbers.rational-real-numbers +open import real-numbers.upper-dedekind-real-numbers ``` diff --git a/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md index 3f6366d7ac..25081b1abe 100644 --- a/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/negation-lower-upper-dedekind-real-numbers.lagda.md @@ -29,17 +29,17 @@ open import foundation.universe-levels open import logic.functoriality-existential-quantification open import real-numbers.lower-dedekind-real-numbers -open import real-numbers.upper-dedekind-real-numbers open import real-numbers.rational-lower-dedekind-real-numbers open import real-numbers.rational-upper-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers ``` ## Idea -The negation of a lower Dedekind real is an upper Dedekind real containing -the negations of elements in the lower cut, and vice versa. +The negation of a lower Dedekind real is an upper Dedekind real containing the +negations of elements in the lower cut, and vice versa. ## Definition @@ -126,7 +126,7 @@ module _ ( λ x → le-ℚ x (neg-ℚ p)) ( neg-neg-ℚ q) ( neg-le-ℚ p (neg-ℚ q) p<-q) , - tr (is-in-cut-upper-ℝ x) (inv (neg-neg-ℚ p)) x

diff --git a/src/real-numbers/rational-real-numbers.lagda.md b/src/real-numbers/rational-real-numbers.lagda.md index d3829df34b..69ec475e2a 100644 --- a/src/real-numbers/rational-real-numbers.lagda.md +++ b/src/real-numbers/rational-real-numbers.lagda.md @@ -37,9 +37,9 @@ open import logic.functoriality-existential-quantification open import real-numbers.dedekind-real-numbers open import real-numbers.lower-dedekind-real-numbers -open import real-numbers.upper-dedekind-real-numbers open import real-numbers.rational-lower-dedekind-real-numbers open import real-numbers.rational-upper-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers ``` From 926877950f77ce8f137452df3e56bbc22ad573bc Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 10 Feb 2025 09:08:37 -0800 Subject: [PATCH 019/119] a -> an --- src/real-numbers/upper-dedekind-real-numbers.lagda.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/real-numbers/upper-dedekind-real-numbers.lagda.md b/src/real-numbers/upper-dedekind-real-numbers.lagda.md index 264bf07633..01625b8046 100644 --- a/src/real-numbers/upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/upper-dedekind-real-numbers.lagda.md @@ -25,7 +25,7 @@ open import foundation.universe-levels ## Idea -A upper +An upper {{#concept "Dedekind cut" Agda=is-dedekind-cut WD="dedekind cut" WDID=Q851333}} consists of a [subtype](foundation-core.subtypes.md) `U` of [the rational numbers](elementary-number-theory.rational-numbers.md) `ℚ`, From 1b9d81b2b52a68c6093186f8b12facffc089ed53 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 10 Feb 2025 09:10:52 -0800 Subject: [PATCH 020/119] Rename some things --- src/real-numbers/inequality-real-numbers.lagda.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/real-numbers/inequality-real-numbers.lagda.md b/src/real-numbers/inequality-real-numbers.lagda.md index 579ef75be4..098feec9e9 100644 --- a/src/real-numbers/inequality-real-numbers.lagda.md +++ b/src/real-numbers/inequality-real-numbers.lagda.md @@ -62,7 +62,7 @@ module _ ## Properties -### Equivalence with reversed containment of upper cuts +### Equivalence with inequality on upper cuts ```agda module _ From f75209b769526ce9b5c6f17f50b75c823ba3481f Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 10 Feb 2025 17:08:28 -0800 Subject: [PATCH 021/119] Some more theorems --- ...uality-lower-dedekind-real-numbers.lagda.md | 18 ++++++++++++++++++ ...uality-upper-dedekind-real-numbers.lagda.md | 18 ++++++++++++++++++ ...-lower-upper-dedekind-real-numbers.lagda.md | 2 ++ 3 files changed, 38 insertions(+) diff --git a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md index 9cd1a90e4c..7a0a1d476b 100644 --- a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md @@ -14,7 +14,9 @@ open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.empty-types +open import foundation.existential-quantification open import foundation.logical-equivalences +open import foundation.negation open import foundation.powersets open import foundation.propositions open import foundation.subtypes @@ -74,6 +76,22 @@ antisymmetric-leq-Large-Poset lower-ℝ-Large-Poset x y x≤y y≤x = ( antisymmetric-leq-subtype (cut-lower-ℝ x) (cut-lower-ℝ y) x≤y y≤x) ``` +### If a rational is in a lower Dedekind cut, its projections is less than or equal to the corresponding lower real + +```agda +module _ + {l : Level} + (x : lower-ℝ l) + (q : ℚ) + where + + leq-is-in-cut-lower-real-ℚ : is-in-cut-lower-ℝ x q → leq-lower-ℝ (lower-real-ℚ q) x + leq-is-in-cut-lower-real-ℚ q∈L p p From 098d4e88a48b3e1b87da820e5af988c4adc43399 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 10 Feb 2025 17:20:47 -0800 Subject: [PATCH 022/119] Finish gaps --- .../inequality-rational-numbers.lagda.md | 256 +++++++++--------- .../rational-numbers.lagda.md | 17 +- ...thmetically-located-dedekind-cuts.lagda.md | 5 +- ...ality-lower-dedekind-real-numbers.lagda.md | 3 +- ...ality-upper-dedekind-real-numbers.lagda.md | 4 +- ...lower-upper-dedekind-real-numbers.lagda.md | 4 +- 6 files changed, 152 insertions(+), 137 deletions(-) diff --git a/src/elementary-number-theory/inequality-rational-numbers.lagda.md b/src/elementary-number-theory/inequality-rational-numbers.lagda.md index a945128fad..12ddd6f34a 100644 --- a/src/elementary-number-theory/inequality-rational-numbers.lagda.md +++ b/src/elementary-number-theory/inequality-rational-numbers.lagda.md @@ -103,33 +103,35 @@ refl-leq-ℚ x = ### Inequality on the rational numbers is antisymmetric ```agda -antisymmetric-leq-ℚ : (x y : ℚ) → leq-ℚ x y → leq-ℚ y x → x = y -antisymmetric-leq-ℚ x y H H' = - ( inv (is-retraction-rational-fraction-ℚ x)) ∙ - ( eq-ℚ-sim-fraction-ℤ - ( fraction-ℚ x) - ( fraction-ℚ y) - ( is-sim-antisymmetric-leq-fraction-ℤ +abstract + antisymmetric-leq-ℚ : (x y : ℚ) → leq-ℚ x y → leq-ℚ y x → x = y + antisymmetric-leq-ℚ x y H H' = + ( inv (is-retraction-rational-fraction-ℚ x)) ∙ + ( eq-ℚ-sim-fraction-ℤ ( fraction-ℚ x) ( fraction-ℚ y) - ( H) - ( H'))) ∙ - ( is-retraction-rational-fraction-ℚ y) + ( is-sim-antisymmetric-leq-fraction-ℤ + ( fraction-ℚ x) + ( fraction-ℚ y) + ( H) + ( H'))) ∙ + ( is-retraction-rational-fraction-ℚ y) ``` ### Inequality on the rational numbers is linear ```agda -linear-leq-ℚ : (x y : ℚ) → (leq-ℚ x y) + (leq-ℚ y x) -linear-leq-ℚ x y = - map-coproduct - ( id) - ( is-nonnegative-eq-ℤ - (distributive-neg-diff-ℤ - ( numerator-ℚ y *ℤ denominator-ℚ x) - ( numerator-ℚ x *ℤ denominator-ℚ y))) - ( decide-is-nonnegative-is-nonnegative-neg-ℤ - { cross-mul-diff-fraction-ℤ (fraction-ℚ x) (fraction-ℚ y)}) +abstract + linear-leq-ℚ : (x y : ℚ) → (leq-ℚ x y) + (leq-ℚ y x) + linear-leq-ℚ x y = + map-coproduct + ( id) + ( is-nonnegative-eq-ℤ + (distributive-neg-diff-ℤ + ( numerator-ℚ y *ℤ denominator-ℚ x) + ( numerator-ℚ x *ℤ denominator-ℚ y))) + ( decide-is-nonnegative-is-nonnegative-neg-ℤ + { cross-mul-diff-fraction-ℤ (fraction-ℚ x) (fraction-ℚ y)}) ``` ### Inequality on the rational numbers is transitive @@ -139,12 +141,13 @@ module _ (x y z : ℚ) where - transitive-leq-ℚ : leq-ℚ y z → leq-ℚ x y → leq-ℚ x z - transitive-leq-ℚ = - transitive-leq-fraction-ℤ - ( fraction-ℚ x) - ( fraction-ℚ y) - ( fraction-ℚ z) + abstract + transitive-leq-ℚ : leq-ℚ y z → leq-ℚ x y → leq-ℚ x z + transitive-leq-ℚ = + transitive-leq-fraction-ℤ + ( fraction-ℚ x) + ( fraction-ℚ y) + ( fraction-ℚ z) ``` ### The partially ordered set of rational numbers ordered by inequality @@ -165,43 +168,45 @@ module _ (p q : fraction-ℤ) where - preserves-leq-rational-fraction-ℤ : - leq-fraction-ℤ p q → leq-ℚ (rational-fraction-ℤ p) (rational-fraction-ℤ q) - preserves-leq-rational-fraction-ℤ = - preserves-leq-sim-fraction-ℤ - ( p) - ( q) - ( reduce-fraction-ℤ p) - ( reduce-fraction-ℤ q) - ( sim-reduced-fraction-ℤ p) - ( sim-reduced-fraction-ℤ q) + abstract + preserves-leq-rational-fraction-ℤ : + leq-fraction-ℤ p q → leq-ℚ (rational-fraction-ℤ p) (rational-fraction-ℤ q) + preserves-leq-rational-fraction-ℤ = + preserves-leq-sim-fraction-ℤ + ( p) + ( q) + ( reduce-fraction-ℤ p) + ( reduce-fraction-ℤ q) + ( sim-reduced-fraction-ℤ p) + ( sim-reduced-fraction-ℤ q) module _ (x : ℚ) (p : fraction-ℤ) where - preserves-leq-right-rational-fraction-ℤ : - leq-fraction-ℤ (fraction-ℚ x) p → leq-ℚ x (rational-fraction-ℤ p) - preserves-leq-right-rational-fraction-ℤ H = - concatenate-leq-sim-fraction-ℤ - ( fraction-ℚ x) - ( p) - ( fraction-ℚ ( rational-fraction-ℤ p)) - ( H) - ( sim-reduced-fraction-ℤ p) - - reflects-leq-right-rational-fraction-ℤ : - leq-ℚ x (rational-fraction-ℤ p) → leq-fraction-ℤ (fraction-ℚ x) p - reflects-leq-right-rational-fraction-ℤ H = - concatenate-leq-sim-fraction-ℤ - ( fraction-ℚ x) - ( reduce-fraction-ℤ p) - ( p) - ( H) - ( symmetric-sim-fraction-ℤ + abstract + preserves-leq-right-rational-fraction-ℤ : + leq-fraction-ℤ (fraction-ℚ x) p → leq-ℚ x (rational-fraction-ℤ p) + preserves-leq-right-rational-fraction-ℤ H = + concatenate-leq-sim-fraction-ℤ + ( fraction-ℚ x) ( p) + ( fraction-ℚ ( rational-fraction-ℤ p)) + ( H) + ( sim-reduced-fraction-ℤ p) + + reflects-leq-right-rational-fraction-ℤ : + leq-ℚ x (rational-fraction-ℤ p) → leq-fraction-ℤ (fraction-ℚ x) p + reflects-leq-right-rational-fraction-ℤ H = + concatenate-leq-sim-fraction-ℤ + ( fraction-ℚ x) ( reduce-fraction-ℤ p) - ( sim-reduced-fraction-ℤ p)) + ( p) + ( H) + ( symmetric-sim-fraction-ℤ + ( p) + ( reduce-fraction-ℤ p) + ( sim-reduced-fraction-ℤ p)) iff-leq-right-rational-fraction-ℤ : leq-fraction-ℤ (fraction-ℚ x) p ↔ leq-ℚ x (rational-fraction-ℤ p) @@ -209,26 +214,27 @@ module _ preserves-leq-right-rational-fraction-ℤ pr2 iff-leq-right-rational-fraction-ℤ = reflects-leq-right-rational-fraction-ℤ - preserves-leq-left-rational-fraction-ℤ : - leq-fraction-ℤ p (fraction-ℚ x) → leq-ℚ (rational-fraction-ℤ p) x - preserves-leq-left-rational-fraction-ℤ = - concatenate-sim-leq-fraction-ℤ - ( fraction-ℚ ( rational-fraction-ℤ p)) - ( p) - ( fraction-ℚ x) - ( symmetric-sim-fraction-ℤ - ( p) + abstract + preserves-leq-left-rational-fraction-ℤ : + leq-fraction-ℤ p (fraction-ℚ x) → leq-ℚ (rational-fraction-ℤ p) x + preserves-leq-left-rational-fraction-ℤ = + concatenate-sim-leq-fraction-ℤ ( fraction-ℚ ( rational-fraction-ℤ p)) - ( sim-reduced-fraction-ℤ p)) - - reflects-leq-left-rational-fraction-ℤ : - leq-ℚ (rational-fraction-ℤ p) x → leq-fraction-ℤ p (fraction-ℚ x) - reflects-leq-left-rational-fraction-ℤ = - concatenate-sim-leq-fraction-ℤ - ( p) - ( reduce-fraction-ℤ p) - ( fraction-ℚ x) - ( sim-reduced-fraction-ℤ p) + ( p) + ( fraction-ℚ x) + ( symmetric-sim-fraction-ℤ + ( p) + ( fraction-ℚ ( rational-fraction-ℤ p)) + ( sim-reduced-fraction-ℤ p)) + + reflects-leq-left-rational-fraction-ℤ : + leq-ℚ (rational-fraction-ℤ p) x → leq-fraction-ℤ p (fraction-ℚ x) + reflects-leq-left-rational-fraction-ℤ = + concatenate-sim-leq-fraction-ℤ + ( p) + ( reduce-fraction-ℤ p) + ( fraction-ℚ x) + ( sim-reduced-fraction-ℤ p) iff-leq-left-rational-fraction-ℤ : leq-fraction-ℤ p (fraction-ℚ x) ↔ leq-ℚ (rational-fraction-ℤ p) x @@ -243,26 +249,29 @@ module _ (x y : ℚ) where - iff-translate-diff-leq-zero-ℚ : leq-ℚ zero-ℚ (y -ℚ x) ↔ leq-ℚ x y - iff-translate-diff-leq-zero-ℚ = - logical-equivalence-reasoning - leq-ℚ zero-ℚ (y -ℚ x) - ↔ leq-fraction-ℤ - ( zero-fraction-ℤ) - ( add-fraction-ℤ (fraction-ℚ y) (neg-fraction-ℤ (fraction-ℚ x))) - by - inv-iff - ( iff-leq-right-rational-fraction-ℤ - ( zero-ℚ) - ( add-fraction-ℤ (fraction-ℚ y) (neg-fraction-ℤ (fraction-ℚ x)))) - ↔ leq-ℚ x y - by - inv-tr - ( _↔ leq-ℚ x y) - ( eq-translate-diff-leq-zero-fraction-ℤ - ( fraction-ℚ x) - ( fraction-ℚ y)) - ( id-iff) + abstract + iff-translate-diff-leq-zero-ℚ : leq-ℚ zero-ℚ (y -ℚ x) ↔ leq-ℚ x y + iff-translate-diff-leq-zero-ℚ = + logical-equivalence-reasoning + leq-ℚ zero-ℚ (y -ℚ x) + ↔ leq-fraction-ℤ + ( zero-fraction-ℤ) + ( add-fraction-ℤ (fraction-ℚ y) (neg-fraction-ℤ (fraction-ℚ x))) + by + inv-iff + ( iff-leq-right-rational-fraction-ℤ + ( zero-ℚ) + ( add-fraction-ℤ + ( fraction-ℚ y) + ( neg-fraction-ℤ (fraction-ℚ x)))) + ↔ leq-ℚ x y + by + inv-tr + ( _↔ leq-ℚ x y) + ( eq-translate-diff-leq-zero-fraction-ℤ + ( fraction-ℚ x) + ( fraction-ℚ y)) + ( id-iff) ``` ### Inequality on the rational numbers is invariant by translation @@ -272,34 +281,35 @@ module _ (z x y : ℚ) where - iff-translate-left-leq-ℚ : leq-ℚ (z +ℚ x) (z +ℚ y) ↔ leq-ℚ x y - iff-translate-left-leq-ℚ = - logical-equivalence-reasoning - leq-ℚ (z +ℚ x) (z +ℚ y) - ↔ leq-ℚ zero-ℚ ((z +ℚ y) -ℚ (z +ℚ x)) - by (inv-iff (iff-translate-diff-leq-zero-ℚ (z +ℚ x) (z +ℚ y))) - ↔ leq-ℚ zero-ℚ (y -ℚ x) - by - ( inv-tr - ( _↔ leq-ℚ zero-ℚ (y -ℚ x)) - ( ap (leq-ℚ zero-ℚ) (left-translation-diff-ℚ y x z)) - ( id-iff)) - ↔ leq-ℚ x y - by (iff-translate-diff-leq-zero-ℚ x y) - - iff-translate-right-leq-ℚ : leq-ℚ (x +ℚ z) (y +ℚ z) ↔ leq-ℚ x y - iff-translate-right-leq-ℚ = - logical-equivalence-reasoning - leq-ℚ (x +ℚ z) (y +ℚ z) - ↔ leq-ℚ zero-ℚ ((y +ℚ z) -ℚ (x +ℚ z)) - by (inv-iff (iff-translate-diff-leq-zero-ℚ (x +ℚ z) (y +ℚ z))) - ↔ leq-ℚ zero-ℚ (y -ℚ x) - by - ( inv-tr - ( _↔ leq-ℚ zero-ℚ (y -ℚ x)) - ( ap (leq-ℚ zero-ℚ) (right-translation-diff-ℚ y x z)) - ( id-iff)) - ↔ leq-ℚ x y by (iff-translate-diff-leq-zero-ℚ x y) + abstract + iff-translate-left-leq-ℚ : leq-ℚ (z +ℚ x) (z +ℚ y) ↔ leq-ℚ x y + iff-translate-left-leq-ℚ = + logical-equivalence-reasoning + leq-ℚ (z +ℚ x) (z +ℚ y) + ↔ leq-ℚ zero-ℚ ((z +ℚ y) -ℚ (z +ℚ x)) + by (inv-iff (iff-translate-diff-leq-zero-ℚ (z +ℚ x) (z +ℚ y))) + ↔ leq-ℚ zero-ℚ (y -ℚ x) + by + ( inv-tr + ( _↔ leq-ℚ zero-ℚ (y -ℚ x)) + ( ap (leq-ℚ zero-ℚ) (left-translation-diff-ℚ y x z)) + ( id-iff)) + ↔ leq-ℚ x y + by (iff-translate-diff-leq-zero-ℚ x y) + + iff-translate-right-leq-ℚ : leq-ℚ (x +ℚ z) (y +ℚ z) ↔ leq-ℚ x y + iff-translate-right-leq-ℚ = + logical-equivalence-reasoning + leq-ℚ (x +ℚ z) (y +ℚ z) + ↔ leq-ℚ zero-ℚ ((y +ℚ z) -ℚ (x +ℚ z)) + by (inv-iff (iff-translate-diff-leq-zero-ℚ (x +ℚ z) (y +ℚ z))) + ↔ leq-ℚ zero-ℚ (y -ℚ x) + by + ( inv-tr + ( _↔ leq-ℚ zero-ℚ (y -ℚ x)) + ( ap (leq-ℚ zero-ℚ) (right-translation-diff-ℚ y x z)) + ( id-iff)) + ↔ leq-ℚ x y by (iff-translate-diff-leq-zero-ℚ x y) preserves-leq-left-add-ℚ : leq-ℚ x y → leq-ℚ (x +ℚ z) (y +ℚ z) preserves-leq-left-add-ℚ = backward-implication iff-translate-right-leq-ℚ diff --git a/src/elementary-number-theory/rational-numbers.lagda.md b/src/elementary-number-theory/rational-numbers.lagda.md index f4b630199a..461cb3854d 100644 --- a/src/elementary-number-theory/rational-numbers.lagda.md +++ b/src/elementary-number-theory/rational-numbers.lagda.md @@ -155,14 +155,15 @@ mediant-ℚ x y = ### The rational images of two similar integer fractions are equal ```agda -eq-ℚ-sim-fraction-ℤ : - (x y : fraction-ℤ) → (H : sim-fraction-ℤ x y) → - rational-fraction-ℤ x = rational-fraction-ℤ y -eq-ℚ-sim-fraction-ℤ x y H = - eq-pair-Σ' - ( pair - ( unique-reduce-fraction-ℤ x y H) - ( eq-is-prop (is-prop-is-reduced-fraction-ℤ (reduce-fraction-ℤ y)))) +abstract + eq-ℚ-sim-fraction-ℤ : + (x y : fraction-ℤ) → (H : sim-fraction-ℤ x y) → + rational-fraction-ℤ x = rational-fraction-ℤ y + eq-ℚ-sim-fraction-ℤ x y H = + eq-pair-Σ' + ( pair + ( unique-reduce-fraction-ℤ x y H) + ( eq-is-prop (is-prop-is-reduced-fraction-ℤ (reduce-fraction-ℤ y)))) ``` ### The type of rationals is a set diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index 06174ce77c..3df7d7cd6d 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -106,7 +106,10 @@ module _ ( p' +ℚ (q -ℚ p)) ( q) ( q' From b3b72b244d870facf903ebbd95993c18881cde0b Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 10 Feb 2025 19:28:57 -0800 Subject: [PATCH 023/119] Progress --- ...thmetically-located-dedekind-cuts.lagda.md | 10 +- .../dedekind-real-numbers.lagda.md | 222 +++++++++++------- .../lower-dedekind-real-numbers.lagda.md | 32 ++- .../upper-dedekind-real-numbers.lagda.md | 32 ++- 4 files changed, 199 insertions(+), 97 deletions(-) diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index 3df7d7cd6d..f4b8c30560 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -60,8 +60,8 @@ module _ {l : Level} (L : lower-ℝ l) (U : upper-ℝ l) where - is-arithmetically-located-pair-of-cuts-ℚ : UU l - is-arithmetically-located-pair-of-cuts-ℚ = + arithmetically-located-lower-upper-ℝ : UU l + arithmetically-located-lower-upper-ℝ = (ε⁺ : ℚ⁺) → exists ( ℚ × ℚ) @@ -79,13 +79,13 @@ rational numbers, it is also located. ```agda module _ - {l : Level} (L : lower-ℝ l) (U : upper-ℝ l) + {l : Level} (x : lower-ℝ l) (y : upper-ℝ l) where abstract is-located-is-arithmetically-located-pair-of-cuts-ℚ : - is-arithmetically-located-pair-of-cuts-ℚ L U → - is-located-cut (cut-lower-ℝ L) (cut-upper-ℝ U) + arithmetically-located-upper-real x y → + is-located-cut (cut-lower-ℝ x) (cut-upper-ℝ y) is-located-is-arithmetically-located-pair-of-cuts-ℚ arithmetically-located p q p

Imports ```agda +open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.conjunction +open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.identity-types open import foundation.logical-equivalences open import foundation.propositions +open import foundation.sets open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.truncated-types +open import foundation.truncation-levels open import foundation.universal-quantification open import foundation.universe-levels ``` @@ -89,7 +95,18 @@ module _ ## Properties -### Lower Dedekind cuts are closed under the standard ordering on the rationals +### The lower Dedekind reals form a set + +```agda +abstract + is-set-lower-ℝ : (l : Level) → is-set (lower-ℝ l) + is-set-lower-ℝ l = + is-set-Σ + ( is-set-function-type (is-trunc-Truncated-Type neg-one-𝕋)) + ( λ q → is-set-is-prop (is-prop-type-Prop (is-lower-dedekind-cut-Prop q))) +``` + +### Lower Dedekind cuts are closed under strict inequality on the rationals ```agda module _ @@ -103,6 +120,19 @@ module _ ( intro-exists q (pImports ```agda +open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.conjunction +open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.identity-types open import foundation.logical-equivalences open import foundation.propositions +open import foundation.sets open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.truncated-types +open import foundation.truncation-levels open import foundation.universal-quantification open import foundation.universe-levels ``` @@ -89,7 +95,18 @@ module _ ## Properties -### Upper Dedekind cuts are closed under the standard ordering on the rationals +### The upper Dedekind reals form a set + +```agda +abstract + is-set-upper-ℝ : (l : Level) → is-set (upper-ℝ l) + is-set-upper-ℝ l = + is-set-Σ + ( is-set-function-type (is-trunc-Truncated-Type neg-one-𝕋)) + ( λ q → is-set-is-prop (is-prop-type-Prop (is-upper-dedekind-cut-Prop q))) +``` + +### Upper Dedekind cuts are closed under strict inequality on the rationals ```agda module _ @@ -103,6 +120,19 @@ module _ ( intro-exists p (p Date: Mon, 10 Feb 2025 19:45:56 -0800 Subject: [PATCH 024/119] Recover all the previous results --- .../dedekind-real-numbers.lagda.md | 104 +++++------------- 1 file changed, 27 insertions(+), 77 deletions(-) diff --git a/src/real-numbers/dedekind-real-numbers.lagda.md b/src/real-numbers/dedekind-real-numbers.lagda.md index d4ec0c3e69..c973a7b3cc 100644 --- a/src/real-numbers/dedekind-real-numbers.lagda.md +++ b/src/real-numbers/dedekind-real-numbers.lagda.md @@ -21,6 +21,7 @@ open import foundation.dependent-pair-types open import foundation.disjunction open import foundation.embeddings open import foundation.empty-types +open import foundation.equivalences open import foundation.existential-quantification open import foundation.function-types open import foundation.functoriality-cartesian-product-types @@ -397,6 +398,14 @@ module _ ( upper-cut-ℝ y) ( H))) + eq-lower-real-eq-upper-real-ℝ : + upper-real-ℝ x = upper-real-ℝ y → lower-real-ℝ x = lower-real-ℝ y + eq-lower-real-eq-upper-real-ℝ ux=uy = + eq-eq-cut-lower-ℝ + ( lower-real-ℝ x) + ( lower-real-ℝ y) + ( eq-lower-cut-eq-upper-cut-ℝ (ap cut-upper-ℝ ux=uy)) + eq-upper-cut-eq-lower-cut-ℝ : lower-cut-ℝ x = lower-cut-ℝ y → upper-cut-ℝ x = upper-cut-ℝ y eq-upper-cut-eq-lower-cut-ℝ H = @@ -413,6 +422,14 @@ module _ ( lower-cut-ℝ x) ( lower-cut-ℝ y) ( H))) + + eq-upper-real-eq-lower-real-ℝ : + lower-real-ℝ x = lower-real-ℝ y → upper-real-ℝ x = upper-real-ℝ y + eq-upper-real-eq-lower-real-ℝ lx=ly = + eq-eq-cut-upper-ℝ + ( upper-real-ℝ x) + ( upper-real-ℝ y) + ( eq-upper-cut-eq-lower-cut-ℝ (ap cut-lower-ℝ lx=ly)) ``` ### The map from a real number to its lower real is an embedding @@ -439,93 +456,26 @@ is-emb-lower-real : {l : Level} → is-emb (lower-real-ℝ {l}) is-emb-lower-real = is-emb-inclusion-subtype has-upper-real-Prop ``` -### The map from a real number to its upper real is an embedding +### Two real numbers with the same lower/upper real are equal ```agda module _ - {l : Level} - (uy : upper-ℝ l) - where - - has-lower-real-Prop : Prop (lsuc l) - pr1 has-lower-real-Prop = - Σ (lower-ℝ l) (λ lx → is-dedekind-lower-upper-ℝ lx uy) - pr2 has-lower-real-Prop = - ( is-prop-all-elements-equal) - ( λ lx lx' → - eq-type-subtype - ( λ l → is-dedekind-prop-lower-upper-ℝ l uy) - ( eq-eq-cut-lower-ℝ - ( pr1 lx) - ( pr1 lx') - ( eq-lower-cut-eq-upper-cut-ℝ - ( pr1 lx , uy , pr2 lx) - ( pr1 lx' , uy , pr2 lx') - ( refl)))) - -is-emb-upper-real : {l : Level} → is-emb (upper-real-ℝ {l}) -pr1 (pr1 (is-emb-upper-real (lx , ux , Hx) (ly , uy , Hy))) ux=uy = - ap - ( λ (uz , lz , Hz) → (lz , uz , Hz)) - ( pr1 - ( pr1 - ( is-emb-inclusion-subtype - ( has-lower-real-Prop) - ( ux , lx , Hx) - ( uy , ly , Hy))) - ( ux=uy)) -pr2 (pr1 (is-emb-upper-real (lx , ux , Hx) (ly , uy , Hy))) ux=uy = - {! (pr2 (pr1 (is-emb-inclusion-subtype has-lower-real-Prop (ux , lx , Hx) (uy , ly , Hy))) ux=uy) !} -pr1 (pr2 (is-emb-upper-real (lx , ux , Hx) (ly , uy , Hy))) ux=uy = - ap - ( λ (uz , lz , Hz) → (lz , uz , Hz)) - ( pr1 - (pr2 - (is-emb-inclusion-subtype - ( has-lower-real-Prop) - ( ux , lx , Hx) - ( uy , ly , Hy))) - ux=uy) -pr2 (pr2 (is-emb-upper-real (lx , ux , Hx) (ly , uy , Hy))) x=y = - {! pr2 (pr2 (is-emb-inclusion-subtype has-lower-real-Prop (ux , lx , Hx) (uy , ly , Hy))) (ap (λ (lz , uz , Hz) → (uz , lz , Hz)) x=y) !} -``` - -### The map from a real number to its lower cut is an embedding - -```agda -{- module _ - {l : Level} (L : subtype l ℚ) + {l : Level} (x y : ℝ l) where - has-upper-cut-Prop : Prop (lsuc l) - has-upper-cut-Prop = - pair - ( Σ (subtype l ℚ) (is-dedekind-cut L)) - ( is-prop-all-elements-equal - ( λ U U' → - eq-type-subtype - ( is-dedekind-cut-Prop L) - ( eq-upper-cut-eq-lower-cut-ℝ - ( pair L U) - ( pair L U') - ( refl)))) - -is-emb-lower-cut : {l : Level} → is-emb (lower-cut-ℝ {l}) -is-emb-lower-cut = is-emb-inclusion-subtype has-upper-cut-Prop -} -``` - -### Two real numbers with the same lower/upper cut are equal + eq-eq-lower-real-ℝ : lower-real-ℝ x = lower-real-ℝ y → x = y + eq-eq-lower-real-ℝ = eq-type-subtype has-upper-real-Prop -```agda -{- module _ - {l : Level} (x y : ℝ l) - where + eq-eq-upper-real-ℝ : upper-real-ℝ x = upper-real-ℝ y → x = y + eq-eq-upper-real-ℝ = eq-eq-lower-real-ℝ ∘ (eq-lower-real-eq-upper-real-ℝ x y) eq-eq-lower-cut-ℝ : lower-cut-ℝ x = lower-cut-ℝ y → x = y - eq-eq-lower-cut-ℝ = eq-type-subtype has-upper-cut-Prop + eq-eq-lower-cut-ℝ lcx=lcy = + eq-eq-lower-real-ℝ + ( eq-eq-cut-lower-ℝ (lower-real-ℝ x) (lower-real-ℝ y) lcx=lcy) eq-eq-upper-cut-ℝ : upper-cut-ℝ x = upper-cut-ℝ y → x = y - eq-eq-upper-cut-ℝ = eq-eq-lower-cut-ℝ ∘ (eq-lower-cut-eq-upper-cut-ℝ x y) -} + eq-eq-upper-cut-ℝ = eq-eq-lower-cut-ℝ ∘ (eq-lower-cut-eq-upper-cut-ℝ x y) ``` ## References From 263f367ecf3f72d4c45766fcacf734c7e7eceda7 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 11 Feb 2025 15:40:17 -0800 Subject: [PATCH 025/119] make pre-commit --- ...ithmetically-located-dedekind-cuts.lagda.md | 14 +++++++------- .../dedekind-real-numbers.lagda.md | 16 +++++++--------- .../rational-real-numbers.lagda.md | 18 ++++++------------ 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index f4b8c30560..ee15d2d9c1 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -83,22 +83,22 @@ module _ where abstract - is-located-is-arithmetically-located-pair-of-cuts-ℚ : - arithmetically-located-upper-real x y → - is-located-cut (cut-lower-ℝ x) (cut-upper-ℝ y) - is-located-is-arithmetically-located-pair-of-cuts-ℚ + is-located-is-arithmetically-located-lower-upper-ℝ : + arithmetically-located-lower-upper-ℝ x y → + is-located-lower-upper-ℝ x y + is-located-is-arithmetically-located-lower-upper-ℝ arithmetically-located p q p Date: Tue, 11 Feb 2025 15:47:49 -0800 Subject: [PATCH 026/119] Remove empty bibliography --- .../inequality-lower-dedekind-real-numbers.lagda.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md index 7a73363b9c..26abd2fb42 100644 --- a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md @@ -111,7 +111,3 @@ iff-leq-lower-real-ℚ : pr1 (iff-leq-lower-real-ℚ p q) = preserves-leq-lower-real-ℚ p q pr2 (iff-leq-lower-real-ℚ p q) = reflects-leq-lower-real-ℚ p q ``` - -## References - -{{#bibliography}} From 827111e46a69879d9d18e743bfc0e3de068f73b7 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 11 Feb 2025 15:58:20 -0800 Subject: [PATCH 027/119] Review changes --- .../lower-dedekind-real-numbers.lagda.md | 28 ++++++++++++------- .../upper-dedekind-real-numbers.lagda.md | 28 ++++++++++++------- 2 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index 948f6e60bd..db4cf96ad6 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -15,8 +15,10 @@ open import foundation.conjunction open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.existential-quantification +open import foundation.function-types open import foundation.identity-types open import foundation.logical-equivalences +open import foundation.powersets open import foundation.propositions open import foundation.sets open import foundation.subtypes @@ -31,9 +33,8 @@ open import foundation.universe-levels ## Idea -A lower -{{#concept "Dedekind cut" Agda=is-dedekind-cut WD="dedekind cut" WDID=Q851333}} -consists of a [subtype](foundation-core.subtypes.md) `L` of +A {{#concept "lower Dedekind cut" Agda=is-lower-dedekind-cut}} consists of a +[subtype](foundation-core.subtypes.md) `L` of [the rational numbers](elementary-number-theory.rational-numbers.md) `ℚ`, satisfying the following two conditions: @@ -42,8 +43,8 @@ satisfying the following two conditions: [if and only if](foundation.logical-equivalences.md) there [exists](foundation.existential-quantification.md) `q < r` such that `r ∈ L`. -The type of all lower Dedekind real numbers is the type of all lower Dedekind -cuts. +The {{#concept "lower Dedekind real numbers" Agda=lower-ℝ}} is the type of all +lower Dedekind cuts. ## Definition @@ -113,8 +114,9 @@ module _ {l : Level} (x : lower-ℝ l) (p q : ℚ) where - le-cut-lower-ℝ : le-ℚ p q → is-in-cut-lower-ℝ x q → is-in-cut-lower-ℝ x p - le-cut-lower-ℝ p Date: Tue, 11 Feb 2025 16:15:25 -0800 Subject: [PATCH 028/119] Fix names --- .../arithmetically-located-dedekind-cuts.lagda.md | 4 ++-- src/real-numbers/dedekind-real-numbers.lagda.md | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index ee15d2d9c1..38e39bfb9e 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -94,10 +94,10 @@ module _ rec-coproduct ( λ p Date: Tue, 11 Feb 2025 17:28:04 -0800 Subject: [PATCH 029/119] Progress --- .../decidable-total-orders.lagda.md | 516 +++++++----------- .../greatest-lower-bounds-posets.lagda.md | 57 ++ .../least-upper-bounds-posets.lagda.md | 36 ++ src/order-theory/meet-semilattices.lagda.md | 2 +- 4 files changed, 290 insertions(+), 321 deletions(-) diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index 58125369d8..9ece7d08c0 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -21,7 +21,9 @@ open import foundation.universe-levels open import order-theory.decidable-posets open import order-theory.decidable-total-preorders open import order-theory.greatest-lower-bounds-posets +open import order-theory.join-semilattices open import order-theory.least-upper-bounds-posets +open import order-theory.meet-semilattices open import order-theory.posets open import order-theory.preorders open import order-theory.total-orders @@ -212,333 +214,174 @@ module _ ( is-leq-or-strict-greater-Decidable-Total-Order T x y) ``` -### `min x y ≤ x` +### `min x y` is the greatest lower bound of `x` and `y` ```agda - leq-left-min-Decidable-Total-Order : - leq-Decidable-Total-Order T min-Decidable-Total-Order x - leq-left-min-Decidable-Total-Order - with is-leq-or-strict-greater-Decidable-Total-Order T x y - ... | inl x≤y = refl-leq-Decidable-Total-Order T x - ... | inr y Date: Tue, 11 Feb 2025 17:32:39 -0800 Subject: [PATCH 030/119] Merge --- src/order-theory/decidable-total-orders.lagda.md | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index ecf37d07d3..66a502bc4a 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -381,7 +381,7 @@ module _ ( order-theoretic-join-semilattice-Decidable-Total-Order) ``` -### `min x y ≤ x` +### The minimum of two values is a lower bound ```agda module _ @@ -396,11 +396,7 @@ module _ leq-left-is-greatest-binary-lower-bound-Poset ( poset-Decidable-Total-Order T) ( min-is-greatest-binary-lower-bound-Decidable-Total-Order T x y) -``` - -### `min x y ≤ y` -```agda leq-right-min-Decidable-Total-Order : leq-Decidable-Total-Order T (min-Decidable-Total-Order T x y) y leq-right-min-Decidable-Total-Order = @@ -409,7 +405,7 @@ module _ ( min-is-greatest-binary-lower-bound-Decidable-Total-Order T x y) ``` -### `x ≤ max x y` +### The maximum of two values is an upper bound ```agda leq-left-max-Decidable-Total-Order : @@ -418,11 +414,7 @@ module _ leq-left-is-least-binary-upper-bound-Poset ( poset-Decidable-Total-Order T) ( max-is-least-binary-upper-bound-Decidable-Total-Order T x y) -``` - -### `y ≤ max x y` -```agda leq-right-max-Decidable-Total-Order : leq-Decidable-Total-Order T y (max-Decidable-Total-Order T x y) leq-right-max-Decidable-Total-Order = @@ -436,7 +428,7 @@ module _ ```agda left-leq-right-min-Decidable-Total-Order : leq-Decidable-Total-Order T x y → min-Decidable-Total-Order T x y = x - left-leq-right-min-Decidable-Total-Order H + left-leq-right-min-Decidable-Total-Order H = with is-leq-or-strict-greater-Decidable-Total-Order T x y ... | inl x≤y = refl ... | inr y Date: Tue, 11 Feb 2025 17:36:34 -0800 Subject: [PATCH 031/119] Fix syntax --- src/order-theory/decidable-total-orders.lagda.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index 66a502bc4a..0afc3251ab 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -428,7 +428,7 @@ module _ ```agda left-leq-right-min-Decidable-Total-Order : leq-Decidable-Total-Order T x y → min-Decidable-Total-Order T x y = x - left-leq-right-min-Decidable-Total-Order H = + left-leq-right-min-Decidable-Total-Order H with is-leq-or-strict-greater-Decidable-Total-Order T x y ... | inl x≤y = refl ... | inr y Date: Tue, 11 Feb 2025 21:07:48 -0800 Subject: [PATCH 032/119] Fix links --- src/real-numbers/dedekind-real-numbers.lagda.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/real-numbers/dedekind-real-numbers.lagda.md b/src/real-numbers/dedekind-real-numbers.lagda.md index 76134fd985..3e6695ebce 100644 --- a/src/real-numbers/dedekind-real-numbers.lagda.md +++ b/src/real-numbers/dedekind-real-numbers.lagda.md @@ -51,8 +51,9 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea A Dedekind real number consists of a [pair](foundation.dependent-pair-types.md) -`(lx , uy)` of a [lower Dedekind real](real-numbers.lower-dedekind-real-numbers) -and an [upper Dedekind real](real-numbers.upper-dedekind-real-numbers) that also +`(lx , uy)` of a +[lower Dedekind real](real-numbers.lower-dedekind-real-numbers.md) and an +[upper Dedekind real](real-numbers.upper-dedekind-real-numbers.md) that also satisfy the following conditions: 1. _Disjointness_. The cuts of `lx` and `uy` are disjoint subsets of `ℚ`. From 71479cac22d2f14bac981f0d66592b74e1d85048 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 11:20:08 -0800 Subject: [PATCH 033/119] Fix naming --- .../arithmetically-located-dedekind-cuts.lagda.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index 38e39bfb9e..fe8f273ea0 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -42,8 +42,8 @@ open import real-numbers.upper-dedekind-real-numbers ## Definition -A pair of a [lower Dedekind cut](real-numbers.lower-dedekind-real-numbers.md) -`L` and an [upper Dedekind cut](real-numbers.upper-dedekind-real-numbers.md) `U` +A pair of a [lower Dedekind real](real-numbers.lower-dedekind-real-numbers.md) +`L` and an [upper Dedekind real](real-numbers.upper-dedekind-real-numbers.md) `U` is {{#concept "arithmetically located" Disambiguation="Dedekind cut"}} if for any positive [rational number](elementary-number-theory.rational-numbers.md) `ε : ℚ`, there exist `p, q : ℚ` such that `0 < q - p < ε`, `p ∈ L`, and `q ∈ U`. From e53543547c419196f42eed070551b537a68d302f Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 11:31:45 -0800 Subject: [PATCH 034/119] make pre-commit --- .../arithmetically-located-dedekind-cuts.lagda.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index fe8f273ea0..405a77a7e2 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -43,9 +43,9 @@ open import real-numbers.upper-dedekind-real-numbers ## Definition A pair of a [lower Dedekind real](real-numbers.lower-dedekind-real-numbers.md) -`L` and an [upper Dedekind real](real-numbers.upper-dedekind-real-numbers.md) `U` -is {{#concept "arithmetically located" Disambiguation="Dedekind cut"}} if for -any positive [rational number](elementary-number-theory.rational-numbers.md) +`L` and an [upper Dedekind real](real-numbers.upper-dedekind-real-numbers.md) +`U` is {{#concept "arithmetically located" Disambiguation="Dedekind cut"}} if +for any positive [rational number](elementary-number-theory.rational-numbers.md) `ε : ℚ`, there exist `p, q : ℚ` such that `0 < q - p < ε`, `p ∈ L`, and `q ∈ U`. Intuitively, when `L , U` represent the cuts of a real number `x`, `p` and `q` are rational approximations of `x` to within `ε`. This follows parts of Section From bd83f7bd0498a70f2eea96ade78e66522079248f Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 12:26:03 -0800 Subject: [PATCH 035/119] Start --- ...nimum-lower-dedekind-real-numbers.lagda.md | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md diff --git a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md new file mode 100644 index 0000000000..b60d3eda45 --- /dev/null +++ b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md @@ -0,0 +1,54 @@ +# The minimum of lower Dedekind real numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module real-numbers.minimum-lower-dedekind-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.rational-numbers + +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.intersections-subtypes +open import foundation.subtypes +open import foundation.universe-levels + +open import real-numbers.inequality-lower-dedekind-real-numbers +open import real-numbers.lower-dedekind-real-numbers +``` + +
+ +## Idea + +The minimum of two +[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers) `x`, `y` +is a lower Dedekind real number with cut equal to the intersection of the cuts +of `x` and `y`. + +The minimum of a family of lower Dedekind real numbers is not always a lower +Dedekind real number. + +## Definition + +```agda +module _ + {l1 l2 : Level} + (x : lower-ℝ l1) + (y : lower-ℝ l2) + where + + binary-min-cut-lower-ℝ : subtype (l1 ⊔ l2) ℚ + binary-min-cut-lower-ℝ = intersection-subtype (cut-lower-ℝ x) (cut-lower-ℝ y) + + is-inhabited-binary-min-cut-lower-ℝ : exists ℚ binary-min-cut-lower-ℝ + is-inhabited-binary-min-cut-lower-ℝ = + elim-exists + ( ∃ ℚ binary-min-cut-lower-ℝ) + {! !} + (is-inhabited-cut-lower-ℝ x) +``` From fbbfe5e5e6d37d4471946b8743dff42636f04de8 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 12:33:18 -0800 Subject: [PATCH 036/119] Progress --- .../minimum-rational-numbers.lagda.md | 51 +++++++++++++++++++ ...nimum-lower-dedekind-real-numbers.lagda.md | 8 ++- 2 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 src/elementary-number-theory/minimum-rational-numbers.lagda.md diff --git a/src/elementary-number-theory/minimum-rational-numbers.lagda.md b/src/elementary-number-theory/minimum-rational-numbers.lagda.md new file mode 100644 index 0000000000..7b615376bb --- /dev/null +++ b/src/elementary-number-theory/minimum-rational-numbers.lagda.md @@ -0,0 +1,51 @@ +# Minimum on the rational numbers + +```agda +module elementary-number-theory.minimum-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.decidable-total-order-rational-numbers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.rational-numbers + +open import foundation.identity-types + +open import order-theory.decidable-total-orders +``` + +
+ +## Idea + +We define the operation of minimum (greatest lower bound) for the rational +numbers. + +## Definition + +```agda +min-ℚ : ℚ → ℚ → ℚ +min-ℚ = min-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +## Properties + +### Associativity of `min-ℚ` + +```agda + +``` + +### Commutativity of `min-ℚ` + +```agda + +``` + +### `min-ℚ` is idempotent + +```agda +idempotent-min-ℚ : (x : ℚ) → min-ℚ x x = x +``` diff --git a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md index b60d3eda45..93e32b2094 100644 --- a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md @@ -17,6 +17,8 @@ open import foundation.intersections-subtypes open import foundation.subtypes open import foundation.universe-levels +open import logic.functoriality-existential-quantification + open import real-numbers.inequality-lower-dedekind-real-numbers open import real-numbers.lower-dedekind-real-numbers ``` @@ -47,8 +49,10 @@ module _ is-inhabited-binary-min-cut-lower-ℝ : exists ℚ binary-min-cut-lower-ℝ is-inhabited-binary-min-cut-lower-ℝ = - elim-exists - ( ∃ ℚ binary-min-cut-lower-ℝ) + map-binary-exists + ( is-in-subtype binary-min-cut-lower-ℝ) + {! !} {! !} (is-inhabited-cut-lower-ℝ x) + (is-inhabited-cut-lower-ℝ y) ``` From 9444d9e44ebf88d832b30417bbd0091d4744d954 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 13:08:28 -0800 Subject: [PATCH 037/119] Progress --- .../maximum-rational-numbers.lagda.md | 58 +++++++++++++ .../minimum-rational-numbers.lagda.md | 55 +++++++++++- ...nimum-lower-dedekind-real-numbers.lagda.md | 87 +++++++++++++++++-- 3 files changed, 187 insertions(+), 13 deletions(-) create mode 100644 src/elementary-number-theory/maximum-rational-numbers.lagda.md diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md new file mode 100644 index 0000000000..81f90905dd --- /dev/null +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -0,0 +1,58 @@ +# Maximum on the rational numbers + +```agda +module elementary-number-theory.maximum-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.decidable-total-order-rational-numbers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.rational-numbers + +open import foundation.identity-types + +open import order-theory.decidable-total-orders +``` + +
+ +## Idea + +We define the operation of maximum +([least upper bound](order-theory.least-upper-bounds-posets.md)) for the +[rational numbers](elementary-number-theory.rational-numbers.md). + +## Definition + +```agda +max-ℚ : ℚ → ℚ → ℚ +max-ℚ = max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +## Properties + +### Associativity of `max-ℚ` + +```agda +associative-max-ℚ : (x y z : ℚ) → max-ℚ (max-ℚ x y) z = max-ℚ x (max-ℚ y z) +associative-max-ℚ = + associative-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### Commutativity of `max-ℚ` + +```agda +commutative-max-ℚ : (x y : ℚ) → max-ℚ x y = max-ℚ y x +commutative-max-ℚ = + commutative-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### `max-ℚ` is idempotent + +```agda +idempotent-max-ℚ : (x : ℚ) → max-ℚ x x = x +idempotent-max-ℚ = + idempotent-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` diff --git a/src/elementary-number-theory/minimum-rational-numbers.lagda.md b/src/elementary-number-theory/minimum-rational-numbers.lagda.md index 7b615376bb..2a29856b46 100644 --- a/src/elementary-number-theory/minimum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/minimum-rational-numbers.lagda.md @@ -10,8 +10,11 @@ module elementary-number-theory.minimum-rational-numbers where open import elementary-number-theory.decidable-total-order-rational-numbers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.coproduct-types open import foundation.identity-types +open import foundation.transport-along-identifications open import order-theory.decidable-total-orders ``` @@ -20,8 +23,9 @@ open import order-theory.decidable-total-orders ## Idea -We define the operation of minimum (greatest lower bound) for the rational -numbers. +We define the operation of minimum +([greatest lower bound](order-theory.greatest-lower-bounds-posets.md)) for the +[rational numbers](elementary-number-theory.rational-numbers.md). ## Definition @@ -35,17 +39,60 @@ min-ℚ = min-Decidable-Total-Order ℚ-Decidable-Total-Order ### Associativity of `min-ℚ` ```agda - +associative-min-ℚ : (x y z : ℚ) → min-ℚ (min-ℚ x y) z = min-ℚ x (min-ℚ y z) +associative-min-ℚ = + associative-min-Decidable-Total-Order ℚ-Decidable-Total-Order ``` ### Commutativity of `min-ℚ` ```agda - +commutative-min-ℚ : (x y : ℚ) → min-ℚ x y = min-ℚ y x +commutative-min-ℚ = + commutative-min-Decidable-Total-Order ℚ-Decidable-Total-Order ``` ### `min-ℚ` is idempotent ```agda idempotent-min-ℚ : (x : ℚ) → min-ℚ x x = x +idempotent-min-ℚ = + idempotent-min-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### The minimum is a lower bound + +```agda +leq-left-min-ℚ : (x y : ℚ) → min-ℚ x y ≤-ℚ x +leq-left-min-ℚ = leq-left-min-Decidable-Total-Order ℚ-Decidable-Total-Order + +leq-right-min-ℚ : (x y : ℚ) → min-ℚ x y ≤-ℚ y +leq-right-min-ℚ = leq-right-min-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### If `z` is less than both `x` and `y`, it is less than their minimum + +```agda +le-min-le-both-ℚ : (z x y : ℚ) → le-ℚ z x → le-ℚ z y → le-ℚ z (min-ℚ x y) +le-min-le-both-ℚ z x y zImports ```agda +open import elementary-number-theory.minimum-rational-numbers open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.cartesian-product-types +open import foundation.conjunction open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.intersections-subtypes +open import foundation.logical-equivalences open import foundation.subtypes open import foundation.universe-levels open import logic.functoriality-existential-quantification +open import order-theory.posets +open import order-theory.greatest-lower-bounds-large-posets + open import real-numbers.inequality-lower-dedekind-real-numbers open import real-numbers.lower-dedekind-real-numbers ``` @@ -44,15 +52,76 @@ module _ (y : lower-ℝ l2) where - binary-min-cut-lower-ℝ : subtype (l1 ⊔ l2) ℚ - binary-min-cut-lower-ℝ = intersection-subtype (cut-lower-ℝ x) (cut-lower-ℝ y) + cut-binary-min-lower-ℝ : subtype (l1 ⊔ l2) ℚ + cut-binary-min-lower-ℝ = intersection-subtype (cut-lower-ℝ x) (cut-lower-ℝ y) + + min-inhabitants-in-binary-min-lower-ℝ : + (p q : ℚ) → (is-in-cut-lower-ℝ x p) → (is-in-cut-lower-ℝ y q) → + is-in-subtype cut-binary-min-lower-ℝ (min-ℚ p q) + min-inhabitants-in-binary-min-lower-ℝ p q p Date: Wed, 12 Feb 2025 13:43:15 -0800 Subject: [PATCH 038/119] Progress --- ...ality-lower-dedekind-real-numbers.lagda.md | 16 +++ .../lower-dedekind-real-numbers.lagda.md | 14 ++ ...ximum-lower-dedekind-real-numbers.lagda.md | 127 ++++++++++++++++++ ...nimum-lower-dedekind-real-numbers.lagda.md | 24 +++- 4 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md diff --git a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md index 26abd2fb42..cba2933eeb 100644 --- a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md @@ -20,10 +20,12 @@ open import foundation.negation open import foundation.powersets open import foundation.propositions open import foundation.subtypes +open import foundation.unit-type open import foundation.universe-levels open import order-theory.large-posets open import order-theory.large-preorders +open import order-theory.top-elements-large-posets open import real-numbers.lower-dedekind-real-numbers open import real-numbers.rational-lower-dedekind-real-numbers @@ -111,3 +113,17 @@ iff-leq-lower-real-ℚ : pr1 (iff-leq-lower-real-ℚ p q) = preserves-leq-lower-real-ℚ p q pr2 (iff-leq-lower-real-ℚ p q) = reflects-leq-lower-real-ℚ p q ``` + +### Infinity is the top element of the large poset of lower reals + +```agda +is-top-element-∞-lower-ℝ : + is-top-element-Large-Poset lower-ℝ-Large-Poset ∞-lower-ℝ +is-top-element-∞-lower-ℝ x q _ = star + +has-top-element-lower-ℝ : + has-top-element-Large-Poset lower-ℝ-Large-Poset +top-has-top-element-Large-Poset has-top-element-lower-ℝ = ∞-lower-ℝ +is-top-element-top-has-top-element-Large-Poset has-top-element-lower-ℝ = + is-top-element-∞-lower-ℝ +``` diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index db4cf96ad6..b778d77cdc 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -7,7 +7,9 @@ module real-numbers.lower-dedekind-real-numbers where
Imports ```agda +open import elementary-number-theory.addition-rational-numbers open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers @@ -25,6 +27,7 @@ open import foundation.subtypes open import foundation.transport-along-identifications open import foundation.truncated-types open import foundation.truncation-levels +open import foundation.unit-type open import foundation.universal-quantification open import foundation.universe-levels ``` @@ -96,6 +99,17 @@ module _ ## Properties +### There is a largest lower Dedekind real, whose cut is all rational numbers + +```agda +∞-lower-ℝ : lower-ℝ lzero +pr1 ∞-lower-ℝ _ = unit-Prop +pr1 (pr2 ∞-lower-ℝ) = intro-exists zero-ℚ star +pr1 (pr2 (pr2 ∞-lower-ℝ) q) _ = + intro-exists (q +ℚ one-ℚ) (le-right-add-rational-ℚ⁺ q one-ℚ⁺ , star) +pr2 (pr2 (pr2 ∞-lower-ℝ) q) _ = star +``` + ### The lower Dedekind reals form a set ```agda diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md new file mode 100644 index 0000000000..c5f327b763 --- /dev/null +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -0,0 +1,127 @@ +# The minimum of lower Dedekind real numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module real-numbers.minimum-lower-dedekind-real-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.minimum-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.cartesian-product-types +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.existential-quantification +open import foundation.intersections-subtypes +open import foundation.logical-equivalences +open import foundation.subtypes +open import foundation.universe-levels + +open import logic.functoriality-existential-quantification + +open import order-theory.large-meet-semilattices +open import order-theory.greatest-lower-bounds-large-posets + +open import real-numbers.inequality-lower-dedekind-real-numbers +open import real-numbers.lower-dedekind-real-numbers +``` + +
+ +## Idea + +The minimum of two +[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers) `x`, `y` +is a lower Dedekind real number with cut equal to the intersection of the cuts +of `x` and `y`. + +The minimum of a family of lower Dedekind real numbers is not always a lower +Dedekind real number. + +## Definition + +```agda +module _ + {l1 l2 : Level} + (x : lower-ℝ l1) + (y : lower-ℝ l2) + where + + cut-binary-min-lower-ℝ : subtype (l1 ⊔ l2) ℚ + cut-binary-min-lower-ℝ = intersection-subtype (cut-lower-ℝ x) (cut-lower-ℝ y) + + min-inhabitants-in-binary-min-lower-ℝ : + (p q : ℚ) → (is-in-cut-lower-ℝ x p) → (is-in-cut-lower-ℝ y q) → + is-in-subtype cut-binary-min-lower-ℝ (min-ℚ p q) + min-inhabitants-in-binary-min-lower-ℝ p q p Date: Wed, 12 Feb 2025 14:49:49 -0800 Subject: [PATCH 039/119] Progress --- ...ximum-lower-dedekind-real-numbers.lagda.md | 211 +++++++++++------- ...nimum-lower-dedekind-real-numbers.lagda.md | 17 +- 2 files changed, 140 insertions(+), 88 deletions(-) diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md index c5f327b763..97f147266c 100644 --- a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -1,31 +1,36 @@ -# The minimum of lower Dedekind real numbers +# The maximum of lower Dedekind real numbers ```agda {-# OPTIONS --lossy-unification #-} -module real-numbers.minimum-lower-dedekind-real-numbers where +module real-numbers.maximum-lower-dedekind-real-numbers where ```
Imports ```agda -open import elementary-number-theory.minimum-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers -open import foundation.cartesian-product-types open import foundation.conjunction -open import foundation.dependent-pair-types +open import foundation.disjunction open import foundation.existential-quantification -open import foundation.intersections-subtypes +open import foundation.dependent-pair-types +open import foundation.inhabited-types +open import foundation.function-types open import foundation.logical-equivalences -open import foundation.subtypes +open import foundation.propositional-truncations open import foundation.universe-levels +open import foundation.subtypes +open import foundation.powersets +open import foundation.unions-subtypes open import logic.functoriality-existential-quantification -open import order-theory.large-meet-semilattices -open import order-theory.greatest-lower-bounds-large-posets +open import foundation.functoriality-cartesian-product-types +open import order-theory.large-suplattices +open import order-theory.upper-bounds-large-posets +open import order-theory.least-upper-bounds-large-posets open import real-numbers.inequality-lower-dedekind-real-numbers open import real-numbers.lower-dedekind-real-numbers @@ -35,16 +40,17 @@ open import real-numbers.lower-dedekind-real-numbers ## Idea -The minimum of two +The maximum of two [lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers) `x`, `y` -is a lower Dedekind real number with cut equal to the intersection of the cuts -of `x` and `y`. - -The minimum of a family of lower Dedekind real numbers is not always a lower -Dedekind real number. +is a lower Dedekind real number with cut equal to the union of the cuts +of `x` and `y`. Unlike the case for the minimum of Dedekind real numbers, +the maximum of any inhabited family of lower Dedekind real numbers is itself +a lower Dedekind real number. ## Definition +### Binary maximum + ```agda module _ {l1 l2 : Level} @@ -52,76 +58,129 @@ module _ (y : lower-ℝ l2) where - cut-binary-min-lower-ℝ : subtype (l1 ⊔ l2) ℚ - cut-binary-min-lower-ℝ = intersection-subtype (cut-lower-ℝ x) (cut-lower-ℝ y) - - min-inhabitants-in-binary-min-lower-ℝ : - (p q : ℚ) → (is-in-cut-lower-ℝ x p) → (is-in-cut-lower-ℝ y q) → - is-in-subtype cut-binary-min-lower-ℝ (min-ℚ p q) - min-inhabitants-in-binary-min-lower-ℝ p q p Date: Wed, 12 Feb 2025 18:55:41 -0800 Subject: [PATCH 040/119] max-lower-R --- .../least-upper-bounds-large-posets.lagda.md | 71 ++++++++++++++++++- .../lower-bounds-large-posets.lagda.md | 9 ++- .../upper-bounds-large-posets.lagda.md | 23 +++++- ...ximum-lower-dedekind-real-numbers.lagda.md | 46 +++++++++++- 4 files changed, 141 insertions(+), 8 deletions(-) diff --git a/src/order-theory/least-upper-bounds-large-posets.lagda.md b/src/order-theory/least-upper-bounds-large-posets.lagda.md index e3ebbe37f5..75fbc4db1f 100644 --- a/src/order-theory/least-upper-bounds-large-posets.lagda.md +++ b/src/order-theory/least-upper-bounds-large-posets.lagda.md @@ -22,18 +22,44 @@ open import order-theory.upper-bounds-large-posets ## Idea -A **least upper bound** of a family of elements `a : I → P` in a +A **binary least upper bound** on a pair of elements `a`, `b` in a [large poset](order-theory.large-posets.md) `P` is an element `x` in `P` such that the [logical equivalence](foundation.logical-equivalences.md) +```text + is-binary-upper-bound-Large-Poset P a b y ↔ (x ≤ y) +``` + +holds for every `y` in `P`. + +Similarly, a least upper bound of a family of elements `a : I → P` in a +large poset `P` is an element `x` in `P` such +that the logical equivalence + ```text is-upper-bound-family-of-elements-Large-Poset P a y ↔ (x ≤ y) ``` -holds for every element in `P`. +holds for every `y` in `P`. ## Definitions +### The predicate on large posets of being a least binary upper bound of a pair of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) + where + + is-least-binary-upper-bound-Large-Poset : + {l3 : Level} (x : type-Large-Poset P l3) → UUω + is-least-binary-upper-bound-Large-Poset x = + {l4 : Level} (y : type-Large-Poset P l4) → + is-binary-upper-bound-Large-Poset P a b y ↔ leq-Large-Poset P x y +``` + ### The predicate on large posets of being a least upper bound of a family of elements ```agda @@ -84,6 +110,45 @@ module _ ## Properties +### Binary least upper bounds are upper bounds + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) + where + + is-binary-upper-bound-is-least-binary-upper-bound-Large-Poset : + {l3 : Level} {y : type-Large-Poset P l3} → + is-least-binary-upper-bound-Large-Poset P a b y → + is-binary-upper-bound-Large-Poset P a b y + is-binary-upper-bound-is-least-binary-upper-bound-Large-Poset H = + backward-implication (H _) (refl-leq-Large-Poset P _) +``` + +### Binary least upper bounds are unique up to similarity of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) + where + + sim-is-least-binary-upper-bound-Large-Poset : + {l3 l4 : Level} {x : type-Large-Poset P l3} {y : type-Large-Poset P l4} → + is-least-binary-upper-bound-Large-Poset P a b x → + is-least-binary-upper-bound-Large-Poset P a b y → + sim-Large-Poset P x y + pr1 (sim-is-least-binary-upper-bound-Large-Poset H K) = + forward-implication (H _) + ( backward-implication (K _) (refl-leq-Large-Poset P _)) + pr2 (sim-is-least-binary-upper-bound-Large-Poset H K) = + forward-implication (K _) + ( backward-implication (H _) (refl-leq-Large-Poset P _)) +``` + ### Least upper bounds of families of elements are upper bounds ```agda @@ -101,7 +166,7 @@ module _ backward-implication (H _) (refl-leq-Large-Poset P _) ``` -### Least upper bounds of families of elements are unique up to similairity of elements +### Least upper bounds of families of elements are unique up to similarity of elements ```agda module _ diff --git a/src/order-theory/lower-bounds-large-posets.lagda.md b/src/order-theory/lower-bounds-large-posets.lagda.md index eaae717e83..aded2bda6d 100644 --- a/src/order-theory/lower-bounds-large-posets.lagda.md +++ b/src/order-theory/lower-bounds-large-posets.lagda.md @@ -8,7 +8,9 @@ module order-theory.lower-bounds-large-posets where ```agda open import foundation.cartesian-product-types +open import foundation.conjunction open import foundation.dependent-pair-types +open import foundation.propositions open import foundation.logical-equivalences open import foundation.universe-levels @@ -35,10 +37,15 @@ module _ {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) where + is-binary-lower-bound-prop-Large-Poset : + {l3 : Level} → type-Large-Poset P l3 → Prop (β l3 l1 ⊔ β l3 l2) + is-binary-lower-bound-prop-Large-Poset x = + leq-prop-Large-Poset P x a ∧ leq-prop-Large-Poset P x b + is-binary-lower-bound-Large-Poset : {l3 : Level} → type-Large-Poset P l3 → UU (β l3 l1 ⊔ β l3 l2) is-binary-lower-bound-Large-Poset x = - leq-Large-Poset P x a × leq-Large-Poset P x b + type-Prop (is-binary-lower-bound-prop-Large-Poset x) ``` ## Properties diff --git a/src/order-theory/upper-bounds-large-posets.lagda.md b/src/order-theory/upper-bounds-large-posets.lagda.md index 02978df689..4c17a5d0e8 100644 --- a/src/order-theory/upper-bounds-large-posets.lagda.md +++ b/src/order-theory/upper-bounds-large-posets.lagda.md @@ -7,6 +7,7 @@ module order-theory.upper-bounds-large-posets where
Imports ```agda +open import foundation.conjunction open import foundation.dependent-pair-types open import foundation.logical-equivalences open import foundation.propositions @@ -20,13 +21,33 @@ open import order-theory.large-posets ## Idea -A **binary upper bound** of two elements `a` and `b` of a large poset `P` is an +A **binary upper bound** of two elements `a` and `b` of a [large poset](order-theory.large-posets.md) `P` is an element `x` of `P` such that `a ≤ x` and `b ≤ x` both hold. Similarly, an **upper bound** of a family `a : I → P` of elements of `P` is an element `x` of `P` such that the inequality `(a i) ≤ x` holds for every `i : I`. ## Definitions +### The predicate of being an upper bound of a pair of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) + where + + is-binary-upper-bound-prop-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → Prop (β l1 l3 ⊔ β l2 l3) + is-binary-upper-bound-prop-Large-Poset y = + leq-prop-Large-Poset P a y ∧ leq-prop-Large-Poset P b y + + is-binary-upper-bound-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → UU (β l1 l3 ⊔ β l2 l3) + is-binary-upper-bound-Large-Poset y = + type-Prop (is-binary-upper-bound-prop-Large-Poset y) +``` + ### The predicate of being an upper bound of a family of elements ```agda diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md index 97f147266c..f4f9fd81d4 100644 --- a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -43,9 +43,9 @@ open import real-numbers.lower-dedekind-real-numbers The maximum of two [lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers) `x`, `y` is a lower Dedekind real number with cut equal to the union of the cuts -of `x` and `y`. Unlike the case for the minimum of Dedekind real numbers, -the maximum of any inhabited family of lower Dedekind real numbers is itself -a lower Dedekind real number. +of `x` and `y`. Unlike the case for the [minimum of lower Dedekind real numbers](real-numbers.minimum-lower-dedekind-real-numbers.md), +the maximum of any inhabited family of lower Dedekind real numbers, +the lower Dedekind real number by taking the union of the cuts of every element of the family, is also a lower Dedekind real number. ## Definition @@ -163,6 +163,46 @@ module _ ## Properties +### The maximum of two lower reals is a least upper bound + +```agda +module _ + {l1 l2 : Level} + (x : lower-ℝ l1) + (y : lower-ℝ l2) + where + + is-least-binary-upper-bound-binary-max-lower-ℝ : + is-least-binary-upper-bound-Large-Poset + ( lower-ℝ-Large-Poset) + ( x) + ( y) + ( binary-max-lower-ℝ x y) + pr1 (is-least-binary-upper-bound-binary-max-lower-ℝ z) (x≤z , y≤z) p = + elim-disjunction (cut-lower-ℝ z p) (x≤z p) (y≤z p) + pr1 (pr2 (is-least-binary-upper-bound-binary-max-lower-ℝ z) max≤z) p p Date: Wed, 12 Feb 2025 18:58:09 -0800 Subject: [PATCH 041/119] make pre-commit --- src/elementary-number-theory.lagda.md | 2 ++ .../least-upper-bounds-large-posets.lagda.md | 5 ++--- .../lower-bounds-large-posets.lagda.md | 2 +- .../upper-bounds-large-posets.lagda.md | 9 ++++---- src/real-numbers.lagda.md | 2 ++ ...ximum-lower-dedekind-real-numbers.lagda.md | 22 ++++++++++--------- ...nimum-lower-dedekind-real-numbers.lagda.md | 2 +- 7 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/elementary-number-theory.lagda.md b/src/elementary-number-theory.lagda.md index 8c83736e27..45493e6071 100644 --- a/src/elementary-number-theory.lagda.md +++ b/src/elementary-number-theory.lagda.md @@ -95,10 +95,12 @@ open import elementary-number-theory.kolakoski-sequence public open import elementary-number-theory.legendre-symbol public open import elementary-number-theory.lower-bounds-natural-numbers public open import elementary-number-theory.maximum-natural-numbers public +open import elementary-number-theory.maximum-rational-numbers public open import elementary-number-theory.maximum-standard-finite-types public open import elementary-number-theory.mediant-integer-fractions public open import elementary-number-theory.mersenne-primes public open import elementary-number-theory.minimum-natural-numbers public +open import elementary-number-theory.minimum-rational-numbers public open import elementary-number-theory.minimum-standard-finite-types public open import elementary-number-theory.modular-arithmetic public open import elementary-number-theory.modular-arithmetic-standard-finite-types public diff --git a/src/order-theory/least-upper-bounds-large-posets.lagda.md b/src/order-theory/least-upper-bounds-large-posets.lagda.md index 75fbc4db1f..45073fad45 100644 --- a/src/order-theory/least-upper-bounds-large-posets.lagda.md +++ b/src/order-theory/least-upper-bounds-large-posets.lagda.md @@ -32,9 +32,8 @@ that the [logical equivalence](foundation.logical-equivalences.md) holds for every `y` in `P`. -Similarly, a least upper bound of a family of elements `a : I → P` in a -large poset `P` is an element `x` in `P` such -that the logical equivalence +Similarly, a least upper bound of a family of elements `a : I → P` in a large +poset `P` is an element `x` in `P` such that the logical equivalence ```text is-upper-bound-family-of-elements-Large-Poset P a y ↔ (x ≤ y) diff --git a/src/order-theory/lower-bounds-large-posets.lagda.md b/src/order-theory/lower-bounds-large-posets.lagda.md index aded2bda6d..764d3dfe4b 100644 --- a/src/order-theory/lower-bounds-large-posets.lagda.md +++ b/src/order-theory/lower-bounds-large-posets.lagda.md @@ -10,8 +10,8 @@ module order-theory.lower-bounds-large-posets where open import foundation.cartesian-product-types open import foundation.conjunction open import foundation.dependent-pair-types -open import foundation.propositions open import foundation.logical-equivalences +open import foundation.propositions open import foundation.universe-levels open import order-theory.dependent-products-large-posets diff --git a/src/order-theory/upper-bounds-large-posets.lagda.md b/src/order-theory/upper-bounds-large-posets.lagda.md index 4c17a5d0e8..96ad72e7a1 100644 --- a/src/order-theory/upper-bounds-large-posets.lagda.md +++ b/src/order-theory/upper-bounds-large-posets.lagda.md @@ -21,10 +21,11 @@ open import order-theory.large-posets ## Idea -A **binary upper bound** of two elements `a` and `b` of a [large poset](order-theory.large-posets.md) `P` is an -element `x` of `P` such that `a ≤ x` and `b ≤ x` both hold. Similarly, an -**upper bound** of a family `a : I → P` of elements of `P` is an element `x` of -`P` such that the inequality `(a i) ≤ x` holds for every `i : I`. +A **binary upper bound** of two elements `a` and `b` of a +[large poset](order-theory.large-posets.md) `P` is an element `x` of `P` such +that `a ≤ x` and `b ≤ x` both hold. Similarly, an **upper bound** of a family +`a : I → P` of elements of `P` is an element `x` of `P` such that the inequality +`(a i) ≤ x` holds for every `i : I`. ## Definitions diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 1cd86ceaa3..2376f2a50c 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -11,7 +11,9 @@ open import real-numbers.inequality-lower-dedekind-real-numbers public open import real-numbers.inequality-real-numbers public open import real-numbers.inequality-upper-dedekind-real-numbers public open import real-numbers.lower-dedekind-real-numbers public +open import real-numbers.maximum-lower-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public +open import real-numbers.minimum-lower-dedekind-real-numbers public open import real-numbers.negation-lower-upper-dedekind-real-numbers public open import real-numbers.negation-real-numbers public open import real-numbers.rational-lower-dedekind-real-numbers public diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md index f4f9fd81d4..85b60f332a 100644 --- a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -13,24 +13,24 @@ open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.conjunction +open import foundation.dependent-pair-types open import foundation.disjunction open import foundation.existential-quantification -open import foundation.dependent-pair-types -open import foundation.inhabited-types open import foundation.function-types +open import foundation.functoriality-cartesian-product-types +open import foundation.inhabited-types open import foundation.logical-equivalences +open import foundation.powersets open import foundation.propositional-truncations -open import foundation.universe-levels open import foundation.subtypes -open import foundation.powersets open import foundation.unions-subtypes +open import foundation.universe-levels open import logic.functoriality-existential-quantification -open import foundation.functoriality-cartesian-product-types open import order-theory.large-suplattices -open import order-theory.upper-bounds-large-posets open import order-theory.least-upper-bounds-large-posets +open import order-theory.upper-bounds-large-posets open import real-numbers.inequality-lower-dedekind-real-numbers open import real-numbers.lower-dedekind-real-numbers @@ -42,10 +42,12 @@ open import real-numbers.lower-dedekind-real-numbers The maximum of two [lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers) `x`, `y` -is a lower Dedekind real number with cut equal to the union of the cuts -of `x` and `y`. Unlike the case for the [minimum of lower Dedekind real numbers](real-numbers.minimum-lower-dedekind-real-numbers.md), -the maximum of any inhabited family of lower Dedekind real numbers, -the lower Dedekind real number by taking the union of the cuts of every element of the family, is also a lower Dedekind real number. +is a lower Dedekind real number with cut equal to the union of the cuts of `x` +and `y`. Unlike the case for the +[minimum of lower Dedekind real numbers](real-numbers.minimum-lower-dedekind-real-numbers.md), +the maximum of any inhabited family of lower Dedekind real numbers, the lower +Dedekind real number by taking the union of the cuts of every element of the +family, is also a lower Dedekind real number. ## Definition diff --git a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md index 2d433ed3cc..f5bbc158e3 100644 --- a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md @@ -24,8 +24,8 @@ open import foundation.universe-levels open import logic.functoriality-existential-quantification -open import order-theory.large-meet-semilattices open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.large-meet-semilattices open import real-numbers.inequality-lower-dedekind-real-numbers open import real-numbers.lower-dedekind-real-numbers From 8c076b181f4862190921f2dde69650d668bc6b8e Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 20:34:23 -0800 Subject: [PATCH 042/119] Progress --- .../maximum-rational-numbers.lagda.md | 34 +++ .../minimum-rational-numbers.lagda.md | 22 +- src/foundation/powersets.lagda.md | 20 ++ src/order-theory.lagda.md | 1 + ...endent-products-large-inflattices.lagda.md | 137 +++++++++ ...reatest-lower-bounds-large-posets.lagda.md | 100 +++++++ src/order-theory/large-inflattices.lagda.md | 236 +++++++++++++++ .../large-join-semilattices.lagda.md | 269 ++++++++++++++++++ .../lower-bounds-large-posets.lagda.md | 58 ++++ src/real-numbers.lagda.md | 1 + ...ality-upper-dedekind-real-numbers.lagda.md | 16 ++ .../lower-dedekind-real-numbers.lagda.md | 2 + ...ximum-lower-dedekind-real-numbers.lagda.md | 2 +- ...ximum-upper-dedekind-real-numbers.lagda.md | 145 ++++++++++ ...nimum-upper-dedekind-real-numbers.lagda.md | 228 +++++++++++++++ .../upper-dedekind-real-numbers.lagda.md | 16 ++ 16 files changed, 1272 insertions(+), 15 deletions(-) create mode 100644 src/order-theory/dependent-products-large-inflattices.lagda.md create mode 100644 src/order-theory/large-inflattices.lagda.md create mode 100644 src/order-theory/large-join-semilattices.lagda.md create mode 100644 src/real-numbers/maximum-upper-dedekind-real-numbers.lagda.md create mode 100644 src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index 81f90905dd..81cae3c227 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -10,8 +10,11 @@ module elementary-number-theory.maximum-rational-numbers where open import elementary-number-theory.decidable-total-order-rational-numbers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.coproduct-types open import foundation.identity-types +open import foundation.transport-along-identifications open import order-theory.decidable-total-orders ``` @@ -56,3 +59,34 @@ idempotent-max-ℚ : (x : ℚ) → max-ℚ x x = x idempotent-max-ℚ = idempotent-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` + +### The maximum is an upper bound + +```agda +leq-left-max-ℚ : (x y : ℚ) → x ≤-ℚ max-ℚ x y +leq-left-max-ℚ = leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order + +leq-right-max-ℚ : (x y : ℚ) → y ≤-ℚ max-ℚ x y +leq-right-max-ℚ = leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### If both `x` and `y` are less than `z`, so is their maximum + +```agda +le-max-le-both-ℚ : (z x y : ℚ) → le-ℚ x z → le-ℚ y z → le-ℚ (max-ℚ x y) z +le-max-le-both-ℚ z x y xImports + +```agda +open import foundation.large-binary-relations +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.dependent-products-large-posets +open import order-theory.large-posets +open import order-theory.large-inflattices +open import order-theory.greatest-lower-bounds-large-posets +``` + +
+ +## Idea + +Families of greatest lower bounds of families of elements in dependent products of +large posets are again greatest lower bounds. Therefore it follows that dependent +products of large inflattices are again large inflattices. + +## Definitions + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} {γ : Level} + {l1 : Level} {I : UU l1} (L : I → Large-Inflattice α β γ) + where + + large-poset-Π-Large-Inflattice : + Large-Poset (λ l2 → α l2 ⊔ l1) (λ l2 l3 → β l2 l3 ⊔ l1) + large-poset-Π-Large-Inflattice = + Π-Large-Poset (λ i → large-poset-Large-Inflattice (L i)) + + is-large-inflattice-Π-Large-Inflattice : + is-large-inflattice-Large-Poset γ large-poset-Π-Large-Inflattice + inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( is-large-inflattice-Π-Large-Inflattice {l2} {l3} {J} a) i = + inf-Large-Inflattice (L i) (λ j → a j i) + is-greatest-lower-bound-inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( is-large-inflattice-Π-Large-Inflattice {l2} {l3} {J} a) = + is-greatest-lower-bound-Π-Large-Poset + ( λ i → large-poset-Large-Inflattice (L i)) + ( a) + ( λ i → inf-Large-Inflattice (L i) (λ j → a j i)) + ( λ i → + is-greatest-lower-bound-inf-Large-Inflattice (L i) (λ j → a j i)) + + Π-Large-Inflattice : + Large-Inflattice (λ l2 → α l2 ⊔ l1) (λ l2 l3 → β l2 l3 ⊔ l1) γ + large-poset-Large-Inflattice Π-Large-Inflattice = + large-poset-Π-Large-Inflattice + is-large-inflattice-Large-Inflattice Π-Large-Inflattice = + is-large-inflattice-Π-Large-Inflattice + + set-Π-Large-Inflattice : (l : Level) → Set (α l ⊔ l1) + set-Π-Large-Inflattice = + set-Large-Inflattice Π-Large-Inflattice + + type-Π-Large-Inflattice : (l : Level) → UU (α l ⊔ l1) + type-Π-Large-Inflattice = + type-Large-Inflattice Π-Large-Inflattice + + is-set-type-Π-Large-Inflattice : + {l : Level} → is-set (type-Π-Large-Inflattice l) + is-set-type-Π-Large-Inflattice = + is-set-type-Large-Inflattice Π-Large-Inflattice + + leq-prop-Π-Large-Inflattice : + Large-Relation-Prop + ( λ l2 l3 → β l2 l3 ⊔ l1) + ( type-Π-Large-Inflattice) + leq-prop-Π-Large-Inflattice = + leq-prop-Large-Inflattice Π-Large-Inflattice + + leq-Π-Large-Inflattice : + {l2 l3 : Level} + (x : type-Π-Large-Inflattice l2) (y : type-Π-Large-Inflattice l3) → + UU (β l2 l3 ⊔ l1) + leq-Π-Large-Inflattice = + leq-Large-Inflattice Π-Large-Inflattice + + is-prop-leq-Π-Large-Inflattice : + is-prop-Large-Relation type-Π-Large-Inflattice leq-Π-Large-Inflattice + is-prop-leq-Π-Large-Inflattice = + is-prop-leq-Large-Inflattice Π-Large-Inflattice + + refl-leq-Π-Large-Inflattice : + is-reflexive-Large-Relation type-Π-Large-Inflattice leq-Π-Large-Inflattice + refl-leq-Π-Large-Inflattice = + refl-leq-Large-Inflattice Π-Large-Inflattice + + antisymmetric-leq-Π-Large-Inflattice : + is-antisymmetric-Large-Relation + ( type-Π-Large-Inflattice) + ( leq-Π-Large-Inflattice) + antisymmetric-leq-Π-Large-Inflattice = + antisymmetric-leq-Large-Inflattice Π-Large-Inflattice + + transitive-leq-Π-Large-Inflattice : + is-transitive-Large-Relation + ( type-Π-Large-Inflattice) + ( leq-Π-Large-Inflattice) + transitive-leq-Π-Large-Inflattice = + transitive-leq-Large-Inflattice Π-Large-Inflattice + + inf-Π-Large-Inflattice : + {l2 l3 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) → + type-Π-Large-Inflattice (γ ⊔ l2 ⊔ l3) + inf-Π-Large-Inflattice = + inf-Large-Inflattice Π-Large-Inflattice + + is-upper-bound-family-of-elements-Π-Large-Inflattice : + {l2 l3 l4 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) + (y : type-Π-Large-Inflattice l4) → UU (β l3 l4 ⊔ l1 ⊔ l2) + is-upper-bound-family-of-elements-Π-Large-Inflattice = + is-upper-bound-family-of-elements-Large-Inflattice Π-Large-Inflattice + + is-greatest-lower-bound-family-of-elements-Π-Large-Inflattice : + {l2 l3 l4 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) → + type-Π-Large-Inflattice l4 → UUω + is-greatest-lower-bound-family-of-elements-Π-Large-Inflattice = + is-greatest-lower-bound-family-of-elements-Large-Inflattice Π-Large-Inflattice + + is-greatest-lower-bound-inf-Π-Large-Inflattice : + {l2 l3 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) → + is-greatest-lower-bound-family-of-elements-Π-Large-Inflattice x + ( inf-Π-Large-Inflattice x) + is-greatest-lower-bound-inf-Π-Large-Inflattice = + is-greatest-lower-bound-inf-Large-Inflattice Π-Large-Inflattice +``` diff --git a/src/order-theory/greatest-lower-bounds-large-posets.lagda.md b/src/order-theory/greatest-lower-bounds-large-posets.lagda.md index 472e36eed4..8325bf5cfc 100644 --- a/src/order-theory/greatest-lower-bounds-large-posets.lagda.md +++ b/src/order-theory/greatest-lower-bounds-large-posets.lagda.md @@ -46,8 +46,73 @@ module _ is-binary-lower-bound-Large-Poset P a b y ↔ leq-Large-Poset P y x ``` +### The predicate on large posets of being a greatest lower bound of a family of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 l3 : Level} {I : UU l1} (x : I → type-Large-Poset P l2) + where + + is-greatest-lower-bound-family-of-elements-Large-Poset : + type-Large-Poset P l3 → UUω + is-greatest-lower-bound-family-of-elements-Large-Poset y = + {l4 : Level} (z : type-Large-Poset P l4) → + is-lower-bound-family-of-elements-Large-Poset P x z ↔ leq-Large-Poset P z y + + leq-is-greatest-lower-bound-family-of-elements-Large-Poset : + (y : type-Large-Poset P l3) → + is-greatest-lower-bound-family-of-elements-Large-Poset y → + {l4 : Level} (z : type-Large-Poset P l4) → + is-lower-bound-family-of-elements-Large-Poset P x z → + leq-Large-Poset P z y + leq-is-greatest-lower-bound-family-of-elements-Large-Poset y H z K = + forward-implication (H z) K +``` + +### The predicate on large posets of having a greatest lower bound of a family of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (γ : Level) + (P : Large-Poset α β) + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Poset P l2) + where + + record + has-greatest-lower-bound-family-of-elements-Large-Poset : UUω + where + field + inf-has-greatest-lower-bound-family-of-elements-Large-Poset : + type-Large-Poset P (γ ⊔ l1 ⊔ l2) + is-greatest-lower-bound-inf-has-greatest-lower-bound-family-of-elements-Large-Poset : + is-greatest-lower-bound-family-of-elements-Large-Poset P x + inf-has-greatest-lower-bound-family-of-elements-Large-Poset + + open has-greatest-lower-bound-family-of-elements-Large-Poset public +``` + ## Properties +### Binary greatest lower bounds are lower bounds + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) + where + + is-binary-lower-bound-is-greatest-binary-lower-bound-Large-Poset : + {l3 : Level} {y : type-Large-Poset P l3} → + is-greatest-binary-lower-bound-Large-Poset P a b y → + is-binary-lower-bound-Large-Poset P a b y + is-binary-lower-bound-is-greatest-binary-lower-bound-Large-Poset H = + backward-implication (H _) (refl-leq-Large-Poset P _) +``` + ### Any pointwise greatest lower bound of two elements in a dependent product of large posets is a greatest lower bound ```agda @@ -74,3 +139,38 @@ module _ ↔ leq-Π-Large-Poset P u z by iff-Π-iff-family (λ i → H i (u i)) ``` +### A family of greatest lower bounds of families of elements in a family of large poset is a greatest lower bound in their dependent product + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + {l1 : Level} {I : UU l1} (P : I → Large-Poset α β) + {l2 l3 : Level} {J : UU l2} (a : J → type-Π-Large-Poset P l3) + {l4 : Level} (x : type-Π-Large-Poset P l4) + where + + is-greatest-lower-bound-Π-Large-Poset : + ( (i : I) → + is-greatest-lower-bound-family-of-elements-Large-Poset + ( P i) + ( λ j → a j i) + ( x i)) → + is-greatest-lower-bound-family-of-elements-Large-Poset (Π-Large-Poset P) a x + is-greatest-lower-bound-Π-Large-Poset H y = + logical-equivalence-reasoning + is-lower-bound-family-of-elements-Large-Poset (Π-Large-Poset P) a y + ↔ ( (i : I) → + is-lower-bound-family-of-elements-Large-Poset + ( P i) + ( λ j → a j i) + ( y i)) + by + inv-iff + ( logical-equivalence-is-lower-bound-family-of-elements-Π-Large-Poset + ( P) + ( a) + ( y)) + ↔ leq-Π-Large-Poset P y x + by + iff-Π-iff-family (λ i → H i (y i)) +``` diff --git a/src/order-theory/large-inflattices.lagda.md b/src/order-theory/large-inflattices.lagda.md new file mode 100644 index 0000000000..a47a0ff67a --- /dev/null +++ b/src/order-theory/large-inflattices.lagda.md @@ -0,0 +1,236 @@ +# Large inflattices + +```agda +module order-theory.large-inflattices where +``` + +
Imports + +```agda +open import foundation.binary-relations +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.large-binary-relations +open import foundation.logical-equivalences +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.large-posets +open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.posets +open import order-theory.inflattices +open import order-theory.lower-bounds-large-posets +``` + +
+ +## Idea + +A **large inflattice** is a [large poset](order-theory.large-posets.md) `P` such +that for every family + +```text + x : I → type-Large-Poset P l1 +``` + +indexed by `I : UU l2` there is an element `⋁ x : type-Large-Poset P (l1 ⊔ l2)` +such that the logical equivalence + +```text + (∀ᵢ xᵢ ≤ y) ↔ ((⋁ x) ≤ y) +``` + +holds for every element `y : type-Large-Poset P l3`. + +## Definitions + +### The predicate on large posets of having least upper bounds of families of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} (γ : Level) + (P : Large-Poset α β) + where + + is-large-inflattice-Large-Poset : UUω + is-large-inflattice-Large-Poset = + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Poset P l2) → + has-greatest-lower-bound-family-of-elements-Large-Poset γ P x + + module _ + (H : is-large-inflattice-Large-Poset) + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Poset P l2) + where + + inf-is-large-inflattice-Large-Poset : type-Large-Poset P (γ ⊔ l1 ⊔ l2) + inf-is-large-inflattice-Large-Poset = + inf-has-greatest-lower-bound-family-of-elements-Large-Poset (H x) + + is-greatest-lower-bound-inf-is-large-inflattice-Large-Poset : + is-greatest-lower-bound-family-of-elements-Large-Poset P x + inf-is-large-inflattice-Large-Poset + is-greatest-lower-bound-inf-is-large-inflattice-Large-Poset = + is-greatest-lower-bound-inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( H x) +``` + +### Large inflattices + +```agda +record + Large-Inflattice + (α : Level → Level) (β : Level → Level → Level) (γ : Level) : UUω + where + constructor + make-Large-Inflattice + field + large-poset-Large-Inflattice : Large-Poset α β + is-large-inflattice-Large-Inflattice : + is-large-inflattice-Large-Poset γ large-poset-Large-Inflattice + +open Large-Inflattice public + +module _ + {α : Level → Level} {β : Level → Level → Level} {γ : Level} + (L : Large-Inflattice α β γ) + where + + set-Large-Inflattice : (l : Level) → Set (α l) + set-Large-Inflattice = set-Large-Poset (large-poset-Large-Inflattice L) + + type-Large-Inflattice : (l : Level) → UU (α l) + type-Large-Inflattice = type-Large-Poset (large-poset-Large-Inflattice L) + + is-set-type-Large-Inflattice : {l : Level} → is-set (type-Large-Inflattice l) + is-set-type-Large-Inflattice = + is-set-type-Large-Poset (large-poset-Large-Inflattice L) + + leq-prop-Large-Inflattice : + Large-Relation-Prop β type-Large-Inflattice + leq-prop-Large-Inflattice = + leq-prop-Large-Poset (large-poset-Large-Inflattice L) + + leq-Large-Inflattice : + Large-Relation β type-Large-Inflattice + leq-Large-Inflattice = leq-Large-Poset (large-poset-Large-Inflattice L) + + is-prop-leq-Large-Inflattice : + is-prop-Large-Relation type-Large-Inflattice leq-Large-Inflattice + is-prop-leq-Large-Inflattice = + is-prop-leq-Large-Poset (large-poset-Large-Inflattice L) + + refl-leq-Large-Inflattice : + is-reflexive-Large-Relation type-Large-Inflattice leq-Large-Inflattice + refl-leq-Large-Inflattice = + refl-leq-Large-Poset (large-poset-Large-Inflattice L) + + antisymmetric-leq-Large-Inflattice : + is-antisymmetric-Large-Relation type-Large-Inflattice leq-Large-Inflattice + antisymmetric-leq-Large-Inflattice = + antisymmetric-leq-Large-Poset (large-poset-Large-Inflattice L) + + transitive-leq-Large-Inflattice : + is-transitive-Large-Relation type-Large-Inflattice leq-Large-Inflattice + transitive-leq-Large-Inflattice = + transitive-leq-Large-Poset (large-poset-Large-Inflattice L) + + inf-Large-Inflattice : + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) → + type-Large-Inflattice (γ ⊔ l1 ⊔ l2) + inf-Large-Inflattice x = + inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( is-large-inflattice-Large-Inflattice L x) + + is-lower-bound-family-of-elements-Large-Inflattice : + {l1 l2 l3 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) + (y : type-Large-Inflattice l3) → UU (β l3 l2 ⊔ l1) + is-lower-bound-family-of-elements-Large-Inflattice x y = + is-lower-bound-family-of-elements-Large-Poset + ( large-poset-Large-Inflattice L) + ( x) + ( y) + + is-greatest-lower-bound-family-of-elements-Large-Inflattice : + {l1 l2 l3 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) → + type-Large-Inflattice l3 → UUω + is-greatest-lower-bound-family-of-elements-Large-Inflattice = + is-greatest-lower-bound-family-of-elements-Large-Poset + ( large-poset-Large-Inflattice L) + + is-greatest-lower-bound-inf-Large-Inflattice : + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) → + is-greatest-lower-bound-family-of-elements-Large-Inflattice x + ( inf-Large-Inflattice x) + is-greatest-lower-bound-inf-Large-Inflattice x = + is-greatest-lower-bound-inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( is-large-inflattice-Large-Inflattice L x) + + is-lower-bound-inf-Large-Inflattice : + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) → + is-lower-bound-family-of-elements-Large-Inflattice x + ( inf-Large-Inflattice x) + is-lower-bound-inf-Large-Inflattice x = + backward-implication + ( is-greatest-lower-bound-inf-Large-Inflattice x (inf-Large-Inflattice x)) + ( refl-leq-Large-Inflattice (inf-Large-Inflattice x)) +``` + +## Properties + +### The operation `inf` is order preserving + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} {γ : Level} + (L : Large-Inflattice α β γ) + where + + preserves-order-inf-Large-Inflattice : + {l1 l2 l3 : Level} {I : UU l1} + {x : I → type-Large-Inflattice L l2} + {y : I → type-Large-Inflattice L l3} → + ((i : I) → leq-Large-Inflattice L (y i) (x i)) → + leq-Large-Inflattice L + ( inf-Large-Inflattice L y) + ( inf-Large-Inflattice L x) + preserves-order-inf-Large-Inflattice {x = x} {y} H = + forward-implication + ( is-greatest-lower-bound-inf-Large-Inflattice L x + ( inf-Large-Inflattice L y)) + ( λ i → + transitive-leq-Large-Inflattice L + ( inf-Large-Inflattice L y) + ( y i) + ( x i) + ( H i) + ( is-lower-bound-inf-Large-Inflattice L y i)) +``` + +### Small inflattices from large inflattices + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} {γ : Level} + (L : Large-Inflattice α β γ) + where + + poset-Large-Inflattice : (l : Level) → Poset (α l) (β l l) + poset-Large-Inflattice = poset-Large-Poset (large-poset-Large-Inflattice L) + + is-inflattice-poset-Large-Inflattice : + (l1 l2 : Level) → + is-inflattice-Poset l1 (poset-Large-Inflattice (γ ⊔ l1 ⊔ l2)) + pr1 (is-inflattice-poset-Large-Inflattice l1 l2 I f) = + inf-Large-Inflattice L f + pr2 (is-inflattice-poset-Large-Inflattice l1 l2 I f) = + is-greatest-lower-bound-inf-Large-Inflattice L f + + inflattice-Large-Inflattice : + (l1 l2 : Level) → + Inflattice (α (γ ⊔ l1 ⊔ l2)) (β (γ ⊔ l1 ⊔ l2) (γ ⊔ l1 ⊔ l2)) l1 + pr1 (inflattice-Large-Inflattice l1 l2) = + poset-Large-Inflattice (γ ⊔ l1 ⊔ l2) + pr2 (inflattice-Large-Inflattice l1 l2) = + is-inflattice-poset-Large-Inflattice l1 l2 +``` diff --git a/src/order-theory/large-join-semilattices.lagda.md b/src/order-theory/large-join-semilattices.lagda.md new file mode 100644 index 0000000000..7c5f497c66 --- /dev/null +++ b/src/order-theory/large-join-semilattices.lagda.md @@ -0,0 +1,269 @@ +# Large join-semilattices + +```agda +module order-theory.large-join-semilattices where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-binary-functions +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.large-binary-relations +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.bottom-elements-large-posets +open import order-theory.join-semilattices +open import order-theory.large-posets +open import order-theory.least-upper-bounds-large-posets +open import order-theory.posets +``` + +
+ +## Idea + +A **large join-semilattice** is a [large poset](order-theory.large-posets.md) in +which every pair of elements has a +[least binary upper bound](order-theory.least-upper-bounds-large-posets.md). + +## Definition + +### The predicate that a large poset has joins + +```agda +record + has-joins-Large-Poset + { α : Level → Level} + { β : Level → Level → Level} + ( P : Large-Poset α β) : + UUω + where + constructor + make-has-joins-Large-Poset + field + join-has-joins-Large-Poset : + {l1 l2 : Level} + (x : type-Large-Poset P l1) (y : type-Large-Poset P l2) → + type-Large-Poset P (l1 ⊔ l2) + is-least-binary-upper-bound-join-has-joins-Large-Poset : + {l1 l2 : Level} + (x : type-Large-Poset P l1) (y : type-Large-Poset P l2) → + is-least-binary-upper-bound-Large-Poset P x y + ( join-has-joins-Large-Poset x y) + +open has-joins-Large-Poset public +``` + +### The predicate of being a large join-semilattice + +```agda +record + is-large-join-semilattice-Large-Poset + { α : Level → Level} + { β : Level → Level → Level} + ( P : Large-Poset α β) : + UUω + where + field + has-joins-is-large-join-semilattice-Large-Poset : + has-joins-Large-Poset P + has-bottom-element-is-large-join-semilattice-Large-Poset : + has-bottom-element-Large-Poset P + +open is-large-join-semilattice-Large-Poset public + +module _ + {α : Level → Level} + {β : Level → Level → Level} + (P : Large-Poset α β) + (H : is-large-join-semilattice-Large-Poset P) + where + + join-is-large-join-semilattice-Large-Poset : + {l1 l2 : Level} (x : type-Large-Poset P l1) (y : type-Large-Poset P l2) → + type-Large-Poset P (l1 ⊔ l2) + join-is-large-join-semilattice-Large-Poset = + join-has-joins-Large-Poset + ( has-joins-is-large-join-semilattice-Large-Poset H) + + is-least-binary-upper-bound-join-is-large-join-semilattice-Large-Poset : + {l1 l2 : Level} (x : type-Large-Poset P l1) (y : type-Large-Poset P l2) → + is-least-binary-upper-bound-Large-Poset P x y + ( join-is-large-join-semilattice-Large-Poset x y) + is-least-binary-upper-bound-join-is-large-join-semilattice-Large-Poset = + is-least-binary-upper-bound-join-has-joins-Large-Poset + ( has-joins-is-large-join-semilattice-Large-Poset H) + + bottom-is-large-join-semilattice-Large-Poset : + type-Large-Poset P lzero + bottom-is-large-join-semilattice-Large-Poset = + bottom-has-bottom-element-Large-Poset + ( has-bottom-element-is-large-join-semilattice-Large-Poset H) + + is-bottom-element-bottom-is-large-join-semilattice-Large-Poset : + {l1 : Level} (x : type-Large-Poset P l1) → + leq-Large-Poset P bottom-is-large-join-semilattice-Large-Poset x + is-bottom-element-bottom-is-large-join-semilattice-Large-Poset = + is-bottom-element-bottom-has-bottom-element-Large-Poset + ( has-bottom-element-is-large-join-semilattice-Large-Poset H) +``` + +### Large join-semilattices + +```agda +record + Large-Join-Semilattice + ( α : Level → Level) + ( β : Level → Level → Level) : + UUω + where + constructor + make-Large-Join-Semilattice + field + large-poset-Large-Join-Semilattice : + Large-Poset α β + is-large-join-semilattice-Large-Join-Semilattice : + is-large-join-semilattice-Large-Poset + large-poset-Large-Join-Semilattice + +open Large-Join-Semilattice public + +module _ + {α : Level → Level} {β : Level → Level → Level} + (L : Large-Join-Semilattice α β) + where + + type-Large-Join-Semilattice : (l : Level) → UU (α l) + type-Large-Join-Semilattice = + type-Large-Poset (large-poset-Large-Join-Semilattice L) + + set-Large-Join-Semilattice : (l : Level) → Set (α l) + set-Large-Join-Semilattice = + set-Large-Poset (large-poset-Large-Join-Semilattice L) + + is-set-type-Large-Join-Semilattice : + {l : Level} → is-set (type-Large-Join-Semilattice l) + is-set-type-Large-Join-Semilattice = + is-set-type-Large-Poset (large-poset-Large-Join-Semilattice L) + + leq-Large-Join-Semilattice : Large-Relation β type-Large-Join-Semilattice + leq-Large-Join-Semilattice = + leq-Large-Poset (large-poset-Large-Join-Semilattice L) + + refl-leq-Large-Join-Semilattice : + is-reflexive-Large-Relation + ( type-Large-Join-Semilattice) + ( leq-Large-Join-Semilattice) + refl-leq-Large-Join-Semilattice = + refl-leq-Large-Poset (large-poset-Large-Join-Semilattice L) + + antisymmetric-leq-Large-Join-Semilattice : + is-antisymmetric-Large-Relation + ( type-Large-Join-Semilattice) + ( leq-Large-Join-Semilattice) + antisymmetric-leq-Large-Join-Semilattice = + antisymmetric-leq-Large-Poset (large-poset-Large-Join-Semilattice L) + + transitive-leq-Large-Join-Semilattice : + is-transitive-Large-Relation + ( type-Large-Join-Semilattice) + ( leq-Large-Join-Semilattice) + transitive-leq-Large-Join-Semilattice = + transitive-leq-Large-Poset (large-poset-Large-Join-Semilattice L) + + has-joins-Large-Join-Semilattice : + has-joins-Large-Poset (large-poset-Large-Join-Semilattice L) + has-joins-Large-Join-Semilattice = + has-joins-is-large-join-semilattice-Large-Poset + ( is-large-join-semilattice-Large-Join-Semilattice L) + + join-Large-Join-Semilattice : + {l1 l2 : Level} + (x : type-Large-Join-Semilattice l1) + (y : type-Large-Join-Semilattice l2) → + type-Large-Join-Semilattice (l1 ⊔ l2) + join-Large-Join-Semilattice = + join-is-large-join-semilattice-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( is-large-join-semilattice-Large-Join-Semilattice L) + + is-least-binary-upper-bound-join-Large-Join-Semilattice : + {l1 l2 : Level} + (x : type-Large-Join-Semilattice l1) + (y : type-Large-Join-Semilattice l2) → + is-least-binary-upper-bound-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( x) + ( y) + ( join-Large-Join-Semilattice x y) + is-least-binary-upper-bound-join-Large-Join-Semilattice = + is-least-binary-upper-bound-join-is-large-join-semilattice-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( is-large-join-semilattice-Large-Join-Semilattice L) + + ap-join-Large-Join-Semilattice : + {l1 l2 : Level} + {x x' : type-Large-Join-Semilattice l1} + {y y' : type-Large-Join-Semilattice l2} → + (x = x') → (y = y') → + join-Large-Join-Semilattice x y = join-Large-Join-Semilattice x' y' + ap-join-Large-Join-Semilattice p q = + ap-binary join-Large-Join-Semilattice p q + + has-bottom-element-Large-Join-Semilattice : + has-bottom-element-Large-Poset (large-poset-Large-Join-Semilattice L) + has-bottom-element-Large-Join-Semilattice = + has-bottom-element-is-large-join-semilattice-Large-Poset + ( is-large-join-semilattice-Large-Join-Semilattice L) + + bottom-Large-Join-Semilattice : + type-Large-Join-Semilattice lzero + bottom-Large-Join-Semilattice = + bottom-is-large-join-semilattice-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( is-large-join-semilattice-Large-Join-Semilattice L) + + is-bottom-element-bottom-Large-Join-Semilattice : + {l1 : Level} (x : type-Large-Join-Semilattice l1) → + leq-Large-Join-Semilattice bottom-Large-Join-Semilattice x + is-bottom-element-bottom-Large-Join-Semilattice = + is-bottom-element-bottom-is-large-join-semilattice-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( is-large-join-semilattice-Large-Join-Semilattice L) +``` + +### Small join semilattices from large join semilattices + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (L : Large-Join-Semilattice α β) + where + + poset-Large-Join-Semilattice : (l : Level) → Poset (α l) (β l l) + poset-Large-Join-Semilattice = + poset-Large-Poset (large-poset-Large-Join-Semilattice L) + + is-join-semilattice-poset-Large-Join-Semilattice : + {l : Level} → is-join-semilattice-Poset (poset-Large-Join-Semilattice l) + pr1 (is-join-semilattice-poset-Large-Join-Semilattice x y) = + join-Large-Join-Semilattice L x y + pr2 (is-join-semilattice-poset-Large-Join-Semilattice x y) = + is-least-binary-upper-bound-join-Large-Join-Semilattice L x y + + order-theoretic-join-semilattice-Large-Join-Semilattice : + (l : Level) → Order-Theoretic-Join-Semilattice (α l) (β l l) + pr1 (order-theoretic-join-semilattice-Large-Join-Semilattice l) = + poset-Large-Join-Semilattice l + pr2 (order-theoretic-join-semilattice-Large-Join-Semilattice l) = + is-join-semilattice-poset-Large-Join-Semilattice + + join-semilattice-Large-Join-Semilattice : + (l : Level) → Join-Semilattice (α l) + join-semilattice-Large-Join-Semilattice l = + join-semilattice-Order-Theoretic-Join-Semilattice + ( order-theoretic-join-semilattice-Large-Join-Semilattice l) +``` diff --git a/src/order-theory/lower-bounds-large-posets.lagda.md b/src/order-theory/lower-bounds-large-posets.lagda.md index 764d3dfe4b..3bfd16b67e 100644 --- a/src/order-theory/lower-bounds-large-posets.lagda.md +++ b/src/order-theory/lower-bounds-large-posets.lagda.md @@ -48,6 +48,32 @@ module _ type-Prop (is-binary-lower-bound-prop-Large-Poset x) ``` +### The predicate of being a lower bound of a family of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Poset P l2) + where + + is-lower-bound-prop-family-of-elements-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → Prop (β l3 l2 ⊔ l1) + is-lower-bound-prop-family-of-elements-Large-Poset y = + Π-Prop I (λ i → leq-prop-Large-Poset P y (x i)) + + is-lower-bound-family-of-elements-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → UU (β l3 l2 ⊔ l1) + is-lower-bound-family-of-elements-Large-Poset y = + type-Prop (is-lower-bound-prop-family-of-elements-Large-Poset y) + + is-prop-is-lower-bound-family-of-elements-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → + is-prop (is-lower-bound-family-of-elements-Large-Poset y) + is-prop-is-lower-bound-family-of-elements-Large-Poset y = + is-prop-type-Prop (is-lower-bound-prop-family-of-elements-Large-Poset y) +``` + ## Properties ### An element of a dependent product of large posets is a binary lower bound of two elements if and only if it is a pointwise binary lower bound @@ -84,3 +110,35 @@ module _ pr2 (logical-equivalence-is-binary-lower-bound-Π-Large-Poset z) = is-binary-lower-bound-is-binary-lower-bound-Π-Large-Poset z ``` + +### An element `x : Π-Large-Poset P` of a dependent product of large posets `P i` indexed by `i : I` is a lower bound of a family `a : J → Π-Large-Poset P` if and only if `x i` is a lower bound of the family `(j ↦ a j i) : J → P i` of elements of `P i` + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + {l1 : Level} {I : UU l1} (P : I → Large-Poset α β) + {l2 l3 : Level} {J : UU l2} (a : J → type-Π-Large-Poset P l3) + {l4 : Level} (x : type-Π-Large-Poset P l4) + where + + is-lower-bound-family-of-elements-Π-Large-Poset : + ( (i : I) → + is-lower-bound-family-of-elements-Large-Poset (P i) (λ j → a j i) (x i)) → + is-lower-bound-family-of-elements-Large-Poset (Π-Large-Poset P) a x + is-lower-bound-family-of-elements-Π-Large-Poset H j i = H i j + + map-inv-is-lower-bound-family-of-elements-Π-Large-Poset : + is-lower-bound-family-of-elements-Large-Poset (Π-Large-Poset P) a x → + (i : I) → + is-lower-bound-family-of-elements-Large-Poset (P i) (λ j → a j i) (x i) + map-inv-is-lower-bound-family-of-elements-Π-Large-Poset H i j = H j i + + logical-equivalence-is-lower-bound-family-of-elements-Π-Large-Poset : + ( (i : I) → + is-lower-bound-family-of-elements-Large-Poset (P i) (λ j → a j i) (x i)) ↔ + is-lower-bound-family-of-elements-Large-Poset (Π-Large-Poset P) a x + pr1 logical-equivalence-is-lower-bound-family-of-elements-Π-Large-Poset = + is-lower-bound-family-of-elements-Π-Large-Poset + pr2 logical-equivalence-is-lower-bound-family-of-elements-Π-Large-Poset = + map-inv-is-lower-bound-family-of-elements-Π-Large-Poset +``` diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 2376f2a50c..6ce425f9d2 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -12,6 +12,7 @@ open import real-numbers.inequality-real-numbers public open import real-numbers.inequality-upper-dedekind-real-numbers public open import real-numbers.lower-dedekind-real-numbers public open import real-numbers.maximum-lower-dedekind-real-numbers public +open import real-numbers.maximum-upper-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public open import real-numbers.minimum-lower-dedekind-real-numbers public open import real-numbers.negation-lower-upper-dedekind-real-numbers public diff --git a/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md index 45cdddb26d..10cda8bb26 100644 --- a/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md @@ -19,10 +19,12 @@ open import foundation.logical-equivalences open import foundation.powersets open import foundation.propositions open import foundation.subtypes +open import foundation.unit-type open import foundation.universe-levels open import order-theory.large-posets open import order-theory.large-preorders +open import order-theory.bottom-elements-large-posets open import real-numbers.rational-upper-dedekind-real-numbers open import real-numbers.upper-dedekind-real-numbers @@ -110,3 +112,17 @@ iff-leq-upper-real-ℚ : pr1 (iff-leq-upper-real-ℚ p q) = preserves-leq-upper-real-ℚ p q pr2 (iff-leq-upper-real-ℚ p q) = reflects-leq-upper-real-ℚ p q ``` + +### Negative infinity is the bottom element of the large poset of upper reals + +```agda +is-bottom-element-neg-∞-upper-ℝ : + is-bottom-element-Large-Poset upper-ℝ-Large-Poset neg-∞-upper-ℝ +is-bottom-element-neg-∞-upper-ℝ x q _ = star + +has-bottom-element-upper-ℝ : + has-bottom-element-Large-Poset upper-ℝ-Large-Poset +bottom-has-bottom-element-Large-Poset has-bottom-element-upper-ℝ = neg-∞-upper-ℝ +is-bottom-element-bottom-has-bottom-element-Large-Poset + has-bottom-element-upper-ℝ = is-bottom-element-neg-∞-upper-ℝ +``` diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index b778d77cdc..47369392dd 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -1,6 +1,8 @@ # Lower Dedekind real numbers ```agda +{-# OPTIONS --lossy-unification #-} + module real-numbers.lower-dedekind-real-numbers where ``` diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md index 85b60f332a..fcc5e25746 100644 --- a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -145,7 +145,7 @@ module _ ( forward-implication (is-rounded-cut-lower-ℝ (F a) q) q∈Fa)) pr2 (is-rounded-cut-max-lower-ℝ q) = elim-exists - (cut-max-lower-ℝ q) + ( cut-max-lower-ℝ q) ( λ r (qImports + +```agda +open import elementary-number-theory.maximum-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.cartesian-product-types +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.disjunction +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.functoriality-cartesian-product-types +open import foundation.inhabited-types +open import foundation.intersections-subtypes +open import foundation.logical-equivalences +open import foundation.powersets +open import foundation.propositional-truncations +open import foundation.subtypes +open import foundation.universe-levels + +open import logic.functoriality-existential-quantification + +open import order-theory.large-join-semilattices +open import order-theory.least-upper-bounds-large-posets + +open import real-numbers.inequality-upper-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers +``` + +
+ +## Idea + +The maximum of two +[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers) `x`, `y` +is a upper Dedekind real number with cut equal to the intersection of the cuts +of `x` and `y`. + +## Definition + +### Binary maximum + +```agda +module _ + {l1 l2 : Level} (x : upper-ℝ l1) (y : upper-ℝ l2) + where + + cut-binary-max-upper-ℝ : subtype (l1 ⊔ l2) ℚ + cut-binary-max-upper-ℝ = intersection-subtype (cut-upper-ℝ x) (cut-upper-ℝ y) + + max-inhabitants-in-binary-max-upper-ℝ : + (p q : ℚ) → (is-in-cut-upper-ℝ x p) → (is-in-cut-upper-ℝ y q) → + is-in-subtype cut-binary-max-upper-ℝ (max-ℚ p q) + max-inhabitants-in-binary-max-upper-ℝ p q x

Imports + +```agda +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.disjunction +open import foundation.existential-quantification +open import foundation.function-types +open import foundation.functoriality-cartesian-product-types +open import foundation.inhabited-types +open import foundation.logical-equivalences +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 logic.functoriality-existential-quantification + +open import order-theory.large-inflattices +open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.lower-bounds-large-posets + +open import real-numbers.inequality-upper-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers +``` + +
+ +## Idea + +The minimum of two +[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers) `x`, `y` +is a upper Dedekind real number with cut equal to the union of the cuts of `x` +and `y`. Unlike the case for the +[minimum of upper Dedekind real numbers](real-numbers.minimum-upper-dedekind-real-numbers.md), +the minimum of any inhabited family of upper Dedekind real numbers, the upper +Dedekind real number by taking the union of the cuts of every element of the +family, is also a upper Dedekind real number. + +## Definition + +### Binary minimum + +```agda +module _ + {l1 l2 : Level} + (x : upper-ℝ l1) + (y : upper-ℝ l2) + where + + cut-binary-min-upper-ℝ : subtype (l1 ⊔ l2) ℚ + cut-binary-min-upper-ℝ = union-subtype (cut-upper-ℝ x) (cut-upper-ℝ y) + + is-inhabited-cut-binary-min-upper-ℝ : exists ℚ cut-binary-min-upper-ℝ + is-inhabited-cut-binary-min-upper-ℝ = + map-tot-exists + ( λ _ → inl-disjunction) + ( is-inhabited-cut-upper-ℝ x) + + is-rounded-cut-binary-min-upper-ℝ : + (q : ℚ) → + is-in-subtype cut-binary-min-upper-ℝ q ↔ + exists ℚ (λ p → le-ℚ-Prop p q ∧ cut-binary-min-upper-ℝ p) + pr1 (is-rounded-cut-binary-min-upper-ℝ q) = + elim-disjunction + ( ∃ ℚ (λ p → le-ℚ-Prop p q ∧ cut-binary-min-upper-ℝ p)) + ( λ qImports ```agda +open import elementary-number-theory.difference-rational-numbers open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers @@ -20,6 +24,7 @@ open import foundation.identity-types open import foundation.logical-equivalences open import foundation.powersets open import foundation.propositions +open import foundation.unit-type open import foundation.sets open import foundation.subtypes open import foundation.transport-along-identifications @@ -96,6 +101,17 @@ module _ ## Properties +### There is a least upper Dedekind real, whose cut is all rational numbers + +```agda +neg-∞-upper-ℝ : upper-ℝ lzero +pr1 neg-∞-upper-ℝ _ = unit-Prop +pr1 (pr2 neg-∞-upper-ℝ) = intro-exists zero-ℚ star +pr1 (pr2 (pr2 neg-∞-upper-ℝ) q) _ = + intro-exists (q -ℚ one-ℚ) (le-diff-rational-ℚ⁺ q one-ℚ⁺ , star) +pr2 (pr2 (pr2 neg-∞-upper-ℝ) q) _ = star +``` + ### The upper Dedekind reals form a set ```agda From 0f4ab5867f2df9f3e50be13615aee552eb1f3216 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 20:59:45 -0800 Subject: [PATCH 043/119] Progress --- .../dependent-products-large-inflattices.lagda.md | 8 ++++---- .../dependent-products-large-preorders.lagda.md | 2 +- .../greatest-lower-bounds-large-posets.lagda.md | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/order-theory/dependent-products-large-inflattices.lagda.md b/src/order-theory/dependent-products-large-inflattices.lagda.md index 7f0f51f84a..ce0ed317b2 100644 --- a/src/order-theory/dependent-products-large-inflattices.lagda.md +++ b/src/order-theory/dependent-products-large-inflattices.lagda.md @@ -116,11 +116,11 @@ module _ inf-Π-Large-Inflattice = inf-Large-Inflattice Π-Large-Inflattice - is-upper-bound-family-of-elements-Π-Large-Inflattice : + is-lower-bound-family-of-elements-Π-Large-Inflattice : {l2 l3 l4 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) - (y : type-Π-Large-Inflattice l4) → UU (β l3 l4 ⊔ l1 ⊔ l2) - is-upper-bound-family-of-elements-Π-Large-Inflattice = - is-upper-bound-family-of-elements-Large-Inflattice Π-Large-Inflattice + (y : type-Π-Large-Inflattice l4) → UU (β l4 l3 ⊔ l1 ⊔ l2) + is-lower-bound-family-of-elements-Π-Large-Inflattice = + is-lower-bound-family-of-elements-Large-Inflattice Π-Large-Inflattice is-greatest-lower-bound-family-of-elements-Π-Large-Inflattice : {l2 l3 l4 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) → diff --git a/src/order-theory/dependent-products-large-preorders.lagda.md b/src/order-theory/dependent-products-large-preorders.lagda.md index 5011bec668..fa7fafa61e 100644 --- a/src/order-theory/dependent-products-large-preorders.lagda.md +++ b/src/order-theory/dependent-products-large-preorders.lagda.md @@ -1,4 +1,4 @@ -# Dependent products large preorders +# Dependent products of large preorders ```agda module order-theory.dependent-products-large-preorders where diff --git a/src/order-theory/greatest-lower-bounds-large-posets.lagda.md b/src/order-theory/greatest-lower-bounds-large-posets.lagda.md index 8325bf5cfc..f311548ab1 100644 --- a/src/order-theory/greatest-lower-bounds-large-posets.lagda.md +++ b/src/order-theory/greatest-lower-bounds-large-posets.lagda.md @@ -139,6 +139,7 @@ module _ ↔ leq-Π-Large-Poset P u z by iff-Π-iff-family (λ i → H i (u i)) ``` + ### A family of greatest lower bounds of families of elements in a family of large poset is a greatest lower bound in their dependent product ```agda From 4c342b2754492657ba356e69b254642a25807acb Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 21:00:19 -0800 Subject: [PATCH 044/119] Progress --- .../decidable-total-orders.lagda.md | 280 +++++++++++++----- ...ependent-products-large-preorders.lagda.md | 2 +- ...reatest-lower-bounds-large-posets.lagda.md | 101 +++++++ .../greatest-lower-bounds-posets.lagda.md | 57 ++++ src/order-theory/large-inflattices.lagda.md | 236 +++++++++++++++ .../least-upper-bounds-large-posets.lagda.md | 70 ++++- .../least-upper-bounds-posets.lagda.md | 36 +++ .../lower-bounds-large-posets.lagda.md | 67 ++++- src/order-theory/meet-semilattices.lagda.md | 2 +- .../upper-bounds-large-posets.lagda.md | 30 +- 10 files changed, 791 insertions(+), 90 deletions(-) create mode 100644 src/order-theory/large-inflattices.lagda.md diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index 1bd894c446..0afc3251ab 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -7,6 +7,7 @@ module order-theory.decidable-total-orders where
Imports ```agda +open import foundation.action-on-identifications-functions open import foundation.binary-relations open import foundation.coproduct-types open import foundation.decidable-propositions @@ -20,7 +21,9 @@ open import foundation.universe-levels open import order-theory.decidable-posets open import order-theory.decidable-total-preorders open import order-theory.greatest-lower-bounds-posets +open import order-theory.join-semilattices open import order-theory.least-upper-bounds-posets +open import order-theory.meet-semilattices open import order-theory.posets open import order-theory.preorders open import order-theory.total-orders @@ -197,11 +200,11 @@ module _ where min-Decidable-Total-Order : type-Decidable-Total-Order T - min-Decidable-Total-Order = - rec-coproduct - ( λ x≤y → x) - ( λ yImports + +```agda +open import foundation.binary-relations +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.large-binary-relations +open import foundation.logical-equivalences +open import foundation.propositions +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.large-posets +open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.posets +open import order-theory.inflattices +open import order-theory.lower-bounds-large-posets +``` + +
+ +## Idea + +A **large inflattice** is a [large poset](order-theory.large-posets.md) `P` such +that for every family + +```text + x : I → type-Large-Poset P l1 +``` + +indexed by `I : UU l2` there is an element `⋁ x : type-Large-Poset P (l1 ⊔ l2)` +such that the logical equivalence + +```text + (∀ᵢ xᵢ ≤ y) ↔ ((⋁ x) ≤ y) +``` + +holds for every element `y : type-Large-Poset P l3`. + +## Definitions + +### The predicate on large posets of having least upper bounds of families of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} (γ : Level) + (P : Large-Poset α β) + where + + is-large-inflattice-Large-Poset : UUω + is-large-inflattice-Large-Poset = + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Poset P l2) → + has-greatest-lower-bound-family-of-elements-Large-Poset γ P x + + module _ + (H : is-large-inflattice-Large-Poset) + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Poset P l2) + where + + inf-is-large-inflattice-Large-Poset : type-Large-Poset P (γ ⊔ l1 ⊔ l2) + inf-is-large-inflattice-Large-Poset = + inf-has-greatest-lower-bound-family-of-elements-Large-Poset (H x) + + is-greatest-lower-bound-inf-is-large-inflattice-Large-Poset : + is-greatest-lower-bound-family-of-elements-Large-Poset P x + inf-is-large-inflattice-Large-Poset + is-greatest-lower-bound-inf-is-large-inflattice-Large-Poset = + is-greatest-lower-bound-inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( H x) +``` + +### Large inflattices + +```agda +record + Large-Inflattice + (α : Level → Level) (β : Level → Level → Level) (γ : Level) : UUω + where + constructor + make-Large-Inflattice + field + large-poset-Large-Inflattice : Large-Poset α β + is-large-inflattice-Large-Inflattice : + is-large-inflattice-Large-Poset γ large-poset-Large-Inflattice + +open Large-Inflattice public + +module _ + {α : Level → Level} {β : Level → Level → Level} {γ : Level} + (L : Large-Inflattice α β γ) + where + + set-Large-Inflattice : (l : Level) → Set (α l) + set-Large-Inflattice = set-Large-Poset (large-poset-Large-Inflattice L) + + type-Large-Inflattice : (l : Level) → UU (α l) + type-Large-Inflattice = type-Large-Poset (large-poset-Large-Inflattice L) + + is-set-type-Large-Inflattice : {l : Level} → is-set (type-Large-Inflattice l) + is-set-type-Large-Inflattice = + is-set-type-Large-Poset (large-poset-Large-Inflattice L) + + leq-prop-Large-Inflattice : + Large-Relation-Prop β type-Large-Inflattice + leq-prop-Large-Inflattice = + leq-prop-Large-Poset (large-poset-Large-Inflattice L) + + leq-Large-Inflattice : + Large-Relation β type-Large-Inflattice + leq-Large-Inflattice = leq-Large-Poset (large-poset-Large-Inflattice L) + + is-prop-leq-Large-Inflattice : + is-prop-Large-Relation type-Large-Inflattice leq-Large-Inflattice + is-prop-leq-Large-Inflattice = + is-prop-leq-Large-Poset (large-poset-Large-Inflattice L) + + refl-leq-Large-Inflattice : + is-reflexive-Large-Relation type-Large-Inflattice leq-Large-Inflattice + refl-leq-Large-Inflattice = + refl-leq-Large-Poset (large-poset-Large-Inflattice L) + + antisymmetric-leq-Large-Inflattice : + is-antisymmetric-Large-Relation type-Large-Inflattice leq-Large-Inflattice + antisymmetric-leq-Large-Inflattice = + antisymmetric-leq-Large-Poset (large-poset-Large-Inflattice L) + + transitive-leq-Large-Inflattice : + is-transitive-Large-Relation type-Large-Inflattice leq-Large-Inflattice + transitive-leq-Large-Inflattice = + transitive-leq-Large-Poset (large-poset-Large-Inflattice L) + + inf-Large-Inflattice : + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) → + type-Large-Inflattice (γ ⊔ l1 ⊔ l2) + inf-Large-Inflattice x = + inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( is-large-inflattice-Large-Inflattice L x) + + is-lower-bound-family-of-elements-Large-Inflattice : + {l1 l2 l3 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) + (y : type-Large-Inflattice l3) → UU (β l3 l2 ⊔ l1) + is-lower-bound-family-of-elements-Large-Inflattice x y = + is-lower-bound-family-of-elements-Large-Poset + ( large-poset-Large-Inflattice L) + ( x) + ( y) + + is-greatest-lower-bound-family-of-elements-Large-Inflattice : + {l1 l2 l3 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) → + type-Large-Inflattice l3 → UUω + is-greatest-lower-bound-family-of-elements-Large-Inflattice = + is-greatest-lower-bound-family-of-elements-Large-Poset + ( large-poset-Large-Inflattice L) + + is-greatest-lower-bound-inf-Large-Inflattice : + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) → + is-greatest-lower-bound-family-of-elements-Large-Inflattice x + ( inf-Large-Inflattice x) + is-greatest-lower-bound-inf-Large-Inflattice x = + is-greatest-lower-bound-inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( is-large-inflattice-Large-Inflattice L x) + + is-lower-bound-inf-Large-Inflattice : + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Inflattice l2) → + is-lower-bound-family-of-elements-Large-Inflattice x + ( inf-Large-Inflattice x) + is-lower-bound-inf-Large-Inflattice x = + backward-implication + ( is-greatest-lower-bound-inf-Large-Inflattice x (inf-Large-Inflattice x)) + ( refl-leq-Large-Inflattice (inf-Large-Inflattice x)) +``` + +## Properties + +### The operation `inf` is order preserving + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} {γ : Level} + (L : Large-Inflattice α β γ) + where + + preserves-order-inf-Large-Inflattice : + {l1 l2 l3 : Level} {I : UU l1} + {x : I → type-Large-Inflattice L l2} + {y : I → type-Large-Inflattice L l3} → + ((i : I) → leq-Large-Inflattice L (y i) (x i)) → + leq-Large-Inflattice L + ( inf-Large-Inflattice L y) + ( inf-Large-Inflattice L x) + preserves-order-inf-Large-Inflattice {x = x} {y} H = + forward-implication + ( is-greatest-lower-bound-inf-Large-Inflattice L x + ( inf-Large-Inflattice L y)) + ( λ i → + transitive-leq-Large-Inflattice L + ( inf-Large-Inflattice L y) + ( y i) + ( x i) + ( H i) + ( is-lower-bound-inf-Large-Inflattice L y i)) +``` + +### Small inflattices from large inflattices + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} {γ : Level} + (L : Large-Inflattice α β γ) + where + + poset-Large-Inflattice : (l : Level) → Poset (α l) (β l l) + poset-Large-Inflattice = poset-Large-Poset (large-poset-Large-Inflattice L) + + is-inflattice-poset-Large-Inflattice : + (l1 l2 : Level) → + is-inflattice-Poset l1 (poset-Large-Inflattice (γ ⊔ l1 ⊔ l2)) + pr1 (is-inflattice-poset-Large-Inflattice l1 l2 I f) = + inf-Large-Inflattice L f + pr2 (is-inflattice-poset-Large-Inflattice l1 l2 I f) = + is-greatest-lower-bound-inf-Large-Inflattice L f + + inflattice-Large-Inflattice : + (l1 l2 : Level) → + Inflattice (α (γ ⊔ l1 ⊔ l2)) (β (γ ⊔ l1 ⊔ l2) (γ ⊔ l1 ⊔ l2)) l1 + pr1 (inflattice-Large-Inflattice l1 l2) = + poset-Large-Inflattice (γ ⊔ l1 ⊔ l2) + pr2 (inflattice-Large-Inflattice l1 l2) = + is-inflattice-poset-Large-Inflattice l1 l2 +``` diff --git a/src/order-theory/least-upper-bounds-large-posets.lagda.md b/src/order-theory/least-upper-bounds-large-posets.lagda.md index e3ebbe37f5..45073fad45 100644 --- a/src/order-theory/least-upper-bounds-large-posets.lagda.md +++ b/src/order-theory/least-upper-bounds-large-posets.lagda.md @@ -22,18 +22,43 @@ open import order-theory.upper-bounds-large-posets ## Idea -A **least upper bound** of a family of elements `a : I → P` in a +A **binary least upper bound** on a pair of elements `a`, `b` in a [large poset](order-theory.large-posets.md) `P` is an element `x` in `P` such that the [logical equivalence](foundation.logical-equivalences.md) +```text + is-binary-upper-bound-Large-Poset P a b y ↔ (x ≤ y) +``` + +holds for every `y` in `P`. + +Similarly, a least upper bound of a family of elements `a : I → P` in a large +poset `P` is an element `x` in `P` such that the logical equivalence + ```text is-upper-bound-family-of-elements-Large-Poset P a y ↔ (x ≤ y) ``` -holds for every element in `P`. +holds for every `y` in `P`. ## Definitions +### The predicate on large posets of being a least binary upper bound of a pair of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) + where + + is-least-binary-upper-bound-Large-Poset : + {l3 : Level} (x : type-Large-Poset P l3) → UUω + is-least-binary-upper-bound-Large-Poset x = + {l4 : Level} (y : type-Large-Poset P l4) → + is-binary-upper-bound-Large-Poset P a b y ↔ leq-Large-Poset P x y +``` + ### The predicate on large posets of being a least upper bound of a family of elements ```agda @@ -84,6 +109,45 @@ module _ ## Properties +### Binary least upper bounds are upper bounds + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) + where + + is-binary-upper-bound-is-least-binary-upper-bound-Large-Poset : + {l3 : Level} {y : type-Large-Poset P l3} → + is-least-binary-upper-bound-Large-Poset P a b y → + is-binary-upper-bound-Large-Poset P a b y + is-binary-upper-bound-is-least-binary-upper-bound-Large-Poset H = + backward-implication (H _) (refl-leq-Large-Poset P _) +``` + +### Binary least upper bounds are unique up to similarity of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) + where + + sim-is-least-binary-upper-bound-Large-Poset : + {l3 l4 : Level} {x : type-Large-Poset P l3} {y : type-Large-Poset P l4} → + is-least-binary-upper-bound-Large-Poset P a b x → + is-least-binary-upper-bound-Large-Poset P a b y → + sim-Large-Poset P x y + pr1 (sim-is-least-binary-upper-bound-Large-Poset H K) = + forward-implication (H _) + ( backward-implication (K _) (refl-leq-Large-Poset P _)) + pr2 (sim-is-least-binary-upper-bound-Large-Poset H K) = + forward-implication (K _) + ( backward-implication (H _) (refl-leq-Large-Poset P _)) +``` + ### Least upper bounds of families of elements are upper bounds ```agda @@ -101,7 +165,7 @@ module _ backward-implication (H _) (refl-leq-Large-Poset P _) ``` -### Least upper bounds of families of elements are unique up to similairity of elements +### Least upper bounds of families of elements are unique up to similarity of elements ```agda module _ diff --git a/src/order-theory/least-upper-bounds-posets.lagda.md b/src/order-theory/least-upper-bounds-posets.lagda.md index 45eaaed587..a7c452326b 100644 --- a/src/order-theory/least-upper-bounds-posets.lagda.md +++ b/src/order-theory/least-upper-bounds-posets.lagda.md @@ -124,6 +124,27 @@ module _ ( is-binary-upper-bound-is-least-binary-upper-bound-Poset H) ``` +### The least upper bound of a and b is the least upper bound of b and a + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) (a b c : type-Poset P) + where + + symmetric-is-least-binary-upper-bound-Poset : + is-least-binary-upper-bound-Poset P a b c → + is-least-binary-upper-bound-Poset P b a c + pr1 (symmetric-is-least-binary-upper-bound-Poset lub-c d) lub-d = + forward-implication + ( lub-c d) + ( leq-right-is-binary-upper-bound-Poset P lub-d , + leq-left-is-binary-upper-bound-Poset P lub-d) + pr1 (pr2 (symmetric-is-least-binary-upper-bound-Poset lub-c d) c≤d) = + leq-right-is-binary-upper-bound-Poset P (backward-implication (lub-c d) c≤d) + pr2 (pr2 (symmetric-is-least-binary-upper-bound-Poset lub-c d) c≤d) = + leq-left-is-binary-upper-bound-Poset P (backward-implication (lub-c d) c≤d) +``` + ### The proposition that two elements have a least upper bound ```agda @@ -175,6 +196,21 @@ module _ ( y , K)) ``` +### The property of having a least binary upper bound is symmetric + +```agda +module _ + {l1 l2 : Level} (P : Poset l1 l2) (a b : type-Poset P) + where + + symmetric-has-least-binary-upper-bound-Poset : + has-least-binary-upper-bound-Poset P a b → + has-least-binary-upper-bound-Poset P b a + pr1 (symmetric-has-least-binary-upper-bound-Poset (lub , is-lub)) = lub + pr2 (symmetric-has-least-binary-upper-bound-Poset (lub , is-lub)) = + symmetric-is-least-binary-upper-bound-Poset P a b lub is-lub +``` + ### Least upper bounds of families of elements ```agda diff --git a/src/order-theory/lower-bounds-large-posets.lagda.md b/src/order-theory/lower-bounds-large-posets.lagda.md index eaae717e83..3bfd16b67e 100644 --- a/src/order-theory/lower-bounds-large-posets.lagda.md +++ b/src/order-theory/lower-bounds-large-posets.lagda.md @@ -8,8 +8,10 @@ module order-theory.lower-bounds-large-posets where ```agda open import foundation.cartesian-product-types +open import foundation.conjunction open import foundation.dependent-pair-types open import foundation.logical-equivalences +open import foundation.propositions open import foundation.universe-levels open import order-theory.dependent-products-large-posets @@ -35,10 +37,41 @@ module _ {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) where + is-binary-lower-bound-prop-Large-Poset : + {l3 : Level} → type-Large-Poset P l3 → Prop (β l3 l1 ⊔ β l3 l2) + is-binary-lower-bound-prop-Large-Poset x = + leq-prop-Large-Poset P x a ∧ leq-prop-Large-Poset P x b + is-binary-lower-bound-Large-Poset : {l3 : Level} → type-Large-Poset P l3 → UU (β l3 l1 ⊔ β l3 l2) is-binary-lower-bound-Large-Poset x = - leq-Large-Poset P x a × leq-Large-Poset P x b + type-Prop (is-binary-lower-bound-prop-Large-Poset x) +``` + +### The predicate of being a lower bound of a family of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} {I : UU l1} (x : I → type-Large-Poset P l2) + where + + is-lower-bound-prop-family-of-elements-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → Prop (β l3 l2 ⊔ l1) + is-lower-bound-prop-family-of-elements-Large-Poset y = + Π-Prop I (λ i → leq-prop-Large-Poset P y (x i)) + + is-lower-bound-family-of-elements-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → UU (β l3 l2 ⊔ l1) + is-lower-bound-family-of-elements-Large-Poset y = + type-Prop (is-lower-bound-prop-family-of-elements-Large-Poset y) + + is-prop-is-lower-bound-family-of-elements-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → + is-prop (is-lower-bound-family-of-elements-Large-Poset y) + is-prop-is-lower-bound-family-of-elements-Large-Poset y = + is-prop-type-Prop (is-lower-bound-prop-family-of-elements-Large-Poset y) ``` ## Properties @@ -77,3 +110,35 @@ module _ pr2 (logical-equivalence-is-binary-lower-bound-Π-Large-Poset z) = is-binary-lower-bound-is-binary-lower-bound-Π-Large-Poset z ``` + +### An element `x : Π-Large-Poset P` of a dependent product of large posets `P i` indexed by `i : I` is a lower bound of a family `a : J → Π-Large-Poset P` if and only if `x i` is a lower bound of the family `(j ↦ a j i) : J → P i` of elements of `P i` + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + {l1 : Level} {I : UU l1} (P : I → Large-Poset α β) + {l2 l3 : Level} {J : UU l2} (a : J → type-Π-Large-Poset P l3) + {l4 : Level} (x : type-Π-Large-Poset P l4) + where + + is-lower-bound-family-of-elements-Π-Large-Poset : + ( (i : I) → + is-lower-bound-family-of-elements-Large-Poset (P i) (λ j → a j i) (x i)) → + is-lower-bound-family-of-elements-Large-Poset (Π-Large-Poset P) a x + is-lower-bound-family-of-elements-Π-Large-Poset H j i = H i j + + map-inv-is-lower-bound-family-of-elements-Π-Large-Poset : + is-lower-bound-family-of-elements-Large-Poset (Π-Large-Poset P) a x → + (i : I) → + is-lower-bound-family-of-elements-Large-Poset (P i) (λ j → a j i) (x i) + map-inv-is-lower-bound-family-of-elements-Π-Large-Poset H i j = H j i + + logical-equivalence-is-lower-bound-family-of-elements-Π-Large-Poset : + ( (i : I) → + is-lower-bound-family-of-elements-Large-Poset (P i) (λ j → a j i) (x i)) ↔ + is-lower-bound-family-of-elements-Large-Poset (Π-Large-Poset P) a x + pr1 logical-equivalence-is-lower-bound-family-of-elements-Π-Large-Poset = + is-lower-bound-family-of-elements-Π-Large-Poset + pr2 logical-equivalence-is-lower-bound-family-of-elements-Π-Large-Poset = + map-inv-is-lower-bound-family-of-elements-Π-Large-Poset +``` diff --git a/src/order-theory/meet-semilattices.lagda.md b/src/order-theory/meet-semilattices.lagda.md index ab9a4a7687..4a01ec4db8 100644 --- a/src/order-theory/meet-semilattices.lagda.md +++ b/src/order-theory/meet-semilattices.lagda.md @@ -35,7 +35,7 @@ binary-lower bound. Alternatively, meet-semilattices can be defined algebraically as a set `X` equipped with a binary operation `∧ : X → X → X` satisfying -1. Asociativity: `(x ∧ y) ∧ z = x ∧ (y ∧ z)`, +1. Associativity: `(x ∧ y) ∧ z = x ∧ (y ∧ z)`, 2. Commutativity: `x ∧ y = y ∧ x`, 3. Idempotency: `x ∧ x = x`. diff --git a/src/order-theory/upper-bounds-large-posets.lagda.md b/src/order-theory/upper-bounds-large-posets.lagda.md index 02978df689..96ad72e7a1 100644 --- a/src/order-theory/upper-bounds-large-posets.lagda.md +++ b/src/order-theory/upper-bounds-large-posets.lagda.md @@ -7,6 +7,7 @@ module order-theory.upper-bounds-large-posets where
Imports ```agda +open import foundation.conjunction open import foundation.dependent-pair-types open import foundation.logical-equivalences open import foundation.propositions @@ -20,13 +21,34 @@ open import order-theory.large-posets ## Idea -A **binary upper bound** of two elements `a` and `b` of a large poset `P` is an -element `x` of `P` such that `a ≤ x` and `b ≤ x` both hold. Similarly, an -**upper bound** of a family `a : I → P` of elements of `P` is an element `x` of -`P` such that the inequality `(a i) ≤ x` holds for every `i : I`. +A **binary upper bound** of two elements `a` and `b` of a +[large poset](order-theory.large-posets.md) `P` is an element `x` of `P` such +that `a ≤ x` and `b ≤ x` both hold. Similarly, an **upper bound** of a family +`a : I → P` of elements of `P` is an element `x` of `P` such that the inequality +`(a i) ≤ x` holds for every `i : I`. ## Definitions +### The predicate of being an upper bound of a pair of elements + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (P : Large-Poset α β) + {l1 l2 : Level} (a : type-Large-Poset P l1) (b : type-Large-Poset P l2) + where + + is-binary-upper-bound-prop-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → Prop (β l1 l3 ⊔ β l2 l3) + is-binary-upper-bound-prop-Large-Poset y = + leq-prop-Large-Poset P a y ∧ leq-prop-Large-Poset P b y + + is-binary-upper-bound-Large-Poset : + {l3 : Level} (y : type-Large-Poset P l3) → UU (β l1 l3 ⊔ β l2 l3) + is-binary-upper-bound-Large-Poset y = + type-Prop (is-binary-upper-bound-prop-Large-Poset y) +``` + ### The predicate of being an upper bound of a family of elements ```agda From a9034401075d2fa96f6f6f64a0a82ce7b8ede6ab Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 21:01:58 -0800 Subject: [PATCH 045/119] More imports --- ...endent-products-large-inflattices.lagda.md | 137 +++++++++ .../large-join-semilattices.lagda.md | 269 ++++++++++++++++++ 2 files changed, 406 insertions(+) create mode 100644 src/order-theory/dependent-products-large-inflattices.lagda.md create mode 100644 src/order-theory/large-join-semilattices.lagda.md diff --git a/src/order-theory/dependent-products-large-inflattices.lagda.md b/src/order-theory/dependent-products-large-inflattices.lagda.md new file mode 100644 index 0000000000..ce0ed317b2 --- /dev/null +++ b/src/order-theory/dependent-products-large-inflattices.lagda.md @@ -0,0 +1,137 @@ +# Dependent products of large inflattices + +```agda +module order-theory.dependent-products-large-inflattices where +``` + +
Imports + +```agda +open import foundation.large-binary-relations +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.dependent-products-large-posets +open import order-theory.large-posets +open import order-theory.large-inflattices +open import order-theory.greatest-lower-bounds-large-posets +``` + +
+ +## Idea + +Families of greatest lower bounds of families of elements in dependent products of +large posets are again greatest lower bounds. Therefore it follows that dependent +products of large inflattices are again large inflattices. + +## Definitions + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} {γ : Level} + {l1 : Level} {I : UU l1} (L : I → Large-Inflattice α β γ) + where + + large-poset-Π-Large-Inflattice : + Large-Poset (λ l2 → α l2 ⊔ l1) (λ l2 l3 → β l2 l3 ⊔ l1) + large-poset-Π-Large-Inflattice = + Π-Large-Poset (λ i → large-poset-Large-Inflattice (L i)) + + is-large-inflattice-Π-Large-Inflattice : + is-large-inflattice-Large-Poset γ large-poset-Π-Large-Inflattice + inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( is-large-inflattice-Π-Large-Inflattice {l2} {l3} {J} a) i = + inf-Large-Inflattice (L i) (λ j → a j i) + is-greatest-lower-bound-inf-has-greatest-lower-bound-family-of-elements-Large-Poset + ( is-large-inflattice-Π-Large-Inflattice {l2} {l3} {J} a) = + is-greatest-lower-bound-Π-Large-Poset + ( λ i → large-poset-Large-Inflattice (L i)) + ( a) + ( λ i → inf-Large-Inflattice (L i) (λ j → a j i)) + ( λ i → + is-greatest-lower-bound-inf-Large-Inflattice (L i) (λ j → a j i)) + + Π-Large-Inflattice : + Large-Inflattice (λ l2 → α l2 ⊔ l1) (λ l2 l3 → β l2 l3 ⊔ l1) γ + large-poset-Large-Inflattice Π-Large-Inflattice = + large-poset-Π-Large-Inflattice + is-large-inflattice-Large-Inflattice Π-Large-Inflattice = + is-large-inflattice-Π-Large-Inflattice + + set-Π-Large-Inflattice : (l : Level) → Set (α l ⊔ l1) + set-Π-Large-Inflattice = + set-Large-Inflattice Π-Large-Inflattice + + type-Π-Large-Inflattice : (l : Level) → UU (α l ⊔ l1) + type-Π-Large-Inflattice = + type-Large-Inflattice Π-Large-Inflattice + + is-set-type-Π-Large-Inflattice : + {l : Level} → is-set (type-Π-Large-Inflattice l) + is-set-type-Π-Large-Inflattice = + is-set-type-Large-Inflattice Π-Large-Inflattice + + leq-prop-Π-Large-Inflattice : + Large-Relation-Prop + ( λ l2 l3 → β l2 l3 ⊔ l1) + ( type-Π-Large-Inflattice) + leq-prop-Π-Large-Inflattice = + leq-prop-Large-Inflattice Π-Large-Inflattice + + leq-Π-Large-Inflattice : + {l2 l3 : Level} + (x : type-Π-Large-Inflattice l2) (y : type-Π-Large-Inflattice l3) → + UU (β l2 l3 ⊔ l1) + leq-Π-Large-Inflattice = + leq-Large-Inflattice Π-Large-Inflattice + + is-prop-leq-Π-Large-Inflattice : + is-prop-Large-Relation type-Π-Large-Inflattice leq-Π-Large-Inflattice + is-prop-leq-Π-Large-Inflattice = + is-prop-leq-Large-Inflattice Π-Large-Inflattice + + refl-leq-Π-Large-Inflattice : + is-reflexive-Large-Relation type-Π-Large-Inflattice leq-Π-Large-Inflattice + refl-leq-Π-Large-Inflattice = + refl-leq-Large-Inflattice Π-Large-Inflattice + + antisymmetric-leq-Π-Large-Inflattice : + is-antisymmetric-Large-Relation + ( type-Π-Large-Inflattice) + ( leq-Π-Large-Inflattice) + antisymmetric-leq-Π-Large-Inflattice = + antisymmetric-leq-Large-Inflattice Π-Large-Inflattice + + transitive-leq-Π-Large-Inflattice : + is-transitive-Large-Relation + ( type-Π-Large-Inflattice) + ( leq-Π-Large-Inflattice) + transitive-leq-Π-Large-Inflattice = + transitive-leq-Large-Inflattice Π-Large-Inflattice + + inf-Π-Large-Inflattice : + {l2 l3 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) → + type-Π-Large-Inflattice (γ ⊔ l2 ⊔ l3) + inf-Π-Large-Inflattice = + inf-Large-Inflattice Π-Large-Inflattice + + is-lower-bound-family-of-elements-Π-Large-Inflattice : + {l2 l3 l4 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) + (y : type-Π-Large-Inflattice l4) → UU (β l4 l3 ⊔ l1 ⊔ l2) + is-lower-bound-family-of-elements-Π-Large-Inflattice = + is-lower-bound-family-of-elements-Large-Inflattice Π-Large-Inflattice + + is-greatest-lower-bound-family-of-elements-Π-Large-Inflattice : + {l2 l3 l4 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) → + type-Π-Large-Inflattice l4 → UUω + is-greatest-lower-bound-family-of-elements-Π-Large-Inflattice = + is-greatest-lower-bound-family-of-elements-Large-Inflattice Π-Large-Inflattice + + is-greatest-lower-bound-inf-Π-Large-Inflattice : + {l2 l3 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) → + is-greatest-lower-bound-family-of-elements-Π-Large-Inflattice x + ( inf-Π-Large-Inflattice x) + is-greatest-lower-bound-inf-Π-Large-Inflattice = + is-greatest-lower-bound-inf-Large-Inflattice Π-Large-Inflattice +``` diff --git a/src/order-theory/large-join-semilattices.lagda.md b/src/order-theory/large-join-semilattices.lagda.md new file mode 100644 index 0000000000..7c5f497c66 --- /dev/null +++ b/src/order-theory/large-join-semilattices.lagda.md @@ -0,0 +1,269 @@ +# Large join-semilattices + +```agda +module order-theory.large-join-semilattices where +``` + +
Imports + +```agda +open import foundation.action-on-identifications-binary-functions +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.large-binary-relations +open import foundation.sets +open import foundation.universe-levels + +open import order-theory.bottom-elements-large-posets +open import order-theory.join-semilattices +open import order-theory.large-posets +open import order-theory.least-upper-bounds-large-posets +open import order-theory.posets +``` + +
+ +## Idea + +A **large join-semilattice** is a [large poset](order-theory.large-posets.md) in +which every pair of elements has a +[least binary upper bound](order-theory.least-upper-bounds-large-posets.md). + +## Definition + +### The predicate that a large poset has joins + +```agda +record + has-joins-Large-Poset + { α : Level → Level} + { β : Level → Level → Level} + ( P : Large-Poset α β) : + UUω + where + constructor + make-has-joins-Large-Poset + field + join-has-joins-Large-Poset : + {l1 l2 : Level} + (x : type-Large-Poset P l1) (y : type-Large-Poset P l2) → + type-Large-Poset P (l1 ⊔ l2) + is-least-binary-upper-bound-join-has-joins-Large-Poset : + {l1 l2 : Level} + (x : type-Large-Poset P l1) (y : type-Large-Poset P l2) → + is-least-binary-upper-bound-Large-Poset P x y + ( join-has-joins-Large-Poset x y) + +open has-joins-Large-Poset public +``` + +### The predicate of being a large join-semilattice + +```agda +record + is-large-join-semilattice-Large-Poset + { α : Level → Level} + { β : Level → Level → Level} + ( P : Large-Poset α β) : + UUω + where + field + has-joins-is-large-join-semilattice-Large-Poset : + has-joins-Large-Poset P + has-bottom-element-is-large-join-semilattice-Large-Poset : + has-bottom-element-Large-Poset P + +open is-large-join-semilattice-Large-Poset public + +module _ + {α : Level → Level} + {β : Level → Level → Level} + (P : Large-Poset α β) + (H : is-large-join-semilattice-Large-Poset P) + where + + join-is-large-join-semilattice-Large-Poset : + {l1 l2 : Level} (x : type-Large-Poset P l1) (y : type-Large-Poset P l2) → + type-Large-Poset P (l1 ⊔ l2) + join-is-large-join-semilattice-Large-Poset = + join-has-joins-Large-Poset + ( has-joins-is-large-join-semilattice-Large-Poset H) + + is-least-binary-upper-bound-join-is-large-join-semilattice-Large-Poset : + {l1 l2 : Level} (x : type-Large-Poset P l1) (y : type-Large-Poset P l2) → + is-least-binary-upper-bound-Large-Poset P x y + ( join-is-large-join-semilattice-Large-Poset x y) + is-least-binary-upper-bound-join-is-large-join-semilattice-Large-Poset = + is-least-binary-upper-bound-join-has-joins-Large-Poset + ( has-joins-is-large-join-semilattice-Large-Poset H) + + bottom-is-large-join-semilattice-Large-Poset : + type-Large-Poset P lzero + bottom-is-large-join-semilattice-Large-Poset = + bottom-has-bottom-element-Large-Poset + ( has-bottom-element-is-large-join-semilattice-Large-Poset H) + + is-bottom-element-bottom-is-large-join-semilattice-Large-Poset : + {l1 : Level} (x : type-Large-Poset P l1) → + leq-Large-Poset P bottom-is-large-join-semilattice-Large-Poset x + is-bottom-element-bottom-is-large-join-semilattice-Large-Poset = + is-bottom-element-bottom-has-bottom-element-Large-Poset + ( has-bottom-element-is-large-join-semilattice-Large-Poset H) +``` + +### Large join-semilattices + +```agda +record + Large-Join-Semilattice + ( α : Level → Level) + ( β : Level → Level → Level) : + UUω + where + constructor + make-Large-Join-Semilattice + field + large-poset-Large-Join-Semilattice : + Large-Poset α β + is-large-join-semilattice-Large-Join-Semilattice : + is-large-join-semilattice-Large-Poset + large-poset-Large-Join-Semilattice + +open Large-Join-Semilattice public + +module _ + {α : Level → Level} {β : Level → Level → Level} + (L : Large-Join-Semilattice α β) + where + + type-Large-Join-Semilattice : (l : Level) → UU (α l) + type-Large-Join-Semilattice = + type-Large-Poset (large-poset-Large-Join-Semilattice L) + + set-Large-Join-Semilattice : (l : Level) → Set (α l) + set-Large-Join-Semilattice = + set-Large-Poset (large-poset-Large-Join-Semilattice L) + + is-set-type-Large-Join-Semilattice : + {l : Level} → is-set (type-Large-Join-Semilattice l) + is-set-type-Large-Join-Semilattice = + is-set-type-Large-Poset (large-poset-Large-Join-Semilattice L) + + leq-Large-Join-Semilattice : Large-Relation β type-Large-Join-Semilattice + leq-Large-Join-Semilattice = + leq-Large-Poset (large-poset-Large-Join-Semilattice L) + + refl-leq-Large-Join-Semilattice : + is-reflexive-Large-Relation + ( type-Large-Join-Semilattice) + ( leq-Large-Join-Semilattice) + refl-leq-Large-Join-Semilattice = + refl-leq-Large-Poset (large-poset-Large-Join-Semilattice L) + + antisymmetric-leq-Large-Join-Semilattice : + is-antisymmetric-Large-Relation + ( type-Large-Join-Semilattice) + ( leq-Large-Join-Semilattice) + antisymmetric-leq-Large-Join-Semilattice = + antisymmetric-leq-Large-Poset (large-poset-Large-Join-Semilattice L) + + transitive-leq-Large-Join-Semilattice : + is-transitive-Large-Relation + ( type-Large-Join-Semilattice) + ( leq-Large-Join-Semilattice) + transitive-leq-Large-Join-Semilattice = + transitive-leq-Large-Poset (large-poset-Large-Join-Semilattice L) + + has-joins-Large-Join-Semilattice : + has-joins-Large-Poset (large-poset-Large-Join-Semilattice L) + has-joins-Large-Join-Semilattice = + has-joins-is-large-join-semilattice-Large-Poset + ( is-large-join-semilattice-Large-Join-Semilattice L) + + join-Large-Join-Semilattice : + {l1 l2 : Level} + (x : type-Large-Join-Semilattice l1) + (y : type-Large-Join-Semilattice l2) → + type-Large-Join-Semilattice (l1 ⊔ l2) + join-Large-Join-Semilattice = + join-is-large-join-semilattice-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( is-large-join-semilattice-Large-Join-Semilattice L) + + is-least-binary-upper-bound-join-Large-Join-Semilattice : + {l1 l2 : Level} + (x : type-Large-Join-Semilattice l1) + (y : type-Large-Join-Semilattice l2) → + is-least-binary-upper-bound-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( x) + ( y) + ( join-Large-Join-Semilattice x y) + is-least-binary-upper-bound-join-Large-Join-Semilattice = + is-least-binary-upper-bound-join-is-large-join-semilattice-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( is-large-join-semilattice-Large-Join-Semilattice L) + + ap-join-Large-Join-Semilattice : + {l1 l2 : Level} + {x x' : type-Large-Join-Semilattice l1} + {y y' : type-Large-Join-Semilattice l2} → + (x = x') → (y = y') → + join-Large-Join-Semilattice x y = join-Large-Join-Semilattice x' y' + ap-join-Large-Join-Semilattice p q = + ap-binary join-Large-Join-Semilattice p q + + has-bottom-element-Large-Join-Semilattice : + has-bottom-element-Large-Poset (large-poset-Large-Join-Semilattice L) + has-bottom-element-Large-Join-Semilattice = + has-bottom-element-is-large-join-semilattice-Large-Poset + ( is-large-join-semilattice-Large-Join-Semilattice L) + + bottom-Large-Join-Semilattice : + type-Large-Join-Semilattice lzero + bottom-Large-Join-Semilattice = + bottom-is-large-join-semilattice-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( is-large-join-semilattice-Large-Join-Semilattice L) + + is-bottom-element-bottom-Large-Join-Semilattice : + {l1 : Level} (x : type-Large-Join-Semilattice l1) → + leq-Large-Join-Semilattice bottom-Large-Join-Semilattice x + is-bottom-element-bottom-Large-Join-Semilattice = + is-bottom-element-bottom-is-large-join-semilattice-Large-Poset + ( large-poset-Large-Join-Semilattice L) + ( is-large-join-semilattice-Large-Join-Semilattice L) +``` + +### Small join semilattices from large join semilattices + +```agda +module _ + {α : Level → Level} {β : Level → Level → Level} + (L : Large-Join-Semilattice α β) + where + + poset-Large-Join-Semilattice : (l : Level) → Poset (α l) (β l l) + poset-Large-Join-Semilattice = + poset-Large-Poset (large-poset-Large-Join-Semilattice L) + + is-join-semilattice-poset-Large-Join-Semilattice : + {l : Level} → is-join-semilattice-Poset (poset-Large-Join-Semilattice l) + pr1 (is-join-semilattice-poset-Large-Join-Semilattice x y) = + join-Large-Join-Semilattice L x y + pr2 (is-join-semilattice-poset-Large-Join-Semilattice x y) = + is-least-binary-upper-bound-join-Large-Join-Semilattice L x y + + order-theoretic-join-semilattice-Large-Join-Semilattice : + (l : Level) → Order-Theoretic-Join-Semilattice (α l) (β l l) + pr1 (order-theoretic-join-semilattice-Large-Join-Semilattice l) = + poset-Large-Join-Semilattice l + pr2 (order-theoretic-join-semilattice-Large-Join-Semilattice l) = + is-join-semilattice-poset-Large-Join-Semilattice + + join-semilattice-Large-Join-Semilattice : + (l : Level) → Join-Semilattice (α l) + join-semilattice-Large-Join-Semilattice l = + join-semilattice-Order-Theoretic-Join-Semilattice + ( order-theoretic-join-semilattice-Large-Join-Semilattice l) +``` From 8aa85c04bfd60a68b8ba6000f3af8bd21642cd79 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 21:09:25 -0800 Subject: [PATCH 046/119] Fix symbols in docs --- src/order-theory/large-inflattices.lagda.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/order-theory/large-inflattices.lagda.md b/src/order-theory/large-inflattices.lagda.md index a47a0ff67a..ca07a05342 100644 --- a/src/order-theory/large-inflattices.lagda.md +++ b/src/order-theory/large-inflattices.lagda.md @@ -34,11 +34,11 @@ that for every family x : I → type-Large-Poset P l1 ``` -indexed by `I : UU l2` there is an element `⋁ x : type-Large-Poset P (l1 ⊔ l2)` +indexed by `I : UU l2` there is an element `⋀ x : type-Large-Poset P (l1 ⊔ l2)` such that the logical equivalence ```text - (∀ᵢ xᵢ ≤ y) ↔ ((⋁ x) ≤ y) + (∀ᵢ y ≤ xᵢ ) ↔ (y ≤ ⋀ x) ``` holds for every element `y : type-Large-Poset P l3`. From 60953306aa072fa9f1930baaa4222610d6a03c87 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 12 Feb 2025 21:14:25 -0800 Subject: [PATCH 047/119] Back off the hard bits --- src/foundation/powersets.lagda.md | 20 ----------------- ...nimum-upper-dedekind-real-numbers.lagda.md | 22 ------------------- 2 files changed, 42 deletions(-) diff --git a/src/foundation/powersets.lagda.md b/src/foundation/powersets.lagda.md index 0defb6326b..40d81d0d15 100644 --- a/src/foundation/powersets.lagda.md +++ b/src/foundation/powersets.lagda.md @@ -26,7 +26,6 @@ open import order-theory.dependent-products-large-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.dependent-products-large-inflattices open import order-theory.large-meet-semilattices open import order-theory.large-posets open import order-theory.large-preorders @@ -38,8 +37,6 @@ open import order-theory.posets open import order-theory.preorders open import order-theory.similarity-of-elements-large-posets open import order-theory.suplattices -open import order-theory.inflattices -open import order-theory.large-inflattices open import order-theory.top-elements-large-posets open import order-theory.top-elements-posets ``` @@ -185,23 +182,6 @@ module _ powerset-Suplattice = suplattice-Large-Suplattice powerset-Large-Suplattice ``` -### The powerset inflattice - -```agda -module _ - {l1 : Level} (A : UU l1) - where - - powerset-Large-Inflattice : - Large-Inflattice (λ l2 → ?) (λ l2 l3 → ?) lzero - powerset-Large-Inflattice = - Π-Large-Inflattice {I = A} (λ _ → Prop-Large-Inflattice) - - powerset-Inflattice : - (l2 l3 : Level) → Inflattice ? ? ? - powerset-Inflattice = suplattice-Large-Inflattice powerset-Large-Inflattice -``` - ### Similarity of subtypes ```agda diff --git a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md index 9320ae3b9c..30cac717c6 100644 --- a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md @@ -204,25 +204,3 @@ module _ y is-greatest-binary-lower-bound-binary-min-upper-ℝ ``` - -### The minimum of an inhabited family of upper reals is a greatest lower bound - -```agda -module _ - {l1 l2 : Level} - (A : UU l1) - (H : is-inhabited A) - (F : A → upper-ℝ l2) - where - - is-greatest-lower-bound-min-upper-ℝ : - is-greatest-lower-bound-family-of-elements-Large-Poset - upper-ℝ-Large-Poset - F - (min-upper-ℝ A H F) - is-greatest-lower-bound-min-upper-ℝ z = - is-greatest-lower-bound-inf-Large-Inflattice - ( powerset-Large-Inflattice ℚ) - ( cut-upper-ℝ ∘ F) - ( cut-upper-ℝ z) -``` From 23a33d354e3d0c034e5cec8180b9c058a04d6db9 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 13 Feb 2025 15:07:01 -0800 Subject: [PATCH 048/119] Apply suggestions from code review Co-authored-by: Fredrik Bakke --- ...rithmetically-located-dedekind-cuts.lagda.md | 2 +- src/real-numbers/dedekind-real-numbers.lagda.md | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index 405a77a7e2..aaba62504f 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -46,7 +46,7 @@ A pair of a [lower Dedekind real](real-numbers.lower-dedekind-real-numbers.md) `L` and an [upper Dedekind real](real-numbers.upper-dedekind-real-numbers.md) `U` is {{#concept "arithmetically located" Disambiguation="Dedekind cut"}} if for any positive [rational number](elementary-number-theory.rational-numbers.md) -`ε : ℚ`, there exist `p, q : ℚ` such that `0 < q - p < ε`, `p ∈ L`, and `q ∈ U`. +`ε : ℚ`, there exists `p, q : ℚ` where `p ∈ L` and `q ∈ U`, such that `0 < q - p < ε`. Intuitively, when `L , U` represent the cuts of a real number `x`, `p` and `q` are rational approximations of `x` to within `ε`. This follows parts of Section 11 in {{#cite BauerTaylor2009}}. diff --git a/src/real-numbers/dedekind-real-numbers.lagda.md b/src/real-numbers/dedekind-real-numbers.lagda.md index 3e6695ebce..e68152a823 100644 --- a/src/real-numbers/dedekind-real-numbers.lagda.md +++ b/src/real-numbers/dedekind-real-numbers.lagda.md @@ -50,22 +50,21 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea -A Dedekind real number consists of a [pair](foundation.dependent-pair-types.md) -`(lx , uy)` of a -[lower Dedekind real](real-numbers.lower-dedekind-real-numbers.md) and an -[upper Dedekind real](real-numbers.upper-dedekind-real-numbers.md) that also -satisfy the following conditions: +A {{#concept "Dedekind real number" WD="real number" WDID=Q12916 Agda=ℝ}} `x` consists of a [pair](foundation.dependent-pair-types.md) + of _cuts_ `(L , U)` of [rational numbers](elementary-number-theory.rational-numbers.md), a +[lower Dedekind cut](real-numbers.lower-dedekind-real-numbers.md) `L` and an +[upper Dedekind cut](real-numbers.upper-dedekind-real-numbers.md) `U`. These cuts present lower and upper bounds on the Dedekind real number, and must satisfy the conditions -1. _Disjointness_. The cuts of `lx` and `uy` are disjoint subsets of `ℚ`. -2. _Locatedness_. If `q < r` then `q` is in the cut of `lx` or `r` is in the cut - of `uy`. +1. _Disjointness_. The cuts `lx` and `uy` are disjoint subsets of `ℚ`. +2. _Locatedness_. If `q < r` then `q` is in the cut `L` or `r` is in the cut `U`. +The {{#concept "collection of all Dedekind real numbers" WD="set of real numbers" WDID=Q1174982 Agda=ℝ}} is denoted `ℝ`. The Dedekind real numbers will be taken as the standard definition of the real numbers in the agda-unimath library. ## Definition -### Dedekind real numbers +### Dedekind cuts ```agda module _ From f2c3f7646486d0f5b5894418ea4baa08847a3f65 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 13 Feb 2025 15:13:49 -0800 Subject: [PATCH 049/119] renaming --- src/real-numbers/dedekind-real-numbers.lagda.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/real-numbers/dedekind-real-numbers.lagda.md b/src/real-numbers/dedekind-real-numbers.lagda.md index e68152a823..4c2e2f5a10 100644 --- a/src/real-numbers/dedekind-real-numbers.lagda.md +++ b/src/real-numbers/dedekind-real-numbers.lagda.md @@ -438,10 +438,11 @@ module _ (lx : lower-ℝ l) where - has-upper-real-Prop : Prop (lsuc l) - pr1 has-upper-real-Prop = Σ (upper-ℝ l) (is-dedekind-lower-upper-ℝ lx) - pr2 has-upper-real-Prop = - ( is-prop-all-elements-equal) + is-dedekind-cut-lower-ℝ-Prop : Prop (lsuc l) + pr1 is-dedekind-cut-lower-ℝ-Prop = + Σ (upper-ℝ l) (is-dedekind-lower-upper-ℝ lx) + pr2 is-dedekind-cut-lower-ℝ-Prop = + is-prop-all-elements-equal ( λ uy uy' → eq-type-subtype ( is-dedekind-prop-lower-upper-ℝ lx) @@ -451,7 +452,7 @@ module _ ( eq-upper-cut-eq-lower-cut-ℝ (lx , uy) (lx , uy') refl))) is-emb-lower-real : {l : Level} → is-emb (lower-real-ℝ {l}) -is-emb-lower-real = is-emb-inclusion-subtype has-upper-real-Prop +is-emb-lower-real = is-emb-inclusion-subtype is-dedekind-cut-lower-ℝ-Prop ``` ### Two real numbers with the same lower/upper real are equal @@ -462,7 +463,7 @@ module _ where eq-eq-lower-real-ℝ : lower-real-ℝ x = lower-real-ℝ y → x = y - eq-eq-lower-real-ℝ = eq-type-subtype has-upper-real-Prop + eq-eq-lower-real-ℝ = eq-type-subtype is-dedekind-cut-lower-ℝ-Prop eq-eq-upper-real-ℝ : upper-real-ℝ x = upper-real-ℝ y → x = y eq-eq-upper-real-ℝ = eq-eq-lower-real-ℝ ∘ (eq-lower-real-eq-upper-real-ℝ x y) From b9f1d27f130763fb7032f777d3f81bbaac03e361 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 13 Feb 2025 15:29:01 -0800 Subject: [PATCH 050/119] Fix formatting --- src/order-theory.lagda.md | 3 +++ .../dependent-products-large-inflattices.lagda.md | 13 +++++++------ src/order-theory/large-inflattices.lagda.md | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/order-theory.lagda.md b/src/order-theory.lagda.md index f285009bbb..349f62993a 100644 --- a/src/order-theory.lagda.md +++ b/src/order-theory.lagda.md @@ -25,6 +25,7 @@ open import order-theory.decidable-total-preorders public open import order-theory.deflationary-maps-posets public open import order-theory.deflationary-maps-preorders public open import order-theory.dependent-products-large-frames public +open import order-theory.dependent-products-large-inflattices public open import order-theory.dependent-products-large-locales public open import order-theory.dependent-products-large-meet-semilattices public open import order-theory.dependent-products-large-posets public @@ -62,6 +63,8 @@ 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 +open import order-theory.large-inflattices public +open import order-theory.large-join-semilattices public open import order-theory.large-locales public open import order-theory.large-meet-semilattices public open import order-theory.large-meet-subsemilattices public diff --git a/src/order-theory/dependent-products-large-inflattices.lagda.md b/src/order-theory/dependent-products-large-inflattices.lagda.md index ce0ed317b2..7078f31b85 100644 --- a/src/order-theory/dependent-products-large-inflattices.lagda.md +++ b/src/order-theory/dependent-products-large-inflattices.lagda.md @@ -12,18 +12,18 @@ open import foundation.sets open import foundation.universe-levels open import order-theory.dependent-products-large-posets -open import order-theory.large-posets -open import order-theory.large-inflattices open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.large-inflattices +open import order-theory.large-posets ```
## Idea -Families of greatest lower bounds of families of elements in dependent products of -large posets are again greatest lower bounds. Therefore it follows that dependent -products of large inflattices are again large inflattices. +Families of greatest lower bounds of families of elements in dependent products +of large posets are again greatest lower bounds. Therefore it follows that +dependent products of large inflattices are again large inflattices. ## Definitions @@ -126,7 +126,8 @@ module _ {l2 l3 l4 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) → type-Π-Large-Inflattice l4 → UUω is-greatest-lower-bound-family-of-elements-Π-Large-Inflattice = - is-greatest-lower-bound-family-of-elements-Large-Inflattice Π-Large-Inflattice + is-greatest-lower-bound-family-of-elements-Large-Inflattice + ( Π-Large-Inflattice) is-greatest-lower-bound-inf-Π-Large-Inflattice : {l2 l3 : Level} {J : UU l2} (x : J → type-Π-Large-Inflattice l3) → diff --git a/src/order-theory/large-inflattices.lagda.md b/src/order-theory/large-inflattices.lagda.md index ca07a05342..d699e66af6 100644 --- a/src/order-theory/large-inflattices.lagda.md +++ b/src/order-theory/large-inflattices.lagda.md @@ -16,11 +16,11 @@ open import foundation.propositions open import foundation.sets open import foundation.universe-levels -open import order-theory.large-posets open import order-theory.greatest-lower-bounds-large-posets -open import order-theory.posets open import order-theory.inflattices +open import order-theory.large-posets open import order-theory.lower-bounds-large-posets +open import order-theory.posets ``` From 36731631bde357cfda2527326f45a3d388ab945f Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 13 Feb 2025 15:58:03 -0800 Subject: [PATCH 051/119] make pre-commit --- ...thmetically-located-dedekind-cuts.lagda.md | 8 ++++---- .../dedekind-real-numbers.lagda.md | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md index aaba62504f..f290bbe754 100644 --- a/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md +++ b/src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md @@ -46,10 +46,10 @@ A pair of a [lower Dedekind real](real-numbers.lower-dedekind-real-numbers.md) `L` and an [upper Dedekind real](real-numbers.upper-dedekind-real-numbers.md) `U` is {{#concept "arithmetically located" Disambiguation="Dedekind cut"}} if for any positive [rational number](elementary-number-theory.rational-numbers.md) -`ε : ℚ`, there exists `p, q : ℚ` where `p ∈ L` and `q ∈ U`, such that `0 < q - p < ε`. -Intuitively, when `L , U` represent the cuts of a real number `x`, `p` and `q` -are rational approximations of `x` to within `ε`. This follows parts of Section -11 in {{#cite BauerTaylor2009}}. +`ε : ℚ`, there exists `p, q : ℚ` where `p ∈ L` and `q ∈ U`, such that +`0 < q - p < ε`. Intuitively, when `L , U` represent the cuts of a real number +`x`, `p` and `q` are rational approximations of `x` to within `ε`. This follows +parts of Section 11 in {{#cite BauerTaylor2009}}. ## Definitions diff --git a/src/real-numbers/dedekind-real-numbers.lagda.md b/src/real-numbers/dedekind-real-numbers.lagda.md index 4c2e2f5a10..3b6c9ce2bc 100644 --- a/src/real-numbers/dedekind-real-numbers.lagda.md +++ b/src/real-numbers/dedekind-real-numbers.lagda.md @@ -50,17 +50,22 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea -A {{#concept "Dedekind real number" WD="real number" WDID=Q12916 Agda=ℝ}} `x` consists of a [pair](foundation.dependent-pair-types.md) - of _cuts_ `(L , U)` of [rational numbers](elementary-number-theory.rational-numbers.md), a +A {{#concept "Dedekind real number" WD="real number" WDID=Q12916 Agda=ℝ}} `x` +consists of a [pair](foundation.dependent-pair-types.md) of _cuts_ `(L , U)` of +[rational numbers](elementary-number-theory.rational-numbers.md), a [lower Dedekind cut](real-numbers.lower-dedekind-real-numbers.md) `L` and an -[upper Dedekind cut](real-numbers.upper-dedekind-real-numbers.md) `U`. These cuts present lower and upper bounds on the Dedekind real number, and must satisfy the conditions +[upper Dedekind cut](real-numbers.upper-dedekind-real-numbers.md) `U`. These +cuts present lower and upper bounds on the Dedekind real number, and must +satisfy the conditions 1. _Disjointness_. The cuts `lx` and `uy` are disjoint subsets of `ℚ`. -2. _Locatedness_. If `q < r` then `q` is in the cut `L` or `r` is in the cut `U`. +2. _Locatedness_. If `q < r` then `q` is in the cut `L` or `r` is in the cut + `U`. -The {{#concept "collection of all Dedekind real numbers" WD="set of real numbers" WDID=Q1174982 Agda=ℝ}} is denoted `ℝ`. -The Dedekind real numbers will be taken as the standard definition of the real -numbers in the agda-unimath library. +The +{{#concept "collection of all Dedekind real numbers" WD="set of real numbers" WDID=Q1174982 Agda=ℝ}} +is denoted `ℝ`. The Dedekind real numbers will be taken as the standard +definition of the real numbers in the agda-unimath library. ## Definition From 324595aba9740dec0caaae65e69922c4fb08631e Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 13 Feb 2025 16:02:06 -0800 Subject: [PATCH 052/119] Respond to review comments --- src/real-numbers/lower-dedekind-real-numbers.lagda.md | 8 ++++---- src/real-numbers/upper-dedekind-real-numbers.lagda.md | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index db4cf96ad6..ddae49559d 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -33,10 +33,10 @@ open import foundation.universe-levels ## Idea -A {{#concept "lower Dedekind cut" Agda=is-lower-dedekind-cut}} consists of a -[subtype](foundation-core.subtypes.md) `L` of -[the rational numbers](elementary-number-theory.rational-numbers.md) `ℚ`, -satisfying the following two conditions: +A [subtype](foundation-core.subtypes.md) `L` of +[the rational numbers](elementary-number-theory.rational-numbers.md) is a +{{#concept "lower Dedekind cut" Agda=is-lower-dedekind-cut}} if it satisfies the +following two conditions: 1. _Inhabitedness_. `L` is [inhabited](foundation.inhabited-subtypes.md). 2. _Roundedness_. A rational number `q` is in `L` diff --git a/src/real-numbers/upper-dedekind-real-numbers.lagda.md b/src/real-numbers/upper-dedekind-real-numbers.lagda.md index 83d2328e84..da99075a67 100644 --- a/src/real-numbers/upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/upper-dedekind-real-numbers.lagda.md @@ -33,10 +33,10 @@ open import foundation.universe-levels ## Idea -An {{#concept "upper Dedekind cut" Agda=is-upper-dedekind-cut}} consists of a -[subtype](foundation-core.subtypes.md) `U` of -[the rational numbers](elementary-number-theory.rational-numbers.md) `ℚ`, -satisfying the following two conditions: +A [subtype](foundation-core.subtypes.md) `U` of +[the rational numbers](elementary-number-theory.rational-numbers.md) is an +{{#concept "upper Dedekind cut" Agda=is-upper-dedekind-cut}} if it satisfies the +following two conditions: 1. _Inhabitedness_. `U` is [inhabited](foundation.inhabited-subtypes.md). 2. _Roundedness_. A rational number `q` is in `U` From 10a0a3612d92e4893433fcbdedf8d7a8d23d58c1 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 13 Feb 2025 16:06:06 -0800 Subject: [PATCH 053/119] Inline explanations of lower and upper cuts --- src/real-numbers/dedekind-real-numbers.lagda.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/real-numbers/dedekind-real-numbers.lagda.md b/src/real-numbers/dedekind-real-numbers.lagda.md index 3b6c9ce2bc..912f8f9676 100644 --- a/src/real-numbers/dedekind-real-numbers.lagda.md +++ b/src/real-numbers/dedekind-real-numbers.lagda.md @@ -54,8 +54,15 @@ A {{#concept "Dedekind real number" WD="real number" WDID=Q12916 Agda=ℝ}} `x` consists of a [pair](foundation.dependent-pair-types.md) of _cuts_ `(L , U)` of [rational numbers](elementary-number-theory.rational-numbers.md), a [lower Dedekind cut](real-numbers.lower-dedekind-real-numbers.md) `L` and an -[upper Dedekind cut](real-numbers.upper-dedekind-real-numbers.md) `U`. These -cuts present lower and upper bounds on the Dedekind real number, and must +[upper Dedekind cut](real-numbers.upper-dedekind-real-numbers.md) `U`. A lower +Dedekind cut `L` is a subtype of the rational numbers that is +[inhabited](foundation.inhabited-subtypes.md) and rounded, meaning that `q ∈ L` +[if and only if](foundation.logical-equivalences.md) there exists `r`, with +`q < r` and `r ∈ L`. An upper Dedekind cut is a subtype of the rational numbers +that is inhabited and rounded "in the other direction": `q ∈ U` if and only if +there is a `p < q` where `p ∈ U`. + +These cuts present lower and upper bounds on the Dedekind real number, and must satisfy the conditions 1. _Disjointness_. The cuts `lx` and `uy` are disjoint subsets of `ℚ`. From 6430f86be2f1172423b78799be52cbdfc11075c5 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 13 Feb 2025 16:07:55 -0800 Subject: [PATCH 054/119] Reword --- .../dedekind-real-numbers.lagda.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/real-numbers/dedekind-real-numbers.lagda.md b/src/real-numbers/dedekind-real-numbers.lagda.md index 912f8f9676..3f83f4b510 100644 --- a/src/real-numbers/dedekind-real-numbers.lagda.md +++ b/src/real-numbers/dedekind-real-numbers.lagda.md @@ -54,13 +54,18 @@ A {{#concept "Dedekind real number" WD="real number" WDID=Q12916 Agda=ℝ}} `x` consists of a [pair](foundation.dependent-pair-types.md) of _cuts_ `(L , U)` of [rational numbers](elementary-number-theory.rational-numbers.md), a [lower Dedekind cut](real-numbers.lower-dedekind-real-numbers.md) `L` and an -[upper Dedekind cut](real-numbers.upper-dedekind-real-numbers.md) `U`. A lower -Dedekind cut `L` is a subtype of the rational numbers that is -[inhabited](foundation.inhabited-subtypes.md) and rounded, meaning that `q ∈ L` -[if and only if](foundation.logical-equivalences.md) there exists `r`, with -`q < r` and `r ∈ L`. An upper Dedekind cut is a subtype of the rational numbers -that is inhabited and rounded "in the other direction": `q ∈ U` if and only if -there is a `p < q` where `p ∈ U`. +[upper Dedekind cut](real-numbers.upper-dedekind-real-numbers.md) `U`. + +A lower Dedekind cut `L` is a subtype of the rational numbers that is + +1. [Inhabited](foundation.inhabited-subtypes.md), meaning it has at least one + element. +2. Rounded, meaning that `q ∈ L` + [if and only if](foundation.logical-equivalences.md) there exists `r`, with + `q < r` and `r ∈ L`. + +An upper Dedekind cut is analogous, but must be rounded "in the other +direction": `q ∈ U` if and only if there is a `p < q` where `p ∈ U`. These cuts present lower and upper bounds on the Dedekind real number, and must satisfy the conditions From 02e1fdcc1fc2da4193340849e5d103c6a009e3f9 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Thu, 13 Feb 2025 16:17:08 -0800 Subject: [PATCH 055/119] Typo fix --- src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md index 30cac717c6..32e2d2e472 100644 --- a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md @@ -188,7 +188,7 @@ module _ z≤min p (inr-disjunction y Date: Thu, 13 Feb 2025 16:36:26 -0800 Subject: [PATCH 056/119] Update src/order-theory/decidable-total-orders.lagda.md Co-authored-by: Fredrik Bakke --- src/order-theory/decidable-total-orders.lagda.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index 27b49bbad4..b0cdb583ea 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -200,11 +200,11 @@ module _ where min-Decidable-Total-Order : type-Decidable-Total-Order T - min-Decidable-Total-Order - with - is-leq-or-strict-greater-Decidable-Total-Order T x y - ... | inl x≤y = x - ... | inr y Date: Tue, 18 Feb 2025 08:56:09 -0800 Subject: [PATCH 057/119] Progress --- src/real-numbers.lagda.md | 1 + .../inequality-lower-dedekind-real-numbers.lagda.md | 2 ++ .../inequality-upper-dedekind-real-numbers.lagda.md | 4 +++- src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md | 1 + src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md | 2 +- src/real-numbers/upper-dedekind-real-numbers.lagda.md | 2 +- 6 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index 47788ce11a..d17b3218fc 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -16,6 +16,7 @@ open import real-numbers.maximum-lower-dedekind-real-numbers public open import real-numbers.maximum-upper-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public open import real-numbers.minimum-lower-dedekind-real-numbers public +open import real-numbers.minimum-upper-dedekind-real-numbers public open import real-numbers.negation-lower-upper-dedekind-real-numbers public open import real-numbers.negation-real-numbers public open import real-numbers.rational-lower-dedekind-real-numbers public diff --git a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md index cba2933eeb..a3fb22e1f5 100644 --- a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md @@ -1,6 +1,8 @@ # Inequality on the lower Dedekind real numbers ```agda +{-# OPTIONS --lossy-unification #-} + module real-numbers.inequality-lower-dedekind-real-numbers where ``` diff --git a/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md index 10cda8bb26..3dc717ec7f 100644 --- a/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md @@ -1,6 +1,8 @@ # Inequality on the upper Dedekind real numbers ```agda +{-# OPTIONS --lossy-unification #-} + module real-numbers.inequality-upper-dedekind-real-numbers where ``` @@ -22,9 +24,9 @@ open import foundation.subtypes open import foundation.unit-type open import foundation.universe-levels +open import order-theory.bottom-elements-large-posets open import order-theory.large-posets open import order-theory.large-preorders -open import order-theory.bottom-elements-large-posets open import real-numbers.rational-upper-dedekind-real-numbers open import real-numbers.upper-dedekind-real-numbers diff --git a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md index f5bbc158e3..814c74c965 100644 --- a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md @@ -26,6 +26,7 @@ open import logic.functoriality-existential-quantification open import order-theory.greatest-lower-bounds-large-posets open import order-theory.large-meet-semilattices +open import order-theory.lower-bounds-large-posets open import real-numbers.inequality-lower-dedekind-real-numbers open import real-numbers.lower-dedekind-real-numbers diff --git a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md index 32e2d2e472..ba1b3818ff 100644 --- a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md @@ -28,8 +28,8 @@ open import foundation.universe-levels open import logic.functoriality-existential-quantification -open import order-theory.large-inflattices open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.large-inflattices open import order-theory.lower-bounds-large-posets open import real-numbers.inequality-upper-dedekind-real-numbers diff --git a/src/real-numbers/upper-dedekind-real-numbers.lagda.md b/src/real-numbers/upper-dedekind-real-numbers.lagda.md index cc84752c80..9471785e56 100644 --- a/src/real-numbers/upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/upper-dedekind-real-numbers.lagda.md @@ -24,12 +24,12 @@ open import foundation.identity-types open import foundation.logical-equivalences open import foundation.powersets open import foundation.propositions -open import foundation.unit-type open import foundation.sets open import foundation.subtypes open import foundation.transport-along-identifications open import foundation.truncated-types open import foundation.truncation-levels +open import foundation.unit-type open import foundation.universal-quantification open import foundation.universe-levels ``` From 2276510796086661e5528e9857b0a624043049af Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 18 Feb 2025 16:02:02 -0800 Subject: [PATCH 058/119] Define minimum and maximum on real numbers --- .../maximum-real-numbers.lagda.md | 117 +++++++++++++++++ .../minimum-real-numbers.lagda.md | 118 ++++++++++++++++++ 2 files changed, 235 insertions(+) create mode 100644 src/real-numbers/maximum-real-numbers.lagda.md create mode 100644 src/real-numbers/minimum-real-numbers.lagda.md diff --git a/src/real-numbers/maximum-real-numbers.lagda.md b/src/real-numbers/maximum-real-numbers.lagda.md new file mode 100644 index 0000000000..83da3e003a --- /dev/null +++ b/src/real-numbers/maximum-real-numbers.lagda.md @@ -0,0 +1,117 @@ +# The maximum of real numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module real-numbers.maximum-real-numbers where +``` + +
Imports + +```agda +open import real-numbers.lower-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers +open import real-numbers.maximum-lower-dedekind-real-numbers +open import real-numbers.maximum-upper-dedekind-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.dedekind-real-numbers +open import foundation.empty-types +open import foundation.dependent-pair-types +open import foundation.propositions +open import foundation.disjunction +open import foundation.universe-levels +open import order-theory.least-upper-bounds-large-posets +open import order-theory.large-join-semilattices +``` + +
+ +## Idea + +The **binary maximum** of two +[Dedekind real numbers](real-numbers.dedekind-real-numbers) `x`, `y` +is a Dedekind real number with lower cut equal to the union of `x` and `y`'s +lower cuts, and upper cut equal to the intersection of their upper cuts. + +## Definition + +```agda +module _ + {l1 l2 : Level} + (x : ℝ l1) (y : ℝ l2) + where + + lower-real-binary-max-ℝ : lower-ℝ (l1 ⊔ l2) + lower-real-binary-max-ℝ = binary-max-lower-ℝ (lower-real-ℝ x) (lower-real-ℝ y) + + upper-real-binary-max-ℝ : upper-ℝ (l1 ⊔ l2) + upper-real-binary-max-ℝ = binary-max-upper-ℝ (upper-real-ℝ x) (upper-real-ℝ y) + + is-disjoint-lower-upper-binary-max-ℝ : + is-disjoint-lower-upper-ℝ lower-real-binary-max-ℝ upper-real-binary-max-ℝ + is-disjoint-lower-upper-binary-max-ℝ q (qImports + +```agda +open import real-numbers.lower-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers +open import real-numbers.minimum-lower-dedekind-real-numbers +open import real-numbers.minimum-upper-dedekind-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.dedekind-real-numbers +open import real-numbers.inequality-real-numbers +open import foundation.empty-types +open import foundation.dependent-pair-types +open import foundation.propositions +open import foundation.disjunction +open import foundation.universe-levels +open import order-theory.greatest-lower-bounds-large-posets +open import order-theory.large-meet-semilattices +``` + + + +## Idea + +The **binary minimum** of two +[Dedekind real numbers](real-numbers.dedekind-real-numbers) `x`, `y` +is a Dedekind real number with lower cut equal to the intersection of `x` and `y`'s +lower cuts, and upper cut equal to the union of their upper cuts. + +## Definition + +```agda +module _ + {l1 l2 : Level} + (x : ℝ l1) (y : ℝ l2) + where + + lower-real-binary-min-ℝ : lower-ℝ (l1 ⊔ l2) + lower-real-binary-min-ℝ = binary-min-lower-ℝ (lower-real-ℝ x) (lower-real-ℝ y) + + upper-real-binary-min-ℝ : upper-ℝ (l1 ⊔ l2) + upper-real-binary-min-ℝ = binary-min-upper-ℝ (upper-real-ℝ x) (upper-real-ℝ y) + + is-disjoint-lower-upper-binary-min-ℝ : + is-disjoint-lower-upper-ℝ lower-real-binary-min-ℝ upper-real-binary-min-ℝ + is-disjoint-lower-upper-binary-min-ℝ q ((q Date: Tue, 18 Feb 2025 16:03:39 -0800 Subject: [PATCH 059/119] make pre-commit --- src/real-numbers.lagda.md | 2 ++ .../maximum-real-numbers.lagda.md | 26 ++++++++++--------- .../minimum-real-numbers.lagda.md | 23 ++++++++-------- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index d17b3218fc..c40b9cf763 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -13,9 +13,11 @@ open import real-numbers.inequality-real-numbers public open import real-numbers.inequality-upper-dedekind-real-numbers public open import real-numbers.lower-dedekind-real-numbers public open import real-numbers.maximum-lower-dedekind-real-numbers public +open import real-numbers.maximum-real-numbers public open import real-numbers.maximum-upper-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public open import real-numbers.minimum-lower-dedekind-real-numbers public +open import real-numbers.minimum-real-numbers public open import real-numbers.minimum-upper-dedekind-real-numbers public open import real-numbers.negation-lower-upper-dedekind-real-numbers public open import real-numbers.negation-real-numbers public diff --git a/src/real-numbers/maximum-real-numbers.lagda.md b/src/real-numbers/maximum-real-numbers.lagda.md index 83da3e003a..1d32fc75ee 100644 --- a/src/real-numbers/maximum-real-numbers.lagda.md +++ b/src/real-numbers/maximum-real-numbers.lagda.md @@ -9,19 +9,21 @@ module real-numbers.maximum-real-numbers where
Imports ```agda -open import real-numbers.lower-dedekind-real-numbers -open import real-numbers.upper-dedekind-real-numbers -open import real-numbers.maximum-lower-dedekind-real-numbers -open import real-numbers.maximum-upper-dedekind-real-numbers -open import real-numbers.inequality-real-numbers -open import real-numbers.dedekind-real-numbers -open import foundation.empty-types open import foundation.dependent-pair-types -open import foundation.propositions open import foundation.disjunction +open import foundation.empty-types +open import foundation.propositions open import foundation.universe-levels -open import order-theory.least-upper-bounds-large-posets + open import order-theory.large-join-semilattices +open import order-theory.least-upper-bounds-large-posets + +open import real-numbers.dedekind-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.lower-dedekind-real-numbers +open import real-numbers.maximum-lower-dedekind-real-numbers +open import real-numbers.maximum-upper-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers ```
@@ -29,9 +31,9 @@ open import order-theory.large-join-semilattices ## Idea The **binary maximum** of two -[Dedekind real numbers](real-numbers.dedekind-real-numbers) `x`, `y` -is a Dedekind real number with lower cut equal to the union of `x` and `y`'s -lower cuts, and upper cut equal to the intersection of their upper cuts. +[Dedekind real numbers](real-numbers.dedekind-real-numbers) `x`, `y` is a +Dedekind real number with lower cut equal to the union of `x` and `y`'s lower +cuts, and upper cut equal to the intersection of their upper cuts. ## Definition diff --git a/src/real-numbers/minimum-real-numbers.lagda.md b/src/real-numbers/minimum-real-numbers.lagda.md index e72beb8d74..cada217260 100644 --- a/src/real-numbers/minimum-real-numbers.lagda.md +++ b/src/real-numbers/minimum-real-numbers.lagda.md @@ -9,20 +9,21 @@ module real-numbers.minimum-real-numbers where
Imports ```agda -open import real-numbers.lower-dedekind-real-numbers -open import real-numbers.upper-dedekind-real-numbers -open import real-numbers.minimum-lower-dedekind-real-numbers -open import real-numbers.minimum-upper-dedekind-real-numbers -open import real-numbers.inequality-real-numbers -open import real-numbers.dedekind-real-numbers -open import real-numbers.inequality-real-numbers -open import foundation.empty-types open import foundation.dependent-pair-types -open import foundation.propositions open import foundation.disjunction +open import foundation.empty-types +open import foundation.propositions open import foundation.universe-levels + open import order-theory.greatest-lower-bounds-large-posets open import order-theory.large-meet-semilattices + +open import real-numbers.dedekind-real-numbers +open import real-numbers.inequality-real-numbers +open import real-numbers.lower-dedekind-real-numbers +open import real-numbers.minimum-lower-dedekind-real-numbers +open import real-numbers.minimum-upper-dedekind-real-numbers +open import real-numbers.upper-dedekind-real-numbers ```
@@ -30,8 +31,8 @@ open import order-theory.large-meet-semilattices ## Idea The **binary minimum** of two -[Dedekind real numbers](real-numbers.dedekind-real-numbers) `x`, `y` -is a Dedekind real number with lower cut equal to the intersection of `x` and `y`'s +[Dedekind real numbers](real-numbers.dedekind-real-numbers) `x`, `y` is a +Dedekind real number with lower cut equal to the intersection of `x` and `y`'s lower cuts, and upper cut equal to the union of their upper cuts. ## Definition From e4ef49bb7925bfee5dd366428328eb147c4dc8eb Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 18 Feb 2025 16:40:23 -0800 Subject: [PATCH 060/119] make pre-commit --- src/real-numbers.lagda.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/real-numbers.lagda.md b/src/real-numbers.lagda.md index f5fb08d033..c40b9cf763 100644 --- a/src/real-numbers.lagda.md +++ b/src/real-numbers.lagda.md @@ -12,13 +12,10 @@ open import real-numbers.inequality-lower-dedekind-real-numbers public open import real-numbers.inequality-real-numbers public open import real-numbers.inequality-upper-dedekind-real-numbers public open import real-numbers.lower-dedekind-real-numbers public -open import real-numbers.inequality-upper-dedekind-real-numbers public -open import real-numbers.lower-dedekind-real-numbers public open import real-numbers.maximum-lower-dedekind-real-numbers public open import real-numbers.maximum-real-numbers public open import real-numbers.maximum-upper-dedekind-real-numbers public open import real-numbers.metric-space-of-real-numbers public -open import real-numbers.negation-lower-upper-dedekind-real-numbers public open import real-numbers.minimum-lower-dedekind-real-numbers public open import real-numbers.minimum-real-numbers public open import real-numbers.minimum-upper-dedekind-real-numbers public From f04c6fd124baee299c8c0806e827fb39501f9863 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 18 Feb 2025 17:04:48 -0800 Subject: [PATCH 061/119] Fix links --- src/real-numbers/maximum-real-numbers.lagda.md | 2 +- src/real-numbers/minimum-real-numbers.lagda.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/real-numbers/maximum-real-numbers.lagda.md b/src/real-numbers/maximum-real-numbers.lagda.md index 1d32fc75ee..76e734a07c 100644 --- a/src/real-numbers/maximum-real-numbers.lagda.md +++ b/src/real-numbers/maximum-real-numbers.lagda.md @@ -31,7 +31,7 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea The **binary maximum** of two -[Dedekind real numbers](real-numbers.dedekind-real-numbers) `x`, `y` is a +[Dedekind real numbers](real-numbers.dedekind-real-numbers.md) `x`, `y` is a Dedekind real number with lower cut equal to the union of `x` and `y`'s lower cuts, and upper cut equal to the intersection of their upper cuts. diff --git a/src/real-numbers/minimum-real-numbers.lagda.md b/src/real-numbers/minimum-real-numbers.lagda.md index cada217260..983909254f 100644 --- a/src/real-numbers/minimum-real-numbers.lagda.md +++ b/src/real-numbers/minimum-real-numbers.lagda.md @@ -31,7 +31,7 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea The **binary minimum** of two -[Dedekind real numbers](real-numbers.dedekind-real-numbers) `x`, `y` is a +[Dedekind real numbers](real-numbers.dedekind-real-numbers.md) `x`, `y` is a Dedekind real number with lower cut equal to the intersection of `x` and `y`'s lower cuts, and upper cut equal to the union of their upper cuts. From b4fb302847f2ab8a73f8b5b9c8dc96d1e524be74 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 18 Feb 2025 23:27:16 -0800 Subject: [PATCH 062/119] Fix md links --- .../maximum-lower-dedekind-real-numbers.lagda.md | 6 +++--- .../maximum-upper-dedekind-real-numbers.lagda.md | 6 +++--- .../minimum-lower-dedekind-real-numbers.lagda.md | 6 +++--- .../minimum-upper-dedekind-real-numbers.lagda.md | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md index fcc5e25746..cfbaacfd1a 100644 --- a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -41,9 +41,9 @@ open import real-numbers.lower-dedekind-real-numbers ## Idea The maximum of two -[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers) `x`, `y` -is a lower Dedekind real number with cut equal to the union of the cuts of `x` -and `y`. Unlike the case for the +[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x`, +`y` is a lower Dedekind real number with cut equal to the union of the cuts of +`x` and `y`. Unlike the case for the [minimum of lower Dedekind real numbers](real-numbers.minimum-lower-dedekind-real-numbers.md), the maximum of any inhabited family of lower Dedekind real numbers, the lower Dedekind real number by taking the union of the cuts of every element of the diff --git a/src/real-numbers/maximum-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-upper-dedekind-real-numbers.lagda.md index cc08b4d5cb..0d3b55b69b 100644 --- a/src/real-numbers/maximum-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-upper-dedekind-real-numbers.lagda.md @@ -42,9 +42,9 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea The maximum of two -[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers) `x`, `y` -is a upper Dedekind real number with cut equal to the intersection of the cuts -of `x` and `y`. +[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md) `x`, +`y` is a upper Dedekind real number with cut equal to the intersection of the +cuts of `x` and `y`. ## Definition diff --git a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md index 814c74c965..390ddf4cae 100644 --- a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md @@ -37,9 +37,9 @@ open import real-numbers.lower-dedekind-real-numbers ## Idea The minimum of two -[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers) `x`, `y` -is a lower Dedekind real number with cut equal to the intersection of the cuts -of `x` and `y`. +[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x`, +`y` is a lower Dedekind real number with cut equal to the intersection of the +cuts of `x` and `y`. The minimum of a family of lower Dedekind real numbers is not always a lower Dedekind real number. diff --git a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md index ba1b3818ff..b173e9d341 100644 --- a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md @@ -41,9 +41,9 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea The minimum of two -[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers) `x`, `y` -is a upper Dedekind real number with cut equal to the union of the cuts of `x` -and `y`. Unlike the case for the +[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md) `x`, +`y` is a upper Dedekind real number with cut equal to the union of the cuts of +`x` and `y`. Unlike the case for the [minimum of upper Dedekind real numbers](real-numbers.minimum-upper-dedekind-real-numbers.md), the minimum of any inhabited family of upper Dedekind real numbers, the upper Dedekind real number by taking the union of the cuts of every element of the From 87543f94831c14e463df74d10bd93b90711b007d Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sat, 22 Feb 2025 18:31:07 -0800 Subject: [PATCH 063/119] Add a bunch of stuff about reciprocals --- ...medean-property-integer-fractions.lagda.md | 40 ++++---- .../archimedean-property-integers.lagda.md | 61 ++++++------ ...himedean-property-natural-numbers.lagda.md | 26 ++--- ...roperty-positive-rational-numbers.lagda.md | 94 +++++++++++++++++++ ...imedean-property-rational-numbers.lagda.md | 55 ++++++----- ...roup-of-positive-rational-numbers.lagda.md | 33 ++++++- .../nonzero-natural-numbers.lagda.md | 55 +++++++++++ .../positive-integers.lagda.md | 7 ++ .../positive-rational-numbers.lagda.md | 70 +++++++++++++- 9 files changed, 358 insertions(+), 83 deletions(-) create mode 100644 src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md diff --git a/src/elementary-number-theory/archimedean-property-integer-fractions.lagda.md b/src/elementary-number-theory/archimedean-property-integer-fractions.lagda.md index 1d20da58d6..4565463b17 100644 --- a/src/elementary-number-theory/archimedean-property-integer-fractions.lagda.md +++ b/src/elementary-number-theory/archimedean-property-integer-fractions.lagda.md @@ -24,6 +24,7 @@ open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.identity-types open import foundation.transport-along-identifications +open import foundation.propositional-truncations ``` @@ -36,28 +37,31 @@ than `n` as an integer fraction times `x`. ```agda abstract + bound-archimedean-property-fraction-ℤ : + (x y : fraction-ℤ) → + is-positive-fraction-ℤ x → + Σ ℕ (λ n → le-fraction-ℤ y (in-fraction-ℤ (int-ℕ n) *fraction-ℤ x)) + bound-archimedean-property-fraction-ℤ + x@(px , qx , pos-qx) y@(py , qy , pos-qy) pos-px = + let + (n , H) = + bound-archimedean-property-ℤ + ( px *ℤ qy) + ( py *ℤ qx) + ( is-positive-mul-ℤ pos-px pos-qy) + in + n , + tr + ( le-ℤ (py *ℤ qx)) + ( inv (associative-mul-ℤ (int-ℕ n) px qy)) + ( H) + archimedean-property-fraction-ℤ : (x y : fraction-ℤ) → is-positive-fraction-ℤ x → exists ℕ (λ n → le-fraction-ℤ-Prop y (in-fraction-ℤ (int-ℕ n) *fraction-ℤ x)) - archimedean-property-fraction-ℤ - x@(px , qx , pos-qx) y@(py , qy , pos-qy) pos-px = - elim-exists - (∃ - ( ℕ) - ( λ n → - le-fraction-ℤ-Prop y (in-fraction-ℤ (int-ℕ n) *fraction-ℤ x))) - ( λ n H → - intro-exists - ( n) - ( tr - ( le-ℤ (py *ℤ qx)) - ( inv (associative-mul-ℤ (int-ℕ n) px qy)) - ( H))) - ( archimedean-property-ℤ - ( px *ℤ qy) - ( py *ℤ qx) - ( is-positive-mul-ℤ pos-px pos-qy)) + archimedean-property-fraction-ℤ x y pos-x = + unit-trunc-Prop (bound-archimedean-property-fraction-ℤ x y pos-x) ``` diff --git a/src/elementary-number-theory/archimedean-property-integers.lagda.md b/src/elementary-number-theory/archimedean-property-integers.lagda.md index 6973362cef..8383a82c31 100644 --- a/src/elementary-number-theory/archimedean-property-integers.lagda.md +++ b/src/elementary-number-theory/archimedean-property-integers.lagda.md @@ -25,7 +25,7 @@ open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.identity-types open import foundation.transport-along-identifications -open import foundation.unit-type +open import foundation.propositional-truncations ``` @@ -40,35 +40,40 @@ integer `y`, there is an `n : ℕ` such that `y < int-ℕ n *ℤ x`. ```agda abstract + bound-archimedean-property-ℤ : + (x y : ℤ) → is-positive-ℤ x → Σ ℕ (λ n → le-ℤ y (int-ℕ n *ℤ x)) + bound-archimedean-property-ℤ x y pos-x + with decide-is-negative-is-nonnegative-ℤ {y} + ... | inl neg-y = zero-ℕ , le-zero-is-negative-ℤ y neg-y + ... | inr nonneg-y = + let + (nx , nonzero-nx , nx=x) = pos-ℤ-to-ℕ x pos-x + (n , nyImports ```agda -open import elementary-number-theory.equality-natural-numbers open import elementary-number-theory.euclidean-division-natural-numbers open import elementary-number-theory.multiplication-natural-numbers open import elementary-number-theory.natural-numbers @@ -16,6 +15,7 @@ open import elementary-number-theory.strict-inequality-natural-numbers open import foundation.dependent-pair-types open import foundation.existential-quantification +open import foundation.propositional-truncations open import foundation.transport-along-identifications ``` @@ -31,19 +31,23 @@ for any nonzero natural number `x` and any natural number `y`, there is an ```agda abstract + bound-archimedean-property-ℕ : + (x y : ℕ) → is-nonzero-ℕ x → Σ ℕ (λ n → le-ℕ y (n *ℕ x)) + bound-archimedean-property-ℕ x y nonzero-x = + succ-ℕ (quotient-euclidean-division-ℕ x y) , + tr + ( λ z → z <-ℕ succ-ℕ (quotient-euclidean-division-ℕ x y) *ℕ x) + ( eq-euclidean-division-ℕ x y) + ( preserves-le-left-add-ℕ + ( quotient-euclidean-division-ℕ x y *ℕ x) + ( remainder-euclidean-division-ℕ x y) + ( x) + ( strict-upper-bound-remainder-euclidean-division-ℕ x y nonzero-x)) + archimedean-property-ℕ : (x y : ℕ) → is-nonzero-ℕ x → exists ℕ (λ n → le-ℕ-Prop y (n *ℕ x)) archimedean-property-ℕ x y nonzero-x = - intro-exists - (succ-ℕ (quotient-euclidean-division-ℕ x y)) - ( tr - ( λ z → z <-ℕ succ-ℕ (quotient-euclidean-division-ℕ x y) *ℕ x) - ( eq-euclidean-division-ℕ x y) - ( preserves-le-left-add-ℕ - ( quotient-euclidean-division-ℕ x y *ℕ x) - ( remainder-euclidean-division-ℕ x y) - ( x) - ( strict-upper-bound-remainder-euclidean-division-ℕ x y nonzero-x))) + unit-trunc-Prop (bound-archimedean-property-ℕ x y nonzero-x) ``` ## External links diff --git a/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md b/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md new file mode 100644 index 0000000000..2cc87734fb --- /dev/null +++ b/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md @@ -0,0 +1,94 @@ +# The Archimedean property of `ℚ⁺` + +```agda +{-# OPTIONS --lossy-unification #-} + +module elementary-number-theory.archimedean-property-positive-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.natural-numbers +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.nonzero-natural-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.multiplication-rational-numbers +open import elementary-number-theory.multiplicative-group-of-positive-rational-numbers +open import elementary-number-theory.archimedean-property-rational-numbers +open import elementary-number-theory.integers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.binary-transport +open import foundation.existential-quantification +open import foundation.propositional-truncations +open import foundation.dependent-pair-types +open import foundation.transport-along-identifications +open import foundation.identity-types +open import foundation.action-on-identifications-functions +``` + +
+ +## Definition + +The +{{#concept "Archimedean property" Disambiguation="positive rational numbers" Agda=archimedean-property-ℚ⁺}} +of `ℚ⁺` is that for any two +[positive rational numbers](elementary-number-theory.positive-rational-numbers.md) `x y : ℚ⁺`, +there is an `n : ℕ⁺` such that `y` is less than `n` as a rational number times `x`. + +```agda +abstract + bound-archimedean-property-ℚ⁺ : + (x y : ℚ⁺) → + Σ ℕ⁺ (λ n → le-ℚ⁺ y (positive-rational-ℕ⁺ n *ℚ⁺ x)) + bound-archimedean-property-ℚ⁺ (x , pos-x) (y , pos-y) = + let + (n , y @@ -38,9 +45,14 @@ proof that they are nonzero. nonzero-ℕ : UU lzero nonzero-ℕ = Σ ℕ is-nonzero-ℕ +ℕ⁺ : UU lzero +ℕ⁺ = nonzero-ℕ + nat-nonzero-ℕ : nonzero-ℕ → ℕ nat-nonzero-ℕ = pr1 +nat-ℕ⁺ = nat-nonzero-ℕ + is-nonzero-nat-nonzero-ℕ : (n : nonzero-ℕ) → is-nonzero-ℕ (nat-nonzero-ℕ n) is-nonzero-nat-nonzero-ℕ = pr2 ``` @@ -51,6 +63,8 @@ is-nonzero-nat-nonzero-ℕ = pr2 one-nonzero-ℕ : nonzero-ℕ pr1 one-nonzero-ℕ = 1 pr2 one-nonzero-ℕ = is-nonzero-one-ℕ + +one-ℕ⁺ = one-nonzero-ℕ ``` ### The successor function on the nonzero natural numbers @@ -77,3 +91,44 @@ quotient-div-nonzero-ℕ : pr1 (quotient-div-nonzero-ℕ d (pair x K) H) = quotient-div-ℕ d x H pr2 (quotient-div-nonzero-ℕ d (pair x K) H) = is-nonzero-quotient-div-ℕ H K ``` + +### Addition of nonzero natural numbers + +```agda +add-nonzero-ℕ : nonzero-ℕ → nonzero-ℕ → nonzero-ℕ +pr1 (add-nonzero-ℕ (p , p≠0) (q , q≠0)) = p +ℕ q +pr2 (add-nonzero-ℕ (succ-ℕ p , H) (succ-ℕ q , K)) () +pr2 (add-nonzero-ℕ (succ-ℕ p , H) (zero-ℕ , K)) = ex-falso (K refl) +pr2 (add-nonzero-ℕ (zero-ℕ , H) (q , K)) = ex-falso (H refl) + +_+ℕ⁺_ = add-nonzero-ℕ +``` + +### Multiplication of nonzero natural numbers + +```agda +mul-nonzero-ℕ : nonzero-ℕ → nonzero-ℕ → nonzero-ℕ +pr1 (mul-nonzero-ℕ (p , p≠0) (q , q≠0)) = p *ℕ q +pr2 (mul-nonzero-ℕ (p , p≠0) (q , q≠0)) pq=0 = + rec-coproduct p≠0 q≠0 (is-zero-summand-is-zero-mul-ℕ p q pq=0) + +_*ℕ⁺_ = mul-nonzero-ℕ +``` + +### Strict inequality on nonzero natural numbers + +```agda +le-ℕ⁺ : ℕ⁺ → ℕ⁺ → UU lzero +le-ℕ⁺ (p , _) (q , _) = le-ℕ p q +``` + +### Addition of nonzero natural numbers is a strictly inflationary map + +```agda +le-left-add-nat-ℕ⁺ : (m : ℕ) (n : ℕ⁺) → le-ℕ m (m +ℕ nat-ℕ⁺ n) +le-left-add-nat-ℕ⁺ m (n , n≠0) = + tr + ( λ p → le-ℕ p (m +ℕ n)) + ( right-unit-law-add-ℕ m) + ( preserves-le-left-add-ℕ m zero-ℕ n (le-is-nonzero-ℕ n n≠0)) +``` diff --git a/src/elementary-number-theory/positive-integers.lagda.md b/src/elementary-number-theory/positive-integers.lagda.md index 5ac772e16d..7c2c04b1ce 100644 --- a/src/elementary-number-theory/positive-integers.lagda.md +++ b/src/elementary-number-theory/positive-integers.lagda.md @@ -9,6 +9,7 @@ module elementary-number-theory.positive-integers where ```agda open import elementary-number-theory.integers open import elementary-number-theory.natural-numbers +open import elementary-number-theory.nonzero-natural-numbers open import elementary-number-theory.nonzero-integers open import foundation.action-on-identifications-functions @@ -75,6 +76,9 @@ subtype-positive-ℤ x = (is-positive-ℤ x , is-prop-is-positive-ℤ x) positive-ℤ : UU lzero positive-ℤ = type-subtype subtype-positive-ℤ +ℤ⁺ : UU lzero +ℤ⁺ = positive-ℤ + is-positive-eq-ℤ : {x y : ℤ} → x = y → is-positive-ℤ x → is-positive-ℤ y is-positive-eq-ℤ = tr is-positive-ℤ @@ -149,6 +153,9 @@ is-positive-int-is-nonzero-ℕ : (x : ℕ) → is-nonzero-ℕ x → is-positive-ℤ (int-ℕ x) is-positive-int-is-nonzero-ℕ zero-ℕ H = ex-falso (H refl) is-positive-int-is-nonzero-ℕ (succ-ℕ x) H = star + +positive-int-ℕ⁺ : ℕ⁺ → positive-ℤ +positive-int-ℕ⁺ (n , n≠0) = int-ℕ n , is-positive-int-is-nonzero-ℕ n n≠0 ``` ### The canonical equivalence between natural numbers and positive integers diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index 63ae446cfa..4a47b56c57 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -14,14 +14,17 @@ open import elementary-number-theory.addition-rational-numbers open import elementary-number-theory.additive-group-of-rational-numbers open import elementary-number-theory.cross-multiplication-difference-integer-fractions open import elementary-number-theory.difference-rational-numbers +open import elementary-number-theory.nonzero-natural-numbers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integer-fractions open import elementary-number-theory.multiplication-integers open import elementary-number-theory.multiplication-rational-numbers +open import elementary-number-theory.strict-inequality-integers open import elementary-number-theory.multiplicative-inverses-positive-integer-fractions open import elementary-number-theory.multiplicative-monoid-of-rational-numbers +open import elementary-number-theory.multiplication-positive-and-negative-integers open import elementary-number-theory.negative-integers open import elementary-number-theory.nonzero-rational-numbers open import elementary-number-theory.positive-and-negative-integers @@ -36,6 +39,7 @@ open import foundation.cartesian-product-types open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.empty-types +open import foundation.binary-transport open import foundation.equivalences open import foundation.existential-quantification open import foundation.function-types @@ -152,8 +156,19 @@ abstract (x : ℤ) → is-positive-ℤ x → is-positive-ℚ (rational-ℤ x) is-positive-rational-ℤ x P = P +positive-rational-positive-ℤ : positive-ℤ → ℚ⁺ +positive-rational-positive-ℤ (z , pos-z) = rational-ℤ z , pos-z + one-ℚ⁺ : ℚ⁺ -one-ℚ⁺ = (one-ℚ , is-positive-int-positive-ℤ one-positive-ℤ) +one-ℚ⁺ = positive-rational-positive-ℤ one-positive-ℤ +``` + +### Embedding of nonzero natural numbers in the positive rational numbers + +```agda +positive-rational-ℕ⁺ : ℕ⁺ → ℚ⁺ +positive-rational-ℕ⁺ n = + positive-rational-positive-ℤ (positive-int-ℕ⁺ n) ``` ### The rational image of a positive integer fraction is positive @@ -526,6 +541,59 @@ module _ ( left-diff-law-add-ℚ⁺) ``` +### Multiplication by a positive rational number preserves strict inequality + +```agda +preserves-le-left-mul-ℚ⁺ : + (p : ℚ⁺) (q r : ℚ) → le-ℚ q r → le-ℚ (rational-ℚ⁺ p *ℚ q) (rational-ℚ⁺ p *ℚ r) +preserves-le-left-mul-ℚ⁺ + p⁺@((p@(p-num , p-denom , p-denom-pos) , _) , p-num-pos) + q@((q-num , q-denom , _) , _) + r@((r-num , r-denom , _) , _) + q Date: Sat, 22 Feb 2025 22:08:17 -0800 Subject: [PATCH 064/119] Break out a section --- .../archimedean-property-positive-rational-numbers.lagda.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md b/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md index 2cc87734fb..4e9d9249a5 100644 --- a/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md @@ -67,7 +67,13 @@ abstract exists ℕ⁺ (λ n → le-prop-ℚ⁺ y (positive-rational-ℕ⁺ n *ℚ⁺ x)) archimedean-property-ℚ⁺ x y = unit-trunc-Prop (bound-archimedean-property-ℚ⁺ x y) +``` + +## Corollaries +### For every positive rational number, there is a smaller `1 / n` for a natural number n + +```agda smaller-reciprocal-ℚ⁺ : (q : ℚ⁺) → Σ ℕ⁺ (λ n → le-ℚ⁺ (positive-reciprocal-rational-ℕ⁺ n) q) smaller-reciprocal-ℚ⁺ q⁺@(q , _) = From a190827d076e38e8b8d99ba8b8ffe9ba3a6123fa Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 23 Feb 2025 13:37:32 -0800 Subject: [PATCH 065/119] make pre-commit --- src/elementary-number-theory.lagda.md | 1 + ...medean-property-integer-fractions.lagda.md | 2 +- .../archimedean-property-integers.lagda.md | 2 +- ...roperty-positive-rational-numbers.lagda.md | 21 ++++++++++--------- ...imedean-property-rational-numbers.lagda.md | 2 +- ...roup-of-positive-rational-numbers.lagda.md | 8 +++---- .../nonzero-natural-numbers.lagda.md | 8 +++---- .../positive-integers.lagda.md | 2 +- .../positive-rational-numbers.lagda.md | 8 +++---- 9 files changed, 28 insertions(+), 26 deletions(-) diff --git a/src/elementary-number-theory.lagda.md b/src/elementary-number-theory.lagda.md index 8c83736e27..550faf647d 100644 --- a/src/elementary-number-theory.lagda.md +++ b/src/elementary-number-theory.lagda.md @@ -20,6 +20,7 @@ open import elementary-number-theory.additive-group-of-rational-numbers public open import elementary-number-theory.archimedean-property-integer-fractions public open import elementary-number-theory.archimedean-property-integers public open import elementary-number-theory.archimedean-property-natural-numbers public +open import elementary-number-theory.archimedean-property-positive-rational-numbers public open import elementary-number-theory.archimedean-property-rational-numbers public open import elementary-number-theory.arithmetic-functions public open import elementary-number-theory.based-induction-natural-numbers public diff --git a/src/elementary-number-theory/archimedean-property-integer-fractions.lagda.md b/src/elementary-number-theory/archimedean-property-integer-fractions.lagda.md index 4565463b17..c28ab250d1 100644 --- a/src/elementary-number-theory/archimedean-property-integer-fractions.lagda.md +++ b/src/elementary-number-theory/archimedean-property-integer-fractions.lagda.md @@ -23,8 +23,8 @@ open import elementary-number-theory.strict-inequality-integers open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.identity-types -open import foundation.transport-along-identifications open import foundation.propositional-truncations +open import foundation.transport-along-identifications ``` diff --git a/src/elementary-number-theory/archimedean-property-integers.lagda.md b/src/elementary-number-theory/archimedean-property-integers.lagda.md index 8383a82c31..c96fb799cf 100644 --- a/src/elementary-number-theory/archimedean-property-integers.lagda.md +++ b/src/elementary-number-theory/archimedean-property-integers.lagda.md @@ -24,8 +24,8 @@ open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.identity-types -open import foundation.transport-along-identifications open import foundation.propositional-truncations +open import foundation.transport-along-identifications ``` diff --git a/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md b/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md index 4e9d9249a5..788bfa929e 100644 --- a/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md @@ -9,23 +9,23 @@ module elementary-number-theory.archimedean-property-positive-rational-numbers w
Imports ```agda +open import elementary-number-theory.archimedean-property-rational-numbers +open import elementary-number-theory.integers +open import elementary-number-theory.multiplication-rational-numbers +open import elementary-number-theory.multiplicative-group-of-positive-rational-numbers open import elementary-number-theory.natural-numbers -open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.nonzero-natural-numbers +open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers -open import elementary-number-theory.multiplication-rational-numbers -open import elementary-number-theory.multiplicative-group-of-positive-rational-numbers -open import elementary-number-theory.archimedean-property-rational-numbers -open import elementary-number-theory.integers open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.action-on-identifications-functions open import foundation.binary-transport +open import foundation.dependent-pair-types open import foundation.existential-quantification +open import foundation.identity-types open import foundation.propositional-truncations -open import foundation.dependent-pair-types open import foundation.transport-along-identifications -open import foundation.identity-types -open import foundation.action-on-identifications-functions ```
@@ -35,8 +35,9 @@ open import foundation.action-on-identifications-functions The {{#concept "Archimedean property" Disambiguation="positive rational numbers" Agda=archimedean-property-ℚ⁺}} of `ℚ⁺` is that for any two -[positive rational numbers](elementary-number-theory.positive-rational-numbers.md) `x y : ℚ⁺`, -there is an `n : ℕ⁺` such that `y` is less than `n` as a rational number times `x`. +[positive rational numbers](elementary-number-theory.positive-rational-numbers.md) +`x y : ℚ⁺`, there is an `n : ℕ⁺` such that `y` is less than `n` as a rational +number times `x`. ```agda abstract diff --git a/src/elementary-number-theory/archimedean-property-rational-numbers.lagda.md b/src/elementary-number-theory/archimedean-property-rational-numbers.lagda.md index 11d2a9cbb0..dc4fd7b441 100644 --- a/src/elementary-number-theory/archimedean-property-rational-numbers.lagda.md +++ b/src/elementary-number-theory/archimedean-property-rational-numbers.lagda.md @@ -21,10 +21,10 @@ open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.action-on-identifications-binary-functions open import foundation.binary-transport -open import foundation.propositional-truncations open import foundation.dependent-pair-types open import foundation.existential-quantification open import foundation.identity-types +open import foundation.propositional-truncations ``` diff --git a/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md b/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md index 13b0297543..7e37cee1c8 100644 --- a/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md @@ -9,16 +9,16 @@ module elementary-number-theory.multiplicative-group-of-positive-rational-number
Imports ```agda +open import elementary-number-theory.multiplication-integers open import elementary-number-theory.multiplication-rational-numbers open import elementary-number-theory.multiplicative-monoid-of-rational-numbers -open import elementary-number-theory.positive-rational-numbers -open import elementary-number-theory.rational-numbers open import elementary-number-theory.natural-numbers -open import elementary-number-theory.multiplication-integers open import elementary-number-theory.nonzero-natural-numbers +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-integers open import elementary-number-theory.strict-inequality-natural-numbers open import elementary-number-theory.strict-inequality-rational-numbers -open import elementary-number-theory.strict-inequality-integers open import foundation.binary-transport open import foundation.cartesian-product-types diff --git a/src/elementary-number-theory/nonzero-natural-numbers.lagda.md b/src/elementary-number-theory/nonzero-natural-numbers.lagda.md index 5de1850cbd..a0acc973d4 100644 --- a/src/elementary-number-theory/nonzero-natural-numbers.lagda.md +++ b/src/elementary-number-theory/nonzero-natural-numbers.lagda.md @@ -7,18 +7,18 @@ module elementary-number-theory.nonzero-natural-numbers where
Imports ```agda -open import elementary-number-theory.divisibility-natural-numbers -open import elementary-number-theory.natural-numbers open import elementary-number-theory.addition-natural-numbers +open import elementary-number-theory.divisibility-natural-numbers open import elementary-number-theory.multiplication-natural-numbers +open import elementary-number-theory.natural-numbers open import elementary-number-theory.strict-inequality-natural-numbers -open import foundation.transport-along-identifications open import foundation.coproduct-types open import foundation.dependent-pair-types +open import foundation.empty-types open import foundation.identity-types +open import foundation.transport-along-identifications open import foundation.universe-levels -open import foundation.empty-types ```
diff --git a/src/elementary-number-theory/positive-integers.lagda.md b/src/elementary-number-theory/positive-integers.lagda.md index 7c2c04b1ce..bc942b406f 100644 --- a/src/elementary-number-theory/positive-integers.lagda.md +++ b/src/elementary-number-theory/positive-integers.lagda.md @@ -9,8 +9,8 @@ module elementary-number-theory.positive-integers where ```agda open import elementary-number-theory.integers open import elementary-number-theory.natural-numbers -open import elementary-number-theory.nonzero-natural-numbers open import elementary-number-theory.nonzero-integers +open import elementary-number-theory.nonzero-natural-numbers open import foundation.action-on-identifications-functions open import foundation.coproduct-types diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index 4a47b56c57..78ae9a569d 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -14,32 +14,32 @@ open import elementary-number-theory.addition-rational-numbers open import elementary-number-theory.additive-group-of-rational-numbers open import elementary-number-theory.cross-multiplication-difference-integer-fractions open import elementary-number-theory.difference-rational-numbers -open import elementary-number-theory.nonzero-natural-numbers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integer-fractions open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.multiplication-positive-and-negative-integers open import elementary-number-theory.multiplication-rational-numbers -open import elementary-number-theory.strict-inequality-integers open import elementary-number-theory.multiplicative-inverses-positive-integer-fractions open import elementary-number-theory.multiplicative-monoid-of-rational-numbers -open import elementary-number-theory.multiplication-positive-and-negative-integers open import elementary-number-theory.negative-integers +open import elementary-number-theory.nonzero-natural-numbers open import elementary-number-theory.nonzero-rational-numbers open import elementary-number-theory.positive-and-negative-integers open import elementary-number-theory.positive-integer-fractions open import elementary-number-theory.positive-integers open import elementary-number-theory.rational-numbers open import elementary-number-theory.reduced-integer-fractions +open import elementary-number-theory.strict-inequality-integers open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.action-on-identifications-functions +open import foundation.binary-transport open import foundation.cartesian-product-types open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.empty-types -open import foundation.binary-transport open import foundation.equivalences open import foundation.existential-quantification open import foundation.function-types From 7e17e0a1d36956f2cc47ef27a9bdd3ccc3e9ec68 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 25 Feb 2025 15:43:10 -0800 Subject: [PATCH 066/119] Factor out unit fractions file --- ...roup-of-positive-rational-numbers.lagda.md | 24 ------------------- .../nonzero-natural-numbers.lagda.md | 8 +++++++ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md b/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md index 7e37cee1c8..f490892c4f 100644 --- a/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md @@ -90,27 +90,3 @@ abelian-group-mul-ℚ⁺ : Ab lzero pr1 abelian-group-mul-ℚ⁺ = group-mul-ℚ⁺ pr2 abelian-group-mul-ℚ⁺ = commutative-mul-ℚ⁺ ``` - -### Reciprocals of nonzero natural numbers - -```agda -positive-reciprocal-rational-ℕ⁺ : ℕ⁺ → ℚ⁺ -positive-reciprocal-rational-ℕ⁺ n = inv-ℚ⁺ (positive-rational-ℕ⁺ n) -``` - -### If `m < n`, the reciprocal of `n` is less than the reciprocal of `n` - -```agda -abstract - le-reciprocal-rational-ℕ⁺ : - (m n : ℕ⁺) → le-ℕ⁺ m n → - le-ℚ⁺ - ( positive-reciprocal-rational-ℕ⁺ n) - ( positive-reciprocal-rational-ℕ⁺ m) - le-reciprocal-rational-ℕ⁺ (m , pos-m) (n , pos-n) m Date: Tue, 25 Feb 2025 15:44:19 -0800 Subject: [PATCH 067/119] make pre-commit --- src/elementary-number-theory.lagda.md | 1 + .../nonzero-natural-numbers.lagda.md | 2 +- .../unit-fractions-rational-numbers.lagda.md | 77 +++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/elementary-number-theory/unit-fractions-rational-numbers.lagda.md diff --git a/src/elementary-number-theory.lagda.md b/src/elementary-number-theory.lagda.md index 550faf647d..495cbb3189 100644 --- a/src/elementary-number-theory.lagda.md +++ b/src/elementary-number-theory.lagda.md @@ -173,6 +173,7 @@ open import elementary-number-theory.triangular-numbers public open import elementary-number-theory.twin-prime-conjecture public open import elementary-number-theory.type-arithmetic-natural-numbers public open import elementary-number-theory.unit-elements-standard-finite-types public +open import elementary-number-theory.unit-fractions-rational-numbers public open import elementary-number-theory.unit-similarity-standard-finite-types public open import elementary-number-theory.universal-property-conatural-numbers public open import elementary-number-theory.universal-property-integers public diff --git a/src/elementary-number-theory/nonzero-natural-numbers.lagda.md b/src/elementary-number-theory/nonzero-natural-numbers.lagda.md index 7affe6bb11..478ce1cee4 100644 --- a/src/elementary-number-theory/nonzero-natural-numbers.lagda.md +++ b/src/elementary-number-theory/nonzero-natural-numbers.lagda.md @@ -9,10 +9,10 @@ module elementary-number-theory.nonzero-natural-numbers where ```agda open import elementary-number-theory.addition-natural-numbers open import elementary-number-theory.divisibility-natural-numbers +open import elementary-number-theory.inequality-natural-numbers open import elementary-number-theory.multiplication-natural-numbers open import elementary-number-theory.natural-numbers open import elementary-number-theory.strict-inequality-natural-numbers -open import elementary-number-theory.inequality-natural-numbers open import foundation.coproduct-types open import foundation.dependent-pair-types diff --git a/src/elementary-number-theory/unit-fractions-rational-numbers.lagda.md b/src/elementary-number-theory/unit-fractions-rational-numbers.lagda.md new file mode 100644 index 0000000000..ff0e9bafe7 --- /dev/null +++ b/src/elementary-number-theory/unit-fractions-rational-numbers.lagda.md @@ -0,0 +1,77 @@ +# Unit fractions in the rational numbers types + +```agda +module elementary-number-theory.unit-fractions-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.inequality-integers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.integers +open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.multiplicative-group-of-positive-rational-numbers +open import elementary-number-theory.natural-numbers +open import elementary-number-theory.nonzero-natural-numbers +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-integers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.binary-transport +open import foundation.dependent-pair-types +``` + +
+ +## Idea + +The {{#concept "unit fractions" WDID=Q255388 WD="unit fraction"}} are +[rational numbers](elementary-number-theory.rational-numbers.md) whose numerator +is 1 and whose denominator is a positive integer (or, equivalently, a positive +natural number). + +## Definition + +### Reciprocals of nonzero natural numbers + +```agda +positive-reciprocal-rational-ℕ⁺ : ℕ⁺ → ℚ⁺ +positive-reciprocal-rational-ℕ⁺ n = inv-ℚ⁺ (positive-rational-ℕ⁺ n) + +reciprocal-rational-ℕ⁺ : ℕ⁺ → ℚ +reciprocal-rational-ℕ⁺ n = rational-ℚ⁺ (positive-reciprocal-rational-ℕ⁺ n) +``` + +### If `m ≤ n`, the reciprocal of `n` is less than or equal to the reciprocal of `n` + +```agda +abstract + leq-reciprocal-rational-ℕ⁺ : + (m n : ℕ⁺) → leq-ℕ⁺ m n → + leq-ℚ (reciprocal-rational-ℕ⁺ n) (reciprocal-rational-ℕ⁺ m) + leq-reciprocal-rational-ℕ⁺ (m , pos-m) (n , pos-n) m≤n = + binary-tr + ( leq-ℤ) + ( left-unit-law-mul-ℤ (int-ℕ m)) + ( left-unit-law-mul-ℤ (int-ℕ n)) + ( leq-int-ℕ m n m≤n) +``` + +### If `m < n`, the reciprocal of `n` is less than the reciprocal of `n` + +```agda +abstract + le-reciprocal-rational-ℕ⁺ : + (m n : ℕ⁺) → le-ℕ⁺ m n → + le-ℚ⁺ + ( positive-reciprocal-rational-ℕ⁺ n) + ( positive-reciprocal-rational-ℕ⁺ m) + le-reciprocal-rational-ℕ⁺ (m , pos-m) (n , pos-n) m Date: Tue, 25 Feb 2025 15:55:16 -0800 Subject: [PATCH 068/119] Simplifications --- ...roperty-positive-rational-numbers.lagda.md | 35 ++----------------- .../unit-fractions-rational-numbers.lagda.md | 34 ++++++++++++++++++ 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md b/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md index 788bfa929e..341574d74b 100644 --- a/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/archimedean-property-positive-rational-numbers.lagda.md @@ -36,8 +36,9 @@ The {{#concept "Archimedean property" Disambiguation="positive rational numbers" Agda=archimedean-property-ℚ⁺}} of `ℚ⁺` is that for any two [positive rational numbers](elementary-number-theory.positive-rational-numbers.md) -`x y : ℚ⁺`, there is an `n : ℕ⁺` such that `y` is less than `n` as a rational -number times `x`. +`x y : ℚ⁺`, there is a +[nonzero natural number](elementary-number-theory.nonzero-natural-numbers.md) +`n` such that `y` is less than `n` as a rational number times `x`. ```agda abstract @@ -69,33 +70,3 @@ abstract archimedean-property-ℚ⁺ x y = unit-trunc-Prop (bound-archimedean-property-ℚ⁺ x y) ``` - -## Corollaries - -### For every positive rational number, there is a smaller `1 / n` for a natural number n - -```agda -smaller-reciprocal-ℚ⁺ : - (q : ℚ⁺) → Σ ℕ⁺ (λ n → le-ℚ⁺ (positive-reciprocal-rational-ℕ⁺ n) q) -smaller-reciprocal-ℚ⁺ q⁺@(q , _) = - let (n⁺ , 1 Date: Tue, 25 Feb 2025 15:58:34 -0800 Subject: [PATCH 069/119] make pre-commit --- .../unit-fractions-rational-numbers.lagda.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/elementary-number-theory/unit-fractions-rational-numbers.lagda.md b/src/elementary-number-theory/unit-fractions-rational-numbers.lagda.md index 7f42d6b695..8ac86b4014 100644 --- a/src/elementary-number-theory/unit-fractions-rational-numbers.lagda.md +++ b/src/elementary-number-theory/unit-fractions-rational-numbers.lagda.md @@ -9,26 +9,25 @@ module elementary-number-theory.unit-fractions-rational-numbers where
Imports ```agda +open import elementary-number-theory.archimedean-property-positive-rational-numbers open import elementary-number-theory.inequality-integers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.multiplication-rational-numbers open import elementary-number-theory.multiplicative-group-of-positive-rational-numbers -open import elementary-number-theory.natural-numbers open import elementary-number-theory.nonzero-natural-numbers open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers -open import elementary-number-theory.multiplication-rational-numbers open import elementary-number-theory.strict-inequality-integers open import elementary-number-theory.strict-inequality-rational-numbers -open import elementary-number-theory.archimedean-property-positive-rational-numbers - -open import group-theory.groups open import foundation.action-on-identifications-functions open import foundation.binary-transport -open import foundation.identity-types open import foundation.dependent-pair-types +open import foundation.functoriality-dependent-pair-types + +open import group-theory.groups ```
@@ -92,20 +91,21 @@ abstract smaller-reciprocal-ℚ⁺ : (q : ℚ⁺) → Σ ℕ⁺ (λ n → le-ℚ⁺ (positive-reciprocal-rational-ℕ⁺ n) q) smaller-reciprocal-ℚ⁺ q⁺@(q , _) = - let (n⁺ , 1 Date: Tue, 25 Feb 2025 18:47:15 -0800 Subject: [PATCH 070/119] Revert multiplicative group --- ...tiplicative-group-of-positive-rational-numbers.lagda.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md b/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md index f490892c4f..5c6d0553be 100644 --- a/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/multiplicative-group-of-positive-rational-numbers.lagda.md @@ -9,18 +9,11 @@ module elementary-number-theory.multiplicative-group-of-positive-rational-number
Imports ```agda -open import elementary-number-theory.multiplication-integers open import elementary-number-theory.multiplication-rational-numbers open import elementary-number-theory.multiplicative-monoid-of-rational-numbers -open import elementary-number-theory.natural-numbers -open import elementary-number-theory.nonzero-natural-numbers open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers -open import elementary-number-theory.strict-inequality-integers -open import elementary-number-theory.strict-inequality-natural-numbers -open import elementary-number-theory.strict-inequality-rational-numbers -open import foundation.binary-transport open import foundation.cartesian-product-types open import foundation.dependent-pair-types open import foundation.identity-types From 3940e6de549a919dc7ac91e95190a63c9606ed81 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 25 Feb 2025 19:25:30 -0800 Subject: [PATCH 071/119] Beginnings --- ...closed-intervals-rational-numbers.lagda.md | 67 +++++++++++++++++++ .../inequality-rational-numbers.lagda.md | 3 + 2 files changed, 70 insertions(+) create mode 100644 src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md diff --git a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md new file mode 100644 index 0000000000..210469eb5f --- /dev/null +++ b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md @@ -0,0 +1,67 @@ +# Closed intervals of rational numbers + +```agda +module elementary-number-theory.closed-intervals-rational-numbers where +``` + +
Imports + +```agda +open import foundation.cartesian-product-types +open import foundation.dependent-pair-types +open import foundation.subtypes +open import foundation.propositions +open import foundation.conjunction +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.universe-levels +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.multiplication-rational-numbers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.minimum-rational-numbers +open import elementary-number-theory.maximum-rational-numbers +``` + +
+ +## Idea + +## Definition + +```agda +module _ + (a b : ℚ) + where + + closed-interval-ℚ : subtype lzero ℚ + closed-interval-ℚ q = leq-ℚ-Prop a q ∧ leq-ℚ-Prop q b + + is-in-closed-interval-ℚ : ℚ → UU lzero + is-in-closed-interval-ℚ q = type-Prop (closed-interval-ℚ q) + +module _ + (a b : ℚ) + where + + unordered-closed-interval-ℚ : subtype lzero ℚ + unordered-closed-interval-ℚ = closed-interval-ℚ (min-ℚ a b) (max-ℚ a b) + + is-in-unordered-closed-interval-ℚ : ℚ → UU lzero + is-in-unordered-closed-interval-ℚ q = + type-Prop (unordered-closed-interval-ℚ q) +``` + +## Properties + +```agda +right-mul-closed-interval-ℚ : + (a b p q : ℚ) → is-in-closed-interval-ℚ a b p → + is-in-unordered-closed-interval-ℚ (a *ℚ q) (b *ℚ q) (p *ℚ q) +right-mul-closed-interval-ℚ a b p q (a≤p , p≤b) = + trichotomy-le-ℚ + q + zero-ℚ + {! !} + ( λ q=0 → {! !}) + {! !} +``` diff --git a/src/elementary-number-theory/inequality-rational-numbers.lagda.md b/src/elementary-number-theory/inequality-rational-numbers.lagda.md index 12ddd6f34a..5426edd268 100644 --- a/src/elementary-number-theory/inequality-rational-numbers.lagda.md +++ b/src/elementary-number-theory/inequality-rational-numbers.lagda.md @@ -98,6 +98,9 @@ leq-ℚ-Decidable-Prop x y = refl-leq-ℚ : (x : ℚ) → leq-ℚ x x refl-leq-ℚ x = refl-leq-ℤ (numerator-ℚ x *ℤ denominator-ℚ x) + +leq-eq-ℚ : (x y : ℚ) → x = y → leq-ℚ x y +leq-eq-ℚ x y x=y = tr (leq-ℚ x) x=y (refl-leq-ℚ x) ``` ### Inequality on the rational numbers is antisymmetric From 8d43badd3a4f86554c3d994ec2b7daa0c109930c Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 25 Feb 2025 19:27:52 -0800 Subject: [PATCH 072/119] Progress --- .../positive-rational-numbers.lagda.md | 119 +++++++++++++++++- 1 file changed, 115 insertions(+), 4 deletions(-) diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index 63ae446cfa..4d7b4ec280 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -19,19 +19,23 @@ open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integer-fractions open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.multiplication-positive-and-negative-integers open import elementary-number-theory.multiplication-rational-numbers open import elementary-number-theory.multiplicative-inverses-positive-integer-fractions open import elementary-number-theory.multiplicative-monoid-of-rational-numbers open import elementary-number-theory.negative-integers +open import elementary-number-theory.nonzero-natural-numbers open import elementary-number-theory.nonzero-rational-numbers open import elementary-number-theory.positive-and-negative-integers open import elementary-number-theory.positive-integer-fractions open import elementary-number-theory.positive-integers open import elementary-number-theory.rational-numbers open import elementary-number-theory.reduced-integer-fractions +open import elementary-number-theory.strict-inequality-integers open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.action-on-identifications-functions +open import foundation.binary-transport open import foundation.cartesian-product-types open import foundation.coproduct-types open import foundation.dependent-pair-types @@ -152,8 +156,19 @@ abstract (x : ℤ) → is-positive-ℤ x → is-positive-ℚ (rational-ℤ x) is-positive-rational-ℤ x P = P +positive-rational-positive-ℤ : positive-ℤ → ℚ⁺ +positive-rational-positive-ℤ (z , pos-z) = rational-ℤ z , pos-z + one-ℚ⁺ : ℚ⁺ -one-ℚ⁺ = (one-ℚ , is-positive-int-positive-ℤ one-positive-ℤ) +one-ℚ⁺ = positive-rational-positive-ℤ one-positive-ℤ +``` + +### Embedding of nonzero natural numbers in the positive rational numbers + +```agda +positive-rational-ℕ⁺ : ℕ⁺ → ℚ⁺ +positive-rational-ℕ⁺ n = + positive-rational-positive-ℤ (positive-int-ℕ⁺ n) ``` ### The rational image of a positive integer fraction is positive @@ -453,6 +468,19 @@ is-prop-le-ℚ⁺ : (x y : ℚ⁺) → is-prop (le-ℚ⁺ x y) is-prop-le-ℚ⁺ x y = is-prop-type-Prop (le-prop-ℚ⁺ x y) ``` +### The inequality on positive rational numbers + +```agda +leq-prop-ℚ⁺ : ℚ⁺ → ℚ⁺ → Prop lzero +leq-prop-ℚ⁺ x y = leq-ℚ-Prop (rational-ℚ⁺ x) (rational-ℚ⁺ y) + +leq-ℚ⁺ : ℚ⁺ → ℚ⁺ → UU lzero +leq-ℚ⁺ x y = type-Prop (leq-prop-ℚ⁺ x y) + +is-prop-leq-ℚ⁺ : (x y : ℚ⁺) → is-prop (leq-ℚ⁺ x y) +is-prop-leq-ℚ⁺ x y = is-prop-type-Prop (leq-prop-ℚ⁺ x y) +``` + ### The sum of two positive rational numbers is greater than each of them ```agda @@ -526,6 +554,84 @@ module _ ( left-diff-law-add-ℚ⁺) ``` +### Multiplication by a positive rational number preserves strict inequality + +```agda +preserves-le-left-mul-ℚ⁺ : + (p : ℚ⁺) (q r : ℚ) → le-ℚ q r → le-ℚ (rational-ℚ⁺ p *ℚ q) (rational-ℚ⁺ p *ℚ r) +preserves-le-left-mul-ℚ⁺ + p⁺@((p@(p-num , p-denom , p-denom-pos) , _) , p-num-pos) + q@((q-num , q-denom , _) , _) + r@((r-num , r-denom , _) , _) + q Date: Tue, 25 Feb 2025 20:13:16 -0800 Subject: [PATCH 073/119] Progress --- ...closed-intervals-rational-numbers.lagda.md | 88 ++++++++++++++++--- .../inequality-integer-fractions.lagda.md | 16 ++++ .../inequality-integers.lagda.md | 11 +++ .../inequality-rational-numbers.lagda.md | 9 ++ .../maximum-rational-numbers.lagda.md | 12 +++ .../minimum-rational-numbers.lagda.md | 12 +++ .../positive-rational-numbers.lagda.md | 16 +++- 7 files changed, 152 insertions(+), 12 deletions(-) diff --git a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md index 210469eb5f..3e5bd8a2e6 100644 --- a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md +++ b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md @@ -1,6 +1,8 @@ # Closed intervals of rational numbers ```agda +{-# OPTIONS --lossy-unification #-} + module elementary-number-theory.closed-intervals-rational-numbers where ``` @@ -9,11 +11,18 @@ module elementary-number-theory.closed-intervals-rational-numbers where ```agda open import foundation.cartesian-product-types open import foundation.dependent-pair-types +open import foundation.action-on-identifications-functions +open import foundation.action-on-identifications-binary-functions open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.identity-types open import foundation.propositions +open import foundation.binary-transport open import foundation.conjunction open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers +open import order-theory.decidable-total-orders +open import elementary-number-theory.decidable-total-order-rational-numbers open import foundation.universe-levels open import elementary-number-theory.rational-numbers open import elementary-number-theory.multiplication-rational-numbers @@ -54,14 +63,73 @@ module _ ## Properties ```agda -right-mul-closed-interval-ℚ : - (a b p q : ℚ) → is-in-closed-interval-ℚ a b p → - is-in-unordered-closed-interval-ℚ (a *ℚ q) (b *ℚ q) (p *ℚ q) -right-mul-closed-interval-ℚ a b p q (a≤p , p≤b) = - trichotomy-le-ℚ - q - zero-ℚ - {! !} - ( λ q=0 → {! !}) - {! !} +abstract + right-mul-closed-interval-ℚ : + (a b p q : ℚ) → is-in-closed-interval-ℚ a b p → + is-in-unordered-closed-interval-ℚ (a *ℚ q) (b *ℚ q) (p *ℚ q) + right-mul-closed-interval-ℚ a b p q (a≤p , p≤b) = + trichotomy-le-ℚ + q + zero-ℚ + ( λ q<0 → + let + pos-neg-q = is-positive-le-zero-ℚ (neg-ℚ q) (neg-le-ℚ q zero-ℚ q<0) + neg-q⁺ : ℚ⁺ + neg-q⁺ = neg-ℚ q , pos-neg-q + leq-mul-negative : (x y : ℚ) → leq-ℚ x y → leq-ℚ (y *ℚ q) (x *ℚ q) + leq-mul-negative x y x≤y = + binary-tr + ( leq-ℚ) + ( ap neg-ℚ (right-negative-law-mul-ℚ y q) ∙ neg-neg-ℚ _) + ( ap neg-ℚ (right-negative-law-mul-ℚ y q) ∙ + a-neg-q≤b-neg-q = preserves-leq-right-mul-ℚ⁺ neg-q⁺ a b a≤b + a-neg-q≤p-neg-q = preserves-leq-right-mul-ℚ⁺ neg-q⁺ a p a≤p + p-neg-q≤b-neg-q = preserves-leq-right-mul-ℚ⁺ neg-q⁺ p b p≤b + bq≤aq : leq-ℚ (b *ℚ q) (a *ℚ q) + bq≤aq = + binary-tr + ( leq-ℚ) + ( ap neg-ℚ (right-negative-law-mul-ℚ b q) ∙ neg-neg-ℚ _) + ( ap neg-ℚ (right-negative-law-mul-ℚ a q) ∙ neg-neg-ℚ _) + ( neg-leq-ℚ (a *ℚ neg-ℚ q) (b *ℚ neg-ℚ q) a-neg-q≤b-neg-q) + min=bq = right-leq-left-min-ℚ (a *ℚ q) (b *ℚ q) bq≤aq + max=aq = right-leq-left-min-ℚ (a *ℚ q) (b *ℚ q) bq≤aq + pq≤aq = + binary-tr + ( leq-ℚ) + ( ap neg-ℚ (right-negative-law-mul-ℚ p q) ∙ neg-neg-ℚ _) + ( ap neg-ℚ (right-negative-law-mul-ℚ a q) ∙ neg-neg-ℚ _) + ( neg-leq-ℚ (a *ℚ neg-ℚ q) (p *ℚ neg-ℚ q) a-neg-q≤p-neg-q) + aq≤pq = + in {! !}) + ( λ q=0 → + let + aq=0 = ap (a *ℚ_) q=0 ∙ right-zero-law-mul-ℚ a + bq=0 = ap (b *ℚ_) q=0 ∙ right-zero-law-mul-ℚ b + pq=0 = ap (p *ℚ_) q=0 ∙ right-zero-law-mul-ℚ p + min=0 : min-ℚ (a *ℚ q) (b *ℚ q) = zero-ℚ + min=0 = ap-binary min-ℚ aq=0 bq=0 ∙ idempotent-min-ℚ zero-ℚ + max=0 : max-ℚ (a *ℚ q) (b *ℚ q) = zero-ℚ + max=0 = ap-binary max-ℚ aq=0 bq=0 ∙ idempotent-max-ℚ zero-ℚ + in + leq-eq-ℚ (min-ℚ (a *ℚ q) (b *ℚ q)) (p *ℚ q) (min=0 ∙ inv pq=0) , + leq-eq-ℚ (p *ℚ q) (max-ℚ (a *ℚ q) (b *ℚ q)) (pq=0 ∙ inv max=0)) + ( λ 0 Date: Tue, 25 Feb 2025 20:14:28 -0800 Subject: [PATCH 074/119] Progress --- ...closed-intervals-rational-numbers.lagda.md | 135 ------------------ 1 file changed, 135 deletions(-) delete mode 100644 src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md diff --git a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md deleted file mode 100644 index 3e5bd8a2e6..0000000000 --- a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md +++ /dev/null @@ -1,135 +0,0 @@ -# Closed intervals of rational numbers - -```agda -{-# OPTIONS --lossy-unification #-} - -module elementary-number-theory.closed-intervals-rational-numbers where -``` - -
Imports - -```agda -open import foundation.cartesian-product-types -open import foundation.dependent-pair-types -open import foundation.action-on-identifications-functions -open import foundation.action-on-identifications-binary-functions -open import foundation.subtypes -open import foundation.transport-along-identifications -open import foundation.identity-types -open import foundation.propositions -open import foundation.binary-transport -open import foundation.conjunction -open import elementary-number-theory.positive-rational-numbers -open import elementary-number-theory.strict-inequality-rational-numbers -open import order-theory.decidable-total-orders -open import elementary-number-theory.decidable-total-order-rational-numbers -open import foundation.universe-levels -open import elementary-number-theory.rational-numbers -open import elementary-number-theory.multiplication-rational-numbers -open import elementary-number-theory.inequality-rational-numbers -open import elementary-number-theory.minimum-rational-numbers -open import elementary-number-theory.maximum-rational-numbers -``` - -
- -## Idea - -## Definition - -```agda -module _ - (a b : ℚ) - where - - closed-interval-ℚ : subtype lzero ℚ - closed-interval-ℚ q = leq-ℚ-Prop a q ∧ leq-ℚ-Prop q b - - is-in-closed-interval-ℚ : ℚ → UU lzero - is-in-closed-interval-ℚ q = type-Prop (closed-interval-ℚ q) - -module _ - (a b : ℚ) - where - - unordered-closed-interval-ℚ : subtype lzero ℚ - unordered-closed-interval-ℚ = closed-interval-ℚ (min-ℚ a b) (max-ℚ a b) - - is-in-unordered-closed-interval-ℚ : ℚ → UU lzero - is-in-unordered-closed-interval-ℚ q = - type-Prop (unordered-closed-interval-ℚ q) -``` - -## Properties - -```agda -abstract - right-mul-closed-interval-ℚ : - (a b p q : ℚ) → is-in-closed-interval-ℚ a b p → - is-in-unordered-closed-interval-ℚ (a *ℚ q) (b *ℚ q) (p *ℚ q) - right-mul-closed-interval-ℚ a b p q (a≤p , p≤b) = - trichotomy-le-ℚ - q - zero-ℚ - ( λ q<0 → - let - pos-neg-q = is-positive-le-zero-ℚ (neg-ℚ q) (neg-le-ℚ q zero-ℚ q<0) - neg-q⁺ : ℚ⁺ - neg-q⁺ = neg-ℚ q , pos-neg-q - leq-mul-negative : (x y : ℚ) → leq-ℚ x y → leq-ℚ (y *ℚ q) (x *ℚ q) - leq-mul-negative x y x≤y = - binary-tr - ( leq-ℚ) - ( ap neg-ℚ (right-negative-law-mul-ℚ y q) ∙ neg-neg-ℚ _) - ( ap neg-ℚ (right-negative-law-mul-ℚ y q) ∙ - a-neg-q≤b-neg-q = preserves-leq-right-mul-ℚ⁺ neg-q⁺ a b a≤b - a-neg-q≤p-neg-q = preserves-leq-right-mul-ℚ⁺ neg-q⁺ a p a≤p - p-neg-q≤b-neg-q = preserves-leq-right-mul-ℚ⁺ neg-q⁺ p b p≤b - bq≤aq : leq-ℚ (b *ℚ q) (a *ℚ q) - bq≤aq = - binary-tr - ( leq-ℚ) - ( ap neg-ℚ (right-negative-law-mul-ℚ b q) ∙ neg-neg-ℚ _) - ( ap neg-ℚ (right-negative-law-mul-ℚ a q) ∙ neg-neg-ℚ _) - ( neg-leq-ℚ (a *ℚ neg-ℚ q) (b *ℚ neg-ℚ q) a-neg-q≤b-neg-q) - min=bq = right-leq-left-min-ℚ (a *ℚ q) (b *ℚ q) bq≤aq - max=aq = right-leq-left-min-ℚ (a *ℚ q) (b *ℚ q) bq≤aq - pq≤aq = - binary-tr - ( leq-ℚ) - ( ap neg-ℚ (right-negative-law-mul-ℚ p q) ∙ neg-neg-ℚ _) - ( ap neg-ℚ (right-negative-law-mul-ℚ a q) ∙ neg-neg-ℚ _) - ( neg-leq-ℚ (a *ℚ neg-ℚ q) (p *ℚ neg-ℚ q) a-neg-q≤p-neg-q) - aq≤pq = - in {! !}) - ( λ q=0 → - let - aq=0 = ap (a *ℚ_) q=0 ∙ right-zero-law-mul-ℚ a - bq=0 = ap (b *ℚ_) q=0 ∙ right-zero-law-mul-ℚ b - pq=0 = ap (p *ℚ_) q=0 ∙ right-zero-law-mul-ℚ p - min=0 : min-ℚ (a *ℚ q) (b *ℚ q) = zero-ℚ - min=0 = ap-binary min-ℚ aq=0 bq=0 ∙ idempotent-min-ℚ zero-ℚ - max=0 : max-ℚ (a *ℚ q) (b *ℚ q) = zero-ℚ - max=0 = ap-binary max-ℚ aq=0 bq=0 ∙ idempotent-max-ℚ zero-ℚ - in - leq-eq-ℚ (min-ℚ (a *ℚ q) (b *ℚ q)) (p *ℚ q) (min=0 ∙ inv pq=0) , - leq-eq-ℚ (p *ℚ q) (max-ℚ (a *ℚ q) (b *ℚ q)) (pq=0 ∙ inv max=0)) - ( λ 0 Date: Tue, 25 Feb 2025 20:47:20 -0800 Subject: [PATCH 075/119] Define negative integer fractions --- ...on-positive-and-negative-integers.lagda.md | 30 +++++ .../negative-integer-fractions.lagda.md | 117 ++++++++++++++++++ .../negative-rational-numbers.lagda.md | 112 +++++++++++++++++ .../positive-and-negative-integers.lagda.md | 9 ++ 4 files changed, 268 insertions(+) create mode 100644 src/elementary-number-theory/negative-integer-fractions.lagda.md create mode 100644 src/elementary-number-theory/negative-rational-numbers.lagda.md diff --git a/src/elementary-number-theory/multiplication-positive-and-negative-integers.lagda.md b/src/elementary-number-theory/multiplication-positive-and-negative-integers.lagda.md index a8c0e801c0..5e16129e00 100644 --- a/src/elementary-number-theory/multiplication-positive-and-negative-integers.lagda.md +++ b/src/elementary-number-theory/multiplication-positive-and-negative-integers.lagda.md @@ -24,6 +24,7 @@ open import foundation.dependent-pair-types open import foundation.empty-types open import foundation.identity-types open import foundation.unit-type +open import foundation.transport-along-identifications ```
@@ -302,6 +303,35 @@ is-nonnegative-right-factor-mul-ℤ {x} {y} H = ( is-nonnegative-eq-ℤ (commutative-mul-ℤ x y) H) ``` +### The left factor of a negative product with a positive right factor is negative + +```agda +abstract + is-negative-left-factor-mul-positive-ℤ : + {x y : ℤ} → is-negative-ℤ (x *ℤ y) → is-positive-ℤ y → is-negative-ℤ x + is-negative-left-factor-mul-positive-ℤ {inl x} {inr (inr y)} _ _ = star + is-negative-left-factor-mul-positive-ℤ {inr x} {inr (inr y)} H _ = + is-not-negative-and-nonnegative-ℤ + ( inr x *ℤ inr (inr y)) + ( H , + is-nonnegative-mul-nonnegative-positive-ℤ + { inr x} + { inr (inr y)} + ( star) + ( star)) +``` + +### The right factor of a negative product with a positive right factor is negative + +```agda +abstract + is-negative-right-factor-mul-positive-ℤ : + {x y : ℤ} → is-negative-ℤ (x *ℤ y) → is-positive-ℤ x → is-negative-ℤ y + is-negative-right-factor-mul-positive-ℤ {x} {y} xy-is-neg = + is-negative-left-factor-mul-positive-ℤ + ( tr is-negative-ℤ (commutative-mul-ℤ x y) xy-is-neg) +``` + ## Definitions ### Multiplication by a signed integer diff --git a/src/elementary-number-theory/negative-integer-fractions.lagda.md b/src/elementary-number-theory/negative-integer-fractions.lagda.md new file mode 100644 index 0000000000..cb650b5401 --- /dev/null +++ b/src/elementary-number-theory/negative-integer-fractions.lagda.md @@ -0,0 +1,117 @@ +# Negative integer fractions + +```agda +{-# OPTIONS --lossy-unification #-} + +module elementary-number-theory.negative-integer-fractions where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-integer-fractions +open import elementary-number-theory.addition-positive-and-negative-integers +open import elementary-number-theory.integer-fractions +open import elementary-number-theory.integers +open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.multiplication-integer-fractions +open import elementary-number-theory.multiplication-positive-and-negative-integers +open import elementary-number-theory.positive-integers +open import elementary-number-theory.negative-integers +open import elementary-number-theory.reduced-integer-fractions +open import elementary-number-theory.positive-integer-fractions + +open import foundation.propositions +open import foundation.identity-types +open import foundation.subtypes +open import foundation.universe-levels +``` + +
+ +## Idea + +An [integer fraction](elementary-number-theory.integer-fractions.md) `x` is said +to be +{{#concept "negative" Disambiguation="integer fraction" Agda=is-negative-fraction-ℤ}} +if its numerator is a +[negative integer](elementary-number-theory.negative-integers.md). + +## Definitions + +### The property of being a negative integer fraction + +```agda +module _ + (x : fraction-ℤ) + where + + is-negative-fraction-ℤ : UU lzero + is-negative-fraction-ℤ = is-negative-ℤ (numerator-fraction-ℤ x) + + is-prop-is-negative-fraction-ℤ : is-prop is-negative-fraction-ℤ + is-prop-is-negative-fraction-ℤ = + is-prop-is-negative-ℤ (numerator-fraction-ℤ x) +``` + +## Properties + +### An integer fraction similar to a negative integer fraction is negative + +```agda +is-negative-sim-fraction-ℤ : + (x y : fraction-ℤ) (S : sim-fraction-ℤ x y) → + is-negative-fraction-ℤ x → + is-negative-fraction-ℤ y +is-negative-sim-fraction-ℤ x y S N = + is-negative-right-factor-mul-positive-ℤ + ( is-negative-eq-ℤ + ( S ∙ + commutative-mul-ℤ (numerator-fraction-ℤ y) (denominator-fraction-ℤ x)) + ( is-negative-mul-negative-positive-ℤ + ( N) + ( is-positive-denominator-fraction-ℤ y))) + ( is-positive-denominator-fraction-ℤ x) +``` + +### The reduced fraction of a negative integer fraction is negative + +```agda +is-negative-reduce-fraction-ℤ : + {x : fraction-ℤ} (P : is-negative-fraction-ℤ x) → + is-negative-fraction-ℤ (reduce-fraction-ℤ x) +is-negative-reduce-fraction-ℤ {x} = + is-negative-sim-fraction-ℤ + ( x) + ( reduce-fraction-ℤ x) + ( sim-reduced-fraction-ℤ x) +``` + +### The sum of two negative integer fractions is negative + +```agda +is-negative-add-fraction-ℤ : + {x y : fraction-ℤ} → + is-negative-fraction-ℤ x → + is-negative-fraction-ℤ y → + is-negative-fraction-ℤ (add-fraction-ℤ x y) +is-negative-add-fraction-ℤ {x} {y} P Q = + is-negative-add-ℤ + ( is-negative-mul-negative-positive-ℤ + ( P) + ( is-positive-denominator-fraction-ℤ y)) + ( is-negative-mul-negative-positive-ℤ + ( Q) + ( is-positive-denominator-fraction-ℤ x)) +``` + +### The product of two negative integer fractions is positive + +```agda +is-positive-mul-negative-fraction-ℤ : + {x y : fraction-ℤ} → + is-negative-fraction-ℤ x → + is-negative-fraction-ℤ y → + is-positive-fraction-ℤ (mul-fraction-ℤ x y) +is-positive-mul-negative-fraction-ℤ = is-positive-mul-negative-ℤ +``` diff --git a/src/elementary-number-theory/negative-rational-numbers.lagda.md b/src/elementary-number-theory/negative-rational-numbers.lagda.md new file mode 100644 index 0000000000..fa10a1aaee --- /dev/null +++ b/src/elementary-number-theory/negative-rational-numbers.lagda.md @@ -0,0 +1,112 @@ +# Negative rational numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module elementary-number-theory.negative-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.integers +open import elementary-number-theory.negative-integers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.positive-rational-numbers +``` + +
+ +## Idea + +A [rational number](elementary-number-theory.rational-numbers.md) `x` is said to +be {{#concept "negative" Disambiguation="rational number" Agda=is-negative-ℚ}} +if its underlying fraction is negative. + +Positive rational numbers are a [subsemigroup](group-theory.subsemigroups.md) of +the +[additive monoid of rational numbers](elementary-number-theory.additive-group-of-rational-numbers.md). + +## Definitions + +### The property of being a negative rational number + +```agda +module _ + (x : ℚ) + where + + is-positive-ℚ : UU lzero + is-positive-ℚ = is-positive-fraction-ℤ (fraction-ℚ x) + + is-prop-is-positive-ℚ : is-prop is-positive-ℚ + is-prop-is-positive-ℚ = is-prop-is-positive-fraction-ℤ (fraction-ℚ x) + + is-positive-prop-ℚ : Prop lzero + pr1 is-positive-prop-ℚ = is-positive-ℚ + pr2 is-positive-prop-ℚ = is-prop-is-positive-ℚ +``` + +### The type of positive rational numbers + +```agda +positive-ℚ : UU lzero +positive-ℚ = type-subtype is-positive-prop-ℚ + +ℚ⁺ : UU lzero +ℚ⁺ = positive-ℚ + +module _ + (x : positive-ℚ) + where + + rational-ℚ⁺ : ℚ + rational-ℚ⁺ = pr1 x + + fraction-ℚ⁺ : fraction-ℤ + fraction-ℚ⁺ = fraction-ℚ rational-ℚ⁺ + + numerator-ℚ⁺ : ℤ + numerator-ℚ⁺ = numerator-ℚ rational-ℚ⁺ + + denominator-ℚ⁺ : ℤ + denominator-ℚ⁺ = denominator-ℚ rational-ℚ⁺ + + is-positive-rational-ℚ⁺ : is-positive-ℚ rational-ℚ⁺ + is-positive-rational-ℚ⁺ = pr2 x + + is-positive-fraction-ℚ⁺ : is-positive-fraction-ℤ fraction-ℚ⁺ + is-positive-fraction-ℚ⁺ = is-positive-rational-ℚ⁺ + + is-positive-numerator-ℚ⁺ : is-positive-ℤ numerator-ℚ⁺ + is-positive-numerator-ℚ⁺ = is-positive-rational-ℚ⁺ + + is-positive-denominator-ℚ⁺ : is-positive-ℤ denominator-ℚ⁺ + is-positive-denominator-ℚ⁺ = is-positive-denominator-ℚ rational-ℚ⁺ + +abstract + eq-ℚ⁺ : {x y : ℚ⁺} → rational-ℚ⁺ x = rational-ℚ⁺ y → x = y + eq-ℚ⁺ {x} {y} = eq-type-subtype is-positive-prop-ℚ +``` + +## Properties + +### The positive rational numbers form a set + +```agda +is-set-ℚ⁺ : is-set ℚ⁺ +is-set-ℚ⁺ = is-set-type-subtype is-positive-prop-ℚ is-set-ℚ +``` + +### The rational image of a positive integer is positive + +```agda +abstract + is-positive-rational-ℤ : + (x : ℤ) → is-positive-ℤ x → is-positive-ℚ (rational-ℤ x) + is-positive-rational-ℤ x P = P + +positive-rational-positive-ℤ : positive-ℤ → ℚ⁺ +positive-rational-positive-ℤ (z , pos-z) = rational-ℤ z , pos-z + +``` diff --git a/src/elementary-number-theory/positive-and-negative-integers.lagda.md b/src/elementary-number-theory/positive-and-negative-integers.lagda.md index 844b95a8b8..9f35831163 100644 --- a/src/elementary-number-theory/positive-and-negative-integers.lagda.md +++ b/src/elementary-number-theory/positive-and-negative-integers.lagda.md @@ -51,6 +51,15 @@ is-not-negative-and-positive-ℤ (inl x) (H , K) = K is-not-negative-and-positive-ℤ (inr x) (H , K) = H ``` +### No integer is both nonnegative and negative + +```agda +is-not-negative-and-nonnegative-ℤ : + (x : ℤ) → ¬ (is-negative-ℤ x × is-nonnegative-ℤ x) +is-not-negative-and-nonnegative-ℤ (inl x) (H , K) = K +is-not-negative-and-nonnegative-ℤ (inr x) (H , K) = H +``` + ### Dichotomies #### A nonzero integer is either negative or positive From ec218ba31520080524bbcb3a5334d4f9b02d3b4b Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 25 Feb 2025 21:45:22 -0800 Subject: [PATCH 076/119] Start on defining negative rationals --- .../negative-rational-numbers.lagda.md | 90 ++++++++++--------- 1 file changed, 49 insertions(+), 41 deletions(-) diff --git a/src/elementary-number-theory/negative-rational-numbers.lagda.md b/src/elementary-number-theory/negative-rational-numbers.lagda.md index fa10a1aaee..1e6b11b8d5 100644 --- a/src/elementary-number-theory/negative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/negative-rational-numbers.lagda.md @@ -13,6 +13,15 @@ open import elementary-number-theory.integers open import elementary-number-theory.negative-integers open import elementary-number-theory.rational-numbers open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.integer-fractions +open import elementary-number-theory.negative-integer-fractions +open import foundation.propositions +open import foundation.subtypes +open import foundation.universe-levels +open import foundation.dependent-pair-types +open import foundation.sets +open import foundation.identity-types +open import elementary-number-theory.positive-integers ```
@@ -36,77 +45,76 @@ module _ (x : ℚ) where - is-positive-ℚ : UU lzero - is-positive-ℚ = is-positive-fraction-ℤ (fraction-ℚ x) + is-negative-ℚ : UU lzero + is-negative-ℚ = is-negative-fraction-ℤ (fraction-ℚ x) - is-prop-is-positive-ℚ : is-prop is-positive-ℚ - is-prop-is-positive-ℚ = is-prop-is-positive-fraction-ℤ (fraction-ℚ x) + is-prop-is-negative-ℚ : is-prop is-negative-ℚ + is-prop-is-negative-ℚ = is-prop-is-negative-fraction-ℤ (fraction-ℚ x) - is-positive-prop-ℚ : Prop lzero - pr1 is-positive-prop-ℚ = is-positive-ℚ - pr2 is-positive-prop-ℚ = is-prop-is-positive-ℚ + is-negative-prop-ℚ : Prop lzero + pr1 is-negative-prop-ℚ = is-negative-ℚ + pr2 is-negative-prop-ℚ = is-prop-is-negative-ℚ ``` -### The type of positive rational numbers +### The type of negative rational numbers ```agda -positive-ℚ : UU lzero -positive-ℚ = type-subtype is-positive-prop-ℚ +negative-ℚ : UU lzero +negative-ℚ = type-subtype is-negative-prop-ℚ -ℚ⁺ : UU lzero -ℚ⁺ = positive-ℚ +ℚ⁻ : UU lzero +ℚ⁻ = negative-ℚ module _ - (x : positive-ℚ) + (x : negative-ℚ) where - rational-ℚ⁺ : ℚ - rational-ℚ⁺ = pr1 x + rational-ℚ⁻ : ℚ + rational-ℚ⁻ = pr1 x - fraction-ℚ⁺ : fraction-ℤ - fraction-ℚ⁺ = fraction-ℚ rational-ℚ⁺ + fraction-ℚ⁻ : fraction-ℤ + fraction-ℚ⁻ = fraction-ℚ rational-ℚ⁻ - numerator-ℚ⁺ : ℤ - numerator-ℚ⁺ = numerator-ℚ rational-ℚ⁺ + numerator-ℚ⁻ : ℤ + numerator-ℚ⁻ = numerator-ℚ rational-ℚ⁻ - denominator-ℚ⁺ : ℤ - denominator-ℚ⁺ = denominator-ℚ rational-ℚ⁺ + denominator-ℚ⁻ : ℤ + denominator-ℚ⁻ = denominator-ℚ rational-ℚ⁻ - is-positive-rational-ℚ⁺ : is-positive-ℚ rational-ℚ⁺ - is-positive-rational-ℚ⁺ = pr2 x + is-negative-rational-ℚ⁻ : is-negative-ℚ rational-ℚ⁻ + is-negative-rational-ℚ⁻ = pr2 x - is-positive-fraction-ℚ⁺ : is-positive-fraction-ℤ fraction-ℚ⁺ - is-positive-fraction-ℚ⁺ = is-positive-rational-ℚ⁺ + is-negative-fraction-ℚ⁻ : is-negative-fraction-ℤ fraction-ℚ⁻ + is-negative-fraction-ℚ⁻ = is-negative-rational-ℚ⁻ - is-positive-numerator-ℚ⁺ : is-positive-ℤ numerator-ℚ⁺ - is-positive-numerator-ℚ⁺ = is-positive-rational-ℚ⁺ + is-negative-numerator-ℚ⁻ : is-negative-ℤ numerator-ℚ⁻ + is-negative-numerator-ℚ⁻ = is-negative-rational-ℚ⁻ - is-positive-denominator-ℚ⁺ : is-positive-ℤ denominator-ℚ⁺ - is-positive-denominator-ℚ⁺ = is-positive-denominator-ℚ rational-ℚ⁺ + is-positive-denominator-ℚ⁻ : is-positive-ℤ denominator-ℚ⁻ + is-positive-denominator-ℚ⁻ = is-positive-denominator-ℚ rational-ℚ⁻ abstract - eq-ℚ⁺ : {x y : ℚ⁺} → rational-ℚ⁺ x = rational-ℚ⁺ y → x = y - eq-ℚ⁺ {x} {y} = eq-type-subtype is-positive-prop-ℚ + eq-ℚ⁻ : {x y : ℚ⁻} → rational-ℚ⁻ x = rational-ℚ⁻ y → x = y + eq-ℚ⁻ {x} {y} = eq-type-subtype is-negative-prop-ℚ ``` ## Properties -### The positive rational numbers form a set +### The negative rational numbers form a set ```agda -is-set-ℚ⁺ : is-set ℚ⁺ -is-set-ℚ⁺ = is-set-type-subtype is-positive-prop-ℚ is-set-ℚ +is-set-ℚ⁻ : is-set ℚ⁻ +is-set-ℚ⁻ = is-set-type-subtype is-negative-prop-ℚ is-set-ℚ ``` -### The rational image of a positive integer is positive +### The rational image of a negative integer is negative ```agda abstract - is-positive-rational-ℤ : - (x : ℤ) → is-positive-ℤ x → is-positive-ℚ (rational-ℤ x) - is-positive-rational-ℤ x P = P - -positive-rational-positive-ℤ : positive-ℤ → ℚ⁺ -positive-rational-positive-ℤ (z , pos-z) = rational-ℤ z , pos-z + is-negative-rational-ℤ : + (x : ℤ) → is-negative-ℤ x → is-negative-ℚ (rational-ℤ x) + is-negative-rational-ℤ x P = P +negative-rational-negative-ℤ : negative-ℤ → ℚ⁻ +negative-rational-negative-ℤ (z , pos-z) = rational-ℤ z , pos-z ``` From 4f030cc7e5df3c454c5001c3bdcc15144c7dff17 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 25 Feb 2025 21:45:52 -0800 Subject: [PATCH 077/119] make pre-commit --- src/elementary-number-theory.lagda.md | 2 ++ .../inequality-integer-fractions.lagda.md | 2 +- ...cation-positive-and-negative-integers.lagda.md | 2 +- .../negative-integer-fractions.lagda.md | 8 ++++---- .../negative-rational-numbers.lagda.md | 15 ++++++++------- .../positive-rational-numbers.lagda.md | 2 +- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/elementary-number-theory.lagda.md b/src/elementary-number-theory.lagda.md index 1a7ff67349..4dbb578c94 100644 --- a/src/elementary-number-theory.lagda.md +++ b/src/elementary-number-theory.lagda.md @@ -122,7 +122,9 @@ open import elementary-number-theory.multiplicative-units-integers public open import elementary-number-theory.multiplicative-units-standard-cyclic-rings public open import elementary-number-theory.multiset-coefficients public open import elementary-number-theory.natural-numbers public +open import elementary-number-theory.negative-integer-fractions public open import elementary-number-theory.negative-integers public +open import elementary-number-theory.negative-rational-numbers public open import elementary-number-theory.nonnegative-integers public open import elementary-number-theory.nonpositive-integers public open import elementary-number-theory.nonzero-integers public diff --git a/src/elementary-number-theory/inequality-integer-fractions.lagda.md b/src/elementary-number-theory/inequality-integer-fractions.lagda.md index 92c8055589..4da09c34b8 100644 --- a/src/elementary-number-theory/inequality-integer-fractions.lagda.md +++ b/src/elementary-number-theory/inequality-integer-fractions.lagda.md @@ -23,8 +23,8 @@ open import elementary-number-theory.positive-and-negative-integers open import elementary-number-theory.positive-integers open import elementary-number-theory.strict-inequality-integers -open import foundation.binary-transport open import foundation.action-on-identifications-functions +open import foundation.binary-transport open import foundation.cartesian-product-types open import foundation.coproduct-types open import foundation.decidable-propositions diff --git a/src/elementary-number-theory/multiplication-positive-and-negative-integers.lagda.md b/src/elementary-number-theory/multiplication-positive-and-negative-integers.lagda.md index 5e16129e00..c2f96f0721 100644 --- a/src/elementary-number-theory/multiplication-positive-and-negative-integers.lagda.md +++ b/src/elementary-number-theory/multiplication-positive-and-negative-integers.lagda.md @@ -23,8 +23,8 @@ open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.empty-types open import foundation.identity-types -open import foundation.unit-type open import foundation.transport-along-identifications +open import foundation.unit-type ``` diff --git a/src/elementary-number-theory/negative-integer-fractions.lagda.md b/src/elementary-number-theory/negative-integer-fractions.lagda.md index cb650b5401..bd72e2be4d 100644 --- a/src/elementary-number-theory/negative-integer-fractions.lagda.md +++ b/src/elementary-number-theory/negative-integer-fractions.lagda.md @@ -13,16 +13,16 @@ open import elementary-number-theory.addition-integer-fractions open import elementary-number-theory.addition-positive-and-negative-integers open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers -open import elementary-number-theory.multiplication-integers open import elementary-number-theory.multiplication-integer-fractions +open import elementary-number-theory.multiplication-integers open import elementary-number-theory.multiplication-positive-and-negative-integers -open import elementary-number-theory.positive-integers open import elementary-number-theory.negative-integers -open import elementary-number-theory.reduced-integer-fractions open import elementary-number-theory.positive-integer-fractions +open import elementary-number-theory.positive-integers +open import elementary-number-theory.reduced-integer-fractions -open import foundation.propositions open import foundation.identity-types +open import foundation.propositions open import foundation.subtypes open import foundation.universe-levels ``` diff --git a/src/elementary-number-theory/negative-rational-numbers.lagda.md b/src/elementary-number-theory/negative-rational-numbers.lagda.md index 1e6b11b8d5..75b59bf88b 100644 --- a/src/elementary-number-theory/negative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/negative-rational-numbers.lagda.md @@ -9,19 +9,20 @@ module elementary-number-theory.negative-rational-numbers where
Imports ```agda +open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers +open import elementary-number-theory.negative-integer-fractions open import elementary-number-theory.negative-integers -open import elementary-number-theory.rational-numbers +open import elementary-number-theory.positive-integers open import elementary-number-theory.positive-rational-numbers -open import elementary-number-theory.integer-fractions -open import elementary-number-theory.negative-integer-fractions +open import elementary-number-theory.rational-numbers + +open import foundation.dependent-pair-types +open import foundation.identity-types open import foundation.propositions +open import foundation.sets open import foundation.subtypes open import foundation.universe-levels -open import foundation.dependent-pair-types -open import foundation.sets -open import foundation.identity-types -open import elementary-number-theory.positive-integers ```
diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index 0bb477abca..ffdb127416 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -14,8 +14,8 @@ open import elementary-number-theory.addition-rational-numbers open import elementary-number-theory.additive-group-of-rational-numbers open import elementary-number-theory.cross-multiplication-difference-integer-fractions open import elementary-number-theory.difference-rational-numbers -open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.inequality-integers +open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integer-fractions From 8ee275f5170d93279604c4e235ee2676284a1d38 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 25 Feb 2025 22:07:00 -0800 Subject: [PATCH 078/119] Prove some results about negative rationals --- .../negative-rational-numbers.lagda.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/src/elementary-number-theory/negative-rational-numbers.lagda.md b/src/elementary-number-theory/negative-rational-numbers.lagda.md index 75b59bf88b..5208949b00 100644 --- a/src/elementary-number-theory/negative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/negative-rational-numbers.lagda.md @@ -11,15 +11,24 @@ module elementary-number-theory.negative-rational-numbers where ```agda open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers +open import elementary-number-theory.cross-multiplication-difference-integer-fractions +open import elementary-number-theory.addition-rational-numbers +open import elementary-number-theory.difference-rational-numbers open import elementary-number-theory.negative-integer-fractions open import elementary-number-theory.negative-integers open import elementary-number-theory.positive-integers +open import elementary-number-theory.positive-and-negative-integers open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers +open import elementary-number-theory.nonzero-rational-numbers +open import foundation.coproduct-types +open import foundation.transport-along-identifications open import foundation.dependent-pair-types open import foundation.identity-types open import foundation.propositions +open import foundation.logical-equivalences open import foundation.sets open import foundation.subtypes open import foundation.universe-levels @@ -119,3 +128,93 @@ abstract negative-rational-negative-ℤ : negative-ℤ → ℚ⁻ negative-rational-negative-ℤ (z , pos-z) = rational-ℤ z , pos-z ``` + +### The rational image of a negative integer fraction is negative + +```agda +abstract + is-negative-rational-fraction-ℤ : + {x : fraction-ℤ} (P : is-negative-fraction-ℤ x) → + is-negative-ℚ (rational-fraction-ℤ x) + is-negative-rational-fraction-ℤ = is-negative-reduce-fraction-ℤ +``` + +### A rational number `x` is negative if and only if its negation is positive + +```agda +is-negative-iff-negation-is-positive-ℚ : + (q : ℚ) → is-negative-ℚ q ↔ is-positive-ℚ (neg-ℚ q) +pr1 (is-negative-iff-negation-is-positive-ℚ q) = is-positive-neg-is-negative-ℤ +pr2 (is-negative-iff-negation-is-positive-ℚ q) neg-is-pos = + tr + ( is-negative-ℤ) + ( neg-neg-ℤ (numerator-ℚ q)) + ( is-negative-neg-is-positive-ℤ neg-is-pos) +``` + +### A rational number `x` is negative if and only if `x < 0` + +```agda +module _ + (x : ℚ) + where + + abstract + le-zero-is-negative-ℚ : is-negative-ℚ x → le-ℚ x zero-ℚ + le-zero-is-negative-ℚ x-is-neg = + tr + ( λ y → le-ℚ y zero-ℚ) + ( neg-neg-ℚ x) + ( neg-le-ℚ + ( zero-ℚ) + ( neg-ℚ x) + ( le-zero-is-positive-ℚ + ( neg-ℚ x) + ( forward-implication + ( is-negative-iff-negation-is-positive-ℚ x) + ( x-is-neg)))) + + is-negative-le-zero-ℚ : le-ℚ x zero-ℚ → is-negative-ℚ x + is-negative-le-zero-ℚ x<0 = + backward-implication + ( is-negative-iff-negation-is-positive-ℚ x) + ( is-positive-le-zero-ℚ + ( neg-ℚ x) + ( neg-le-ℚ x zero-ℚ x<0)) + + is-negative-iff-le-zero-ℚ : is-negative-ℚ x ↔ le-ℚ x zero-ℚ + is-negative-iff-le-zero-ℚ = + le-zero-is-negative-ℚ , + is-negative-le-zero-ℚ +``` + +### The difference of a rational number with a greater rational number is negative + +```agda +module _ + (x y : ℚ) (H : le-ℚ x y) + where + + is-negative-diff-le-ℚ : is-negative-ℚ (x -ℚ y) + is-negative-diff-le-ℚ = + backward-implication + ( is-negative-iff-negation-is-positive-ℚ (x -ℚ y)) + ( inv-tr + ( is-positive-ℚ) + ( distributive-neg-diff-ℚ x y) + ( is-positive-diff-le-ℚ x y H)) + + negative-diff-le-ℚ : ℚ⁻ + negative-diff-le-ℚ = x -ℚ y , is-negative-diff-le-ℚ +``` + +### Negative rational numbers are nonzero + +```agda +abstract + is-nonzero-is-negative-ℚ : {x : ℚ} → is-negative-ℚ x → is-nonzero-ℚ x + is-nonzero-is-negative-ℚ {x} H = + is-nonzero-is-nonzero-numerator-ℚ + ( x) + ( is-nonzero-is-negative-ℤ {numerator-ℚ x} H) +``` From b1fac84f36c675ca3ea8eba8e4842c19e772db32 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 26 Feb 2025 14:14:26 -0800 Subject: [PATCH 079/119] Define negative rational numbers and important properties --- .../integer-fractions.lagda.md | 8 + .../negative-integer-fractions.lagda.md | 22 +++ .../negative-rational-numbers.lagda.md | 144 ++++++++++++------ 3 files changed, 128 insertions(+), 46 deletions(-) diff --git a/src/elementary-number-theory/integer-fractions.lagda.md b/src/elementary-number-theory/integer-fractions.lagda.md index dea0da34e6..ccbfc6ad7f 100644 --- a/src/elementary-number-theory/integer-fractions.lagda.md +++ b/src/elementary-number-theory/integer-fractions.lagda.md @@ -108,6 +108,14 @@ neg-fraction-ℤ (d , n) = (neg-ℤ d , n) ## Properties +### The double negation of an integer fraction is the original fraction + +```agda +abstract + neg-neg-fraction-ℤ : (x : fraction-ℤ) → neg-fraction-ℤ (neg-fraction-ℤ x) = x + neg-neg-fraction-ℤ (n , d) = ap (_, d) (neg-neg-ℤ n) +``` + ### Denominators are nonzero ```agda diff --git a/src/elementary-number-theory/negative-integer-fractions.lagda.md b/src/elementary-number-theory/negative-integer-fractions.lagda.md index bd72e2be4d..2ca455092f 100644 --- a/src/elementary-number-theory/negative-integer-fractions.lagda.md +++ b/src/elementary-number-theory/negative-integer-fractions.lagda.md @@ -15,12 +15,14 @@ open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integer-fractions open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.positive-and-negative-integers open import elementary-number-theory.multiplication-positive-and-negative-integers open import elementary-number-theory.negative-integers open import elementary-number-theory.positive-integer-fractions open import elementary-number-theory.positive-integers open import elementary-number-theory.reduced-integer-fractions +open import foundation.transport-along-identifications open import foundation.identity-types open import foundation.propositions open import foundation.subtypes @@ -56,6 +58,26 @@ module _ ## Properties +### The negative of a positive integer fraction is negative + +```agda +abstract + is-negative-neg-positive-fraction-ℤ : + (x : fraction-ℤ) → is-positive-fraction-ℤ x → + is-negative-fraction-ℤ (neg-fraction-ℤ x) + is-negative-neg-positive-fraction-ℤ _ = is-negative-neg-is-positive-ℤ +``` + +### The negative of a negative integer fraction is positive + +```agda +abstract + is-positive-neg-negative-fraction-ℤ : + (x : fraction-ℤ) → is-negative-fraction-ℤ x → + is-positive-fraction-ℤ (neg-fraction-ℤ x) + is-positive-neg-negative-fraction-ℤ _ = is-positive-neg-is-negative-ℤ +``` + ### An integer fraction similar to a negative integer fraction is negative ```agda diff --git a/src/elementary-number-theory/negative-rational-numbers.lagda.md b/src/elementary-number-theory/negative-rational-numbers.lagda.md index 5208949b00..cfa78230fc 100644 --- a/src/elementary-number-theory/negative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/negative-rational-numbers.lagda.md @@ -15,14 +15,18 @@ open import elementary-number-theory.cross-multiplication-difference-integer-fra open import elementary-number-theory.addition-rational-numbers open import elementary-number-theory.difference-rational-numbers open import elementary-number-theory.negative-integer-fractions +open import elementary-number-theory.multiplication-rational-numbers open import elementary-number-theory.negative-integers +open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.positive-integers +open import elementary-number-theory.positive-integer-fractions open import elementary-number-theory.positive-and-negative-integers open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers open import elementary-number-theory.nonzero-rational-numbers +open import foundation.binary-transport open import foundation.coproduct-types open import foundation.transport-along-identifications open import foundation.dependent-pair-types @@ -40,9 +44,9 @@ open import foundation.universe-levels A [rational number](elementary-number-theory.rational-numbers.md) `x` is said to be {{#concept "negative" Disambiguation="rational number" Agda=is-negative-ℚ}} -if its underlying fraction is negative. +if its negation is positive. -Positive rational numbers are a [subsemigroup](group-theory.subsemigroups.md) of +Negative rational numbers are a [subsemigroup](group-theory.subsemigroups.md) of the [additive monoid of rational numbers](elementary-number-theory.additive-group-of-rational-numbers.md). @@ -52,14 +56,14 @@ the ```agda module _ - (x : ℚ) + (q : ℚ) where is-negative-ℚ : UU lzero - is-negative-ℚ = is-negative-fraction-ℤ (fraction-ℚ x) + is-negative-ℚ = is-positive-ℚ (neg-ℚ q) is-prop-is-negative-ℚ : is-prop is-negative-ℚ - is-prop-is-negative-ℚ = is-prop-is-negative-fraction-ℤ (fraction-ℚ x) + is-prop-is-negative-ℚ = is-prop-is-positive-ℚ (neg-ℚ q) is-negative-prop-ℚ : Prop lzero pr1 is-negative-prop-ℚ = is-negative-ℚ @@ -95,14 +99,26 @@ module _ is-negative-rational-ℚ⁻ = pr2 x is-negative-fraction-ℚ⁻ : is-negative-fraction-ℤ fraction-ℚ⁻ - is-negative-fraction-ℚ⁻ = is-negative-rational-ℚ⁻ + is-negative-fraction-ℚ⁻ = + tr + ( is-negative-fraction-ℤ) + ( neg-neg-fraction-ℤ fraction-ℚ⁻) + ( is-negative-neg-positive-fraction-ℤ + ( neg-fraction-ℤ fraction-ℚ⁻) + ( is-negative-rational-ℚ⁻)) is-negative-numerator-ℚ⁻ : is-negative-ℤ numerator-ℚ⁻ - is-negative-numerator-ℚ⁻ = is-negative-rational-ℚ⁻ + is-negative-numerator-ℚ⁻ = is-negative-fraction-ℚ⁻ is-positive-denominator-ℚ⁻ : is-positive-ℤ denominator-ℚ⁻ is-positive-denominator-ℚ⁻ = is-positive-denominator-ℚ rational-ℚ⁻ + neg-ℚ⁻ : ℚ⁺ + neg-ℚ⁻ = (neg-ℚ rational-ℚ⁻) , is-negative-rational-ℚ⁻ + +neg-ℚ⁺ : ℚ⁺ → ℚ⁻ +neg-ℚ⁺ (q , q-is-pos) = neg-ℚ q , inv-tr is-positive-ℚ (neg-neg-ℚ q) q-is-pos + abstract eq-ℚ⁻ : {x y : ℚ⁻} → rational-ℚ⁻ x = rational-ℚ⁻ y → x = y eq-ℚ⁻ {x} {y} = eq-type-subtype is-negative-prop-ℚ @@ -123,10 +139,11 @@ is-set-ℚ⁻ = is-set-type-subtype is-negative-prop-ℚ is-set-ℚ abstract is-negative-rational-ℤ : (x : ℤ) → is-negative-ℤ x → is-negative-ℚ (rational-ℤ x) - is-negative-rational-ℤ x P = P + is-negative-rational-ℤ _ = is-positive-neg-is-negative-ℤ negative-rational-negative-ℤ : negative-ℤ → ℚ⁻ -negative-rational-negative-ℤ (z , pos-z) = rational-ℤ z , pos-z +negative-rational-negative-ℤ (x , x-is-neg) = + rational-ℤ x , is-negative-rational-ℤ x x-is-neg ``` ### The rational image of a negative integer fraction is negative @@ -136,20 +153,8 @@ abstract is-negative-rational-fraction-ℤ : {x : fraction-ℤ} (P : is-negative-fraction-ℤ x) → is-negative-ℚ (rational-fraction-ℤ x) - is-negative-rational-fraction-ℤ = is-negative-reduce-fraction-ℤ -``` - -### A rational number `x` is negative if and only if its negation is positive - -```agda -is-negative-iff-negation-is-positive-ℚ : - (q : ℚ) → is-negative-ℚ q ↔ is-positive-ℚ (neg-ℚ q) -pr1 (is-negative-iff-negation-is-positive-ℚ q) = is-positive-neg-is-negative-ℤ -pr2 (is-negative-iff-negation-is-positive-ℚ q) neg-is-pos = - tr - ( is-negative-ℤ) - ( neg-neg-ℤ (numerator-ℚ q)) - ( is-negative-neg-is-positive-ℤ neg-is-pos) + is-negative-rational-fraction-ℤ P = + is-positive-neg-is-negative-ℤ (is-negative-reduce-fraction-ℤ P) ``` ### A rational number `x` is negative if and only if `x < 0` @@ -165,22 +170,11 @@ module _ tr ( λ y → le-ℚ y zero-ℚ) ( neg-neg-ℚ x) - ( neg-le-ℚ - ( zero-ℚ) - ( neg-ℚ x) - ( le-zero-is-positive-ℚ - ( neg-ℚ x) - ( forward-implication - ( is-negative-iff-negation-is-positive-ℚ x) - ( x-is-neg)))) + ( neg-le-ℚ zero-ℚ (neg-ℚ x) (le-zero-is-positive-ℚ (neg-ℚ x) x-is-neg)) is-negative-le-zero-ℚ : le-ℚ x zero-ℚ → is-negative-ℚ x - is-negative-le-zero-ℚ x<0 = - backward-implication - ( is-negative-iff-negation-is-positive-ℚ x) - ( is-positive-le-zero-ℚ - ( neg-ℚ x) - ( neg-le-ℚ x zero-ℚ x<0)) + is-negative-le-zero-ℚ x-is-neg = + is-positive-le-zero-ℚ (neg-ℚ x) (neg-le-ℚ x zero-ℚ x-is-neg) is-negative-iff-le-zero-ℚ : is-negative-ℚ x ↔ le-ℚ x zero-ℚ is-negative-iff-le-zero-ℚ = @@ -195,14 +189,13 @@ module _ (x y : ℚ) (H : le-ℚ x y) where - is-negative-diff-le-ℚ : is-negative-ℚ (x -ℚ y) - is-negative-diff-le-ℚ = - backward-implication - ( is-negative-iff-negation-is-positive-ℚ (x -ℚ y)) - ( inv-tr + abstract + is-negative-diff-le-ℚ : is-negative-ℚ (x -ℚ y) + is-negative-diff-le-ℚ = + inv-tr ( is-positive-ℚ) ( distributive-neg-diff-ℚ x y) - ( is-positive-diff-le-ℚ x y H)) + ( is-positive-diff-le-ℚ x y H) negative-diff-le-ℚ : ℚ⁻ negative-diff-le-ℚ = x -ℚ y , is-negative-diff-le-ℚ @@ -214,7 +207,66 @@ module _ abstract is-nonzero-is-negative-ℚ : {x : ℚ} → is-negative-ℚ x → is-nonzero-ℚ x is-nonzero-is-negative-ℚ {x} H = - is-nonzero-is-nonzero-numerator-ℚ - ( x) - ( is-nonzero-is-negative-ℤ {numerator-ℚ x} H) + tr + ( is-nonzero-ℚ) + ( neg-neg-ℚ x) + ( is-nonzero-neg-ℚ (is-nonzero-is-positive-ℚ H)) +``` + +### The product of two negative rational numbers is positive + +```agda + is-positive-mul-negative-ℚ : + {x y : ℚ} → is-negative-ℚ x → is-negative-ℚ y → is-positive-ℚ (x *ℚ y) + is-positive-mul-negative-ℚ {x} {y} P Q = + is-positive-reduce-fraction-ℤ + ( is-positive-mul-negative-fraction-ℤ + { fraction-ℚ x} + { fraction-ℚ y} + ( is-negative-fraction-ℚ⁻ (x , P)) + ( is-negative-fraction-ℚ⁻ (y , Q))) +``` + +### Multiplication by a negative rational number reverses inequality + +```agda +module _ + (p : ℚ⁻) + (q r : ℚ) + (H : leq-ℚ q r) + where + + reverses-leq-right-mul-ℚ⁻ : leq-ℚ (r *ℚ rational-ℚ⁻ p) (q *ℚ rational-ℚ⁻ p) + reverses-leq-right-mul-ℚ⁻ = + binary-tr + ( leq-ℚ) + ( negative-law-mul-ℚ r (rational-ℚ⁻ p)) + ( negative-law-mul-ℚ q (rational-ℚ⁻ p)) + ( preserves-leq-right-mul-ℚ⁺ + ( neg-ℚ⁻ p) + ( neg-ℚ r) + ( neg-ℚ q) + ( neg-leq-ℚ q r H)) +``` + +### Multiplication by a negative rational number reverses strict inequality + +```agda +module _ + (p : ℚ⁻) + (q r : ℚ) + (H : le-ℚ q r) + where + + reverses-le-right-mul-ℚ⁻ : le-ℚ (r *ℚ rational-ℚ⁻ p) (q *ℚ rational-ℚ⁻ p) + reverses-le-right-mul-ℚ⁻ = + binary-tr + ( le-ℚ) + ( negative-law-mul-ℚ r (rational-ℚ⁻ p)) + ( negative-law-mul-ℚ q (rational-ℚ⁻ p)) + ( preserves-le-right-mul-ℚ⁺ + ( neg-ℚ⁻ p) + ( neg-ℚ r) + ( neg-ℚ q) + ( neg-le-ℚ q r H)) ``` From b4520a14aa2c8b9cafa0c2d2d9e8b0cb419862ff Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 26 Feb 2025 14:15:35 -0800 Subject: [PATCH 080/119] make pre-commit --- .../negative-integer-fractions.lagda.md | 4 ++-- .../negative-rational-numbers.lagda.md | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/elementary-number-theory/negative-integer-fractions.lagda.md b/src/elementary-number-theory/negative-integer-fractions.lagda.md index 2ca455092f..4b8de8ccd7 100644 --- a/src/elementary-number-theory/negative-integer-fractions.lagda.md +++ b/src/elementary-number-theory/negative-integer-fractions.lagda.md @@ -15,17 +15,17 @@ open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integer-fractions open import elementary-number-theory.multiplication-integers -open import elementary-number-theory.positive-and-negative-integers open import elementary-number-theory.multiplication-positive-and-negative-integers open import elementary-number-theory.negative-integers +open import elementary-number-theory.positive-and-negative-integers open import elementary-number-theory.positive-integer-fractions open import elementary-number-theory.positive-integers open import elementary-number-theory.reduced-integer-fractions -open import foundation.transport-along-identifications open import foundation.identity-types open import foundation.propositions open import foundation.subtypes +open import foundation.transport-along-identifications open import foundation.universe-levels ``` diff --git a/src/elementary-number-theory/negative-rational-numbers.lagda.md b/src/elementary-number-theory/negative-rational-numbers.lagda.md index cfa78230fc..f197b5d065 100644 --- a/src/elementary-number-theory/negative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/negative-rational-numbers.lagda.md @@ -9,32 +9,32 @@ module elementary-number-theory.negative-rational-numbers where
Imports ```agda -open import elementary-number-theory.integer-fractions -open import elementary-number-theory.integers -open import elementary-number-theory.cross-multiplication-difference-integer-fractions open import elementary-number-theory.addition-rational-numbers +open import elementary-number-theory.cross-multiplication-difference-integer-fractions open import elementary-number-theory.difference-rational-numbers -open import elementary-number-theory.negative-integer-fractions +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.integer-fractions +open import elementary-number-theory.integers open import elementary-number-theory.multiplication-rational-numbers +open import elementary-number-theory.negative-integer-fractions open import elementary-number-theory.negative-integers -open import elementary-number-theory.inequality-rational-numbers -open import elementary-number-theory.positive-integers -open import elementary-number-theory.positive-integer-fractions +open import elementary-number-theory.nonzero-rational-numbers open import elementary-number-theory.positive-and-negative-integers +open import elementary-number-theory.positive-integer-fractions +open import elementary-number-theory.positive-integers open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers -open import elementary-number-theory.nonzero-rational-numbers open import foundation.binary-transport open import foundation.coproduct-types -open import foundation.transport-along-identifications open import foundation.dependent-pair-types open import foundation.identity-types -open import foundation.propositions open import foundation.logical-equivalences +open import foundation.propositions open import foundation.sets open import foundation.subtypes +open import foundation.transport-along-identifications open import foundation.universe-levels ``` From 61a4880cc8a870c73c55e9f7c94b35ec95b55ef5 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 26 Feb 2025 14:28:03 -0800 Subject: [PATCH 081/119] Remove unused imports --- .../negative-rational-numbers.lagda.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/elementary-number-theory/negative-rational-numbers.lagda.md b/src/elementary-number-theory/negative-rational-numbers.lagda.md index f197b5d065..8691d5ed71 100644 --- a/src/elementary-number-theory/negative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/negative-rational-numbers.lagda.md @@ -9,8 +9,6 @@ module elementary-number-theory.negative-rational-numbers where
Imports ```agda -open import elementary-number-theory.addition-rational-numbers -open import elementary-number-theory.cross-multiplication-difference-integer-fractions open import elementary-number-theory.difference-rational-numbers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.integer-fractions @@ -27,7 +25,6 @@ open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.binary-transport -open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.identity-types open import foundation.logical-equivalences From 97e43f5309081235c91b6f37d9c9f69303ece0f8 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 26 Feb 2025 15:54:24 -0800 Subject: [PATCH 082/119] Multiplication of closed intervals on the rational numbers --- ...closed-intervals-rational-numbers.lagda.md | 169 +++++++++++ .../inequality-integer-fractions.lagda.md | 16 ++ .../inequality-integers.lagda.md | 11 + .../inequality-rational-numbers.lagda.md | 12 + .../integer-fractions.lagda.md | 8 + .../maximum-rational-numbers.lagda.md | 112 ++++++++ .../minimum-rational-numbers.lagda.md | 112 ++++++++ ...on-positive-and-negative-integers.lagda.md | 30 ++ .../negative-integer-fractions.lagda.md | 139 +++++++++ .../negative-rational-numbers.lagda.md | 269 ++++++++++++++++++ .../positive-and-negative-integers.lagda.md | 9 + .../positive-rational-numbers.lagda.md | 122 +++++++- .../decidable-total-orders.lagda.md | 50 ++++ 13 files changed, 1055 insertions(+), 4 deletions(-) create mode 100644 src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md create mode 100644 src/elementary-number-theory/maximum-rational-numbers.lagda.md create mode 100644 src/elementary-number-theory/minimum-rational-numbers.lagda.md create mode 100644 src/elementary-number-theory/negative-integer-fractions.lagda.md create mode 100644 src/elementary-number-theory/negative-rational-numbers.lagda.md diff --git a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md new file mode 100644 index 0000000000..6426b31bc7 --- /dev/null +++ b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md @@ -0,0 +1,169 @@ +# Closed intervals of rational numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module elementary-number-theory.closed-intervals-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.decidable-total-order-rational-numbers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.maximum-rational-numbers +open import elementary-number-theory.minimum-rational-numbers +open import elementary-number-theory.multiplication-rational-numbers +open import elementary-number-theory.negative-rational-numbers +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.action-on-identifications-binary-functions +open import foundation.action-on-identifications-functions +open import foundation.binary-transport +open import foundation.conjunction +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.propositions +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels +``` + +
+ +## Idea + +A [rational number](elementary-number-theory.rational-numbers.md) `p` is in a +{{#concept "closed interval" Disambiguation="rational numbers" WDID=Q78240777 WD="closed interval"}} +`[q , r]` if `q` is +[less than or equal to](elementary-number-theory.inequality-rational-numbers.md) +`p` and `p` is less than or equal to `r`. + +## Definition + +```agda +module _ + (p q : ℚ) + where + + closed-interval-ℚ : subtype lzero ℚ + closed-interval-ℚ r = leq-ℚ-Prop p r ∧ leq-ℚ-Prop r q + + is-in-closed-interval-ℚ : ℚ → UU lzero + is-in-closed-interval-ℚ r = type-Prop (closed-interval-ℚ r) + +unordered-closed-interval-ℚ : ℚ → ℚ → subtype lzero ℚ +unordered-closed-interval-ℚ p q = closed-interval-ℚ (min-ℚ p q) (max-ℚ p q) + +is-in-unordered-closed-interval-ℚ : ℚ → ℚ → ℚ → UU lzero +is-in-unordered-closed-interval-ℚ p q = + is-in-closed-interval-ℚ (min-ℚ p q) (max-ℚ p q) +``` + +## Properties + +### Multiplication of elements in a closed interval + +```agda +abstract + left-mul-closed-interval-ℚ : (p q r s : ℚ) → is-in-closed-interval-ℚ p q r → + is-in-unordered-closed-interval-ℚ (p *ℚ s) (q *ℚ s) (r *ℚ s) + left-mul-closed-interval-ℚ p q r s (p≤r , r≤q) = + let + p≤q = transitive-leq-ℚ p r q r≤q p≤r + in + trichotomy-le-ℚ + ( s) + ( zero-ℚ) + ( λ s<0 → + let + s⁻ = s , is-negative-le-zero-ℚ s s<0 + rs≤ps = reverses-leq-right-mul-ℚ⁻ s⁻ p r p≤r + qs≤ps = reverses-leq-right-mul-ℚ⁻ s⁻ p q p≤q + qs≤rs = reverses-leq-right-mul-ℚ⁻ s⁻ r q r≤q + min=qs = right-leq-left-min-ℚ (p *ℚ s) (q *ℚ s) qs≤ps + max=ps = right-leq-left-max-ℚ (p *ℚ s) (q *ℚ s) qs≤ps + in + inv-tr (λ t → leq-ℚ t (r *ℚ s)) min=qs qs≤rs , + inv-tr (leq-ℚ (r *ℚ s)) max=ps rs≤ps) + ( λ s=0 → + let + ps=0 = ap (p *ℚ_) s=0 ∙ right-zero-law-mul-ℚ p + rs=0 = ap (r *ℚ_) s=0 ∙ right-zero-law-mul-ℚ r + qs=0 = ap (q *ℚ_) s=0 ∙ right-zero-law-mul-ℚ q + min=0 = ap-binary min-ℚ ps=0 qs=0 ∙ idempotent-min-ℚ zero-ℚ + max=0 = ap-binary max-ℚ ps=0 qs=0 ∙ idempotent-max-ℚ zero-ℚ + in leq-eq-ℚ _ _ (min=0 ∙ inv rs=0) , leq-eq-ℚ _ _ (rs=0 ∙ inv max=0)) + ( λ 0Imports + +```agda +open import elementary-number-theory.decidable-total-order-rational-numbers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.coproduct-types +open import foundation.identity-types +open import foundation.transport-along-identifications + +open import order-theory.decidable-total-orders +``` + +
+ +## Idea + +We define the operation of maximum +([least upper bound](order-theory.least-upper-bounds-posets.md)) for the +[rational numbers](elementary-number-theory.rational-numbers.md). + +## Definition + +```agda +max-ℚ : ℚ → ℚ → ℚ +max-ℚ = max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +## Properties + +### Associativity of `max-ℚ` + +```agda +associative-max-ℚ : (x y z : ℚ) → max-ℚ (max-ℚ x y) z = max-ℚ x (max-ℚ y z) +associative-max-ℚ = + associative-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### Commutativity of `max-ℚ` + +```agda +commutative-max-ℚ : (x y : ℚ) → max-ℚ x y = max-ℚ y x +commutative-max-ℚ = + commutative-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### `max-ℚ` is idempotent + +```agda +idempotent-max-ℚ : (x : ℚ) → max-ℚ x x = x +idempotent-max-ℚ = + idempotent-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### The maximum is an upper bound + +```agda +leq-left-max-ℚ : (x y : ℚ) → x ≤-ℚ max-ℚ x y +leq-left-max-ℚ = leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order + +leq-right-max-ℚ : (x y : ℚ) → y ≤-ℚ max-ℚ x y +leq-right-max-ℚ = leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### If `a ≤ b`, `max a b = b` + +```agda +left-leq-right-max-ℚ : (x y : ℚ) → leq-ℚ x y → max-ℚ x y = y +left-leq-right-max-ℚ = + left-leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order + +right-leq-left-max-ℚ : (x y : ℚ) → leq-ℚ y x → max-ℚ x y = x +right-leq-left-max-ℚ = + right-leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### If both `x` and `y` are less than `z`, so is their maximum + +```agda +le-max-le-both-ℚ : (z x y : ℚ) → le-ℚ x z → le-ℚ y z → le-ℚ (max-ℚ x y) z +le-max-le-both-ℚ z x y xImports + +```agda +open import elementary-number-theory.decidable-total-order-rational-numbers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.coproduct-types +open import foundation.identity-types +open import foundation.transport-along-identifications + +open import order-theory.decidable-total-orders +``` + +
+ +## Idea + +We define the operation of minimum +([greatest lower bound](order-theory.greatest-lower-bounds-posets.md)) for the +[rational numbers](elementary-number-theory.rational-numbers.md). + +## Definition + +```agda +min-ℚ : ℚ → ℚ → ℚ +min-ℚ = min-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +## Properties + +### Associativity of `min-ℚ` + +```agda +associative-min-ℚ : (x y z : ℚ) → min-ℚ (min-ℚ x y) z = min-ℚ x (min-ℚ y z) +associative-min-ℚ = + associative-min-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### Commutativity of `min-ℚ` + +```agda +commutative-min-ℚ : (x y : ℚ) → min-ℚ x y = min-ℚ y x +commutative-min-ℚ = + commutative-min-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### `min-ℚ` is idempotent + +```agda +idempotent-min-ℚ : (x : ℚ) → min-ℚ x x = x +idempotent-min-ℚ = + idempotent-min-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### The minimum is a lower bound + +```agda +leq-left-min-ℚ : (x y : ℚ) → min-ℚ x y ≤-ℚ x +leq-left-min-ℚ = leq-left-min-Decidable-Total-Order ℚ-Decidable-Total-Order + +leq-right-min-ℚ : (x y : ℚ) → min-ℚ x y ≤-ℚ y +leq-right-min-ℚ = leq-right-min-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### If `a ≤ b`, `min a b = a` + +```agda +left-leq-right-min-ℚ : (x y : ℚ) → leq-ℚ x y → min-ℚ x y = x +left-leq-right-min-ℚ = + left-leq-right-min-Decidable-Total-Order ℚ-Decidable-Total-Order + +right-leq-left-min-ℚ : (x y : ℚ) → leq-ℚ y x → min-ℚ x y = y +right-leq-left-min-ℚ = + right-leq-left-min-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + +### If `z` is less than both `x` and `y`, it is less than their minimum + +```agda +le-min-le-both-ℚ : (z x y : ℚ) → le-ℚ z x → le-ℚ z y → le-ℚ z (min-ℚ x y) +le-min-le-both-ℚ z x y zImports + +```agda +open import elementary-number-theory.addition-integer-fractions +open import elementary-number-theory.addition-positive-and-negative-integers +open import elementary-number-theory.integer-fractions +open import elementary-number-theory.integers +open import elementary-number-theory.multiplication-integer-fractions +open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.multiplication-positive-and-negative-integers +open import elementary-number-theory.negative-integers +open import elementary-number-theory.positive-and-negative-integers +open import elementary-number-theory.positive-integer-fractions +open import elementary-number-theory.positive-integers +open import elementary-number-theory.reduced-integer-fractions + +open import foundation.identity-types +open import foundation.propositions +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels +``` + + + +## Idea + +An [integer fraction](elementary-number-theory.integer-fractions.md) `x` is said +to be +{{#concept "negative" Disambiguation="integer fraction" Agda=is-negative-fraction-ℤ}} +if its numerator is a +[negative integer](elementary-number-theory.negative-integers.md). + +## Definitions + +### The property of being a negative integer fraction + +```agda +module _ + (x : fraction-ℤ) + where + + is-negative-fraction-ℤ : UU lzero + is-negative-fraction-ℤ = is-negative-ℤ (numerator-fraction-ℤ x) + + is-prop-is-negative-fraction-ℤ : is-prop is-negative-fraction-ℤ + is-prop-is-negative-fraction-ℤ = + is-prop-is-negative-ℤ (numerator-fraction-ℤ x) +``` + +## Properties + +### The negative of a positive integer fraction is negative + +```agda +abstract + is-negative-neg-positive-fraction-ℤ : + (x : fraction-ℤ) → is-positive-fraction-ℤ x → + is-negative-fraction-ℤ (neg-fraction-ℤ x) + is-negative-neg-positive-fraction-ℤ _ = is-negative-neg-is-positive-ℤ +``` + +### The negative of a negative integer fraction is positive + +```agda +abstract + is-positive-neg-negative-fraction-ℤ : + (x : fraction-ℤ) → is-negative-fraction-ℤ x → + is-positive-fraction-ℤ (neg-fraction-ℤ x) + is-positive-neg-negative-fraction-ℤ _ = is-positive-neg-is-negative-ℤ +``` + +### An integer fraction similar to a negative integer fraction is negative + +```agda +is-negative-sim-fraction-ℤ : + (x y : fraction-ℤ) (S : sim-fraction-ℤ x y) → + is-negative-fraction-ℤ x → + is-negative-fraction-ℤ y +is-negative-sim-fraction-ℤ x y S N = + is-negative-right-factor-mul-positive-ℤ + ( is-negative-eq-ℤ + ( S ∙ + commutative-mul-ℤ (numerator-fraction-ℤ y) (denominator-fraction-ℤ x)) + ( is-negative-mul-negative-positive-ℤ + ( N) + ( is-positive-denominator-fraction-ℤ y))) + ( is-positive-denominator-fraction-ℤ x) +``` + +### The reduced fraction of a negative integer fraction is negative + +```agda +is-negative-reduce-fraction-ℤ : + {x : fraction-ℤ} (P : is-negative-fraction-ℤ x) → + is-negative-fraction-ℤ (reduce-fraction-ℤ x) +is-negative-reduce-fraction-ℤ {x} = + is-negative-sim-fraction-ℤ + ( x) + ( reduce-fraction-ℤ x) + ( sim-reduced-fraction-ℤ x) +``` + +### The sum of two negative integer fractions is negative + +```agda +is-negative-add-fraction-ℤ : + {x y : fraction-ℤ} → + is-negative-fraction-ℤ x → + is-negative-fraction-ℤ y → + is-negative-fraction-ℤ (add-fraction-ℤ x y) +is-negative-add-fraction-ℤ {x} {y} P Q = + is-negative-add-ℤ + ( is-negative-mul-negative-positive-ℤ + ( P) + ( is-positive-denominator-fraction-ℤ y)) + ( is-negative-mul-negative-positive-ℤ + ( Q) + ( is-positive-denominator-fraction-ℤ x)) +``` + +### The product of two negative integer fractions is positive + +```agda +is-positive-mul-negative-fraction-ℤ : + {x y : fraction-ℤ} → + is-negative-fraction-ℤ x → + is-negative-fraction-ℤ y → + is-positive-fraction-ℤ (mul-fraction-ℤ x y) +is-positive-mul-negative-fraction-ℤ = is-positive-mul-negative-ℤ +``` diff --git a/src/elementary-number-theory/negative-rational-numbers.lagda.md b/src/elementary-number-theory/negative-rational-numbers.lagda.md new file mode 100644 index 0000000000..8691d5ed71 --- /dev/null +++ b/src/elementary-number-theory/negative-rational-numbers.lagda.md @@ -0,0 +1,269 @@ +# Negative rational numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module elementary-number-theory.negative-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.difference-rational-numbers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.integer-fractions +open import elementary-number-theory.integers +open import elementary-number-theory.multiplication-rational-numbers +open import elementary-number-theory.negative-integer-fractions +open import elementary-number-theory.negative-integers +open import elementary-number-theory.nonzero-rational-numbers +open import elementary-number-theory.positive-and-negative-integers +open import elementary-number-theory.positive-integer-fractions +open import elementary-number-theory.positive-integers +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.binary-transport +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.logical-equivalences +open import foundation.propositions +open import foundation.sets +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels +``` + +
+ +## Idea + +A [rational number](elementary-number-theory.rational-numbers.md) `x` is said to +be {{#concept "negative" Disambiguation="rational number" Agda=is-negative-ℚ}} +if its negation is positive. + +Negative rational numbers are a [subsemigroup](group-theory.subsemigroups.md) of +the +[additive monoid of rational numbers](elementary-number-theory.additive-group-of-rational-numbers.md). + +## Definitions + +### The property of being a negative rational number + +```agda +module _ + (q : ℚ) + where + + is-negative-ℚ : UU lzero + is-negative-ℚ = is-positive-ℚ (neg-ℚ q) + + is-prop-is-negative-ℚ : is-prop is-negative-ℚ + is-prop-is-negative-ℚ = is-prop-is-positive-ℚ (neg-ℚ q) + + is-negative-prop-ℚ : Prop lzero + pr1 is-negative-prop-ℚ = is-negative-ℚ + pr2 is-negative-prop-ℚ = is-prop-is-negative-ℚ +``` + +### The type of negative rational numbers + +```agda +negative-ℚ : UU lzero +negative-ℚ = type-subtype is-negative-prop-ℚ + +ℚ⁻ : UU lzero +ℚ⁻ = negative-ℚ + +module _ + (x : negative-ℚ) + where + + rational-ℚ⁻ : ℚ + rational-ℚ⁻ = pr1 x + + fraction-ℚ⁻ : fraction-ℤ + fraction-ℚ⁻ = fraction-ℚ rational-ℚ⁻ + + numerator-ℚ⁻ : ℤ + numerator-ℚ⁻ = numerator-ℚ rational-ℚ⁻ + + denominator-ℚ⁻ : ℤ + denominator-ℚ⁻ = denominator-ℚ rational-ℚ⁻ + + is-negative-rational-ℚ⁻ : is-negative-ℚ rational-ℚ⁻ + is-negative-rational-ℚ⁻ = pr2 x + + is-negative-fraction-ℚ⁻ : is-negative-fraction-ℤ fraction-ℚ⁻ + is-negative-fraction-ℚ⁻ = + tr + ( is-negative-fraction-ℤ) + ( neg-neg-fraction-ℤ fraction-ℚ⁻) + ( is-negative-neg-positive-fraction-ℤ + ( neg-fraction-ℤ fraction-ℚ⁻) + ( is-negative-rational-ℚ⁻)) + + is-negative-numerator-ℚ⁻ : is-negative-ℤ numerator-ℚ⁻ + is-negative-numerator-ℚ⁻ = is-negative-fraction-ℚ⁻ + + is-positive-denominator-ℚ⁻ : is-positive-ℤ denominator-ℚ⁻ + is-positive-denominator-ℚ⁻ = is-positive-denominator-ℚ rational-ℚ⁻ + + neg-ℚ⁻ : ℚ⁺ + neg-ℚ⁻ = (neg-ℚ rational-ℚ⁻) , is-negative-rational-ℚ⁻ + +neg-ℚ⁺ : ℚ⁺ → ℚ⁻ +neg-ℚ⁺ (q , q-is-pos) = neg-ℚ q , inv-tr is-positive-ℚ (neg-neg-ℚ q) q-is-pos + +abstract + eq-ℚ⁻ : {x y : ℚ⁻} → rational-ℚ⁻ x = rational-ℚ⁻ y → x = y + eq-ℚ⁻ {x} {y} = eq-type-subtype is-negative-prop-ℚ +``` + +## Properties + +### The negative rational numbers form a set + +```agda +is-set-ℚ⁻ : is-set ℚ⁻ +is-set-ℚ⁻ = is-set-type-subtype is-negative-prop-ℚ is-set-ℚ +``` + +### The rational image of a negative integer is negative + +```agda +abstract + is-negative-rational-ℤ : + (x : ℤ) → is-negative-ℤ x → is-negative-ℚ (rational-ℤ x) + is-negative-rational-ℤ _ = is-positive-neg-is-negative-ℤ + +negative-rational-negative-ℤ : negative-ℤ → ℚ⁻ +negative-rational-negative-ℤ (x , x-is-neg) = + rational-ℤ x , is-negative-rational-ℤ x x-is-neg +``` + +### The rational image of a negative integer fraction is negative + +```agda +abstract + is-negative-rational-fraction-ℤ : + {x : fraction-ℤ} (P : is-negative-fraction-ℤ x) → + is-negative-ℚ (rational-fraction-ℤ x) + is-negative-rational-fraction-ℤ P = + is-positive-neg-is-negative-ℤ (is-negative-reduce-fraction-ℤ P) +``` + +### A rational number `x` is negative if and only if `x < 0` + +```agda +module _ + (x : ℚ) + where + + abstract + le-zero-is-negative-ℚ : is-negative-ℚ x → le-ℚ x zero-ℚ + le-zero-is-negative-ℚ x-is-neg = + tr + ( λ y → le-ℚ y zero-ℚ) + ( neg-neg-ℚ x) + ( neg-le-ℚ zero-ℚ (neg-ℚ x) (le-zero-is-positive-ℚ (neg-ℚ x) x-is-neg)) + + is-negative-le-zero-ℚ : le-ℚ x zero-ℚ → is-negative-ℚ x + is-negative-le-zero-ℚ x-is-neg = + is-positive-le-zero-ℚ (neg-ℚ x) (neg-le-ℚ x zero-ℚ x-is-neg) + + is-negative-iff-le-zero-ℚ : is-negative-ℚ x ↔ le-ℚ x zero-ℚ + is-negative-iff-le-zero-ℚ = + le-zero-is-negative-ℚ , + is-negative-le-zero-ℚ +``` + +### The difference of a rational number with a greater rational number is negative + +```agda +module _ + (x y : ℚ) (H : le-ℚ x y) + where + + abstract + is-negative-diff-le-ℚ : is-negative-ℚ (x -ℚ y) + is-negative-diff-le-ℚ = + inv-tr + ( is-positive-ℚ) + ( distributive-neg-diff-ℚ x y) + ( is-positive-diff-le-ℚ x y H) + + negative-diff-le-ℚ : ℚ⁻ + negative-diff-le-ℚ = x -ℚ y , is-negative-diff-le-ℚ +``` + +### Negative rational numbers are nonzero + +```agda +abstract + is-nonzero-is-negative-ℚ : {x : ℚ} → is-negative-ℚ x → is-nonzero-ℚ x + is-nonzero-is-negative-ℚ {x} H = + tr + ( is-nonzero-ℚ) + ( neg-neg-ℚ x) + ( is-nonzero-neg-ℚ (is-nonzero-is-positive-ℚ H)) +``` + +### The product of two negative rational numbers is positive + +```agda + is-positive-mul-negative-ℚ : + {x y : ℚ} → is-negative-ℚ x → is-negative-ℚ y → is-positive-ℚ (x *ℚ y) + is-positive-mul-negative-ℚ {x} {y} P Q = + is-positive-reduce-fraction-ℤ + ( is-positive-mul-negative-fraction-ℤ + { fraction-ℚ x} + { fraction-ℚ y} + ( is-negative-fraction-ℚ⁻ (x , P)) + ( is-negative-fraction-ℚ⁻ (y , Q))) +``` + +### Multiplication by a negative rational number reverses inequality + +```agda +module _ + (p : ℚ⁻) + (q r : ℚ) + (H : leq-ℚ q r) + where + + reverses-leq-right-mul-ℚ⁻ : leq-ℚ (r *ℚ rational-ℚ⁻ p) (q *ℚ rational-ℚ⁻ p) + reverses-leq-right-mul-ℚ⁻ = + binary-tr + ( leq-ℚ) + ( negative-law-mul-ℚ r (rational-ℚ⁻ p)) + ( negative-law-mul-ℚ q (rational-ℚ⁻ p)) + ( preserves-leq-right-mul-ℚ⁺ + ( neg-ℚ⁻ p) + ( neg-ℚ r) + ( neg-ℚ q) + ( neg-leq-ℚ q r H)) +``` + +### Multiplication by a negative rational number reverses strict inequality + +```agda +module _ + (p : ℚ⁻) + (q r : ℚ) + (H : le-ℚ q r) + where + + reverses-le-right-mul-ℚ⁻ : le-ℚ (r *ℚ rational-ℚ⁻ p) (q *ℚ rational-ℚ⁻ p) + reverses-le-right-mul-ℚ⁻ = + binary-tr + ( le-ℚ) + ( negative-law-mul-ℚ r (rational-ℚ⁻ p)) + ( negative-law-mul-ℚ q (rational-ℚ⁻ p)) + ( preserves-le-right-mul-ℚ⁺ + ( neg-ℚ⁻ p) + ( neg-ℚ r) + ( neg-ℚ q) + ( neg-le-ℚ q r H)) +``` diff --git a/src/elementary-number-theory/positive-and-negative-integers.lagda.md b/src/elementary-number-theory/positive-and-negative-integers.lagda.md index 844b95a8b8..9f35831163 100644 --- a/src/elementary-number-theory/positive-and-negative-integers.lagda.md +++ b/src/elementary-number-theory/positive-and-negative-integers.lagda.md @@ -51,6 +51,15 @@ is-not-negative-and-positive-ℤ (inl x) (H , K) = K is-not-negative-and-positive-ℤ (inr x) (H , K) = H ``` +### No integer is both nonnegative and negative + +```agda +is-not-negative-and-nonnegative-ℤ : + (x : ℤ) → ¬ (is-negative-ℤ x × is-nonnegative-ℤ x) +is-not-negative-and-nonnegative-ℤ (inl x) (H , K) = K +is-not-negative-and-nonnegative-ℤ (inr x) (H , K) = H +``` + ### Dichotomies #### A nonzero integer is either negative or positive diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index 63ae446cfa..6ad222c781 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -14,11 +14,13 @@ open import elementary-number-theory.addition-rational-numbers open import elementary-number-theory.additive-group-of-rational-numbers open import elementary-number-theory.cross-multiplication-difference-integer-fractions open import elementary-number-theory.difference-rational-numbers +open import elementary-number-theory.inequality-integers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.integer-fractions open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integer-fractions open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.multiplication-positive-and-negative-integers open import elementary-number-theory.multiplication-rational-numbers open import elementary-number-theory.multiplicative-inverses-positive-integer-fractions open import elementary-number-theory.multiplicative-monoid-of-rational-numbers @@ -29,9 +31,11 @@ open import elementary-number-theory.positive-integer-fractions open import elementary-number-theory.positive-integers open import elementary-number-theory.rational-numbers open import elementary-number-theory.reduced-integer-fractions +open import elementary-number-theory.strict-inequality-integers open import elementary-number-theory.strict-inequality-rational-numbers open import foundation.action-on-identifications-functions +open import foundation.binary-transport open import foundation.cartesian-product-types open import foundation.coproduct-types open import foundation.dependent-pair-types @@ -152,8 +156,11 @@ abstract (x : ℤ) → is-positive-ℤ x → is-positive-ℚ (rational-ℤ x) is-positive-rational-ℤ x P = P +positive-rational-positive-ℤ : positive-ℤ → ℚ⁺ +positive-rational-positive-ℤ (z , pos-z) = rational-ℤ z , pos-z + one-ℚ⁺ : ℚ⁺ -one-ℚ⁺ = (one-ℚ , is-positive-int-positive-ℤ one-positive-ℤ) +one-ℚ⁺ = positive-rational-positive-ℤ one-positive-ℤ ``` ### The rational image of a positive integer fraction is positive @@ -453,6 +460,19 @@ is-prop-le-ℚ⁺ : (x y : ℚ⁺) → is-prop (le-ℚ⁺ x y) is-prop-le-ℚ⁺ x y = is-prop-type-Prop (le-prop-ℚ⁺ x y) ``` +### The inequality on positive rational numbers + +```agda +leq-prop-ℚ⁺ : ℚ⁺ → ℚ⁺ → Prop lzero +leq-prop-ℚ⁺ x y = leq-ℚ-Prop (rational-ℚ⁺ x) (rational-ℚ⁺ y) + +leq-ℚ⁺ : ℚ⁺ → ℚ⁺ → UU lzero +leq-ℚ⁺ x y = type-Prop (leq-prop-ℚ⁺ x y) + +is-prop-leq-ℚ⁺ : (x y : ℚ⁺) → is-prop (leq-ℚ⁺ x y) +is-prop-leq-ℚ⁺ x y = is-prop-type-Prop (leq-prop-ℚ⁺ x y) +``` + ### The sum of two positive rational numbers is greater than each of them ```agda @@ -526,6 +546,95 @@ module _ ( left-diff-law-add-ℚ⁺) ``` +### Multiplication by a positive rational number preserves strict inequality + +```agda +preserves-le-left-mul-ℚ⁺ : + (p : ℚ⁺) (q r : ℚ) → le-ℚ q r → le-ℚ (rational-ℚ⁺ p *ℚ q) (rational-ℚ⁺ p *ℚ r) +preserves-le-left-mul-ℚ⁺ + p⁺@((p@(p-num , p-denom , p-denom-pos) , _) , p-num-pos) + q@((q-num , q-denom , _) , _) + r@((r-num , r-denom , _) , _) + q Date: Wed, 26 Feb 2025 15:54:53 -0800 Subject: [PATCH 083/119] make pre-commit --- src/elementary-number-theory.lagda.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/elementary-number-theory.lagda.md b/src/elementary-number-theory.lagda.md index 8c83736e27..d57f6dc233 100644 --- a/src/elementary-number-theory.lagda.md +++ b/src/elementary-number-theory.lagda.md @@ -32,6 +32,7 @@ open import elementary-number-theory.binomial-theorem-integers public open import elementary-number-theory.binomial-theorem-natural-numbers public open import elementary-number-theory.bounded-sums-arithmetic-functions public open import elementary-number-theory.catalan-numbers public +open import elementary-number-theory.closed-intervals-rational-numbers public open import elementary-number-theory.cofibonacci public open import elementary-number-theory.collatz-bijection public open import elementary-number-theory.collatz-conjecture public @@ -95,10 +96,12 @@ open import elementary-number-theory.kolakoski-sequence public open import elementary-number-theory.legendre-symbol public open import elementary-number-theory.lower-bounds-natural-numbers public open import elementary-number-theory.maximum-natural-numbers public +open import elementary-number-theory.maximum-rational-numbers public open import elementary-number-theory.maximum-standard-finite-types public open import elementary-number-theory.mediant-integer-fractions public open import elementary-number-theory.mersenne-primes public open import elementary-number-theory.minimum-natural-numbers public +open import elementary-number-theory.minimum-rational-numbers public open import elementary-number-theory.minimum-standard-finite-types public open import elementary-number-theory.modular-arithmetic public open import elementary-number-theory.modular-arithmetic-standard-finite-types public @@ -119,7 +122,9 @@ open import elementary-number-theory.multiplicative-units-integers public open import elementary-number-theory.multiplicative-units-standard-cyclic-rings public open import elementary-number-theory.multiset-coefficients public open import elementary-number-theory.natural-numbers public +open import elementary-number-theory.negative-integer-fractions public open import elementary-number-theory.negative-integers public +open import elementary-number-theory.negative-rational-numbers public open import elementary-number-theory.nonnegative-integers public open import elementary-number-theory.nonpositive-integers public open import elementary-number-theory.nonzero-integers public From fa9738ac79bace8da0dd4d3f7d162e6bc053f7c3 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Fri, 28 Feb 2025 07:50:58 -0800 Subject: [PATCH 084/119] Apply suggestions from code review Co-authored-by: Fredrik Bakke --- .../closed-intervals-rational-numbers.lagda.md | 2 +- .../maximum-rational-numbers.lagda.md | 10 +++++----- .../minimum-rational-numbers.lagda.md | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md index 6426b31bc7..52d17c7750 100644 --- a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md +++ b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md @@ -36,7 +36,7 @@ open import foundation.universe-levels ## Idea A [rational number](elementary-number-theory.rational-numbers.md) `p` is in a -{{#concept "closed interval" Disambiguation="rational numbers" WDID=Q78240777 WD="closed interval"}} +{{#concept "closed interval" Disambiguation="rational numbers" WDID=Q78240777 WD="closed interval" Agda=closed-interval-ℚ}} `[q , r]` if `q` is [less than or equal to](elementary-number-theory.inequality-rational-numbers.md) `p` and `p` is less than or equal to `r`. diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index 162f9f8f61..550ce9fa47 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -23,7 +23,7 @@ open import order-theory.decidable-total-orders ## Idea -We define the operation of maximum +We define the operation of {{#concept "maximum" Disambiguation="of pairs of rational numbers" Agda=max-ℚ}} ([least upper bound](order-theory.least-upper-bounds-posets.md)) for the [rational numbers](elementary-number-theory.rational-numbers.md). @@ -36,7 +36,7 @@ max-ℚ = max-Decidable-Total-Order ℚ-Decidable-Total-Order ## Properties -### Associativity of `max-ℚ` +### Associativity of the maximum operation ```agda associative-max-ℚ : (x y z : ℚ) → max-ℚ (max-ℚ x y) z = max-ℚ x (max-ℚ y z) @@ -44,7 +44,7 @@ associative-max-ℚ = associative-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` -### Commutativity of `max-ℚ` +### Commutativity of the maximum operation ```agda commutative-max-ℚ : (x y : ℚ) → max-ℚ x y = max-ℚ y x @@ -52,7 +52,7 @@ commutative-max-ℚ = commutative-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` -### `max-ℚ` is idempotent +### The maximum operation is idempotent ```agda idempotent-max-ℚ : (x : ℚ) → max-ℚ x x = x @@ -70,7 +70,7 @@ leq-right-max-ℚ : (x y : ℚ) → y ≤-ℚ max-ℚ x y leq-right-max-ℚ = leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` -### If `a ≤ b`, `max a b = b` +### If `a` is less than or equal to `b`, then the maximum of `a` and `b` is `b` ```agda left-leq-right-max-ℚ : (x y : ℚ) → leq-ℚ x y → max-ℚ x y = y diff --git a/src/elementary-number-theory/minimum-rational-numbers.lagda.md b/src/elementary-number-theory/minimum-rational-numbers.lagda.md index 442fc1e1a8..3a811bb795 100644 --- a/src/elementary-number-theory/minimum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/minimum-rational-numbers.lagda.md @@ -23,7 +23,7 @@ open import order-theory.decidable-total-orders ## Idea -We define the operation of minimum +We define the operation of {{#concept "minimum" Disambiguation="of pairs of rational numbers" Agda=min-ℚ}} ([greatest lower bound](order-theory.greatest-lower-bounds-posets.md)) for the [rational numbers](elementary-number-theory.rational-numbers.md). @@ -36,7 +36,7 @@ min-ℚ = min-Decidable-Total-Order ℚ-Decidable-Total-Order ## Properties -### Associativity of `min-ℚ` +### Associativity of the minimum operation ```agda associative-min-ℚ : (x y z : ℚ) → min-ℚ (min-ℚ x y) z = min-ℚ x (min-ℚ y z) @@ -44,7 +44,7 @@ associative-min-ℚ = associative-min-Decidable-Total-Order ℚ-Decidable-Total-Order ``` -### Commutativity of `min-ℚ` +### Commutativity of the minimum operation ```agda commutative-min-ℚ : (x y : ℚ) → min-ℚ x y = min-ℚ y x @@ -52,7 +52,7 @@ commutative-min-ℚ = commutative-min-Decidable-Total-Order ℚ-Decidable-Total-Order ``` -### `min-ℚ` is idempotent +### The minimum operation is idempotent ```agda idempotent-min-ℚ : (x : ℚ) → min-ℚ x x = x @@ -70,7 +70,7 @@ leq-right-min-ℚ : (x y : ℚ) → min-ℚ x y ≤-ℚ y leq-right-min-ℚ = leq-right-min-Decidable-Total-Order ℚ-Decidable-Total-Order ``` -### If `a ≤ b`, `min a b = a` +### If `a` is less than or equal to `b`, then the minimum of `a` and `b` is `a` ```agda left-leq-right-min-ℚ : (x y : ℚ) → leq-ℚ x y → min-ℚ x y = x From ac065089b868836ebc919685aab6676c547ca4c5 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 5 Mar 2025 14:33:45 -0500 Subject: [PATCH 085/119] Minor formatting --- ...ximum-lower-dedekind-real-numbers.lagda.md | 20 ++++++++++--------- .../maximum-real-numbers.lagda.md | 4 ++-- ...ximum-upper-dedekind-real-numbers.lagda.md | 7 ++++--- ...nimum-lower-dedekind-real-numbers.lagda.md | 11 +++++----- ...nimum-upper-dedekind-real-numbers.lagda.md | 15 +++++++------- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md index cfbaacfd1a..d3bdf5fab5 100644 --- a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -103,9 +103,10 @@ module _ ( r Date: Sun, 16 Mar 2025 18:26:12 -0700 Subject: [PATCH 086/119] Fix merge --- .../positive-rational-numbers.lagda.md | 56 +------------------ 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index ac26ec97ca..f65d527a96 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -161,8 +161,7 @@ positive-rational-positive-ℤ : positive-ℤ → ℚ⁺ positive-rational-positive-ℤ (z , pos-z) = rational-ℤ z , pos-z one-ℚ⁺ : ℚ⁺ -one-ℚ⁺ = (one-ℚ , is-positive-int-po -sitive-ℤ one-positive-ℤ) +one-ℚ⁺ = (one-ℚ , is-positive-int-positive-ℤ one-positive-ℤ) ``` ### The rational image of a positive integer fraction is positive @@ -637,59 +636,6 @@ le-right-mul-less-than-one-ℚ⁺ p p<1 q = ( le-left-mul-less-than-one-ℚ⁺ p p<1 q) ``` -### Multiplication by a positive rational number preserves strict inequality - -```agda -preserves-le-left-mul-ℚ⁺ : - (p : ℚ⁺) (q r : ℚ) → le-ℚ q r → le-ℚ (rational-ℚ⁺ p *ℚ q) (rational-ℚ⁺ p *ℚ r) -preserves-le-left-mul-ℚ⁺ - p⁺@((p@(p-num , p-denom , p-denom-pos) , _) , p-num-pos) - q@((q-num , q-denom , _) , _) - r@((r-num , r-denom , _) , _) - q Date: Sun, 16 Mar 2025 19:02:12 -0700 Subject: [PATCH 087/119] Generalize functoriality of meets and joins --- .../decidable-total-orders.lagda.md | 30 ++------ src/order-theory/join-semilattices.lagda.md | 68 +++++++++++++++++++ src/order-theory/meet-semilattices.lagda.md | 66 ++++++++++++++++++ 3 files changed, 140 insertions(+), 24 deletions(-) diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index 092fbd34b8..671f8a8d3d 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -487,18 +487,9 @@ module _ ( T) ( min-Decidable-Total-Order T a c) ( min-Decidable-Total-Order T b d) - min-leq-leq-Decidable-Total-Order a b c d a≤b c≤d - with is-leq-or-strict-greater-Decidable-Total-Order T a c - ... | inl a≤c = - forward-implication - ( min-is-greatest-binary-lower-bound-Decidable-Total-Order T b d a) - ( a≤b , - transitive-leq-Decidable-Total-Order T a c d c≤d a≤c) - ... | inr c Date: Sun, 16 Mar 2025 19:03:10 -0700 Subject: [PATCH 088/119] make pre-commit --- src/elementary-number-theory/maximum-rational-numbers.lagda.md | 3 ++- src/elementary-number-theory/minimum-rational-numbers.lagda.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index 550ce9fa47..e8adbe5976 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -23,7 +23,8 @@ open import order-theory.decidable-total-orders ## Idea -We define the operation of {{#concept "maximum" Disambiguation="of pairs of rational numbers" Agda=max-ℚ}} +We define the operation of +{{#concept "maximum" Disambiguation="of pairs of rational numbers" Agda=max-ℚ}} ([least upper bound](order-theory.least-upper-bounds-posets.md)) for the [rational numbers](elementary-number-theory.rational-numbers.md). diff --git a/src/elementary-number-theory/minimum-rational-numbers.lagda.md b/src/elementary-number-theory/minimum-rational-numbers.lagda.md index 3a811bb795..a60e03e357 100644 --- a/src/elementary-number-theory/minimum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/minimum-rational-numbers.lagda.md @@ -23,7 +23,8 @@ open import order-theory.decidable-total-orders ## Idea -We define the operation of {{#concept "minimum" Disambiguation="of pairs of rational numbers" Agda=min-ℚ}} +We define the operation of +{{#concept "minimum" Disambiguation="of pairs of rational numbers" Agda=min-ℚ}} ([greatest lower bound](order-theory.greatest-lower-bounds-posets.md)) for the [rational numbers](elementary-number-theory.rational-numbers.md). From 993f0c17fea593859d585ee97d56ec2085d7c202 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 16 Mar 2025 19:25:22 -0700 Subject: [PATCH 089/119] Fix missing function --- .../positive-rational-numbers.lagda.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index f65d527a96..04f5c23411 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -164,6 +164,13 @@ one-ℚ⁺ : ℚ⁺ one-ℚ⁺ = (one-ℚ , is-positive-int-positive-ℤ one-positive-ℤ) ``` +### The rational image of a positive natural number is positive + +```agda +positive-rational-ℕ⁺ : ℕ⁺ → ℚ⁺ +positive-rational-ℕ⁺ n = positive-rational-positive-ℤ (positive-int-ℕ⁺ n) +``` + ### The rational image of a positive integer fraction is positive ```agda From 69171a6406c40c64b1ba3936751c01139ecc8ef1 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sat, 22 Mar 2025 10:19:22 -0700 Subject: [PATCH 090/119] Apply suggestions from code review Co-authored-by: Fredrik Bakke --- .../lower-dedekind-real-numbers.lagda.md | 4 +++- .../maximum-lower-dedekind-real-numbers.lagda.md | 16 ++++++++-------- src/real-numbers/maximum-real-numbers.lagda.md | 2 +- .../maximum-upper-dedekind-real-numbers.lagda.md | 2 +- .../minimum-lower-dedekind-real-numbers.lagda.md | 2 +- src/real-numbers/minimum-real-numbers.lagda.md | 4 ++-- .../minimum-upper-dedekind-real-numbers.lagda.md | 6 ++---- .../upper-dedekind-real-numbers.lagda.md | 4 +++- 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index 2aee47cb68..dfd4375825 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -101,7 +101,9 @@ module _ ## Properties -### There is a largest lower Dedekind real, whose cut is all rational numbers +### The greatest lower Dedekind real + +There is a largest lower Dedekind real whose cut is all rational numbers. We call this element **infinity**. ```agda ∞-lower-ℝ : lower-ℝ lzero diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md index d3bdf5fab5..8784bdde2c 100644 --- a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -41,7 +41,7 @@ open import real-numbers.lower-dedekind-real-numbers ## Idea The maximum of two -[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x`, +[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x` and `y` is a lower Dedekind real number with cut equal to the union of the cuts of `x` and `y`. Unlike the case for the [minimum of lower Dedekind real numbers](real-numbers.minimum-lower-dedekind-real-numbers.md), @@ -201,10 +201,10 @@ module _ ( binary-max-lower-ℝ x y) is-binary-upper-bound-binary-max-lower-ℝ = is-binary-upper-bound-is-least-binary-upper-bound-Large-Poset - lower-ℝ-Large-Poset - x - y - is-least-binary-upper-bound-binary-max-lower-ℝ + ( lower-ℝ-Large-Poset) + ( x) + ( y) + ( is-least-binary-upper-bound-binary-max-lower-ℝ) ``` ### The maximum of an inhabited family is a least upper bound @@ -219,9 +219,9 @@ module _ is-least-upper-bound-max-lower-ℝ : is-least-upper-bound-family-of-elements-Large-Poset - lower-ℝ-Large-Poset - F - (max-lower-ℝ A H F) + ( lower-ℝ-Large-Poset) + ( F) + ( max-lower-ℝ A H F) is-least-upper-bound-max-lower-ℝ z = is-least-upper-bound-sup-Large-Suplattice ( powerset-Large-Suplattice ℚ) diff --git a/src/real-numbers/maximum-real-numbers.lagda.md b/src/real-numbers/maximum-real-numbers.lagda.md index 327cc70c6a..794d1b2c76 100644 --- a/src/real-numbers/maximum-real-numbers.lagda.md +++ b/src/real-numbers/maximum-real-numbers.lagda.md @@ -109,7 +109,7 @@ module _ ( lower-real-ℝ z) ``` -### The large poset of the real numbers has joins +### The large poset of real numbers has joins ```agda has-joins-ℝ-Large-Poset : has-joins-Large-Poset ℝ-Large-Poset diff --git a/src/real-numbers/maximum-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-upper-dedekind-real-numbers.lagda.md index bdb61ded39..2085d474cb 100644 --- a/src/real-numbers/maximum-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-upper-dedekind-real-numbers.lagda.md @@ -42,7 +42,7 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea The maximum of two -[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md) `x`, +[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md) `x` and `y` is a upper Dedekind real number with cut equal to the intersection of the cuts of `x` and `y`. diff --git a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md index 65b485de4d..aaf75ac5f2 100644 --- a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md @@ -37,7 +37,7 @@ open import real-numbers.lower-dedekind-real-numbers ## Idea The minimum of two -[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x`, +[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x` and `y` is a lower Dedekind real number with cut equal to the intersection of the cuts of `x` and `y`. diff --git a/src/real-numbers/minimum-real-numbers.lagda.md b/src/real-numbers/minimum-real-numbers.lagda.md index 983909254f..bcb82d7cd0 100644 --- a/src/real-numbers/minimum-real-numbers.lagda.md +++ b/src/real-numbers/minimum-real-numbers.lagda.md @@ -31,7 +31,7 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea The **binary minimum** of two -[Dedekind real numbers](real-numbers.dedekind-real-numbers.md) `x`, `y` is a +[Dedekind real numbers](real-numbers.dedekind-real-numbers.md) `x` and `y` is a Dedekind real number with lower cut equal to the intersection of `x` and `y`'s lower cuts, and upper cut equal to the union of their upper cuts. @@ -109,7 +109,7 @@ module _ ( lower-real-ℝ z) ``` -### The large poset of the real numbers has meets +### The large poset of real numbers has meets ```agda has-meets-ℝ-Large-Poset : has-meets-Large-Poset ℝ-Large-Poset diff --git a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md index 8c13f2da58..9015431c15 100644 --- a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md @@ -41,13 +41,11 @@ open import real-numbers.upper-dedekind-real-numbers ## Idea The minimum of two -[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md) `x`, +[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md) `x` and `y` is a upper Dedekind real number with cut equal to the union of the cuts of `x` and `y`. Unlike the case for the [maximum of upper Dedekind real numbers](real-numbers.maximum-upper-dedekind-real-numbers.md), -the minimum of any inhabited family of upper Dedekind real numbers, the upper -Dedekind real number whose cut is union of the cuts of every element of the -family, is also a upper Dedekind real number. +the minimum of any inhabited family of upper Dedekind real numbers is also an upper Dedekind real number. ## Definition diff --git a/src/real-numbers/upper-dedekind-real-numbers.lagda.md b/src/real-numbers/upper-dedekind-real-numbers.lagda.md index a62de5aba6..fa1e1e5bed 100644 --- a/src/real-numbers/upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/upper-dedekind-real-numbers.lagda.md @@ -101,7 +101,9 @@ module _ ## Properties -### There is a least upper Dedekind real, whose cut is all rational numbers +### The least upper Dedekind real + +There is a least upper Dedekind real whose cut is all rational numbers. We call this element **negative infinity**. ```agda neg-∞-upper-ℝ : upper-ℝ lzero From 8b3ad05de08c98b4ef23282be6c0bc05c48d6e27 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sat, 22 Mar 2025 11:03:55 -0700 Subject: [PATCH 091/119] Respond to review comments --- ...ality-lower-dedekind-real-numbers.lagda.md | 10 +- ...ality-upper-dedekind-real-numbers.lagda.md | 11 +- .../lower-dedekind-real-numbers.lagda.md | 10 +- ...ximum-lower-dedekind-real-numbers.lagda.md | 191 ++++++++++-------- .../maximum-real-numbers.lagda.md | 64 +++--- ...ximum-upper-dedekind-real-numbers.lagda.md | 102 ++++++---- ...nimum-lower-dedekind-real-numbers.lagda.md | 99 +++++---- .../minimum-real-numbers.lagda.md | 64 +++--- ...nimum-upper-dedekind-real-numbers.lagda.md | 185 ++++++++++------- .../upper-dedekind-real-numbers.lagda.md | 10 +- 10 files changed, 425 insertions(+), 321 deletions(-) diff --git a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md index a3fb22e1f5..e4765318c1 100644 --- a/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/inequality-lower-dedekind-real-numbers.lagda.md @@ -119,13 +119,13 @@ pr2 (iff-leq-lower-real-ℚ p q) = reflects-leq-lower-real-ℚ p q ### Infinity is the top element of the large poset of lower reals ```agda -is-top-element-∞-lower-ℝ : - is-top-element-Large-Poset lower-ℝ-Large-Poset ∞-lower-ℝ -is-top-element-∞-lower-ℝ x q _ = star +is-top-element-infinity-lower-ℝ : + is-top-element-Large-Poset lower-ℝ-Large-Poset infinity-lower-ℝ +is-top-element-infinity-lower-ℝ x q _ = star has-top-element-lower-ℝ : has-top-element-Large-Poset lower-ℝ-Large-Poset -top-has-top-element-Large-Poset has-top-element-lower-ℝ = ∞-lower-ℝ +top-has-top-element-Large-Poset has-top-element-lower-ℝ = infinity-lower-ℝ is-top-element-top-has-top-element-Large-Poset has-top-element-lower-ℝ = - is-top-element-∞-lower-ℝ + is-top-element-infinity-lower-ℝ ``` diff --git a/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md index 3dc717ec7f..4493915e37 100644 --- a/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/inequality-upper-dedekind-real-numbers.lagda.md @@ -118,13 +118,14 @@ pr2 (iff-leq-upper-real-ℚ p q) = reflects-leq-upper-real-ℚ p q ### Negative infinity is the bottom element of the large poset of upper reals ```agda -is-bottom-element-neg-∞-upper-ℝ : - is-bottom-element-Large-Poset upper-ℝ-Large-Poset neg-∞-upper-ℝ -is-bottom-element-neg-∞-upper-ℝ x q _ = star +is-bottom-element-neg-infinity-upper-ℝ : + is-bottom-element-Large-Poset upper-ℝ-Large-Poset neg-infinity-upper-ℝ +is-bottom-element-neg-infinity-upper-ℝ x q _ = star has-bottom-element-upper-ℝ : has-bottom-element-Large-Poset upper-ℝ-Large-Poset -bottom-has-bottom-element-Large-Poset has-bottom-element-upper-ℝ = neg-∞-upper-ℝ +bottom-has-bottom-element-Large-Poset has-bottom-element-upper-ℝ = + neg-infinity-upper-ℝ is-bottom-element-bottom-has-bottom-element-Large-Poset - has-bottom-element-upper-ℝ = is-bottom-element-neg-∞-upper-ℝ + has-bottom-element-upper-ℝ = is-bottom-element-neg-infinity-upper-ℝ ``` diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index dfd4375825..533c3256dd 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -106,12 +106,12 @@ module _ There is a largest lower Dedekind real whose cut is all rational numbers. We call this element **infinity**. ```agda -∞-lower-ℝ : lower-ℝ lzero -pr1 ∞-lower-ℝ _ = unit-Prop -pr1 (pr2 ∞-lower-ℝ) = intro-exists zero-ℚ star -pr1 (pr2 (pr2 ∞-lower-ℝ) q) _ = +infinity-lower-ℝ : lower-ℝ lzero +pr1 infinity-lower-ℝ _ = unit-Prop +pr1 (pr2 infinity-lower-ℝ) = intro-exists zero-ℚ star +pr1 (pr2 (pr2 infinity-lower-ℝ) q) _ = intro-exists (q +ℚ one-ℚ) (le-right-add-rational-ℚ⁺ q one-ℚ⁺ , star) -pr2 (pr2 (pr2 ∞-lower-ℝ) q) _ = star +pr2 (pr2 (pr2 infinity-lower-ℝ) q) _ = star ``` ### The lower Dedekind reals form a set diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md index 8784bdde2c..5589c48eb9 100644 --- a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -40,14 +40,19 @@ open import real-numbers.lower-dedekind-real-numbers ## Idea -The maximum of two +The +{{#concept "maximum" Disambiguation="binary, lower Dedekind real numbers" Agda=binary-max-lower-ℝ WD="maximum" WDID=Q10578722}} +of two [lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x` and `y` is a lower Dedekind real number with cut equal to the union of the cuts of -`x` and `y`. Unlike the case for the -[minimum of lower Dedekind real numbers](real-numbers.minimum-lower-dedekind-real-numbers.md), -the maximum of any inhabited family of lower Dedekind real numbers, the lower -Dedekind real number by taking the union of the cuts of every element of the -family, is also a lower Dedekind real number. +`x` and `y`. + +Unlike the case for the +[minimum of lower Dedekind real numbers](real-numbers.minimum-lower-dedekind-real-numbers.md) +or the +[maximum of upper Dedekind real numbers](real-numbers.maximum-upper-dedekind-real-numbers.md), +the maximum of any inhabited family of lower Dedekind real numbers is also a +lower Dedekind real number. ## Definition @@ -63,44 +68,58 @@ module _ cut-binary-max-lower-ℝ : subtype (l1 ⊔ l2) ℚ cut-binary-max-lower-ℝ = union-subtype (cut-lower-ℝ x) (cut-lower-ℝ y) - is-inhabited-cut-binary-max-lower-ℝ : exists ℚ cut-binary-max-lower-ℝ - is-inhabited-cut-binary-max-lower-ℝ = - map-tot-exists - ( λ _ → inl-disjunction) - ( is-inhabited-cut-lower-ℝ x) - - is-rounded-cut-binary-max-lower-ℝ : - (q : ℚ) → - is-in-subtype cut-binary-max-lower-ℝ q ↔ - exists ℚ (λ r → le-ℚ-Prop q r ∧ cut-binary-max-lower-ℝ r) - pr1 (is-rounded-cut-binary-max-lower-ℝ q) = - elim-disjunction - ( ∃ ℚ (λ r → le-ℚ-Prop q r ∧ cut-binary-max-lower-ℝ r)) - ( λ q Date: Sat, 22 Mar 2025 11:06:10 -0700 Subject: [PATCH 092/119] make pre-commit --- src/real-numbers/lower-dedekind-real-numbers.lagda.md | 3 ++- .../maximum-lower-dedekind-real-numbers.lagda.md | 6 +++--- .../minimum-lower-dedekind-real-numbers.lagda.md | 8 ++++---- .../minimum-upper-dedekind-real-numbers.lagda.md | 6 +++--- src/real-numbers/upper-dedekind-real-numbers.lagda.md | 3 ++- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/real-numbers/lower-dedekind-real-numbers.lagda.md b/src/real-numbers/lower-dedekind-real-numbers.lagda.md index 533c3256dd..f776cf6490 100644 --- a/src/real-numbers/lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/lower-dedekind-real-numbers.lagda.md @@ -103,7 +103,8 @@ module _ ### The greatest lower Dedekind real -There is a largest lower Dedekind real whose cut is all rational numbers. We call this element **infinity**. +There is a largest lower Dedekind real whose cut is all rational numbers. We +call this element **infinity**. ```agda infinity-lower-ℝ : lower-ℝ lzero diff --git a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md index 5589c48eb9..6073388da0 100644 --- a/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/maximum-lower-dedekind-real-numbers.lagda.md @@ -43,9 +43,9 @@ open import real-numbers.lower-dedekind-real-numbers The {{#concept "maximum" Disambiguation="binary, lower Dedekind real numbers" Agda=binary-max-lower-ℝ WD="maximum" WDID=Q10578722}} of two -[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x` and -`y` is a lower Dedekind real number with cut equal to the union of the cuts of -`x` and `y`. +[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x` +and `y` is a lower Dedekind real number with cut equal to the union of the cuts +of `x` and `y`. Unlike the case for the [minimum of lower Dedekind real numbers](real-numbers.minimum-lower-dedekind-real-numbers.md) diff --git a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md index 85e2113637..860e3cee2a 100644 --- a/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-lower-dedekind-real-numbers.lagda.md @@ -39,12 +39,12 @@ open import real-numbers.lower-dedekind-real-numbers The {{#concept "minimum" Disambiguation="binary, lower Dedekind real numbers" Agda=binary-min-lower-ℝ WD="minimum" WDID=Q10585806}} of two -[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x` and -`y` is a lower Dedekind real number with cut equal to the intersection of the -cuts of `x` and `y`. +[lower Dedekind real numbers](real-numbers.lower-dedekind-real-numbers.md) `x` +and `y` is a lower Dedekind real number with cut equal to the intersection of +the cuts of `x` and `y`. The minimum of a family of lower Dedekind real numbers is not always a lower -Dedekind real number. For example, the minimum of all lower Dedekind real +Dedekind real number. For example, the minimum of all lower Dedekind real numbers would have an empty cut and would fail to be inhabited. ## Definition diff --git a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md index 328fc5e832..3115aff1a4 100644 --- a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md @@ -43,9 +43,9 @@ open import real-numbers.upper-dedekind-real-numbers The {{#concept "minimum" Disambiguation="binary, upper Dedekind real numbers" Agda=binary-min-upper-ℝ WD="minimum" WDID=Q10585806}} of two -[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md) `x` and -`y` is a upper Dedekind real number with cut equal to the union of the cuts of -`x` and `y`. +[upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md) `x` +and `y` is a upper Dedekind real number with cut equal to the union of the cuts +of `x` and `y`. Unlike the case for the [maximum of upper Dedekind real numbers](real-numbers.maximum-upper-dedekind-real-numbers.md), diff --git a/src/real-numbers/upper-dedekind-real-numbers.lagda.md b/src/real-numbers/upper-dedekind-real-numbers.lagda.md index 86deee0dbc..7a2eae02a3 100644 --- a/src/real-numbers/upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/upper-dedekind-real-numbers.lagda.md @@ -103,7 +103,8 @@ module _ ### The least upper Dedekind real -There is a least upper Dedekind real whose cut is all rational numbers. We call this element **negative infinity**. +There is a least upper Dedekind real whose cut is all rational numbers. We call +this element **negative infinity**. ```agda neg-infinity-upper-ℝ : upper-ℝ lzero From dda8a69ba4e7464257cfd272e0b578605c0184f5 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sat, 22 Mar 2025 12:59:23 -0700 Subject: [PATCH 093/119] Apply suggestions from code review Co-authored-by: Fredrik Bakke --- .../maximum-rational-numbers.lagda.md | 5 +---- .../minimum-rational-numbers.lagda.md | 5 +---- src/order-theory/decidable-total-orders.lagda.md | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index e8adbe5976..85c33d42de 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -23,10 +23,7 @@ open import order-theory.decidable-total-orders ## Idea -We define the operation of -{{#concept "maximum" Disambiguation="of pairs of rational numbers" Agda=max-ℚ}} -([least upper bound](order-theory.least-upper-bounds-posets.md)) for the -[rational numbers](elementary-number-theory.rational-numbers.md). +The {{#concept "maximum" Disambiguation="of pairs of rational numbers" Agda=max-ℚ}} of two [rational numbers](elementary-number-theory.rational-numbers.md) is the [greatest](elementary-number-theory.inequality-rational-numbers.md) rational number of the two. This is the [binary least upper bound](order-theory.least-upper-bounds-posets.md) in the [total order of rational numbers](elementary-number-theory.decidable-total-order-rational-numbers.md). ## Definition diff --git a/src/elementary-number-theory/minimum-rational-numbers.lagda.md b/src/elementary-number-theory/minimum-rational-numbers.lagda.md index a60e03e357..d2a3112329 100644 --- a/src/elementary-number-theory/minimum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/minimum-rational-numbers.lagda.md @@ -23,10 +23,7 @@ open import order-theory.decidable-total-orders ## Idea -We define the operation of -{{#concept "minimum" Disambiguation="of pairs of rational numbers" Agda=min-ℚ}} -([greatest lower bound](order-theory.greatest-lower-bounds-posets.md)) for the -[rational numbers](elementary-number-theory.rational-numbers.md). +The {{#concept "minimum" Disambiguation="of pairs of rational numbers" Agda=min-ℚ}} of two [rational numbers](elementary-number-theory.rational-numbers.md) is the [smallest](elementary-number-theory.inequality-rational-numbers.md) rational number of the two. This is the [binary greatest lower bound](order-theory.greatest-lower-bounds-posets.md) in the [total order of rational numbers](elementary-number-theory.decidable-total-order-rational-numbers.md). ## Definition diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index 671f8a8d3d..2d8296df76 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -477,7 +477,7 @@ module _ ... | inr y Date: Sat, 22 Mar 2025 13:10:00 -0700 Subject: [PATCH 094/119] Progress --- ...closed-intervals-rational-numbers.lagda.md | 86 ++++++++++--------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md index 52d17c7750..230b6445ed 100644 --- a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md +++ b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md @@ -80,33 +80,43 @@ abstract ( λ s<0 → let s⁻ = s , is-negative-le-zero-ℚ s s<0 - rs≤ps = reverses-leq-right-mul-ℚ⁻ s⁻ p r p≤r qs≤ps = reverses-leq-right-mul-ℚ⁻ s⁻ p q p≤q - qs≤rs = reverses-leq-right-mul-ℚ⁻ s⁻ r q r≤q - min=qs = right-leq-left-min-ℚ (p *ℚ s) (q *ℚ s) qs≤ps - max=ps = right-leq-left-max-ℚ (p *ℚ s) (q *ℚ s) qs≤ps in - inv-tr (λ t → leq-ℚ t (r *ℚ s)) min=qs qs≤rs , - inv-tr (leq-ℚ (r *ℚ s)) max=ps rs≤ps) + inv-tr + ( λ t → leq-ℚ t (r *ℚ s)) + ( right-leq-left-min-ℚ (p *ℚ s) (q *ℚ s) qs≤ps) + ( reverses-leq-right-mul-ℚ⁻ s⁻ r q r≤q) , + inv-tr + ( leq-ℚ (r *ℚ s)) + ( right-leq-left-max-ℚ (p *ℚ s) (q *ℚ s) qs≤ps) + ( reverses-leq-right-mul-ℚ⁻ s⁻ p r p≤r)) ( λ s=0 → let ps=0 = ap (p *ℚ_) s=0 ∙ right-zero-law-mul-ℚ p rs=0 = ap (r *ℚ_) s=0 ∙ right-zero-law-mul-ℚ r qs=0 = ap (q *ℚ_) s=0 ∙ right-zero-law-mul-ℚ q - min=0 = ap-binary min-ℚ ps=0 qs=0 ∙ idempotent-min-ℚ zero-ℚ - max=0 = ap-binary max-ℚ ps=0 qs=0 ∙ idempotent-max-ℚ zero-ℚ - in leq-eq-ℚ _ _ (min=0 ∙ inv rs=0) , leq-eq-ℚ _ _ (rs=0 ∙ inv max=0)) + in + leq-eq-ℚ + ( _) + ( _) + ( ap-binary min-ℚ ps=0 qs=0 ∙ + idempotent-min-ℚ zero-ℚ ∙ inv rs=0) , + leq-eq-ℚ _ _ + ( rs=0 ∙ + inv (ap-binary max-ℚ ps=0 qs=0 ∙ idempotent-max-ℚ zero-ℚ))) ( λ 0 Date: Sat, 22 Mar 2025 13:50:44 -0700 Subject: [PATCH 095/119] nonnegative integer fractions --- .../nonnegative-integer-fractions.lagda.md | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 src/elementary-number-theory/nonnegative-integer-fractions.lagda.md diff --git a/src/elementary-number-theory/nonnegative-integer-fractions.lagda.md b/src/elementary-number-theory/nonnegative-integer-fractions.lagda.md new file mode 100644 index 0000000000..465e60abf6 --- /dev/null +++ b/src/elementary-number-theory/nonnegative-integer-fractions.lagda.md @@ -0,0 +1,120 @@ +# Nonnegative integer fractions + +```agda +{-# OPTIONS --lossy-unification #-} + +module elementary-number-theory.nonnegative-integer-fractions where +``` + +
Imports + +```agda +open import elementary-number-theory.addition-integer-fractions +open import elementary-number-theory.addition-positive-and-negative-integers +open import elementary-number-theory.integer-fractions +open import elementary-number-theory.integers +open import elementary-number-theory.multiplication-integer-fractions +open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.multiplication-positive-and-negative-integers +open import elementary-number-theory.nonnegative-integers +open import elementary-number-theory.positive-and-negative-integers +open import elementary-number-theory.positive-integer-fractions +open import elementary-number-theory.positive-integers +open import elementary-number-theory.reduced-integer-fractions + +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.propositions +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels +``` + +
+ +## Idea + +An [integer fraction](elementary-number-theory.integer-fractions.md) `x` is said +to be +{{#concept "nonnegative" Disambiguation="integer fraction" Agda=is-nonnegative-fraction-ℤ}} +if its numerator is a +[nonnegative integer](elementary-number-theory.nonnegative-integers.md). + +## Definitions + +### The property of being a nonnegative integer fraction + +```agda +module _ + (x : fraction-ℤ) + where + + is-nonnegative-fraction-ℤ : UU lzero + is-nonnegative-fraction-ℤ = is-nonnegative-ℤ (numerator-fraction-ℤ x) + + is-prop-is-nonnegative-fraction-ℤ : is-prop is-nonnegative-fraction-ℤ + is-prop-is-nonnegative-fraction-ℤ = + is-prop-is-nonnegative-ℤ (numerator-fraction-ℤ x) +``` + +## Properties + +### An integer fraction similar to a nonnegative integer fraction is nonnegative + +```agda +is-nonnegative-sim-fraction-ℤ : + (x y : fraction-ℤ) (S : sim-fraction-ℤ x y) → + is-nonnegative-fraction-ℤ x → + is-nonnegative-fraction-ℤ y +is-nonnegative-sim-fraction-ℤ x y S N = + is-nonnegative-left-factor-mul-ℤ + ( tr + ( is-nonnegative-ℤ) + ( S) + ( is-nonnegative-mul-nonnegative-positive-ℤ + ( N) + ( is-positive-denominator-fraction-ℤ y))) + ( is-positive-denominator-fraction-ℤ x) +``` + +### The reduced fraction of a nonnegative integer fraction is nonnegative + +```agda +is-nonnegative-reduce-fraction-ℤ : + {x : fraction-ℤ} (P : is-nonnegative-fraction-ℤ x) → + is-nonnegative-fraction-ℤ (reduce-fraction-ℤ x) +is-nonnegative-reduce-fraction-ℤ {x} = + is-nonnegative-sim-fraction-ℤ + ( x) + ( reduce-fraction-ℤ x) + ( sim-reduced-fraction-ℤ x) +``` + +### The sum of two nonnegative integer fractions is nonnegative + +```agda +is-nonnegative-add-fraction-ℤ : + {x y : fraction-ℤ} → + is-nonnegative-fraction-ℤ x → + is-nonnegative-fraction-ℤ y → + is-nonnegative-fraction-ℤ (add-fraction-ℤ x y) +is-nonnegative-add-fraction-ℤ {x} {y} P Q = + is-nonnegative-add-ℤ + ( is-nonnegative-mul-nonnegative-positive-ℤ + ( P) + ( is-positive-denominator-fraction-ℤ y)) + ( is-nonnegative-mul-nonnegative-positive-ℤ + ( Q) + ( is-positive-denominator-fraction-ℤ x)) +``` + +### The product of two nonnegative integer fractions is nonnegative + +```agda +is-nonnegative-mul-nonnegative-fraction-ℤ : + {x y : fraction-ℤ} → + is-nonnegative-fraction-ℤ x → + is-nonnegative-fraction-ℤ y → + is-nonnegative-fraction-ℤ (mul-fraction-ℤ x y) +is-nonnegative-mul-nonnegative-fraction-ℤ H K = is-nonnegative-mul-ℤ H K +``` From dd97d3b4ed2d0c634172c50d1b2717d05ae475d3 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 23 Mar 2025 10:53:45 +0000 Subject: [PATCH 096/119] Update src/real-numbers/maximum-real-numbers.lagda.md --- src/real-numbers/maximum-real-numbers.lagda.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/real-numbers/maximum-real-numbers.lagda.md b/src/real-numbers/maximum-real-numbers.lagda.md index 4ba4d206b1..4afed197b7 100644 --- a/src/real-numbers/maximum-real-numbers.lagda.md +++ b/src/real-numbers/maximum-real-numbers.lagda.md @@ -32,8 +32,8 @@ open import real-numbers.upper-dedekind-real-numbers The {{#concept "maximum" Disambiguation="binary, Dedekind real numbers" Agda=binary-max-ℝ WD="maximum" WDID=Q10578722}} -of two [Dedekind real numbers](real-numbers.dedekind-real-numbers.md) `x`, `y` -is a Dedekind real number with lower cut equal to the union of `x` and `y`'s +of two [Dedekind real numbers](real-numbers.dedekind-real-numbers.md) `x` and +`y` is a Dedekind real number with lower cut equal to the union of `x` and `y`'s lower cuts, and upper cut equal to the intersection of their upper cuts. ## Definition From 3064497d3174382f70602e3797ab60d20f8c2ab4 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Sun, 23 Mar 2025 10:54:04 +0000 Subject: [PATCH 097/119] Update src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md --- src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md index 3115aff1a4..c157bd88b8 100644 --- a/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md @@ -44,7 +44,7 @@ The {{#concept "minimum" Disambiguation="binary, upper Dedekind real numbers" Agda=binary-min-upper-ℝ WD="minimum" WDID=Q10585806}} of two [upper Dedekind real numbers](real-numbers.upper-dedekind-real-numbers.md) `x` -and `y` is a upper Dedekind real number with cut equal to the union of the cuts +and `y` is an upper Dedekind real number with cut equal to the union of the cuts of `x` and `y`. Unlike the case for the From 5fb9a18a615582e9b079a8a9f0645301201fe3a9 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 23 Mar 2025 10:32:54 -0700 Subject: [PATCH 098/119] Simplify --- .../nonnegative-integer-fractions.lagda.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/elementary-number-theory/nonnegative-integer-fractions.lagda.md b/src/elementary-number-theory/nonnegative-integer-fractions.lagda.md index 465e60abf6..76b8630dfa 100644 --- a/src/elementary-number-theory/nonnegative-integer-fractions.lagda.md +++ b/src/elementary-number-theory/nonnegative-integer-fractions.lagda.md @@ -116,5 +116,5 @@ is-nonnegative-mul-nonnegative-fraction-ℤ : is-nonnegative-fraction-ℤ x → is-nonnegative-fraction-ℤ y → is-nonnegative-fraction-ℤ (mul-fraction-ℤ x y) -is-nonnegative-mul-nonnegative-fraction-ℤ H K = is-nonnegative-mul-ℤ H K +is-nonnegative-mul-nonnegative-fraction-ℤ = is-nonnegative-mul-ℤ ``` From 3eb0a07c6b8f214abf3b30a7d5ab5f4de0ac944e Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 23 Mar 2025 10:55:47 -0700 Subject: [PATCH 099/119] make pre-commit --- .../maximum-rational-numbers.lagda.md | 8 +++++++- .../minimum-rational-numbers.lagda.md | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index 85c33d42de..59124d8e82 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -23,7 +23,13 @@ open import order-theory.decidable-total-orders ## Idea -The {{#concept "maximum" Disambiguation="of pairs of rational numbers" Agda=max-ℚ}} of two [rational numbers](elementary-number-theory.rational-numbers.md) is the [greatest](elementary-number-theory.inequality-rational-numbers.md) rational number of the two. This is the [binary least upper bound](order-theory.least-upper-bounds-posets.md) in the [total order of rational numbers](elementary-number-theory.decidable-total-order-rational-numbers.md). +The +{{#concept "maximum" Disambiguation="of pairs of rational numbers" Agda=max-ℚ}} +of two [rational numbers](elementary-number-theory.rational-numbers.md) is the +[greatest](elementary-number-theory.inequality-rational-numbers.md) rational +number of the two. This is the +[binary least upper bound](order-theory.least-upper-bounds-posets.md) in the +[total order of rational numbers](elementary-number-theory.decidable-total-order-rational-numbers.md). ## Definition diff --git a/src/elementary-number-theory/minimum-rational-numbers.lagda.md b/src/elementary-number-theory/minimum-rational-numbers.lagda.md index d2a3112329..a0e9cf67da 100644 --- a/src/elementary-number-theory/minimum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/minimum-rational-numbers.lagda.md @@ -23,7 +23,14 @@ open import order-theory.decidable-total-orders ## Idea -The {{#concept "minimum" Disambiguation="of pairs of rational numbers" Agda=min-ℚ}} of two [rational numbers](elementary-number-theory.rational-numbers.md) is the [smallest](elementary-number-theory.inequality-rational-numbers.md) rational number of the two. This is the [binary greatest lower bound](order-theory.greatest-lower-bounds-posets.md) in the [total order of rational numbers](elementary-number-theory.decidable-total-order-rational-numbers.md). +The +{{#concept "minimum" Disambiguation="of pairs of rational numbers" Agda=min-ℚ}} +of two [rational numbers](elementary-number-theory.rational-numbers.md) is the +[smallest](elementary-number-theory.inequality-rational-numbers.md) rational +number of the two. This is the +[binary greatest lower bound](order-theory.greatest-lower-bounds-posets.md) in +the +[total order of rational numbers](elementary-number-theory.decidable-total-order-rational-numbers.md). ## Definition From 3507f558c70d5d905ca76e9258724a2d2caedfac Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 23 Mar 2025 10:56:59 -0700 Subject: [PATCH 100/119] Pull over changes to min/max on rationals --- .../maximum-rational-numbers.lagda.md | 36 +++++++++++++++--- .../minimum-rational-numbers.lagda.md | 37 ++++++++++++++++--- 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index 81cae3c227..59124d8e82 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -23,9 +23,13 @@ open import order-theory.decidable-total-orders ## Idea -We define the operation of maximum -([least upper bound](order-theory.least-upper-bounds-posets.md)) for the -[rational numbers](elementary-number-theory.rational-numbers.md). +The +{{#concept "maximum" Disambiguation="of pairs of rational numbers" Agda=max-ℚ}} +of two [rational numbers](elementary-number-theory.rational-numbers.md) is the +[greatest](elementary-number-theory.inequality-rational-numbers.md) rational +number of the two. This is the +[binary least upper bound](order-theory.least-upper-bounds-posets.md) in the +[total order of rational numbers](elementary-number-theory.decidable-total-order-rational-numbers.md). ## Definition @@ -36,7 +40,7 @@ max-ℚ = max-Decidable-Total-Order ℚ-Decidable-Total-Order ## Properties -### Associativity of `max-ℚ` +### Associativity of the maximum operation ```agda associative-max-ℚ : (x y z : ℚ) → max-ℚ (max-ℚ x y) z = max-ℚ x (max-ℚ y z) @@ -44,7 +48,7 @@ associative-max-ℚ = associative-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` -### Commutativity of `max-ℚ` +### Commutativity of the maximum operation ```agda commutative-max-ℚ : (x y : ℚ) → max-ℚ x y = max-ℚ y x @@ -52,7 +56,7 @@ commutative-max-ℚ = commutative-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` -### `max-ℚ` is idempotent +### The maximum operation is idempotent ```agda idempotent-max-ℚ : (x : ℚ) → max-ℚ x x = x @@ -70,6 +74,18 @@ leq-right-max-ℚ : (x y : ℚ) → y ≤-ℚ max-ℚ x y leq-right-max-ℚ = leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` +### If `a` is less than or equal to `b`, then the maximum of `a` and `b` is `b` + +```agda +left-leq-right-max-ℚ : (x y : ℚ) → leq-ℚ x y → max-ℚ x y = y +left-leq-right-max-ℚ = + left-leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order + +right-leq-left-max-ℚ : (x y : ℚ) → leq-ℚ y x → max-ℚ x y = x +right-leq-left-max-ℚ = + right-leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order +``` + ### If both `x` and `y` are less than `z`, so is their maximum ```agda @@ -90,3 +106,11 @@ le-max-le-both-ℚ z x y x Date: Sun, 23 Mar 2025 12:35:49 -0700 Subject: [PATCH 101/119] Progress --- src/elementary-number-theory.lagda.md | 2 + .../nonnegative-rational-numbers.lagda.md | 244 ++++++++++++++++++ .../positive-rational-numbers.lagda.md | 53 ---- 3 files changed, 246 insertions(+), 53 deletions(-) create mode 100644 src/elementary-number-theory/nonnegative-rational-numbers.lagda.md diff --git a/src/elementary-number-theory.lagda.md b/src/elementary-number-theory.lagda.md index 94d76040a6..834e941a68 100644 --- a/src/elementary-number-theory.lagda.md +++ b/src/elementary-number-theory.lagda.md @@ -126,7 +126,9 @@ open import elementary-number-theory.natural-numbers public open import elementary-number-theory.negative-integer-fractions public open import elementary-number-theory.negative-integers public open import elementary-number-theory.negative-rational-numbers public +open import elementary-number-theory.nonnegative-integer-fractions public open import elementary-number-theory.nonnegative-integers public +open import elementary-number-theory.nonnegative-rational-numbers public open import elementary-number-theory.nonpositive-integers public open import elementary-number-theory.nonzero-integers public open import elementary-number-theory.nonzero-natural-numbers public diff --git a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md new file mode 100644 index 0000000000..7a249a80cf --- /dev/null +++ b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md @@ -0,0 +1,244 @@ +# Nonnegative rational numbers + +```agda +{-# OPTIONS --lossy-unification #-} + +module elementary-number-theory.nonnegative-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.cross-multiplication-difference-integer-fractions +open import elementary-number-theory.difference-rational-numbers +open import elementary-number-theory.inequality-integers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.integer-fractions +open import elementary-number-theory.integers +open import elementary-number-theory.multiplication-integer-fractions +open import elementary-number-theory.multiplication-integers +open import elementary-number-theory.multiplication-positive-and-negative-integers +open import elementary-number-theory.multiplication-rational-numbers +open import elementary-number-theory.nonnegative-integer-fractions +open import elementary-number-theory.nonnegative-integers +open import elementary-number-theory.nonzero-rational-numbers +open import elementary-number-theory.positive-and-negative-integers +open import elementary-number-theory.positive-integer-fractions +open import elementary-number-theory.positive-integers +open import elementary-number-theory.positive-rational-numbers +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.reduced-integer-fractions +open import elementary-number-theory.strict-inequality-rational-numbers + +open import foundation.binary-transport +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.logical-equivalences +open import foundation.propositions +open import foundation.sets +open import foundation.subtypes +open import foundation.transport-along-identifications +open import foundation.universe-levels +``` + +
+ +## Idea + +A [rational number](elementary-number-theory.rational-numbers.md) `x` is said to +be +{{#concept "nonnegative" Disambiguation="rational number" Agda=is-nonnegative-ℚ}} +if its negation is positive. + +Nonnegative rational numbers are a [subsemigroup](group-theory.subsemigroups.md) +of the +[additive monoid of rational numbers](elementary-number-theory.additive-group-of-rational-numbers.md). + +## Definitions + +### The property of being a nonnegative rational number + +```agda +module _ + (q : ℚ) + where + + is-nonnegative-ℚ : UU lzero + is-nonnegative-ℚ = is-nonnegative-fraction-ℤ (fraction-ℚ q) + + is-prop-is-nonnegative-ℚ : is-prop is-nonnegative-ℚ + is-prop-is-nonnegative-ℚ = is-prop-is-nonnegative-fraction-ℤ (fraction-ℚ q) + + is-nonnegative-prop-ℚ : Prop lzero + pr1 is-nonnegative-prop-ℚ = is-nonnegative-ℚ + pr2 is-nonnegative-prop-ℚ = is-prop-is-nonnegative-ℚ +``` + +### The type of nonnegative rational numbers + +```agda +nonnegative-ℚ : UU lzero +nonnegative-ℚ = type-subtype is-nonnegative-prop-ℚ + +ℚ⁰⁺ : UU lzero +ℚ⁰⁺ = nonnegative-ℚ + +module _ + (x : nonnegative-ℚ) + where + + rational-ℚ⁰⁺ : ℚ + rational-ℚ⁰⁺ = pr1 x + + fraction-ℚ⁰⁺ : fraction-ℤ + fraction-ℚ⁰⁺ = fraction-ℚ rational-ℚ⁰⁺ + + numerator-ℚ⁰⁺ : ℤ + numerator-ℚ⁰⁺ = numerator-ℚ rational-ℚ⁰⁺ + + denominator-ℚ⁰⁺ : ℤ + denominator-ℚ⁰⁺ = denominator-ℚ rational-ℚ⁰⁺ + + is-nonnegative-rational-ℚ⁰⁺ : is-nonnegative-ℚ rational-ℚ⁰⁺ + is-nonnegative-rational-ℚ⁰⁺ = pr2 x + + is-nonnegative-fraction-ℚ⁰⁺ : is-nonnegative-fraction-ℤ fraction-ℚ⁰⁺ + is-nonnegative-fraction-ℚ⁰⁺ = pr2 x + + is-nonnegative-numerator-ℚ⁰⁺ : is-nonnegative-ℤ numerator-ℚ⁰⁺ + is-nonnegative-numerator-ℚ⁰⁺ = is-nonnegative-fraction-ℚ⁰⁺ + + is-positive-denominator-ℚ⁰⁺ : is-positive-ℤ denominator-ℚ⁰⁺ + is-positive-denominator-ℚ⁰⁺ = is-positive-denominator-ℚ rational-ℚ⁰⁺ + +abstract + eq-ℚ⁰⁺ : {x y : ℚ⁰⁺} → rational-ℚ⁰⁺ x = rational-ℚ⁰⁺ y → x = y + eq-ℚ⁰⁺ {x} {y} = eq-type-subtype is-nonnegative-prop-ℚ +``` + +## Properties + +### The nonnegative rational numbers form a set + +```agda +is-set-ℚ⁰⁺ : is-set ℚ⁰⁺ +is-set-ℚ⁰⁺ = is-set-type-subtype is-nonnegative-prop-ℚ is-set-ℚ +``` + +### The rational image of a nonnegative integer is nonnegative + +```agda +abstract + is-nonnegative-rational-ℤ : + (x : ℤ) → is-nonnegative-ℤ x → is-nonnegative-ℚ (rational-ℤ x) + is-nonnegative-rational-ℤ _ H = H + +nonnegative-rational-nonnegative-ℤ : nonnegative-ℤ → ℚ⁰⁺ +nonnegative-rational-nonnegative-ℤ (x , x-is-neg) = + rational-ℤ x , is-nonnegative-rational-ℤ x x-is-neg +``` + +### The rational image of a nonnegative integer fraction is nonnegative + +```agda +abstract + is-nonnegative-rational-fraction-ℤ : + {x : fraction-ℤ} (P : is-nonnegative-fraction-ℤ x) → + is-nonnegative-ℚ (rational-fraction-ℤ x) + is-nonnegative-rational-fraction-ℤ {x} = + is-nonnegative-sim-fraction-ℤ + ( x) + ( reduce-fraction-ℤ x) + ( sim-reduced-fraction-ℤ x) +``` + +### A rational number `x` is nonnegative if and only if `0 ≤ x` + +```agda +module _ + (x : ℚ) + where + + abstract + leq-zero-is-nonnegative-ℚ : is-nonnegative-ℚ x → leq-ℚ zero-ℚ x + leq-zero-is-nonnegative-ℚ = + is-nonnegative-eq-ℤ (inv (cross-mul-diff-zero-fraction-ℤ (fraction-ℚ x))) + + is-nonnegative-leq-zero-ℚ : leq-ℚ zero-ℚ x → is-nonnegative-ℚ x + is-nonnegative-leq-zero-ℚ = + is-nonnegative-eq-ℤ (cross-mul-diff-zero-fraction-ℤ (fraction-ℚ x)) + + is-nonnegative-iff-leq-zero-ℚ : is-nonnegative-ℚ x ↔ leq-ℚ zero-ℚ x + is-nonnegative-iff-leq-zero-ℚ = + leq-zero-is-nonnegative-ℚ , + is-nonnegative-leq-zero-ℚ +``` + +### The difference of a rational number with a rational number less than or equal to the first is nonnegative + +```agda +module _ + (x y : ℚ) (H : leq-ℚ x y) + where + + abstract + is-nonnegative-diff-leq-ℚ : is-nonnegative-ℚ (y -ℚ x) + is-nonnegative-diff-leq-ℚ = + is-nonnegative-leq-zero-ℚ + ( y -ℚ x) + ( backward-implication (iff-translate-diff-leq-zero-ℚ x y) H) + + nonnegative-diff-le-ℚ : ℚ⁰⁺ + nonnegative-diff-le-ℚ = y -ℚ x , is-nonnegative-diff-leq-ℚ +``` + +### The product of two nonnegative rational numbers is nonnegative + +```agda + is-nonnegative-mul-nonnegative-ℚ : + {x y : ℚ} → is-nonnegative-ℚ x → is-nonnegative-ℚ y → is-nonnegative-ℚ (x *ℚ y) + is-nonnegative-mul-nonnegative-ℚ {x} {y} P Q = + is-nonnegative-rational-fraction-ℤ + ( is-nonnegative-mul-nonnegative-fraction-ℤ + { fraction-ℚ x} + { fraction-ℚ y} + ( P) + ( Q)) +``` + +### Multiplication by a nonnegative rational number preserves inequality + +```agda +abstract + preserves-leq-right-mul-ℚ⁰⁺ : + (p : ℚ⁰⁺) (q r : ℚ) → leq-ℚ q r → + leq-ℚ (q *ℚ rational-ℚ⁰⁺ p) (r *ℚ rational-ℚ⁰⁺ p) + preserves-leq-right-mul-ℚ⁰⁺ + p⁺@((p@(np , dp , pos-dp) , _) , nonneg-np) + (q@(nq , dq , _) , _) + (r@(nr , dr , _) , _) + q≤r = + preserves-leq-rational-fraction-ℤ + ( mul-fraction-ℤ q p) + ( mul-fraction-ℤ r p) + ( binary-tr + ( leq-ℤ) + ( interchange-law-mul-mul-ℤ _ _ _ _) + ( interchange-law-mul-mul-ℤ _ _ _ _) + ( preserves-leq-left-mul-nonnegative-ℤ + ( np *ℤ dp , + is-nonnegative-mul-nonnegative-positive-ℤ nonneg-np pos-dp) + ( nq *ℤ dr) + ( nr *ℤ dq) + ( q≤r))) + + preserves-leq-left-mul-ℚ⁰⁺ : + (p : ℚ⁰⁺) (q r : ℚ) → leq-ℚ q r → + leq-ℚ (rational-ℚ⁰⁺ p *ℚ q) (rational-ℚ⁰⁺ p *ℚ r) + preserves-leq-left-mul-ℚ⁰⁺ p q r q≤r = + binary-tr + ( leq-ℚ) + ( commutative-mul-ℚ q (rational-ℚ⁰⁺ p)) + ( commutative-mul-ℚ r (rational-ℚ⁰⁺ p)) + ( preserves-leq-right-mul-ℚ⁰⁺ p q r q≤r) +``` diff --git a/src/elementary-number-theory/positive-rational-numbers.lagda.md b/src/elementary-number-theory/positive-rational-numbers.lagda.md index ca40dedc34..ffdb127416 100644 --- a/src/elementary-number-theory/positive-rational-numbers.lagda.md +++ b/src/elementary-number-theory/positive-rational-numbers.lagda.md @@ -588,59 +588,6 @@ preserves-le-right-mul-ℚ⁺ p⁺@(p , _) q r q Date: Sun, 23 Mar 2025 17:55:57 -0700 Subject: [PATCH 102/119] make pre-commit --- src/real-numbers/upper-dedekind-real-numbers.lagda.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/real-numbers/upper-dedekind-real-numbers.lagda.md b/src/real-numbers/upper-dedekind-real-numbers.lagda.md index c9cfe81da2..6c38bcdcad 100644 --- a/src/real-numbers/upper-dedekind-real-numbers.lagda.md +++ b/src/real-numbers/upper-dedekind-real-numbers.lagda.md @@ -9,8 +9,8 @@ module real-numbers.upper-dedekind-real-numbers where
Imports ```agda -open import elementary-number-theory.difference-rational-numbers open import elementary-number-theory.addition-rational-numbers +open import elementary-number-theory.difference-rational-numbers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers From af942b435d093e95714bbb033f92179ad9ef785a Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 23 Mar 2025 18:09:23 -0700 Subject: [PATCH 103/119] Pull over more necessary changes --- .../decidable-total-orders.lagda.md | 32 +++++++++ src/order-theory/join-semilattices.lagda.md | 68 +++++++++++++++++++ .../least-upper-bounds-large-posets.lagda.md | 9 --- src/order-theory/meet-semilattices.lagda.md | 66 ++++++++++++++++++ 4 files changed, 166 insertions(+), 9 deletions(-) diff --git a/src/order-theory/decidable-total-orders.lagda.md b/src/order-theory/decidable-total-orders.lagda.md index b0cdb583ea..2d8296df76 100644 --- a/src/order-theory/decidable-total-orders.lagda.md +++ b/src/order-theory/decidable-total-orders.lagda.md @@ -14,8 +14,10 @@ open import foundation.decidable-propositions open import foundation.dependent-pair-types open import foundation.empty-types open import foundation.identity-types +open import foundation.logical-equivalences open import foundation.propositions open import foundation.sets +open import foundation.transport-along-identifications open import foundation.universe-levels open import order-theory.decidable-posets @@ -474,3 +476,33 @@ module _ ... | inl x≤y = antisymmetric-leq-Decidable-Total-Order T y x H x≤y ... | inr y Date: Sun, 23 Mar 2025 18:09:39 -0700 Subject: [PATCH 104/119] Progress --- .../absolute-value-rational-numbers.lagda.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/elementary-number-theory/absolute-value-rational-numbers.lagda.md diff --git a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md new file mode 100644 index 0000000000..59af506193 --- /dev/null +++ b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md @@ -0,0 +1,35 @@ +# The absolute value function on the rational numbers + +```agda +module elementary-number-theory.absolute-value-rational-numbers where +``` + +
Imports + +```agda +open import elementary-number-theory.rational-numbers +open import elementary-number-theory.inequality-rational-numbers +open import elementary-number-theory.nonnegative-rational-numbers +open import elementary-number-theory.maximum-rational-numbers +``` + +
+ +## Idea + +The {{#concept "absolute value" Disambiguation="of a rational number" Agda=abs-ℚ WD="absolute value" WDID=Q120812}} +a rational number is the greater of itself and its negation. + +## Definition + +```agda +rational-abs-ℚ : ℚ → ℚ +rational-abs-ℚ q = max-ℚ q (neg-ℚ q) + +is-nonnegative-rational-abs-ℚ : (q : ℚ) → is-nonnegative-ℚ (rational-abs-ℚ q) + +abs-ℚ : ℚ → ℚ⁰⁺ +pr1 (abs-ℚ q) = rational-abs-ℚ q +``` + +## Properties From c37f6e36c2ddab541c77cbee56f6cc0c775e5331 Mon Sep 17 00:00:00 2001 From: Fredrik Bakke Date: Mon, 24 Mar 2025 16:12:00 +0000 Subject: [PATCH 105/119] edits `abstract` --- ...closed-intervals-rational-numbers.lagda.md | 14 ++- .../maximum-rational-numbers.lagda.md | 85 +++++++++--------- .../minimum-rational-numbers.lagda.md | 86 ++++++++++--------- .../negative-rational-numbers.lagda.md | 47 +++++----- 4 files changed, 128 insertions(+), 104 deletions(-) diff --git a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md index 230b6445ed..21adaa0ad1 100644 --- a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md +++ b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md @@ -49,7 +49,7 @@ module _ where closed-interval-ℚ : subtype lzero ℚ - closed-interval-ℚ r = leq-ℚ-Prop p r ∧ leq-ℚ-Prop r q + closed-interval-ℚ r = (leq-ℚ-Prop p r) ∧ (leq-ℚ-Prop r q) is-in-closed-interval-ℚ : ℚ → UU lzero is-in-closed-interval-ℚ r = type-Prop (closed-interval-ℚ r) @@ -68,7 +68,9 @@ is-in-unordered-closed-interval-ℚ p q = ```agda abstract - left-mul-closed-interval-ℚ : (p q r s : ℚ) → is-in-closed-interval-ℚ p q r → + left-mul-closed-interval-ℚ : + (p q r s : ℚ) → + is-in-closed-interval-ℚ p q r → is-in-unordered-closed-interval-ℚ (p *ℚ s) (q *ℚ s) (r *ℚ s) left-mul-closed-interval-ℚ p q r s (p≤r , r≤q) = let @@ -118,8 +120,10 @@ abstract ( left-leq-right-max-ℚ (p *ℚ s) (q *ℚ s) ps≤qs) ( preserves-leq-right-mul-ℚ⁺ s⁺ r q r≤q)) +abstract right-mul-closed-interval-ℚ : - (p q r s : ℚ) → is-in-closed-interval-ℚ p q r → + (p q r s : ℚ) → + is-in-closed-interval-ℚ p q r → is-in-unordered-closed-interval-ℚ (s *ℚ p) (s *ℚ q) (s *ℚ r) right-mul-closed-interval-ℚ p q r s r∈[p,q] = tr @@ -131,9 +135,11 @@ abstract ( commutative-mul-ℚ q s) ( left-mul-closed-interval-ℚ p q r s r∈[p,q])) +abstract mul-closed-interval-closed-interval-ℚ : (p q r s t u : ℚ) → - is-in-closed-interval-ℚ p q r → is-in-closed-interval-ℚ s t u → + is-in-closed-interval-ℚ p q r → + is-in-closed-interval-ℚ s t u → is-in-closed-interval-ℚ (min-ℚ (min-ℚ (p *ℚ s) (p *ℚ t)) (min-ℚ (q *ℚ s) (q *ℚ t))) (max-ℚ (max-ℚ (p *ℚ s) (p *ℚ t)) (max-ℚ (q *ℚ s) (q *ℚ t))) diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index 59124d8e82..5861ba5fdb 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -43,74 +43,81 @@ max-ℚ = max-Decidable-Total-Order ℚ-Decidable-Total-Order ### Associativity of the maximum operation ```agda -associative-max-ℚ : (x y z : ℚ) → max-ℚ (max-ℚ x y) z = max-ℚ x (max-ℚ y z) -associative-max-ℚ = - associative-max-Decidable-Total-Order ℚ-Decidable-Total-Order +abstract + associative-max-ℚ : (x y z : ℚ) → max-ℚ (max-ℚ x y) z = max-ℚ x (max-ℚ y z) + associative-max-ℚ = + associative-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` ### Commutativity of the maximum operation ```agda -commutative-max-ℚ : (x y : ℚ) → max-ℚ x y = max-ℚ y x -commutative-max-ℚ = - commutative-max-Decidable-Total-Order ℚ-Decidable-Total-Order +abstract + commutative-max-ℚ : (x y : ℚ) → max-ℚ x y = max-ℚ y x + commutative-max-ℚ = + commutative-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` ### The maximum operation is idempotent ```agda -idempotent-max-ℚ : (x : ℚ) → max-ℚ x x = x -idempotent-max-ℚ = - idempotent-max-Decidable-Total-Order ℚ-Decidable-Total-Order +abstract + idempotent-max-ℚ : (x : ℚ) → max-ℚ x x = x + idempotent-max-ℚ = + idempotent-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` ### The maximum is an upper bound ```agda -leq-left-max-ℚ : (x y : ℚ) → x ≤-ℚ max-ℚ x y -leq-left-max-ℚ = leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order +abstract + leq-left-max-ℚ : (x y : ℚ) → x ≤-ℚ max-ℚ x y + leq-left-max-ℚ = leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order -leq-right-max-ℚ : (x y : ℚ) → y ≤-ℚ max-ℚ x y -leq-right-max-ℚ = leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order + leq-right-max-ℚ : (x y : ℚ) → y ≤-ℚ max-ℚ x y + leq-right-max-ℚ = leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` ### If `a` is less than or equal to `b`, then the maximum of `a` and `b` is `b` ```agda -left-leq-right-max-ℚ : (x y : ℚ) → leq-ℚ x y → max-ℚ x y = y -left-leq-right-max-ℚ = - left-leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order - -right-leq-left-max-ℚ : (x y : ℚ) → leq-ℚ y x → max-ℚ x y = x -right-leq-left-max-ℚ = - right-leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order +abstract + left-leq-right-max-ℚ : (x y : ℚ) → leq-ℚ x y → max-ℚ x y = y + left-leq-right-max-ℚ = + left-leq-right-max-Decidable-Total-Order ℚ-Decidable-Total-Order + + right-leq-left-max-ℚ : (x y : ℚ) → leq-ℚ y x → max-ℚ x y = x + right-leq-left-max-ℚ = + right-leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order ``` ### If both `x` and `y` are less than `z`, so is their maximum ```agda -le-max-le-both-ℚ : (z x y : ℚ) → le-ℚ x z → le-ℚ y z → le-ℚ (max-ℚ x y) z -le-max-le-both-ℚ z x y x Date: Mon, 24 Mar 2025 16:45:58 +0000 Subject: [PATCH 106/119] pre-commit --- .../maximum-rational-numbers.lagda.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index 5861ba5fdb..9bb3eab066 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -109,7 +109,10 @@ abstract ... | inr y≤x = inv-tr ( λ w → le-ℚ w z) - ( right-leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order x y y≤x) + ( right-leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order + ( x) + ( y) + ( y≤x)) ( x Date: Mon, 24 Mar 2025 16:41:42 -0700 Subject: [PATCH 107/119] Progress --- .../absolute-value-rational-numbers.lagda.md | 172 +++++++++++++++++- .../maximum-rational-numbers.lagda.md | 17 ++ .../nonnegative-rational-numbers.lagda.md | 37 ++++ 3 files changed, 225 insertions(+), 1 deletion(-) diff --git a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md index 59af506193..a6038f4845 100644 --- a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md +++ b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md @@ -1,16 +1,26 @@ # The absolute value function on the rational numbers ```agda +{-# OPTIONS --lossy-unification #-} module elementary-number-theory.absolute-value-rational-numbers where ```
Imports ```agda +open import elementary-number-theory.addition-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.nonnegative-rational-numbers open import elementary-number-theory.maximum-rational-numbers + +open import foundation.action-on-identifications-functions +open import foundation.action-on-identifications-binary-functions +open import foundation.function-types +open import foundation.coproduct-types +open import foundation.dependent-pair-types +open import foundation.identity-types +open import foundation.transport-along-identifications ```
@@ -26,10 +36,170 @@ a rational number is the greater of itself and its negation. rational-abs-ℚ : ℚ → ℚ rational-abs-ℚ q = max-ℚ q (neg-ℚ q) -is-nonnegative-rational-abs-ℚ : (q : ℚ) → is-nonnegative-ℚ (rational-abs-ℚ q) +abstract + is-nonnegative-rational-abs-ℚ : (q : ℚ) → is-nonnegative-ℚ (rational-abs-ℚ q) + is-nonnegative-rational-abs-ℚ q = + rec-coproduct + ( λ 0≤q → + inv-tr + ( is-nonnegative-ℚ) + ( right-leq-left-max-ℚ + ( q) + ( neg-ℚ q) + ( transitive-leq-ℚ (neg-ℚ q) zero-ℚ q 0≤q (neg-leq-ℚ zero-ℚ q 0≤q))) + ( is-nonnegative-leq-zero-ℚ q 0≤q)) + ( λ q≤0 → + inv-tr + ( is-nonnegative-ℚ) + ( left-leq-right-max-ℚ + ( q) + ( neg-ℚ q) + ( transitive-leq-ℚ q zero-ℚ (neg-ℚ q) (neg-leq-ℚ q zero-ℚ q≤0) q≤0)) + ( is-nonnegative-leq-zero-ℚ (neg-ℚ q) (neg-leq-ℚ q zero-ℚ q≤0))) + ( linear-leq-ℚ zero-ℚ q) abs-ℚ : ℚ → ℚ⁰⁺ pr1 (abs-ℚ q) = rational-abs-ℚ q +pr2 (abs-ℚ q) = is-nonnegative-rational-abs-ℚ q ``` ## Properties + +### The absolute value of a nonnegative rational number is the number itself + +```agda +abstract + abs-rational-ℚ⁰⁺ : (q : ℚ⁰⁺) → abs-ℚ (rational-ℚ⁰⁺ q) = q + abs-rational-ℚ⁰⁺ (q , nonneg-q) = + eq-ℚ⁰⁺ + ( right-leq-left-max-ℚ + ( q) + ( neg-ℚ q) + ( transitive-leq-ℚ + ( neg-ℚ q) + ( zero-ℚ) + ( q) + ( leq-zero-is-nonnegative-ℚ q nonneg-q) + ( neg-leq-ℚ zero-ℚ q (leq-zero-is-nonnegative-ℚ q nonneg-q)))) + + rational-abs-zero-leq-ℚ : (q : ℚ) → leq-ℚ zero-ℚ q → rational-abs-ℚ q = q + rational-abs-zero-leq-ℚ q 0≤q = + ap rational-ℚ⁰⁺ (abs-rational-ℚ⁰⁺ (q , is-nonnegative-leq-zero-ℚ q 0≤q)) + + rational-abs-leq-zero-ℚ : + (q : ℚ) → leq-ℚ q zero-ℚ → rational-abs-ℚ q = neg-ℚ q + rational-abs-leq-zero-ℚ q q≤0 = + left-leq-right-max-ℚ + ( q) + ( neg-ℚ q) + ( transitive-leq-ℚ + ( q) + ( zero-ℚ) + ( neg-ℚ q) + ( neg-leq-ℚ q zero-ℚ q≤0) + ( q≤0)) +``` + +### The absolute value of the negation of `q` is the absolute value of `q` + +```agda +abstract + abs-neg-ℚ : (q : ℚ) → abs-ℚ (neg-ℚ q) = abs-ℚ q + abs-neg-ℚ q = + eq-ℚ⁰⁺ + ( ap (max-ℚ (neg-ℚ q)) (neg-neg-ℚ q) ∙ commutative-max-ℚ _ _) +``` + +### `q` is less than or equal to `abs-ℚ q` + +```agda +abstract + leq-abs-ℚ : (q : ℚ) → leq-ℚ q (rational-abs-ℚ q) + leq-abs-ℚ q = leq-left-max-ℚ q (neg-ℚ q) + + leq-neg-abs-ℚ : (q : ℚ) → leq-ℚ (neg-ℚ q) (rational-abs-ℚ q) + leq-neg-abs-ℚ q = leq-right-max-ℚ q (neg-ℚ q) +``` + +### The absolute value of `q` is zero iff `q` is zero + +```agda +eq-zero-eq-abs-zero-ℚ : (q : ℚ) → abs-ℚ q = zero-ℚ⁰⁺ → q = zero-ℚ +eq-zero-eq-abs-zero-ℚ q abs=0 = + rec-coproduct + ( λ 0≤q → + antisymmetric-leq-ℚ + ( q) + ( zero-ℚ) + ( tr (leq-ℚ q) (ap rational-ℚ⁰⁺ abs=0) (leq-abs-ℚ q)) 0≤q) + ( λ q≤0 → + antisymmetric-leq-ℚ + ( q) + ( zero-ℚ) + ( q≤0) + ( tr + ( leq-ℚ zero-ℚ) + ( neg-neg-ℚ q) + ( neg-leq-ℚ + ( neg-ℚ q) + ( zero-ℚ) + ( tr (leq-ℚ (neg-ℚ q)) (ap rational-ℚ⁰⁺ abs=0) (leq-neg-abs-ℚ q))))) + (linear-leq-ℚ zero-ℚ q) + +abs-zero-ℚ : abs-ℚ zero-ℚ = zero-ℚ⁰⁺ +abs-zero-ℚ = eq-ℚ⁰⁺ (left-leq-right-max-ℚ _ _ (refl-leq-ℚ zero-ℚ)) +``` + +### The triangle inequality + +```agda +abstract + triangle-inequality-abs-ℚ : + (p q : ℚ) → leq-ℚ⁰⁺ (abs-ℚ (p +ℚ q)) (abs-ℚ p +ℚ⁰⁺ abs-ℚ q) + triangle-inequality-abs-ℚ p q + with linear-leq-ℚ zero-ℚ p | linear-leq-ℚ zero-ℚ q + ... | inl 0≤p | inl 0≤q = + leq-eq-ℚ + ( rational-abs-ℚ (p +ℚ q)) + ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + ( equational-reasoning + rational-abs-ℚ (p +ℚ q) + = p +ℚ q + by + rational-abs-zero-leq-ℚ + ( p +ℚ q) + ( tr + ( λ r → leq-ℚ r (p +ℚ q)) + ( left-unit-law-add-ℚ zero-ℚ) + ( preserves-leq-add-ℚ {zero-ℚ} {p} {zero-ℚ} {q} 0≤p 0≤q)) + = rational-abs-ℚ p +ℚ rational-abs-ℚ q + by + ap-binary + ( add-ℚ) + ( inv (rational-abs-zero-leq-ℚ p 0≤p)) + ( inv (rational-abs-zero-leq-ℚ q 0≤q))) + ... | inl 0≤p | inr q≤0 = + leq-max-leq-both-ℚ + ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + ( p +ℚ q) + ( neg-ℚ (p +ℚ q)) + ( transitive-leq-ℚ + ( p +ℚ q) + ( p) + ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + {! !} + {! !}) + {! !} + ... | inr p≤0 | inl 0≤q = + leq-max-leq-both-ℚ + ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + ( p +ℚ q) + ( neg-ℚ (p +ℚ q)) + {! !} + {! !} + ... | inr p≤0 | inr q≤0 = + leq-eq-ℚ + ( rational-abs-ℚ (p +ℚ q)) + ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + {! !} +``` diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index 59124d8e82..c76090fd7c 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -12,8 +12,10 @@ open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers +open import foundation.dependent-pair-types open import foundation.coproduct-types open import foundation.identity-types +open import foundation.logical-equivalences open import foundation.transport-along-identifications open import order-theory.decidable-total-orders @@ -107,6 +109,21 @@ le-max-le-both-ℚ z x y xImports ```agda +open import elementary-number-theory.addition-rational-numbers open import elementary-number-theory.cross-multiplication-difference-integer-fractions open import elementary-number-theory.difference-rational-numbers open import elementary-number-theory.inequality-integers @@ -114,6 +115,9 @@ module _ abstract eq-ℚ⁰⁺ : {x y : ℚ⁰⁺} → rational-ℚ⁰⁺ x = rational-ℚ⁰⁺ y → x = y eq-ℚ⁰⁺ {x} {y} = eq-type-subtype is-nonnegative-prop-ℚ + +zero-ℚ⁰⁺ : ℚ⁰⁺ +zero-ℚ⁰⁺ = zero-ℚ , _ ``` ## Properties @@ -242,3 +246,36 @@ abstract ( commutative-mul-ℚ r (rational-ℚ⁰⁺ p)) ( preserves-leq-right-mul-ℚ⁰⁺ p q r q≤r) ``` + +### Addition on nonnegative rational numbers + +```agda +abstract + is-nonnegative-add-ℚ : + (p q : ℚ) → is-nonnegative-ℚ p → is-nonnegative-ℚ q → + is-nonnegative-ℚ (p +ℚ q) + is-nonnegative-add-ℚ p q nonneg-p nonneg-q = + is-nonnegative-rational-fraction-ℤ + ( is-nonnegative-add-fraction-ℤ + { fraction-ℚ p} + { fraction-ℚ q} + ( nonneg-p) + ( nonneg-q)) + +add-ℚ⁰⁺ : ℚ⁰⁺ → ℚ⁰⁺ → ℚ⁰⁺ +add-ℚ⁰⁺ (p , nonneg-p) (q , nonneg-q) = + p +ℚ q , is-nonnegative-add-ℚ p q nonneg-p nonneg-q + +infixl 35 _+ℚ⁰⁺_ +_+ℚ⁰⁺_ = add-ℚ⁰⁺ +``` + +### Inequality on nonnegative rational numbers + +```agda +leq-ℚ⁰⁺-Prop : ℚ⁰⁺ → ℚ⁰⁺ → Prop lzero +leq-ℚ⁰⁺-Prop (p , _) (q , _) = leq-ℚ-Prop p q + +leq-ℚ⁰⁺ : ℚ⁰⁺ → ℚ⁰⁺ → UU lzero +leq-ℚ⁰⁺ (p , _) (q , _) = leq-ℚ p q +``` From 1c6fddd65f7fc4d3e2cf5038a7343e96a213f98d Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 24 Mar 2025 17:54:35 -0700 Subject: [PATCH 108/119] Progress --- ...closed-intervals-rational-numbers.lagda.md | 101 +++++++++++++----- 1 file changed, 73 insertions(+), 28 deletions(-) diff --git a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md index 230b6445ed..7729fee535 100644 --- a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md +++ b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md @@ -60,6 +60,41 @@ unordered-closed-interval-ℚ p q = closed-interval-ℚ (min-ℚ p q) (max-ℚ p is-in-unordered-closed-interval-ℚ : ℚ → ℚ → ℚ → UU lzero is-in-unordered-closed-interval-ℚ p q = is-in-closed-interval-ℚ (min-ℚ p q) (max-ℚ p q) + +is-in-unordered-closed-interval-is-in-closed-interval-ℚ : + (p q r : ℚ) → is-in-closed-interval-ℚ p q r → + is-in-unordered-closed-interval-ℚ p q r +is-in-unordered-closed-interval-is-in-closed-interval-ℚ p q r (p≤r , q≤r) = + transitive-leq-ℚ + ( min-ℚ p q) + ( p) + ( r) + ( p≤r) + ( leq-left-min-ℚ p q) , + transitive-leq-ℚ + ( r) + ( q) + ( max-ℚ p q) + ( leq-right-max-ℚ p q) + ( q≤r) + +is-in-reversed-unordered-closed-interval-is-in-closed-interval-ℚ : + (p q r : ℚ) → is-in-closed-interval-ℚ p q r → + is-in-unordered-closed-interval-ℚ q p r +is-in-reversed-unordered-closed-interval-is-in-closed-interval-ℚ + p q r (p≤r , q≤r) = + transitive-leq-ℚ + ( min-ℚ q p) + ( p) + ( r) + ( p≤r) + ( leq-right-min-ℚ q p) , + transitive-leq-ℚ + ( r) + ( q) + ( max-ℚ q p) + ( leq-left-max-ℚ q p) + ( q≤r) ``` ## Properties @@ -68,9 +103,29 @@ is-in-unordered-closed-interval-ℚ p q = ```agda abstract + left-mul-negative-closed-interval-ℚ : (p q r s : ℚ) → + is-in-closed-interval-ℚ p q r → is-negative-ℚ s → + is-in-closed-interval-ℚ (q *ℚ s) (p *ℚ s) (r *ℚ s) + left-mul-negative-closed-interval-ℚ p q r s (p≤r , r≤q) neg-s = + let + s⁻ = s , neg-s + in + reverses-leq-right-mul-ℚ⁻ s⁻ r q r≤q , + reverses-leq-right-mul-ℚ⁻ s⁻ p r p≤r + + left-mul-positive-closed-interval-ℚ : (p q r s : ℚ) → + is-in-closed-interval-ℚ p q r → is-positive-ℚ s → + is-in-closed-interval-ℚ (p *ℚ s) (q *ℚ s) (r *ℚ s) + left-mul-positive-closed-interval-ℚ p q r s (p≤r , r≤q) pos-s = + let + s⁺ = s , pos-s + in + preserves-leq-right-mul-ℚ⁺ s⁺ p r p≤r , + preserves-leq-right-mul-ℚ⁺ s⁺ r q r≤q + left-mul-closed-interval-ℚ : (p q r s : ℚ) → is-in-closed-interval-ℚ p q r → is-in-unordered-closed-interval-ℚ (p *ℚ s) (q *ℚ s) (r *ℚ s) - left-mul-closed-interval-ℚ p q r s (p≤r , r≤q) = + left-mul-closed-interval-ℚ p q r s H@(p≤r , r≤q) = let p≤q = transitive-leq-ℚ p r q r≤q p≤r in @@ -78,18 +133,12 @@ abstract ( s) ( zero-ℚ) ( λ s<0 → - let - s⁻ = s , is-negative-le-zero-ℚ s s<0 - qs≤ps = reverses-leq-right-mul-ℚ⁻ s⁻ p q p≤q - in - inv-tr - ( λ t → leq-ℚ t (r *ℚ s)) - ( right-leq-left-min-ℚ (p *ℚ s) (q *ℚ s) qs≤ps) - ( reverses-leq-right-mul-ℚ⁻ s⁻ r q r≤q) , - inv-tr - ( leq-ℚ (r *ℚ s)) - ( right-leq-left-max-ℚ (p *ℚ s) (q *ℚ s) qs≤ps) - ( reverses-leq-right-mul-ℚ⁻ s⁻ p r p≤r)) + is-in-reversed-unordered-closed-interval-is-in-closed-interval-ℚ + (q *ℚ s) + (p *ℚ s) + (r *ℚ s) + ( left-mul-negative-closed-interval-ℚ p q r s H + ( is-negative-le-zero-ℚ s s<0))) ( λ s=0 → let ps=0 = ap (p *ℚ_) s=0 ∙ right-zero-law-mul-ℚ p @@ -101,22 +150,18 @@ abstract ( _) ( ap-binary min-ℚ ps=0 qs=0 ∙ idempotent-min-ℚ zero-ℚ ∙ inv rs=0) , - leq-eq-ℚ _ _ - ( rs=0 ∙ - inv (ap-binary max-ℚ ps=0 qs=0 ∙ idempotent-max-ℚ zero-ℚ))) + leq-eq-ℚ + ( _) + ( _) + ( rs=0 ∙ + inv (ap-binary max-ℚ ps=0 qs=0 ∙ idempotent-max-ℚ zero-ℚ))) ( λ 0 Date: Mon, 24 Mar 2025 17:56:35 -0700 Subject: [PATCH 109/119] Progress --- .../closed-intervals-rational-numbers.lagda.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md index c139b411d7..86535643cd 100644 --- a/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md +++ b/src/elementary-number-theory/closed-intervals-rational-numbers.lagda.md @@ -62,7 +62,8 @@ is-in-unordered-closed-interval-ℚ p q = is-in-closed-interval-ℚ (min-ℚ p q) (max-ℚ p q) is-in-unordered-closed-interval-is-in-closed-interval-ℚ : - (p q r : ℚ) → is-in-closed-interval-ℚ p q r → + (p q r : ℚ) → + is-in-closed-interval-ℚ p q r → is-in-unordered-closed-interval-ℚ p q r is-in-unordered-closed-interval-is-in-closed-interval-ℚ p q r (p≤r , q≤r) = transitive-leq-ℚ @@ -103,7 +104,8 @@ is-in-reversed-unordered-closed-interval-is-in-closed-interval-ℚ ```agda abstract - left-mul-negative-closed-interval-ℚ : (p q r s : ℚ) → + left-mul-negative-closed-interval-ℚ : + (p q r s : ℚ) → is-in-closed-interval-ℚ p q r → is-negative-ℚ s → is-in-closed-interval-ℚ (q *ℚ s) (p *ℚ s) (r *ℚ s) left-mul-negative-closed-interval-ℚ p q r s (p≤r , r≤q) neg-s = @@ -113,7 +115,8 @@ abstract reverses-leq-right-mul-ℚ⁻ s⁻ r q r≤q , reverses-leq-right-mul-ℚ⁻ s⁻ p r p≤r - left-mul-positive-closed-interval-ℚ : (p q r s : ℚ) → + left-mul-positive-closed-interval-ℚ : + (p q r s : ℚ) → is-in-closed-interval-ℚ p q r → is-positive-ℚ s → is-in-closed-interval-ℚ (p *ℚ s) (q *ℚ s) (r *ℚ s) left-mul-positive-closed-interval-ℚ p q r s (p≤r , r≤q) pos-s = From 674b50d8efea63848bd9e4da5e94c12531fcb985 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 24 Mar 2025 19:19:21 -0700 Subject: [PATCH 110/119] Progress --- .../absolute-value-rational-numbers.lagda.md | 203 +++++++++++++++--- .../nonnegative-rational-numbers.lagda.md | 51 +++++ 2 files changed, 225 insertions(+), 29 deletions(-) diff --git a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md index a6038f4845..6180e8729d 100644 --- a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md +++ b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md @@ -13,6 +13,7 @@ open import elementary-number-theory.rational-numbers open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.nonnegative-rational-numbers open import elementary-number-theory.maximum-rational-numbers +open import elementary-number-theory.multiplication-rational-numbers open import foundation.action-on-identifications-functions open import foundation.action-on-identifications-binary-functions @@ -21,6 +22,7 @@ open import foundation.coproduct-types open import foundation.dependent-pair-types open import foundation.identity-types open import foundation.transport-along-identifications +open import foundation.binary-transport ```
@@ -124,30 +126,31 @@ abstract ### The absolute value of `q` is zero iff `q` is zero ```agda -eq-zero-eq-abs-zero-ℚ : (q : ℚ) → abs-ℚ q = zero-ℚ⁰⁺ → q = zero-ℚ -eq-zero-eq-abs-zero-ℚ q abs=0 = - rec-coproduct - ( λ 0≤q → - antisymmetric-leq-ℚ - ( q) - ( zero-ℚ) - ( tr (leq-ℚ q) (ap rational-ℚ⁰⁺ abs=0) (leq-abs-ℚ q)) 0≤q) - ( λ q≤0 → - antisymmetric-leq-ℚ - ( q) - ( zero-ℚ) - ( q≤0) - ( tr - ( leq-ℚ zero-ℚ) - ( neg-neg-ℚ q) - ( neg-leq-ℚ - ( neg-ℚ q) - ( zero-ℚ) - ( tr (leq-ℚ (neg-ℚ q)) (ap rational-ℚ⁰⁺ abs=0) (leq-neg-abs-ℚ q))))) - (linear-leq-ℚ zero-ℚ q) +abstract + eq-zero-eq-abs-zero-ℚ : (q : ℚ) → abs-ℚ q = zero-ℚ⁰⁺ → q = zero-ℚ + eq-zero-eq-abs-zero-ℚ q abs=0 = + rec-coproduct + ( λ 0≤q → + antisymmetric-leq-ℚ + ( q) + ( zero-ℚ) + ( tr (leq-ℚ q) (ap rational-ℚ⁰⁺ abs=0) (leq-abs-ℚ q)) 0≤q) + ( λ q≤0 → + antisymmetric-leq-ℚ + ( q) + ( zero-ℚ) + ( q≤0) + ( tr + ( leq-ℚ zero-ℚ) + ( neg-neg-ℚ q) + ( neg-leq-ℚ + ( neg-ℚ q) + ( zero-ℚ) + ( tr (leq-ℚ (neg-ℚ q)) (ap rational-ℚ⁰⁺ abs=0) (leq-neg-abs-ℚ q))))) + (linear-leq-ℚ zero-ℚ q) -abs-zero-ℚ : abs-ℚ zero-ℚ = zero-ℚ⁰⁺ -abs-zero-ℚ = eq-ℚ⁰⁺ (left-leq-right-max-ℚ _ _ (refl-leq-ℚ zero-ℚ)) + abs-zero-ℚ : abs-ℚ zero-ℚ = zero-ℚ⁰⁺ + abs-zero-ℚ = eq-ℚ⁰⁺ (left-leq-right-max-ℚ _ _ (refl-leq-ℚ zero-ℚ)) ``` ### The triangle inequality @@ -187,19 +190,161 @@ abstract ( p +ℚ q) ( p) ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) - {! !} - {! !}) - {! !} + ( inv-tr + ( leq-ℚ p) + ( ap (_+ℚ rational-abs-ℚ q) (rational-abs-zero-leq-ℚ p 0≤p)) + ( is-inflationary-map-right-add-rational-ℚ⁰⁺ (abs-ℚ q) p)) + ( tr + ( leq-ℚ (p +ℚ q)) + ( right-unit-law-add-ℚ p) + ( preserves-leq-right-add-ℚ p q zero-ℚ q≤0))) + ( transitive-leq-ℚ + ( neg-ℚ (p +ℚ q)) + ( neg-ℚ q) + ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + ( inv-tr + ( λ r → leq-ℚ (neg-ℚ q) (rational-abs-ℚ p +ℚ r)) + ( rational-abs-leq-zero-ℚ q q≤0) + ( is-inflationary-map-left-add-rational-ℚ⁰⁺ (abs-ℚ p) (neg-ℚ q))) + ( binary-tr + ( leq-ℚ) + ( inv (distributive-neg-add-ℚ p q)) + ( left-unit-law-add-ℚ (neg-ℚ q)) + ( preserves-leq-left-add-ℚ + ( neg-ℚ q) + ( neg-ℚ p) + ( zero-ℚ) + ( neg-leq-ℚ zero-ℚ p 0≤p)))) ... | inr p≤0 | inl 0≤q = leq-max-leq-both-ℚ ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) ( p +ℚ q) ( neg-ℚ (p +ℚ q)) - {! !} - {! !} + ( transitive-leq-ℚ + ( p +ℚ q) + ( q) + ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + ( tr + ( λ r → leq-ℚ r (rational-abs-ℚ p +ℚ rational-abs-ℚ q)) + ( rational-abs-zero-leq-ℚ q 0≤q) + ( is-inflationary-map-left-add-rational-ℚ⁰⁺ + ( abs-ℚ p) + ( rational-abs-ℚ q))) + ( tr + ( leq-ℚ (p +ℚ q)) + ( left-unit-law-add-ℚ q) + ( preserves-leq-left-add-ℚ q p zero-ℚ p≤0))) + ( transitive-leq-ℚ + ( neg-ℚ (p +ℚ q)) + ( neg-ℚ p) + ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + ( inv-tr + ( leq-ℚ (neg-ℚ p)) + ( ap (_+ℚ rational-abs-ℚ q) (rational-abs-leq-zero-ℚ p p≤0)) + ( is-inflationary-map-right-add-rational-ℚ⁰⁺ (abs-ℚ q) (neg-ℚ p))) + ( binary-tr + ( leq-ℚ) + ( inv (distributive-neg-add-ℚ p q)) + ( right-unit-law-add-ℚ (neg-ℚ p)) + ( preserves-leq-right-add-ℚ + ( neg-ℚ p) + ( neg-ℚ q) + ( zero-ℚ) + ( neg-leq-ℚ zero-ℚ q 0≤q)))) ... | inr p≤0 | inr q≤0 = leq-eq-ℚ ( rational-abs-ℚ (p +ℚ q)) ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) - {! !} + ( equational-reasoning + rational-abs-ℚ (p +ℚ q) + = neg-ℚ (p +ℚ q) + by + rational-abs-leq-zero-ℚ + ( p +ℚ q) + ( tr + ( λ r → leq-ℚ (p +ℚ q) r) + ( left-unit-law-add-ℚ zero-ℚ) + ( preserves-leq-add-ℚ {p} {zero-ℚ} {q} {zero-ℚ} p≤0 q≤0)) + = neg-ℚ p +ℚ neg-ℚ q by distributive-neg-add-ℚ p q + = rational-abs-ℚ p +ℚ rational-abs-ℚ q + by + inv + ( ap-add-ℚ + ( rational-abs-leq-zero-ℚ p p≤0) + ( rational-abs-leq-zero-ℚ q q≤0))) +``` + +### `|ab| = |a||b|` + +```agda +abstract + abs-left-mul-nonnegative-ℚ : + (q : ℚ) (p : ℚ⁰⁺) → abs-ℚ (rational-ℚ⁰⁺ p *ℚ q) = p *ℚ⁰⁺ abs-ℚ q + abs-left-mul-nonnegative-ℚ q p⁰⁺@(p , nonneg-p) with linear-leq-ℚ zero-ℚ q + ... | inl 0≤q = + eq-ℚ⁰⁺ + ( equational-reasoning + rational-abs-ℚ (p *ℚ q) + = p *ℚ q + by + ap + ( rational-ℚ⁰⁺) + ( abs-rational-ℚ⁰⁺ + ( p⁰⁺ *ℚ⁰⁺ (q , is-nonnegative-leq-zero-ℚ q 0≤q))) + = p *ℚ rational-abs-ℚ q + by ap (p *ℚ_) (inv (rational-abs-zero-leq-ℚ q 0≤q))) + ... | inr q≤0 = + eq-ℚ⁰⁺ + ( equational-reasoning + rational-abs-ℚ (p *ℚ q) + = rational-abs-ℚ (neg-ℚ (p *ℚ q)) + by ap rational-ℚ⁰⁺ (inv (abs-neg-ℚ (p *ℚ q))) + = rational-abs-ℚ (p *ℚ neg-ℚ q) + by ap rational-abs-ℚ (inv (right-negative-law-mul-ℚ p q)) + = p *ℚ neg-ℚ q + by + ap + ( rational-ℚ⁰⁺) + ( abs-rational-ℚ⁰⁺ + ( p⁰⁺ *ℚ⁰⁺ + ( neg-ℚ q , + is-nonnegative-leq-zero-ℚ + ( neg-ℚ q) + ( neg-leq-ℚ q zero-ℚ q≤0)))) + = p *ℚ rational-abs-ℚ q + by ap (p *ℚ_) (inv (rational-abs-leq-zero-ℚ q q≤0))) + + abs-mul-ℚ : (p q : ℚ) → abs-ℚ (p *ℚ q) = abs-ℚ p *ℚ⁰⁺ abs-ℚ q + abs-mul-ℚ p q with linear-leq-ℚ zero-ℚ p + ... | inl 0≤p = + eq-ℚ⁰⁺ + ( equational-reasoning + rational-abs-ℚ (p *ℚ q) + = p *ℚ rational-abs-ℚ q + by + ap + ( rational-ℚ⁰⁺) + ( abs-left-mul-nonnegative-ℚ + ( q) + ( p , is-nonnegative-leq-zero-ℚ p 0≤p)) + = rational-abs-ℚ p *ℚ rational-abs-ℚ q + by ap (_*ℚ rational-abs-ℚ q) (inv (rational-abs-zero-leq-ℚ p 0≤p))) + ... | inr p≤0 = + eq-ℚ⁰⁺ + ( equational-reasoning + rational-abs-ℚ (p *ℚ q) + = rational-abs-ℚ (neg-ℚ (p *ℚ q)) + by ap rational-ℚ⁰⁺ (inv (abs-neg-ℚ (p *ℚ q))) + = rational-abs-ℚ (neg-ℚ p *ℚ q) + by ap rational-abs-ℚ (inv (left-negative-law-mul-ℚ p q)) + = neg-ℚ p *ℚ rational-abs-ℚ q + by + ap + ( rational-ℚ⁰⁺) + ( abs-left-mul-nonnegative-ℚ + ( q) + ( neg-ℚ p , + is-nonnegative-leq-zero-ℚ (neg-ℚ p) (neg-leq-ℚ p zero-ℚ p≤0))) + = rational-abs-ℚ p *ℚ rational-abs-ℚ q + by ap (_*ℚ rational-abs-ℚ q) (inv (rational-abs-leq-zero-ℚ p p≤0))) ``` diff --git a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md index 97cba10d17..8b4d1d415e 100644 --- a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md @@ -19,6 +19,7 @@ open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integer-fractions open import elementary-number-theory.multiplication-integers open import elementary-number-theory.multiplication-positive-and-negative-integers +open import order-theory.inflationary-maps-posets open import elementary-number-theory.multiplication-rational-numbers open import elementary-number-theory.nonnegative-integer-fractions open import elementary-number-theory.nonnegative-integers @@ -30,6 +31,7 @@ open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.reduced-integer-fractions open import elementary-number-theory.strict-inequality-rational-numbers +open import elementary-number-theory.decidable-total-order-rational-numbers open import foundation.binary-transport open import foundation.dependent-pair-types @@ -270,6 +272,30 @@ infixl 35 _+ℚ⁰⁺_ _+ℚ⁰⁺_ = add-ℚ⁰⁺ ``` +### Multiplication on nonnegative rational numbers + +```agda +abstract + is-nonnegative-mul-ℚ : + (p q : ℚ) → is-nonnegative-ℚ p → is-nonnegative-ℚ q → + is-nonnegative-ℚ (p *ℚ q) + is-nonnegative-mul-ℚ p q nonneg-p nonneg-q = + is-nonnegative-rational-fraction-ℤ + ( is-nonnegative-mul-nonnegative-fraction-ℤ + { fraction-ℚ p} + { fraction-ℚ q} + ( nonneg-p) + ( nonneg-q)) + +mul-ℚ⁰⁺ : ℚ⁰⁺ → ℚ⁰⁺ → ℚ⁰⁺ +mul-ℚ⁰⁺ (p , nonneg-p) (q , nonneg-q) = + p *ℚ q , is-nonnegative-mul-ℚ p q nonneg-p nonneg-q + +infixl 35 _*ℚ⁰⁺_ +_*ℚ⁰⁺_ = mul-ℚ⁰⁺ +``` + + ### Inequality on nonnegative rational numbers ```agda @@ -279,3 +305,28 @@ leq-ℚ⁰⁺-Prop (p , _) (q , _) = leq-ℚ-Prop p q leq-ℚ⁰⁺ : ℚ⁰⁺ → ℚ⁰⁺ → UU lzero leq-ℚ⁰⁺ (p , _) (q , _) = leq-ℚ p q ``` + +### Addition of a nonnegative rational number is an increasing map + +```agda +abstract + is-inflationary-map-left-add-rational-ℚ⁰⁺ : + (p : ℚ⁰⁺) → is-inflationary-map-Poset ℚ-Poset (rational-ℚ⁰⁺ p +ℚ_) + is-inflationary-map-left-add-rational-ℚ⁰⁺ (p , nonneg-p) q = + tr + ( λ r → leq-ℚ r (p +ℚ q)) + ( left-unit-law-add-ℚ q) + ( preserves-leq-left-add-ℚ + ( q) + ( zero-ℚ) + ( p) + ( leq-zero-is-nonnegative-ℚ p nonneg-p)) + + is-inflationary-map-right-add-rational-ℚ⁰⁺ : + (p : ℚ⁰⁺) → is-inflationary-map-Poset ℚ-Poset (_+ℚ rational-ℚ⁰⁺ p) + is-inflationary-map-right-add-rational-ℚ⁰⁺ p q = + tr + ( leq-ℚ q) + ( commutative-add-ℚ (rational-ℚ⁰⁺ p) q) + ( is-inflationary-map-left-add-rational-ℚ⁰⁺ p q) +``` From 23533b25ce638eafd9214d7b8e387f202969cb38 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 24 Mar 2025 19:21:07 -0700 Subject: [PATCH 111/119] make pre-commit --- src/elementary-number-theory.lagda.md | 1 + .../absolute-value-rational-numbers.lagda.md | 15 +++++++++------ .../maximum-rational-numbers.lagda.md | 2 +- .../nonnegative-rational-numbers.lagda.md | 9 +++++---- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/elementary-number-theory.lagda.md b/src/elementary-number-theory.lagda.md index 834e941a68..fa10aaf874 100644 --- a/src/elementary-number-theory.lagda.md +++ b/src/elementary-number-theory.lagda.md @@ -10,6 +10,7 @@ module elementary-number-theory where open import elementary-number-theory.absolute-value-integers public +open import elementary-number-theory.absolute-value-rational-numbers public open import elementary-number-theory.ackermann-function public open import elementary-number-theory.addition-integer-fractions public open import elementary-number-theory.addition-integers public diff --git a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md index 6180e8729d..a4c0787405 100644 --- a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md +++ b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md @@ -9,20 +9,20 @@ module elementary-number-theory.absolute-value-rational-numbers where ```agda open import elementary-number-theory.addition-rational-numbers -open import elementary-number-theory.rational-numbers open import elementary-number-theory.inequality-rational-numbers -open import elementary-number-theory.nonnegative-rational-numbers open import elementary-number-theory.maximum-rational-numbers open import elementary-number-theory.multiplication-rational-numbers +open import elementary-number-theory.nonnegative-rational-numbers +open import elementary-number-theory.rational-numbers -open import foundation.action-on-identifications-functions open import foundation.action-on-identifications-binary-functions -open import foundation.function-types +open import foundation.action-on-identifications-functions +open import foundation.binary-transport open import foundation.coproduct-types open import foundation.dependent-pair-types +open import foundation.function-types open import foundation.identity-types open import foundation.transport-along-identifications -open import foundation.binary-transport ``` @@ -146,7 +146,10 @@ abstract ( neg-leq-ℚ ( neg-ℚ q) ( zero-ℚ) - ( tr (leq-ℚ (neg-ℚ q)) (ap rational-ℚ⁰⁺ abs=0) (leq-neg-abs-ℚ q))))) + ( tr + ( leq-ℚ (neg-ℚ q)) + ( ap rational-ℚ⁰⁺ abs=0) + ( leq-neg-abs-ℚ q))))) (linear-leq-ℚ zero-ℚ q) abs-zero-ℚ : abs-ℚ zero-ℚ = zero-ℚ⁰⁺ diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index c76090fd7c..38bf272b27 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -12,8 +12,8 @@ open import elementary-number-theory.inequality-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.strict-inequality-rational-numbers -open import foundation.dependent-pair-types open import foundation.coproduct-types +open import foundation.dependent-pair-types open import foundation.identity-types open import foundation.logical-equivalences open import foundation.transport-along-identifications diff --git a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md index 8b4d1d415e..144319a4f6 100644 --- a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md @@ -11,6 +11,7 @@ module elementary-number-theory.nonnegative-rational-numbers where ```agda open import elementary-number-theory.addition-rational-numbers open import elementary-number-theory.cross-multiplication-difference-integer-fractions +open import elementary-number-theory.decidable-total-order-rational-numbers open import elementary-number-theory.difference-rational-numbers open import elementary-number-theory.inequality-integers open import elementary-number-theory.inequality-rational-numbers @@ -19,7 +20,6 @@ open import elementary-number-theory.integers open import elementary-number-theory.multiplication-integer-fractions open import elementary-number-theory.multiplication-integers open import elementary-number-theory.multiplication-positive-and-negative-integers -open import order-theory.inflationary-maps-posets open import elementary-number-theory.multiplication-rational-numbers open import elementary-number-theory.nonnegative-integer-fractions open import elementary-number-theory.nonnegative-integers @@ -31,7 +31,6 @@ open import elementary-number-theory.positive-rational-numbers open import elementary-number-theory.rational-numbers open import elementary-number-theory.reduced-integer-fractions open import elementary-number-theory.strict-inequality-rational-numbers -open import elementary-number-theory.decidable-total-order-rational-numbers open import foundation.binary-transport open import foundation.dependent-pair-types @@ -42,6 +41,8 @@ open import foundation.sets open import foundation.subtypes open import foundation.transport-along-identifications open import foundation.universe-levels + +open import order-theory.inflationary-maps-posets ``` @@ -202,7 +203,8 @@ module _ ```agda is-nonnegative-mul-nonnegative-ℚ : - {x y : ℚ} → is-nonnegative-ℚ x → is-nonnegative-ℚ y → is-nonnegative-ℚ (x *ℚ y) + {x y : ℚ} → is-nonnegative-ℚ x → is-nonnegative-ℚ y → + is-nonnegative-ℚ (x *ℚ y) is-nonnegative-mul-nonnegative-ℚ {x} {y} P Q = is-nonnegative-rational-fraction-ℤ ( is-nonnegative-mul-nonnegative-fraction-ℤ @@ -295,7 +297,6 @@ infixl 35 _*ℚ⁰⁺_ _*ℚ⁰⁺_ = mul-ℚ⁰⁺ ``` - ### Inequality on nonnegative rational numbers ```agda From 558ffd228232c5538805ba545f7ad72d32d5329b Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 24 Mar 2025 19:32:08 -0700 Subject: [PATCH 112/119] Remove duplicate declaration --- .../inequality-rational-numbers.lagda.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/elementary-number-theory/inequality-rational-numbers.lagda.md b/src/elementary-number-theory/inequality-rational-numbers.lagda.md index b82bcf2a15..690b806b34 100644 --- a/src/elementary-number-theory/inequality-rational-numbers.lagda.md +++ b/src/elementary-number-theory/inequality-rational-numbers.lagda.md @@ -422,13 +422,6 @@ pr1 (leq-iff-transpose-left-diff-ℚ x y z) = leq-transpose-left-diff-ℚ x y z pr2 (leq-iff-transpose-left-diff-ℚ x y z) = leq-transpose-right-add-ℚ x z y ``` -### Negation of rational numbers reverses inequality - -```agda -neg-leq-ℚ : (x y : ℚ) → leq-ℚ x y → leq-ℚ (neg-ℚ y) (neg-ℚ x) -neg-leq-ℚ x y = neg-leq-fraction-ℤ (fraction-ℚ x) (fraction-ℚ y) -``` - ## See also - The decidable total order on the rational numbers is defined in From 45fca9a0fd03c33f25298f3da7940c423faf6409 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 26 Mar 2025 08:25:29 -0700 Subject: [PATCH 113/119] make pre-commit --- .../absolute-value-rational-numbers.lagda.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md index a4c0787405..bb5bf2b1ce 100644 --- a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md +++ b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md @@ -29,7 +29,8 @@ open import foundation.transport-along-identifications ## Idea -The {{#concept "absolute value" Disambiguation="of a rational number" Agda=abs-ℚ WD="absolute value" WDID=Q120812}} +The +{{#concept "absolute value" Disambiguation="of a rational number" Agda=abs-ℚ WD="absolute value" WDID=Q120812}} a rational number is the greater of itself and its negation. ## Definition From f547f4eca66c03e094cedb32771718c0f871e2c1 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Wed, 26 Mar 2025 22:05:37 -0700 Subject: [PATCH 114/119] Simplifications --- .../absolute-value-rational-numbers.lagda.md | 147 +++++++----------- .../maximum-rational-numbers.lagda.md | 10 ++ 2 files changed, 67 insertions(+), 90 deletions(-) diff --git a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md index bb5bf2b1ce..149374c8fe 100644 --- a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md +++ b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md @@ -161,43 +161,40 @@ abstract ```agda abstract - triangle-inequality-abs-ℚ : - (p q : ℚ) → leq-ℚ⁰⁺ (abs-ℚ (p +ℚ q)) (abs-ℚ p +ℚ⁰⁺ abs-ℚ q) - triangle-inequality-abs-ℚ p q - with linear-leq-ℚ zero-ℚ p | linear-leq-ℚ zero-ℚ q - ... | inl 0≤p | inl 0≤q = + triangle-inequality-nonneg-abs-ℚ : + (p : ℚ⁰⁺) → (q : ℚ) → + leq-ℚ⁰⁺ (abs-ℚ (rational-ℚ⁰⁺ p +ℚ q)) (p +ℚ⁰⁺ abs-ℚ q) + triangle-inequality-nonneg-abs-ℚ p⁰⁺@(p , nonneg-p) q + with linear-leq-ℚ zero-ℚ q + ... | inl 0≤q = leq-eq-ℚ ( rational-abs-ℚ (p +ℚ q)) - ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) - ( equational-reasoning - rational-abs-ℚ (p +ℚ q) - = p +ℚ q - by - rational-abs-zero-leq-ℚ - ( p +ℚ q) - ( tr - ( λ r → leq-ℚ r (p +ℚ q)) - ( left-unit-law-add-ℚ zero-ℚ) - ( preserves-leq-add-ℚ {zero-ℚ} {p} {zero-ℚ} {q} 0≤p 0≤q)) - = rational-abs-ℚ p +ℚ rational-abs-ℚ q - by - ap-binary - ( add-ℚ) - ( inv (rational-abs-zero-leq-ℚ p 0≤p)) - ( inv (rational-abs-zero-leq-ℚ q 0≤q))) - ... | inl 0≤p | inr q≤0 = + ( p +ℚ rational-abs-ℚ q) + ( rational-abs-zero-leq-ℚ + ( p +ℚ q) + ( tr + ( λ r → leq-ℚ r (p +ℚ q)) + ( left-unit-law-add-ℚ zero-ℚ) + ( preserves-leq-add-ℚ + { zero-ℚ} + { p} + { zero-ℚ} + { q} + ( leq-zero-is-nonnegative-ℚ p nonneg-p) + ( 0≤q))) ∙ + ap-add-ℚ + ( refl) + ( inv (rational-abs-zero-leq-ℚ q 0≤q))) + ... | inr q≤0 = leq-max-leq-both-ℚ - ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + ( p +ℚ rational-abs-ℚ q) ( p +ℚ q) ( neg-ℚ (p +ℚ q)) ( transitive-leq-ℚ ( p +ℚ q) ( p) - ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) - ( inv-tr - ( leq-ℚ p) - ( ap (_+ℚ rational-abs-ℚ q) (rational-abs-zero-leq-ℚ p 0≤p)) - ( is-inflationary-map-right-add-rational-ℚ⁰⁺ (abs-ℚ q) p)) + ( p +ℚ rational-abs-ℚ q) + ( is-inflationary-map-right-add-rational-ℚ⁰⁺ (abs-ℚ q) p) ( tr ( leq-ℚ (p +ℚ q)) ( right-unit-law-add-ℚ p) @@ -205,11 +202,11 @@ abstract ( transitive-leq-ℚ ( neg-ℚ (p +ℚ q)) ( neg-ℚ q) - ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + ( p +ℚ rational-abs-ℚ q) ( inv-tr - ( λ r → leq-ℚ (neg-ℚ q) (rational-abs-ℚ p +ℚ r)) + ( λ r → leq-ℚ (neg-ℚ q) (p +ℚ r)) ( rational-abs-leq-zero-ℚ q q≤0) - ( is-inflationary-map-left-add-rational-ℚ⁰⁺ (abs-ℚ p) (neg-ℚ q))) + ( is-inflationary-map-left-add-rational-ℚ⁰⁺ p⁰⁺ (neg-ℚ q))) ( binary-tr ( leq-ℚ) ( inv (distributive-neg-add-ℚ p q)) @@ -218,64 +215,34 @@ abstract ( neg-ℚ q) ( neg-ℚ p) ( zero-ℚ) - ( neg-leq-ℚ zero-ℚ p 0≤p)))) - ... | inr p≤0 | inl 0≤q = - leq-max-leq-both-ℚ - ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) - ( p +ℚ q) - ( neg-ℚ (p +ℚ q)) - ( transitive-leq-ℚ - ( p +ℚ q) - ( q) - ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) - ( tr - ( λ r → leq-ℚ r (rational-abs-ℚ p +ℚ rational-abs-ℚ q)) - ( rational-abs-zero-leq-ℚ q 0≤q) - ( is-inflationary-map-left-add-rational-ℚ⁰⁺ - ( abs-ℚ p) - ( rational-abs-ℚ q))) - ( tr - ( leq-ℚ (p +ℚ q)) - ( left-unit-law-add-ℚ q) - ( preserves-leq-left-add-ℚ q p zero-ℚ p≤0))) - ( transitive-leq-ℚ - ( neg-ℚ (p +ℚ q)) - ( neg-ℚ p) - ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) - ( inv-tr - ( leq-ℚ (neg-ℚ p)) - ( ap (_+ℚ rational-abs-ℚ q) (rational-abs-leq-zero-ℚ p p≤0)) - ( is-inflationary-map-right-add-rational-ℚ⁰⁺ (abs-ℚ q) (neg-ℚ p))) - ( binary-tr - ( leq-ℚ) - ( inv (distributive-neg-add-ℚ p q)) - ( right-unit-law-add-ℚ (neg-ℚ p)) - ( preserves-leq-right-add-ℚ - ( neg-ℚ p) - ( neg-ℚ q) - ( zero-ℚ) - ( neg-leq-ℚ zero-ℚ q 0≤q)))) - ... | inr p≤0 | inr q≤0 = - leq-eq-ℚ - ( rational-abs-ℚ (p +ℚ q)) - ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) - ( equational-reasoning - rational-abs-ℚ (p +ℚ q) - = neg-ℚ (p +ℚ q) - by - rational-abs-leq-zero-ℚ - ( p +ℚ q) - ( tr - ( λ r → leq-ℚ (p +ℚ q) r) - ( left-unit-law-add-ℚ zero-ℚ) - ( preserves-leq-add-ℚ {p} {zero-ℚ} {q} {zero-ℚ} p≤0 q≤0)) - = neg-ℚ p +ℚ neg-ℚ q by distributive-neg-add-ℚ p q - = rational-abs-ℚ p +ℚ rational-abs-ℚ q - by - inv - ( ap-add-ℚ - ( rational-abs-leq-zero-ℚ p p≤0) - ( rational-abs-leq-zero-ℚ q q≤0))) + ( neg-leq-ℚ zero-ℚ p (leq-zero-is-nonnegative-ℚ p nonneg-p))))) + + triangle-inequality-abs-ℚ : + (p q : ℚ) → leq-ℚ⁰⁺ (abs-ℚ (p +ℚ q)) (abs-ℚ p +ℚ⁰⁺ abs-ℚ q) + triangle-inequality-abs-ℚ p q + with linear-leq-ℚ zero-ℚ p + ... | inl 0≤p = + let + p⁰⁺ = p , is-nonnegative-leq-zero-ℚ p 0≤p + in + inv-tr + ( λ r → leq-ℚ⁰⁺ (abs-ℚ (p +ℚ q)) (r +ℚ⁰⁺ abs-ℚ q)) + ( abs-rational-ℚ⁰⁺ p⁰⁺) + ( triangle-inequality-nonneg-abs-ℚ p⁰⁺ q) + ... | inr p≤0 = + binary-tr + ( leq-ℚ) + ( ap + ( rational-ℚ⁰⁺) + ( ap abs-ℚ (inv (distributive-neg-add-ℚ p q)) ∙ + abs-neg-ℚ (p +ℚ q))) + ( ap-add-ℚ + ( inv (rational-abs-leq-zero-ℚ p p≤0)) + ( ap rational-ℚ⁰⁺ (abs-neg-ℚ q))) + ( triangle-inequality-nonneg-abs-ℚ + ( neg-ℚ p , + is-nonnegative-leq-zero-ℚ (neg-ℚ p) (neg-leq-ℚ p zero-ℚ p≤0)) + ( neg-ℚ q)) ``` ### `|ab| = |a||b|` diff --git a/src/elementary-number-theory/maximum-rational-numbers.lagda.md b/src/elementary-number-theory/maximum-rational-numbers.lagda.md index 2424c0e378..80cde98f19 100644 --- a/src/elementary-number-theory/maximum-rational-numbers.lagda.md +++ b/src/elementary-number-theory/maximum-rational-numbers.lagda.md @@ -116,6 +116,16 @@ abstract ( y) ( y≤x)) ( x Date: Thu, 27 Mar 2025 13:03:03 -0700 Subject: [PATCH 115/119] Review comments --- .../absolute-value-rational-numbers.lagda.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md index 149374c8fe..03d72bc975 100644 --- a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md +++ b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md @@ -2,6 +2,7 @@ ```agda {-# OPTIONS --lossy-unification #-} + module elementary-number-theory.absolute-value-rational-numbers where ``` @@ -31,7 +32,9 @@ open import foundation.transport-along-identifications The {{#concept "absolute value" Disambiguation="of a rational number" Agda=abs-ℚ WD="absolute value" WDID=Q120812}} -a rational number is the greater of itself and its negation. +of a [rational number](elementary-number-theory.rational-numbers.md) is the +[greater](elementary-number-theory.maximum-rational-numbers.md) of itself and +its negation. ## Definition From b0c623af4a7304f11de9b5403aa465e67908bb5d Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 30 Mar 2025 08:09:55 -0700 Subject: [PATCH 116/119] Apply suggestions from code review Co-authored-by: Fredrik Bakke --- .../nonnegative-rational-numbers.lagda.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md index 144319a4f6..7cca644a90 100644 --- a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md @@ -142,7 +142,7 @@ abstract nonnegative-rational-nonnegative-ℤ : nonnegative-ℤ → ℚ⁰⁺ nonnegative-rational-nonnegative-ℤ (x , x-is-neg) = - rational-ℤ x , is-nonnegative-rational-ℤ x x-is-neg + ( rational-ℤ x , is-nonnegative-rational-ℤ x x-is-neg) ``` ### The rational image of a nonnegative integer fraction is nonnegative @@ -177,8 +177,8 @@ module _ is-nonnegative-iff-leq-zero-ℚ : is-nonnegative-ℚ x ↔ leq-ℚ zero-ℚ x is-nonnegative-iff-leq-zero-ℚ = - leq-zero-is-nonnegative-ℚ , - is-nonnegative-leq-zero-ℚ + ( leq-zero-is-nonnegative-ℚ , + is-nonnegative-leq-zero-ℚ) ``` ### The difference of a rational number with a rational number less than or equal to the first is nonnegative @@ -196,7 +196,7 @@ module _ ( backward-implication (iff-translate-diff-leq-zero-ℚ x y) H) nonnegative-diff-le-ℚ : ℚ⁰⁺ - nonnegative-diff-le-ℚ = y -ℚ x , is-nonnegative-diff-leq-ℚ + nonnegative-diff-le-ℚ = (y -ℚ x , is-nonnegative-diff-leq-ℚ) ``` ### The product of two nonnegative rational numbers is nonnegative @@ -268,7 +268,7 @@ abstract add-ℚ⁰⁺ : ℚ⁰⁺ → ℚ⁰⁺ → ℚ⁰⁺ add-ℚ⁰⁺ (p , nonneg-p) (q , nonneg-q) = - p +ℚ q , is-nonnegative-add-ℚ p q nonneg-p nonneg-q + ( p +ℚ q , is-nonnegative-add-ℚ p q nonneg-p nonneg-q) infixl 35 _+ℚ⁰⁺_ _+ℚ⁰⁺_ = add-ℚ⁰⁺ @@ -291,9 +291,10 @@ abstract mul-ℚ⁰⁺ : ℚ⁰⁺ → ℚ⁰⁺ → ℚ⁰⁺ mul-ℚ⁰⁺ (p , nonneg-p) (q , nonneg-q) = - p *ℚ q , is-nonnegative-mul-ℚ p q nonneg-p nonneg-q + ( p *ℚ q , is-nonnegative-mul-ℚ p q nonneg-p nonneg-q) infixl 35 _*ℚ⁰⁺_ +_*ℚ⁰⁺_ : ℚ⁰⁺ → ℚ⁰⁺ → ℚ⁰⁺ _*ℚ⁰⁺_ = mul-ℚ⁰⁺ ``` From 36a50a0cc523834f6361d36d056ca65b1a17ab8b Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Sun, 30 Mar 2025 09:58:54 -0700 Subject: [PATCH 117/119] Update src/elementary-number-theory/nonnegative-rational-numbers.lagda.md Co-authored-by: Fredrik Bakke --- .../nonnegative-rational-numbers.lagda.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md index 7cca644a90..c2a4389043 100644 --- a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md @@ -271,6 +271,7 @@ add-ℚ⁰⁺ (p , nonneg-p) (q , nonneg-q) = ( p +ℚ q , is-nonnegative-add-ℚ p q nonneg-p nonneg-q) infixl 35 _+ℚ⁰⁺_ +_+ℚ⁰⁺_ : ℚ⁰⁺ → ℚ⁰⁺ → ℚ⁰⁺ _+ℚ⁰⁺_ = add-ℚ⁰⁺ ``` From 59b07a640f9f87e67cdee8f169ac26919bed6a79 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Mon, 31 Mar 2025 20:53:56 -0700 Subject: [PATCH 118/119] Simplification --- .../absolute-value-rational-numbers.lagda.md | 110 +++++------------- 1 file changed, 26 insertions(+), 84 deletions(-) diff --git a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md index 03d72bc975..7c69ea4eac 100644 --- a/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md +++ b/src/elementary-number-theory/absolute-value-rational-numbers.lagda.md @@ -123,8 +123,8 @@ abstract leq-abs-ℚ : (q : ℚ) → leq-ℚ q (rational-abs-ℚ q) leq-abs-ℚ q = leq-left-max-ℚ q (neg-ℚ q) - leq-neg-abs-ℚ : (q : ℚ) → leq-ℚ (neg-ℚ q) (rational-abs-ℚ q) - leq-neg-abs-ℚ q = leq-right-max-ℚ q (neg-ℚ q) + neg-leq-abs-ℚ : (q : ℚ) → leq-ℚ (neg-ℚ q) (rational-abs-ℚ q) + neg-leq-abs-ℚ q = leq-right-max-ℚ q (neg-ℚ q) ``` ### The absolute value of `q` is zero iff `q` is zero @@ -153,8 +153,8 @@ abstract ( tr ( leq-ℚ (neg-ℚ q)) ( ap rational-ℚ⁰⁺ abs=0) - ( leq-neg-abs-ℚ q))))) - (linear-leq-ℚ zero-ℚ q) + ( neg-leq-abs-ℚ q))))) + ( linear-leq-ℚ zero-ℚ q) abs-zero-ℚ : abs-ℚ zero-ℚ = zero-ℚ⁰⁺ abs-zero-ℚ = eq-ℚ⁰⁺ (left-leq-right-max-ℚ _ _ (refl-leq-ℚ zero-ℚ)) @@ -164,88 +164,30 @@ abstract ```agda abstract - triangle-inequality-nonneg-abs-ℚ : - (p : ℚ⁰⁺) → (q : ℚ) → - leq-ℚ⁰⁺ (abs-ℚ (rational-ℚ⁰⁺ p +ℚ q)) (p +ℚ⁰⁺ abs-ℚ q) - triangle-inequality-nonneg-abs-ℚ p⁰⁺@(p , nonneg-p) q - with linear-leq-ℚ zero-ℚ q - ... | inl 0≤q = - leq-eq-ℚ - ( rational-abs-ℚ (p +ℚ q)) - ( p +ℚ rational-abs-ℚ q) - ( rational-abs-zero-leq-ℚ - ( p +ℚ q) - ( tr - ( λ r → leq-ℚ r (p +ℚ q)) - ( left-unit-law-add-ℚ zero-ℚ) - ( preserves-leq-add-ℚ - { zero-ℚ} - { p} - { zero-ℚ} - { q} - ( leq-zero-is-nonnegative-ℚ p nonneg-p) - ( 0≤q))) ∙ - ap-add-ℚ - ( refl) - ( inv (rational-abs-zero-leq-ℚ q 0≤q))) - ... | inr q≤0 = - leq-max-leq-both-ℚ - ( p +ℚ rational-abs-ℚ q) - ( p +ℚ q) - ( neg-ℚ (p +ℚ q)) - ( transitive-leq-ℚ - ( p +ℚ q) - ( p) - ( p +ℚ rational-abs-ℚ q) - ( is-inflationary-map-right-add-rational-ℚ⁰⁺ (abs-ℚ q) p) - ( tr - ( leq-ℚ (p +ℚ q)) - ( right-unit-law-add-ℚ p) - ( preserves-leq-right-add-ℚ p q zero-ℚ q≤0))) - ( transitive-leq-ℚ - ( neg-ℚ (p +ℚ q)) - ( neg-ℚ q) - ( p +ℚ rational-abs-ℚ q) - ( inv-tr - ( λ r → leq-ℚ (neg-ℚ q) (p +ℚ r)) - ( rational-abs-leq-zero-ℚ q q≤0) - ( is-inflationary-map-left-add-rational-ℚ⁰⁺ p⁰⁺ (neg-ℚ q))) - ( binary-tr - ( leq-ℚ) - ( inv (distributive-neg-add-ℚ p q)) - ( left-unit-law-add-ℚ (neg-ℚ q)) - ( preserves-leq-left-add-ℚ - ( neg-ℚ q) - ( neg-ℚ p) - ( zero-ℚ) - ( neg-leq-ℚ zero-ℚ p (leq-zero-is-nonnegative-ℚ p nonneg-p))))) - triangle-inequality-abs-ℚ : (p q : ℚ) → leq-ℚ⁰⁺ (abs-ℚ (p +ℚ q)) (abs-ℚ p +ℚ⁰⁺ abs-ℚ q) - triangle-inequality-abs-ℚ p q - with linear-leq-ℚ zero-ℚ p - ... | inl 0≤p = - let - p⁰⁺ = p , is-nonnegative-leq-zero-ℚ p 0≤p - in - inv-tr - ( λ r → leq-ℚ⁰⁺ (abs-ℚ (p +ℚ q)) (r +ℚ⁰⁺ abs-ℚ q)) - ( abs-rational-ℚ⁰⁺ p⁰⁺) - ( triangle-inequality-nonneg-abs-ℚ p⁰⁺ q) - ... | inr p≤0 = - binary-tr - ( leq-ℚ) - ( ap - ( rational-ℚ⁰⁺) - ( ap abs-ℚ (inv (distributive-neg-add-ℚ p q)) ∙ - abs-neg-ℚ (p +ℚ q))) - ( ap-add-ℚ - ( inv (rational-abs-leq-zero-ℚ p p≤0)) - ( ap rational-ℚ⁰⁺ (abs-neg-ℚ q))) - ( triangle-inequality-nonneg-abs-ℚ - ( neg-ℚ p , - is-nonnegative-leq-zero-ℚ (neg-ℚ p) (neg-leq-ℚ p zero-ℚ p≤0)) - ( neg-ℚ q)) + triangle-inequality-abs-ℚ p q = + leq-max-leq-both-ℚ + ( rational-abs-ℚ p +ℚ rational-abs-ℚ q) + ( _) + ( _) + ( preserves-leq-add-ℚ + { p} + { rational-abs-ℚ p} + { q} + { rational-abs-ℚ q} + ( leq-abs-ℚ p) + ( leq-abs-ℚ q)) + ( inv-tr + ( λ r → leq-ℚ r (rational-abs-ℚ p +ℚ rational-abs-ℚ q)) + ( distributive-neg-add-ℚ p q) + ( preserves-leq-add-ℚ + { neg-ℚ p} + { rational-abs-ℚ p} + { neg-ℚ q} + { rational-abs-ℚ q} + ( neg-leq-abs-ℚ p) + ( neg-leq-abs-ℚ q))) ``` ### `|ab| = |a||b|` From 96d274d6b36cbf40c6adcebf1d51ba4315e97f14 Mon Sep 17 00:00:00 2001 From: Louis Wasserman Date: Tue, 1 Apr 2025 08:15:33 -0700 Subject: [PATCH 119/119] Fix typo --- .../nonnegative-rational-numbers.lagda.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md index c2a4389043..808366d930 100644 --- a/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md +++ b/src/elementary-number-theory/nonnegative-rational-numbers.lagda.md @@ -52,7 +52,8 @@ open import order-theory.inflationary-maps-posets A [rational number](elementary-number-theory.rational-numbers.md) `x` is said to be {{#concept "nonnegative" Disambiguation="rational number" Agda=is-nonnegative-ℚ}} -if its negation is positive. +if its numerator is a +[nonnegative integer](elementary-number-theory.nonnegative-integers.md). Nonnegative rational numbers are a [subsemigroup](group-theory.subsemigroups.md) of the