-
Notifications
You must be signed in to change notification settings - Fork 79
Absolute value of real numbers #1385
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
Merged
Merged
Changes from all commits
Commits
Show all changes
100 commits
Select commit
Hold shift + click to select a range
68ffc45
Associativity of min and max
lowasser 4ac4f7d
Merge branch 'master' into min-max-associative
lowasser 4a8b5c5
Formatting
lowasser 6a9f837
Define lower Dedekind cuts/reals
lowasser ef39dd3
make pre-commit
lowasser 59195c9
Define upper Dedekind reals
lowasser 4233e28
make pre-commit
lowasser 6ad62d5
Rename things
lowasser 6bfb619
Formatting
lowasser fd8f384
Add new file
lowasser fb0d5d3
Fix line length
lowasser efaf647
Merge branch 'lower-upper-dedekind' into lower-upper-rational-dedekind
lowasser f21b948
Add rational upper reals
lowasser a3d3af9
Progress
lowasser ba687cd
Merge branch 'lower-upper-rational-dedekind' into lower-upper-inequality
lowasser fb18a45
Preservation of inequality
lowasser 0aa663c
Define normal Dedekind reals in terms of lower and upper cuts
lowasser 1f9f502
Merge branch 'lower-upper-inequality' into lower-upper-dedekind
lowasser 7499c7c
Start negation
lowasser 2185e18
Inequality on upper reals
lowasser f2da896
overhaul
lowasser 70f181c
make pre-commit
lowasser 9268779
a -> an
lowasser e40e90b
Merge branch 'master' into lower-upper-neg
lowasser 1b9d81b
Rename some things
lowasser d40a43a
Merge branch 'master' into lower-upper-neg
lowasser f75209b
Some more theorems
lowasser 6d17056
Merge branch 'master' into lower-upper-neg
lowasser 098d4e8
Finish gaps
lowasser b3b72b2
Progress
lowasser 56c4fe3
Merge remote-tracking branch 'origin/lower-upper-neg' into lower-uppe…
lowasser faaa937
Merge branch 'master' into lower-upper-neg
lowasser 1f9d73a
Recover all the previous results
lowasser 7857a80
Merge branch 'master' into lower-upper-neg
lowasser 263f367
make pre-commit
lowasser a3da42d
Merge remote-tracking branch 'origin/lower-upper-neg' into lower-uppe…
lowasser 3669840
Merge branch 'master' into lower-upper-neg
lowasser f235570
Remove empty bibliography
lowasser 827111e
Review changes
lowasser f734874
Fix names
lowasser 327479d
Progress
lowasser 3a4c279
Merge branch 'master' into min-max-associative
lowasser 80e1863
Merge
lowasser 6eeef9a
Fix syntax
lowasser 53e54d8
Fix links
lowasser 71479ca
Fix naming
lowasser e535435
make pre-commit
lowasser bd83f7b
Start
lowasser fbbfe5e
Progress
lowasser c100494
Merge branch 'min-max-associative' into lower-upper-max-min
lowasser 9444d9e
Progress
lowasser c62e125
Progress
lowasser ba7600c
Progress
lowasser 178808f
Merge branch 'master' into lower-upper-neg
lowasser b524ba8
max-lower-R
lowasser 0d68a13
make pre-commit
lowasser 8c076b1
Progress
lowasser 0f4ab58
Progress
lowasser 4c342b2
Progress
lowasser a903440
More imports
lowasser 42ad0b8
Merge branch 'min-max-associative' into inflattice
lowasser 8df9c15
Merge branch 'master' into min-max-associative
lowasser f9e99ef
Merge branch 'min-max-associative' into inflattice
lowasser 8aa85c0
Fix symbols in docs
lowasser 24b6f2f
Merge branch 'add-rational-reals' into add-reals
lowasser 6095330
Back off the hard bits
lowasser 9a2c3d6
Merge branch 'master' into lower-upper-neg
lowasser 7ad5d5f
Merge remote-tracking branch 'origin/lower-upper-neg' into lower-uppe…
lowasser 23a33d3
Apply suggestions from code review
lowasser f2c3f76
renaming
lowasser b9f1d27
Fix formatting
lowasser 3673163
make pre-commit
lowasser 324595a
Respond to review comments
lowasser 10a0a36
Inline explanations of lower and upper cuts
lowasser 6430f86
Reword
lowasser 73a9e40
Merge branch 'master' into inflattice
lowasser e64c537
Merge branch 'master' into lower-upper-neg
lowasser d35cc9a
Merge branch 'inflattice' into min-max-lower-upper
lowasser eb516ee
Merge branch 'lower-upper-neg' into min-max-lower-upper
lowasser 02e1fdc
Typo fix
lowasser c213682
Progress
lowasser 2276510
Define minimum and maximum on real numbers
lowasser fff4eda
make pre-commit
lowasser e5861c3
Begin defining the absolute value.
lowasser 89e5a16
Merge branch 'master' into min-max-lower-upper
lowasser e4ef49b
make pre-commit
lowasser 7a1164e
Merge branch 'min-max-lower-upper' into abs-real
lowasser 8e9b4c5
Prove the absolute value is nonnegative
lowasser f04c6fd
Fix links
lowasser 73a6953
Merge branch 'min-max-lower-upper' into abs-real
lowasser ef02378
Merge branch 'master' into abs-real
lowasser 5db467d
Progress
lowasser 5b103eb
make pre-commit
lowasser 759bf61
Revert
lowasser 872c07e
Update src/order-theory/least-upper-bounds-large-posets.lagda.md
lowasser 1760b08
Review comments
lowasser d6b5608
Review comments
lowasser cef6c75
Apply suggestions from code review
lowasser 4078ef9
Review coments
lowasser 40877b9
Fix
lowasser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# The absolute value of real numbers | ||
|
||
```agda | ||
{-# OPTIONS --lossy-unification #-} | ||
|
||
module real-numbers.absolute-value-real-numbers where | ||
``` | ||
|
||
<details><summary>Imports</summary> | ||
|
||
```agda | ||
open import elementary-number-theory.rational-numbers | ||
|
||
open import foundation.action-on-identifications-functions | ||
open import foundation.dependent-pair-types | ||
open import foundation.disjunction | ||
open import foundation.empty-types | ||
open import foundation.function-types | ||
open import foundation.identity-types | ||
open import foundation.transport-along-identifications | ||
open import foundation.universe-levels | ||
|
||
open import real-numbers.dedekind-real-numbers | ||
open import real-numbers.inequality-real-numbers | ||
open import real-numbers.maximum-real-numbers | ||
open import real-numbers.negation-real-numbers | ||
open import real-numbers.nonnegative-real-numbers | ||
``` | ||
|
||
</details> | ||
|
||
## Idea | ||
|
||
The | ||
{{#concept "absolute value" Disambiguation="of a real number" Agda=abs-ℝ WD="absolute value" WDID=Q120812}} | ||
of a [real number](real-numbers.dedekind-real-numbers.md) is the | ||
[maximum](real-numbers.maximum-real-numbers.md) of it and its | ||
[negation](real-numbers.negation-real-numbers.md). | ||
|
||
```agda | ||
abs-ℝ : {l : Level} → ℝ l → ℝ l | ||
abs-ℝ x = binary-max-ℝ x (neg-ℝ x) | ||
``` | ||
|
||
## Properties | ||
|
||
### The absolute value of a real number is nonnegative | ||
|
||
```agda | ||
abstract | ||
is-nonnegative-abs-ℝ : {l : Level} → (x : ℝ l) → is-nonnegative-ℝ (abs-ℝ x) | ||
is-nonnegative-abs-ℝ x q q<0 = | ||
elim-disjunction | ||
( lower-cut-ℝ (abs-ℝ x) q) | ||
( id) | ||
( λ (x<0 , 0<x) → ex-falso (is-disjoint-cut-ℝ x zero-ℚ (0<x , x<0))) | ||
( is-located-lower-upper-cut-ℝ (abs-ℝ x) q zero-ℚ q<0) | ||
``` | ||
|
||
### The absolute value of the negation of a real number is its absolute value | ||
|
||
```agda | ||
abstract | ||
abs-neg-ℝ : {l : Level} → (x : ℝ l) → abs-ℝ (neg-ℝ x) = abs-ℝ x | ||
abs-neg-ℝ x = | ||
ap (binary-max-ℝ (neg-ℝ x)) (neg-neg-ℝ x) ∙ commutative-binary-max-ℝ _ _ | ||
``` | ||
|
||
### `x` is between `-|x|` and `|x|` | ||
|
||
```agda | ||
module _ | ||
{l : Level} (x : ℝ l) | ||
where | ||
|
||
abstract | ||
leq-abs-ℝ : leq-ℝ x (abs-ℝ x) | ||
leq-abs-ℝ = leq-left-binary-max-ℝ x (neg-ℝ x) | ||
|
||
neg-leq-abs-ℝ : leq-ℝ (neg-ℝ x) (abs-ℝ x) | ||
neg-leq-abs-ℝ = leq-right-binary-max-ℝ x (neg-ℝ x) | ||
|
||
leq-neg-abs-ℝ : leq-ℝ (neg-ℝ (abs-ℝ x)) x | ||
leq-neg-abs-ℝ = | ||
tr | ||
( leq-ℝ (neg-ℝ (abs-ℝ x))) | ||
( neg-neg-ℝ x) | ||
( neg-leq-ℝ (neg-ℝ x) (abs-ℝ x) neg-leq-abs-ℝ) | ||
|
||
neg-leq-neg-abs-ℝ : leq-ℝ (neg-ℝ (abs-ℝ x)) (neg-ℝ x) | ||
neg-leq-neg-abs-ℝ = neg-leq-ℝ x (abs-ℝ x) leq-abs-ℝ | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Nonnegative real numbers | ||
|
||
```agda | ||
{-# OPTIONS --lossy-unification #-} | ||
|
||
module real-numbers.nonnegative-real-numbers where | ||
``` | ||
|
||
<details><summary>Imports</summary> | ||
|
||
```agda | ||
open import foundation.propositions | ||
open import foundation.subtypes | ||
open import foundation.universe-levels | ||
|
||
open import real-numbers.dedekind-real-numbers | ||
open import real-numbers.inequality-real-numbers | ||
open import real-numbers.rational-real-numbers | ||
``` | ||
|
||
</details> | ||
|
||
## Idea | ||
|
||
A real number `x` is | ||
{{#concept "nonnegative" Disambiguation="real number" Agda=is-nonnegative-ℝ}} if | ||
`0 ≤ x`. | ||
|
||
## Definitions | ||
|
||
```agda | ||
lowasser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
is-nonnegative-ℝ : {l : Level} → ℝ l → UU l | ||
is-nonnegative-ℝ = leq-ℝ zero-ℝ | ||
|
||
is-nonnegative-prop-ℝ : {l : Level} → ℝ l → Prop l | ||
is-nonnegative-prop-ℝ = leq-ℝ-Prop zero-ℝ | ||
|
||
nonnegative-ℝ : (l : Level) → UU (lsuc l) | ||
nonnegative-ℝ l = type-subtype (is-nonnegative-prop-ℝ {l}) | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.