Skip to content

Refactor elementary number theory #1211

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

Draft
wants to merge 100 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
f988936
squares of natural numbers
EgbertRijke Oct 25, 2024
c66773a
add file
EgbertRijke Oct 25, 2024
269e3d0
make pre-commit
EgbertRijke Oct 25, 2024
48b74ec
properties of squares
EgbertRijke Oct 26, 2024
7952fc4
some work on integer fractions
EgbertRijke Oct 26, 2024
156dd99
squares of integers
EgbertRijke Oct 26, 2024
defae26
make pre-commit
EgbertRijke Oct 26, 2024
9b917e7
parity integers
EgbertRijke Oct 26, 2024
01b1c33
parity integers
EgbertRijke Oct 26, 2024
70edf99
work
EgbertRijke Oct 27, 2024
e55cb69
work
EgbertRijke Oct 28, 2024
a12e652
generalizations to commutative rings
EgbertRijke Oct 29, 2024
39b6264
work
EgbertRijke Oct 29, 2024
02a81cf
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Oct 29, 2024
dec3433
implementing some algebra into the theory of integers
EgbertRijke Oct 30, 2024
22a5ace
edits
EgbertRijke Oct 30, 2024
aea9973
edits
EgbertRijke Oct 30, 2024
c0dfde5
work
EgbertRijke Oct 30, 2024
fbdb94c
moving decidability of divisibility into the file about divisibility
EgbertRijke Oct 31, 2024
9fa26d3
refactoring decidability of divisibility of integers
EgbertRijke Oct 31, 2024
3c12fb5
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Oct 31, 2024
19a1948
some work
EgbertRijke Nov 5, 2024
3c8f4fd
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Nov 5, 2024
de1f5b5
work
EgbertRijke Nov 5, 2024
15f9efa
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Nov 11, 2024
627cbb3
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Dec 4, 2024
032e45d
some improvements to number theory
EgbertRijke Dec 7, 2024
c8f84ad
refactoring the fundamental theorem of arithmetic
EgbertRijke Dec 16, 2024
5578aaa
further refactoring of fundamental theorem
EgbertRijke Dec 17, 2024
71f3b76
well-ordering principles for the integers
EgbertRijke Jan 2, 2025
6270496
Nicomachus's Theorem
EgbertRijke Jan 4, 2025
9d2836c
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Jan 4, 2025
405c30a
square pyramidal numbers
EgbertRijke Jan 4, 2025
adec8f0
sum of pronic numbers
EgbertRijke Jan 4, 2025
4f10aa5
The sum of the first n odd numbers is the nth square
EgbertRijke Jan 4, 2025
a4e411c
merge
EgbertRijke Jan 4, 2025
5dd2b23
number of divisors
EgbertRijke Jan 4, 2025
f94ad9d
LeVeque's strict bound on the growth of the Fibonacci numbers
EgbertRijke Jan 5, 2025
c6b25ed
generalizing LeVeque's upper bound for the Fibonacci sequence
EgbertRijke Jan 5, 2025
8b61eeb
edits
EgbertRijke Jan 6, 2025
2c3a0c1
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Jan 6, 2025
d484452
mersenne numbers and bounded natural numbers
EgbertRijke Jan 6, 2025
e031856
fixing citations
EgbertRijke Jan 6, 2025
9af5931
resolve merge conflicts
EgbertRijke Jan 6, 2025
aa6bb2e
resolve merge conflicts
EgbertRijke Jan 6, 2025
be13fbf
involution on the type of divisors
EgbertRijke Jan 7, 2025
ed68ab3
The formula for the distance of squares
EgbertRijke Jan 7, 2025
e0a8dee
refactoring exponentiation
EgbertRijke Jan 7, 2025
06035d1
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Jan 7, 2025
1e2dc89
strictly ordered sets and inflationary maps
EgbertRijke Jan 8, 2025
1535006
inflationary maps of strictly ordered types
EgbertRijke Jan 8, 2025
4b86dd1
lower and upper bounds of structured natural numbers
EgbertRijke Jan 9, 2025
03dd0cf
factoring out minimal and maximal structure natural numbers
EgbertRijke Jan 10, 2025
948d7c7
bounded maximal elements of decidable families
EgbertRijke Jan 10, 2025
0845585
setting up some files for maps on the natural numbers
EgbertRijke Jan 11, 2025
9ff5147
maximal value-bound input property
EgbertRijke Jan 11, 2025
f120698
finite subtypes of the natural numbers have maximal elements
EgbertRijke Jan 12, 2025
1d66e6e
structured maximal value-bound inputs
EgbertRijke Jan 14, 2025
89abe84
any two distinct Fermat numbers are relatively prime
EgbertRijke Jan 15, 2025
a686f18
Farey fractions
EgbertRijke Jan 15, 2025
fa5ced3
unbounded Farey fractions
EgbertRijke Jan 15, 2025
24c32f7
some properties of Farey fractions
EgbertRijke Jan 16, 2025
ae95d3c
Every positive natural number has a 2-adic decomposition
EgbertRijke Jan 17, 2025
a23ea64
work
EgbertRijke Jan 19, 2025
fb2ec5b
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Jan 19, 2025
f64232c
literature, exercises, and historical references
EgbertRijke Jan 21, 2025
b14fcab
literature, exercises, and historical references
EgbertRijke Jan 21, 2025
b66615e
formatting
EgbertRijke Jan 21, 2025
f80e569
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Jan 26, 2025
06f229d
refactoring divisibility
EgbertRijke Jan 27, 2025
5b637cb
ideals of semirings and iterated pronic numbers
EgbertRijke Feb 2, 2025
54a9a8e
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 2, 2025
99fda92
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 2, 2025
fd4c8aa
Saidak's proof
EgbertRijke Feb 3, 2025
c49bd09
typo
EgbertRijke Feb 3, 2025
65c2056
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 3, 2025
c60e8b1
the largest power divisor is the largest power divisor
EgbertRijke Feb 3, 2025
160188a
parity results
EgbertRijke Feb 3, 2025
00448cc
some divisibility infrastructure
EgbertRijke Feb 4, 2025
8ba3c58
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 4, 2025
2cf37d6
lemma about divisors of the form 2^k
EgbertRijke Feb 5, 2025
734528e
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 5, 2025
1b7b9b3
Every nonzero natural number has a unique 2-adic decomposition
EgbertRijke Feb 5, 2025
acc6f20
resolve merge conflict
EgbertRijke Feb 5, 2025
cec430b
NZM exercise 53
EgbertRijke Feb 7, 2025
e64766c
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 7, 2025
b4b86ac
refactoring up to the fundamental theorem
EgbertRijke Feb 7, 2025
0661b4b
some work towards Bezout's identity in the natural numbers
EgbertRijke Feb 9, 2025
c839ebe
edit
EgbertRijke Feb 9, 2025
e283a6d
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 9, 2025
ee2c931
resolve merge conflict
EgbertRijke Feb 10, 2025
99add77
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 10, 2025
f2ba05d
a few more merge conflicts
EgbertRijke Feb 10, 2025
e5c7b79
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 11, 2025
7c9b3cc
edit?
EgbertRijke Feb 11, 2025
10b8d6e
Merge branch 'master' of github.com:UniMath/agda-unimath into irratio…
EgbertRijke Feb 11, 2025
c83c8f3
products of elements of lists
EgbertRijke Feb 11, 2025
df6c719
edits?
EgbertRijke Feb 11, 2025
595c7ae
merge
EgbertRijke Feb 11, 2025
3ea787e
address merge conflicts
EgbertRijke Feb 19, 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 @@ -76,6 +76,7 @@ open import elementary-number-theory.initial-segments-natural-numbers public
open import elementary-number-theory.integer-fractions public
open import elementary-number-theory.integer-partitions public
open import elementary-number-theory.integers public
open import elementary-number-theory.irrationality-square-root-of-2 public
open import elementary-number-theory.jacobi-symbol public
open import elementary-number-theory.kolakoski-sequence public
open import elementary-number-theory.legendre-symbol public
Expand Down Expand Up @@ -112,6 +113,7 @@ open import elementary-number-theory.nonzero-integers public
open import elementary-number-theory.nonzero-natural-numbers public
open import elementary-number-theory.nonzero-rational-numbers public
open import elementary-number-theory.ordinal-induction-natural-numbers public
open import elementary-number-theory.parity-integers public
open import elementary-number-theory.parity-natural-numbers public
open import elementary-number-theory.peano-arithmetic public
open import elementary-number-theory.pisano-periods public
Expand Down
32 changes: 16 additions & 16 deletions src/elementary-number-theory/absolute-value-integers.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,36 +178,36 @@ is-nonzero-abs-ℤ :
is-nonzero-abs-ℤ (inr (inr x)) H = is-nonzero-succ-ℕ x
```

### The absolute value function is multiplicative
### The absolute value distributes over multiplication

```agda
multiplicative-abs-ℤ' :
(x y : ℤ) → abs-ℤ (explicit-mul-ℤ x y) = (abs-ℤ x) *ℕ (abs-ℤ y)
multiplicative-abs-ℤ' (inl x) (inl y) =
distributive-abs-mul-ℤ' :
(x y : ℤ) → abs-ℤ (explicit-mul-ℤ x y) = abs-ℤ x *ℕ abs-ℤ y
distributive-abs-mul-ℤ' (inl x) (inl y) =
abs-int-ℕ _
multiplicative-abs-ℤ' (inl x) (inr (inl star)) =
distributive-abs-mul-ℤ' (inl x) (inr (inl star)) =
inv (right-zero-law-mul-ℕ x)
multiplicative-abs-ℤ' (inl x) (inr (inr y)) =
distributive-abs-mul-ℤ' (inl x) (inr (inr y)) =
( abs-neg-ℤ (inl ((x *ℕ (succ-ℕ y)) +ℕ y))) ∙
( abs-int-ℕ ((succ-ℕ x) *ℕ (succ-ℕ y)))
multiplicative-abs-ℤ' (inr (inl star)) (inl y) =
distributive-abs-mul-ℤ' (inr (inl star)) (inl y) =
refl
multiplicative-abs-ℤ' (inr (inr x)) (inl y) =
distributive-abs-mul-ℤ' (inr (inr x)) (inl y) =
( abs-neg-ℤ (inl ((x *ℕ (succ-ℕ y)) +ℕ y))) ∙
( abs-int-ℕ (succ-ℕ ((x *ℕ (succ-ℕ y)) +ℕ y)))
multiplicative-abs-ℤ' (inr (inl star)) (inr (inl star)) =
distributive-abs-mul-ℤ' (inr (inl star)) (inr (inl star)) =
refl
multiplicative-abs-ℤ' (inr (inl star)) (inr (inr x)) =
distributive-abs-mul-ℤ' (inr (inl star)) (inr (inr x)) =
refl
multiplicative-abs-ℤ' (inr (inr x)) (inr (inl star)) =
distributive-abs-mul-ℤ' (inr (inr x)) (inr (inl star)) =
inv (right-zero-law-mul-ℕ (succ-ℕ x))
multiplicative-abs-ℤ' (inr (inr x)) (inr (inr y)) =
distributive-abs-mul-ℤ' (inr (inr x)) (inr (inr y)) =
abs-int-ℕ _

