Opened 5 years ago

Closed 4 years ago

# S_hilbert_symbol() helper function to find integer with negative Hilbert symbol for primes in a set S

Reported by: Owned by: Anna Haensch minor sage-8.8 basic arithmetic sd90 Manami Roy, Sandi Rudzinski, Juanita Duque Simon Brandhorst, Anna Haensch, Manami Roy, Juanita Duque, Sandi Rudzinski Simon Brandhorst, Anna Haensch N/A bca5e62 bca5e62b90d0e84b086b412cd6cabe4a244038ca #25023,#25029

This is an implementation of algorithm 3.4.1 from Markus Kirschmer's "Definite quadratic and hermitian forms with small class number." Given a non-square 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.

### comment:1 Changed 5 years ago by Anna Haensch

Description: modified (diff) _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 Anna Haensch

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 Anna Haensch

Commit: → ec55c0d42702b1bf86f12e9e0cdb13f3c76949d2 new → needs_review

New commits:

 ​ec55c0d `Adds function S_hilbert_symbol`
Version 0, edited 5 years ago by Anna Haensch (next)

### comment:5 Changed 5 years ago by Anna Haensch

Cc: Manami Roy Sandi Rudzinski Juanita Duque added; manami.roy.90@… sbrudzin@… jduque@… removed

### comment:6 Changed 5 years ago by Anna Haensch

Component: quadratic forms → basic arithmetic

### comment:7 Changed 5 years ago by Anna Haensch

Keywords: sd90 added; #sd90 removed 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 Simon Brandhorst

Description: modified (diff) → Simon Brandhorst

### comment:9 Changed 5 years ago by Simon Brandhorst

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
```

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 Simon Brandhorst

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 Simon Brandhorst

Status: needs_review → needs_work

### comment:12 Changed 5 years ago by Simon Brandhorst

Dependencies: → #25023

### comment:13 Changed 5 years ago by Simon Brandhorst

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 follow-up:  18 Changed 5 years ago by Simon Brandhorst

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 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 Simon Brandhorst

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 git

Commit: ec55c0d42702b1bf86f12e9e0cdb13f3c76949d2 → 61faa15afef6589f0a8131cbf593c0078f89ce9f

Branch pushed to git repo; I updated commit sha1. New commits:

 ​61faa15 `Clean up`

### comment:17 Changed 5 years ago by Simon Brandhorst

Authors: Anna Haensch, Manami Roy, Juanita Duque, Sandi Rudzinski → Simon Brandhorst, Anna Haensch, Manami Roy, Juanita Duque, Sandi Rudzinski

### comment:18 in reply to:  14 Changed 5 years ago by Anna Haensch

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 `QQ`.

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 Simon Brandhorst

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 S-rings 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 argument `b`?
• `hilbert_conductor_inverse_S`?

ooops I have the numberfield version ready as well

### comment:20 Changed 5 years ago by Anna Haensch

How about `hilbert_symbol_positive_at_S`?

### comment:21 follow-up:  22 Changed 5 years ago by Simon Brandhorst

i could settle for hilbert_symbol_negative_at_S

:)

### comment:22 in reply to:  21 Changed 5 years ago by Anna Haensch

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 Simon Brandhorst

Dependencies: #25023 → #25023,#25029

### comment:24 Changed 5 years ago by git

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 5 years ago by Simon Brandhorst

Would you review the number field version? Else we can split it off to another ticket.

### comment:26 Changed 4 years ago by Anna Haensch

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 git

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:28 Changed 4 years ago by Simon Brandhorst

should be okay now.

### comment:29 Changed 4 years ago by git

Commit: 1fbeefce060bfcffd765b4b0827a7e6a85339eec → 1a6e6da35a2950911847943dbb1f6e9e513c2574

Branch pushed to git repo; I updated commit sha1. New commits:

 ​1a6e6da `removed unnecessary import`

### comment:30 follow-up:  31 Changed 4 years ago by Simon Brandhorst

We have a green bot. Tests pass.

### comment:31 in reply to:  30 Changed 4 years ago by Anna Haensch

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 Anna Haensch

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 Anna Haensch

Commit: 1a6e6da35a2950911847943dbb1f6e9e513c2574 → bca5e62b90d0e84b086b412cd6cabe4a244038ca

I fixed a few errors that I spotted in the reference manual build, everything else looks good. What do you think?

New commits:

 ​6b72793 `fixed errors in reference build` ​ca2db75 `fixed typo in documentation and code commenting` ​bca5e62 ` fixed typo again`

### comment:34 Changed 4 years ago by Simon Brandhorst

Add your name as a reviewer, then we can set positive review.

### comment:35 Changed 4 years ago by Anna Haensch

Reviewers: Simon Brandhorst → Simon Brandhorst, Anna Haensch needs_review → positive_review

### comment:36 Changed 4 years ago by Frédéric Chapoton

Milestone: sage-8.1 → sage-8.8

### comment:37 Changed 4 years ago by Volker Braun

Branch: u/annahaensch/_s_hilbert_symbol___helper_function_to_find_integer_with_negative_hilbert_symbol_for_primes_in_at_set_s → bca5e62b90d0e84b086b412cd6cabe4a244038ca → fixed positive_review → closed
Note: See TracTickets for help on using tickets.