Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimum and maximum on the lower, upper, and usual Dedekind real numbers #1335

Merged
merged 111 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
68ffc45
Associativity of min and max
lowasser Feb 8, 2025
4ac4f7d
Merge branch 'master' into min-max-associative
lowasser Feb 8, 2025
4a8b5c5
Formatting
lowasser Feb 8, 2025
6a9f837
Define lower Dedekind cuts/reals
lowasser Feb 9, 2025
ef39dd3
make pre-commit
lowasser Feb 9, 2025
59195c9
Define upper Dedekind reals
lowasser Feb 9, 2025
4233e28
make pre-commit
lowasser Feb 9, 2025
6ad62d5
Rename things
lowasser Feb 9, 2025
6bfb619
Formatting
lowasser Feb 9, 2025
fd8f384
Add new file
lowasser Feb 9, 2025
fb0d5d3
Fix line length
lowasser Feb 9, 2025
efaf647
Merge branch 'lower-upper-dedekind' into lower-upper-rational-dedekind
lowasser Feb 9, 2025
f21b948
Add rational upper reals
lowasser Feb 9, 2025
a3d3af9
Progress
lowasser Feb 9, 2025
ba687cd
Merge branch 'lower-upper-rational-dedekind' into lower-upper-inequality
lowasser Feb 9, 2025
fb18a45
Preservation of inequality
lowasser Feb 9, 2025
0aa663c
Define normal Dedekind reals in terms of lower and upper cuts
lowasser Feb 9, 2025
1f9f502
Merge branch 'lower-upper-inequality' into lower-upper-dedekind
lowasser Feb 9, 2025
7499c7c
Start negation
lowasser Feb 9, 2025
2185e18
Inequality on upper reals
lowasser Feb 9, 2025
f2da896
overhaul
lowasser Feb 10, 2025
70f181c
make pre-commit
lowasser Feb 10, 2025
9268779
a -> an
lowasser Feb 10, 2025
e40e90b
Merge branch 'master' into lower-upper-neg
lowasser Feb 10, 2025
1b9d81b
Rename some things
lowasser Feb 10, 2025
d40a43a
Merge branch 'master' into lower-upper-neg
lowasser Feb 10, 2025
f75209b
Some more theorems
lowasser Feb 11, 2025
6d17056
Merge branch 'master' into lower-upper-neg
lowasser Feb 11, 2025
098d4e8
Finish gaps
lowasser Feb 11, 2025
b3b72b2
Progress
lowasser Feb 11, 2025
56c4fe3
Merge remote-tracking branch 'origin/lower-upper-neg' into lower-uppe…
lowasser Feb 11, 2025
faaa937
Merge branch 'master' into lower-upper-neg
lowasser Feb 11, 2025
1f9d73a
Recover all the previous results
lowasser Feb 11, 2025
7857a80
Merge branch 'master' into lower-upper-neg
lowasser Feb 11, 2025
263f367
make pre-commit
lowasser Feb 11, 2025
a3da42d
Merge remote-tracking branch 'origin/lower-upper-neg' into lower-uppe…
lowasser Feb 11, 2025
3669840
Merge branch 'master' into lower-upper-neg
lowasser Feb 11, 2025
f235570
Remove empty bibliography
lowasser Feb 11, 2025
827111e
Review changes
lowasser Feb 11, 2025
f734874
Fix names
lowasser Feb 12, 2025
327479d
Progress
lowasser Feb 12, 2025
3a4c279
Merge branch 'master' into min-max-associative
lowasser Feb 12, 2025
80e1863
Merge
lowasser Feb 12, 2025
6eeef9a
Fix syntax
lowasser Feb 12, 2025
53e54d8
Fix links
lowasser Feb 12, 2025
71479ca
Fix naming
lowasser Feb 12, 2025
e535435
make pre-commit
lowasser Feb 12, 2025
bd83f7b
Start
lowasser Feb 12, 2025
fbbfe5e
Progress
lowasser Feb 12, 2025
c100494
Merge branch 'min-max-associative' into lower-upper-max-min
lowasser Feb 12, 2025
9444d9e
Progress
lowasser Feb 12, 2025
c62e125
Progress
lowasser Feb 12, 2025
ba7600c
Progress
lowasser Feb 12, 2025
178808f
Merge branch 'master' into lower-upper-neg
lowasser Feb 13, 2025
b524ba8
max-lower-R
lowasser Feb 13, 2025
0d68a13
make pre-commit
lowasser Feb 13, 2025
8c076b1
Progress
lowasser Feb 13, 2025
0f4ab58
Progress
lowasser Feb 13, 2025
4c342b2
Progress
lowasser Feb 13, 2025
a903440
More imports
lowasser Feb 13, 2025
42ad0b8
Merge branch 'min-max-associative' into inflattice
lowasser Feb 13, 2025
8df9c15
Merge branch 'master' into min-max-associative
lowasser Feb 13, 2025
f9e99ef
Merge branch 'min-max-associative' into inflattice
lowasser Feb 13, 2025
8aa85c0
Fix symbols in docs
lowasser Feb 13, 2025
24b6f2f
Merge branch 'add-rational-reals' into add-reals
lowasser Feb 13, 2025
6095330
Back off the hard bits
lowasser Feb 13, 2025
9a2c3d6
Merge branch 'master' into lower-upper-neg
lowasser Feb 13, 2025
7ad5d5f
Merge remote-tracking branch 'origin/lower-upper-neg' into lower-uppe…
lowasser Feb 13, 2025
23a33d3
Apply suggestions from code review
lowasser Feb 13, 2025
f2c3f76
renaming
lowasser Feb 13, 2025
b9f1d27
Fix formatting
lowasser Feb 13, 2025
3673163
make pre-commit
lowasser Feb 13, 2025
324595a
Respond to review comments
lowasser Feb 14, 2025
10a0a36
Inline explanations of lower and upper cuts
lowasser Feb 14, 2025
6430f86
Reword
lowasser Feb 14, 2025
73a9e40
Merge branch 'master' into inflattice
lowasser Feb 14, 2025
e64c537
Merge branch 'master' into lower-upper-neg
lowasser Feb 14, 2025
d35cc9a
Merge branch 'inflattice' into min-max-lower-upper
lowasser Feb 14, 2025
eb516ee
Merge branch 'lower-upper-neg' into min-max-lower-upper
lowasser Feb 14, 2025
02e1fdc
Typo fix
lowasser Feb 14, 2025
e11919b
Update src/order-theory/decidable-total-orders.lagda.md
lowasser Feb 14, 2025
96186d2
Merge branch 'master' into inflattice
lowasser Feb 14, 2025
a8d3b47
Merge branch 'master' into inflattice
lowasser Feb 16, 2025
c213682
Progress
lowasser Feb 18, 2025
2276510
Define minimum and maximum on real numbers
lowasser Feb 19, 2025
fff4eda
make pre-commit
lowasser Feb 19, 2025
89e5a16
Merge branch 'master' into min-max-lower-upper
lowasser Feb 19, 2025
e4ef49b
make pre-commit
lowasser Feb 19, 2025
f04c6fd
Fix links
lowasser Feb 19, 2025
eaaa9c3
Merge branch 'master' into inflattice
lowasser Feb 19, 2025
9a54be1
Merge remote-tracking branch 'origin/inflattice' into inflattice
lowasser Feb 19, 2025
58d4bda
Merge branch 'inflattice' into min-max-lower-upper
lowasser Feb 19, 2025
b4fb302
Fix md links
lowasser Feb 19, 2025
a3cb818
Merge branch 'master' into inflattice
lowasser Feb 23, 2025
304e48b
Merge branch 'master' into inflattice
lowasser Feb 23, 2025
ac9be28
Merge remote-tracking branch 'origin/inflattice' into inflattice
lowasser Feb 23, 2025
95c75a3
Merge branch 'inflattice' into min-max-lower-upper
lowasser Feb 23, 2025
70959e0
Merge branch 'master' into min-max-lower-upper
lowasser Feb 26, 2025
8f059f3
Merge branch 'master' into min-max-lower-upper
lowasser Mar 4, 2025
ac06508
Minor formatting
lowasser Mar 5, 2025
69171a6
Apply suggestions from code review
lowasser Mar 22, 2025
ba351a6
Merge branch 'master' into min-max-lower-upper
lowasser Mar 22, 2025
8b3ad05
Respond to review comments
lowasser Mar 22, 2025
fad7de3
make pre-commit
lowasser Mar 22, 2025
dd97d3b
Update src/real-numbers/maximum-real-numbers.lagda.md
fredrik-bakke Mar 23, 2025
3064497
Update src/real-numbers/minimum-upper-dedekind-real-numbers.lagda.md
fredrik-bakke Mar 23, 2025
2e2795e
Merge branch 'master' into min-max-lower-upper
fredrik-bakke Mar 23, 2025
3507f55
Pull over changes to min/max on rationals
lowasser Mar 23, 2025
e1e9c47
Merge remote-tracking branch 'origin/min-max-lower-upper' into min-ma…
lowasser Mar 23, 2025
7d98d25
Merge branch 'master' into min-max-lower-upper
lowasser Mar 24, 2025
af942b4
Pull over more necessary changes
lowasser Mar 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/elementary-number-theory.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,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
Expand Down
116 changes: 116 additions & 0 deletions src/elementary-number-theory/maximum-rational-numbers.lagda.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Maximum on the rational numbers