multiplicative-abs-ℤ :
(x y : ℤ) → abs-ℤ (x *ℤ y) = (abs-ℤ x) *ℕ (abs-ℤ y)
multiplicative-abs-ℤ x y =
ap abs-ℤ (compute-mul-ℤ x y) ∙ multiplicative-abs-ℤ' x y
distributive-abs-mul-ℤ :
(x y : ℤ) → abs-ℤ (x *ℤ y) = abs-ℤ x *ℕ abs-ℤ y
distributive-abs-mul-ℤ x y =
ap abs-ℤ (compute-mul-ℤ x y) ∙ distributive-abs-mul-ℤ' x y
```

### `|(-x)y| = |xy|`
Expand Down
19 changes: 19 additions & 0 deletions src/elementary-number-theory/addition-integers.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,25 @@ abstract
associative-add-ℤ
```

### Swapping the order of iterated addition

```agda
abstract
right-swap-add-ℤ :
(x y z : ℤ) → (x +ℤ y) +ℤ z = (x +ℤ z) +ℤ y
right-swap-add-ℤ x y z =
associative-add-ℤ x y z ∙
ap (x +ℤ_) (commutative-add-ℤ y z) ∙
inv (associative-add-ℤ x z y)

left-swap-add-ℤ :
(x y z : ℤ) → x +ℤ (y +ℤ z) = y +ℤ (x +ℤ z)
left-swap-add-ℤ x y z =
inv (associative-add-ℤ x y z) ∙
ap (_+ℤ z) (commutative-add-ℤ x y) ∙
associative-add-ℤ y x z
```

