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

Addition on lower and upper Dedekind reals #1328

Closed
wants to merge 107 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
03bf44a
Do syntax for elim-exists chains, including application to strict rea…
lowasser Feb 9, 2025
a49369f
Simplifications and indentation
lowasser Feb 9, 2025
f053354
make pre-commit
lowasser Feb 9, 2025
5481940
Updates
lowasser Feb 9, 2025
96b05c1
make pre-commit
lowasser Feb 9, 2025
e84f3ce
Define Minkowski multiplication for semigroups
lowasser Feb 9, 2025
4f547c8
make pre-commit
lowasser Feb 9, 2025
ab87dac
Add monoids and commutative monoids
lowasser Feb 9, 2025
1f8bb30
make pre-commit
lowasser Feb 9, 2025
4581333
Use subset syntax
lowasser Feb 9, 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
9eee806
Merge branch 'minkowski-sum-semigroup' into add-lower-upper-reals
lowasser Feb 9, 2025
0bd35b8
Start defining lower addition
lowasser Feb 9, 2025
258ec99
Inhabitedness
lowasser Feb 9, 2025
40a9e33
make pre-commit
lowasser Feb 9, 2025
5b524b2
Merge branch 'minkowski-sum-semigroup' into add-lower-upper-reals
lowasser Feb 9, 2025
f9006be
Progress
lowasser Feb 9, 2025
6ad62d5
Rename things
lowasser Feb 9, 2025
2b0b4e3
Merge branch 'lower-upper-dedekind' into add-lower-upper-reals
lowasser Feb 9, 2025
426df71
Finish defining addition on lower reals
lowasser Feb 9, 2025
1875b50
Fix naming
lowasser Feb 9, 2025
d7f6e2d
Similarity and containment
lowasser Feb 9, 2025
f80d545
Merge branch 'minkowski-sum-semigroup' into add-lower-upper-reals
lowasser Feb 9, 2025
fd4d192
Progress
lowasser Feb 9, 2025
ca7ab8b
Propagate properties
lowasser Feb 9, 2025
efd9246
Merge branch 'minkowski-sum-semigroup' into add-lower-upper-reals
lowasser Feb 9, 2025
1a5f82f
Addition on lower reals is associative and commutative
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
531bc2e
Merge branch 'lower-upper-rational-dedekind' into add-lower-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
bb7b295
Merge branch 'master' into monad-existence
lowasser Feb 10, 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
3aee71f
Merge branch 'master' into monad-existence
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
04c6f16
Merge branch 'master' into monad-existence
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
53e54d8
Fix links
lowasser Feb 12, 2025
ab26d4f
Merge branch 'master' into monad-existence
lowasser Feb 12, 2025
71479ca
Fix naming
lowasser Feb 12, 2025
1bf398b
Merge branch 'lower-upper-neg' into add-lower-upper-reals
lowasser Feb 12, 2025
9f12eee
Progress on upper addition
lowasser Feb 12, 2025
e535435
make pre-commit
lowasser Feb 12, 2025
41fa435
Merge branch 'lower-upper-neg' into add-lower-upper-reals
lowasser Feb 12, 2025
74a4def
make pre-commit
lowasser Feb 12, 2025
178808f
Merge branch 'master' into lower-upper-neg
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
68ab249
Rewrite in terms of propositional truncation
lowasser Feb 13, 2025
9686b6b
Merge remote-tracking branch 'origin/monad-existence' into monad-exis…
lowasser Feb 13, 2025
b9bea80
Merge branch 'master' into monad-existence
lowasser Feb 13, 2025
df87847
More words
lowasser Feb 13, 2025
e510c3d
make pre-commit
lowasser Feb 13, 2025
b4e7234
Reorganize
lowasser Feb 13, 2025
6cd9e60
Apply suggestions from code review
lowasser Feb 13, 2025
45f47a8
Formatting
lowasser Feb 13, 2025
a41a114
Merge remote-tracking branch 'origin/monad-existence' into monad-exis…
lowasser Feb 13, 2025
23a33d3
Apply suggestions from code review
lowasser Feb 13, 2025
f2c3f76
renaming
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
e64c537
Merge branch 'master' into lower-upper-neg
lowasser Feb 14, 2025
69430a2
Update src/real-numbers/arithmetically-located-dedekind-cuts.lagda.md
lowasser Feb 14, 2025
8c1ad11
Progress
lowasser Feb 14, 2025
9f4197c
Review comments
lowasser Feb 14, 2025
d6da824
reword negation
lowasser Feb 14, 2025
0a2691c
Apply suggestions from code review
lowasser Feb 14, 2025
f462be5
Fix compile
lowasser Feb 14, 2025
5978e1a
Review comments
lowasser Feb 14, 2025
5468d44
Merge branch 'master' into monad-existence
lowasser Feb 14, 2025
2c5d304
Merge branch 'lower-upper-neg' into add-lower-upper-reals
lowasser Feb 14, 2025
e981a15
Progress
lowasser Feb 14, 2025
24a67e7
Merge branch 'monad-existence' into add-lower-upper-reals
lowasser Feb 14, 2025
d90e459
Unit laws and simplifications
lowasser Feb 14, 2025
1d4965b
make pre-commit
lowasser Feb 14, 2025
7c151c8
Merge branch 'master' into add-lower-upper-reals
lowasser Feb 16, 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ open import foundation.unital-binary-operations
open import foundation.universe-levels

