Skip to content
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

compute isomorphisms between quaternion orders #34976

Merged

Conversation

yyyyx4
Copy link
Member

@yyyyx4 yyyyx4 commented Feb 6, 2023

Fixes #34861.

@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2023

Codecov Report

Base: 88.57% // Head: 88.59% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (e265c3f) compared to base (52a81cb).
Patch coverage: 85.00% of modified lines in pull request are covered.

❗ Current head e265c3f differs from pull request most recent head 113d1bf. Consider uploading reports for the commit 113d1bf to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #34976      +/-   ##
===========================================
+ Coverage    88.57%   88.59%   +0.02%     
===========================================
  Files         2140     2136       -4     
  Lines       397273   396159    -1114     
===========================================
- Hits        351891   350991     -900     
+ Misses       45382    45168     -214     
Impacted Files Coverage Δ
src/sage/algebras/quatalg/quaternion_algebra.py 92.73% <85.00%> (+0.04%) ⬆️
src/sage/crypto/util.py 91.37% <0.00%> (-5.18%) ⬇️
...c/sage/schemes/elliptic_curves/ell_finite_field.py 87.57% <0.00%> (-1.27%) ⬇️
src/sage/cpython/_py2_random.py 75.20% <0.00%> (-1.24%) ⬇️
src/sage/categories/posets.py 98.76% <0.00%> (-1.24%) ⬇️
src/sage/combinat/matrices/hadamard_matrix.py 84.43% <0.00%> (-1.01%) ⬇️
src/sage/modular/modform/numerical.py 94.19% <0.00%> (-0.65%) ⬇️
src/sage/combinat/schubert_polynomial.py 91.66% <0.00%> (-0.65%) ⬇️
...sage/geometry/hyperbolic_space/hyperbolic_model.py 88.95% <0.00%> (-0.62%) ⬇️
src/sage/categories/weyl_groups.py 96.47% <0.00%> (-0.59%) ⬇️
... and 97 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@yyyyx4 yyyyx4 force-pushed the public/isomorphisms_between_quaternion_orders branch 2 times, most recently from e588905 to 296a27a Compare February 14, 2023 00:21
@yyyyx4 yyyyx4 force-pushed the public/isomorphisms_between_quaternion_orders branch from 296a27a to 113d1bf Compare February 25, 2023 02:56
@yyyyx4 yyyyx4 force-pushed the public/isomorphisms_between_quaternion_orders branch 2 times, most recently from f488bba to 99f34a2 Compare April 7, 2023 01:19
@yyyyx4 yyyyx4 force-pushed the public/isomorphisms_between_quaternion_orders branch from 99f34a2 to a987af5 Compare April 14, 2023 03:11
@yyyyx4 yyyyx4 force-pushed the public/isomorphisms_between_quaternion_orders branch from a987af5 to 7de1ed7 Compare May 24, 2023 05:08
@yyyyx4 yyyyx4 force-pushed the public/isomorphisms_between_quaternion_orders branch from 132c96e to 1e0a009 Compare August 21, 2023 20:51
@yyyyx4 yyyyx4 force-pushed the public/isomorphisms_between_quaternion_orders branch from 1e0a009 to 82b3395 Compare January 1, 2024 14:02
@yyyyx4 yyyyx4 force-pushed the public/isomorphisms_between_quaternion_orders branch from add56b4 to 4af1af5 Compare January 1, 2024 15:42
@GiacomoPope
Copy link
Contributor

Looking through this code, it seems to be a good addition, even if only working for maximal orders currently. I see other reviewers on the list but no comments. I personally think this should be included.

@S17A05
Copy link
Member

S17A05 commented Feb 2, 2024

I wanted to look through the code later today, unfortunately I couldn't find time for it earlier this week.

Copy link
Member

@S17A05 S17A05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. It's just two small things, otherwise it looks good to me.

Comment on lines +2125 to +2126
if not self.quadratic_form().is_positive_definite():
raise NotImplementedError('only implemented for definite quaternion orders')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it a bit more efficient to check whether the associated quaternion algebra is definite by checking the invariants as done in #37100? If so, I could put a dependency on that PR and update it accordingly after this PR is merged.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. In hindsight we should've probably just made one big pull request together, but alas that's not how things evolved...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we probably should have started directy from your code in #37100, but I'll fix that

@S17A05
Copy link
Member

S17A05 commented Feb 2, 2024

Just briefly resetting to "needs review" for the above two things.

@S17A05
Copy link
Member

S17A05 commented Feb 2, 2024

Also, while I don't think there should be any conflicts with the current version of develop, can you bring this branch up to date to make sure?

Copy link
Member

@S17A05 S17A05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now :)

@yyyyx4
Copy link
Member Author

yyyyx4 commented Feb 2, 2024

Thanks!

Copy link

github-actions bot commented Feb 2, 2024

Documentation preview for this PR (built with commit 134e16d; changes) is ready! 🎉

S17A05 added a commit to jtcc2/sage that referenced this pull request Feb 3, 2024
- Modified definiteness check in `.minimal_element()` and `.isomorphism_to`; also added check of the base field in the latter method
- Reduced search for a generator in `.is_principal()` to a call to `.minimal_element()`
S17A05 added a commit to jtcc2/sage that referenced this pull request Feb 3, 2024
- Modified definiteness check in `.minimal_element()` and `.isomorphism_to`; also added check of the base field in the latter method
- Reduced search for a generator in `.is_principal()` to a call to `.minimal_element()`
yyyyx4 pushed a commit to yyyyx4/sage that referenced this pull request Feb 5, 2024
- Modified definiteness check in `.minimal_element()` and `.isomorphism_to`; also added check of the base field in the latter method
- Reduced search for a generator in `.is_principal()` to a call to `.minimal_element()`
@jtcc2
Copy link
Contributor

