-
Notifications
You must be signed in to change notification settings - Fork 64
/
multiplication-rational-numbers.lagda.md
63 lines (48 loc) · 1.63 KB
/
multiplication-rational-numbers.lagda.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Multiplication on the rational numbers
```agda
{-# OPTIONS --lossy-unification #-}
module elementary-number-theory.multiplication-rational-numbers where
```
<details><summary>Imports</summary>
```agda
open import elementary-number-theory.integer-fractions
open import elementary-number-theory.integers
open import elementary-number-theory.multiplication-integer-fractions
open import elementary-number-theory.rational-numbers
open import elementary-number-theory.reduced-integer-fractions
open import foundation.dependent-pair-types
open import foundation.identity-types
```
</details>
## Idea
**Multiplication** on the
[rational numbers](elementary-number-theory.rational-numbers.md) is defined by
extending
[multiplication](elementary-number-theory.multiplication-integer-fractions.md)
on [integer fractions](elementary-number-theory.integer-fractions.md) to the
rational numbers.
## Definition
```agda
mul-ℚ : ℚ → ℚ → ℚ
mul-ℚ (x , p) (y , q) = in-fraction-ℤ (mul-fraction-ℤ x y)
infix 30 _*ℚ_
_*ℚ_ = mul-ℚ
```
## Properties
### Unit laws
```agda
left-unit-law-mul-ℚ : (x : ℚ) → one-ℚ *ℚ x = x
left-unit-law-mul-ℚ x =
( eq-ℚ-sim-fractions-ℤ
( mul-fraction-ℤ one-fraction-ℤ (fraction-ℚ x))
( fraction-ℚ x)
( left-unit-law-mul-fraction-ℤ (fraction-ℚ x))) ∙
( in-fraction-fraction-ℚ x)
right-unit-law-mul-ℚ : (x : ℚ) → x *ℚ one-ℚ = x
right-unit-law-mul-ℚ x =
( eq-ℚ-sim-fractions-ℤ
( mul-fraction-ℤ (fraction-ℚ x) one-fraction-ℤ)
( fraction-ℚ x)
( right-unit-law-mul-fraction-ℤ (fraction-ℚ x))) ∙
( in-fraction-fraction-ℚ x)
```