open import group-theory.abelian-groups
open import group-theory.commutative-monoids
open import group-theory.groups
open import group-theory.monoids
open import group-theory.semigroups
Expand Down Expand Up @@ -60,9 +61,13 @@ pr2 (pr2 (pr2 (pr2 group-add-ℚ))) = right-inverse-law-add-ℚ

## Properties

### Tha additive group of rational numbers is commutative
### The additive group of rational numbers is commutative

```agda
commutative-monoid-add-ℚ : Commutative-Monoid lzero
pr1 commutative-monoid-add-ℚ = monoid-add-ℚ
pr2 commutative-monoid-add-ℚ = commutative-add-ℚ

abelian-group-add-ℚ : Ab lzero
pr1 abelian-group-add-ℚ = group-add-ℚ
pr2 abelian-group-add-ℚ = commutative-add-ℚ
Expand Down
28 changes: 15 additions & 13 deletions src/elementary-number-theory/positive-rational-numbers.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,14 @@ module _
(x y : ℚ) (H : le-ℚ x y)
where

is-positive-diff-le-ℚ : is-positive-ℚ (y -ℚ x)
is-positive-diff-le-ℚ =
is-positive-le-zero-ℚ
( y -ℚ x)
( backward-implication
( iff-translate-diff-le-zero-ℚ x y)
( H))
abstract
is-positive-diff-le-ℚ : is-positive-ℚ (y -ℚ x)
is-positive-diff-le-ℚ =
is-positive-le-zero-ℚ
( y -ℚ x)
( backward-implication
( iff-translate-diff-le-zero-ℚ x y)
( H))

positive-diff-le-ℚ : ℚ⁺
positive-diff-le-ℚ = y -ℚ x , is-positive-diff-le-ℚ
Expand Down Expand Up @@ -539,12 +540,13 @@ mediant-zero-ℚ⁺ x =
( rational-ℚ⁺ x)
( le-zero-is-positive-ℚ (rational-ℚ⁺ x) (is-positive-rational-ℚ⁺ x))))

le-mediant-zero-ℚ⁺ : (x : ℚ⁺) → le-ℚ⁺ (mediant-zero-ℚ⁺ x) x
le-mediant-zero-ℚ⁺ x =
le-right-mediant-ℚ
( zero-ℚ)
( rational-ℚ⁺ x)
( le-zero-is-positive-ℚ (rational-ℚ⁺ x) (is-positive-rational-ℚ⁺ x))
abstract
le-mediant-zero-ℚ⁺ : (x : ℚ⁺) → le-ℚ⁺ (mediant-zero-ℚ⁺ x) x
le-mediant-zero-ℚ⁺ x =
le-right-mediant-ℚ
( zero-ℚ)
( rational-ℚ⁺ x)
( le-zero-is-positive-ℚ (rational-ℚ⁺ x) (is-positive-rational-ℚ⁺ x))
```

