From ff573dfa4b8e1fdf9b313232aeb3d3b83b01c7d3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 00:32:16 +0000 Subject: [PATCH 1/5] Initial plan From bf14fcddce42cba981cb1c8f0a6516d134bf9589 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 00:35:45 +0000 Subject: [PATCH 2/5] Add support for $mod operator in completeness checks Co-authored-by: edgarcosta <322822+edgarcosta@users.noreply.github.com> --- lmfdb/utils/completeness.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lmfdb/utils/completeness.py b/lmfdb/utils/completeness.py index 743362f5fa..1c0bc47e28 100644 --- a/lmfdb/utils/completeness.py +++ b/lmfdb/utils/completeness.py @@ -155,6 +155,11 @@ def to_rset(query): ans = ans.intersection(RealSet(*[RealSet.point(x) for x in val])) elif k == "$nin": ans = ans.intersection(RealSet(*[RealSet.point(x) for x in val]).complement()) + elif k == "$mod": + # $mod represents an arithmetic progression (e.g., multiples of n) + # which is unbounded, so we return the full real line + # This will cause completeness checks to fail, as expected + pass else: raise ValueError(f"Unsupported key {k}") return ans From be0114e01c52552de45f36b80d8a159367651e0f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 00:37:19 +0000 Subject: [PATCH 3/5] Add tests for $mod operator in completeness checks Co-authored-by: edgarcosta <322822+edgarcosta@users.noreply.github.com> --- lmfdb/tests/test_utils.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lmfdb/tests/test_utils.py b/lmfdb/tests/test_utils.py index 96eebd7444..cd33c53847 100644 --- a/lmfdb/tests/test_utils.py +++ b/lmfdb/tests/test_utils.py @@ -309,6 +309,27 @@ def test_integer_set(self): self.assertEqual((A + A).bound_under(X), 50000) self.assertEqual((A * B).bound_under(X), 1000) + def test_mod_operator(self): + """ + Test that $mod operator in queries is handled correctly + """ + from lmfdb.utils.completeness import to_rset, IntegerSet + from sage.all import RealSet, infinity + + # Test that $mod creates an unbounded set (full real line) + mod_query = {'$mod': [0, 7]} + rset = to_rset(mod_query) + self.assertEqual(str(rset), "(-oo, +oo)") + + # Test that IntegerSet can be created from $mod query without error + iset = IntegerSet(mod_query) + self.assertEqual(str(iset.rset), "(-oo, +oo)") + + # Test that unbounded set is not a subset of bounded set + bounded = IntegerSet([1, 500000]) + self.assertEqual(iset.is_subset(bounded), False) + self.assertEqual(bounded.is_subset(iset), True) + def test_complete(self): from lmfdb import db for tup in [ @@ -399,5 +420,8 @@ def test_complete(self): ("hgm_families", {'degree': 8}), ("gps_transitive", {'n': 32, 'solv': 1}), ("gps_st", {'rational': True, 'weight': 1, 'degree': 8}), + # Test $mod operator (multiples of n) - should be incomplete + ("ec_curvedata", {'conductor': {'$mod': [0, 7]}}), + ("mf_newforms", {'level': {'$mod': [0, 23]}}), ]: self.assertEqual(results_complete(tbl, query, db)[0], False) From 118198ae12ca5e34b05d49f0297fb63a31a5371e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 00:38:03 +0000 Subject: [PATCH 4/5] Remove unused imports from test Co-authored-by: edgarcosta <322822+edgarcosta@users.noreply.github.com> --- lmfdb/tests/test_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lmfdb/tests/test_utils.py b/lmfdb/tests/test_utils.py index cd33c53847..88d576b927 100644 --- a/lmfdb/tests/test_utils.py +++ b/lmfdb/tests/test_utils.py @@ -314,7 +314,6 @@ def test_mod_operator(self): Test that $mod operator in queries is handled correctly """ from lmfdb.utils.completeness import to_rset, IntegerSet - from sage.all import RealSet, infinity # Test that $mod creates an unbounded set (full real line) mod_query = {'$mod': [0, 7]} From 1a2a02823a346a8e824b1e0e5309861c4670d44f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 2 Feb 2026 00:41:19 +0000 Subject: [PATCH 5/5] Add clarifying comments about psycodict $mod format Co-authored-by: edgarcosta <322822+edgarcosta@users.noreply.github.com> --- lmfdb/tests/test_utils.py | 5 +++++ lmfdb/utils/completeness.py | 1 + 2 files changed, 6 insertions(+) diff --git a/lmfdb/tests/test_utils.py b/lmfdb/tests/test_utils.py index 88d576b927..9fdc279bef 100644 --- a/lmfdb/tests/test_utils.py +++ b/lmfdb/tests/test_utils.py @@ -312,10 +312,14 @@ def test_integer_set(self): def test_mod_operator(self): """ Test that $mod operator in queries is handled correctly + + Note: psycodict uses [remainder, divisor] format for $mod, so + {'$mod': [0, 7]} means "values where value % 7 == 0" (multiples of 7) """ from lmfdb.utils.completeness import to_rset, IntegerSet # Test that $mod creates an unbounded set (full real line) + # {'$mod': [0, 7]} means multiples of 7 in psycodict format mod_query = {'$mod': [0, 7]} rset = to_rset(mod_query) self.assertEqual(str(rset), "(-oo, +oo)") @@ -420,6 +424,7 @@ def test_complete(self): ("gps_transitive", {'n': 32, 'solv': 1}), ("gps_st", {'rational': True, 'weight': 1, 'degree': 8}), # Test $mod operator (multiples of n) - should be incomplete + # Note: psycodict format is [remainder, divisor], so [0, 7] means multiples of 7 ("ec_curvedata", {'conductor': {'$mod': [0, 7]}}), ("mf_newforms", {'level': {'$mod': [0, 23]}}), ]: diff --git a/lmfdb/utils/completeness.py b/lmfdb/utils/completeness.py index 1c0bc47e28..6a6b26409c 100644 --- a/lmfdb/utils/completeness.py +++ b/lmfdb/utils/completeness.py @@ -159,6 +159,7 @@ def to_rset(query): # $mod represents an arithmetic progression (e.g., multiples of n) # which is unbounded, so we return the full real line # This will cause completeness checks to fail, as expected + # Note: psycodict format is {'$mod': [remainder, divisor]} pass else: raise ValueError(f"Unsupported key {k}")