### Addition by `x` is a binary equivalence

```agda
Expand Down
19 changes: 19 additions & 0 deletions src/elementary-number-theory/addition-natural-numbers.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,25 @@ abstract
associative-add-ℕ
```

### Swapping iterated addition

```agda
abstract
right-swap-add-ℕ :
(x y z : ℕ) → (x +ℕ y) +ℕ z = (x +ℕ z) +ℕ y
right-swap-add-ℕ x y z =
associative-add-ℕ x y z ∙
ap (add-ℕ x) (commutative-add-ℕ y z) ∙
inv (associative-add-ℕ x z y)

left-swap-add-ℕ :
(x y z : ℕ) → x +ℕ (y +ℕ z) = y +ℕ (x +ℕ z)
left-swap-add-ℕ x y z =
inv (associative-add-ℕ x y z) ∙
ap (add-ℕ' z) (commutative-add-ℕ x y) ∙
associative-add-ℕ y x z
```

### Addition by a fixed element on either side is injective

```agda
Expand Down
4 changes: 2 additions & 2 deletions src/elementary-number-theory/bezouts-lemma-integers.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ bezouts-lemma-eqn-to-int x y H =
( minimal-positive-distance-y-coeff (abs-ℤ x) (abs-ℤ y) H)))
( abs-ℤ y)))
( inv
( multiplicative-abs-ℤ
( distributive-abs-mul-ℤ
( int-ℕ (minimal-positive-distance-x-coeff (abs-ℤ x) (abs-ℤ y) H))
( x))))
= dist-ℕ
Expand All @@ -138,7 +138,7 @@ bezouts-lemma-eqn-to-int x y H =
( minimal-positive-distance-x-coeff (abs-ℤ x) (abs-ℤ y) H))
( x))))
( inv
( multiplicative-abs-ℤ
( distributive-abs-mul-ℤ
( int-ℕ (minimal-positive-distance-y-coeff (abs-ℤ x) (abs-ℤ y) H))
( y))))

Expand Down
10 changes: 5 additions & 5 deletions src/elementary-number-theory/distance-natural-numbers.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ left-distributive-mul-dist-ℕ (succ-ℕ m) (succ-ℕ n) (succ-ℕ k) =
( ( ap-dist-ℕ
( right-successor-law-mul-ℕ (succ-ℕ k) m)
( right-successor-law-mul-ℕ (succ-ℕ k) n)) ∙
( ( translation-invariant-dist-ℕ
( succ-ℕ k)
( (succ-ℕ k) *ℕ m)
( (succ-ℕ k) *ℕ n)) ∙
( inv (left-distributive-mul-dist-ℕ m n (succ-ℕ k)))))
( translation-invariant-dist-ℕ'
( succ-ℕ k)
( succ-ℕ k *ℕ m)
( succ-ℕ k *ℕ n)) ∙
( inv (left-distributive-mul-dist-ℕ m n (succ-ℕ k))))

right-distributive-mul-dist-ℕ :
(x y k : ℕ) → (dist-ℕ x y) *ℕ k = dist-ℕ (x *ℕ k) (y *ℕ k)
Expand Down
44 changes: 34 additions & 10 deletions src/elementary-number-theory/divisibility-integers.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,6 @@ is-zero-is-zero-div-ℤ : (x k : ℤ) → div-ℤ k x → is-zero-ℤ k → is-z
is-zero-is-zero-div-ℤ x .zero-ℤ k-div-x refl = is-zero-div-zero-ℤ x k-div-x
```

