Opened 5 years ago
Closed 4 years ago
#24098 closed enhancement (fixed)
S_hilbert_symbol() helper function to find integer with negative Hilbert symbol for primes in a set S
Reported by:  Anna Haensch  Owned by:  

Priority:  minor  Milestone:  sage8.8 
Component:  basic arithmetic  Keywords:  sd90 
Cc:  Manami Roy, Sandi Rudzinski, Juanita Duque  Merged in:  
Authors:  Simon Brandhorst, Anna Haensch, Manami Roy, Juanita Duque, Sandi Rudzinski  Reviewers:  Simon Brandhorst, Anna Haensch 
Report Upstream:  N/A  Work issues:  
Branch:  bca5e62 (Commits, GitHub, GitLab)  Commit:  bca5e62b90d0e84b086b412cd6cabe4a244038ca 
Dependencies:  #25023,#25029  Stopgaps: 
Description (last modified by )
This is an implementation of algorithm 3.4.1 from Markus Kirschmer's "Definite quadratic and hermitian forms with small class number." Given a nonsquare b and a set of primes S, the function returns a number a which has negative Hilbert symbol with respect to b at precisely the primes in S.
This is a function in service to algorithm 3.4.3, quadratic_form_form_local_invariants()
, ticket #24108.
Change History (37)
comment:1 Changed 5 years ago by
Description:  modified (diff) 

Summary:  _S_hilbert_symbol() helper function to find integer with negative Hilbert symbol for primes in at set S → S_hilbert_symbol() helper function to find integer with negative Hilbert symbol for primes in at set S 
comment:2 Changed 5 years ago by
Branch:  → u/annahaensch/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s 

comment:3 Changed 5 years ago by
Commit:  → ec55c0d42702b1bf86f12e9e0cdb13f3c76949d2 

Status:  new → needs_review 
comment:4 Changed 5 years ago by
Cc:  manami.roy.90@… sbrudzin@… jduque@… added 

comment:5 Changed 5 years ago by
Cc:  Manami Roy Sandi Rudzinski Juanita Duque added; manami.roy.90@… sbrudzin@… jduque@… removed 

comment:6 Changed 5 years ago by
Component:  quadratic forms → basic arithmetic 

comment:7 Changed 5 years ago by
Keywords:  sd90 added; #sd90 removed 

Summary:  S_hilbert_symbol() helper function to find integer with negative Hilbert symbol for primes in at set S → S_hilbert_symbol() helper function to find integer with negative Hilbert symbol for primes in a set S 
comment:8 Changed 5 years ago by
Description:  modified (diff) 

Reviewers:  → Simon Brandhorst 
comment:9 Changed 5 years ago by
So here are some thoughts:
This is just a helper function so it should not pollute the global namespace.
Is there a reason that you have implemented Markus algorithm just for QQ
?
The beauty of Markus' work is that he did it directly for number fields.
It should not be too hard to do it for number fields.
All the necessary functions like class groups, ideals, hilbert symbols, places, are there:
sage: K.<a>=CyclotomicField(13) sage: P=K.primes_above(3)[0] sage: P Fractional ideal (3, a^3  a  1) sage: K.hilbert_symbol(3,1+a,P) 1
We can define the function as a method of the number field. Just like the hilbert_symbol. Maybe the name S_hilbert_symbol is misleading? I would expect it to be the global hilbert_symbol of the localization at S or something like that. This function seems more like an inverse image? maybe hilbert_symbol_inv_S?
Some remarks for formatting: Comments should be of the form (note the space)
# foo does bla foo = 3
See https://www.python.org/dev/peps/pep0008/#comments.
You are redefining V,W,vv in the while loop. But really they stay constant. So they should not sit in the loop.
Use the names of Markus if possible or more descriptive names. HH,PP etc. is not very descriptive. Same for i,j. I do not see the need to define H. Why hide everything in lists?
Either use the verbose things or remove them.
comment:10 Changed 5 years ago by
It is good to test the error messages. But they belong to the TESTS:: block not the EXAMPLES:: block. > they do not need to show up in the documentation.
comment:11 Changed 5 years ago by
Status:  needs_review → needs_work 

comment:12 Changed 5 years ago by
Dependencies:  → #25023 

comment:13 Changed 5 years ago by
Branch:  u/annahaensch/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s → u/sbrandhorst/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s 

comment:14 followup: 18 Changed 5 years ago by
Branch:  u/sbrandhorst/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s → u/annahaensch/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s 

Status:  needs_work → needs_review 
How about hilbert_conductor_inverse
as a name?
Problem is this exists and is (allmost) the same function.
Ideas? I would like to move it as a method of QQ
.
comment:15 Changed 5 years ago by
Branch:  u/annahaensch/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s → u/sbrandhorst/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s 

