Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
/- | |
Copyright (c) 2020 Yury Kudryashov. All rights reserved. | |
Released under Apache 2.0 license as described in the file LICENSE. | |
Authors: Yury Kudryashov | |
-/ | |
import algebra.quaternion | |
import analysis.inner_product_space.basic | |
/-! | |
# Quaternions as a normed algebra | |
In this file we define the following structures on the space `β := β[β]` of quaternions: | |
* inner product space; | |
* normed ring; | |
* normed space over `β`. | |
## Notation | |
The following notation is available with `open_locale quaternion`: | |
* `β` : quaternions | |
## Tags | |
quaternion, normed ring, normed space, normed algebra | |
-/ | |
localized "notation `β` := quaternion β" in quaternion | |
open_locale real_inner_product_space | |
noncomputable theory | |
namespace quaternion | |
instance : has_inner β β := β¨Ξ» a b, (a * b.conj).reβ© | |
lemma inner_self (a : β) : βͺa, aβ« = norm_sq a := rfl | |
lemma inner_def (a b : β) : βͺa, bβ« = (a * b.conj).re := rfl | |
instance : inner_product_space β β := | |
inner_product_space.of_core | |
{ inner := has_inner.inner, | |
conj_sym := Ξ» x y, by simp [inner_def, mul_comm], | |
nonneg_re := Ξ» x, norm_sq_nonneg, | |
definite := Ξ» x, norm_sq_eq_zero.1, | |
add_left := Ξ» x y z, by simp only [inner_def, add_mul, add_re], | |
smul_left := Ξ» x y r, by simp [inner_def] } | |
lemma norm_sq_eq_norm_sq (a : β) : norm_sq a = β₯aβ₯ * β₯aβ₯ := | |
by rw [β inner_self, real_inner_self_eq_norm_mul_norm] | |
instance : norm_one_class β := | |
β¨by rw [norm_eq_sqrt_real_inner, inner_self, norm_sq.map_one, real.sqrt_one]β© | |
@[simp, norm_cast] lemma norm_coe (a : β) : β₯(a : β)β₯ = β₯aβ₯ := | |
by rw [norm_eq_sqrt_real_inner, inner_self, norm_sq_coe, real.sqrt_sq_eq_abs, real.norm_eq_abs] | |
@[simp, norm_cast] lemma nnnorm_coe (a : β) : β₯(a : β)β₯β = β₯aβ₯β := | |
subtype.ext $ norm_coe a | |
noncomputable instance : normed_division_ring β := | |
{ dist_eq := Ξ» _ _, rfl, | |
norm_mul' := Ξ» a b, by { simp only [norm_eq_sqrt_real_inner, inner_self, norm_sq.map_mul], | |
exact real.sqrt_mul norm_sq_nonneg _ } } | |
noncomputable instance : normed_algebra β β := | |
{ norm_smul_le := Ξ» a x, (norm_smul a x).le, | |
to_algebra := quaternion.algebra } | |
instance : has_coe β β := β¨Ξ» z, β¨z.re, z.im, 0, 0β©β© | |
@[simp, norm_cast] lemma coe_complex_re (z : β) : (z : β).re = z.re := rfl | |
@[simp, norm_cast] lemma coe_complex_im_i (z : β) : (z : β).im_i = z.im := rfl | |
@[simp, norm_cast] lemma coe_complex_im_j (z : β) : (z : β).im_j = 0 := rfl | |
@[simp, norm_cast] lemma coe_complex_im_k (z : β) : (z : β).im_k = 0 := rfl | |
@[simp, norm_cast] lemma coe_complex_add (z w : β) : β(z + w) = (z + w : β) := by ext; simp | |
@[simp, norm_cast] lemma coe_complex_mul (z w : β) : β(z * w) = (z * w : β) := by ext; simp | |
@[simp, norm_cast] lemma coe_complex_zero : ((0 : β) : β) = 0 := rfl | |
@[simp, norm_cast] lemma coe_complex_one : ((1 : β) : β) = 1 := rfl | |
@[simp, norm_cast] lemma coe_real_complex_mul (r : β) (z : β) : (r β’ z : β) = βr * βz := | |
by ext; simp | |
@[simp, norm_cast] lemma coe_complex_coe (r : β) : ((r : β) : β) = r := rfl | |
/-- Coercion `β ββ[β] β` as an algebra homomorphism. -/ | |
def of_complex : β ββ[β] β := | |
{ to_fun := coe, | |
map_one' := rfl, | |
map_zero' := rfl, | |
map_add' := coe_complex_add, | |
map_mul' := coe_complex_mul, | |
commutes' := Ξ» x, rfl } | |
@[simp] lemma coe_of_complex : βof_complex = coe := rfl | |
end quaternion | |