### Any positive rational number is the sum of two positive rational numbers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,13 @@ module _
(x y z : ℚ)
where

transitive-le-ℚ : le-ℚ y z → le-ℚ x y → le-ℚ x z
transitive-le-ℚ =
transitive-le-fraction-ℤ
( fraction-ℚ x)
( fraction-ℚ y)
( fraction-ℚ z)
abstract
transitive-le-ℚ : le-ℚ y z → le-ℚ x y → le-ℚ x z
transitive-le-ℚ =
transitive-le-fraction-ℤ
( fraction-ℚ x)
( fraction-ℚ y)
( fraction-ℚ z)
```

### Concatenation rules for inequality and strict inequality on the rational numbers
Expand Down Expand Up @@ -315,15 +316,16 @@ module _
### Addition on the rational numbers preserves strict inequality

```agda
preserves-le-add-ℚ :
{a b c d : ℚ} → le-ℚ a b → le-ℚ c d → le-ℚ (a +ℚ c) (b +ℚ d)
preserves-le-add-ℚ {a} {b} {c} {d} H K =
transitive-le-ℚ
( a +ℚ c)
( b +ℚ c)
( b +ℚ d)
( preserves-le-right-add-ℚ b c d K)
( preserves-le-left-add-ℚ c a b H)
abstract
preserves-le-add-ℚ :
{a b c d : ℚ} → le-ℚ a b → le-ℚ c d → le-ℚ (a +ℚ c) (b +ℚ d)
preserves-le-add-ℚ {a} {b} {c} {d} H K =
transitive-le-ℚ
( a +ℚ c)
( b +ℚ c)
( b +ℚ d)
( preserves-le-right-add-ℚ b c d K)
( preserves-le-left-add-ℚ c a b H)
```

### The rational numbers have no lower or upper bound
Expand Down
5 changes: 5 additions & 0 deletions src/foundation/existential-quantification.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ module _
( elim-exists Q)
```

