Repository: LMFDB/lmfdb

Issue:
Add search option for elliptic curves with potentially good reduction everywhere
It would be nice to have a search option for elliptic curves over number fields (including Q) that have potentially good reduction everywhere (equivalently, integral j-invariants).  The easiest way to accomplish this would be to add a boolean flag which could easily be populated using the local data we already store that includes the valuation of the denominator of the j-invariant.

One could also ask for the same thing for genus 2 curves over Q and/or their Jacobians.


Discussion:
I have already added this to my ecnf data upload script and so it will be there as soon as I have uploaded the data for issue #3900. I have called the new column 'potgr', so if you want to be called something else, say so now!

Doing this or EC/Q is separate.  A script to do this would be trivial to write, after adding a column called 'potgr' of type boolean, fill it like using this hint:

sage: c = db.ec_curves.lucky()
sage: all([ld['ord_den_j']==0 for ld in c['local_data']])
False

It took me about 15 seconds to figure out what `potgr` stood for; maybe `pot_good` would be clearer and not too long?  Or we could go all the way to `potentially_good_reduction`.
We no longer pay for long field names, thus I would go for `potentially_good_reduction`
> We no longer pay for long field names, thus I would go for `potentially_good_reduction`

Done (in my scripts, no new columns yet).  I'll use the same approach for the other new columns, e.g. instead of "ss" I'll have "supersingular" and so on.
I suggest implementing this now, as well as #1483 (search by size of isogeny class) and maybe more.  The relevant new columns for possible new search options are:
    - semistable (boolean)
    - potential_good_reduction (boolean) 
    - class_size (int)
    - sha (int) (analytic sha, exists for most curves)
    - analytic_rank (int) (exists for most curves)


I had forgotten this in my new ECQ schema, so I am adding it now and then I'll add the search option to the relevant branch.
This is already available over Q, and the ec_nfcurves tables has a column 'potential_good_reduction', so I'll implement the option for ECNF too now.

Resolving patch:
diff --git a/lmfdb/ecnf/main.py b/lmfdb/ecnf/main.py
--- a/lmfdb/ecnf/main.py
+++ b/lmfdb/ecnf/main.py
@@ -16,8 +16,8 @@
 from lmfdb.utils import (
     to_dict, flash_error,
     parse_ints, parse_noop, nf_string_to_label, parse_element_of,
-    parse_nf_string, parse_nf_elt, parse_bracketed_posints,
-    SearchArray, TextBox, ExcludeOnlyBox, SelectBox, CountBox,
+    parse_nf_string, parse_nf_elt, parse_bracketed_posints, parse_bool, parse_floats,
+    SearchArray, TextBox, ExcludeOnlyBox, SelectBox, CountBox, YesNoBox,
     search_wrap, parse_rational,
     redirect_no_cache
     )
@@ -496,6 +496,12 @@ def elliptic_curve_search(info, query):
             t_o *= int(n)
         query['torsion_order'] = t_o
     parse_element_of(info,query,'isodeg',split_interval=1000,contained_in=ECNF_stats().isogeny_degrees)
+    parse_bool(info,query,'semistable','semistable')
+    parse_bool(info,query,'potential_good_reduction','potential_good_reduction')
+    parse_ints(info,query,'class_size','class_size')
+    parse_ints(info,query,'class_deg','class_deg')
+    parse_ints(info,query,'sha','analytic order of &#1064;')
+    parse_floats(info,query,'reg','regulator')
 
     if 'jinv' in info:
         if info.get('field','').strip() == '2.2.5.1':
@@ -734,7 +740,8 @@ def __init__(self):
             name="one",
             label="Curves per isogeny class",
             knowl="ec.isogeny_class",
-            options=[("", ""),
+            example="all, one",
+            options=[("", "all"),
                      ("yes", "one")])
         include_cm = SelectBox(
             name="include_cm",
@@ -783,26 +790,61 @@ def __init__(self):
             label="Torsion structure",
             knowl="ec.torsion_subgroup",
             options=tor_opts)
+        sha = TextBox(
+            name="sha",
+            label="Analytic order* of &#1064;",
+            knowl="ec.analytic_sha_order",
+            example="4")
+        regulator = TextBox(
+            name="regulator",
+            label="Regulator*",
+            knowl="ec.regulator",
+            example="8.4-9.1")
         isodeg = TextBox(
             name="isodeg",
             label="Cyclic isogeny degree",
             knowl="ec.isogeny",
             example="16")
+        semistable = YesNoBox(
+            name="semistable",
+            label="Semistable",
+            example="Yes",
+            knowl="ec.semistable")
+        potential_good_reduction = YesNoBox(
+            name="potential_good_reduction",
+            label="Potential good reduction",
+            example="Yes",
+            knowl="ec.potential_good_reduction")
+        class_size = TextBox(
+            name="class_size",
+            label="Isogeny class size",
+            knowl="ec.isogeny",
+            example="4")
+        class_deg = TextBox(
+            name="class_deg",
+            label="Isogeny class degree",
+            knowl="ec.isogeny",
+            example="16")
         count = CountBox()
 
         self.browse_array = [
-            [jinv],
             [field, bf_deg],
             [conductor_norm, include_base_change],
             [rank, include_Q_curves],
             [torsion, torsion_structure],
             [cm_disc, include_cm],
+            [sha, regulator],
             [isodeg, one],
+            [class_size, class_deg],
+            [semistable, potential_good_reduction],
+            [jinv],
             [count]
             ]
 
         self.refine_array = [
-            [field, bf_deg, conductor_norm, jinv, include_base_change],
-            [include_Q_curves, isodeg, rank, torsion, torsion_structure],
-            [include_cm, cm_disc, one]
+            [field, bf_deg, conductor_norm, rank],
+            [regulator, sha, torsion, torsion_structure],
+            [one, isodeg, class_size, class_deg],
+            [include_cm, cm_disc, include_Q_curves, include_base_change],
+            [semistable, potential_good_reduction, jinv]
             ]


Test patch: