Skip to content

Commit c67f94a

Browse files
authored
Cleanups in real numbers (#1675)
I started out wanting to make some parameters implicit, now that with `opaque` definitions they can reliably be inferred from the context. Then things snowballed from there to include a bunch of #1545, use of `abstract opaque`, and elimination of redundant imports.
1 parent 01d3a84 commit c67f94a

File tree

110 files changed

+1897
-2030
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+1897
-2030
lines changed

src/elementary-number-theory/absolute-value-rational-numbers.lagda.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ abstract
177177
( q)
178178
( rational-abs-ℚ q)
179179
( zero-ℚ)
180-
( leq-eq-ℚ _ _ (ap rational-ℚ⁰⁺ abs=0))
180+
( leq-eq-ℚ (ap rational-ℚ⁰⁺ abs=0))
181181
( leq-abs-ℚ q))
182182
( binary-tr
183183
( leq-ℚ)

src/elementary-number-theory/addition-positive-rational-numbers.lagda.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ module _
169169
where
170170
171171
le-diff-ℚ⁺ : ℚ⁺
172-
le-diff-ℚ⁺ = positive-diff-le-ℚ (rational-ℚ⁺ x) (rational-ℚ⁺ y) H
172+
le-diff-ℚ⁺ = positive-diff-le-ℚ H
173173
174174
left-diff-law-add-ℚ⁺ : le-diff-ℚ⁺ +ℚ⁺ x = y
175175
left-diff-law-add-ℚ⁺ =
@@ -334,23 +334,16 @@ module _
334334
((d : ℚ⁺) → leq-ℚ x (y +ℚ (rational-ℚ⁺ d))) → leq-ℚ x y
335335
leq-leq-add-positive-ℚ H =
336336
rec-coproduct
337-
( λ I
337+
( λ y<x
338338
ex-falso
339339
( not-leq-le-ℚ
340340
( mediant-ℚ y x)
341341
( x)
342-
( le-right-mediant-ℚ y x I)
342+
( le-right-mediant-ℚ y<x)
343343
( tr
344344
( leq-ℚ x)
345-
( right-law-positive-diff-le-ℚ
346-
( y)
347-
( mediant-ℚ y x)
348-
( le-left-mediant-ℚ y x I))
349-
( H
350-
( positive-diff-le-ℚ
351-
( y)
352-
( mediant-ℚ y x)
353-
( le-left-mediant-ℚ y x I))))))
345+
( right-law-positive-diff-le-ℚ (le-left-mediant-ℚ y<x))
346+
( H (positive-diff-le-ℚ (le-left-mediant-ℚ y<x))))))
354347
( id)
355348
( decide-le-leq-ℚ y x)
356349

src/elementary-number-theory/addition-rational-numbers.lagda.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ open import foundation.action-on-identifications-functions
2323
open import foundation.dependent-pair-types
2424
open import foundation.equivalences
2525
open import foundation.identity-types
26-
open import foundation.injective-maps
2726
open import foundation.interchange-law
2827
open import foundation.retractions
2928
open import foundation.sections