Note that since existential quantification is implemented using propositional
truncation, the associated
[do syntax](foundation.propositional-truncations.md#do-syntax) can be used to
simplify deeply nested chains of `elim-exists`.

### The existential quantification satisfies the universal property of existential quantification

```agda
Expand Down
77 changes: 77 additions & 0 deletions src/foundation/propositional-truncations.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,83 @@ module _
is-equiv-map-inv-trunc-Prop-diagonal-coproduct
```

## `do` syntax for propositional truncation { #do-syntax }

[Agda's `do` syntax](https://agda.readthedocs.io/en/v2.7.0/language/syntactic-sugar.html#do-notation)
is a handy tool to avoid deeply nesting calls to the same lambda-based function.
For example, consider a case where you are trying to prove a proposition,
`motive : Prop l`, from witnesses of propositional truncations of types `P` and
`Q`:

```text
rec-trunc-Prop
( motive)
( λ (p : P) →
rec-trunc-Prop
( motive)
( λ (q : Q) → witness-motive-P-Q p q)
( witness-truncated-prop-Q p))
( witness-truncated-prop-P)
```

The tower of indentation, with many layers of indentation in the innermost
derivation, is a little awkward even at two levels, let alone more. In
particular, we have the many duplicated lines of `rec-trunc-Prop motive`, and
the increasing distance between the `rec-trunc-Prop` and the `trunc-Prop` being
recursed on. Agda's `do` syntax offers us an alternative.

```agda
module do-syntax-trunc-Prop {l : Level} (motive : Prop l) where
_>>=_ :
{l : Level} {A : UU l} →
type-trunc-Prop A → (A → type-Prop motive) →
type-Prop motive
trunc-prop-a >>= k = rec-trunc-Prop motive k trunc-prop-a
```

This allows us to rewrite the nested chain above as

```text
do
p ← witness-truncated-prop-P
q ← witness-truncated-prop-Q p
witness-motive-P-Q p q
where open do-syntax-trunc-Prop motive
```

Since Agda's `do` syntax desugars to calls to `>>=`, this is syntactic sugar for

```text
witness-truncated-prop-P >>=
( λ p → witness-truncated-prop-Q p >>=
( λ q → witness-motive-P-Q p q))
```

which, inlining the definition of `>>=`, becomes exactly the chain of
`rec-trunc-Prop` used above.

To read the `do` syntax, it may help to go through each line:

1. `do` indicates that we will be using Agda's syntactic sugar for the `>>=`
function defined in the `do-syntax-trunc-Prop` module.
1. You can read the `p ← witness-truncated-prop-P` as an _instruction_ saying,
"Get the value `p` out of the witness of `trunc-Prop P`." We cannot extract
elements out of witnesses of propositionally truncated types, but since we're
eliminating into a proposition, the universal property of the truncation
allows us to lift a map from the untruncated type to a map from its
truncation.
1. `q ← witness-truncated-prop-Q p` says, "Get the value `q` out of the witness
for the truncation `witness-truncated-prop-Q p`" --- noticing that we can
make use of `p : P` in that line.
1. `witness-motive-P-Q p q` must give us a witness of `motive` --- that is, a
value of type `type-Prop motive` --- from `p` and `q`.
1. `where open do-syntax-trunc-Prop motive` is required to allow us to use the
`do` syntax.

The result of the entire `do` block is the value of type `type-Prop motive`,
which is internally constructed with an appropriate chain of `rec-trunc-Prop`
from the intermediate steps.

## Table of files about propositional logic

The following table gives an overview of basic constructions in propositional
Expand Down
23 changes: 12 additions & 11 deletions src/group-theory/abelian-groups.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,17 +612,18 @@ module _
{l : Level} (A : Ab l)
where

is-identity-left-conjugation-Ab :
(x : type-Ab A) → left-conjugation-Ab A x ~ id
is-identity-left-conjugation-Ab x y =
( ap (add-Ab' A (neg-Ab A x)) (commutative-add-Ab A x y)) ∙
( is-retraction-right-subtraction-Ab A x y)

is-identity-right-conjugation-Ab :
(x : type-Ab A) → right-conjugation-Ab A x ~ id
is-identity-right-conjugation-Ab x =
inv-htpy (left-right-conjugation-Ab A x) ∙h
is-identity-left-conjugation-Ab x
abstract
is-identity-left-conjugation-Ab :
(x : type-Ab A) → left-conjugation-Ab A x ~ id
is-identity-left-conjugation-Ab x y =
( ap (add-Ab' A (neg-Ab A x)) (commutative-add-Ab A x y)) ∙
( is-retraction-right-subtraction-Ab A x y)

is-identity-right-conjugation-Ab :
(x : type-Ab A) → right-conjugation-Ab A x ~ id
is-identity-right-conjugation-Ab x =
inv-htpy (left-right-conjugation-Ab A x) ∙h
is-identity-left-conjugation-Ab x

is-identity-conjugation-Ab :
(x : type-Ab A) → conjugation-Ab A x ~ id
Expand Down
2 changes: 2 additions & 0 deletions src/real-numbers.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
```agda
module real-numbers where

open import real-numbers.addition-lower-dedekind-real-numbers public
open import real-numbers.addition-upper-dedekind-real-numbers public
open import real-numbers.apartness-real-numbers public
open import real-numbers.arithmetically-located-dedekind-cuts public
open import real-numbers.dedekind-real-numbers public
Expand Down
Loading