### If `x` divides both `y` and `z`, then it divides `y + z`

```agda
div-add-ℤ : (x y z : ℤ) → div-ℤ x y → div-ℤ x z → div-ℤ x (y +ℤ z)
pr1 (div-add-ℤ x y z (pair d p) (pair e q)) = d +ℤ e
pr2 (div-add-ℤ x y z (pair d p) (pair e q)) =
( right-distributive-mul-add-ℤ d e x) ∙
( ap-add-ℤ p q)
```

### If `x` divides `y` then `x` divides any multiple of `y`

```agda
Expand Down Expand Up @@ -246,6 +236,40 @@ pr2 (neg-div-ℤ x y (pair d p)) =
by p
```

### If `x` divides both `y` and `z`, then it divides `y + z`

```agda
div-add-ℤ : (x y z : ℤ) → div-ℤ x y → div-ℤ x z → div-ℤ x (y +ℤ z)
pr1 (div-add-ℤ x y z (pair d p) (pair e q)) = d +ℤ e
pr2 (div-add-ℤ x y z (pair d p) (pair e q)) =
( right-distributive-mul-add-ℤ d e x) ∙
( ap-add-ℤ p q)

div-right-summand-ℤ :
(x y z : ℤ) → div-ℤ x y → div-ℤ x (y +ℤ z) → div-ℤ x z
div-right-summand-ℤ x y z H K =
tr
( div-ℤ x)
( is-retraction-left-add-neg-ℤ y z)
( div-add-ℤ x
( neg-ℤ y)
( y +ℤ z)
( div-neg-ℤ x y H)
( K))

div-left-summand-ℤ :
(x y z : ℤ) → div-ℤ x z → div-ℤ x (y +ℤ z) → div-ℤ x y
div-left-summand-ℤ x y z H K =
tr
( div-ℤ x)
( is-retraction-right-add-neg-ℤ z y)
( div-add-ℤ x
( y +ℤ z)
( neg-ℤ z)
( K)
( div-neg-ℤ x z H))
```

