@@ -4,6 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Yury Kudryashov
5
5
-/
6
6
import algebra.algebra.equiv
7
+ import linear_algebra.finrank
8
+ import linear_algebra.free_module.basic
9
+ import linear_algebra.free_module.finite.basic
7
10
import set_theory.cardinal.ordinal
8
11
import tactic.ring_exp
9
12
@@ -65,6 +68,17 @@ def equiv_prod {R : Type*} (c₁ c₂ : R) : ℍ[R, c₁, c₂] ≃ R × R × R
65
68
left_inv := λ ⟨a₁, a₂, a₃, a₄⟩, rfl,
66
69
right_inv := λ ⟨a₁, a₂, a₃, a₄⟩, rfl }
67
70
71
+ /-- The equivalence between a quaternion algebra over `R` and `fin 4 → R`. -/
72
+ @[simps symm_apply]
73
+ def equiv_tuple {R : Type *} (c₁ c₂ : R) : ℍ[R, c₁, c₂] ≃ (fin 4 → R) :=
74
+ { to_fun := λ a, ![a.1 , a.2 , a.3 , a.4 ],
75
+ inv_fun := λ a, ⟨a 0 , a 1 , a 2 , a 3 ⟩,
76
+ left_inv := λ ⟨a₁, a₂, a₃, a₄⟩, rfl,
77
+ right_inv := λ f, by ext ⟨_, _|_|_|_|_|⟨⟩⟩; refl }
78
+
79
+ @[simp] lemma equiv_tuple_apply {R : Type *} (c₁ c₂ : R) (x : ℍ[R, c₁, c₂]) :
80
+ equiv_tuple c₁ c₂ x = ![x.re, x.im_i, x.im_j, x.im_k] := rfl
81
+
68
82
@[simp] lemma mk.eta {R : Type *} {c₁ c₂} : ∀ a : ℍ[R, c₁, c₂], mk a.1 a.2 a.3 a.4 = a
69
83
| ⟨a₁, a₂, a₃, a₄⟩ := rfl
70
84
@@ -191,7 +205,7 @@ instance : algebra R ℍ[R, c₁, c₂] :=
191
205
lemma algebra_map_eq (r : R) : algebra_map R ℍ[R,c₁,c₂] r = ⟨r, 0 , 0 , 0 ⟩ := rfl
192
206
193
207
section
194
- variables (R c₁ c₂)
208
+ variables (c₁ c₂)
195
209
196
210
/-- `quaternion_algebra.re` as a `linear_map`-/
197
211
@[simps] def re_lm : ℍ[R, c₁, c₂] →ₗ[R] R :=
@@ -209,6 +223,37 @@ variables (R c₁ c₂)
209
223
@[simps] def im_k_lm : ℍ[R, c₁, c₂] →ₗ[R] R :=
210
224
{ to_fun := im_k, map_add' := λ x y, rfl, map_smul' := λ r x, rfl }
211
225
226
+ /-- `quaternion_algebra.equiv_tuple` as a linear equivalence. -/
227
+ def linear_equiv_tuple : ℍ[R,c₁,c₂] ≃ₗ[R] (fin 4 → R) :=
228
+ linear_equiv.symm -- proofs are not `rfl` in the forward direction
229
+ { to_fun := (equiv_tuple c₁ c₂).symm,
230
+ inv_fun := equiv_tuple c₁ c₂,
231
+ map_add' := λ v₁ v₂, rfl,
232
+ map_smul' := λ v₁ v₂, rfl,
233
+ .. (equiv_tuple c₁ c₂).symm }
234
+
235
+ @[simp] lemma coe_linear_equiv_tuple : ⇑(linear_equiv_tuple c₁ c₂) = equiv_tuple c₁ c₂ := rfl
236
+ @[simp] lemma coe_linear_equiv_tuple_symm :
237
+ ⇑(linear_equiv_tuple c₁ c₂).symm = (equiv_tuple c₁ c₂).symm := rfl
238
+
239
+ /-- `ℍ[R, c₁, c₂]` has a basis over `R` given by `1`, `i`, `j`, and `k`. -/
240
+ noncomputable def basis_one_i_j_k : basis (fin 4 ) R ℍ[R, c₁, c₂] :=
241
+ basis.of_equiv_fun $ linear_equiv_tuple c₁ c₂
242
+
243
+ @[simp] lemma coe_basis_one_i_j_k_repr (q : ℍ[R, c₁, c₂]) :
244
+ ⇑((basis_one_i_j_k c₁ c₂).repr q) = ![q.re, q.im_i, q.im_j, q.im_k] := rfl
245
+
246
+ instance : module.finite R ℍ[R, c₁, c₂] := module.finite.of_basis (basis_one_i_j_k c₁ c₂)
247
+ instance : module.free R ℍ[R, c₁, c₂] := module.free.of_basis (basis_one_i_j_k c₁ c₂)
248
+
249
+ lemma dim_eq_four [strong_rank_condition R] : module.rank R ℍ[R, c₁, c₂] = 4 :=
250
+ by { rw [dim_eq_card_basis (basis_one_i_j_k c₁ c₂), fintype.card_fin], norm_num }
251
+
252
+ lemma finrank_eq_four [strong_rank_condition R] : finite_dimensional.finrank R ℍ[R, c₁, c₂] = 4 :=
253
+ have cardinal.to_nat 4 = 4 ,
254
+ by rw [←cardinal.to_nat_cast 4 , nat.cast_bit0, nat.cast_bit0, nat.cast_one],
255
+ by rw [finite_dimensional.finrank, dim_eq_four, this ]
256
+
212
257
end
213
258
214
259
@[norm_cast, simp] lemma coe_sub : ((x - y : R) : ℍ[R, c₁, c₂]) = x - y :=
@@ -344,10 +389,19 @@ def quaternion (R : Type*) [has_one R] [has_neg R] := quaternion_algebra R (-1)
344
389
345
390
localized " notation (name := quaternion) `ℍ[` R `]` := quaternion R" in quaternion
346
391
347
- /-- The equivalence between the quaternions over R and R × R × R × R. -/
392
+ /-- The equivalence between the quaternions over `R` and `R × R × R × R`. -/
393
+ @[simps]
348
394
def quaternion.equiv_prod (R : Type *) [has_one R] [has_neg R] : ℍ[R] ≃ R × R × R × R :=
349
395
quaternion_algebra.equiv_prod _ _
350
396
397
+ /-- The equivalence between the quaternions over `R` and `fin 4 → R`. -/
398
+ @[simps symm_apply]
399
+ def quaternion.equiv_tuple (R : Type *) [has_one R] [has_neg R] : ℍ[R] ≃ (fin 4 → R) :=
400
+ quaternion_algebra.equiv_tuple _ _
401
+
402
+ @[simp] lemma quaternion.equiv_tuple_apply (R : Type *) [has_one R] [has_neg R] (x : ℍ[R]) :
403
+ quaternion.equiv_tuple R x = ![x.re, x.im_i, x.im_j, x.im_k] := rfl
404
+
351
405
namespace quaternion
352
406
353
407
variables {R : Type *} [comm_ring R] (r x y z : R) (a b c : ℍ[R])
@@ -445,6 +499,15 @@ lemma mul_coe_eq_smul : a * r = r • a := quaternion_algebra.mul_coe_eq_smul r
445
499
446
500
lemma smul_coe : x • (y : ℍ[R]) = ↑(x * y) := quaternion_algebra.smul_coe x y
447
501
502
+ instance : module.finite R ℍ[R] := quaternion_algebra.module.finite _ _
503
+ instance : module.free R ℍ[R] := quaternion_algebra.module.free _ _
504
+
505
+ lemma dim_eq_four [strong_rank_condition R] : module.rank R ℍ[R] = 4 :=
506
+ quaternion_algebra.dim_eq_four _ _
507
+
508
+ lemma finrank_eq_four [strong_rank_condition R] : finite_dimensional.finrank R ℍ[R] = 4 :=
509
+ quaternion_algebra.finrank_eq_four _ _
510
+
448
511
/-- Quaternion conjugate. -/
449
512
def conj : ℍ[R] ≃ₗ[R] ℍ[R] := quaternion_algebra.conj
450
513
0 commit comments