Skip to content

Commit abcdc62

Browse files
authored
Complex vector spaces (#1692)
Builds on #1688, #1689, and #1684.
1 parent e3ca3a6 commit abcdc62

27 files changed

+1111
-89
lines changed

src/complex-numbers.lagda.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
module complex-numbers where
55
66
open import complex-numbers.addition-complex-numbers public
7+
open import complex-numbers.addition-nonzero-complex-numbers public
78
open import complex-numbers.apartness-complex-numbers public
89
open import complex-numbers.complex-numbers public
910
open import complex-numbers.conjugation-complex-numbers public
1011
open import complex-numbers.eisenstein-integers public
12+
open import complex-numbers.field-of-complex-numbers public
1113
open import complex-numbers.gaussian-integers public
1214
open import complex-numbers.large-additive-group-of-complex-numbers public
1315
open import complex-numbers.large-ring-of-complex-numbers public
16+
open import complex-numbers.local-ring-of-complex-numbers public
1417
open import complex-numbers.magnitude-complex-numbers public
1518
open import complex-numbers.multiplication-complex-numbers public
1619
open import complex-numbers.multiplicative-inverses-nonzero-complex-numbers public
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Addition of nonzero complex numbers
2+
3+
```agda
4+
module complex-numbers.addition-nonzero-complex-numbers where
5+
```
6+
7+
<details><summary>Imports</summary>
8+
9+
```agda
10+
open import complex-numbers.addition-complex-numbers
11+
open import complex-numbers.complex-numbers
12+
open import complex-numbers.nonzero-complex-numbers
13+
14+
open import foundation.disjunction
15+
open import foundation.functoriality-disjunction
16+
open import foundation.universe-levels
17+
18+
open import real-numbers.addition-nonzero-real-numbers
19+
open import real-numbers.nonzero-real-numbers
20+
```
21+
22+
</details>
23+
24+
## Idea
25+
26+
This file describes properties of
27+
[addition](complex-numbers.addition-complex-numbers.md) of
28+
[nonzero](complex-numbers.nonzero-complex-numbers.md)
29+
[complex numbers](complex-numbers.complex-numbers.md).
30+
31+
## Properties
32+
33+
### If the sum of two complex numbers is nonzero, one of them is nonzero
34+
35+
```agda
36+
abstract
37+
is-nonzero-either-is-nonzero-add-ℂ :
38+
{l1 l2 : Level} (z : ℂ l1) (w : ℂ l2) → is-nonzero-ℂ (z +ℂ w) →
39+
disjunction-type (is-nonzero-ℂ z) (is-nonzero-ℂ w)
40+
is-nonzero-either-is-nonzero-add-ℂ z@(a +iℂ b) w@(c +iℂ d) =
41+
elim-disjunction
42+
( is-nonzero-prop-ℂ z ∨ is-nonzero-prop-ℂ w)
43+
( λ a+c≠0 →
44+
map-disjunction
45+
( inl-disjunction)
46+
( inl-disjunction)
47+
( is-nonzero-either-is-nonzero-add-ℝ a c a+c≠0))
48+
( λ b+d≠0 →
49+
map-disjunction
50+
( inr-disjunction)
51+
( inr-disjunction)
52+
( is-nonzero-either-is-nonzero-add-ℝ b d b+d≠0))
53+
```

src/complex-numbers/apartness-complex-numbers.lagda.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ module complex-numbers.apartness-complex-numbers where
88

99
```agda
1010
open import complex-numbers.complex-numbers
11+
open import complex-numbers.similarity-complex-numbers
1112
13+
open import foundation.apartness-relations
1214
open import foundation.dependent-pair-types
1315
open import foundation.disjunction
1416
open import foundation.empty-types
@@ -17,6 +19,7 @@ open import foundation.functoriality-disjunction
1719
open import foundation.large-apartness-relations
1820
open import foundation.negation
1921
open import foundation.propositions
22+
open import foundation.tight-apartness-relations
2023
open import foundation.universe-levels
2124
2225
open import real-numbers.apartness-real-numbers
@@ -100,3 +103,42 @@ symmetric-Large-Apartness-Relation large-apartness-relation-ℂ =
100103
cotransitive-Large-Apartness-Relation large-apartness-relation-ℂ =
101104
cotransitive-apart-ℂ
102105
```
106+
107+
### The apartness relation of complex numbers at a particular universe level
108+
109+
```agda
110+
apartness-relation-ℂ : (l : Level) → Apartness-Relation l (ℂ l)
111+
apartness-relation-ℂ l =
112+
apartness-relation-Large-Apartness-Relation large-apartness-relation-ℂ l
113+
```
114+
115+
### If two complex numbers at the same universe level are not apart, they are equal
116+
117+
```agda
118+
abstract
119+
is-tight-apartness-relation-ℂ :
120+
(l : Level) → is-tight-Apartness-Relation (apartness-relation-ℂ l)
121+
is-tight-apartness-relation-ℂ l (a +iℂ b) (c +iℂ d) ¬a+ib#c+id =
122+
eq-ℂ
123+
( is-tight-apartness-relation-ℝ l a c (¬a+ib#c+id ∘ inl-disjunction))
124+
( is-tight-apartness-relation-ℝ l b d (¬a+ib#c+id ∘ inr-disjunction))
125+
126+
tight-apartness-relation-ℂ : (l : Level) → Tight-Apartness-Relation l (ℂ l)
127+
tight-apartness-relation-ℂ l =
128+
( apartness-relation-ℂ l ,
129+
is-tight-apartness-relation-ℂ l)
130+
```
131+
132+
### Apartness is preserved by similarity
133+
134+
```agda
135+
abstract
136+
apart-right-sim-ℂ :
137+
{l1 l2 l3 : Level} →
138+
(z : ℂ l1) (x : ℂ l2) (y : ℂ l3) →
139+
sim-ℂ x y → apart-ℂ z x → apart-ℂ z y
140+
apart-right-sim-ℂ (a +iℂ b) (c +iℂ d) (e +iℂ f) (c~e , d~f) =
141+
map-disjunction
142+
( apart-right-sim-ℝ a c e c~e)
143+
( apart-right-sim-ℝ b d f d~f)
144+
```

src/complex-numbers/complex-numbers.lagda.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ open import foundation.cartesian-product-types
1414
open import foundation.dependent-pair-types
1515
open import foundation.equality-cartesian-product-types
1616
open import foundation.identity-types
17+
open import foundation.negated-equality
1718
open import foundation.sets
1819
open import foundation.universe-levels
1920
@@ -99,6 +100,14 @@ i-ℂ : ℂ lzero
99100
i-ℂ = (zero-ℝ , one-ℝ)
100101
```
101102

103+
### `0 ≠ 1` in the complex numbers
104+
105+
```agda
106+
abstract
107+
neq-zero-one-ℂ : zero-ℂ ≠ one-ℂ
108+
neq-zero-one-ℂ 0=1ℂ = neq-zero-one-ℝ (ap re-ℂ 0=1ℂ)
109+
```
110+
102111
### Negation of complex numbers
103112

104113
```agda
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# The field of complex numbers
2+
3+
```agda
4+
module complex-numbers.field-of-complex-numbers where
5+
```
6+
7+
<details><summary>Imports</summary>
8+
9+
```agda
10+
open import commutative-algebra.heyting-fields
11+
open import commutative-algebra.invertible-elements-commutative-rings
12+
13+
open import complex-numbers.apartness-complex-numbers
14+
open import complex-numbers.complex-numbers
15+
open import complex-numbers.large-ring-of-complex-numbers
16+
open import complex-numbers.local-ring-of-complex-numbers
17+
open import complex-numbers.multiplicative-inverses-nonzero-complex-numbers
18+
open import complex-numbers.raising-universe-levels-complex-numbers
19+
20+
open import foundation.dependent-pair-types
21+
open import foundation.identity-types
22+
open import foundation.negation
23+
open import foundation.universe-levels
24+
```
25+
26+
</details>
27+
28+
## Idea
29+
30+
The [complex numbers](complex-numbers.complex-numbers.md) form a
31+
[Heyting field](commutative-algebra.heyting-fields.md).
32+
33+
## Definition
34+
35+
```agda
36+
abstract
37+
is-zero-is-noninvertible-commutative-ring-ℂ :
38+
(l : Level) (z : ℂ l) →
39+
¬ (is-invertible-element-Commutative-Ring (commutative-ring-ℂ l) z) →
40+
z = raise-ℂ l zero-ℂ
41+
is-zero-is-noninvertible-commutative-ring-ℂ l z ¬inv-z =
42+
is-tight-apartness-relation-ℂ l z (raise-ℂ l zero-ℂ)
43+
( λ z#0 →
44+
¬inv-z
45+
( is-invertible-is-nonzero-ℂ
46+
( z)
47+
( apart-right-sim-ℂ
48+
( z)
49+
( raise-ℂ l zero-ℂ)
50+
( zero-ℂ)
51+
( sim-raise-ℂ' l zero-ℂ)
52+
( z#0))))
53+
54+
is-heyting-field-local-commutative-ring-ℂ :
55+
(l : Level) →
56+
is-heyting-field-Local-Commutative-Ring (local-commutative-ring-ℂ l)
57+
is-heyting-field-local-commutative-ring-ℂ l =
58+
( neq-raise-zero-one-ℂ l ,
59+
is-zero-is-noninvertible-commutative-ring-ℂ l)
60+
61+
heyting-field-ℂ : (l : Level) → Heyting-Field (lsuc l)
62+
heyting-field-ℂ l =
63+
( local-commutative-ring-ℂ l ,
64+
is-heyting-field-local-commutative-ring-ℂ l)
65+
```
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# The local ring of complex numbers
2+
3+
```agda
4+
module complex-numbers.local-ring-of-complex-numbers where
5+
```
6+
7+
<details><summary>Imports</summary>
8+
9+
```agda
10+
open import commutative-algebra.local-commutative-rings
11+
12+
open import complex-numbers.addition-complex-numbers
13+
open import complex-numbers.addition-nonzero-complex-numbers
14+
open import complex-numbers.large-ring-of-complex-numbers
15+
open import complex-numbers.multiplicative-inverses-nonzero-complex-numbers
16+
open import complex-numbers.nonzero-complex-numbers
17+
18+
open import foundation.dependent-pair-types
19+
open import foundation.functoriality-disjunction
20+
open import foundation.universe-levels
21+
```
22+
23+
</details>
24+
25+
## Idea
26+
27+
The
28+
[commutative ring of complex numbers](complex-numbers.large-ring-of-complex-numbers.md)
29+
is [local](commutative-algebra.local-commutative-rings.md).
30+
31+
## Definition
32+
33+
```agda
34+
is-local-commutative-ring-ℂ :
35+
(l : Level) → is-local-Commutative-Ring (commutative-ring-ℂ l)
36+
is-local-commutative-ring-ℂ l z w is-invertible-z+w =
37+
map-disjunction
38+
( is-invertible-is-nonzero-ℂ z)
39+
( is-invertible-is-nonzero-ℂ w)
40+
( is-nonzero-either-is-nonzero-add-ℂ
41+
( z)
42+
( w)
43+
( is-nonzero-is-invertible-ℂ
44+
( z +ℂ w)
45+
( is-invertible-z+w)))
46+
47+
local-commutative-ring-ℂ : (l : Level) → Local-Commutative-Ring (lsuc l)
48+
local-commutative-ring-ℂ l =
49+
( commutative-ring-ℂ l , is-local-commutative-ring-ℂ l)
50+
```

src/complex-numbers/magnitude-complex-numbers.lagda.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ module complex-numbers.magnitude-complex-numbers where
1212
open import complex-numbers.complex-numbers
1313
open import complex-numbers.conjugation-complex-numbers
1414
open import complex-numbers.multiplication-complex-numbers
15+
open import complex-numbers.similarity-complex-numbers
1516
1617
open import foundation.action-on-identifications-functions
18+
open import foundation.dependent-pair-types
1719
open import foundation.identity-types
1820
open import foundation.universe-levels
1921
22+
open import real-numbers.absolute-value-real-numbers
2023
open import real-numbers.addition-nonnegative-real-numbers
2124
open import real-numbers.addition-real-numbers
2225
open import real-numbers.dedekind-real-numbers
@@ -25,6 +28,7 @@ open import real-numbers.multiplication-nonnegative-real-numbers
2528
open import real-numbers.multiplication-real-numbers
2629
open import real-numbers.negation-real-numbers
2730
open import real-numbers.nonnegative-real-numbers
31+
open import real-numbers.positive-real-numbers
2832
open import real-numbers.raising-universe-levels-real-numbers
2933
open import real-numbers.rational-real-numbers
3034
open import real-numbers.similarity-real-numbers
@@ -225,3 +229,67 @@ abstract
225229
= magnitude-ℂ z *ℝ magnitude-ℂ w
226230
by ap real-ℝ⁰⁺ (distributive-sqrt-mul-ℝ⁰⁺ _ _)
227231
```
232+
233+
### The magnitude of a real number as a complex number is its absolute value
234+
235+
```agda
236+
abstract
237+
magnitude-complex-ℝ :
238+
{l : Level} (x : ℝ l) → magnitude-ℂ (complex-ℝ x) = abs-ℝ x
239+
magnitude-complex-ℝ {l} x =
240+
equational-reasoning
241+
real-sqrt-ℝ⁰⁺
242+
( nonnegative-square-ℝ x +ℝ⁰⁺ nonnegative-square-ℝ (raise-ℝ l zero-ℝ))
243+
244+
real-sqrt-ℝ⁰⁺
245+
( nonnegative-square-ℝ x +ℝ⁰⁺ nonnegative-square-ℝ zero-ℝ)
246+
by
247+
ap
248+
( real-sqrt-ℝ⁰⁺)
249+
( eq-ℝ⁰⁺ _ _
250+
( eq-sim-ℝ
251+
( preserves-sim-left-add-ℝ _ _ _
252+
( preserves-sim-square-ℝ
253+
( symmetric-sim-ℝ (sim-raise-ℝ l zero-ℝ))))))
254+
= real-sqrt-ℝ⁰⁺ (nonnegative-square-ℝ x +ℝ⁰⁺ zero-ℝ⁰⁺)
255+
by ap real-sqrt-ℝ⁰⁺ (eq-ℝ⁰⁺ _ _ (ap-add-ℝ refl square-zero-ℝ))
256+
= real-sqrt-ℝ⁰⁺ (nonnegative-square-ℝ x)
257+
by ap real-sqrt-ℝ⁰⁺ (eq-ℝ⁰⁺ _ _ (right-unit-law-add-ℝ _))
258+
= abs-ℝ x
259+
by inv (eq-abs-sqrt-square-ℝ x)
260+
```
261+
262+
### Similar complex numbers have similar magnitudes
263+
264+
```agda
265+
abstract
266+
preserves-sim-squared-magnitude-ℂ :
267+
{l1 l2 : Level} {z : ℂ l1} {w : ℂ l2} →
268+
sim-ℂ z w → sim-ℝ (squared-magnitude-ℂ z) (squared-magnitude-ℂ w)
269+
preserves-sim-squared-magnitude-ℂ (a~c , b~d) =
270+
preserves-sim-add-ℝ
271+
( preserves-sim-square-ℝ a~c)
272+
( preserves-sim-square-ℝ b~d)
273+
274+
preserves-sim-magnitude-ℂ :
275+
{l1 l2 : Level} {z : ℂ l1} {w : ℂ l2} →
276+
sim-ℂ z w → sim-ℝ (magnitude-ℂ z) (magnitude-ℂ w)
277+
preserves-sim-magnitude-ℂ z~w =
278+
preserves-sim-sqrt-ℝ⁰⁺ _ _ (preserves-sim-squared-magnitude-ℂ z~w)
279+
```
280+
281+
### The magnitude of `one-ℂ` is `one-ℝ`
282+
283+
```agda
284+
abstract
285+
magnitude-one-ℂ : magnitude-ℂ one-ℂ = one-ℝ
286+
magnitude-one-ℂ =
287+
equational-reasoning
288+
magnitude-ℂ one-ℂ
289+
= magnitude-ℂ (complex-ℝ one-ℝ)
290+
by ap magnitude-ℂ (inv eq-complex-one-ℝ)
291+
= abs-ℝ one-ℝ
292+
by magnitude-complex-ℝ one-ℝ
293+
= one-ℝ
294+
by abs-real-ℝ⁺ one-ℝ⁺
295+
```

0 commit comments

Comments
 (0)