-
-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests to see if ideal in quaternion algebra is primitive (cyclic) #37112
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5fdefe0
add Quaternion Book to Reference
giacomoborin b3ca9d9
Add primitive decomposition and integrality check
giacomoborin e609e0b
Error in comments
giacomoborin 4312c4b
format correction
giacomoborin eecb0be
Merge branch 'develop' into develop
giacomoborin f012259
Inserting reviews
giacomoborin acdb7cc
removed block_matrix import
giacomoborin 09d352e
fix doc syntax in quaternion_algebra.py
fchapoton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -56,7 +56,7 @@ | |||||||||||||
from sage.structure.category_object import normalize_names | ||||||||||||||
from sage.structure.parent import Parent | ||||||||||||||
from sage.matrix.matrix_space import MatrixSpace | ||||||||||||||
from sage.matrix.constructor import diagonal_matrix, matrix | ||||||||||||||
from sage.matrix.constructor import diagonal_matrix, matrix, block_matrix | ||||||||||||||
from sage.structure.sequence import Sequence | ||||||||||||||
from sage.structure.element import is_RingElement | ||||||||||||||
from sage.structure.factory import UniqueFactory | ||||||||||||||
|
@@ -3059,6 +3059,114 @@ | |||||||||||||
ans.append(J) | ||||||||||||||
return ans | ||||||||||||||
|
||||||||||||||
def is_integral(self): | ||||||||||||||
r""" | ||||||||||||||
Check if a quaternion fractional ideal is integral. An ideal in a quaternion algebra is | ||||||||||||||
said integral if it is contained in its left order. If the left order is already defined it just | ||||||||||||||
check the definition, otherwise it uses one of the alternative definition of Lemma 16.2.8 of | ||||||||||||||
[Voi2021]_. | ||||||||||||||
|
||||||||||||||
OUTPUT: a boolean. | ||||||||||||||
|
||||||||||||||
EXAMPLES:: | ||||||||||||||
|
||||||||||||||
sage: R.<i,j,k> = QuaternionAlgebra(QQ, -1,-11) | ||||||||||||||
sage: I = R.ideal([2 + 2*j + 140*k, 2*i + 4*j + 150*k, 8*j + 104*k, 152*k]) | ||||||||||||||
sage: I.is_integral() | ||||||||||||||
True | ||||||||||||||
sage: O = I.left_order() | ||||||||||||||
sage: I.is_integral() | ||||||||||||||
True | ||||||||||||||
sage: I = R.ideal([1/2 + 2*j + 140*k, 2*i + 4*j + 150*k, 8*j + 104*k, 152*k]) | ||||||||||||||
sage: I.is_integral() | ||||||||||||||
False | ||||||||||||||
|
||||||||||||||
""" | ||||||||||||||
if self.__left_order is not None: | ||||||||||||||
return self.free_module() <= self.left_order().free_module() | ||||||||||||||
elif self.__right_order is not None: | ||||||||||||||
return self.free_module() <= self.right_order().free_module() | ||||||||||||||
else: | ||||||||||||||
self_square = self**2 | ||||||||||||||
return self_square.free_module() <= self.free_module() | ||||||||||||||
|
||||||||||||||
def primitive_decomposition(self): | ||||||||||||||
r""" | ||||||||||||||
Let `I` = ``self``. If `I` is an integral left `\mathcal{O}`-ideal return its decomposition | ||||||||||||||
as an equivalent primitive ideal and an integer such that their product is the initial ideal. | ||||||||||||||
|
||||||||||||||
OUTPUTS: and quivalent primitive ideal to `I`, i.e. equivalent ideal not contained in `n\mathcal{O}` for any `n>0`, and the smallest integer such that `I \subset g\mathcal{O}`. | ||||||||||||||
|
||||||||||||||
EXAMPLES:: | ||||||||||||||
|
||||||||||||||
sage: A.<i,j,k> = QuaternionAlgebra(QQ, -1,-11) | ||||||||||||||
sage: I = A.ideal([1/2 + 1/2*i + 1/2*j + 3/2*k, i + k, j + k, 2*k]) | ||||||||||||||
sage: I.primitive_decomposition() | ||||||||||||||
(Fractional ideal (1/2 + 1/2*i + 1/2*j + 3/2*k, i + k, j + k, 2*k), 1) | ||||||||||||||
sage: J = A.ideal([7/2 + 7/2*i + 49/2*j + 91/2*k, 7*i + 21*k, 35*j + 35*k, 70*k]) | ||||||||||||||
sage: Jequiv, g = J.primitive_decomposition() | ||||||||||||||
sage: Jequiv*g == J | ||||||||||||||
True | ||||||||||||||
sage: Jequiv, g | ||||||||||||||
(Fractional ideal (1/2 + 1/2*i + 7/2*j + 13/2*k, i + 3*k, 5*j + 5*k, 10*k), 7) | ||||||||||||||
|
||||||||||||||
TESTS:: | ||||||||||||||
|
||||||||||||||
Checks on random crafted ideals that they decompose as expected. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more linter failure:
Suggested change
(The |
||||||||||||||
|
||||||||||||||
sage: for d in ( m for m in range(400, 750) if is_squarefree(m) ): | ||||||||||||||
....: A = QuaternionAlgebra(d) | ||||||||||||||
....: O = A.maximal_order() | ||||||||||||||
....: for _ in range(10): | ||||||||||||||
....: a = O.random_element() | ||||||||||||||
....: if not a.is_constant(): # avoids a = 0 | ||||||||||||||
....: I = a*O + a.reduced_norm()*O | ||||||||||||||
....: if I.is_integral(): | ||||||||||||||
....: J,g = I.primitive_decomposition() | ||||||||||||||
....: assert J*g == I | ||||||||||||||
....: assert J.is_primitive() | ||||||||||||||
|
||||||||||||||
""" | ||||||||||||||
|
||||||||||||||
if not self.is_integral(): | ||||||||||||||
raise ValueError("primitive ideals are defined only for integral ideals") | ||||||||||||||
|
||||||||||||||
I_basis = self.basis_matrix() | ||||||||||||||
O_basis = self.left_order().basis_matrix() | ||||||||||||||
|
||||||||||||||
# Write I in the basis of its left order via rref | ||||||||||||||
M = O_basis.solve_left(I_basis) | ||||||||||||||
g = Integer(gcd(M.list())) | ||||||||||||||
|
||||||||||||||
# If g is 1 then the ideal is primitive | ||||||||||||||
if g.is_one(): | ||||||||||||||
return self, g | ||||||||||||||
|
||||||||||||||
J = self.scale(1/g) | ||||||||||||||
|
||||||||||||||
return J, g | ||||||||||||||
|
||||||||||||||
def is_primitive(self): | ||||||||||||||
r""" | ||||||||||||||
Check if the quaternion fractional ideal is primitive. An integral left | ||||||||||||||
$O$-ideal for some order $O$ is said primitive if for all integers $n > 1$ | ||||||||||||||
$I$ is not contained in $nO$. | ||||||||||||||
|
||||||||||||||
OUTPUT: a boolean. | ||||||||||||||
|
||||||||||||||
EXAMPLES:: | ||||||||||||||
|
||||||||||||||
sage: A.<i,j,k> = QuaternionAlgebra(QQ, -1,-11) | ||||||||||||||
sage: I = A.ideal([1/2 + 1/2*i + 1/2*j + 3/2*k, i + k, j + k, 2*k]) | ||||||||||||||
sage: I.is_primitive() | ||||||||||||||
True | ||||||||||||||
sage: (2*I).is_primitive() | ||||||||||||||
False | ||||||||||||||
|
||||||||||||||
""" | ||||||||||||||
_,g = self.primitive_decomposition() | ||||||||||||||
return g.is_one() | ||||||||||||||
|
||||||||||||||
####################################################################### | ||||||||||||||
# Some utility functions that are needed here and are too | ||||||||||||||
# specialized to go elsewhere. | ||||||||||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import of
block_matrix
is now unused and can be removed.