@@ -4,14 +4,17 @@ Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Alexander Bentkamp, Sébastien Gouëzel
5
5
-/
6
6
import data.complex.basic
7
- import algebra.algebra.basic
7
+ import data.matrix.notation
8
+ import field_theory.tower
9
+ import linear_algebra.finite_dimensional
8
10
9
11
/-!
10
12
# Complex number as a vector space over `ℝ`
11
13
12
14
This file contains three instances:
13
15
* `ℂ` is an `ℝ` algebra;
14
16
* any complex vector space is a real vector space;
17
+ * any finite dimensional complex vector space is a finite dimesional real vector space;
15
18
* the space of `ℝ`-linear maps from a real vector space to a complex vector space is a complex
16
19
vector space.
17
20
@@ -30,41 +33,88 @@ namespace complex
30
33
31
34
instance algebra_over_reals : algebra ℝ ℂ := (complex.of_real).to_algebra
32
35
36
+ @[simp] lemma coe_algebra_map : ⇑(algebra_map ℝ ℂ) = complex.of_real := rfl
37
+
38
+ @[simp] lemma re_smul (a : ℝ) (z : ℂ) : re (a • z) = a * re z := by simp [algebra.smul_def]
39
+
40
+ @[simp] lemma im_smul (a : ℝ) (z : ℂ) : im (a • z) = a * im z := by simp [algebra.smul_def]
41
+
42
+ open submodule finite_dimensional
43
+
44
+ lemma is_basis_one_I : is_basis ℝ ![1 , I] :=
45
+ begin
46
+ refine ⟨linear_independent_fin2.2 ⟨I_ne_zero, λ a, mt (congr_arg re) $ by simp⟩,
47
+ eq_top_iff'.2 $ λ z, _⟩,
48
+ suffices : ∃ a b, z = a • I + b • 1 ,
49
+ by simpa [mem_span_insert, mem_span_singleton, -set.singleton_one],
50
+ use [z.im, z.re],
51
+ simp [algebra.smul_def, add_comm]
52
+ end
53
+
54
+ instance : finite_dimensional ℝ ℂ := of_fintype_basis is_basis_one_I
55
+
56
+ @[simp] lemma findim_real_complex : finite_dimensional.findim ℝ ℂ = 2 :=
57
+ by rw [findim_eq_card_basis is_basis_one_I, fintype.card_fin]
58
+
59
+ @[simp] lemma dim_real_complex : vector_space.dim ℝ ℂ = 2 :=
60
+ by simp [← findim_eq_dim, findim_real_complex]
61
+
62
+ lemma {u } dim_real_complex' : cardinal.lift.{0 u} (vector_space.dim ℝ ℂ) = 2 :=
63
+ by simp [← findim_eq_dim, findim_real_complex, bit0]
64
+
33
65
end complex
34
66
35
67
/- Register as an instance (with low priority) the fact that a complex vector space is also a real
36
68
vector space. -/
69
+ @[priority 900 ]
37
70
instance module.complex_to_real (E : Type *) [add_comm_group E] [module ℂ E] : module ℝ E :=
38
71
semimodule.restrict_scalars' ℝ ℂ E
39
- attribute [instance, priority 900 ] module.complex_to_real
72
+
73
+ instance module.real_complex_tower (E : Type *) [add_comm_group E] [module ℂ E] :
74
+ is_scalar_tower ℝ ℂ E :=
75
+ semimodule.restrict_scalars.is_scalar_tower ℝ
40
76
41
77
instance (E : Type *) [add_comm_group E] [module ℝ E]
42
78
(F : Type *) [add_comm_group F] [module ℂ F] : module ℂ (E →ₗ[ℝ] F) :=
43
79
linear_map.module_extend_scalars _ _ _ _
44
80
81
+ @[priority 100 ]
82
+ instance finite_dimensional.complex_to_real (E : Type *) [add_comm_group E] [module ℂ E]
83
+ [finite_dimensional ℂ E] : finite_dimensional ℝ E :=
84
+ finite_dimensional.trans ℝ ℂ E
85
+
86
+ lemma dim_real_of_complex (E : Type *) [add_comm_group E] [module ℂ E] :
87
+ vector_space.dim ℝ E = 2 * vector_space.dim ℂ E :=
88
+ cardinal.lift_inj.1 $
89
+ by { rw [← dim_mul_dim' ℝ ℂ E, complex.dim_real_complex], simp [bit0] }
90
+
91
+ lemma findim_real_of_complex (E : Type *) [add_comm_group E] [module ℂ E] :
92
+ finite_dimensional.findim ℝ E = 2 * finite_dimensional.findim ℂ E :=
93
+ by rw [← finite_dimensional.findim_mul_findim ℝ ℂ E, complex.findim_real_complex]
94
+
45
95
namespace complex
46
96
47
97
/-- Linear map version of the real part function, from `ℂ` to `ℝ`. -/
48
98
def linear_map.re : ℂ →ₗ[ℝ] ℝ :=
49
99
{ to_fun := λx, x.re,
50
- map_add' := by simp ,
51
- map_smul' := λc x, by { change ((c : ℂ) * x).re = c * x.re, simp } }
100
+ map_add' := add_re ,
101
+ map_smul' := re_smul }
52
102
53
103
@[simp] lemma linear_map.coe_re : ⇑linear_map.re = re := rfl
54
104
55
105
/-- Linear map version of the imaginary part function, from `ℂ` to `ℝ`. -/
56
106
def linear_map.im : ℂ →ₗ[ℝ] ℝ :=
57
107
{ to_fun := λx, x.im,
58
- map_add' := by simp ,
59
- map_smul' := λc x, by { change ((c : ℂ) * x).im = c * x.im, simp } }
108
+ map_add' := add_im ,
109
+ map_smul' := im_smul }
60
110
61
111
@[simp] lemma linear_map.coe_im : ⇑linear_map.im = im := rfl
62
112
63
113
/-- Linear map version of the canonical embedding of `ℝ` in `ℂ`. -/
64
114
def linear_map.of_real : ℝ →ₗ[ℝ] ℂ :=
65
115
{ to_fun := coe,
66
- map_add' := by simp ,
67
- map_smul' := λc x, by { simp, refl } }
116
+ map_add' := of_real_add ,
117
+ map_smul' := λc x, by simp [algebra.smul_def] }
68
118
69
119
@[simp] lemma linear_map.coe_of_real : ⇑linear_map.of_real = coe := rfl
70
120
0 commit comments