```agda
module elementary-number-theory.maximum-rational-numbers where
```

<details><summary>Imports</summary>

```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
```

</details>

## 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).

## Definition

```agda
max-ℚ : ℚ → ℚ → ℚ
max-ℚ = max-Decidable-Total-Order ℚ-Decidable-Total-Order
```

## Properties

### 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
```

### 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
```

### The maximum operation 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` 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
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<z y<z with decide-le-leq-ℚ x y
... | inl x<y =
inv-tr
( λ w → le-ℚ w z)
( left-leq-right-max-Decidable-Total-Order
( ℚ-Decidable-Total-Order)
( x)
( y)
( leq-le-ℚ {x} {y} x<y))
( y<z)
... | inr y≤x =
inv-tr
( λ w → le-ℚ w z)
( right-leq-left-max-Decidable-Total-Order ℚ-Decidable-Total-Order x y y≤x)
( x<z)
```

### If `a ≤ b` and `c ≤ d`, then `max a c ≤ max b d`

```agda
max-leq-leq-ℚ :
(a b c d : ℚ) → leq-ℚ a b → leq-ℚ c d → leq-ℚ (max-ℚ a c) (max-ℚ b d)
max-leq-leq-ℚ = max-leq-leq-Decidable-Total-Order ℚ-Decidable-Total-Order
```
117 changes: 117 additions & 0 deletions src/elementary-number-theory/minimum-rational-numbers.lagda.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Minimum on the rational numbers

```agda
module elementary-number-theory.minimum-rational-numbers where
```

<details><summary>Imports</summary>

```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
```

</details>

## 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).

## Definition

```agda
min-ℚ : ℚ → ℚ → ℚ
min-ℚ = min-Decidable-Total-Order ℚ-Decidable-Total-Order
```

## Properties

### Associativity of the minimum operation

```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 the minimum operation