### Multiplication preserves divisibility

```agda
Expand Down
15 changes: 6 additions & 9 deletions src/elementary-number-theory/finitary-natural-numbers.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,12 @@ convert-based-succ-based-ℕ
( succ-ℕ (convert-based-ℕ (succ-ℕ k) (succ-based-ℕ (succ-ℕ k) n))))
+ℕ_)
( is-zero-nat-zero-Fin {k})) ∙
( ( ap
( ((succ-ℕ k) *ℕ_) ∘ succ-ℕ)
( convert-based-succ-based-ℕ (succ-ℕ k) n)) ∙
( ( right-successor-law-mul-ℕ
( succ-ℕ k)
( succ-ℕ (convert-based-ℕ (succ-ℕ k) n))) ∙
( commutative-add-ℕ
( succ-ℕ k)
( (succ-ℕ k) *ℕ (succ-ℕ (convert-based-ℕ (succ-ℕ k) n))))))
( ap
( ((succ-ℕ k) *ℕ_) ∘ succ-ℕ)
( convert-based-succ-based-ℕ (succ-ℕ k) n)) ∙
( ( right-successor-law-mul-ℕ
( succ-ℕ k)
( succ-ℕ (convert-based-ℕ (succ-ℕ k) n))))

is-section-inv-convert-based-ℕ :
(k n : ℕ) → convert-based-ℕ (succ-ℕ k) (inv-convert-based-ℕ k n) = n
Expand Down
83 changes: 34 additions & 49 deletions src/elementary-number-theory/integer-fractions.lagda.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module elementary-number-theory.integer-fractions where
open import elementary-number-theory.greatest-common-divisor-integers
open import elementary-number-theory.integers
open import elementary-number-theory.multiplication-integers
open import elementary-number-theory.natural-numbers
open import elementary-number-theory.nonzero-integers
open import elementary-number-theory.positive-and-negative-integers
open import elementary-number-theory.positive-integers
Expand Down Expand Up @@ -64,6 +65,10 @@ denominator-fraction-ℤ x = pr1 (positive-denominator-fraction-ℤ x)
is-positive-denominator-fraction-ℤ :
(x : fraction-ℤ) → is-positive-ℤ (denominator-fraction-ℤ x)
is-positive-denominator-fraction-ℤ x = pr2 (positive-denominator-fraction-ℤ x)

nat-denominator-fraction-ℤ : fraction-ℤ → ℕ
nat-denominator-fraction-ℤ x =
nat-positive-ℤ (positive-denominator-fraction-ℤ x)
```