jtcc2 commented Feb 7, 2024

I'm curious as to why in the random tests you ensure gcd(b.reduced_norm(), Quat.discriminant()) == 1 ?

For instance the following edge case doesn't work, which I would interpret as a bug.

p = 419
B.<i,j,k> = QuaternionAlgebra(p)
O = B.quaternion_order([1/2 + 3/2*j + k, 1/18*i + 25/9*j + 5/6*k, 3*j + 2*k, 3*k])
Oconj = j.inverse() * O * j
Oconj = B.quaternion_order(Oconj.basis())
O.isomorphism_to(Oconj)

It gives a ValueError: quaternion orders not isomorphic, when they are isomorphic.

And a small suggestion is if the two input orders are not isomorphic, you could return the error faster if you did a theta series check on the ideal $I = N O_1 O_2$ - it is not principal if the norm form represents anything which is not a square. I imagine running I.minimal_element() immediately would be slower. (e.g. a bit like this is_equivalent test)

I.theta_series_vector(10) == vector([1, 2, 0, 0, 2, 0, 0, 0, 0, 2])

vbraun pushed a commit to vbraun/sage that referenced this pull request Feb 7, 2024
sagemathgh-34976: compute isomorphisms between quaternion orders
    
Fixes sagemath#34861.
    
URL: sagemath#34976
Reported by: Lorenz Panny
Reviewer(s): Lorenz Panny, Sebastian Spindler
@S17A05
Copy link
Member

S17A05 commented Feb 8, 2024

I'm curious as to why in the random tests you ensure gcd(b.reduced_norm(), Quat.discriminant()) == 1 ?

For instance the following edge case doesn't work, which I would interpret as a bug.

p = 419
B.<i,j,k> = QuaternionAlgebra(p)
O = B.quaternion_order([1/2 + 3/2*j + k, 1/18*i + 25/9*j + 5/6*k, 3*j + 2*k, 3*k])
Oconj = j.inverse() * O * j
Oconj = B.quaternion_order(Oconj.basis())
O.isomorphism_to(Oconj)

It gives a ValueError: quaternion orders not isomorphic, when they are isomorphic.

And a small suggestion is if the two input orders are not isomorphic, you could return the error faster if you did a theta series check on the ideal I=NO1O2 - it is not principal if the norm form represents anything which is not a square. I imagine running I.minimal_element() immediately would be slower. (e.g. a bit like this is_equivalent test)

I.theta_series_vector(10) == vector([1, 2, 0, 0, 2, 0, 0, 0, 0, 2])

You're right on that first point, I missed that in my review. The issue seems to be that the connecting ideal is only locally principal by the results in Voight, and one cannot get global principality from that if the norm of the conjugating element is divisible by a ramified prime of the algebra; I believe this comes down to the proofs of the statements (b) and (c) in Exercise 4 in Chapter 17 of Voight's book. So the orders are still isomorphic, but trying to find a global generator of the connecting ideal fails and the method gives the wrong result.

@S17A05
Copy link
Member

S17A05 commented Feb 10, 2024

I'm curious as to why in the random tests you ensure gcd(b.reduced_norm(), Quat.discriminant()) == 1 ?
For instance the following edge case doesn't work, which I would interpret as a bug.

p = 419
B.<i,j,k> = QuaternionAlgebra(p)
O = B.quaternion_order([1/2 + 3/2*j + k, 1/18*i + 25/9*j + 5/6*k, 3*j + 2*k, 3*k])
Oconj = j.inverse() * O * j
Oconj = B.quaternion_order(Oconj.basis())
O.isomorphism_to(Oconj)

It gives a ValueError: quaternion orders not isomorphic, when they are isomorphic.
And a small suggestion is if the two input orders are not isomorphic, you could return the error faster if you did a theta series check on the ideal I=NO1O2 - it is not principal if the norm form represents anything which is not a square. I imagine running I.minimal_element() immediately would be slower. (e.g. a bit like this is_equivalent test)

I.theta_series_vector(10) == vector([1, 2, 0, 0, 2, 0, 0, 0, 0, 2])

You're right on that first point, I missed that in my review. The issue seems to be that the connecting ideal is only locally principal by the results in Voight, and one cannot get global principality from that if the norm of the conjugating element is divisible by a ramified prime of the algebra; I believe this comes down to the proofs of the statements (b) and (c) in Exercise 4 in Chapter 17 of Voight's book. So the orders are still isomorphic, but trying to find a global generator of the connecting ideal fails and the method gives the wrong result.

@yyyyx4 Unless there is an easy fix that I am missing, I figure it's best to make the error warning slightly more ambiguous for now, e.g. by letting the user know that the method is not able to detect whether the given orders are isomorphic, and to add this limitation to the docstring (maybe with the example that @jtcc2 gave above).

@vbraun vbraun merged commit 9d24006 into sagemath:develop Feb 13, 2024
21 of 22 checks passed
S17A05 added a commit to jtcc2/sage that referenced this pull request Feb 14, 2024
This is not a fix for the issue - it just adapts the error warning to be more ambiguous, as suggested in sagemath#34976 (comment)
S17A05 added a commit to jtcc2/sage that referenced this pull request Feb 14, 2024
This is not a fix for the issue - it just adapts the error warning to be more ambiguous, as suggested in sagemath#34976 (comment)
@yyyyx4 yyyyx4 deleted the public/isomorphisms_between_quaternion_orders branch February 25, 2024 12:08
@mkoeppe mkoeppe added this to the sage-10.3 milestone Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compute isomorphisms between quaternion orders
8 participants