```agda
commutative-min-ℚ : (x y : ℚ) → min-ℚ x y = min-ℚ y x
commutative-min-ℚ =
commutative-min-Decidable-Total-Order ℚ-Decidable-Total-Order
```

### The minimum operation 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` 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
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 z<x z<y with decide-le-leq-ℚ x y
... | inl x<y =
inv-tr
( le-ℚ z)
( left-leq-right-min-Decidable-Total-Order
( ℚ-Decidable-Total-Order)
( x)
( y)
( leq-le-ℚ {x} {y} x<y))
( z<x)
... | inr y≤x =
inv-tr
( le-ℚ z)
( right-leq-left-min-Decidable-Total-Order ℚ-Decidable-Total-Order x y y≤x)
( z<y)
```

### If `a ≤ b` and `c ≤ d`, then `min a c ≤ min b d`

```agda
min-leq-leq-ℚ :
(a b c d : ℚ) → leq-ℚ a b → leq-ℚ c d → leq-ℚ (min-ℚ a c) (min-ℚ b d)
min-leq-leq-ℚ = min-leq-leq-Decidable-Total-Order ℚ-Decidable-Total-Order
```
32 changes: 32 additions & 0 deletions src/order-theory/decidable-total-orders.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -474,3 +476,33 @@ module _
... | inl x≤y = antisymmetric-leq-Decidable-Total-Order T y x H x≤y
... | inr y<x = refl
```

### If `a ≤ b` and `c ≤ d`, then `min a c ≤ min b d`