### Inclusion of the integers
Expand Down Expand Up @@ -129,12 +134,35 @@ fraction-ℤ-Set : Set lzero
fraction-ℤ-Set = fraction-ℤ , is-set-fraction-ℤ
```

### The standard equivalence relation on integer fractions

Two integer fractions `a/b` and `c/d` are said to be equivalent if they satisfy
the equation

```text
ad = cb.
```

This relation is obviously reflexive and symmetric. To see that it is
transitive, suppose that `a/b ~ c/d` and that `c/d ~ e/f`. Since `d` is
positive, we have the implication

```text
(af)d = (eb)d → af = eb.
```

Therefore it suffices to show that `(af)d = (eb)d`. To see this, we calculate

```text
(af)d = (ad)f = (cb)f = (cf)b = (ed)b = (eb)d.
```

```agda
sim-fraction-ℤ-Prop : fraction-ℤ → fraction-ℤ → Prop lzero
sim-fraction-ℤ-Prop x y =
Id-Prop ℤ-Set
((numerator-fraction-ℤ x) *ℤ (denominator-fraction-ℤ y))
((numerator-fraction-ℤ y) *ℤ (denominator-fraction-ℤ x))
( numerator-fraction-ℤ x *ℤ denominator-fraction-ℤ y)
( numerator-fraction-ℤ y *ℤ denominator-fraction-ℤ x)

sim-fraction-ℤ : fraction-ℤ → fraction-ℤ → UU lzero
sim-fraction-ℤ x y = type-Prop (sim-fraction-ℤ-Prop x y)
Expand All @@ -150,54 +178,11 @@ symmetric-sim-fraction-ℤ x y r = inv r

abstract
transitive-sim-fraction-ℤ : is-transitive sim-fraction-ℤ
transitive-sim-fraction-ℤ x y z s r =
is-injective-right-mul-ℤ
( denominator-fraction-ℤ y)
transitive-sim-fraction-ℤ (a , b , pb) y@(c , d , pd) (e , f , pf) s r =
is-injective-right-mul-ℤ d
( is-nonzero-denominator-fraction-ℤ y)
( ( associative-mul-ℤ
( numerator-fraction-ℤ x)
( denominator-fraction-ℤ z)
( denominator-fraction-ℤ y)) ∙
( ap
( (numerator-fraction-ℤ x) *ℤ_)
( commutative-mul-ℤ
( denominator-fraction-ℤ z)
( denominator-fraction-ℤ y))) ∙
( inv
( associative-mul-ℤ
( numerator-fraction-ℤ x)
( denominator-fraction-ℤ y)
( denominator-fraction-ℤ z))) ∙
( ap ( _*ℤ (denominator-fraction-ℤ z)) r) ∙
( associative-mul-ℤ
( numerator-fraction-ℤ y)
( denominator-fraction-ℤ x)
( denominator-fraction-ℤ z)) ∙
( ap
( (numerator-fraction-ℤ y) *ℤ_)
( commutative-mul-ℤ
( denominator-fraction-ℤ x)
( denominator-fraction-ℤ z))) ∙
( inv
( associative-mul-ℤ
( numerator-fraction-ℤ y)
( denominator-fraction-ℤ z)
( denominator-fraction-ℤ x))) ∙
( ap (_*ℤ (denominator-fraction-ℤ x)) s) ∙
( associative-mul-ℤ
( numerator-fraction-ℤ z)
( denominator-fraction-ℤ y)
( denominator-fraction-ℤ x)) ∙
( ap
( (numerator-fraction-ℤ z) *ℤ_)
( commutative-mul-ℤ
( denominator-fraction-ℤ y)
( denominator-fraction-ℤ x))) ∙
( inv
( associative-mul-ℤ
( numerator-fraction-ℤ z)
( denominator-fraction-ℤ x)
( denominator-fraction-ℤ y))))
( right-swap-mul-ℤ a f d ∙ ap (_*ℤ f) r ∙
right-swap-mul-ℤ c b f ∙ ap (_*ℤ b) s ∙ right-swap-mul-ℤ e d b)

equivalence-relation-sim-fraction-ℤ : equivalence-relation lzero fraction-ℤ
pr1 equivalence-relation-sim-fraction-ℤ = sim-fraction-ℤ-Prop
Expand Down
Loading
Loading