Quaternions #
In this file we define quaternions ℍ[R]
over a commutative ring R
, and define some
algebraic structures on ℍ[R]
.
Main definitions #
QuaternionAlgebra R a b
,ℍ[R, a, b]
: quaternion algebra with coefficientsa
,b
Quaternion R
,ℍ[R]
: the space of quaternions, a.k.a.QuaternionAlgebra R (-1) (-1)
;Quaternion.normSq
: square of the norm of a quaternion;
We also define the following algebraic structures on ℍ[R]
:
Ring ℍ[R, a, b]
,StarRing ℍ[R, a, b]
, andAlgebra R ℍ[R, a, b]
: for any commutative ringR
;Ring ℍ[R]
,StarRing ℍ[R]
, andAlgebra R ℍ[R]
: for any commutative ringR
;IsDomain ℍ[R]
: for a linear ordered commutative ringR
;DivisionRing ℍ[R]
: for a linear ordered fieldR
.
Notation #
The following notation is available with open Quaternion
or open scoped Quaternion
.
ℍ[R, c₁, c₂]
:QuaternionAlgebra R c₁ c₂
ℍ[R]
: quaternions overR
.
Implementation notes #
We define quaternions over any ring R
, not just ℝ
to be able to deal with, e.g., integer
or rational quaternions without using real numbers. In particular, all definitions in this file
are computable.
Tags #
quaternion
Quaternion algebra over a type with fixed coefficients $a=i^2$ and $b=j^2$.
Implemented as a structure with four fields: re
, imI
, imJ
, and imK
.
- re : R
Real part of a quaternion.
- imI : R
First imaginary part (i) of a quaternion.
- imJ : R
Second imaginary part (j) of a quaternion.
- imK : R
Third imaginary part (k) of a quaternion.
Instances For
The equivalence between a quaternion algebra over R
and R × R × R × R
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The equivalence between a quaternion algebra over R
and Fin 4 → R
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
The imaginary part of a quaternion.
Equations
- x.im = { re := 0, imI := x.imI, imJ := x.imJ, imK := x.imK }
Instances For
Coercion R → ℍ[R,c₁,c₂]
.
Equations
- ↑x = { re := x, imI := 0, imJ := 0, imK := 0 }
Instances For
Equations
- QuaternionAlgebra.instCoeTC = { coe := QuaternionAlgebra.coe }
Equations
- QuaternionAlgebra.instZero = { zero := { re := 0, imI := 0, imJ := 0, imK := 0 } }
Equations
- QuaternionAlgebra.instInhabited = { default := 0 }
Equations
- QuaternionAlgebra.instOne = { one := { re := 1, imI := 0, imJ := 0, imK := 0 } }
Multiplication is given by
1 * x = x * 1 = x
;i * i = c₁
;j * j = c₂
;i * j = k
,j * i = -k
;k * k = -c₁ * c₂
;i * k = c₁ * j
,k * i = -c₁ * j
;j * k = -c₂ * i
,k * j = c₂ * i
.
Equations
- One or more equations did not get rendered due to their size.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- QuaternionAlgebra.instAddCommGroup = Function.Injective.addCommGroup ⇑(QuaternionAlgebra.equivProd c₁ c₂) ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
Equations
- QuaternionAlgebra.instAddCommGroupWithOne = AddCommGroupWithOne.mk ⋯ ⋯ ⋯ ⋯
Alias of QuaternionAlgebra.natCast_re
.
Alias of QuaternionAlgebra.natCast_imI
.
Alias of QuaternionAlgebra.natCast_imJ
.
Alias of QuaternionAlgebra.natCast_imK
.
Alias of QuaternionAlgebra.natCast_im
.
Alias of QuaternionAlgebra.coe_natCast
.
Alias of QuaternionAlgebra.intCast_re
.
Alias of QuaternionAlgebra.intCast_imI
.
Alias of QuaternionAlgebra.intCast_imJ
.
Alias of QuaternionAlgebra.intCast_imK
.
Alias of QuaternionAlgebra.intCast_im
.
Alias of QuaternionAlgebra.coe_intCast
.
Equations
- QuaternionAlgebra.instAlgebra = Algebra.mk { toFun := fun (s : S) => ↑((algebraMap S R) s), map_one' := ⋯, map_mul' := ⋯, map_zero' := ⋯, map_add' := ⋯ } ⋯ ⋯
Equations
- ⋯ = ⋯
QuaternionAlgebra.re
as a LinearMap
Equations
- QuaternionAlgebra.reₗ c₁ c₂ = { toFun := Quaternion.re, map_add' := ⋯, map_smul' := ⋯ }
Instances For
QuaternionAlgebra.imI
as a LinearMap
Equations
- QuaternionAlgebra.imIₗ c₁ c₂ = { toFun := Quaternion.imI, map_add' := ⋯, map_smul' := ⋯ }
Instances For
QuaternionAlgebra.imJ
as a LinearMap
Equations
- QuaternionAlgebra.imJₗ c₁ c₂ = { toFun := Quaternion.imJ, map_add' := ⋯, map_smul' := ⋯ }
Instances For
QuaternionAlgebra.imK
as a LinearMap
Equations
- QuaternionAlgebra.imKₗ c₁ c₂ = { toFun := Quaternion.imK, map_add' := ⋯, map_smul' := ⋯ }
Instances For
QuaternionAlgebra.equivTuple
as a linear equivalence.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ℍ[R, c₁, c₂]
has a basis over R
given by 1
, i
, j
, and k
.
Equations
Instances For
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
There is a natural equivalence when swapping the coefficients of a quaternion algebra.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Quaternion conjugate.
Equations
- QuaternionAlgebra.instStarQuaternionAlgebra = { star := fun (a : QuaternionAlgebra R c₁ c₂) => { re := a.re, imI := -a.imI, imJ := -a.imJ, imK := -a.imK } }
Equations
- QuaternionAlgebra.instStarRing = StarRing.mk ⋯
Equations
- ⋯ = ⋯
Quaternion conjugate as an AlgEquiv
to the opposite ring.
Equations
Instances For
Space of quaternions over a type. Implemented as a structure with four fields:
re
, im_i
, im_j
, and im_k
.
Equations
- Quaternion R = QuaternionAlgebra R (-1) (-1)
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
The equivalence between the quaternions over R
and R × R × R × R
.
Equations
- Quaternion.equivProd R = QuaternionAlgebra.equivProd (-1) (-1)
Instances For
The equivalence between the quaternions over R
and Fin 4 → R
.
Equations
- Quaternion.equivTuple R = QuaternionAlgebra.equivTuple (-1) (-1)
Instances For
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- Quaternion.instCoeTC = { coe := Quaternion.coe }
Equations
- Quaternion.instRing = QuaternionAlgebra.instRing
Equations
- Quaternion.instInhabited = inferInstanceAs (Inhabited (QuaternionAlgebra R (-1) (-1)))
Equations
- Quaternion.instSMul = inferInstanceAs (SMul S (QuaternionAlgebra R (-1) (-1)))
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- Quaternion.algebra = inferInstanceAs (Algebra S (QuaternionAlgebra R (-1) (-1)))
Equations
- Quaternion.instStar = QuaternionAlgebra.instStarQuaternionAlgebra
Equations
- Quaternion.instStarRing = QuaternionAlgebra.instStarRing
Equations
- ⋯ = ⋯
Alias of Quaternion.natCast_re
.
Alias of Quaternion.natCast_imI
.
Alias of Quaternion.natCast_imJ
.
Alias of Quaternion.natCast_imK
.
Alias of Quaternion.natCast_im
.
Alias of Quaternion.coe_natCast
.
Alias of Quaternion.intCast_re
.
Alias of Quaternion.intCast_imI
.
Alias of Quaternion.intCast_imJ
.
Alias of Quaternion.intCast_imK
.
Alias of Quaternion.intCast_im
.
Alias of Quaternion.coe_intCast
.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Square of the norm.
Equations
- Quaternion.normSq = { toFun := fun (a : Quaternion R) => (a * star a).re, map_zero' := ⋯, map_one' := ⋯, map_mul' := ⋯ }
Instances For
Alias of Quaternion.normSq_natCast
.
Alias of Quaternion.normSq_intCast
.
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- ⋯ = ⋯
Equations
- Quaternion.instInv = { inv := fun (a : Quaternion R) => (Quaternion.normSq a)⁻¹ • star a }
Equations
- Quaternion.instGroupWithZero = GroupWithZero.mk ⋯ zpowRec ⋯ ⋯ ⋯ ⋯ ⋯
Alias of Quaternion.ratCast_imI
.
Alias of Quaternion.ratCast_imJ
.
Alias of Quaternion.ratCast_imK
.
Alias of Quaternion.coe_ratCast
.
Equations
- Quaternion.instDivisionRing = DivisionRing.mk ⋯ GroupWithZero.zpow ⋯ ⋯ ⋯ ⋯ ⋯ ⋯ (fun (x1 : ℚ≥0) (x2 : Quaternion R) => x1 • x2) ⋯ ⋯ (fun (x1 : ℚ) (x2 : Quaternion R) => x1 • x2) ⋯
Alias of Quaternion.normSq_ratCast
.
The cardinality of a quaternion algebra, as a type.
The cardinality of a quaternion algebra, as a set.
Show the quaternion ⟨w, x, y, z⟩ as a string "{ re := w, imI := x, imJ := y, imK := z }".
For the typical case of quaternions over ℝ, each component will show as a Cauchy sequence due to the way Real numbers are represented.
Equations
- One or more equations did not get rendered due to their size.
The cardinality of the quaternions, as a type.
The cardinality of the quaternions, as a set.