2
2
Copyright (c) 2017 Kevin Buzzard. All rights reserved.
3
3
Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Kevin Buzzard, Mario Carneiro
5
-
6
- The complex numbers, modelled as R^2 in the obvious way.
7
5
-/
8
6
import data.real.basic
9
7
import deprecated.field
8
+ /-!
9
+ # The complex numbers
10
+
11
+ The complex numbers are modelled as ℝ^2 in the obvious way.
12
+ -/
10
13
14
+ /-- Complex numbers consist of two `real`s, a real part `re` and an imaginary part `im`. -/
11
15
structure complex : Type :=
12
16
(re : ℝ) (im : ℝ)
13
17
@@ -51,6 +55,7 @@ instance : has_one ℂ := ⟨(1 : ℝ)⟩
51
55
@[simp] lemma one_im : (1 : ℂ).im = 0 := rfl
52
56
@[simp, norm_cast] lemma of_real_one : ((1 : ℝ) : ℂ) = 1 := rfl
53
57
58
+ /-- the imaginary unit -/
54
59
def I : ℂ := ⟨0 , 1 ⟩
55
60
56
61
@[simp] lemma I_re : I.re = 0 := rfl
@@ -90,6 +95,7 @@ ext_iff.2 $ by simp
90
95
@[simp] lemma re_add_im (z : ℂ) : (z.re : ℂ) + z.im * I = z :=
91
96
ext_iff.2 $ by simp
92
97
98
+ /-- The complex numbers are equivalent to `ℝ × ℝ` -/
93
99
def real_prod_equiv : ℂ ≃ (ℝ × ℝ) :=
94
100
{ to_fun := λ z, ⟨z.re, z.im⟩,
95
101
inv_fun := λ p, ⟨p.1 , p.2 ⟩,
@@ -100,6 +106,7 @@ def real_prod_equiv : ℂ ≃ (ℝ × ℝ) :=
100
106
theorem real_prod_equiv_symm_re (x y : ℝ) : (real_prod_equiv.symm (x, y)).re = x := rfl
101
107
theorem real_prod_equiv_symm_im (x y : ℝ) : (real_prod_equiv.symm (x, y)).im = y := rfl
102
108
109
+ /-- the complex conjugate -/
103
110
def conj (z : ℂ) : ℂ := ⟨z.re, -z.im⟩
104
111
105
112
@[simp] lemma conj_re (z : ℂ) : (conj z).re = z.re := rfl
@@ -141,7 +148,8 @@ lemma eq_conj_iff_real {z : ℂ} : conj z = z ↔ ∃ r : ℝ, z = r :=
141
148
lemma eq_conj_iff_re {z : ℂ} : conj z = z ↔ (z.re : ℂ) = z :=
142
149
eq_conj_iff_real.trans ⟨by rintro ⟨r, rfl⟩; simp, λ h, ⟨_, h.symm⟩⟩
143
150
144
- def norm_sq (z : ℂ) : ℝ := z.re * z.re + z.im * z.im
151
+ /-- the norm squared function -/
152
+ @[pp_nodot] def norm_sq (z : ℂ) : ℝ := z.re * z.re + z.im * z.im
145
153
146
154
@[simp] lemma norm_sq_of_real (r : ℝ) : norm_sq r = r * r :=
147
155
by simp [norm_sq]
@@ -329,7 +337,8 @@ by rw [← of_real_rat_cast, of_real_re]
329
337
@[simp, norm_cast] lemma rat_cast_im (q : ℚ) : (q : ℂ).im = 0 :=
330
338
by rw [← of_real_rat_cast, of_real_im]
331
339
332
- noncomputable def abs (z : ℂ) : ℝ := (norm_sq z).sqrt
340
+ /-- the complex absolute value function, defined as the square root of the norm squared. -/
341
+ @[pp_nodot] noncomputable def abs (z : ℂ) : ℝ := (norm_sq z).sqrt
333
342
334
343
local notation `abs' ` := _root_.abs
335
344
@@ -439,9 +448,11 @@ theorem is_cau_seq_im (f : cau_seq ℂ abs) : is_cau_seq abs' (λ n, (f n).im) :
439
448
λ ε ε0 , (f.cauchy ε0 ).imp $ λ i H j ij,
440
449
lt_of_le_of_lt (by simpa using abs_im_le_abs (f j - f i)) (H _ ij)
441
450
451
+ /-- The real part of a complex Cauchy sequence is a real Cauchy sequence. -/
442
452
noncomputable def cau_seq_re (f : cau_seq ℂ abs) : cau_seq ℝ abs' :=
443
453
⟨_, is_cau_seq_re f⟩
444
454
455
+ /-- The imaginary part of a complex Cauchy sequence is a real Cauchy sequence. -/
445
456
noncomputable def cau_seq_im (f : cau_seq ℂ abs) : cau_seq ℝ abs' :=
446
457
⟨_, is_cau_seq_im f⟩
447
458
@@ -450,6 +461,7 @@ lemma is_cau_seq_abs {f : ℕ → ℂ} (hf : is_cau_seq abs f) :
450
461
λ ε ε0 , let ⟨i, hi⟩ := hf ε ε0 in
451
462
⟨i, λ j hj, lt_of_le_of_lt (abs_abs_sub_le_abs_sub _ _) (hi j hj)⟩
452
463
464
+ /-- the limit of a Cauchy sequence of complex numbers -/
453
465
noncomputable def lim_aux (f : cau_seq ℂ abs) : ℂ :=
454
466
⟨cau_seq.lim (cau_seq_re f), cau_seq.lim (cau_seq_im f)⟩
455
467
@@ -487,12 +499,15 @@ lemma is_cau_seq_conj (f : cau_seq ℂ abs) : is_cau_seq abs (λ n, conj (f n))
487
499
λ ε ε0 , let ⟨i, hi⟩ := f.2 ε ε0 in
488
500
⟨i, λ j hj, by rw [← conj_sub, abs_conj]; exact hi j hj⟩
489
501
490
- noncomputable def cau_seq_conj (f : cau_seq ℂ abs) : cau_seq ℂ abs := ⟨_, is_cau_seq_conj f⟩
502
+ /-- The complex conjugation of a complex Cauchy sequence is a Cauchy sequence. -/
503
+ noncomputable def cau_seq_conj (f : cau_seq ℂ abs) : cau_seq ℂ abs :=
504
+ ⟨_, is_cau_seq_conj f⟩
491
505
492
506
lemma lim_conj (f : cau_seq ℂ abs) : lim (cau_seq_conj f) = conj (lim f) :=
493
507
complex.ext (by simp [cau_seq_conj, (lim_re _).symm, cau_seq_re])
494
508
(by simp [cau_seq_conj, (lim_im _).symm, cau_seq_im, (lim_neg _).symm]; refl)
495
509
510
+ /-- The absolute value of a complex Cauchy sequence is a real Cauchy sequence. -/
496
511
noncomputable def cau_seq_abs (f : cau_seq ℂ abs) : cau_seq ℝ abs' :=
497
512
⟨_, is_cau_seq_abs f.2 ⟩
498
513
0 commit comments