```agda
min-leq-leq-Decidable-Total-Order :
(a b c d : type-Decidable-Total-Order T) →
leq-Decidable-Total-Order T a b → leq-Decidable-Total-Order T c d →
leq-Decidable-Total-Order
( T)
( min-Decidable-Total-Order T a c)
( min-Decidable-Total-Order T b d)
min-leq-leq-Decidable-Total-Order =
meet-leq-leq-Order-Theoretic-Meet-Semilattice
( order-theoretic-meet-semilattice-Decidable-Total-Order)
```

### If `a ≤ b` and `c ≤ d`, then `max a c ≤ max b d`

```agda
max-leq-leq-Decidable-Total-Order :
(a b c d : type-Decidable-Total-Order T) →
leq-Decidable-Total-Order T a b → leq-Decidable-Total-Order T c d →
leq-Decidable-Total-Order
( T)
( max-Decidable-Total-Order T a c)
( max-Decidable-Total-Order T b d)
max-leq-leq-Decidable-Total-Order =
join-leq-leq-Order-Theoretic-Join-Semilattice
( order-theoretic-join-semilattice-Decidable-Total-Order)
```
68 changes: 68 additions & 0 deletions src/order-theory/join-semilattices.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,48 @@ module _
by ap (join-Join-Semilattice x) K
= z
by H)

leq-left-join-Join-Semilattice :
(a b : type-Join-Semilattice) →
leq-Join-Semilattice a (join-Join-Semilattice a b)
leq-left-join-Join-Semilattice a b =
equational-reasoning
a ∨ (a ∨ b)
= (a ∨ a) ∨ b by inv (associative-join-Join-Semilattice a a b)
= a ∨ b by ap (_∨ b) (idempotent-join-Join-Semilattice a)

leq-right-join-Join-Semilattice :
(a b : type-Join-Semilattice) →
leq-Join-Semilattice b (join-Join-Semilattice a b)
leq-right-join-Join-Semilattice a b =
equational-reasoning
b ∨ (a ∨ b)
= (a ∨ b) ∨ b by commutative-join-Join-Semilattice _ _
= a ∨ (b ∨ b) by associative-join-Join-Semilattice a b b
= a ∨ b by ap (a ∨_) (idempotent-join-Join-Semilattice b)

join-leq-leq-Join-Semilattice :
(a b c d : type-Join-Semilattice) →
leq-Join-Semilattice a b → leq-Join-Semilattice c d →
leq-Join-Semilattice (join-Join-Semilattice a c) (join-Join-Semilattice b d)
join-leq-leq-Join-Semilattice a b c d a≤b c≤d =
forward-implication
( is-least-binary-upper-bound-join-Join-Semilattice
( a)
( c)
( join-Join-Semilattice b d))
( transitive-leq-Join-Semilattice
( a)
( b)
( b ∨ d)
( leq-left-join-Join-Semilattice b d)
( a≤b) ,
transitive-leq-Join-Semilattice
( c)
( d)
( b ∨ d)
( leq-right-join-Join-Semilattice b d)
( c≤d))
```

### The predicate on posets of being a join-semilattice
Expand Down Expand Up @@ -412,6 +454,32 @@ module _
( y)
( z))
( H , K)

join-leq-leq-Order-Theoretic-Join-Semilattice :
(a b c d : type-Order-Theoretic-Join-Semilattice) →
leq-Order-Theoretic-Join-Semilattice a b →
leq-Order-Theoretic-Join-Semilattice c d →
leq-Order-Theoretic-Join-Semilattice
( join-Order-Theoretic-Join-Semilattice a c)
( join-Order-Theoretic-Join-Semilattice b d)
join-leq-leq-Order-Theoretic-Join-Semilattice a b c d a≤b c≤d =
forward-implication
( is-least-binary-upper-bound-join-Order-Theoretic-Join-Semilattice
( a)
( c)
( b ∨ d))
( transitive-leq-Order-Theoretic-Join-Semilattice
( a)
( b)
( b ∨ d)
( leq-left-join-Order-Theoretic-Join-Semilattice b d)
( a≤b) ,
transitive-leq-Order-Theoretic-Join-Semilattice
( c)
( d)
( b ∨ d)
( leq-right-join-Order-Theoretic-Join-Semilattice b d)
( c≤d))
```

## Properties
Expand Down
Loading