comment:16 Changed 5 years ago by
Commit:  ec55c0d42702b1bf86f12e9e0cdb13f3c76949d2 → 61faa15afef6589f0a8131cbf593c0078f89ce9f 

Branch pushed to git repo; I updated commit sha1. New commits:
61faa15  Clean up

comment:17 Changed 5 years ago by
Authors:  Anna Haensch, Manami Roy, Juanita Duque, Sandi Rudzinski → Simon Brandhorst, Anna Haensch, Manami Roy, Juanita Duque, Sandi Rudzinski 

comment:18 Changed 5 years ago by
Replying to sbrandhorst:
How about
hilbert_conductor_inverse
as a name?
I'm not sure about that name, it already exists and means something else. I am happy with S_hilbert_symbol since it's restricting the Hilbert symbol at a finite set of primes, it's pretty consistent with your initial interpretation in comment 9; a hilbert symbol taken at a finite number of localizations.
Problem is this exists and is (allmost) the same function. Ideas? I would like to move it as a method of
Eventually we can split this into two methods, one for QQ an one for number fields. I've got the general number fields method queued up and ready to go as soon as tickets #25023 and #25029 are positively reviewed.
comment:19 Changed 5 years ago by
Mhh I do not like the prefix S_. In methods like S_unit_group and S_class_group, the primes in S are inverted. But we are not inverting anything  we are working in fields anyways. So there is no relation to this kind of objects? Finally in these Srings one can define a hilbert symbol and we are not computing it.
For b
and S
given our function computes a
such that hilbert_conductor(a,b) = prod(S)
plus a condition at infinity. So I think that it is pretty close. And I like the idea that if you type
hilbert
+ autocompletion you get this method suggested.
So maybe
hilbert_something
hilbert_conductor_something
hilbert_conductor_inverse
with optional argumentb
?hilbert_conductor_inverse_S
?
ooops I have the numberfield version ready as well
comment:22 Changed 5 years ago by
Replying to sbrandhorst:
i could settle for hilbert_symbol_negative_at_S
:)
Ah, yes, even better. Let's go with that :)
comment:23 Changed 5 years ago by
Dependencies:  #25023 → #25023,#25029 

comment:24 Changed 5 years ago by
Commit:  61faa15afef6589f0a8131cbf593c0078f89ce9f → 707703320e734ba38a61a28cbc179b07f5165aa8 

Branch pushed to git repo; I updated commit sha1. New commits:
7077033  changed name to hilbert_symbol_negative_at_S

comment:25 Changed 4 years ago by
Would you review the number field version? Else we can split it off to another ticket.
comment:26 Changed 4 years ago by
This ticket has been asleep for awhile, but let's try and finish it. I just tried to run doctests on and got an error message
AttributeError: Values instance has no attribute 'gc'
Any ideas?
comment:27 Changed 4 years ago by
Commit:  707703320e734ba38a61a28cbc179b07f5165aa8 → 1fbeefce060bfcffd765b4b0827a7e6a85339eec 

Branch pushed to git repo; I updated commit sha1. New commits:
9e5a98f  Merge branch 'develop' into t/24098/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s

b7ca8fe  fixed doctests

1fbeefc  Merge branch 'develop' into t/24098/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s

comment:29 Changed 4 years ago by
Commit:  1fbeefce060bfcffd765b4b0827a7e6a85339eec → 1a6e6da35a2950911847943dbb1f6e9e513c2574 

Branch pushed to git repo; I updated commit sha1. New commits:
1a6e6da  removed unnecessary import

comment:31 Changed 4 years ago by
Replying to sbrandhorst:
We have a green bot. Tests pass.
All tests pass! I had just run them independently anyhow, but good to know :)
comment:32 Changed 4 years ago by
Branch:  u/sbrandhorst/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s → u/annahaensch/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s 

comment:33 Changed 4 years ago by
Commit:  1a6e6da35a2950911847943dbb1f6e9e513c2574 → bca5e62b90d0e84b086b412cd6cabe4a244038ca 

comment:35 Changed 4 years ago by
Reviewers:  Simon Brandhorst → Simon Brandhorst, Anna Haensch 

Status:  needs_review → positive_review 
comment:36 Changed 4 years ago by
Milestone:  sage8.1 → sage8.8 

comment:37 Changed 4 years ago by
Branch:  u/annahaensch/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s → bca5e62b90d0e84b086b412cd6cabe4a244038ca 

Resolution:  → fixed 
Status:  positive_review → closed 
New commits:
Adds function S_hilbert_symbol