src/elementary-number-theory/difference-rational-numbers.lagda.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ open import elementary-number-theory.rational-numbers
1717
open import foundation.action-on-identifications-binary-functions
1818
open import foundation.action-on-identifications-functions
1919
open import foundation.identity-types
20-
open import foundation.interchange-law
2120
```
2221

2322
</details>

src/elementary-number-theory/distance-rational-numbers.lagda.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ open import elementary-number-theory.minimum-rational-numbers
2121
open import elementary-number-theory.multiplication-nonnegative-rational-numbers
2222
open import elementary-number-theory.multiplication-rational-numbers
2323
open import elementary-number-theory.nonnegative-rational-numbers
24-
open import elementary-number-theory.positive-rational-numbers
2524
open import elementary-number-theory.rational-numbers
2625
open import elementary-number-theory.strict-inequality-rational-numbers
2726
2827
open import foundation.action-on-identifications-binary-functions
2928
open import foundation.action-on-identifications-functions
30-
open import foundation.binary-transport
3129
open import foundation.coproduct-types
3230
open import foundation.dependent-pair-types
3331
open import foundation.function-types
@@ -191,10 +189,7 @@ abstract
191189
( rational-dist-ℚ p q)
192190
( (rational-abs-ℚ p) +ℚ (rational-abs-ℚ (neg-ℚ q)))
193191
( rational-abs-ℚ p +ℚ rational-abs-ℚ q)
194-
( leq-eq-ℚ
195-
( (rational-abs-ℚ p) +ℚ (rational-abs-ℚ (neg-ℚ q)))
196-
( rational-abs-ℚ p +ℚ rational-abs-ℚ q)
197-
( ap (add-ℚ (rational-abs-ℚ p) ∘ rational-ℚ⁰⁺) (abs-neg-ℚ q)))
192+
( leq-eq-ℚ (ap (add-ℚ (rational-abs-ℚ p) ∘ rational-ℚ⁰⁺) (abs-neg-ℚ q)))
198193
( triangle-inequality-abs-ℚ p (neg-ℚ q))
199194
```
200195

