Quaternion algebras
We provide a model for quaternion algebras over a field $K$ in standard form, which is parametrized by two elements $a, b \in K$. The corresponding quaternion algebra has a basis $1, i, j, k$ satisfying $i^2 = a$, $j^2 = b$ and $ij = -ji = k$.
This functionality is currently restricted to fields of characteristic not equal to two.
Creation
quaternion_algebra — Method
quaternion_algebra(K::Field, a, b) -> QuaternionAlgebraIf the characteristic of K isn't 2, return the quaternion algebra $(a, b)_K$ defined by $i^2 = a$, $j^2 = b$, and $ij=-ji$.
If the characteristic of K is 2, return the quaternion algebra $[a,b)_K$ defined by $i^2+i=a$, $j^2=b$, and $ij=ji+j$.
Examples
julia> Q = quaternion_algebra(QQ, -1, -1)
Quaternion algebra
over rational field
defined by i^2 = -1, j^2 = -1, ij = -ji
julia> K, sqrt2 = quadratic_field(2);
julia> Q = quaternion_algebra(K, sqrt2, -1)
Quaternion algebra
over real quadratic field defined by x^2 - 2
defined by i^2 = sqrt(2), j^2 = -1, ij = -ji
julia> R, x = polynomial_ring(GF(2), "x"); F=fraction_field(R);
julia> Q = quaternion_algebra(F, 0, x)
Quaternion algebra
over fraction field of R
defined by i^2 = i+0, j^2 = x, ij = ji+jquaternion_algebra_ramified_at — Method
quaternion_algebra_ramified_at(K::QQField, p::IntegerUnion;
check::Bool = true)
-> QuaternionAlgebra{QQFieldElem}Return the quaternion algebra over $\mathbf{Q}$ that is ramified exactly at the prime $p$ and at infinity, presented as $(-p, -q)_{\mathbf{Q}}$, so $i^2 = -p$ and $j^2 = -q$, where $q$ is the least prime with $q \equiv 3 \bmod 8$ and $\left(\frac{p}{q}\right) = -1$.
The algebra carries the maximal order, which maximal_order returns,
\[\mathbf{Z} + \mathbf{Z}\frac{1 + j}{2} + \mathbf{Z}\frac{i(1 + j)}{2} + \mathbf{Z}\frac{(r + i)j}{q},\]
where $r$ is the square root of $-p$ modulo $q$ in $(0, q/2]$. Both $q$ and $r$ are determined by $p$, so the algebra and its maximal order are the same on every call.
If check is true, it is tested that $p$ is prime.
The presentation and the order are those of [Ibu82], Lemmas 1.1 and 1.2, with the least admissible $q$, which exists by Dirichlet's theorem.
Examples
julia> A = quaternion_algebra_ramified_at(QQ, 97)
Quaternion algebra
over rational field
defined by i^2 = -97, j^2 = -19, ij = -ji
julia> abs(discriminant(maximal_order(A))) == 97^2
trueArithmetic of elements
conj — Method
conj(a::AssociativeAlgebraElem{_, QuaternionAlgebra})
-> AssociativeAlgebraElem{_, QuaternionAlgebra}Return the image of $a$ under the canonical involution of the quaternion algebra.
Examples
julia> Q = quaternion_algebra(QQ, -1, -1); a = Q([1, 1, 1, 1])
1 + i + j + k
julia> conj(a)
1 - i - j - kreduced_charpoly — Method
reduced_charpoly(a::AbstractAssociativeAlgebraElem) -> PolyRingElemReturns the reduced characteristic polynomial of $a$ as a polynomial over base_ring(algebra(a)).
Example
julia> Q = quaternion_algebra(QQ, -1, -1)
Quaternion algebra
over rational field
defined by i^2 = -1, j^2 = -1, ij = -ji
julia> z = Q([1, 2, 0, 1//3])
1 + 2*i + 1//3*k
julia> trred(z)
2
julia> normred(z)
46//9
julia> reduced_charpoly(z)
x^2 - 2*x + 46//9
julia> m = reduced_charpoly(z)
x^2 - 2*x + 46//9
julia> m(z)
0Eichler orders
is_eichler — Method
is_eichler(O::Union{AlgAssAbsOrd, AlgAssRelOrd}) -> BoolReturn whether the order $O$ of a quaternion algebra is an Eichler order, that is, the intersection of two maximal orders.
eichler_level — Method
eichler_level(O::AlgAssAbsOrd{<:QuaternionAlgebra}) -> ZZRingElem
eichler_level(O::AlgAssRelOrd{<:Any, <:Any, <:QuaternionAlgebra})
-> AbsNumFieldOrderIdealReturn the level of the Eichler order $O$ of a quaternion algebra $A$ over $K$: the ideal $M$ of the ring of integers of $K$, coprime to the discriminant $D$ of $A$, with $\operatorname{discrd}(O) = DM$ [Voi21], 23.4.19. Over $\mathbf{Q}$ it is returned as a positive integer.
An ArgumentError is thrown if $O$ is not an Eichler order, see is_eichler.
Examples
The order of the matrices $\begin{pmatrix} a & b \\ 6c & d \end{pmatrix}$, with $a, b, c, d \in \mathbf{Z}$, in $M_2(\mathbf{Q}) \cong (1, 1)_{\mathbf{Q}}$, spanned by the matrix units $(1 \pm i)/2$, $(j + k)/2$ and $6$ times $(j - k)/2$:
julia> A = quaternion_algebra(QQ, 1, 1);
julia> e, i, j, k = basis(A);
julia> h = QQ(1, 2);
julia> O = order(A, [h * (e + i), h * (e - i), h * (j + k), 3 * (j - k)]);
julia> eichler_level(O)
6
julia> eichler_level(maximal_order(A))
1Right ideal classes and types
right_class_set — Method
right_class_set(O::Union{AlgAssAbsOrd, AlgAssRelOrd}) -> VectorReturn representatives of the classes of locally principal right ideals of the order $O$ of a quaternion algebra $A$ over $\mathbf{Q}$ or a number field. Two ideals $I$ and $J$ lie in the same class if $J = \alpha I$ for some $\alpha \in A^\times$.
The representatives are integral right ideals of $O$.
Examples
julia> O = maximal_order(quaternion_algebra_ramified_at(QQ, 97));
julia> C = right_class_set(O);
julia> length(C), all(I -> right_order(I) == O, C)
(8, true)
julia> length(right_class_set(maximal_order(quaternion_algebra(QQ, -1, 3))))
1type_set — Method
type_set(O::Union{AlgAssAbsOrd, AlgAssRelOrd}) -> VectorReturn representatives of the types of the order $O$ of a quaternion algebra $A$ over $\mathbf{Q}$ or a number field: one order for each isomorphism class of orders locally isomorphic to $O$.
If $A$ is not totally definite, $O$ must be an Eichler order.
Examples
julia> O = maximal_order(quaternion_algebra_ramified_at(QQ, 97));
julia> length(type_set(O)), length(right_class_set(O))
(5, 8)type_number — Method
type_number(O::Union{AlgAssAbsOrd, AlgAssRelOrd}) -> IntReturn the number of types of the order $O$, that is, the length of type_set.
Splitting of quaternion algebras
is_split_with_zero_divisor — Function
is_split_with_zero_divisor(A::QuaternionAlgebra) -> Bool, AssociativeAlgebraElemGiven a quaternion algebra $A$, return whether $A$ is split together with an element, which is a zero-divisor in case $A$ is split.
Examples
julia> A = quaternion_algebra(QQ, 1, 4);
julia> is_split_with_zero_divisor(A)
(true, 1 + i)
julia> A = quaternion_algebra(QQ, -1, -1);
julia> is_split_with_zero_divisor(A)
(false, 0)Gross lattices
gross_lattice — Method
gross_lattice(O::AlgAssAbsOrd{<:QuaternionAlgebra{QQFieldElem}}) -> ZZLatReturn the Gross lattice of an order $O$ of $B_p$, the quaternion algebra over $\mathbf{Q}$ ramified exactly at a prime $p$ and infinity: the image of $O$ under $x \mapsto 2x - \mathrm{trd}(x)$, which is the set of elements of reduced trace zero in $\mathbf{Z} + 2O$ [CG14, GL25]. It is a positive definite lattice of rank $3$, with the reduced norm as its quadratic form. The order need not be maximal; an ArgumentError is thrown if the algebra of $O$ is not of the form $B_p$.
It lies in the quadratic space on the coordinates with respect to basis(A) whose bilinear form is $(x, y) \mapsto \mathrm{trd}(x\bar{y})/2$, so that the norm of a vector is the reduced norm of the element and not twice it. Its basis consists of the coordinates of gross_lattice_basis and its Gram matrix is gross_gram_matrix of that basis.
For a maximal order of $B_p$, the determinant of the Gram matrix is $4p^2$ [CG14], and two maximal orders of $B_p$ are isomorphic if and only if their Gross lattices are isometric [GL25].
Examples
julia> A = quaternion_algebra(QQ, -1, -3);
julia> L = gross_lattice(maximal_order(A));
julia> rank(L), det(L)
(3, 36)gross_lattice_basis — Method
gross_lattice_basis(O::AlgAssAbsOrd{<:QuaternionAlgebra{QQFieldElem}})
-> Vector{AssociativeAlgebraElem{QQFieldElem}}Return a basis of the Gross lattice of an order $O$ of $B_p$, the elements of reduced trace zero in $\mathbf{Z} + 2O$, as three elements of the algebra of $O$; see gross_lattice.
Examples
julia> A = quaternion_algebra(QQ, -1, -3);
julia> B = gross_lattice_basis(maximal_order(A));
julia> length(B), all(iszero, trred.(B))
(3, true)gross_gram_matrix — Method
gross_gram_matrix(B::Vector{<:AssociativeAlgebraElem{QQFieldElem}})
-> ZZMatrixReturn the Gram matrix of the three elements in B, a basis of a Gross lattice of an order of $B_p$ (see gross_lattice), with respect to the bilinear form $(x, y) \mapsto \mathrm{trd}(x\bar{y})/2$: the reduced norms of the elements are on its diagonal. The matrix is integral for a basis of a Gross lattice; an ArgumentError is thrown otherwise.
Examples
julia> A = quaternion_algebra(QQ, -1, -3);
julia> B = gross_lattice_basis(maximal_order(A));
julia> G = gross_gram_matrix(B);
julia> det(G), [G[i, i] for i in 1:3] == normred.(B)
(36, true)Ideals connecting maximal orders
connecting_ideal — Method
connecting_ideal(O1::AlgAssAbsOrd{<:QuaternionAlgebra},
O2::AlgAssAbsOrd{<:QuaternionAlgebra}; check::Bool = true)
-> AlgAssAbsOrdIdl
connecting_ideal(O1::AlgAssRelOrd{<:Any, <:Any, <:QuaternionAlgebra},
O2::AlgAssRelOrd{<:Any, <:Any, <:QuaternionAlgebra};
check::Bool = true) -> AlgAssRelOrdIdlGiven maximal orders $O_1$ and $O_2$ of a quaternion algebra over $\mathbf{Q}$ or a number field, return the lattice $O_1 O_2$ spanned by the products $xy$ with $x \in O_1$ and $y \in O_2$. It is an invertible fractional ideal with left order $O_1$ and right order $O_2$ [Voi21], Lemma 17.4.7. As it contains $O_1$ and $O_2$, it is integral only if $O_1 = O_2$.
If check is true, an ArgumentError is thrown unless both orders are maximal.
Examples
julia> O = maximal_order(quaternion_algebra_ramified_at(QQ, 97));
julia> O1, O2 = left_order.(right_class_set(O)[1:2]);
julia> J = connecting_ideal(O1, O2);
julia> left_order(J) == O1, right_order(J) == O2
(true, true)least_norm_ideal — Method
least_norm_ideal(I::AlgAssAbsOrdIdl, O::AlgAssAbsOrd; side::Symbol = :right,
check::Bool = true) -> ZZRingElem, AlgAssAbsOrdIdlGiven an invertible fractional ideal $I$ with right order $O$ (side = :right) or left order $O$ (side = :left), in a definite quaternion algebra $A$ over $\mathbf{Q}$, return the least reduced norm $d$ of an integral ideal in the class of $I$, and one such ideal $J$. The class of $I$ consists of the ideals $\alpha I$ (side = :right) or $I \alpha$ (side = :left) with $\alpha \in A^\times$, as in right_class_set: the order $O$ of $J$ on that side is $O$ itself, while its order on the other side is a conjugate of the one of $I$. In particular, $d = 1$ if and only if $I$ is principal.
For side = :right, the integral ideals in the class of $I$ are the $\bar\gamma I / \operatorname{nrd}(I)$ with $0 \neq \gamma \in I$, of reduced norm $\operatorname{nrd}(\gamma)/\operatorname{nrd}(I)$ ([Voi21], proof of Proposition 17.5.6), and similarly for side = :left. So $d$ is the minimum of $\operatorname{nrd}/\operatorname{nrd}(I)$ on $I$, found by one shortest vector computation, and $J$ is the ideal of such a $\gamma$.
If check is true, an ArgumentError is thrown unless $I$ is invertible with the order $O$ on the given side.
Examples
julia> O = maximal_order(quaternion_algebra_ramified_at(QQ, 97));
julia> C = right_class_set(O);
julia> d, J = least_norm_ideal(C[2], O);
julia> d == normred(J, O), right_order(J) == O, is_subset(J, O)
(true, true, true)
julia> first(least_norm_ideal(3 * C[2], O)) == d
trueleast_connecting_norm — Method
least_connecting_norm(O1::AlgAssAbsOrd, O2::AlgAssAbsOrd;
check::Bool = true) -> ZZRingElem, AlgAssAbsOrdIdlGiven maximal orders $O_1$ and $O_2$ of a definite quaternion algebra $A$ over $\mathbf{Q}$, return the least reduced norm $d$ of an integral ideal with left order $O_1$ and right order conjugate to $O_2$, and one such ideal. So $O_1$ is fixed and $O_2$ is taken up to conjugacy: $d$ depends only on the types of $O_1$ and $O_2$ (see type_set), does not change when they are swapped, and is $1$ if and only if they are conjugate. When $A$ is ramified only at a prime $p$ and $\infty$, and $E_1$, $E_2$ are supersingular elliptic curves over $\overline{\mathbf{F}}_p$ with endomorphism rings $O_1$ and $O_2$, it is the least degree of an isogeny from $E_1$ to $E_2$ or to its Frobenius conjugate $E_2^{(p)}$ ([Voi21], Proposition 42.2.16 and Corollary 42.2.21; the ideals $J$ and $J P$ below). The curve $E_2^{(p)}$ also has endomorphism ring $O_2$, and is not isomorphic to $E_2$ unless $j(E_2) \in \mathbf{F}_p$ ([Voi21], Lemma 42.4.1), so $d$ need not be the least degree of an isogeny $E_1 \to E_2$: for $O_1 = O_2$ it is $1$, while in $B_{97}$ some $E_2 \to E_2^{(p)}$ have least degree $2$.
The ideals with left order $O_1$ and right order conjugate to $O_2$ lie in the left classes of $J P$, where $J$ is connecting_ideal(O1, O2) and $P$ runs over the products of the two-sided prime ideals of $O_2$ above distinct primes ramified in $A$ ([Voi21], Theorem 18.1.3 and Proposition 18.5.10). So $d$ is the least of the values of least_norm_ideal with side = :left on these $2^r$ ideals, where $r$ is the number of ramified primes.
If check is true, an ArgumentError is thrown unless both orders are maximal.
Examples
julia> O = maximal_order(quaternion_algebra_ramified_at(QQ, 97));
julia> Ts = type_set(O);
julia> [first(least_connecting_norm(Ts[1], T)) for T in Ts]
5-element Vector{ZZRingElem}:
1
2
2
4
3denominator — Method
denominator(R::AlgAssAbsOrd, O::AlgAssAbsOrd) -> ZZRingElemReturn the least positive integer $d$ with $dR \subseteq O$, for orders $R$ and $O$ of the same algebra.
Examples
julia> O = maximal_order(quaternion_algebra_ramified_at(QQ, 97));
julia> O1, O2 = left_order.(right_class_set(O)[1:2]);
julia> denominator(O1, O1), denominator(O2, O1), index(intersect(O1, O2), O1)
(1, 2, 2)