# Isomorphisms

## Isomorphisms of Algebras

Two quaternion algebras $A, B$ over a common field $F$ are isomorphic algebras if and only if they share the same ramified places. Finding an explicit isomorphism is much harder. Currently Magma embeds the first standard generator of $A$ into $B$ and then finds another element perpendicular to that image having the correct minimal polynomial. In particular, this requires the construction of two points on a conic (or equivalently, the solution of two norm equations) over quadratic extensions of $F$.

### `IsIsomorphic(A, B): AlgQuat, AlgQuat -> BoolElt, Map`

```magma
Isomorphism: BoolElt                    Default: false
```

Given two quaternion algebras $A,B$ over ${\mathbb{Q}}$, ${\mathbb{F}}_q(X)$ with $q$ odd or a number field, this function returns `true` if and only if they are isomorphic.

If the algebras are isomorphic and `Isomorphism` is set to true, an isomorphism $A \to B$ is also returned.

## Isomorphisms of Orders

Two orders $S, T$ in a quaternion algebra $A$ are isomorphic if and only if they are conjugate in $A$.

In a definite algebra, we use the fact that this conjugation induces an isometry of the quadratic ${\mathbb{Z}}$- or ${\mathbb{F}}_q[X]$-modules $S$ and $T$ equipped with the (absolute) norm form. Over an indefinite algebra, we use the fact that any connecting ideal $I$ having left order $S$ and right order $T$ must be isomorphic to a right ideal of $T$. See [[Kirschmer and Voight, 2010](../../references.md#cite-kirschmer-voight)] for details.

### `IsIsomorphic(S, T): AlgQuatOrd, AlgQuatOrd -> BoolElt, Map, AlgQuatElt`

### `IsIsomorphic(S, T): AlgAssVOrd[RngOrd], AlgAssVOrd[RngOrd] -> BoolElt, Map, AlgQuatElt`

### `IsConjugate(S, T): AlgAssVOrd, AlgAssVOrd -> BoolElt, Map, AlgQuatElt`

```magma
FindElement    : BoolElt                          Default: false
ConnectingIdeal: AlgAssVOrdIdl                    Default: 
```

Given orders $S$ and $T$ in a quaternion algebra $A$ over ${\mathbb{Q}}$, ${\mathbb{F}}_q(X)$ (with $q$ odd) or a number field, this function returns `true` if and only if $S$ and $T$ are isomorphic.

For indefinite algebras, the orders are currently required to be maximal.

If `FindElement` is set, the second return value is an isomorphism from $S$ to $T$ and the third return value is an element $a$ with $T = a^{-1} S a$, inducing the isomorphism. For indefinite algebras, this search is expensive and may sometimes fail (as in `IsIsomorphic` for ideals, see below).

For indefinite algebras defined over number fields, part of the computation may be faster when a connecting ideal is specified using the parameter `ConnectingIdeal`; this should be an ideal with left order $S$ and right order $T$.

### `Isomorphism(S, T): AlgQuatOrd, AlgQuatOrd -> Map`

Given two isomorphic definite quaternion orders $S, T$ over ${\mathbb{Z}}$ or ${\mathbb{F}}_q[X]$ (with $q$ odd), this function returns an algebra isomorphism. For orders over number rings the intrinsic `IsIsomorphic` should be used with the optional argument `FindElement` set.

## Isomorphisms of Ideals

Two right (left) ideals $I, J$ of an order $O$ in a quaternion algebra $A$ are isomorphic $O$-modules if and only if $xI=J$ ($Ix=J$) for some $x \in A^*$.

To decide whether $I$ and $J$ are isomorphic, we test whether the *colon ideal* $(J:I) = \{x \in A: xI \subset J\}$ (similarly defined if $I, J$ are left ideals) is principal, or not.

Over ${\mathbb{Z}}$, to accomplish this task we compute a Minkowski-reduced Gram matrix of $(J:I)$ which produces an element of smallest norm. Over ${\mathbb{F}}_q[X]$ we compute a Gram matrix which has dominant diagonal form (see [[Gerstein, 2003](../../references.md#cite-forms-fqx)]) which also produces a suitable element. Over other number rings $R$, we search $(J:I)$ for an element of the required norm by computing a reduced basis. This method runs very quickly for “reasonably small” input. (See [[Dembele and Donnelly, 2008](../../references.md#cite-dembele-donnelly), [Kirschmer and Voight, 2010](../../references.md#cite-kirschmer-voight)] for further details.)

### `IsIsomorphic(I, J): AlgAssVOrdIdl, AlgAssVOrdIdl -> BoolElt, AlgAssVElt`

Given ideals $I$ and $J$ of the same order $O$ in a quaternion algebra $A$ over ${\mathbb{Q}}$, ${\mathbb{F}}_q(X)$ (with $q$ odd) or a number field, this function returns `true` if and only if the quaternion ideals $I$ and $J$ are isomorphic (left or right) $O$-ideals. If $I$ and $J$ are isomorphic, there exists some $x\in A$ such that $xI=J$ (in the case of right $O$-ideals) or $Ix=J$ (for left ideals). For definite algebras, such an element $x$ is always returned. For indefinite algebras over ${\mathbb{Z}}$ or a number ring, a search for such an element is made, and if one is found then it is returned.

### `IsPrincipal(I): AlgAssVOrdIdl -> BoolElt, AlgQuatElt`

Given a left (or right) ideal $I$ over ${\mathbb{Z}}, {\mathbb{F}}_q[X]$ or a number ring, this function returns `true` if and only if $I$ is a principal ideal; if so, a generator is returned as the second value.

### `IsLeftIsomorphic(I, J): AlgQuatOrdIdl, AlgQuatOrdIdl -> BoolElt, Map, AlgQuatElt`

### `IsRightIsomorphic(I, J): AlgQuatOrdIdl, AlgQuatOrdIdl -> BoolElt, Map, AlgQuatElt`

Given two definite ideals over ${\mathbb{Z}}$ or ${\mathbb{F}}_q[X]$ (with $q$ odd) with the same left (or right) order $S$, this function returns `true` if and only if they are isomorphic as $S$-modules. The isomorphism and the transforming scalar in the quaternion algebra are returned as second and third values if `true`.

### `IsLeftIsomorphic(I, J): AlgAssVOrdIdl[RngOrd], AlgAssVOrdIdl[RngOrd] -> BoolElt, AlgQuatElt`

### `IsRightIsomorphic(I, J): AlgAssVOrdIdl[RngOrd], AlgAssVOrdIdl[RngOrd] -> BoolElt, AlgQuatElt`

Given two left (or right) ideals $I$ and $J$ over a number ring, with the same left order $O$, this function returns `true` if and only if they are isomorphic as $O$-modules. The isomorphism is given by multiplication as a second return value.

### `LeftIsomorphism(I, J): AlgQuatOrdIdl, AlgQuatOrdIdl -> Map, AlgQuatElt`

Given two isomorphic left ideals over a definite order $S$ over ${\mathbb{Z}}$ or ${\mathbb{F}}_q[X]$, this function returns the $S$-module isomorphism between them, followed by the quaternion algebra element which defines the isomorphism by right-multiplication.

### `RightIsomorphism(I, J): AlgQuatOrdIdl, AlgQuatOrdIdl -> Map, AlgQuatElt`

Given two isomorphic right ideals over a definite order $S$ over ${\mathbb{Z}}$ or ${\mathbb{F}}_q[X]$, this function returns the $S$-module isomorphism between them, followed by the quaternion algebra element which defines the isomorphism by left-multiplication.

## Examples

### `Example: Isomorphism Algebras (ex-f5c0d5)`

In this example, we create two quaternion algebras over ${\mathbb{F}}_7$, show that they are isomorphic and find an isomorphism between them.

```magma
> F<x> := RationalFunctionField( GF(7) );
> Q1 := QuaternionAlgebra< F | (x^2+x-1)*(x+1), x >;
> a := x^3 + x^2 + 3;
> b := x^13 + 4*x^11 + 2*x^10 + x^9 + 6*x^8 + 4*x^5 + 3*x^4 + x;
> Q2:= QuaternionAlgebra< F | a, b >;
> ok, phi:= IsIsomorphic(Q1, Q2 : Isomorphism);
> ok;
true
> forall{ <x,y> : x,y in Basis(Q1) |  phi(x*y) eq phi(x)*phi(y) };
true

```

### `Example: Isomorphism Example (ex-50db58)`

In this example, we create two ideals, show that they have isomorphic right orders, and then explicitly exhibit the isomorphism.

```magma
> A := QuaternionAlgebra(37);
> S := MaximalOrder(A);
> ideals := LeftIdealClasses(S);
> _, I, J := Explode(ideals);
> R := RightOrder(I);
> Q := RightOrder(J);
> IsIsomorphic(R,Q);
true

```

Now we find an element $pi$ which conjugates R to Q, and then check that it has this property.

```magma
> _, pi := Isomorphism(R,Q);
> J := lideal< S | [ x*pi : x in Basis(J) ] >;
> RightOrder(J) eq R;
true

```

### `Example: Left Right Isomorphisms (ex-03d026)`

We construct two non-isomorphic left ideals with the same left and right orders, then investigate their isomorphisms as right ideals.

```magma
> S := QuaternionOrder(37);
> ideals := LeftIdealClasses(S);
> _, I, J := Explode(ideals);
> R := RightOrder(I);
> _, pi := Isomorphism(R,RightOrder(J));
> J := lideal< S | [ x*pi : x in Basis(J) ] >;
> IsLeftIsomorphic(I,J);
false
> IsRightIsomorphic(I,J);
true Mapping from: AlgQuatOrd: I to AlgQuatOrd: J given by a rule [no inverse]
1 + i - 2*k
> h, x := RightIsomorphism(I,J);
> y := [1,2,-1,3];
> y := &+[y[i]*b[i] : i in [1 .. 4]] where b is Basis(I);
> h(y);
[-73  15  31   4]
> x*y;
-73 + 15*i + 31*j + 4*k

```

The existence of an isomorphism as a right ideal is due to the fact that the two-sided ideals of $R$ do not have non-isomorphic counterparts in S.

```magma
> TwoSidedIdealClasses(R);
[ Ideal with basis Pseudo-matrix over Integer Ring
1 * [1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[0 0 0 1]
, Ideal with basis Pseudo-matrix over Integer Ring
1 * [37  0 32 18]
[ 0 37 10  2]
[ 0  0  1  0]
[ 0  0  0  1]
 ]
> TwoSidedIdealClasses(S);
[ Ideal with basis Pseudo-matrix over Integer Ring
1 * [1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[0 0 0 1]
 ]

```

Thus while `Conjugate(I)*J` is in the non-principal $R$-ideal class, the ideal `I*Conjugate(J)` represents the unique principal ideal class of $S$.

### `Example: Left Right Isomorphisms Number Field (ex-0c04cb)`

We exhibit isomorphism testing for ideals of orders over number rings.

```magma
> P<x> := PolynomialRing(Rationals());
> F<b> := NumberField(x^3-3*x-1);
> Z_F := MaximalOrder(F);
> F := FieldOfFractions(Z_F);
> A<alpha,beta,alphabeta> := QuaternionAlgebra<F | -3, b>;
> O := Order([alpha,beta,alphabeta]);
> O;
Order of Quaternion Algebra with base ring F
with coefficient ring Maximal Equation Order with defining polynomial x^3 - 3*x
    - 1 over its ground order
> I := ideal<O | 2>;
> I eq (I + ideal<O | 2>);
true
> I eq (I + ideal<O | 3>);
false
>
> Foo := InfinitePlaces(F);
> A := QuaternionAlgebra(ideal<Z_F | 2*3*5>, Foo);
> IsDefinite(A);
true
> O := MaximalOrder(A);
> I := rideal<O | Norm(O.2), O.2>;
> J := rideal<O | Norm(O.3), O.3>;
> IsIsomorphic(I, J);
true (F.2 + F.3) + (27/9190*F.1 - 143/9190*F.2 - 73/9190*F.3)*i +
(-251/27570*F.1 + 7/2757*F.2 + 10/2757*F.3)*k

```