src/elementary-number-theory/geometric-sequences-rational-numbers.lagda.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ open import elementary-number-theory.rational-numbers
2929
open import elementary-number-theory.ring-of-rational-numbers
3030
open import elementary-number-theory.strict-inequality-rational-numbers
3131
32-
open import foundation.action-on-identifications-functions
3332
open import foundation.binary-transport
34-
open import foundation.dependent-pair-types
3533
open import foundation.function-extensionality
3634
open import foundation.identity-types
3735
open import foundation.negated-equality
@@ -45,8 +43,6 @@ open import lists.sequences
4543
open import metric-spaces.limits-of-sequences-metric-spaces
4644
open import metric-spaces.metric-space-of-rational-numbers
4745
open import metric-spaces.uniformly-continuous-functions-metric-spaces
48-
49-
open import order-theory.strictly-increasing-sequences-strictly-preordered-sets
5046
```
5147

5248
</details>

src/elementary-number-theory/inequalities-positive-and-negative-rational-numbers.lagda.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ abstract
101101
```agda
102102
abstract
103103
is-positive-le-ℚ⁰⁺ :
104-
(p : ℚ⁰⁺) (q : ℚ) → le-ℚ (rational-ℚ⁰⁺ p) q → is-positive-ℚ q
105-
is-positive-le-ℚ⁰⁺ (p , nonneg-p) q p<q =
104+
(p : ℚ⁰⁺) {q : ℚ} → le-ℚ (rational-ℚ⁰⁺ p) q → is-positive-ℚ q
105+
is-positive-le-ℚ⁰⁺ (p , nonneg-p) p<q =
106106
is-positive-le-zero-ℚ
107107
( concatenate-leq-le-ℚ _ _ _ (leq-zero-is-nonnegative-ℚ nonneg-p) p<q)
108108
```
@@ -112,8 +112,8 @@ abstract
112112
```agda
113113
abstract
114114
is-negative-le-ℚ⁰⁻ :
115-
(q : ℚ⁰⁻) (p : ℚ) → le-ℚ p (rational-ℚ⁰⁻ q) → is-negative-ℚ p
116-
is-negative-le-ℚ⁰⁻ (q , nonpos-q) p p<q =
115+
(q : ℚ⁰⁻) {p : ℚ} → le-ℚ p (rational-ℚ⁰⁻ q) → is-negative-ℚ p
116+
is-negative-le-ℚ⁰⁻ (q , nonpos-q) {p} p<q =
117117
is-negative-le-zero-ℚ
118118
( concatenate-le-leq-ℚ p q zero-ℚ
119119
( p<q)

src/elementary-number-theory/inequality-positive-rational-numbers.lagda.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ open import elementary-number-theory.positive-rational-numbers
1313
1414
open import foundation.action-on-identifications-functions
1515
open import foundation.binary-relations
16-
open import foundation.dependent-pair-types
1716
open import foundation.identity-types
1817
open import foundation.propositions
1918
open import foundation.universe-levels
@@ -97,5 +96,5 @@ antisymmetric-leq-ℚ⁺ = antisymmetric-leq-Poset poset-ℚ⁺
9796

9897
```agda
9998
leq-eq-ℚ⁺ : {x y : ℚ⁺} → x = y → leq-ℚ⁺ x y
100-
leq-eq-ℚ⁺ x=y = leq-eq-ℚ _ _ (ap rational-ℚ⁺ x=y)
99+
leq-eq-ℚ⁺ x=y = leq-eq-ℚ (ap rational-ℚ⁺ x=y)
101100
```

src/elementary-number-theory/inequality-rational-numbers.lagda.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ opaque
126126
refl-leq-ℤ (numerator-ℚ x *ℤ denominator-ℚ x)
127127
128128
abstract
129-
leq-eq-ℚ : (x y : ℚ) → x = y → leq-ℚ x y
130-
leq-eq-ℚ x y x=y = tr (leq-ℚ x) x=y (refl-leq-ℚ x)
129+
leq-eq-ℚ : {x y : ℚ} → x = y → leq-ℚ x y
130+
leq-eq-ℚ {x} refl = refl-leq-ℚ x
131131
```
132132

133133
### Inequality on the rational numbers is antisymmetric
@@ -294,8 +294,8 @@ opaque
294294
unfolding leq-ℚ-Prop
295295
296296
preserves-leq-rational-ℤ :
297-
(x y : ℤ) → leq-ℤ x y → leq-ℚ (rational-ℤ x) (rational-ℤ y)
298-
preserves-leq-rational-ℤ x y =
297+
{x y : ℤ} → leq-ℤ x y → leq-ℚ (rational-ℤ x) (rational-ℤ y)
298+
preserves-leq-rational-ℤ {x} {y} =
299299
binary-tr leq-ℤ
300300
( inv (right-unit-law-mul-ℤ x))
301301
( inv (right-unit-law-mul-ℤ y))
@@ -309,7 +309,7 @@ opaque
309309
310310
iff-leq-rational-ℤ :
311311
(x y : ℤ) → leq-ℤ x y ↔ leq-ℚ (rational-ℤ x) (rational-ℤ y)
312-
pr1 (iff-leq-rational-ℤ x y) = preserves-leq-rational-ℤ x y
312+
pr1 (iff-leq-rational-ℤ x y) = preserves-leq-rational-ℤ
313313
pr2 (iff-leq-rational-ℤ x y) = reflects-leq-rational-ℤ x y
314314
```
315315

@@ -324,8 +324,9 @@ abstract
324324
iff-leq-int-ℕ x y
325325
326326
preserves-leq-rational-ℕ :
327-
(x y : ℕ) → leq-ℕ x y → leq-ℚ (rational-ℕ x) (rational-ℕ y)
328-
preserves-leq-rational-ℕ x y = forward-implication (iff-leq-rational-ℕ x y)
327+
{x y : ℕ} → leq-ℕ x y → leq-ℚ (rational-ℕ x) (rational-ℕ y)
328+
preserves-leq-rational-ℕ {x} {y} =
329+
forward-implication (iff-leq-rational-ℕ x y)
329330
330331
reflects-leq-rational-ℕ :
331332
(x y : ℕ) → leq-ℚ (rational-ℕ x) (rational-ℕ y) → leq-ℕ x y

src/elementary-number-theory/metric-additive-group-of-rational-numbers.lagda.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ module elementary-number-theory.metric-additive-group-of-rational-numbers where
99
```agda
1010
open import analysis.metric-abelian-groups
1111
12-
open import elementary-number-theory.addition-rational-numbers
1312
open import elementary-number-theory.additive-group-of-rational-numbers
14-
open import elementary-number-theory.rational-numbers
1513
1614
open import foundation.dependent-pair-types
1715
open import foundation.universe-levels

0 commit comments

Comments
 (0)