{ "format": "longsmall-complete-consolidated-v1", "category": "sources", "files": [ { "path": "anc/build.sh", "size_bytes": 673, "sha256": "76466c0f011c80bbf665be0a507392570b8e96b2b6016af00c7dba32a8680cce", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/sh\nset -eu\ncd \"$(dirname \"$0\")/..\"\nmkdir -p build\npdflatex -interaction=nonstopmode -halt-on-error -file-line-error -output-directory=build longsmall.tex\nbibtex build/longsmall\nrerun='Rerun (to|LaTeX)|Label\\(s\\) may have changed|There were undefined|undefined on input line'\nfor pass in 1 2 3 4 5; do\n pdflatex -interaction=nonstopmode -halt-on-error -file-line-error -output-directory=build longsmall.tex\n if ! grep -Eq \"$rerun\" build/longsmall.log; then\n break\n fi\ndone\nif grep -Eq \"$rerun\" build/longsmall.log; then\n echo 'LaTeX references or table widths did not stabilize; see build/longsmall.log.' >&2\n exit 1\nfi\ncp build/longsmall.pdf .\n" }, { "path": "anc/check_corrections.py", "size_bytes": 2554, "sha256": "9f049a72402845189e2e6ea053afbbee18e747d869b6c6df9490ec91d90d7baf", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Reproduce the targeted algebra checks for the 24 October 2026 corrections.\n\nRequires SymPy. This is not a rerun of the proof certificates: the final check\nreads the four characteristic polynomials from the recorded certificate output.\n\"\"\"\nfrom fractions import Fraction\nfrom pathlib import Path\n\nimport sympy as sp\n\n\ndef main():\n # Proposition D: the reviewer’s counterexample, using exact rationals.\n x, y = Fraction(3), Fraction(5)\n slope = 3 * x * x / (2 * y)\n gx = slope * slope - 2 * x\n gy = slope * (x - gx) - y\n assert (gx, gy) == (Fraction(129, 100), Fraction(-383, 1000))\n assert gy * gy == gx**3 - 2\n t = -gx / gy\n assert t.numerator % 5 == 0 and t.denominator % 5 != 0\n # Thus G=2P reduces to O at 5, whereas -G has finite x and -G+G=O.\n print('PASS: Proposition D counterexample and formal parameter at 5.')\n\n # Sections 3.1 and 3.10: unscaled coefficient conditions, in printed order.\n m, z = sp.symbols('m z')\n a = m**3 / 2\n b = (12 * m**2 * z - m**6) / 8\n pk = (m**27 - 480*m**19 - 1344*m**18 - 34560*m**11\n + 70656*m**10 - 40704*m**9 + 16384*m**3 - 12288*m - 4096)\n f = (m**27 + 480*m**19 - 2688*m**18 - 17280*m**15\n - 34560*m**11 - 141312*m**10 - 162816*m**9 + 165888*m**7\n + 221184*m**6 - 126976*m**3 + 49152*m - 32768)\n r1 = sp.resultant(2*a*b - (3*m*z**2 - m + 1), b**2 - (z**3-z), z)\n r2 = sp.resultant(2*a*b - (3*m*z**2 + m + 2), b**2 - (z**3+z-1), z)\n assert sp.expand(4096*r1 - pk) == 0\n assert sp.expand(4096*r2 - f) == 0\n print('PASS: both resultants equal the printed polynomial divided by 4096.')\n\n # Lemma 3.8.5: all nonleading coefficients are 2-adically even.\n recorded = Path(__file__).resolve().parent / 'code/1.1.8/expected/1.1.8f.txt'\n variable = sp.Symbol('x')\n count = 0\n for line in recorded.read_text(encoding='utf-8').splitlines():\n if line.strip().startswith(('charpoly t:', 'charpoly w:')):\n polynomial = sp.Poly(sp.sympify(line.split(': ', 1)[1].replace('^', '**')),\n variable)\n assert polynomial.degree() == 3 and polynomial.LC() == 1\n for coefficient in polynomial.all_coeffs()[1:]:\n numerator, denominator = coefficient.as_numer_denom()\n assert int(numerator) % 2 == 0 and int(denominator) % 2 == 1\n count += 1\n assert count == 4\n print('PASS: all four recorded characteristic polynomials reduce to T^3 modulo 2.')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/check_package.py", "size_bytes": 5228, "sha256": "ca0d7cc7a941bcb2df39263ff135e74bf8a1a8e98145457908ebddc3a4b62bd3", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Check package structure, references and hashes without running proofs.\"\"\"\nimport ast\nfrom collections import Counter\nimport hashlib\nfrom pathlib import Path\nimport re\n\nROOT = Path(__file__).resolve().parent\nARCHIVE_ROOT = ROOT.parent\n\n\ndef main():\n tex = (ARCHIVE_ROOT / 'longsmall.tex').read_text(encoding='utf-8')\n bib = (ARCHIVE_ROOT / 'references.bib').read_text(encoding='utf-8')\n body_marker = r'\\section{Shared tools and certificate lemmas}'\n intro = tex[:tex.index(body_marker)]\n cases = re.findall(r'\\\\begin\\{thm\\}\\\\label\\{thm:([^}]+)\\}', tex)\n assert len(cases) == len(set(cases)) == 38, 'Headline theorem count'\n assert Counter(c.rsplit('.', 1)[0] for c in cases) == {\n '1.1': 15, '1.2': 5, '1.3': 8, '1.4': 10\n }, 'Case-family counts'\n directories = {p.name for p in (ROOT / 'code').iterdir()\n if p.is_dir() and p.name != 'common'}\n assert directories == set(cases), 'Code directories do not match the paper'\n assert tex.count(r'\\begin{introthm}') == 8, 'Introduction theorem count'\n labels = re.findall(r'\\\\label\\{([^{}]+)\\}', tex)\n refs = re.findall(r'\\\\(?:eqref|ref|pageref)\\{([^{}]+)\\}', tex)\n assert len(labels) == len(set(labels)), 'Duplicate LaTeX labels'\n assert set(refs) <= set(labels), 'Unresolved LaTeX labels'\n cites = {k.strip() for group in re.findall(\n r'\\\\cite(?:\\[[^]]*\\])?\\{([^}]+)\\}', tex) for k in group.split(',')}\n keys = re.findall(r'^@\\w+\\{([^,]+),', bib, re.M)\n assert len(keys) == len(set(keys)) == 75, 'Bibliography inventory'\n assert cites == set(keys), 'Missing or unused bibliography entries'\n assert r'\\bibliography{references}' in tex\n assert not re.search(r'\\\\(?:input|include|includegraphics)\\b', tex)\n\n tables = re.findall(r'\\\\begin\\{longtable\\}.*?\\\\end\\{longtable\\}', intro, re.S)\n assert len(tables) == 8, 'Introduction table count'\n statuses = {}\n for table in tables:\n for ids, row in re.findall(\n r'% Book-open entr(?:y|ies): ([^;\\n]+)[^\\n]*\\n(\\$[^\\n]+)', table):\n for case in (x.strip() for x in ids.split(',')):\n assert case not in statuses, 'Duplicate book entry'\n if r'\\ref{thm:' in row:\n status = 'here'\n elif r'\\cite' in row:\n status = 'older' if case in {'F04', 'F06', 'F14'} else 'earlier'\n else:\n status = 'open'\n statuses[case] = status\n assert len(statuses) == 68, 'Tabulated book-entry count'\n statuses.update(G03='here', D06='here', S02='open', B01='open', B02='open')\n assert Counter(statuses.values()) == {\n 'here': 38, 'earlier': 17, 'older': 3, 'open': 15\n }, 'Introduction statistics'\n\n for certificate in re.findall(r'\\\\code\\{([^}]+)\\}', tex):\n if certificate.startswith('1.4q'):\n assert (ROOT / 'code/common/frey_quintic').is_dir()\n else:\n match = re.match(r'\\d+\\.\\d+\\.\\d+', certificate)\n assert match and match[0] in directories, ('Certificate directory', certificate)\n mapping = re.findall(r'^\\| ([3-6]\\.\\d+) \\| `([^`]+)`',\n (ROOT / 'README.md').read_text(encoding='utf-8'), re.M)\n assert len(mapping) == 38 and {c for _, c in mapping} == set(cases)\n expected = []\n group_counts = Counter()\n for case in cases:\n group = int(case.split('.')[1]) + 2\n group_counts[group] += 1\n expected.append((f'{group}.{group_counts[group]}', case))\n assert mapping == expected, 'Section-to-certificate map'\n\n tree = ast.parse((ROOT / 'verify_statements.py').read_text(encoding='utf-8'))\n assignments = {node.targets[0].id: node.value for node in tree.body\n if isinstance(node, ast.Assign) and len(node.targets) == 1\n and isinstance(node.targets[0], ast.Name)}\n names = ('AFFINE', 'FERMAT', 'QUARTICS', 'SURFACES', 'QUINTICS')\n assert [len(assignments[n].elts) for n in names] == [15, 5, 8, 4, 6]\n fermat_ids = ast.literal_eval(assignments['FERMAT_IDS'])\n assert tuple(int(c.split('.')[-1]) for c in cases if c.startswith('1.2.')) == fermat_ids\n scripts = sorted((ROOT / 'code').rglob('*.py')) + [\n ROOT / name for name in ('check_package.py', 'check_corrections.py', 'verify_statements.py', 'verify_quick.py')]\n for path in scripts:\n # compile() parses the source but does not execute it or write bytecode.\n compile(path.read_bytes(), str(path.relative_to(ROOT)), 'exec', ast.PyCF_ONLY_AST)\n\n checked = 0\n for line in (ROOT / 'SHA256SUMS').read_text(encoding='ascii').splitlines():\n digest, relative = line.split(' ', 1)\n path = ARCHIVE_ROOT / relative\n assert not Path(relative).is_absolute() and '..' not in Path(relative).parts\n assert hashlib.sha256(path.read_bytes()).hexdigest() == digest, ('Checksum', relative)\n checked += 1\n print(f'PASS: 38 cases, 73 book entries, 8 tables, 75 references; '\n f'{len(scripts)} Python sources parsed and {checked} file hashes checked.')\n print('No proof certificates, substitutions or bounded searches were executed.')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.1.1/1.1.1a_bitangent.gp", "size_bytes": 1329, "sha256": "b53d290916eb330adff63106cfa116a96f2988e9ebc894bc00537b1bed776c85", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisizemax, 2000000000);\np1 = 12*m^5*z - m^9 - 24*m*z^2 + 8*m - 8;\np2 = (12*m^2*z - m^6)^2 - 64*(z^3 - z);\nR = polresultant(p1, p2, z);\npK = z^27-480*z^19-1344*z^18-34560*z^11+70656*z^10-40704*z^9+16384*z^3-12288*z-4096;\nprint(\"deg R = \", poldegree(R,m), \" lc = \", pollead(R,m));\nprint(\"R/lc == pK(m)? \", R/pollead(R,m) == subst(pK,z,m));\nprint(\"irreducible: \", polisirreducible(pK));\nd = poldisc(pK); fd = factor(d); print(\"disc(pK) = \", fd);\nprint(\"check factorization exact: \", factorback(fd)==d, \" all primes: \", vector(#fd~,i,isprime(fd[i,1])));\nnf = nfinit([pK, fd[,1]~]);\nprint(\"sig = \", nf.sign, \" disc(K) = \", factor(nf.disc), \" index = \", factor(nf.index));\nprint(\"disc(K) value = \", nf.disc);\ndec2 = idealprimedec(nf,2); print(\"primes above 2: \", vector(#dec2,i,[dec2[i].e, dec2[i].f]));\n\\\\ et formula\nmm = Mod(z, pK);\net = mm*(11*mm^12-112*mm^4+112*mm^3)/(8*(13*mm^9+16*mm+8));\nprint(\"p1(m,et)=0: \", subst(subst(p1,z,et),m,mm)==0, \" p2: \", subst(subst(p2,z,et),m,mm)==0);\na = mm^3/2; b=(12*mm^2*et - mm^6)/8;\nprint(\"2ab - (3m et^2 - m + 1) = \", 2*a*b - (3*mm*et^2-mm+1), \" b^2-(et^3-et) = \", b^2 - (et^3-et), \" a^2-4b !=0: \", a^2-4*b!=0);\n\\\\ also check: ramification at 157, 64679\nforeach([157,64679,3,333337], p, dec=idealprimedec(nf,p); print(\"p=\",p,\" (e,f): \", vector(#dec,i,[dec[i].e,dec[i].f])));\n" }, { "path": "anc/code/1.1.1/1.1.1a_geometry.gp", "size_bytes": 838, "sha256": "497a444b103d8e83252cf03b0b25f2e7e74a2cc1743ba8c8246d153b2d1802f6", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Geometry checks for source curve F = x^4+y^3+x-y\nF = x^4+y^3+x-y;\n\\\\ transport\nP(X,Y) = X^4-Y^3-X+Y;\nprint(\"transport identity: \", P(-u,-v) - (u^4+v^3+u-v));\nsrc=[[-1,-1],[-1,0],[-1,1],[0,-1],[0,0],[0,1]];\nprint(\"targets: \", vector(6,i,[-src[i][1],-src[i][2]]), \" vals \", vector(6,i,P(-src[i][1],-src[i][2])));\n\\\\ singular points: discriminant of plane quartic via resultants\nFx = deriv(F,x); Fy = deriv(F,y);\n\\\\ use projective: Fh = X^4+Y^3Z+XZ^3-YZ^3\n\\\\ affine sing: 4x^3+1=0, 3y^2-1=0, F=0\nr1 = polresultant(4*x^3+1, polresultant(3*y^2-1, F, y), x);\nprint(\"res affine sing = \", factor(r1));\n\\\\ point at infinity: Z=0 => X^4=0 -> O=[0:1:0]; chart Y=1: X^4+Z+XZ^3-Z^3\nG = X^4+Z+X*Z^3-Z^3; print(\"dG/dZ at (0,0) = \", subst(subst(deriv(G,Z),X,0),Z,0));\n\\\\ char 2: F_x = 4x^3+1 = 1 mod 2 -> smooth affine; infinity chart dG/dZ=1 smooth.\n" }, { "path": "anc/code/1.1.1/1.1.1a_nodes.gp", "size_bytes": 835, "sha256": "fe02c441f8c54a1f29500f8d44ba73e8fa8f1e63ba691a598bdfea8edc47ecd8", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "F = x^4+y^3+x-y;\n{\nforeach([157,64679], p,\n sols=List();\n rx = polrootsmod(4*x^3+1, p);\n for(i=1,#rx, ry = polrootsmod(3*y^2-1,p); for(j=1,#ry,\n if(subst(subst(F,x,lift(rx[i])),y,lift(ry[j]))%p==0, listput(sols,[lift(rx[i]),lift(ry[j])]))));\n print(\"p=\",p,\" singular pts over F_p: \",sols);\n \\\\ check no singular pts over extension: gcd degrees\n g = gcd(Mod(1,p)*(4*x^3+1), Mod(1,p)*(243*x^2-64)); print(\" gcd(4x^3+1,243x^2-64) mod p: \",g);\n s=sols[1]; print(\" 72x^2y mod p = \", (72*s[1]^2*s[2])%p);\n \\\\ Newton lift of gradient system mod p^8\n N=8; X=Mod(s[1],p^N); Y=Mod(s[2],p^N);\n for(it=1,6, X = X - (4*X^3+1)/(12*X^2); Y = Y - (3*Y^2-1)/(6*Y));\n val = X^4+Y^3+X-Y; print(\" v_p(F(crit)) = \", valuation(lift(val),p), \" F(crit) mod p^4 = \", lift(val)%p^4, \" xcrit mod p^4=\",lift(X)%p^4,\" ycrit=\",lift(Y)%p^4);\n);\n}\n" }, { "path": "anc/code/1.1.1/1.1.1b_dyadic.gp", "size_bytes": 2364, "sha256": "40570e33c56db8cd82ff6460650b3169432ae78ea43ecfb0021e6058e813dbd1", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisizemax, 1500000000);\npK=x^27-480*x^19-1344*x^18-34560*x^11+70656*x^10-40704*x^9+16384*x^3-12288*x-4096;\nnf = nfinit([pK, [2,3,157,64679,333337,172659335137]]);\nm = Mod(x,pK);\net = m*(11*m^12-112*m^4+112*m^3)/(8*(13*m^9+16*m+8));\npts = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,0],[0,1]]; names=[\"A\",\"B\",\"C1\",\"D\",\"E\",\"F1\"];\nU = vector(6,i, lift(m*pts[i][1] + et - pts[i][2]));\n\\\\ ---- global independence via quadratic characters at split primes\nrows = vector(6,i,List());\n{\nforprime(p=7, 3000, if(p==157||p==64679, next);\n rr = polrootsmod(pK, p);\n for(k=1,#rr, r=lift(rr[k]);\n vals = vector(6,i, kronecker(lift(subst(U[i],x,Mod(r,p))),p));\n if(#select(v->v==0, vals), next);\n for(i=1,6, listput(rows[i], if(vals[i]==1,0,1)))));\n}\nMg = matrix(6, #rows[1], i,j, rows[i][j]);\nprint(\"split-prime character columns: \", #rows[1]);\nprint(\"rank over F2 of {A,B,D}: \", matrank(Mod(vecextract(Mg,[1,2,4],\"..\"),2)), \" of {E,B,D}: \", matrank(Mod(vecextract(Mg,[5,2,4],\"..\"),2)));\nprint(\"A==E mod squares (chars): \", Mg[1,]==Mg[5,], \" C1 = E+B: \", Mod(Mg[3,],2)==Mod(Mg[5,]+Mg[2,],2), \" F1 = E+D: \", Mod(Mg[6,],2)==Mod(Mg[5,]+Mg[4,],2));\n\\\\ ---- dyadic local images\nP2 = idealprimedec(nf,2)[1]; print(\"P2 e,f: \", P2.e, \" \", P2.f);\nbid = idealstar(nf, idealpow(nf,P2,19), 1);\ncyc = bid.cyc; ev = select(c->c%2==0, cyc, 1); print(\"number of even cyclic factors of (O/P^19)^*: \", #ev);\npi = P2.gen[2]; print(\"v(pi) = \", nfeltval(nf,pi,P2));\nimg(u) = { my(v=nfeltval(nf,u,P2), w = nfeltdiv(nf, u, nfeltpow(nf,pi,v)), lg);\n \\\\ w may have other primes in denominators; it's a P2-unit\n lg = ideallog(nf, w, bid);\n concat([v%2], vector(#ev, j, lg[ev[j]]%2)); }\nIM = matrix(6, 1+#ev, i, j, img(U[i])[j]);\nprint(\"dyadic rank {A,B,D}: \", matrank(Mod(vecextract(IM,[1,2,4],\"..\"),2)), \" {E,B,D}: \", matrank(Mod(vecextract(IM,[5,2,4],\"..\"),2)), \" all six: \", matrank(Mod(IM,2)));\n\\\\ sanity: square of a random element maps to 0; -1 and 2\nprint(\"image of a square (should be 0): \", img(nfeltpow(nf, nfalgtobasis(nf, 3+x-x^5), 2)));\nprint(\"valuations of U at P2: \", vector(6,i,nfeltval(nf,U[i],P2)));\n\\\\ all odd-prime valuations of U even? factor ideals\nfor(i=1,6, F=idealfactor(nf, U[i]); odd=0; for(k=1,#F~, if(F[k,1].p!=2 && F[k,2]%2, odd++)); print(names[i], \": #odd-prime factors with odd valuation = \", odd, \" primes involved: \", Set(vector(#F~,k,F[k,1].p))));\n" }, { "path": "anc/code/1.1.1/1.1.1c_code.py", "size_bytes": 1392, "sha256": "1c443a9b456118e693ca58cb045bdb8cfface0f302c772b5a18fc12833c52df9", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent enumeration of the marked-code trace bounds\nimport itertools\ndef Q(v):\n v1,v2,v3,v4,v5,v6=[(v>>i)&1 for i in range(6)]\n return (v1*v2+v3*v4+v5*v6+v5+v6)&1\ndef B(u,v): return Q(u^v)^Q(u)^Q(v)\nOmega=[w for w in range(1,64) if Q(w)==0]\nprint(\"|Omega|=\",len(Omega))\nwts=set(sum(B(c,w) for w in Omega) for c in range(1,64)); print(\"nonzero word weights:\",sorted(wts))\n# B nondegenerate?\nprint(\"B nondeg:\", all(any(B(c,w) for w in range(64)) for c in range(1,64)))\n# enumerate all subspaces as sets (closed under xor) via spans of bases in RREF\nsubs=set()\ndef span(gens):\n S={0}\n for g in gens:\n S|={s^g for s in S}\n return frozenset(S)\n# all subspaces: generate by BFS adding vectors\nfrontier={frozenset({0})}; subs|=frontier\nwhile frontier:\n new=set()\n for S in frontier:\n for v in range(1,64):\n if v not in S:\n T=frozenset(S|{s^v for s in S})\n if T not in subs:\n subs.add(T); new.add(T)\n frontier=new\nfrom collections import Counter\nprint(\"num subspaces:\",len(subs), Counter(len(S).bit_length()-1 for S in subs))\nell={}\nfor S in subs:\n r=sum(1 for w in S if w in set(Omega))\n for c in range(64):\n val=sum((-1)**B(c,w) for w in S if w!=0 and Q(w)==0)\n ell[r]=min(ell.get(r,99),val)\nprint(\"ell table:\",sorted(ell.items()))\nprint(\"universal min:\",min(ell.values()))\n" }, { "path": "anc/code/1.1.1/1.1.1e_census_stream.py", "size_bytes": 5546, "sha256": "c94bebe9c6561a8888b708e6fde1a5c69fd91f417ddbd50a36b6bd6d5fa30708", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Exact resumable root-count census for the3723 strict-character criterion.\n\nEach prime is generated by PARI, and the number of degree-one primes in the\n27-dimensional bitangent field is counted by a polynomial gcd in FLINT. All\npolynomial-discriminant prime factors are below the default starting point.\nCategory4 records three roots whose Frobenius cube also has three roots.\nThe output records exact prime counts by refined root-count category in short rational\nmultiplicative intervals. Analytic weights are deliberately not evaluated here.\n\nExample:\n python census_stream_3723.py --workers 5\nNo network access or BNF data is used. Existing completed blocks are replayable\nindependently and are reused when the requested upper limit is extended.\n\"\"\"\nimport argparse,bisect,hashlib,json,math,multiprocessing as mp,os,struct,time\nfrom pathlib import Path\nfrom cypari2 import Pari\nfrom flint import nmod_poly\n\nCOEFF=[-4096, -12288, 0, 16384, 0, 0, 0, 0, 0, -40704, 70656, -34560, 0, 0, 0, 0, 0, 0, -1344, -480, 0, 0, 0, 0, 0, 0, 0, 1]\nBAD=[2, 3, 157, 64679, 333337, 172659335137]\nDISC_FACTORS=[[2, 312], [3, 54], [157, 6], [64679, 6], [333337, 2], [172659335137, 2]]\nCATEGORIES=[0,1,2,3,4,5,7,9,11,15,27]\nLOWER_CHARACTER=[0,-1,-2,-3,-1,-3,-5,-3,-5,-5,-5]\nROOT=Path(__file__).resolve().parent/'data'\n_P=None;_EDGES=None\n\ndef edges(start,stop):\n result=[start]\n while result[-1]args.start and not any(args.start<=p 2 else 'data/3723_census_blocks')\nrefbins = {}\nfor p in ref.glob('block_*.json'):\n for a, b, c in json.loads(p.read_text())['bins']:\n refbins[a, b] = c\nsame = diff = cut = 0\nfor p in sl.glob('block_*.json'):\n for a, b, c in json.loads(p.read_text())['bins']:\n if (a, b) not in refbins:\n cut += 1\n continue\n if refbins[a, b] == c:\n same += 1\n else:\n diff += 1\n print('MISMATCH', a, b, c, refbins[a, b])\nprint('bins compared', same + diff, 'identical', same, 'different', diff, 'skipped (cut by slice end)', cut)\n" }, { "path": "anc/code/1.1.1/1.1.1e_low_norm_census.py", "size_bytes": 4988, "sha256": "caedbae1fb57c2701bda42d55c0277dac8c4dea2c3ff40d41cbb9dbb31b70438", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Exact low-norm and higher-residue-degree census for the3723 class criterion.\n\nThe default replay regenerates every needed prime-ideal count. For a quick\nresearch run, --reuse-census may refer to a previously regenerated full census\nof prime-ideal norms through at least15m; all low-prime data are still checked.\nOutput keeps norms≤sqrt(support) exact and bins the larger known-principal\nnorms, which can contribute only their first powers to the explicit formula.\n\"\"\"\nimport argparse,bisect,hashlib,json,math,os,struct,time\nfrom collections import Counter\nfrom pathlib import Path\nfrom cypari2 import Pari\nfrom flint import nmod_poly\n\nCOEFF=[-4096, -12288, 0, 16384, 0, 0, 0, 0, 0, -40704, 70656, -34560, 0, 0, 0, 0, 0, 0, -1344, -480, 0, 0, 0, 0, 0, 0, 0, 1]\nDISC_FACTORS=[[2, 312], [3, 54], [157, 6], [64679, 6], [333337, 2], [172659335137, 2]]\nROOT=Path(__file__).resolve().parent/'data'\n\ndef main():\n ap=argparse.ArgumentParser(description=__doc__)\n ap.add_argument('--cutoff',type=int,default=10000000)\n ap.add_argument('--support',type=int,default=10000000000)\n ap.add_argument('--reuse-census',type=Path)\n ap.add_argument('--output',type=Path,default=ROOT/'3723_low_norm_census.json')\n ap.add_argument('--higher-output',type=Path,default=ROOT/'3723_higher_norms.json')\n a=ap.parse_args();start=time.monotonic();P=Pari();P.allocatemem(300000000,1000000000,silent=True)\n f=P.Pol(COEFF[::-1]);assert int(f.poldisc())==math.prod(p**e for p,e in DISC_FACTORS)\n assert all(P.isprime(p)for p,e in DISC_FACTORS)\n assert int(P.polisirreducible(f))==1\n nf=P.nfinit(f);assert abs(int(nf[2]))==2**24*157**6*64679**6\n assert len(P.nfcertify(nf))==0\n assert int(nf[2])*int(nf[3])**2==int(f.poldisc())\n assert[int(v)for v in nf[1]]==[3,12]\n bad={p for p,e in DISC_FACTORS};small_limit=math.isqrt(a.support)\n assert small_limit=2 and q<=a.support:higher[q]+=1\n partial=dict(known)\n if a.reuse_census:\n supplied={int(q):int(c)for q,c in json.loads(a.reuse_census.read_text())if int(q)<=a.cutoff}\n for q,c in partial.items():assert supplied[q]==c,(q,c,supplied.get(q))\n assert {q:c for q,c in supplied.items()if q<=small_limit}=={q:c for q,c in partial.items()if q<=small_limit}\n for p in bad:\n if small_limit=10**6 and cutoff**2>support\n heights=list(map(int,spec['heights'])); N=len(heights)\n assert N==128 and all(h>0 for h in heights)\n den=sum(h*h for h in heights)\n knots=[sum(heights[i]*heights[i+k] for i in range(N-k)) for k in range(N+1)]\n assert knots[0]==den and knots[N]==0\n assert all(knots[k]>=knots[k+1]>=0 for k in range(N))\n extended=knots+[0]\n weights=[k*(extended[k-1]-2*extended[k]+extended[k+1]) for k in range(1,N+1)]\n assert sum(weights)==den\n T=arb(support).log(); delta=T/N; delta_float=math.log(support)/N\n alpha=arb(3)/n\n C=arb.const_euler()+(4*arb.pi()).log()+alpha-arb(D).log()/n\n arch=arb(0)\n for k,w in enumerate(weights,1):\n A=k*delta; z=(-A).exp()\n triangle=C-arb.pi()**2/(4*A)-2*alpha*arb(2).log()/A+2/A*(z.polylog(2)-(z*z).polylog(2)/4)+2*alpha/A*z.log1p()\n arch+=(arb(w)/den)*triangle\n\n def window(logq, approximate):\n k=int(approximate/delta_float)\n assert 0<=kk*delta and logq<(k+1)*delta\n value=(arb(knots[k])+(logq-k*delta)/delta*(knots[k+1]-knots[k]))/den\n assert value>0\n return value\n\n principal_sum=arb(0); principal_ideals=0; principal_power_terms=0\n low=json.loads(args.low_norms.read_text())\n positive_bins=[]; expected_known=None; low_stream_hash=None; low_higher=None\n if isinstance(low,dict) and 'small_exact_known_norms' in low:\n assert low['principal_cutoff']==cutoff and low['support']==support\n assert low['field_discriminant']==D and low['signature']==[3,12]\n assert low['polynomial_coefficients_ascending']==expected_coefficients\n assert low['small_exact_limit']==math.isqrt(support)\n positive_bins=low['large_known_norm_bins']\n expected_known=low['total_known_prime_ideals']\n low_stream_hash=low['sha256_complete_known_norm_count_stream']\n low_higher=low['unknown_higher_residue_degree_norms']\n low=low['small_exact_known_norms']\n elif isinstance(low,dict): low=low['norm_counts']\n last=0\n for q,count in low:\n q=int(q); count=int(count)\n assert q>last and count>0;last=q\n if q>cutoff: break\n principal_ideals+=count; logq=arb(q).log(); logq_float=math.log(q)\n power=q; m=1\n while power0\n principal_ideals+=count\n logb=arb(b).log();f=window(logb,math.log(b))\n # Positive terms require the right endpoint, where this decreasing\n # weight is smallest. Norms in these bins have no supported power m>1.\n principal_sum+=4*count*logb/(n*(b+1))*f\n principal_power_terms+=1\n if expected_known is not None: assert principal_ideals==expected_known\n\n higher=json.loads(args.higher_norms.read_text())\n if isinstance(higher,dict):\n assert higher['support']==support and higher['principal_cutoff']==cutoff\n assert sum(c for q,c in higher['norm_counts'])==higher['total_prime_ideals']\n higher=higher['norm_counts']\n if low_higher is not None: assert higher==low_higher\n higher_sum=arb(0); higher_ideals=0\n for q,count in higher:\n q=int(q);count=int(count)\n assert q0\n if q<=cutoff:continue\n assert q*q>=support\n logq=arb(q).log();f=window(logq,math.log(q))\n higher_sum-=4*count*logq/(n*(q+1))*f\n higher_ideals+=count\n\n meta=json.loads((args.census/'metadata.json').read_text())\n assert meta['index']==3723 and meta['polynomial_coefficients_ascending']==expected_coefficients\n assert meta['bin_origin']==cutoff\n categories=meta['categories']; lowers=meta['lower_character_by_category']\n assert meta['category4_definition']=='r1=3 and r3=3'\n # Use only the conservative root-count bound: category4 also has three roots.\n lowers=[-3 if r==4 else c for r,c in zip(categories,lowers)]\n exact_bounds={int(k):int(v)for k,v in spec['rootcount_character_lower_bound'].items()}\n assert exact_bounds=={0:0,1:-1,2:-2,3:-3,4:-3,5:-3,7:-5,9:-3,11:-5,15:-5,27:-5}\n assert all(exact_bounds[r]==c for r,c in zip(categories,lowers))\n blocks={}\n for path in args.census.glob('block_*.json'):\n rec=json.loads(path.read_text()); lo=int(rec['lower']);hi=int(rec['upper'])\n assert lo not in blocks and hi>lo\n blocks[lo]=rec\n prefix=cutoff; census_sum=arb(0); census_primes=0; census_blocks=0\n census_counts={r:0 for r in categories}; block_hashes=[]\n while prefix in blocks:\n rec=blocks[prefix];assert rec['upper']<=support\n total=0;previous=prefix\n for a,b,counts in rec['bins']:\n assert prefix<=a=previous\n previous=b\n assert len(counts)==len(categories) and all(isinstance(v,int)and v>=0 for v in counts)\n total+=sum(counts)\n for r,v in zip(categories,counts):census_counts[r]+=v\n cm=sum(c*v for c,v in zip(lowers,counts));assert cm<=0\n if cm:\n loga=arb(a).log();f=window(loga,math.log(a))\n # x -> log(x)/(x+1)*f(log(x)) decreases for x>=cutoff.\n # Thus the left endpoint safely overestimates the magnitude\n # of each negative contribution in this half-open bin.\n census_sum+=4*cm*loga/(n*(a+1))*f\n assert total==rec['prime_count']\n census_primes+=total;census_blocks+=1\n block_hashes.append([prefix,rec['upper'],rec['sha256_prime_rootcount_stream']])\n prefix=int(rec['upper'])\n assert prefix>3594641 and prefixA*(1-1/(5 log(A)^2)).\n c=arb(36261)/36260\n prime_tail_upper=c*integral+(c-1+arb(1)/(5*logA*logA))*fA\n assert prime_tail_upper>0\n tail_sum=-arb(20)/n*prime_tail_upper\n result=arch+principal_sum+higher_sum+census_sum+tail_sum\n record=dict(index=3723,criterion='strict Selmer characters only',precision_bits=ctx.prec,\n support=support,principal_cutoff=cutoff,window_cells=N,integer_window_denominator=str(den),\n principal_ideal_count_required=principal_ideals,principal_prime_power_terms=principal_power_terms,\n principal_large_norm_bins=len(positive_bins),low_norm_stream_sha256=low_stream_hash,\n higher_degree_nonprincipal_ideal_count=higher_ideals,census_prefix_exclusive=prefix,\n census_blocks=census_blocks,census_prime_count=census_primes,census_root_counts=census_counts,\n archimedean_interval=str(arch),principal_sum_interval=str(principal_sum),\n higher_degree_lower_interval=str(higher_sum),census_lower_interval=str(census_sum),\n dusart_tail_lower_interval=str(tail_sum),B_interval=str(result),\n rigorously_positive=bool(result>0),census_block_hashes=block_hashes,\n rigorously_greater_than_7_over_1000=bool(result>arb(7)/1000),\n seconds=round(time.monotonic()-began,3))\n args.output.write_text(json.dumps(record,indent=2)+'\\n')\n print(json.dumps({k:v for k,v in record.items()if k!='census_block_hashes'},indent=2),flush=True)\n if args.require_positive:assert result>0,result\n\nif __name__=='__main__': main()\n" }, { "path": "anc/code/1.1.1/1.1.1g_kernel.py", "size_bytes": 1115, "sha256": "1e23340b96b6a8e2565963d5bd7eaad96844c88ca4e6213a43cdcaff806a8ed6", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Exact symbolic verification of the explicit height-kernel identity.\"\"\"\nimport json\nimport sympy as s\nx,y,a,b,t=s.symbols('x y a b t')\nF=x**4+x+y**3-y;FP=a**4+a+b**3-b\nS=y*y+b*y+b*b-1;T=x**3+x*x*a+x*a*a+a**3+1\nassert s.expand((b-y)*S-(x-a)*T)==FP-F\ncoefficient=5*a*a*b+2*a*b*x+a*a*y-5*x*x*y-2*a*x*y-b*x*x\nassert s.expand(3*(b+y)*T-(4*a**3+1)*(y+2*b)-(4*x**3+1)*(b+2*y)-(x-a)*coefficient)==0\nforms=[-t**4,-t,1,5*t**-6,2*t**-3,-t**-2]\ncup=[]\nfor f in forms:\n row=[]\n for g in forms:row.append(int(s.residue(s.integrate(f,t)*g,t,0)))\n cup.append(row)\nexpected=[[0]*6 for _ in range(6)]\nfor i in range(3):expected[i][i+3]=-1;expected[i+3][i]=1\nassert cup==expected\nbeta=3*b*b-1;bp=-(4*a**3+1)/beta\nassert s.cancel(2*(-3*b*bp/beta)+6*b*bp/beta)==0\nrecord=dict(kernel_polynomial_identity_verified=True,cup_matrix=cup,\n first_relative_Laurent_correction_order=8,\n diagonal_tangent_cancellation_verified=True,all_checks_passed=True,\n scope='Exact algebraic identities; Coleman normalization and precision are proved in the accompanying text.')\nprint(json.dumps(record,indent=2))\n" }, { "path": "anc/code/1.1.1/1.1.1h_qc3.gp", "size_bytes": 7449, "sha256": "1f51654c99ae7677c35c0d2ce92a2505234dbed9c76e49beb07912ef9389c6e2", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent quadratic Chabauty at p=3 for C: x^4+y^3+x-y=0 (source coordinates).\n\\\\ Only inputs taken from the TeX: the six RR sections (coefficients of 1,x,y,x^2,xy).\np = 3; PR = 45; DS = 80;\npts = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,0],[0,1]]; \\\\ A,B,C1,D,E,F1\nnm = [\"A\",\"B\",\"C1\",\"D\",\"E\",\"F1\"];\nsecs = [[-43,-202,104,-183,128],[75,132,37,57,31],[-3059,-2834,2264,-183,1856],[24,44,24,7,32],[0,0,0,-1,1],[24,-44,-24,7,32]];\nFc(X,Y) = X^4+Y^3+X-Y;\n\\\\ ---------- disk expansions (exact rational series in s)\nYser = vector(6); OM = vector(6); ET = vector(6); IOM = vector(6); IET = vector(6);\n{\nfor(k=1,6, my(a=pts[k][1], b=pts[k][2], Y=b+O(s^DS), w);\n for(it=1,9, Y = Y - Fc(a+s,Y)/(3*Y^2-1));\n if(valuation(Fc(a+s,Y),s) < DS, error(\"Y\"));\n Yser[k]=Y; w = 1/(3*Y^2-1);\n OM[k] = [w, (a+s)*w, Y*w]; ET[k] = [5*(a+s)^2*Y*w, 2*(a+s)*Y*w, (a+s)^2*w];\n IOM[k] = vector(3,i,intformal(OM[k][i])); IET[k] = vector(3,i,intformal(ET[k][i])));\n}\n\\\\ integrality of series coefficients at 3 (all denominators prime to 3 before integration)\n{ for(k=1,6, for(i=1,3, for(n=0,DS-1, if(valuation(polcoef(OM[k][i],n,s),3)<0 || valuation(polcoef(ET[k][i],n,s),3)<0, error(\"nonintegral\")))));\n print(\"disk series integral at 3: ok\"); }\nevs(S, z) = { my(r=0); for(n=valuation(S,s), DS-1, r += polcoef(S,n,s)*z^n); r };\n\\\\ ---------- residual zeros of the sections\npadic(xx) = xx + O(p^PR);\nres = vector(6); Rm = matrix(6,6);\n{\nfor(j=1,6, my(c=secs[j], Nn=c[1]+c[2]*x+c[4]*x^2, Dn=c[3]+c[5]*x, h, g, a=pts[j][1], rts, L=List());\n \\\\ vanishing order at P_j\n my(fs = c[1]+c[2]*(a+s)+c[3]*Yser[j]+c[4]*(a+s)^2+c[5]*(a+s)*Yser[j]);\n if(valuation(fs,s)!=4, error(Str(\"order at P_j: \",j,\" \",valuation(fs,s))));\n if(j==5, \\\\ x(y-x): residual exact zeros A,D,F1\n L = List([[1,0],[4,0],[6,0]]),\n if(poldegree(gcd(Nn,Dn))>0, error(\"gcd\"));\n h = (x^4+x)*Dn^3 - Nn^3 + Nn*Dn^2;\n if(poldegree(h)!=7, error(\"deg\"));\n g = h/(x-a)^4; if(type(g)!=\"t_POL\", error(\"not divisible\"));\n if(polresultant(g, x-a)==0, error(\"extra zero at center\"));\n rts = polrootspadic(g, p, PR);\n if(#rts!=3, error(Str(\"residual roots not all in Q_3 for j=\",j)));\n for(r=1,3, my(xr=rts[r], yr=-subst(Nn,x,xr)/subst(Dn,x,xr), kk=0);\n for(k=1,6, if(valuation(xr-pts[k][1],p)>=1 && valuation(yr-pts[k][2],p)>=1, kk=k));\n if(kk==0, error(\"disk\"));\n my(sr = xr - pts[kk][1]);\n \\\\ consistency with disk branch\n if(valuation(evs(Yser[kk], sr) - yr, p) < PR-5, error(\"branch\"));\n listput(L, [kk, sr])));\n res[j] = L; Rm[j,j] += 4; for(r=1,#L, Rm[j, L[r][1]] += 1));\nprint(\"relation matrix R = \", Rm, \" det = \", matdet(Rm));\nfor(j=1,6, print(\"section \",j,\" residual disks: \", vector(#res[j],r,nm[res[j][r][1]]), \" v_3(s): \", vector(#res[j],r, if(res[j][r][2]==0,\"exact\",valuation(res[j][r][2],p)))));\n}\n\\\\ ---------- expansion at O (t-adic) for residues of second-kind forms\nTO = 40;\nv = 1+O(t^TO); for(it=1,8, v = v - (v^2*(v-1)+t^8+t^9)/(3*v^2-2*v));\nxt = t^-3*v; yt = -t^-4*v; om_t = deriv(xt,t)/(3*yt^2-1);\net_t = [5*xt^2*yt*om_t, 2*xt*yt*om_t, xt^2*om_t];\nprint(\"omega at O leading: \", om_t + O(t^8));\nRES = matrix(6,3);\n{\nfor(j=1,6, my(c=secs[j], f = c[1]+c[2]*xt+c[3]*yt+c[4]*xt^2+c[5]*xt*yt, fO, U);\n if(valuation(f,t)!=-7, error(\"pole order\")); fO = polcoef(f,-7,t);\n if(fO != -c[5], error(\"fO\"));\n U = f*t^7/fO; my(lU = log(U));\n for(i=1,3, RES[j,i] = polcoef(lU*et_t[i], -1, t)));\nprint(\"second-kind residue corrections: \", RES);\n}\n\\\\ ---------- holomorphic and second-kind periods at the six centers\nTi = matrix(6,3); Te = matrix(6,3);\n{\nfor(j=1,6, for(r=1,#res[j], my(k=res[j][r][1], sr=res[j][r][2]);\n for(i=1,3, Ti[j,i] += if(sr==0,0,evs(IOM[k][i], sr)); Te[j,i] += if(sr==0,0,evs(IET[k][i], sr)))));\n}\nRi = Rm^-1;\nIm3 = Ri*(-Ti);\nJm = Ri*(RES - Te);\nprint(\"I/3 mod 729 rows: \"); for(k=1,6, print(\" \",nm[k],\": \", vector(3,i, lift(Mod(truncate(Im3[k,i]/3),729)))));\nprint(\"J mod 729 rows: \"); for(k=1,6, print(\" \",nm[k],\": \", vector(3,i, lift(Mod(truncate(Jm[k,i]),729)))));\nprint(\"relations: I(A)+3I(E) val \", vector(3,i,valuation(Im3[1,i]+3*Im3[5,i],p)), \" I(C1)-3I(E)+I(B) \", vector(3,i,valuation(Im3[3,i]-3*Im3[5,i]+Im3[2,i],p)), \" I(F1)+I(E)+I(D) \", vector(3,i,valuation(Im3[6,i]+Im3[5,i]+Im3[4,i],p)));\n\\\\ ---------- third-kind integrals\nfleading(j,i) = { my(c=secs[j], a=pts[i][1], b=pts[i][2], fs=c[1]+c[2]*(a+s)+c[3]*Yser[i]+c[4]*(a+s)^2+c[5]*(a+s)*Yser[i], m=valuation(fs,s));\n polcoef(fs,m,s)*(3*b^2-1)^m };\nnuser(i,k) = { my(a=pts[i][1], b=pts[i][2], Y=Yser[k], ak=pts[k][1], S=Y^2+b*Y+b^2-1);\n S/((ak-a)+s)*(1/(3*Y^2-1)) };\nKm = matrix(6,6);\n{\nfor(i=1,6, my(rhs=vector(6)~);\n for(j=1,6, my(val = log(padic(fleading(j,i))) - log(padic(-secs[j][5])));\n for(r=1,#res[j], my(k=res[j][r][1], sr=res[j][r][2], nu, tiny);\n if(sr==0, next);\n nu = nuser(i,k);\n if(k==i, my(rho = nu - 1/s); if(valuation(rho,s)<0, error(\"rho\")); tiny = log(padic(sr/(3*pts[i][2]^2-1))) + evs(intformal(rho), sr),\n if(valuation(nu,s)<0, error(\"pole\")); tiny = evs(intformal(nu), sr));\n val -= tiny);\n rhs[j]=val);\n my(col = Ri*rhs); for(k=1,6, Km[i,k]=col[k]));\n}\nH = matrix(6,6,i,k, Km[i,k] - sum(l=1,3, Jm[i,l]*Im3[k,l]));\nprint(\"symmetry: min valuation of H - H~ : \", vecmin(vector(36,n, my(i=(n-1)\\6+1,k=(n-1)%6+1); valuation(H[i,k]-H[k,i],p))));\nbas = [5,2,4]; \\\\ E,B,D\nIB = matrix(3,3,r,c, Im3[bas[r],c]); HB = matrix(3,3,r,c,H[bas[r],bas[c]]);\nMq = IB^-1*HB*(IB^-1)~;\nprint(\"3M mod 729: \", matrix(3,3,r,c, lift(Mod(truncate(3*Mq[r,c]),729))), \" min v(M) = \", vecmin(vector(9,n,valuation(Mq[(n-1)\\3+1,(n-1)%3+1],p))));\nprint(\"I_B/3 mod 3: \", matrix(3,3,r,c, lift(Mod(truncate(IB[r,c]/3),3))), \" det mod 3: \", lift(Mod(truncate(matdet(IB/3)),3)));\ncorr = matrix(6,6); l2 = log(padic(2)); corr[1,3]=corr[3,1]=corr[4,6]=corr[6,4]=-l2;\n{print(\"global height consistency: min valuation over 36 entries of H+corr - I M I^T: \", vecmin(vector(36,n, my(i=(n-1)\\6+1,k=(n-1)%6+1); valuation(H[i,k]+corr[i,k] - (Im3[i,]*Mq*Im3[k,]~), p))));}\nprint(\"tau centers mod 2187: \", vector(6,k, lift(Mod(truncate(H[k,k]),2187))));\n\\\\ ---------- disk functions q_k(u)\nDU = 60;\n{\nallroots = List();\nfor(k=1,6, my(Ik = vector(3,i, Im3[k,i] + IOM[k][i]), tau, q, qu, e, red, rts, nadd=0);\n tau = H[k,k] - 2*sum(i=1,3, intformal(OM[k][i]*(Jm[k,i] + IET[k][i])));\n q = tau - Ik*Mq*Ik~;\n qu = substpol(q + O(s^DU), s, 3*u);\n qu = sum(n=0,DU-1, polcoef(qu,n,u)*u^n);\n e = vecmin(vector(DU-1,n, valuation(polcoef(qu,n,u),p)));\n my(c0v = valuation(polcoef(qu,0,u),p));\n red = sum(n=1,12, lift(Mod(truncate(polcoef(qu,n,u)/p^e),p))*u^n);\n \\\\ tail check: valuations of high coefficients\n my(tailmin = vecmin(vector(DU-1-12, n, valuation(polcoef(qu,n+12,u),p)-e)));\n print(nm[k],\": v(const)=\",c0v,\" e=\",e,\" reduction=\",red, \" min rel. val of coeffs 13..\",DU-1,\": \",tailmin);\n \\\\ roots in Z_3 of qu/u (exclude known root u=0)\n my(P = sum(n=1,DU-1, polcoef(qu,n,u)/p^e*u^(n-1)));\n rts = polrootspadic(P, p, 25);\n for(r=1,#rts, if(valuation(rts[r],p)>=0, nadd++; listput(allroots,[k,rts[r]])));\n print(\" additional roots in Z_3: \", nadd));\n}\nprint(\"additional roots: coordinates a = I(P) I_B^{-1} mod 3^8:\");\n{\nIBi = IB^-1;\nfor(r=1,#allroots, my(k=allroots[r][1], uu=allroots[r][2], sv=3*uu, Iv=vector(3,i, Im3[k,i]+evs(IOM[k][i], sv)), av=Iv*IBi);\n print(\" disk \",nm[k],\": u mod 6561 = \", lift(Mod(truncate(uu),6561)), \" a = \", vector(3,i, lift(Mod(truncate(av[i]),6561)))));\n}\n" }, { "path": "anc/code/1.1.1/1.1.1i_qc5.gp", "size_bytes": 8107, "sha256": "a5d5e402f38a9e509c07b629f1c30ab3ee3011e91e8e5c0e9ae4677eb9dd6245", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent quadratic Chabauty at p=5 for C: x^4+y^3+x-y=0 (source coordinates).\n\\\\ Inputs from the TeX: only the list (N, imposed orders) of the seven sections; sections recomputed here.\np = 5; PR = 40; DS = 64;\npadic(z) = z + O(p^PR);\nFc(X,Y) = X^4+Y^3+X-Y;\nbet = polrootspadic(Y^3-Y+84, p, PR); bet = select(r->valuation(r-2,p)>=1, bet); if(#bet!=1, error(\"beta\")); bet=bet[1];\nprint(\"beta mod 5^8 = \", lift(Mod(truncate(bet),5^8)));\npts = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,0],[0,1],[3,bet]];\nnm = [\"A\",\"B\",\"C1\",\"D\",\"E\",\"F1\",\"P6\"];\n\\\\ check affine residue points mod 5\n{ my(L=List()); for(a=0,4,for(b=0,4, if(Fc(a,b)%5==0, listput(L,[a,b])))); print(\"affine F_5 points: \",L); }\nYser = vector(7); OM = vector(7); ET = vector(7); IOM = vector(7); IET = vector(7);\n{\nfor(k=1,7, my(a=pts[k][1], b=pts[k][2], Yk=b+O(s^DS), w);\n for(it=1,9, Yk = Yk - Fc(a+s,Yk)/(3*Yk^2-1));\n Yser[k]=Yk; w = 1/(3*Yk^2-1);\n OM[k] = [w, (a+s)*w, Yk*w]; ET[k] = [5*(a+s)^2*Yk*w, 2*(a+s)*Yk*w, (a+s)^2*w];\n IOM[k] = vector(3,i,intformal(OM[k][i])); IET[k] = vector(3,i,intformal(ET[k][i])));\nfor(k=1,7, for(i=1,3, for(n=0,DS-1, if(valuation(polcoef(OM[k][i],n,s),p)<0 || valuation(polcoef(ET[k][i],n,s),p)<0, error(\"nonintegral\")))));\nprint(\"disk series integral at 5: ok\");\n}\nevs(S, z) = { my(r=0); for(n=valuation(S,s), DS-1, r += polcoef(S,n,s)*z^n); r };\n\\\\ ---------- sections\nspec = [[6,[1,1,0,1,0,0,0]],[7,[2,0,0,0,0,2,0]],[7,[1,0,3,0,0,0,0]],[7,[1,0,0,0,0,3,0]],[7,[1,0,0,0,0,0,3]],[7,[0,0,0,0,4,0,0]],[9,[5,0,1,0,0,0,0]]];\nmons(N) = { my(L=List()); for(w=0,N, for(j=0,2, my(r=w-4*j); if(r>=0 && r%3==0, listput(L,[r/3,j])))); Vec(L) };\nevalf(c, ms, X, Yv) = sum(t=1,#ms, c[t]*X^ms[t][1]*Yv^ms[t][2]);\nsecs = vector(7); fser = vector(7);\n{\nfor(j=1,7, my(N=spec[j][1], o=spec[j][2], ms=mons(N), nmon=#ms, rows=List(), A, rhs, c);\n if(ms[nmon][1]*3+ms[nmon][2]*4 != N, error(\"top monomial\"));\n for(k=1,7, if(o[k]>0, my(g = vector(nmon,t, pts[k][1]^0*((pts[k][1]+s)^ms[t][1]*Yser[k]^ms[t][2])));\n for(n=0,o[k]-1, listput(rows, vector(nmon,t, polcoef(g[t],n,s))))));\n if(#rows != nmon-1, error(\"count\"));\n A = matrix(nmon-1, nmon-1, r, t, rows[r][t]); rhs = vector(nmon-1, r, -rows[r][nmon])~;\n c = concat(Vec(matsolve(A, rhs)), [1]);\n secs[j] = [N, ms, c];\n print(\"section \",j,\" N=\",N,\" reduced coeffs mod 5: \", vector(nmon,t, if(type(c[t])==\"t_PADIC\", lift(Mod(truncate(c[t]),5)), lift(Mod(c[t],5)))), if(j!=5, Str(\" exact: \",c), \"\")));\n}\n\\\\ ---------- zeros of each section in each disk\nres = vector(7); Rm = matrix(7,7); ordc = matrix(7,7);\n{\nfor(j=1,7, my(N=secs[j][1], ms=secs[j][2], c=secs[j][3], tot=0, L=List());\n for(k=1,7, my(g = evalf(c, ms, pts[k][1]+s, Yser[k]), gu, e, wd, m, gg, rts);\n \\\\ exact order at center: for exact sections use valuation; for p-adic section treat imposed order as exact\n if(j==5 || k==7, m = spec[j][2][k]; for(n=0,m-1, if(valuation(polcoef(g,n,s),p) < PR-8, error(Str(\"imposed \",j,\" \",k)))), m = valuation(g,s));\n ordc[j,k] = m;\n gg = sum(n=m, DS-1, polcoef(g,n,s)*s^(n-m));\n \\\\ Weierstrass degree of gg on v(s)>=1\n gu = substpol(gg, s, 5*u);\n e = vecmin(vector(DS-m, n, valuation(polcoef(gu,n-1,u),p)));\n wd = 0; for(n=0,DS-m-1, if(valuation(polcoef(gu,n,u),p)==e, wd=n));\n tot += m + wd;\n if(wd>0, rts = polrootspadic(gu/p^e, p, PR-10); rts = select(r->valuation(r,p)>=0, rts);\n if(#rts != wd, error(Str(\"roots not in Q_5 \", j, \" \", k, \" \", #rts, \" vs \", wd)));\n for(r=1,#rts, listput(L, [k, 5*rts[r]])));\n \\\\ exact residual zero at center beyond imposed order (rational sections)\n if(m > spec[j][2][k], for(r=1, m-spec[j][2][k], listput(L,[k,0]))));\n if(tot != N, error(Str(\"total zeros \",j,\" \",tot)));\n res[j] = L;\n for(k=1,7, Rm[j,k] += spec[j][2][k]); for(r=1,#L, Rm[j,L[r][1]] += 1);\n print(\"section \",j,\": residual zeros in \", vector(#L,r,nm[L[r][1]]), \" v(s)=\", vector(#L,r, if(L[r][2]==0,\"exact\",valuation(L[r][2],p)))));\nprint(\"relation matrix rows: \"); for(j=1,7, print(\" \", Rm[j,]));\nprint(\"det R = \", matdet(Rm));\n}\n\\\\ ---------- expansions at O\nTO = 44;\nv = 1+O(t^TO); for(it=1,8, v = v - (v^2*(v-1)+t^8+t^9)/(3*v^2-2*v));\nxt = t^-3*v; yt = -t^-4*v; om_t = deriv(xt,t)/(3*yt^2-1);\net_t = [5*xt^2*yt*om_t, 2*xt*yt*om_t, xt^2*om_t];\nRES = matrix(7,3); fO = vector(7);\n{\nfor(j=1,7, my(N=secs[j][1], f = evalf(secs[j][3], secs[j][2], xt, yt), U, lU);\n if(valuation(f,t)!=-N, error(\"pole order\")); fO[j] = polcoef(f,-N,t);\n U = f*t^N/fO[j]; lU = log(U);\n for(i=1,3, RES[j,i] = polcoef(lU*et_t[i], -1, t)));\n}\nTi = matrix(7,3); Te = matrix(7,3);\n{\nfor(j=1,7, for(r=1,#res[j], my(k=res[j][r][1], sr=res[j][r][2]);\n if(sr!=0, for(i=1,3, Ti[j,i] += evs(IOM[k][i], sr); Te[j,i] += evs(IET[k][i], sr)))));\n}\nRi = Rm^-1;\nIm5 = Ri*(-Ti);\nJm = Ri*(RES - Te);\nprint(\"relations (valuations): I(A)+3I(E) \", vector(3,i,valuation(Im5[1,i]+3*Im5[5,i],p)), \" I(C1)-3I(E)+I(B) \", vector(3,i,valuation(Im5[3,i]-3*Im5[5,i]+Im5[2,i],p)), \" I(F1)+I(E)+I(D) \", vector(3,i,valuation(Im5[6,i]+Im5[5,i]+Im5[4,i],p)));\nfleading(j,i) = { my(g = evalf(secs[j][3], secs[j][2], pts[i][1]+s, Yser[i]), m = ordc[j,i], b=pts[i][2]);\n polcoef(g,m,s)*(3*b^2-1)^m };\nnuser(i,k) = { my(a=pts[i][1], b=pts[i][2], Yk=Yser[k], ak=pts[k][1], S=Yk^2+b*Yk+b^2-1);\n if(k!=i && ak==a, if(polcoef(S,0,s)!=0, error(\"S0\")); S = (S - polcoef(S,0,s))/s * (1/(3*Yk^2-1)), S = S/((ak-a)+s)*(1/(3*Yk^2-1))); S };\nKm = matrix(7,7);\n{\nfor(i=1,7, my(rhs=vector(7)~);\n for(j=1,7, my(val = log(padic(fleading(j,i))) - log(padic(fO[j])));\n for(r=1,#res[j], my(k=res[j][r][1], sr=res[j][r][2], nu, tiny);\n if(sr==0, next);\n nu = nuser(i,k);\n if(k==i, my(rho = nu - 1/s); tiny = log(sr/(3*pts[i][2]^2-1)) + evs(intformal(rho), sr),\n tiny = evs(intformal(nu), sr));\n val -= tiny);\n rhs[j]=val);\n my(col = Ri*rhs); for(k=1,7, Km[i,k]=col[k]));\n}\nH = matrix(7,7,i,k, Km[i,k] - sum(l=1,3, Jm[i,l]*Im5[k,l]));\nprint(\"symmetry: min valuation of H - H~ : \", vecmin(vector(49,n, my(i=(n-1)\\7+1,k=(n-1)%7+1); valuation(H[i,k]-H[k,i],p))));\nbas = [5,2,4];\nIB = matrix(3,3,r,c, Im5[bas[r],c]); HB = matrix(3,3,r,c,H[bas[r],bas[c]]);\nMq = IB^-1*HB*(IB^-1)~;\nprint(\"5^-1 I_B mod 5: \", matrix(3,3,r,c, lift(Mod(truncate(IB[r,c]/5),5))), \" v(det I_B) = \", valuation(matdet(IB),p));\nprint(\"5M mod 5: \", matrix(3,3,r,c, lift(Mod(truncate(5*Mq[r,c]),5))), \" min v(M) = \", vecmin(vector(9,n,valuation(Mq[(n-1)\\3+1,(n-1)%3+1],p))));\ncorr = matrix(6,6); l2 = log(padic(2)); corr[1,3]=-l2; corr[3,1]=-l2; corr[4,6]=-l2; corr[6,4]=-l2;\n{ print(\"global consistency (36): min valuation: \", vecmin(vector(36,n, my(i=(n-1)\\6+1,k=(n-1)%6+1); valuation(H[i,k]+corr[i,k] - (Im5[i,]*Mq*Im5[k,]~), p)))); }\n{ print(\"basis coordinates of six points: \", vector(6,k, my(av=Im5[k,]*IB^-1); vector(3,i, my(z=av[i]); if(valuation(z,p)>=PR-12, 0, round(lift(Mod(truncate(z),5^10))) - if(lift(Mod(truncate(z),5^10))>5^10/2,5^10,0))))); }\nDU = 56;\n{\nallroots = List();\nfor(k=1,7, my(Ik = vector(3,i, Im5[k,i] + IOM[k][i]), tau, q, qu, e, red, rts, nadd=0, P);\n tau = H[k,k] - 2*sum(i=1,3, intformal(OM[k][i]*(Jm[k,i] + IET[k][i])));\n q = tau - Ik*Mq*Ik~;\n qu = substpol(q + O(s^DU), s, 5*u);\n qu = sum(n=0,DU-1, polcoef(qu,n,u)*u^n);\n e = vecmin(vector(DU-1,n, valuation(polcoef(qu,n,u),p)));\n red = sum(n=1,10, lift(Mod(truncate(polcoef(qu,n,u)/p^e),p))*u^n);\n my(tailmin = vecmin(vector(DU-1-10, n, valuation(polcoef(qu,n+10,u),p)-e)));\n print(nm[k],\": v(const)=\",valuation(polcoef(qu,0,u),p),\" e=\",e,\" reduction=\",red, \" min rel. val coeffs 11..: \",tailmin);\n if(k<7, P = sum(n=1,DU-1, polcoef(qu,n,u)/p^e*u^(n-1)), P = sum(n=0,DU-1, polcoef(qu,n,u)/p^e*u^n));\n rts = polrootspadic(P, p, 20);\n for(r=1,#rts, if(valuation(rts[r],p)>=0, nadd++; listput(allroots,[k,rts[r]])));\n print(\" additional roots in Z_5: \", nadd));\n}\nprint(\"additional roots: coordinates mod 5^8:\");\n{\nIBi = IB^-1;\nfor(r=1,#allroots, my(k=allroots[r][1], uu=allroots[r][2], Iv=vector(3,i, Im5[k,i]+evs(IOM[k][i], 5*uu)), av=Iv*IBi);\n print(\" disk \",nm[k],\": u = \", lift(Mod(truncate(uu),5^8)), \" a = \", vector(3,i, lift(Mod(truncate(av[i]),5^8)))));\n}\n" }, { "path": "anc/code/1.1.1/1.1.1j_count.cpp", "size_bytes": 1923, "sha256": "a27d148a2e827b494ea6de2c5cc1dea5d8102ba724a7b32c7c2b353b466ad272", "mode": 420, "language": "C++", "encoding": "utf-8", "text": "// Count points of y^3 - y + x^4 + x = 0 (plus one point at infinity) over F_{q^r}, r=1,2,3.\n#include \n#include \n#include \n#include \ntypedef long long ll;\nint q, r; std::vector mod; // monic irreducible of degree r: t^r = -sum mod[i] t^i\nstruct E { int c[3]; };\nstatic inline E mul(const E&a,const E&b){ ll t[5]={0,0,0,0,0};\n for(int i=0;i=r;k--){ ll v=t[k]%q; t[k]=0; for(int i=0;i=0;i--) v=v*q+a.c[i]; return v; }\nstatic E fromidx(ll v){E o; for(int i=0;i<3;i++)o.c[i]=0; for(int i=0;i1){ // find irreducible t^r + t + c or t^r - c\n bool found=false; for(int a=0;a1) mod[1]=a; if(irreducible()) found=true; }\n }\n ll N=1; for(int i=0;i hist(N,0);\n for(ll v=0;v0]\n assert len(pls)==1; return pls[0]\ndef val(n,l):\n v=0\n while n%l==0: n//=l; v+=1\n return v\nvs={l:val(N,l) for l in (2,3,5)}\nc=N//(2**vs[2]*3**vs[3]*5**vs[5])\ncof={2:3**vs[3]*5**vs[5], 3:2**vs[2]*5**vs[5], 5:2**vs[2]*3**vs[3]}\ngpts=[G.point(place_of(0,0)-O),G.point(place_of(-1,0)-O),G.point(place_of(0,-1)-O)]\nfor g in gpts: assert g.multiple(N)==G.zero()\nres={'q':q,'N':N,'v':vs,'tables':{},'points':{}}\nfor l in (2,3,5):\n if vs[l]==0: continue\n gens=[g.multiple(c*cof[l]) for g in gpts]\n # annihilation check by l^v\n for g in gens: assert g.multiple(l**vs[l])==G.zero()\n elems=[G.zero()]; index={G.zero():0}; nxt=[]\n k=0\n while k3 else 'work'\nos.makedirs(outdir,exist_ok=True)\njson.dump(res,open(os.path.join(outdir,f'sieve_data_{q}.json'),'w'))\nprint(q,\"done\",len(aff),\"affine points\", round(time.time()-t0,1),flush=True)\n" }, { "path": "anc/code/1.1.10/9111_chabauty.py", "size_bytes": 11259, "sha256": "cc2b0c011276d2fc9cfcc856a70ae742f98d0bdf63df0370e30ef39105f2ad23", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Exact Coleman and coefficient-congruence certificate for equation9111.\n\nRequires Python3 and cypari2 only. No input data, BNF cache, external research\nimports, floating point or network. Reconstructs four rational RR sections.\nThis local packet assumes rankJ(Q)<=2; the separate finite sieve completes it.\n\"\"\"\nimport json,math,sys\nfrom pathlib import Path\nfrom cypari2 import Pari\nP=Pari();P.allocatemem(100_000_000,silent=True)\nA=(-1,1);B=(1,-1)\n\nclass Quad:\n \"\"\"(Z/125Z)[s]/(s^2+767), unramified quadratic at5.\"\"\"\n M=125\n def __init__(self,a=0,b=0):\n if isinstance(a,Quad):a,b=a.a,a.b\n self.a,self.b=int(a)%self.M,int(b)%self.M\n def __add__(self,b):\n b=Quad(b);return Quad(self.a+b.a,self.b+b.b)\n __radd__=__add__\n def __neg__(self):return Quad(-self.a,-self.b)\n def __sub__(self,b):return self+-Quad(b)\n def __rsub__(self,b):return Quad(b)+-self\n def __mul__(self,b):\n b=Quad(b);return Quad(self.a*b.a-767*self.b*b.b,self.a*b.b+self.b*b.a)\n __rmul__=__mul__\n def __pow__(self,n,modulus=None):\n if n<0:\n u=pow((self.a*self.a+767*self.b*self.b)%self.M,-1,self.M)\n return Quad(self.a*u,-self.b*u)**(-n)\n a,b=Quad(1),self\n while n:\n if n&1:a=a*b\n b,n=b*b,n//2\n return a\n def __truediv__(self,b):return self*Quad(b)**-1\n def __mod__(self,m):\n assert self.M%m==0;return Quad(self.a%m,self.b%m)\n def __eq__(self,b):\n b=Quad(b);return self.a==b.a and self.b==b.b\n def __bool__(self):return bool(self.a or self.b)\n def pair(self):return[self.a,self.b]\n\n\ndef conv(a,b,n,mod=None):\n ans=[0]*n\n for i,v in enumerate(a[:n]):\n if v:\n for j,w in enumerate(b[:n-i]):ans[i+j]+=v*w\n return[v%mod for v in ans]if mod else ans\n\n\ndef branch(x0,y0,n,mod=None):\n \"\"\"y(x0+u) from F=x^4+y^3+2x+y-1, with unitFy.\"\"\"\n assert x0**4+y0**3+2*x0+y0-1==0 or mod\n w,w2=[0]*n,[0]*n\n qi=pow(3*y0*y0+1,-1,mod)if mod else P(1)/(3*y0*y0+1)\n for k in range(1,n):\n c2=sum(w[i]*w[k-i]for i in range(1,k))\n c3=sum(w2[i]*w[k-i]for i in range(1,k))\n rhs=(3*y0*c2+c3+(4*x0**3+2)*(k==1)+6*x0*x0*(k==2)\n +4*x0*(k==3)+(k==4))\n w[k],w2[k]=-qi*rhs,c2\n if mod:w[k],w2[k]=w[k]%mod,w2[k]%mod\n w[0]=y0;x=([x0,1]+[0]*n)[:n]\n if mod:\n f=[(a+b+2*c+d-(i==0))%mod for i,(a,b,c,d)in enumerate(zip(\n conv(conv(x,x,n,mod),conv(x,x,n,mod),n,mod),\n conv(conv(w,w,n,mod),w,n,mod),x,w))]\n assert all(v==0 for v in f)\n return x,w\n\n\ndef mons(N):\n return sorted([(i,j)for j in range(3)for i in range(N//3+1)\n if 3*i+4*j<=N],key=lambda m:3*m[0]+4*m[1])\n\n\ndef rows(mm,q,n,mod=None):\n if n==0:return[]\n x,y=branch(*q,n,mod)\n xp=[[math.comb(i,k)*q[0]**(i-k)for k in range(min(i,n-1)+1)]\n for i in range(max(i for i,j in mm)+1)]\n yp=[[1]+[0]*(n-1),y,conv(y,y,n,mod)]\n return[list(v)for v in zip(*[conv(xp[i],yp[j],n,mod)for i,j in mm])]\n\n\ndef rr_section(n,m):\n N=n+m+5;mm=mons(N)\n rr=rows(mm,A,n+2)+rows(mm,B,m)\n mat=P.matrix(len(rr),len(mm),[v for r in rr for v in r])\n ker=P.matker(mat);assert ker.ncols()==1\n cs=list(ker[0]);den=P(1)\n for c in cs:den=P.lcm(den,c.denominator())\n cs=[c*den for c in cs];g=P(0)\n for c in cs:g=P.gcd(g,c)\n cs=[int(c/g)for c in cs]\n assert cs[-1]!=0 and all(v==0 for v in mat*P.Col(cs))\n return dict(n=n,m=m,pole_order=N,monomials=mm,coefficients=cs,\n exact_kernel_dimension=1,exact_vanishing_verified=True)\n\n\ndef hs(rec,q,n,mod):\n return[sum(c*v for c,v in zip(rec['coefficients'],r))%mod\n for r in rows(rec['monomials'],q,n,mod)]\n\n\ndef at_infinity(rec,n,mod):\n # S=t^4/w=-1+O(t^8). All requested truncations have n<=4.\n assert n<=4\n out=[0]*n;N=rec['pole_order']\n for(i,j),c in zip(rec['monomials'],rec['coefficients']):\n e=N-3*i-4*j\n if e1 else Path(__file__).with_suffix('.json')\n target.write_text(json.dumps(out,indent=2)+'\\n')\n print(json.dumps(dict(logs3=d3['logs'],logs5=d5['logs'],pairs_mod45=pairs,\n output=str(target)),indent=2))\n print('ALL EXACT LOCAL ASSERTIONS PASSED; FINITE SIEVE AND RANK PREMISES REMAIN SEPARATE')\nif __name__=='__main__':main()\n" }, { "path": "anc/code/1.1.10/9111_finite_sieve.py", "size_bytes": 11867, "sha256": "478ff7b9d4c492bb066876e394ab795f484a063a77778994fad1e7c3d1df0772", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Exact small finite-field Jacobian arithmetic for x^4+y^3+2x+y-1.\n\nEffective divisors are reduced by two Riemann--Roch residual intersections.\nEvery residual intersection is checked by its complete degree, using all\nclosed points of degree <=3. No discrete-log assumption enters the group law.\n\"\"\"\nimport argparse,json,time,hashlib\nfrom functools import lru_cache\nfrom pathlib import Path\n\nclass Field:\n def __init__(self,p,d):\n self.p=p;self.d=d;self.q=p**d\n self.digits=[tuple((a//p**i)%p for i in range(d)) for a in range(self.q)]\n if d==1:self.poly=[0,1]\n elif d==2:\n b=next(a for a in range(2,p) if pow(a,(p-1)//2,p)==p-1)\n self.poly=[(-b)%p,0,1]\n else:\n self.poly=next([b,a,0,1] for a in range(p) for b in range(1,p)\n if all((x**3+a*x+b)%p for x in range(p)))\n def add(self,a,b):\n if self.d==1:return (a+b)%self.p\n return sum(((x+y)%self.p)*self.p**i for i,(x,y) in enumerate(zip(self.digits[a],self.digits[b])))\n def neg(self,a):return sum((-x%self.p)*self.p**i for i,x in enumerate(self.digits[a]))\n def sub(self,a,b):return self.add(a,self.neg(b))\n @lru_cache(maxsize=200000)\n def mul(self,a,b):\n if self.d==1:return a*b%self.p\n if not a or not b:return 0\n v=[0]*(2*self.d-1)\n for i,x in enumerate(self.digits[a]):\n for j,y in enumerate(self.digits[b]):v[i+j]+=x*y\n for i in range(len(v)-1,self.d-1,-1):\n v[i]%=self.p\n for j in range(self.d):v[i-self.d+j]-=v[i]*self.poly[j]\n return sum((v[i]%self.p)*self.p**i for i in range(self.d))\n def pow(self,a,n):\n v=1\n while n:\n if n&1:v=self.mul(v,a)\n a=self.mul(a,a);n//=2\n return v\n def inv(self,a):assert a;return self.pow(a,self.q-2)\n def scale(self,a,n):return self.mul(a,n%self.p)\n\ndef kernel(rows,n,p):\n piv={}\n for row in rows:\n row=row[:]\n for k in range(n):\n if not row[k]:continue\n if k in piv:\n u=row[k];row=[(a-u*b)%p for a,b in zip(row,piv[k])]\n else:\n u=pow(row[k],-1,p);piv[k]=[a*u%p for a in row];break\n if len(piv)==n:return None\n free=next(j for j in range(n) if j not in piv);v=[0]*n;v[free]=1\n for j in sorted(piv,reverse=True):v[j]=-sum(a*b for a,b in zip(piv[j][j+1:],v[j+1:]))%p\n assert all(sum(a*b for a,b in zip(v,row))%p==0 for row in rows)\n return v\n\nclass Jacobian:\n def __init__(self,p):\n self.p=p;self.fields={d:Field(p,d) for d in [1,2,3]};self.points=[];self.lookup={}\n self.series_cache={};self.eval_cache={};self.operations=0;self.closed_counts=[];self.audit=hashlib.sha256()\n for d,K in self.fields.items():\n ys={}\n for y in range(K.q):ys.setdefault(K.add(K.pow(y,3),y),[]).append(y)\n seen=set();count=1\n for x in range(K.q):\n target=K.sub(1,K.add(K.pow(x,4),K.scale(x,2)))\n for y in ys.get(target,[]):\n count+=1\n if d>1 and x

0\n degree+=d*v;v-=D.get(point,0);assert v>=0\n if v:result[point]=v\n assert degree==pole,(degree,pole,mons,vec,D,result)\n assert self.degree(result)==pole-self.degree(D)<=3\n self.audit.update(repr((sorted(D.items()),mons,vec,sorted(result.items()))).encode())\n return result\n def neg(self,D):return self.residual(D)\n def add(self,D,E):\n self.operations+=1;both=dict(D)\n for a,v in E.items():both[a]=both.get(a,0)+v\n return self.neg(self.residual(both))\n def mul(self,n,D):\n if n<0:return self.mul(-n,self.neg(D))\n out={}\n while n:\n if n&1:out=self.add(out,D)\n n//=2\n if n:D=self.add(D,D)\n return out\n def eq(self,D,E):return not self.add(D,self.neg(E))\n def external(self,D):return [[*self.points[j],v] for j,v in sorted(D.items())]\n\ndef main():\n start=time.monotonic()\n # Good reduction: Fy=1 at p3. For p>=5 eliminate the two gradient\n # equations; a singularity would give a common root of these polynomials.\n for p in [5,11,13]:\n a=[1,0,0,2];b=[124%p,-324%p,243%p]\n while b:\n while a and len(a)>=len(b):\n shift=len(a)-len(b);c=a[-1]*pow(b[-1],-1,p)%p\n for j,v in enumerate(b):a[j+shift]=(a[j+shift]-c*v)%p\n while a and not a[-1]:a.pop()\n a,b=b,a\n assert len(a)==1\n Js={p:Jacobian(p)for p in [3,5,11,13]}\n expected={3:28,5:64,11:2520,13:2912}\n # Store exact extension-field counts. Jacobian orders use Newton identities.\n for p,J in Js.items():\n print('FIELD',p,'COUNTS',J.closed_counts,'JORDER',J.order,flush=True)\n assert J.order==expected[p]\n A={p:J.onepoint(-1,1)for p,J in Js.items()};B={p:J.onepoint(1,-1)for p,J in Js.items()}\n J5=Js[5];J11=Js[11];J13=Js[13]\n assert not J5.mul(64,B[5]) and J5.mul(32,B[5])\n assert J5.eq(A[5],J5.mul(17,B[5]))\n # Characters to order2: the rows on(A,B) are(1,1) and(0,1).\n T5=J5.mul(32,B[5]);assert J5.eq(J5.mul(32,A[5]),T5)\n assert not J11.mul(1260,A[11]);T11=J11.mul(1260,B[11]);assert T11 and not J11.mul(2,T11)\n two_rows=[[1,1],[0,1]]\n print('TWO_SATURATION',two_rows,flush=True)\n # The two possible NEW p3/p5 Chabauty points have coefficients modulo45.\n candidates45=[(33,3),(3,13)]\n a45=J11.mul(56,A[11]);b45=J11.mul(56,B[11])\n assert not J11.mul(45,a45) and not J11.mul(45,b45)\n target45=[(pair,J11.add(J11.mul(pair[0],a45),J11.mul(pair[1],b45)))for pair in candidates45]\n matches45=[]\n for i,(d,x,y)in enumerate(J11.points):\n if d!=1:continue\n image=J11.mul(56,{i:1})\n pairs=[pair for pair,E in target45 if J11.eq(image,E)]\n if pairs:matches45.append(([x,y],pairs))\n assert matches45==[([3,4],[(3,13)])]\n assert all(not J11.eq({},E)for pair,E in target45)\n print('MOD45_SURVIVOR',matches45,flush=True)\n # Retain the full {2,3,5}-primary quotient of order360, projection[7].\n a360=J11.mul(7,A[11]);b360=J11.mul(7,B[11]);q360=J11.mul(7,J11.onepoint(3,4))\n assert not J11.mul(360,a360) and not J11.mul(360,b360) and not J11.mul(360,q360)\n candidates360=[];matches360=[]\n for i in range(8):\n for j in range(8):\n n=3+45*i;m=13+45*j\n if (17*n+m-1)%8:continue\n pair=[n,m];candidates360.append(pair)\n image=J11.add(J11.mul(n,a360),J11.mul(m,b360))\n if J11.eq(image,q360):matches360.append(pair)\n assert len(candidates360)==8 and matches360==[[228,13]]\n print('MOD360_SURVIVOR',matches360,flush=True)\n # Two independent finite7-characters prove seven-saturation.\n chars=[]\n for p,point in [(3,(0,2)),(11,(3,4))]:\n J=Js[p];assert J.order%7==0 and J.order%49!=0\n cofactor=J.order//7\n av=J.mul(cofactor,A[p]);bv=J.mul(cofactor,B[p]);qv=J.mul(cofactor,J.onepoint(*point))\n T=av;assert T and not J.mul(7,T)\n powers=[{}]\n for j in range(1,7):powers.append(J.add(powers[-1],T))\n def coordinate(D):\n hits=[j for j,E in enumerate(powers)if J.eq(D,E)];assert len(hits)==1;return hits[0]\n row=[coordinate(av),coordinate(bv),coordinate(qv)];chars.append(row)\n assert chars==[[1,4,2],[1,3,1]]\n det=(chars[0][0]*chars[1][1]-chars[0][1]*chars[1][0])%7;assert det==6\n n7=(chars[0][2]*chars[1][1]-chars[0][1]*chars[1][2])*pow(det,-1,7)%7\n m7=(chars[0][0]*chars[1][2]-chars[0][2]*chars[1][0])*pow(det,-1,7)%7\n assert [n7,m7]==[5,1]\n print('SEVEN_SATURATION_AND_COEFFICIENTS',chars,[n7,m7],flush=True)\n # Prime13: primary{2,7} quotient order224, projection[13].\n a224=J13.mul(13,A[13]);b224=J13.mul(13,B[13]);targets=[]\n assert not J13.mul(224,a224) and not J13.mul(224,b224)\n for i in range(4):\n n32=4+8*i;m32=(1-17*n32)%32\n n=n32+32*((n7-n32)*pow(32,-1,7)%7)\n m=m32+32*((m7-m32)*pow(32,-1,7)%7)\n targets.append(([n,m],J13.add(J13.mul(n,a224),J13.mul(m,b224))))\n assert [pair for pair,D in targets]==[[68,29],[12,85],[180,141],[124,197]]\n checks=[]\n for idx,(d,x,y)in enumerate(J13.points):\n if d!=1:continue\n image=J13.mul(13,{idx:1})\n matches=[pair for pair,D in targets if J13.eq(image,D)]\n assert not matches;checks.append([x,y])\n assert all(not J13.eq({},D)for pair,D in targets)\n assert len(checks)==15\n print('PRIME13_ALL16_POINT_IMAGES_EXCLUDED',flush=True)\n out=dict(equation='x^4+y^3+2x+y-1=0',conditional_input='rank(J(Q))<=2 and J(Q)[2]=0, plus the accompanying p3/p5 Chabauty congruences',\n finite_fields=[dict(prime=p,point_counts=J.closed_counts,jacobian_order=J.order,\n group_operations=J.operations,checked_residual_divisor_hash=J.audit.hexdigest())for p,J in Js.items()],\n two_saturation_rows=two_rows,p5_order_B=64,p5_relation_A_equals=17,\n mod45_candidates=candidates45,mod45_survivor=matches45,\n mod360_candidates=candidates360,mod360_survivor=matches360,\n seven_character_rows_A_B_Q=chars,seven_saturation_determinant=det,\n coefficients_mod7=[5,1],prime13_target_pairs=[pair for pair,D in targets],\n prime13_affine_points=checks,all_new_point_candidates_excluded=True,\n seconds=time.monotonic()-start)\n Path(__file__).with_suffix('.json').write_text(json.dumps(out,indent=2)+'\\n')\n print('ALL FINITE SIEVE ASSERTIONS PASSED',flush=True)\n\nif __name__=='__main__':main()\n" }, { "path": "anc/code/1.1.10/census_stream_9111.py", "size_bytes": 5237, "sha256": "d56e609a5a3d78b99e516cafa3cd773fcc6b875243f6f79d069e8a078d2730e1", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Exact resumable root-count census for the9111 strict-character criterion.\n\nEach prime is generated by PARI, and the number of degree-one primes in the\n27-dimensional bitangent field is counted by a polynomial gcd in FLINT. All\npolynomial-discriminant prime factors are below the default starting point.\nThe output records exact prime counts by root-count category in short rational\nmultiplicative intervals. Analytic weights are deliberately not evaluated here.\n\nExample:\n python census_stream_9111.py --workers 5\nNo network access or BNF data is used. Existing completed blocks are replayable\nindependently and are reused when the requested upper limit is extended.\n\"\"\"\nimport argparse,bisect,hashlib,json,math,multiprocessing as mp,os,struct,time\nfrom pathlib import Path\nfrom cypari2 import Pari\nfrom flint import nmod_poly\n\nCOEFF=[-32768,49152,0,-126976,0,0,221184,165888,0,-162816,-141312,-34560,0,0,0,-17280,0,0,-2688,480,0,0,0,0,0,0,0,1]\nBAD=[2,3,17,31,101,433,2341,2969,5227,924151]\nDISC_FACTORS=[(2,390),(3,54),(17,2),(31,6),(101,2),(433,6),(2341,6),(2969,2),(5227,2),(924151,2)]\nCATEGORIES=[0,1,2,3,5,7,9,15,27]\nLOWER_CHARACTER=[0,-1,-2,-3,-3,-5,-3,-5,-5]\nROOT=Path(__file__).resolve().parent\n_P=None;_EDGES=None\n\ndef edges(start,stop):\n result=[start]\n while result[-1]max(BAD) and args.stop>args.start\n check=Pari();f=check.Pol(COEFF[::-1])\n assert int(f.poldisc())==math.prod(p**e for p,e in DISC_FACTORS)\n assert all(check.isprime(p)for p,e in DISC_FACTORS)\n assert int(check.polisirreducible(f))==1\n args.output.mkdir(parents=True,exist_ok=True)\n metadata=dict(index=9111,polynomial_coefficients_ascending=COEFF,polynomial_discriminant_prime_factors=BAD,categories=CATEGORIES,lower_character_by_category=LOWER_CHARACTER,bin_ratio_numerator=10005,bin_ratio_denominator=10000,bin_origin=args.start)\n meta=args.output/'metadata.json'\n if meta.exists():assert json.loads(meta.read_text())==metadata\n else:meta.write_text(json.dumps(metadata,indent=2)+'\\n')\n blocks=[(lo,min(lo+args.block,args.stop))for lo in range(args.start,args.stop,args.block)]\n pending=[];done={};count=0;expected={}\n for lo,hi in blocks:\n path=args.output/f'block_{lo}_{hi}.json'\n if path.exists():\n rec=json.loads(path.read_text());assert(rec['lower'],rec['upper'])==(lo,hi)\n assert sum(sum(row)for a,b,row in rec['bins'])==rec['prime_count']\n if args.verify:expected[lo]=rec;pending.append((lo,hi))\n else:done[lo]=hi;count+=rec['prime_count']\n else:\n assert not args.verify,('missing expected block',str(path))\n pending.append((lo,hi))\n started=time.monotonic()\n print('START',args.start,args.stop,'BLOCKS',len(blocks),'REUSED',len(done),'WORKERS',args.workers,flush=True)\n with mp.get_context('spawn').Pool(args.workers,initializer=initialize,initargs=(args.start,args.stop)) as pool:\n for rec in pool.imap_unordered(run_block,pending,chunksize=1):\n lo=rec['lower'];hi=rec['upper'];path=args.output/f'block_{lo}_{hi}.json'\n if args.verify:\n for key in ['lower','upper','prime_count','sha256_prime_rootcount_stream','bins']:assert rec[key]==expected[lo][key],(lo,key)\n else:\n tmp=path.with_suffix('.tmp');tmp.write_text(json.dumps(rec,separators=(',',':'))+'\\n');os.replace(tmp,path)\n done[lo]=hi;count+=rec['prime_count'];prefix=args.start\n while prefix in done:prefix=done[prefix]\n print('BLOCK',lo,hi,'PRIMES',rec['prime_count'],'SECONDS',round(rec['seconds'],3),'COMPLETE',len(done),'PREFIX',prefix,'TOTAL_PRIMES',count,'WALL',round(time.monotonic()-started,2),flush=True)\n summary=dict(start=args.start,stop=args.stop,block_size=args.block,completed_blocks=len(done),total_primes=count,seconds=time.monotonic()-started)\n (args.output/f'summary_{args.start}_{args.stop}.json').write_text(json.dumps(summary,indent=2)+'\\n')\n print('COMPLETE',json.dumps(summary),flush=True)\n\nif __name__=='__main__':main()\n" }, { "path": "anc/code/1.1.10/certify_9111_principals_fast.py", "size_bytes": 13338, "sha256": "e7f61a6ae0c3cb83d3dba53e4f8e4ee4c851ab350a38d7f0f4c102a62d6ea4b7", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Exact prime-ideal principality certificate, using degree-one root HNFs.\n\nA locally constructed BNF object is used only to propose elements. Every accepted element is\nproved integral, proved to belong to its target ideal, and checked by exact\nnorm arithmetic. Strict cofactor descent proves principality by induction.\nThe default run starts from norm one and needs no earlier certificate.\n\nExample of an incremental run:\n python certify_9111_principals_fast.py --bound 15000000 --workers 4 \\\n --previous-bound 1000000 --previous-certificate previous.json\nThe previous certificate is checked when the extension finishes. Its\nseparate exact replay remains part of an incremental certificate.\n\"\"\"\nimport argparse\nimport hashlib\nimport json\nimport math\nimport multiprocessing as mp\nimport os\nimport time\nfrom pathlib import Path\n\nfrom cypari2 import Pari\nfrom flint import nmod_poly\n\nPOLYNOMIAL = ('x^27 + 480*x^19 - 2688*x^18 - 17280*x^15 - 34560*x^11 '\n '- 141312*x^10 - 162816*x^9 + 165888*x^7 + 221184*x^6 '\n '- 126976*x^3 + 49152*x - 32768')\nP = nf = bnf = None\nBOUND = PREVIOUS = DEN = None\nCOEFFICIENTS = ROWS = None\n\n\ndef initialize(bound, previous):\n global P, nf, bnf, BOUND, PREVIOUS, DEN, COEFFICIENTS, ROWS\n BOUND, PREVIOUS = bound, previous\n P = Pari()\n P.allocatemem(350_000_000, 800_000_000, silent=True)\n P.set_real_precision(80)\n P.setrand(1)\n nf = P.nfinit(P(POLYNOMIAL))\n bnf = P.bnfinit(nf, 1)\n assert bnf[6][0] == nf[0]\n assert bnf[6].nf_get_zk() == nf.nf_get_zk()\n zk = list(nf.nf_get_zk())\n assert zk[0] == 1\n raw = [[P.polcoef(z, j) for j in range(27)] for z in zk]\n DEN = math.lcm(*(int(c.denominator()) for row in raw for c in row))\n ROWS = [[int(c * DEN) for c in row] for row in raw]\n COEFFICIENTS = [int(P.polcoef(nf[0], j)) for j in range(28)]\n\n\ndef root_ideals(p):\n \"\"\"All degree-one primes above p, in the certified integral basis.\"\"\"\n assert DEN % p\n inverse = pow(DEN, -1, p)\n roots = nmod_poly(COEFFICIENTS, p).roots()\n if not roots:\n return\n reduced_rows = [[c % p for c in row] for row in ROWS]\n for root, multiplicity in sorted(roots, key=lambda pair: int(pair[0])):\n root = int(root)\n values = []\n for row in reduced_rows:\n z = 0\n for coefficient in reversed(row):\n z = (z * root + coefficient) % p\n values.append(z * inverse % p)\n assert values[0] == 1\n # Column-HNF of the kernel of O_K --> F_p, alpha |--> root.\n entries = [0] * 729\n entries[0] = p\n for j in range(1, 27):\n entries[j] = -values[j] % p\n entries[27 * j + j] = 1\n hnf = P.matrix(27, 27, entries)\n yield hnf, values, root\n\n\ndef element_from_proposal(ideal):\n proposed = P.bnfisprincipal(bnf, ideal, 4)\n g = proposed[1]\n if g.type() == 't_MAT':\n value = P(1)\n for j in range(g.nrows()):\n value = P.nfeltmul(nf, value,\n P.nfeltpow(nf, g[j, 0], int(g[j, 1])))\n g = value\n return g\n\n\ndef checked_coordinates(g, ideal, values):\n coordinates = P.nfalgtobasis(nf, g)\n assert all(c.denominator() == 1 for c in coordinates)\n result = [int(c) for c in coordinates]\n assert any(result)\n if values is None:\n assert int(P.nfeltval(nf, g, ideal)) >= 1\n else:\n p = int(ideal[0, 0])\n assert sum(c * v for c, v in zip(result, values)) % p == 0\n return result\n\n\ndef certify_one(ideal, p, degree, values, root):\n q = p ** degree\n g = P.idealmin(nf, ideal)\n norm = abs(int(P.nfeltnorm(nf, g)))\n assert norm > 0 and norm % q == 0\n cofactor = norm // q\n factorization = P.factor(cofactor)\n factors = [(int(factorization[i, 0]), int(factorization[i, 1]))\n for i in range(factorization.nrows())]\n if all(r ** e < q for r, e in factors):\n coordinates = checked_coordinates(g, ideal, values)\n assert all(P.isprime(r) for r, e in factors)\n assert math.prod(r ** e for r, e in factors) == cofactor\n method = 'strict'\n else:\n g = element_from_proposal(ideal)\n coordinates = checked_coordinates(g, ideal, values)\n assert abs(P.nfeltnorm(nf, g)) == q\n factors = []\n method = 'direct'\n # A root target's complete HNF is uniquely specified by p and values.\n target = (['root', root, values] if values is not None\n else ['prid', str(P.idealhnf(nf, ideal))])\n return [p, degree, target, coordinates, factors, method], method\n\n\ndef block(task):\n kind, lo, hi = task\n began = time.monotonic()\n digest = hashlib.sha256()\n ideals = strict = direct = rational_primes = 0\n degree_counts = {}\n for prime in P.primes([lo, hi]):\n p = int(prime)\n rational_primes += 1\n if kind == 'higher' or p * p <= BOUND or DEN % p == 0:\n targets = [(pr, int(pr[3]), None, None)\n for pr in P.idealprimedec(nf, p)]\n else:\n targets = [(hnf, 1, values, root)\n for hnf, values, root in root_ideals(p)]\n for ideal, degree, values, root in targets:\n q = p ** degree\n if not PREVIOUS < q <= BOUND:\n continue\n ideals += 1\n degree_counts[degree] = degree_counts.get(degree, 0) + 1\n record, method = certify_one(ideal, p, degree, values, root)\n strict += method == 'strict'\n direct += method == 'direct'\n digest.update(json.dumps(record, separators=(',', ':')).encode())\n digest.update(b'\\n')\n return dict(kind=kind, lo=lo, hi=hi, rational_primes=rational_primes,\n prime_ideals=ideals, strict_witnesses=strict,\n direct_generators=direct, by_residue_degree=degree_counts,\n witness_sha256=digest.hexdigest(),\n seconds=time.monotonic() - began)\n\n\ndef write_checkpoint(path, result):\n temporary = path.with_name(path.name + '.tmp')\n temporary.write_text(json.dumps(result, indent=2) + '\\n')\n os.replace(temporary, path)\n\n\ndef checked_completed_blocks(result, tasks):\n \"\"\"Check checkpoint structure and exact, nonoverlapping task coverage.\"\"\"\n expected = set(tasks)\n completed = set()\n for row in result['blocks']:\n task = (row['kind'], row['lo'], row['hi'])\n assert task in expected and task not in completed\n completed.add(task)\n assert type(row['rational_primes']) is int and row['rational_primes'] >= 0\n for key in ('prime_ideals', 'strict_witnesses', 'direct_generators'):\n assert type(row[key]) is int and row[key] >= 0\n assert row['prime_ideals'] == row['strict_witnesses'] + row['direct_generators']\n assert all(int(degree) >= 1 and type(count) is int and count >= 0\n for degree, count in row['by_residue_degree'].items())\n assert sum(row['by_residue_degree'].values()) == row['prime_ideals']\n digest = row['witness_sha256']\n assert len(digest) == 64 and all(c in '0123456789abcdef' for c in digest)\n assert row['seconds'] >= 0\n return completed\n\n\ndef check_previous_certificate(args, result):\n if not args.previous_bound:\n return 0\n previous_bytes = args.previous_certificate.read_bytes()\n previous = json.loads(previous_bytes)\n assert previous['all_passed']\n assert previous['bound'] == args.previous_bound\n assert previous['discriminant'] == result['discriminant']\n assert previous['polynomial'] == result['polynomial']\n digest = hashlib.sha256(previous_bytes).hexdigest()\n if 'previous_certificate_sha256' in result:\n assert result['previous_certificate_sha256'] == digest\n result['previous_certificate'] = args.previous_certificate.name\n result['previous_certificate_sha256'] = digest\n result['previous_prime_ideals'] = previous['prime_ideals_verified']\n return previous['prime_ideals_verified']\n\n\ndef main():\n ap = argparse.ArgumentParser(description=__doc__)\n ap.add_argument('--bound', type=int, default=15_000_000)\n ap.add_argument('--workers', type=int, default=4)\n ap.add_argument('--block-size', type=int, default=20_000)\n ap.add_argument('--previous-bound', type=int, default=0)\n ap.add_argument('--previous-certificate', type=Path)\n ap.add_argument('--resume', action='store_true',\n help='validate the existing output checkpoint and run only missing blocks')\n ap.add_argument('--output', type=Path,\n default=Path('9111_principals_fast_verified.json'))\n args = ap.parse_args()\n assert 0 <= args.previous_bound < args.bound\n assert (args.previous_certificate is not None) == (args.previous_bound > 0)\n check = Pari()\n check.allocatemem(400_000_000, 800_000_000, silent=True)\n field = check.nfinit(check(POLYNOMIAL))\n assert check.polisirreducible(field[0])\n assert len(check.nfcertify(field)) == 0\n discriminant = check(2) ** 30 * check(31) ** 6 * check(433) ** 6 * check(2341) ** 6\n assert field.disc() == discriminant\n assert [int(v) for v in field.nf_get_sign()] == [3, 12]\n tasks = [('primes', lo, min(lo + args.block_size - 1, args.bound))\n for lo in range(max(2, args.previous_bound + 1),\n args.bound + 1, args.block_size)]\n upper = min(args.previous_bound, math.isqrt(args.bound))\n if upper >= 2:\n tasks.insert(0, ('higher', 2, upper))\n metadata = dict(polynomial=POLYNOMIAL, degree=27, signature=[3, 12],\n discriminant=str(discriminant), maximal_order_certified=True,\n pari_version=str(check.version()), bound=args.bound,\n previous_bound=args.previous_bound, block_size=args.block_size)\n if args.resume:\n result = json.loads(args.output.read_text())\n assert all(result[key] == value for key, value in metadata.items())\n completed = checked_completed_blocks(result, tasks)\n earlier_elapsed = float(result['elapsed_seconds'])\n assert earlier_elapsed >= 0\n if result['all_passed']:\n assert completed == set(tasks)\n total = sum(row['prime_ideals'] for row in result['blocks'])\n total += check_previous_certificate(args, result)\n assert total == result['prime_ideals_verified']\n print('EXISTING COMPLETE CERTIFICATE VALIDATED:', total, 'prime ideals.', flush=True)\n return\n # If available, verify and bind the completed earlier norm range now.\n check_previous_certificate(args, result)\n else:\n result = dict(metadata, workers=args.workers, blocks=[], all_passed=False)\n completed = set()\n earlier_elapsed = 0.0\n remaining = [task for task in tasks if task not in completed]\n result['workers'] = args.workers\n result.setdefault('run_history', []).append(dict(workers=args.workers,\n completed_blocks_at_start=len(completed),\n missing_blocks=len(remaining),\n process_id=os.getpid()))\n result['prime_ideals_verified'] = sum(row['prime_ideals'] for row in result['blocks'])\n result['elapsed_seconds'] = earlier_elapsed\n began = time.monotonic()\n args.output.parent.mkdir(parents=True, exist_ok=True)\n write_checkpoint(args.output, result)\n if args.resume:\n print('RESUMING', len(completed), 'completed blocks;', len(remaining),\n 'remaining with', args.workers, 'workers.', flush=True)\n with mp.Pool(args.workers, initializer=initialize,\n initargs=(args.bound, args.previous_bound)) as pool:\n for item in pool.imap_unordered(block, remaining, chunksize=1):\n result['blocks'].append(item)\n result['blocks'].sort(key=lambda row: (row['kind'], row['lo']))\n result['prime_ideals_verified'] = sum(r['prime_ideals'] for r in result['blocks'])\n result['elapsed_seconds'] = earlier_elapsed + time.monotonic() - began\n write_checkpoint(args.output, result)\n print(json.dumps(dict(block=[item['kind'], item['lo'], item['hi']],\n completed=len(result['blocks']), total=len(tasks),\n ideals=result['prime_ideals_verified'],\n seconds=round(result['elapsed_seconds'], 2))), flush=True)\n assert checked_completed_blocks(result, tasks) == set(tasks)\n result['extension_prime_ideals'] = result['prime_ideals_verified']\n result['prime_ideals_verified'] += check_previous_certificate(args, result)\n result['all_passed'] = True\n result['elapsed_seconds'] = earlier_elapsed + time.monotonic() - began\n result['total_strict_witnesses_extension'] = sum(r['strict_witnesses'] for r in result['blocks'])\n result['total_direct_generators_extension'] = sum(r['direct_generators'] for r in result['blocks'])\n write_checkpoint(args.output, result)\n print('ALL PRIME IDEALS THROUGH NORM', args.bound, 'PROVED PRINCIPAL:',\n result['prime_ideals_verified'], 'in', result['elapsed_seconds'], 'seconds.', flush=True)\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.1.10/low_norm_census_9111.py", "size_bytes": 4990, "sha256": "184310e6a3fad2d6f919381dba3f4a3d645aef273108972e332afc4dd57d3d7a", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Exact low-norm and higher-residue-degree census for the9111 class criterion.\n\nThe default replay regenerates every needed prime-ideal count. For a quick\nresearch run, --reuse-census may refer to a previously regenerated full census\nof prime-ideal norms through at least15m; all low-prime data are still checked.\nOutput keeps norms≤sqrt(support) exact and bins the larger known-principal\nnorms, which can contribute only their first powers to the explicit formula.\n\"\"\"\nimport argparse,bisect,hashlib,json,math,os,struct,time\nfrom collections import Counter\nfrom pathlib import Path\nfrom cypari2 import Pari\nfrom flint import nmod_poly\n\nCOEFF=[-32768,49152,0,-126976,0,0,221184,165888,0,-162816,-141312,-34560,0,0,0,-17280,0,0,-2688,480,0,0,0,0,0,0,0,1]\nDISC_FACTORS=[(2,390),(3,54),(17,2),(31,6),(101,2),(433,6),(2341,6),(2969,2),(5227,2),(924151,2)]\nROOT=Path(__file__).resolve().parent\n\ndef main():\n ap=argparse.ArgumentParser(description=__doc__)\n ap.add_argument('--cutoff',type=int,default=15000000)\n ap.add_argument('--support',type=int,default=100000000000)\n ap.add_argument('--reuse-census',type=Path)\n ap.add_argument('--output',type=Path,default=ROOT/'9111_low_norm_census.json')\n ap.add_argument('--higher-output',type=Path,default=ROOT/'9111_higher_norms.json')\n a=ap.parse_args();start=time.monotonic();P=Pari();P.allocatemem(300000000,1000000000,silent=True)\n f=P.Pol(COEFF[::-1]);assert int(f.poldisc())==math.prod(p**e for p,e in DISC_FACTORS)\n assert all(P.isprime(p)for p,e in DISC_FACTORS)\n assert int(P.polisirreducible(f))==1\n nf=P.nfinit(f);assert abs(int(nf[2]))==2**30*31**6*433**6*2341**6\n assert len(P.nfcertify(nf))==0\n assert int(nf[2])*int(nf[3])**2==int(f.poldisc())\n assert[int(v)for v in nf[1]]==[3,12]\n bad={p for p,e in DISC_FACTORS};small_limit=math.isqrt(a.support)\n assert small_limit=2 and q<=a.support:higher[q]+=1\n partial=dict(known)\n if a.reuse_census:\n supplied={int(q):int(c)for q,c in json.loads(a.reuse_census.read_text())if int(q)<=a.cutoff}\n for q,c in partial.items():assert supplied[q]==c,(q,c,supplied.get(q))\n assert {q:c for q,c in supplied.items()if q<=small_limit}=={q:c for q,c in partial.items()if q<=small_limit}\n for p in bad:\n if small_limit>i)&1 for i in range(6)]\n return (b[0]*b[1]+b[2]*b[3]+b[4]*b[5]+b[4]+b[5])&1\n\ndef bil(x,y):return q(x^y)^q(x)^q(y)\n\ndef elements(mask):\n while mask:\n bit=mask&-mask\n yield bit.bit_length()-1\n mask-=bit\n\nisotropic=sum(1<>v)&1:continue\n V=U|sum(1<<(u^v)for u in members)\n assert V.bit_count()==1<<(dim+1)\n following.add(V)\n levels.append(following)\nassert [len(L)for L in levels]==[1,63,651,1395,651,63,1]\nrecord={}\nfor dim,spaces in enumerate(levels):\n for U in spaces:\n S=U&isotropic;r=S.bit_count()\n minimum=min(r-2*(S&mask).bit_count()for mask in negative)\n rec=record.setdefault(r,{'minimum':minimum,'subspaces':0,'dimensions':set()})\n rec['minimum']=min(rec['minimum'],minimum)\n rec['subspaces']+=1;rec['dimensions'].add(dim)\nexpected={0:0,1:-1,2:-2,3:-3,5:-3,7:-5,9:-3,11:-5,15:-5,27:-5}\nassert {r:s['minimum']for r,s in record.items()}==expected\nfor rec in record.values():rec['dimensions']=sorted(rec['dimensions'])\nresult={'quadratic_form':'x0*x1+x2*x3+x4*x5+x4+x5','isotropic_nonzero_vectors':27,\n 'number_of_subspaces':sum(map(len,levels)),'subspaces_by_dimension':list(map(len,levels)),\n 'trace_bounds':{str(r):s for r,s in sorted(record.items())},'universal_lower_bound':-5,'all_checks_passed':True}\nPath(__file__).with_suffix('.json').write_text(json.dumps(result,indent=2)+'\\n')\nprint(json.dumps(result,indent=2))\n" }, { "path": "anc/code/1.1.10/verify_9111_descent.py", "size_bytes": 8079, "sha256": "4e587223ad75cc79ef15c23f73859682d83105caf21da152a807e2e0f03f31b9", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Exact unconditional geometry and dyadic ingredients for equation 9111.\n\nThe strict-character argument supplies the rank bound separately.\nThis replay makes no class-number parity or global squareclass-completeness\nclaim. The explicit input needs no BNF cache or external service.\nDependencies: SymPy and PARI through cypari2.\n\"\"\"\nfrom pathlib import Path\nimport json,time\nimport sympy as s\nfrom cypari2 import Pari\n\ndef span(rows):\n piv={}\n for row in rows:\n while row:\n j=row.bit_length()-1\n if j in piv:row^=piv[j]\n else:piv[j]=row;break\n return piv\n\ndef q(v):\n b=[v>>j&1 for j in range(6)]\n return(b[0]*b[1]+b[2]*b[3]+b[4]*b[5]+b[4]+b[5])%2\n\ndef main():\n started=time.monotonic()\n path=Path(__file__).with_name('9111_descent_data.json')\n data=json.loads(path.read_text());assert data['index']==9111\n P=Pari();P.allocatemem(900_000_000,silent=True)\n x,y,m,z,t,w=s.symbols('x y m z t w')\n F=x**4+y**3+2*x+y-1\n chart=t**4+w+2*t*w**3+w**3-w**4\n assert s.diff(chart,w).subs({t:0,w:0})==1\n # At an odd-characteristic singular point, 2*x^3+1=0 and\n # 4*y=6-9*x. Substituting the latter in Fy gives G/16.\n Q=2*x**3+1;G=243*x*x-324*x+124\n assert s.expand(6*F-9*x-4*y+6\n -s.Rational(3,2)*x*s.diff(F,x)-2*y*s.diff(F,y))==0\n assert s.expand(3*(6-9*x)**2+16)==G\n bad=[31,433,2341]\n assert int(s.resultant(Q,G,x))==31*433*2341\n nodes=[]\n for pp in bad:\n assert P.isprime(pp)\n gg=s.gcd(s.Poly(Q,x,modulus=pp),s.Poly(G,x,modulus=pp)).monic()\n assert gg.degree()==1\n xx=(-int(gg.nth(0)))%pp;yy=(6-9*xx)*pow(4,-1,pp)%pp\n x0,y0=xx,yy\n assert(xx**4+yy**3+2*xx+yy-1)%pp==0\n det=(72*xx*xx*yy)%pp;assert det\n for k in range(1,4):\n mod=pp**k\n assert (4*xx**3+2)%mod==(3*yy*yy+1)%mod==0\n dx=-(4*xx**3+2)//mod*pow(12*xx*xx%pp,-1,pp)%pp\n dy=-(3*yy*yy+1)//mod*pow(6*yy%pp,-1,pp)%pp\n xx+=dx*mod;yy+=dy*mod\n fv=(xx**4+yy**3+2*xx+yy-1)%(pp**4)\n assert fv%pp==0 and fv%(pp*pp)!=0\n nodes.append(dict(p=pp,x=x0,y=y0,hessian=det,critical_x=str(xx),\n critical_y=str(yy),value_mod_p4=str(fv),thickness=1))\n # The unique ordinary node of thickness one gives a geometrically\n # irreducible fiber and trivial component group. Finite support is {2}.\n A=12*m**5*z-m**9-24*m*z*z-8*m-16\n B=(12*m*m*z-m**6)**2-64*(z**3+z-1)\n elim=s.Poly(s.resultant(A,B,z),m).monic()\n pol=P(data['polynomial']);assert pol.poldegree()==27 and P.polisirreducible(pol)==1\n assert P(str(elim.as_expr()).replace('m','x').replace('**','^'))==pol\n nf=P.nfinit(pol);assert len(P.nfcertify(nf))==0\n assert str(nf.disc())==data['discriminant']\n assert int(nf.disc())==2**30*31**6*433**6*2341**6\n assert [int(v)for v in nf.nf_get_sign()]==[3,12]\n mm=P.Mod(P('x'),pol)\n eta=mm*(11*mm**12+112*mm**4+224*mm**3-192)/(8*(13*mm**9-16*mm+16))\n aa=mm**3/2;bb=(12*mm*mm*eta-mm**6)/8\n assert 2*aa*bb==3*mm*eta**2+mm+2\n assert bb*bb==eta**3+eta-1 and aa*aa-4*bb!=0\n isotropic=[v for v in range(1,64)if q(v)==0];assert len(isotropic)==27\n code=[sum((q(v^u)^q(v)^q(u))<>j&1:\n for key,pp,val in items:\n old=parities.get(key,[pp,0]);old[1]^=val%2;parities[key]=old\n assert all(pp==2 or parity==0 for pp,parity in parities.values())\n prs=P.idealprimedec(nf,2)\n assert sorted((int(pr[2]),int(pr[3]))for pr in prs)==[(1,3),(8,3)]\n assert sum(data['signature'])+len(prs)==17\n local_data=[];offset=0\n for pr in prs:\n e,f=int(pr[2]),int(pr[3]);pi=pr[1];assert P.nfeltval(nf,pi,pr)==1\n bid=P.idealstar(nf,P.idealpow(nf,pr,2*e+1),2,2)\n assert all(int(a)==2 for a in bid.bid_get_cyc())\n dim=len(bid.bid_get_cyc())+1;assert dim==e*f+2\n local_data.append((pr,pi,bid,dim,offset));offset+=dim\n assert offset==31\n def char(value):\n out=0\n for pr,pi,bid,dim,shift in local_data:\n val=int(P.nfeltval(nf,value,pr))\n unit=P.nfeltmul(nf,value,P.nfeltpow(nf,pi,-val))\n log=P.ideallog(nf,unit,bid)\n out^=((val%2)+sum((int(v)%2)<<(j+1)for j,v in enumerate(log)))<>j&1:im^=ch\n global_images.append(im)\n assert len(span(global_images))==17\n # The local orbits have lengths3,24. No union has code weight12 or16,\n # so J(Q2)[2]=0 and J(Q2)/2 has dimension3.\n lengths=[int(pr[2])*int(pr[3])for pr in prs]\n assert sorted(lengths)==[3,24]\n assert all(sum(lengths[j]for j in range(2)if a>>j&1)not in[12,16]\n for a in range(1,4))\n points=[];point_images=[];N=int(data['precision']);assert N>=48\n xx=int(data['even_y_witness_x']);assert xx%2\n yy=0\n for k in range(1,N):\n if(xx**4+yy**3+2*xx+yy-1)>>k&1:yy+=1<val+2*int(pr[2])for pr,val in zip(prs,vals))\n im=char(h);point_images.append(im)\n points.append(dict(x=xx,y_mod_2N=str(yy),precision=N,valuations=vals,image=im))\n for yy in data['odd_y_witness_y']:\n assert yy%2;xx=1\n # F(1+2u,y)/4 is an integral polynomial with derivative2*x^3+1 odd.\n assert(1+yy**3+2+yy-1)%4==0\n for k in range(N-1):\n if(xx**4+yy**3+2*xx+yy-1)>>(k+2)&1:xx+=1<<(k+1)\n assert(xx**4+yy**3+2*xx+yy-1)%(1<<(N+1))==0\n h=mm*xx+eta-yy;vals=[int(P.nfeltval(nf,h,pr))for pr in prs]\n errors=[int(P.nfeltval(nf,mm,pr))+int(pr[2])*N for pr in prs]\n assert all(err>val+2*int(pr[2])for pr,val,err in zip(prs,vals,errors))\n im=char(h);point_images.append(im)\n points.append(dict(x_mod_2N=str(xx),y=yy,precision=N,valuations=vals,\n error_valuations=errors,image=im))\n assert len(span(point_images))==3\n union_rank=len(span(global_images+point_images));assert union_rank==18\n assert 17+3-union_rank==2\n # Use the actual rational point classes for strictification. Membership\n # in the dyadic span does not assert equality in the global squareclass\n # group; Hilbert reciprocity supplies the joint localization statement.\n rational_points=[];rational_images=[]\n for label,xx,yy,expected in [('A',-1,1,974967040),('B',1,-1,704753920)]:\n assert xx**4+yy**3+2*xx+yy-1==0\n h=mm*xx+eta-yy;assert h!=0\n im=char(h);assert im==expected\n assert len(span(global_images+[im]))==17\n assert len(span(point_images+[im]))==3\n rational_images.append(im)\n rational_points.append(dict(label=label,x=xx,y=yy,image=im))\n assert len(span(rational_images))==2\n out=dict(index=9111,finite_support=[2],nodes=nodes,bitangent_degree=27,\n signature=[3,12],discriminant=str(nf.disc()),code_dimension=6,code_weights=[12,16],\n certificate_scope='Unconditional geometry and dyadic ingredients; the separate strict-character argument supplies the rank bound.',\n known_independent_S_squareclasses=17,\n dyadic_fields=[dict(e=int(pr[2]),f=int(pr[3]),dimension=d)for pr,pi,bid,d,shift in local_data],\n dyadic_squareclass_dimension=31,global_images=global_images,\n global_independence_rank=17,witnesses=points,local_dimension=3,union_rank=union_rank,\n intersection_dimension=2,rational_point_images=rational_points,\n rational_point_image_rank=2,seconds=round(time.monotonic()-started,3),\n conclusion='All geometry and dyadic ingredients are unconditional; the rank conclusion belongs to the separate strict-character argument.')\n path.with_name('9111_descent_verified.json').write_text(json.dumps(out,indent=2)+'\\n')\n print(json.dumps(out,indent=2))\n print('ALL EXACT GEOMETRY AND DYADIC ARITHMETIC ASSERTIONS PASSED; STRICT-CHARACTER RANK ARGUMENT IS SEPARATE')\n\nif __name__=='__main__':main()\n" }, { "path": "anc/code/1.1.10/verify_9111_strict_window.py", "size_bytes": 9061, "sha256": "a76c64c1536a22c83bd33ade03b804da02a82f942b7214e38ae73a81633da4f4", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Arb verification of the strict-Selmer character inequality for equation 9111.\n\nThe mathematical premises are proved separately: every prime ideal through the\nstated cutoff is principal, and a remaining strict Selmer character has the\ndegree-one trace bounds in verify_9111_code_bound.py. This does not assert that\nthe entire class group has odd order. All analytic arithmetic uses Arb balls.\nThe census producers reconstruct the low-norm data and every recorded block;\nthe companion driver runs those exact replays before this analytic stage.\n\"\"\"\nimport argparse, json, math, time\nfrom pathlib import Path\nfrom flint import arb, ctx\n\nROOT = Path(__file__).resolve().parent\nBASE = ROOT\n\ndef main():\n ap=argparse.ArgumentParser(description=__doc__)\n ap.add_argument('--spec',type=Path,default=ROOT/'9111_strict_window.json')\n ap.add_argument('--low-norms',type=Path,default=BASE/'9111_low_norm_census.json')\n ap.add_argument('--higher-norms',type=Path,default=BASE/'9111_higher_norms.json')\n ap.add_argument('--census',type=Path,default=BASE/'9111_census_blocks')\n ap.add_argument('--output',type=Path,default=ROOT/'9111_strict_window_verified.json')\n ap.add_argument('--require-positive',action='store_true')\n args=ap.parse_args(); began=time.monotonic(); ctx.prec=224\n spec=json.loads(args.spec.read_text())\n assert spec['index']==9111\n expected_coefficients=[-32768,49152,0,-126976,0,0,221184,165888,0,-162816,-141312,-34560,0,0,0,-17280,0,0,-2688,480,0,0,0,0,0,0,0,1]\n n=27; D=2**30*31**6*433**6*2341**6\n support=int(spec['support']); cutoff=int(spec['principal_cutoff'])\n assert 10**9<=support<=10**12 and cutoff>=10**6 and cutoff**2>support\n heights=list(map(int,spec['heights'])); N=len(heights)\n assert N==128 and all(h>0 for h in heights)\n den=sum(h*h for h in heights)\n knots=[sum(heights[i]*heights[i+k] for i in range(N-k)) for k in range(N+1)]\n assert knots[0]==den and knots[N]==0\n assert all(knots[k]>=knots[k+1]>=0 for k in range(N))\n extended=knots+[0]\n weights=[k*(extended[k-1]-2*extended[k]+extended[k+1]) for k in range(1,N+1)]\n assert sum(weights)==den\n T=arb(support).log(); delta=T/N; delta_float=math.log(support)/N\n alpha=arb(3)/n\n C=arb.const_euler()+(4*arb.pi()).log()+alpha-arb(D).log()/n\n arch=arb(0)\n for k,w in enumerate(weights,1):\n A=k*delta; z=(-A).exp()\n triangle=C-arb.pi()**2/(4*A)-2*alpha*arb(2).log()/A+2/A*(z.polylog(2)-(z*z).polylog(2)/4)+2*alpha/A*z.log1p()\n arch+=(arb(w)/den)*triangle\n\n def window(logq, approximate):\n k=int(approximate/delta_float)\n assert 0<=kk*delta and logq<(k+1)*delta\n value=(arb(knots[k])+(logq-k*delta)/delta*(knots[k+1]-knots[k]))/den\n assert value>0\n return value\n\n principal_sum=arb(0); principal_ideals=0; principal_power_terms=0\n low=json.loads(args.low_norms.read_text())\n positive_bins=[]; expected_known=None; low_stream_hash=None; low_higher=None\n if isinstance(low,dict) and 'small_exact_known_norms' in low:\n assert low['principal_cutoff']==cutoff and low['support']==support\n assert low['field_discriminant']==D and low['signature']==[3,12]\n assert low['polynomial_coefficients_ascending']==expected_coefficients\n assert low['small_exact_limit']==math.isqrt(support)\n positive_bins=low['large_known_norm_bins']\n expected_known=low['total_known_prime_ideals']\n low_stream_hash=low['sha256_complete_known_norm_count_stream']\n low_higher=low['unknown_higher_residue_degree_norms']\n low=low['small_exact_known_norms']\n elif isinstance(low,dict): low=low['norm_counts']\n last=0\n for q,count in low:\n q=int(q); count=int(count)\n assert q>last and count>0;last=q\n if q>cutoff: break\n principal_ideals+=count; logq=arb(q).log(); logq_float=math.log(q)\n power=q; m=1\n while power0\n principal_ideals+=count\n logb=arb(b).log();f=window(logb,math.log(b))\n # Positive terms require the right endpoint, where this decreasing\n # weight is smallest. Norms in these bins have no supported power m>1.\n principal_sum+=4*count*logb/(n*(b+1))*f\n principal_power_terms+=1\n if expected_known is not None: assert principal_ideals==expected_known\n\n higher=json.loads(args.higher_norms.read_text())\n if isinstance(higher,dict):\n assert higher['support']==support and higher['principal_cutoff']==cutoff\n assert sum(c for q,c in higher['norm_counts'])==higher['total_prime_ideals']\n higher=higher['norm_counts']\n if low_higher is not None: assert higher==low_higher\n higher_sum=arb(0); higher_ideals=0\n for q,count in higher:\n q=int(q);count=int(count)\n assert q0\n if q<=cutoff:continue\n assert q*q>=support\n logq=arb(q).log();f=window(logq,math.log(q))\n higher_sum-=4*count*logq/(n*(q+1))*f\n higher_ideals+=count\n\n meta=json.loads((args.census/'metadata.json').read_text())\n assert meta['index']==9111 and meta['polynomial_coefficients_ascending']==expected_coefficients\n assert meta['bin_origin']==cutoff\n categories=meta['categories']; lowers=meta['lower_character_by_category']\n exact_bounds={int(k):int(v)for k,v in spec['rootcount_character_lower_bound'].items()}\n assert exact_bounds=={0:0,1:-1,2:-2,3:-3,5:-3,7:-5,9:-3,11:-5,15:-5,27:-5}\n assert all(exact_bounds[r]==c for r,c in zip(categories,lowers))\n blocks={}\n for path in args.census.glob('block_*.json'):\n rec=json.loads(path.read_text()); lo=int(rec['lower']);hi=int(rec['upper'])\n assert lo not in blocks and hi>lo\n blocks[lo]=rec\n prefix=cutoff; census_sum=arb(0); census_primes=0; census_blocks=0\n census_counts={r:0 for r in categories}; block_hashes=[]\n while prefix in blocks:\n rec=blocks[prefix];assert rec['upper']<=support\n total=0;previous=prefix\n for a,b,counts in rec['bins']:\n assert prefix<=a=previous\n previous=b\n assert len(counts)==len(categories) and all(isinstance(v,int)and v>=0 for v in counts)\n total+=sum(counts)\n for r,v in zip(categories,counts):census_counts[r]+=v\n cm=sum(c*v for c,v in zip(lowers,counts));assert cm<=0\n if cm:\n loga=arb(a).log();f=window(loga,math.log(a))\n # x -> log(x)/(x+1)*f(log(x)) decreases for x>=cutoff.\n # Thus the left endpoint safely overestimates the magnitude\n # of each negative contribution in this half-open bin.\n census_sum+=4*cm*loga/(n*(a+1))*f\n assert total==rec['prime_count']\n census_primes+=total;census_blocks+=1\n block_hashes.append([prefix,rec['upper'],rec['sha256_prime_rootcount_stream']])\n prefix=int(rec['upper'])\n assert prefix>3594641 and prefixA*(1-1/(5 log(A)^2)).\n c=arb(36261)/36260\n prime_tail_upper=c*integral+(c-1+arb(1)/(5*logA*logA))*fA\n assert prime_tail_upper>0\n tail_sum=-arb(20)/n*prime_tail_upper\n result=arch+principal_sum+higher_sum+census_sum+tail_sum\n record=dict(index=9111,criterion='strict Selmer characters only',precision_bits=ctx.prec,\n support=support,principal_cutoff=cutoff,window_cells=N,integer_window_denominator=str(den),\n principal_ideal_count_required=principal_ideals,principal_prime_power_terms=principal_power_terms,\n principal_large_norm_bins=len(positive_bins),low_norm_stream_sha256=low_stream_hash,\n higher_degree_nonprincipal_ideal_count=higher_ideals,census_prefix_exclusive=prefix,\n census_blocks=census_blocks,census_prime_count=census_primes,census_root_counts=census_counts,\n archimedean_interval=str(arch),principal_sum_interval=str(principal_sum),\n higher_degree_lower_interval=str(higher_sum),census_lower_interval=str(census_sum),\n dusart_tail_lower_interval=str(tail_sum),B_interval=str(result),\n rigorously_positive=bool(result>0),census_block_hashes=block_hashes,\n rigorously_greater_than_7_over_1000=bool(result>arb(7)/1000),\n seconds=round(time.monotonic()-began,3))\n args.output.write_text(json.dumps(record,indent=2)+'\\n')\n print(json.dumps({k:v for k,v in record.items()if k!='census_block_hashes'},indent=2),flush=True)\n if args.require_positive:assert result>0,result\n\nif __name__=='__main__': main()\n" }, { "path": "anc/code/1.1.10/verify_all.py", "size_bytes": 3300, "sha256": "00fa0d903622a4da502ea4d0dd930e48ac435f07c7900da4eea95e39a548417a", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Reconstruct every arithmetic premise of the complete equation-9111 proof.\n\nThe default is a fresh mathematical replay, not a trust-in-output/hash check.\nNo network service, Magma installation or binary number-field cache is needed.\nThe principal stage and prime census can take tens of minutes on a multicore\ncomputer. The original recorded outputs are retained for inspection.\n\"\"\"\nimport argparse,json,os,subprocess,sys,time\nfrom pathlib import Path\n\nROOT=Path(__file__).resolve().parent\n\ndef main():\n ap=argparse.ArgumentParser(description=__doc__)\n ap.add_argument('--workers',type=int,default=min(8,os.cpu_count() or 1))\n args=ap.parse_args(); assert args.workers>=1\n started=time.monotonic()\n def run(script,*options):\n print('EXACT REPLAY:',script,flush=True)\n subprocess.run([sys.executable,str(ROOT/script),*map(str,options)],cwd=ROOT,check=True)\n run('verify_9111_descent.py')\n run('verify_9111_code_bound.py')\n run('9111_chabauty.py')\n run('9111_finite_sieve.py')\n spec=json.loads((ROOT/'9111_strict_window.json').read_text())\n recorded=json.loads((ROOT/'9111_strict_window_verified.json').read_text())\n cutoff=spec['principal_cutoff'];support=spec['support']\n assert cutoff==15_000_000 and support==100_000_000_000\n run('certify_9111_principals_fast.py','--bound',cutoff,'--workers',args.workers,\n '--output',ROOT/'9111_principals_replayed.json')\n principals=json.loads((ROOT/'9111_principals_replayed.json').read_text())\n assert principals['all_passed'] and principals['previous_bound']==0\n assert principals['prime_ideals_verified']==971856\n run('low_norm_census_9111.py','--cutoff',cutoff,'--support',support,\n '--output',ROOT/'9111_low_norm_census_replayed.json',\n '--higher-output',ROOT/'9111_higher_norms_replayed.json')\n norms=json.loads((ROOT/'9111_low_norm_census_replayed.json').read_text())\n assert norms['total_known_prime_ideals']==principals['prime_ideals_verified']\n assert norms['sha256_complete_known_norm_count_stream']==recorded['low_norm_stream_sha256']\n assert norms['total_unknown_higher_degree_prime_ideals']==26759\n run('census_stream_9111.py','--start',cutoff,'--stop',recorded['census_prefix_exclusive'],\n '--block',25_000_000,'--workers',args.workers,\n '--output',ROOT/'9111_census_blocks','--verify')\n run('verify_9111_strict_window.py','--spec',ROOT/'9111_strict_window.json',\n '--low-norms',ROOT/'9111_low_norm_census_replayed.json',\n '--higher-norms',ROOT/'9111_higher_norms_replayed.json',\n '--census',ROOT/'9111_census_blocks',\n '--output',ROOT/'9111_strict_window_replayed.json','--require-positive')\n interval=json.loads((ROOT/'9111_strict_window_replayed.json').read_text())\n assert interval['rigorously_positive']\n assert interval['rigorously_greater_than_7_over_1000']\n assert interval['principal_ideal_count_required']==principals['prime_ideals_verified']\n assert interval['census_prefix_exclusive']==765_000_000\n assert interval['census_prime_count']==38_465_791\n print('ALL EXACT REPLAYS PASSED. Complete affine rational and integer set: {(-1,1),(1,-1)}.',flush=True)\n print('Elapsed seconds:',round(time.monotonic()-started,3),flush=True)\n\nif __name__=='__main__':main()\n" }, { "path": "anc/code/1.1.11/1.1.11a_geometry_field.gp", "size_bytes": 4898, "sha256": "c06b008b508da83c068633bd14893ec2746a150bbbca242bb8634981bccabcd2", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.11a Geometry of C and the bitangent field K.\n\\\\ Target F(x,y) = x^4+y^3+xy-y-1; u = -x, v = y: C: G(u,v) = u^4+v^3-(u+1)v-1 = 0, O = (0:1:0).\n\\\\ Checks: transport; smoothness at O (chart t = u/v, w = 1/v) and hyperflex; affine singular points\n\\\\ (critical algebra v = 4u^3, 48u^6 = u+1; critical value -(5u^4+8u^3+3)/3); bad primes 2, q0;\n\\\\ the unique node mod q0 = 13839869 and its thickness; smoothness at 3; the bitangent slope\n\\\\ polynomial f (own elimination for lines v = m u + b), irreducibility, maximal order of\n\\\\ K = Q[m]/(f) (nfcertify), signature, discriminant, primes over 2.\n\\\\ Usage: gp -q 1.1.11a_geometry_field.gp < /dev/null\ndefault(parisizemax, 2*10^9);\ntmp = b + u + v + X + t + w + z;\nF = x^4+y^3+x*y-y-1;\nG = u^4+v^3-(u+1)*v-1;\nprint(\"transport F(-u,v) == G(u,v): \", substvec(F,[x,y],[-u,v]) == G);\nGc = numerator(substvec(G,[u,v],[t/w,1/w])*w^4);\nprint(\"chart at O: \", Gc, \"; d/dw at (0,0) = \", polcoef(polcoef(Gc,1,w),0,t), \" (unit in every characteristic)\");\nprint(\"line at infinity: G_4 = u^4 (4-fold contact at O: rational hyperflex)\");\n\\\\ ---- affine singular points\nGu = deriv(G,u); Gv = deriv(G,v);\nprint(\"G_u = \", Gu, \", G_v = \", Gv);\n\\\\ G_u = 0 <=> v = 4u^3; then G_v = 0 <=> 48u^6 = u+1; G = -(5u^4+8u^3+3)/3 there\ncr = 48*u^6-u-1; print(\"48u^6-u-1 irreducible: \", polisirreducible(cr));\ngL = X^6 - 48^4*X - 48^5; \\\\ = 48^5 * cr(X/48): monic model of the critical algebra, u = X/48\nL = nfinit(gL); uu = Mod(X/48, gL);\nprint(\"48u^6-u-1 = 0 for u = X/48: \", 48*uu^6-uu-1 == 0);\ncrit = subst(subst(G,v,4*u^3),u,uu); val = lift(crit);\nprint(\"critical value == -(5u^4+8u^3+3)/3: \", crit == -(5*uu^4+8*uu^3+3)/3, \"; norm = \", factor(norm(crit)));\nprint(\"Res(48u^6-u-1, 5u^4+8u^3+3) = \", factor(polresultant(cr, 5*u^4+8*u^3+3)), \"; isprime(13839869): \", isprime(13839869));\nhess = subst(subst(deriv(Gu,u)*deriv(Gv,v)-deriv(Gu,v)^2,v,4*u^3),u,uu);\nprint(\"Hessian G_uu G_vv - G_uv^2 = \", subst(subst(deriv(Gu,u)*deriv(Gv,v)-deriv(Gu,v)^2,v,4*u^3),u,u), \" at the critical point; its norm \", factor(norm(hess)));\nhess = lift(hess);\nfa = idealfactor(L, val);\n{for(i=1,#fa~, my(pr=fa[i,1]); if(pr.p>3,\n print(\" bad p = \", pr.p, \": prime of the critical algebra with residue degree \", pr.f, \", valuation of the critical value \", fa[i,2],\n \", Hessian valuation \", idealval(L,hess,pr), \" -> \", pr.f, \" ordinary node(s) of thickness \", fa[i,2])));}\nq0 = 13839869; uc = 950455;\nprint(\"node mod q0: u = 950455 is a root of 48u^6-u-1 mod q0: \", subst(cr,u,uc) % q0 == 0, \"; v = 4u^3 mod q0 = \", (4*uc^3) % q0);\n{print(\"integral lift (u,v) = (950455, 4*950455^3): v_q0(G) = \", valuation(subst(subst(G,u,uc),v,4*uc^3), q0),\n \", G_u = \", subst(subst(Gu,u,uc),v,4*uc^3), \", v_q0(G_v) = \", valuation(subst(subst(Gv,u,uc),v,4*uc^3), q0),\n \", v_q0(288u^5-1) = \", valuation(288*uc^5-1, q0));}\n\\\\ singular locus modulo 2, 3, q0 over the algebraic closure: gcd of the three resultants in u\nsing(p) = gcd([Mod(1,p)*polresultant(G,Gv,v), Mod(1,p)*polresultant(G,Gu,v), Mod(1,p)*polresultant(Gu,Gv,v)]);\n{foreach([2,3,q0], p, my(g = sing(p)); print(\"p = \", p, \": u-coordinates of singular points satisfy \", g));}\n\\\\ ---- bitangents v = m u + b\nQ = subst(G, v, m*u+b);\nq3=polcoef(Q,3,u); q2=polcoef(Q,2,u); q1=polcoef(Q,1,u); q0c=polcoef(Q,0,u);\nc1=q3/2; c0=(q2-c1^2)/2;\nR = polresultant(numerator(q1-2*c1*c0), numerator(q0c-c0^2), b);\nfaR = factor(R); print(\"Res_b factors (degree, multiplicity): \", vector(#faR~,i,[poldegree(faR[i,1]), faR[i,2]]));\nf = 0; for(i=1,#faR~, if(poldegree(faR[i,1])==27, f = faR[i,1]/pollead(faR[i,1])));\nf11 = m^27 + 48*m^22 - 480*m^19 + 144*m^17 - 17280*m^15 + 2304*m^14 - 832*m^12 - 34560*m^11 + 64512*m^10 + 18944*m^9 - 168448*m^7 - 49152*m^6 - 27648*m^5 + 8192*m^4 - 94208*m^3 + 1024*m^2 - 4096*m + 4096;\nprint(\"degree-27 factor == f: \", f == f11, \"; f irreducible: \", polisirreducible(f11), \"; real roots: \", polsturm(f11));\n\\\\ the square identity with b in K and c1^2 != 4 c0\nmm = Mod(m, f11); gb = gcd(subst(numerator(q1-2*c1*c0),m,mm), subst(numerator(q0c-c0^2),m,mm));\nbb = -polcoef(gb,0,b)/polcoef(gb,1,b);\n{my(QQ = subst(subst(Q,b,bb),m,mm), C1 = subst(subst(c1,b,bb),m,mm), C0 = subst(subst(c0,b,bb),m,mm));\n print(\"G(u, m u + b) == (u^2 + c1 u + c0)^2 with b in K: \", QQ == (u^2+C1*u+C0)^2, \"; c1^2 - 4 c0 != 0: \", C1^2-4*C0 != 0);}\nprint(\"poldisc(f) (trial division to 1e6): \", factor(poldisc(f11), 10^6));\nt0 = getabstime();\nK = nfinit([f11, [2, 13839869, 266892835634814249016896736070677]]);\nprint(\"isprime(266892835634814249016896736070677): \", isprime(266892835634814249016896736070677));\nprint(\"nfcertify (empty = maximal order certified): \", nfcertify(K));\nprint(\"signature \", K.sign, \"; disc \", K.disc, \" = \", factor(K.disc), \"; == 2^28 q0^6: \", abs(K.disc) == 2^28*q0^6);\nP = idealprimedec(K,2); print(\"primes over 2 (e,f): \", vector(#P,i,[P[i].e,P[i].f]), \" (\", getabstime()-t0, \" ms)\");\nquit;\n" }, { "path": "anc/code/1.1.11/1.1.11e_descent.gp", "size_bytes": 4216, "sha256": "6ea9fb586f24fe8d64d8f68dd6f2c69c9ff8ad73df42e3a9b73345a32b2258de", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.11e 2-descent for C: G(u,v) = u^4+v^3-(u+1)v-1 = 0 (u = -x, v = y); here written as\n\\\\ F(x,y) = -G = -x^4-y^3+(x+1)y+1 with x = u, y = v, and h_m = eps (y - m x - b), eps = -1\n\\\\ (= m u + b - v, the normalisation of the text). S = {2}.\n\\\\ (1) basis of K(S,2): S-units proposed by bnfinit (GRH only proposes) and checked exactly (all prime\n\\\\ factors over 2), independence by valuation parities and quadratic residue characters;\n\\\\ (2) norm condition; good primes 487, 491, 499, 503 (images of all points of C(F_p));\n\\\\ (3) at 2: orbit sizes e*f and codeword unions (dim J(Q_2)[2] <= 1); certified images of\n\\\\ (a) P+ - O, (b) R1 - O (u = 5, v = 8s), (c) R2 - O (t = 2), (d) R3 + R3' - 2O (t = sqrt 2);\n\\\\ (4) final space; delta(P+ - O) nonzero and inside it, delta(P- - O) trivial.\n\\\\ Usage: gp -q 1.1.11e_descent.gp < /dev/null (reads ../common/h31_descent_lib/)\ndefault(parisizemax, 4*10^9);\nread(\"../common/h31_descent_lib/descent_lib.gp\");\nread(\"../common/h31_descent_lib/descent_points.gp\");\nF = -x^4-y^3+(x+1)*y+1; eps = -1; Sp = [2];\nf27 = m^27 + 48*m^22 - 480*m^19 + 144*m^17 - 17280*m^15 + 2304*m^14 - 832*m^12 - 34560*m^11 + 64512*m^10 + 18944*m^9 - 168448*m^7 - 49152*m^6 - 27648*m^5 + 8192*m^4 - 94208*m^3 + 1024*m^2 - 4096*m + 4096;\nt0 = getabstime();\ncomps = [mkcomp(F, f27, Sp, \"\")];\nprint(\"number of S-unit classes (torsion, units, S-units): \", #comps[1][6]);\nprint(\"primes above 2 (e,f): \", [[pr.e, pr.f] | pr <- comps[1][5]]);\n{ foreach(comps[1][6], g, my(fa = idealfactor(comps[1][1].nf, g)); for(j = 1, #fa[,1], if(fa[j,1].p != 2, error(\"not an S-unit\")))); }\nprint(\"all classes are S-units (support over 2): 1\");\nAX = auxchars(comps, Sp, 200); GC = globcharmat(comps, AX);\nprint(\"rank of the character matrix (independence): \", matrank(Mod(GC,2)), \" of \", matsize(GC)[1]);\nCtot = normmat(comps, Sp); print(\"ambient \", matsize(Ctot)[1], \"; after the norm condition: \", seldim(Ctot));\n{ foreach([487, 491, 499, 503], p, my(gp = goodplace(comps, eps, F, p, 30)); Ctot = matconcat([Ctot, constraint(gp[1], gp[2])]);\n print(\"p = \", p, \": #affine points \", gp[3], \", local image dim \", f2span_rank(gp[2]), \" -> \", seldim(Ctot))); }\n\\\\ ---- the prime 2\nef = [pr.e * pr.f | pr <- comps[1][5]];\nprint(\"orbit sizes over 2: \", ef);\nU = List(); forsubset(#ef, S, if(#S, my(sz = sum(i = 1, #S, ef[S[i]])); if(sz == 12 || sz == 16, listput(U, [Vec(S), sz]))));\n{print(\"unions of orbits of size 12 or 16 (orbit indices, size): \", U, \"; the sum of the two has size \",\n if(#U == 2, my(D = setminus(setunion(Set(U[1][1]), Set(U[2][1])), setintersect(Set(U[1][1]), Set(U[2][1])))); sum(i = 1, #D, ef[D[i]]), \"?\"),\n \" (not 12 or 16): dim J(Q_2)[2] <= 1, dim J(Q_2)/2J(Q_2) <= 4\");}\npl2 = mkplace(comps, 2); G2 = globmat(comps, pl2);\nprint(\"dim of local square-class target: \", #G2[1,], \" = sum over p|2 of (e f + 2)\");\nIa = delta(comps, eps, 1, 0);\ny5 = select(z -> valuation(z, 2) >= 3, polrootspadic(subst(F, x, 5), 2, 64));\nif(#y5 != 1, error(\"R1 not unique\")); Ib = ptimg(comps, eps, 2, 5, y5[1]);\nGc = numerator(subst(subst(F, x, t/w), y, 1/w) * w^4); print(\"chart at O: \", Gc);\nw2 = select(z -> valuation(z, 2) >= 1, polrootspadic(subst(Gc, t, 2), 2, 64));\nif(#w2 != 1, error(\"R2 not unique\")); Ic = infimg(comps, eps, 2, 2, w2[1]);\nqr = newtonr(substvec(Gc, [t, w], [r, 'W]), 'W, 0, 2, 2, 64);\nprint(\"R3: w = a + c sqrt2 with residual valuation \", qr[3]);\nId = quadinfimg(comps, eps, 2, 2, r, qr[1], qr[2], qr[3]);\nprint(\"certified square classes (ok, margin): (b) \", Ib[2..3], \" (c) \", Ic[2..3], \" (d) \", Id[2..3]);\nif(!(Ib[2] && Ic[2] && Id[2]), error(\"precision not certified\"));\nR2 = locimage(comps, pl2, [Ia, Ib[1], Ic[1], Id[1]]);\nprint(\"rank of the images of (a),(b),(c),(d): \", f2span_rank(R2));\nC2 = matconcat([Ctot, constraint(G2, R2)]); print(\"after the dyadic condition: \", seldim(C2), \" => rank J(Q) <= \", seldim(C2));\nK = f2ker(C2~);\n{ foreach([[\"P+\", [1,0]], [\"P-\", [-1,0]]], e, my(z = delta(comps, eps, e[2][1], e[2][2]), sol = express(GC, charvec(comps, AX, z)));\n print(\"delta(\", e[1], \" - O): nonzero \", sol != 0*sol, \"; in the final space \", matrank(Mod(matconcat([K, sol]), 2)) == matrank(Mod(K, 2)))); }\nprint(\"time \", getabstime() - t0, \" ms\");\nquit;\n" }, { "path": "anc/code/1.1.11/1.1.11f_logs.gp", "size_bytes": 4435, "sha256": "6b201701220cccfe0e66c76f92927dd5410ceaa4603f41a2e9756eaf05c377ca", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.11f The principal divisor div(h) = 21 P+ + E - 24 O, the residual cubic E in the disk of O,\n\\\\ the 3-adic logarithm L = log[P+ - O] = -(1/21) Tr int_0^{t(E)} omega, and the unit coefficients\n\\\\ of the annihilating differentials in the three residue disks at 3.\n\\\\ C: G(u,v) = u^4+v^3-(u+1)v-1 = 0 (u = -x, v = y), O = (0:1:0), t = u/v, w = 1/v,\n\\\\ omega = (1,u,v) du/(u+1-3v^2). Input: data/1.1.11f_h.gp.\n\\\\ Usage: gp -q 1.1.11f_logs.gp < /dev/null\ndefault(parisizemax, 2*10^9);\nG = u^4+v^3-(u+1)*v-1;\nread(\"data/1.1.11f_h.gp\");\n\\\\ ---- pole order: unique monomial of maximal weight 3i+4j\nwt = List(); for(i=0,8, for(j=0,2, if(polcoef(polcoef(h,i,u),j,v)!=0, listput(wt,[3*i+4*j,i,j]))));\nwt = vecsort(Vec(wt),1,4); print(\"monomials: \", #wt, \"; maximal weight \", wt[1], \", next \", wt[2][1], \" => pole of order 24 at O\");\n\\\\ ---- zeros\nR = polresultant(G, h, v); fa = factor(R);\nprint(\"Res_v(G,h) = c * \", vector(#fa~, i, [fa[i,1], fa[i,2]]));\nU = 0; for(i=1,#fa~, if(poldegree(fa[i,1])==3, U = fa[i,1]/pollead(fa[i,1])));\nprint(\"U irreducible: \", polisirreducible(U), \"; U(1) = \", subst(U,u,1));\nprint(\"gcd(G(1,v), h(1,v)) = \", gcd(subst(G,u,1), subst(h,u,1)), \"; G_v(P+) = \", subst(subst(deriv(G,v),u,1),v,0));\nuE = Mod(z, subst(U,u,z)); gg = gcd(subst(G,u,uE), subst(h,u,uE));\nprint(\"residual points: v as a function of u has degree \", poldegree(gg,v), \" in v\");\nvE = -polcoef(gg,0,v)/polcoef(gg,1,v);\nprint(\"G(E) = 0: \", substvec(G,[u,v],[uE,vE]) == 0, \", h(E) = 0: \", substvec(h,[u,v],[uE,vE]) == 0, \"; 21 + 3 = 24 zeros\");\n\\\\ ---- E lies in the disk of O\nTT = charpoly(uE/vE, Z); TV = charpoly(vE, Z);\nprint(\"T(Z) = charpoly of t on E: 3-adic valuations \", vector(4,i,valuation(polcoef(TT,i-1,Z),3)), \"; T mod 81 = \", lift(TT*Mod(1,81)));\nprint(\"charpoly of v on E: 3-adic valuations \", vector(4,i,valuation(polcoef(TV,i-1,Z),3)), \" (one Newton edge: v3(v) = -4/3)\");\n\\\\ ---- the differentials on the branch at O\nGc = numerator(substvec(G,[u,v],[t/w,1/w])*w^4); print(\"chart at O: \", Gc);\nNT = 120; W = O(t^(NT+2)); for(it=1,30, W = W - subst(Gc,w,W)/subst(deriv(Gc,w),w,W));\nprint(\"branch w(t) = \", W + O(t^13), \"; residual valuation \", valuation(subst(Gc,w,W),t));\nom = [W, t, 1] / (1 - 2*t*W - 3*W^2 - 4*W^3);\nuu = t/W; vv = 1/W; omc = [1, uu, vv] * deriv(uu,t) / (uu + 1 - 3*vv^2);\nprint(\"chart formula agrees with (1,u,v)du/(u+1-3v^2) up to t^k, k = \", vector(3,j, valuation(om[j]-omc[j], t)));\nprint(\"omega/dt to degree 9: \", vector(3,j, om[j] + O(t^10)));\nprint(\"integral coefficients (denominators): \", vector(3,j, denominator(content(truncate(om[j])))));\n\\\\ ---- 9-term formula modulo 27\npk = vector(NT, k, trace(Mod(z, TT=subst(TT,Z,z))^k));\nprint(\"power sums p1..p9 mod 81: \", vector(9,k, pk[k] % 81));\nI9 = [-pk[5]/5, pk[2]/2 - 2*pk[7]/7, pk[1] - pk[6]/3 + pk[9]/3];\nprint(\"Tr(I0,I1,I2) mod 27: \", vector(3,j, lift(Mod(I9[j],27))), \"; L = -Tr/21 mod 9: \", vector(3,j, lift(Mod(-I9[j]/21, 9))));\nprint(\"I(t) to degree 9 from omega: \", vector(3,j, intformal(truncate(om[j]+O(t^9)))));\nprint(\"tail: min over 10<=n<=26 of n/3 - v3(n) = \", vecmin(vector(17,k, my(n=k+9); n/3 - valuation(n,3))), \"; n >= 27: v3(n) <= log_3 n <= n/3 - 3\");\n\\\\ ---- long computation (NT terms): valuations and L/3 mod 9\nLf = vector(3,j, -1/21 * sum(n=0,NT-1, polcoef(om[j],n,t) * pk[n+1]/(n+1)));\nprint(\"with \", NT, \" terms (tail valuation >= \", vecmin(vector(500,k, my(n=k+NT); n/3 - valuation(n,3))), \"): v3(L) = \", vector(3,j,valuation(Lf[j],3)), \", L/3 mod 9 = \", vector(3,j, lift(Mod(Lf[j]/3, 9))));\nr0 = lift(Mod(Lf[1]/Lf[2],3)); r2 = lift(Mod(Lf[3]/Lf[2],3));\nprint(\"L0/L1 = \", r0, \", L2/L1 = \", r2, \" (mod 3)\");\n\\\\ ---- unit coefficients at the centres of the three residue disks\nGu = deriv(G,u); Gv = deriv(G,v);\ncP = [1,1,0] / (-subst(subst(Gv,u,1),v,0)); \\\\ P+ = (1,0), s = u-1: omega/ds = (1,u,v)/(u+1-3v^2)\ncM = [1,-1,0] / subst(subst(Gu,u,-1),v,0); \\\\ P- = (-1,0), s = v: omega/ds = (1,u,v)/(4u^3-v)\ncO = vector(3,j, polcoef(om[j],0,t)); \\\\ O, s = t\neta0(c) = c[1] - Lf[1]/Lf[2]*c[2];\neta2(c) = c[3] - Lf[3]/Lf[2]*c[2];\nprint(\"P+: omega/ds = \", cP, \", eta0 constant = \", lift(Mod(eta0(cP),3)), \" mod 3\");\nprint(\"P-: omega/ds = \", cM, \", eta0 constant = \", lift(Mod(eta0(cM),3)), \" mod 3\");\nprint(\"O : omega/ds = \", cO, \", eta2 constant = \", lift(Mod(eta2(cO),3)), \" mod 3\");\nprint(\"C(F_3) affine points: \", [[a,b] | a<-[0..2]; b<-[0..2], substvec(G,[u,v],[a,b])%3==0]);\nquit;\n" }, { "path": "anc/code/1.1.11/data/1.1.11f_h.gp", "size_bytes": 1946, "sha256": "04dd1066b8e94421965123917bb348ef24e13be925ab1066ae7ee7a95c4440e5", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ h with div(h) = 21 P+ + E - 24 O on G(u,v) = u^4+v^3-(u+1)v-1 = 0 (22 monomials u^i v^j, 3i+4j <= 24).\n\\\\ Coefficients copied from the package file 008008_principal_n21.json (fields \"monomials\", \"h_coefficients\").\nh = (2367426793677980144790766553743763/732305065375610740707623870238993)*u^0*v^0 + (-8853460883742502461075070698960742/732305065375610740707623870238993)*u^1*v^0 + (3750676526507670464430132849342486/244101688458536913569207956746331)*u^2*v^0 + (-382885385323087659428119716711402/244101688458536913569207956746331)*u^3*v^0 + (-16407701840248413542781872850881444/732305065375610740707623870238993)*u^4*v^0 + (29268095194733708806585681759514470/732305065375610740707623870238993)*u^5*v^0 + (-24417406845502065901190670924394306/732305065375610740707623870238993)*u^6*v^0 + (7207369092151933797957502892846014/732305065375610740707623870238993)*u^7*v^0 + (1)*u^8*v^0 + (4522769960942462735785868736931814/732305065375610740707623870238993)*u^0*v^1 + (-17266857631100038506458374445842322/732305065375610740707623870238993)*u^1*v^1 + (26248807507524502204711103277767768/732305065375610740707623870238993)*u^2*v^1 + (-18496549736734204586107836606661532/732305065375610740707623870238993)*u^3*v^1 + (254048411201572881652347025882666/244101688458536913569207956746331)*u^4*v^1 + (3328777686335020742698642913103578/244101688458536913569207956746331)*u^5*v^1 + (-2038863050268608966440085594085876/244101688458536913569207956746331)*u^6*v^1 + (3689286898228422164662783007950567/732305065375610740707623870238993)*u^0*v^2 + (-5150762248125260535345863273261288/244101688458536913569207956746331)*u^1*v^2 + (8525885082966399018556996179972175/244101688458536913569207956746331)*u^2*v^2 + (-6172440009645775390942646056521916/244101688458536913569207956746331)*u^3*v^2 + (822969565333085323610137371627892/244101688458536913569207956746331)*u^4*v^2 + (831022844876822876896781938996692/244101688458536913569207956746331)*u^5*v^2;\n" }, { "path": "anc/code/1.1.12/1.1.12a_geometry_fields.gp", "size_bytes": 3683, "sha256": "5e152d6b5148af3a40a352a01d6540dba76b34b976cd3ac8055d44c8ee514b78", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.12a Geometry of C and the bitangent algebra.\n\\\\ Target F(x,y) = x^4-y^3+xy+x-1; u = -x, v = y: C: G(u,v) = u^4-v^3-uv-u-1 = 0, O = (0:1:0).\n\\\\ Checks: transport; smoothness at O (chart t = u/v, w = 1/v) and the rational hyperflex; affine\n\\\\ singular points through the critical algebra (G_u = 0 gives v = 4*u^3-1); bad primes, nodes and\n\\\\ their thickness; smoothness at the remaining small primes; factorisation of the bitangent slope\n\\\\ resultant (lines v = m u + b); signature, discriminant and decomposition of small primes in the\n\\\\ two fields. Usage: gp -q 1.1.12a_geometry_fields.gp < /dev/null\ndefault(parisizemax, 2*10^9);\ntmp = b + u + v + X + t + w + Z;\nF = x^4-y^3+x*y+x-1;\nG = u^4-v^3-u*v-u-1;\nprint(\"transport: F(-u,v) == G: \", substvec(F,[x,y],[-u,v]) == G);\nGc = numerator(substvec(G,[u,v],[t/w,1/w])*w^4);\nprint(\"chart at O: \", Gc, \"; d/dw at (0,0) = \", polcoef(polcoef(Gc,1,w),0,t), \" (unit in every characteristic)\");\nprint(\"line at infinity: w = 0 meets C where \", subst(Gc,w,0), \" = 0 (4-fold contact at O: rational hyperflex)\");\nGu = deriv(G,u); Gv = deriv(G,v);\nprint(\"G_u = \", Gu, \", G_v = \", Gv);\ncr = numerator(subst(Gv, v, 4*u^3-1)); cr = cr/content(cr);\nprint(\"critical algebra: \", cr, \" = \", factor(cr));\nvt = 12*G-3*u*Gu-4*v*Gv;\nprint(\"Euler identity: 12G - 3u G_u - 4v G_v = \", vt, \" => critical value = (\", vt, \")/12\");\n{\nforeach(factor(cr)[,1], c,\n my(d = poldegree(c), lc = pollead(c), g = lc^(d-1)*subst(c, u, X/lc), L = nfinit(g), uu = Mod(X/lc, g), vv = subst(4*u^3-1, u, uu),\n val = substvec(G, [u,v], [uu,vv]), hess = substvec(deriv(Gu,u)*deriv(Gv,v)-deriv(Gu,v)^2, [u,v], [uu,vv]), fa);\n if(substvec(Gu,[u,v],[uu,vv]) != 0 || substvec(Gv,[u,v],[uu,vv]) != 0, error(\"not a critical point\"));\n print(\"factor \", c, \": norm of the critical value \", factor(norm(val)), \"; norm of the Hessian \", factor(norm(hess)));\n fa = idealfactor(L, lift(val));\n for(i=1,#fa~, my(pr=fa[i,1]); if(pr.p > 3,\n print(\" p = \", pr.p, \": prime of residue degree \", pr.f, \", valuation of the critical value \", fa[i,2],\n \", Hessian valuation \", idealval(L, lift(hess), pr), \" -> \", pr.f, \" ordinary node(s) of thickness \", fa[i,2]))));\n}\nsing(p) = gcd([Mod(1,p)*polresultant(G,Gv,v), Mod(1,p)*polresultant(G,Gu,v), Mod(1,p)*polresultant(Gu,Gv,v)]);\n{foreach([2,3,5,7,11,13], p, my(g = sing(p)); print(\"p = \", p, \": \", if(poldegree(g) <= 0, \"no singular point (smooth fibre)\", Str(u, \"-coordinates of singular points: \", factor(g)))));}\n\n\\\\ ---- bitangents v = m u + b\nQ = subst(G, v, m*u+b); e4 = polcoef(Q,4,u);\nq3=polcoef(Q,3,u)/e4; q2=polcoef(Q,2,u)/e4; q1=polcoef(Q,1,u)/e4; q0c=polcoef(Q,0,u)/e4;\nc1=q3/2; c0=(q2-c1^2)/2;\nR = polresultant(numerator(q1-2*c1*c0), numerator(q0c-c0^2), b);\nfaR = factor(R); print(\"Res_b factors (degree, multiplicity): \", vector(#faR~,i,[poldegree(faR[i,1]), faR[i,2]]));\n{for(i=1,#faR~, my(g = faR[i,1]/pollead(faR[i,1])); if(poldegree(g) <= 2, print(\" rational slope factor: \", g)));}\nf10 = m^10 - 24*m^6 - 48*m^2 - 16;\nf16 = m^16 + 24*m^12 + 48*m^11 + 624*m^8 - 192*m^7 + 160*m^6 - 1152*m^4 - 2304*m^3 + 960*m^2 - 64*m + 2304;\n{print(\"f10, f16 are factors: \", vector(#faR~,i, faR[i,1]/pollead(faR[i,1]) == f10) != 0, \" \", vector(#faR~,i, faR[i,1]/pollead(faR[i,1]) == f16) != 0,\n \"; irreducible: \", polisirreducible(f10), \" \", polisirreducible(f16), \"; 27 = 1 + 10 + 16: \", poldegree(R) == 27);}\n{\nforeach([[\"F10\", f10], [\"F16\", f16]], e, my(K = nfinit(e[2]));\n print(e[1], \": signature \", K.sign, \", |disc| = \", factor(abs(K.disc)), \"; nfcertify: \", nfcertify(K));\n foreach([2,3,13], p, print(\" p = \", p, \": (e,f) = \", [[pr.e, pr.f] | pr <- idealprimedec(K, p)])));\n}\nquit;\n" }, { "path": "anc/code/1.1.12/1.1.12b_orthogonal_group.py", "size_bytes": 8393, "sha256": "0a9c8e8c0096eeee6792b39acf348c0e0081d7b5105af7dbe1be1afedb3cad23", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"1.1.12b Finite group computations for the marked-bitangent code (no curve, no number field).\n\nV = F_2^6 with q(z) = z1 z2 + z3 z4 + z5 z6 + z5 + z6; the 27 nonzero isotropic vectors <-> the 27 finite\nbitangents; v0 = (1,0,0,0,0,0) <-> the rational bitangent. H = group generated by the transvections\nz -> z + B(z,a) a with q(a) = 1, B(a,v0) = 0. Prints |H|, its orbits, the code weights of\nV -> E = F_2^27, dim V^H, E^H, (E/V)^H, the map H -> S5 (pairs {w, w+v0} in the 10-orbit), its kernel N,\nnormal closures, the S5 images and fixed spaces of the elements with the Frobenius-at-3 cycle type of\n1.1.12, and all tame decomposition groups (tau of order 5, sigma tau sigma^-1 = tau^2) with\norbit pattern (5,5), (1,5,10). Usage: python3 -I 1.1.12b_orthogonal_group.py (standard library)\n\"\"\"\nimport itertools, sys\nfrom collections import Counter\ndef q(z): return (z[0]*z[1]+z[2]*z[3]+z[4]*z[5]+z[4]+z[5])%2\ndef add(u,v): return tuple((a+b)%2 for a,b in zip(u,v))\ndef B(u,v): return (q(add(u,v))-q(u)-q(v))%2\nV=[tuple(t) for t in itertools.product([0,1],repeat=6)]\nzero=(0,)*6\niso=[v for v in V if v!=zero and q(v)==0]\nprint(\"nonzero isotropic:\",len(iso))\nv0=(1,0,0,0,0,0); assert v0 in iso\nidx={v:i for i,v in enumerate(V)}\n# transvections\ngens=[]\nfor a in V:\n if q(a)==1 and B(a,v0)==0:\n perm=tuple(idx[add(z,a) if B(z,a) else z] for z in V)\n gens.append(perm)\nprint(\"number of transvection generators:\",len(gens))\ndef compose(p,r): return tuple(p[r[i]] for i in range(len(r))) # p∘r\n# generate group by BFS\nident=tuple(range(64))\nG={ident}; frontier=[ident]\nwhile frontier:\n nf=[]\n for g in frontier:\n for s in gens:\n h=compose(s,g)\n if h not in G: G.add(h); nf.append(h)\n frontier=nf\nH=list(G); print(\"|H| =\",len(H))\n# check every element is orthogonal and fixes v0\nassert all(g[idx[v0]]==idx[v0] for g in H)\nassert all(q(V[g[i]])==q(V[i]) for g in H[:200] for i in range(64))\n# orbits on iso\nisoi=[idx[v] for v in iso]\norbs=[]; seen=set()\nfor i in isoi:\n if i in seen: continue\n o={g[i] for g in H}; seen|=o; orbs.append(sorted(o))\nprint(\"orbit sizes on 27:\",sorted(len(o) for o in orbs))\nO1=[o for o in orbs if len(o)==1][0]; O10=[o for o in orbs if len(o)==10][0]; O16=[o for o in orbs if len(o)==16][0]\nlab=O1+O10+O16 # labels of 27 bitangents ordered by orbit\n# code\ndef code(v): return tuple(B(v,V[w]) for w in lab)\nC=[code(v) for v in V]\nprint(\"code weights:\",sorted(Counter(sum(c) for c in C).items()))\n# rank of code (injective?)\ndef rank(vecs):\n rows=[int(''.join(map(str,v)),2) for v in vecs]\n r=0; rows=[x for x in rows if x]\n basis=[]\n for x in rows:\n for b in basis: x=min(x,x^b)\n if x: basis.append(x)\n return len(basis)\nprint(\"dim code image:\",rank(C))\n# invariants: J[2]^G = fixed vectors of V under group Gp (list of perms on V indices)\ndef fixed_dim_V(Gp):\n fixed=[v for v in V if all(V[g[idx[v]]]==v for g in Gp)]\n return len(fixed).bit_length()-1\ndef perm27(g): return tuple(lab.index(g[w]) for w in lab)\ndef fixed_dim_E(Gp):\n # orbits of Gp on 27 positions\n P=[perm27(g) for g in Gp]\n par=list(range(27))\n def f(i):\n while par[i]!=i: par[i]=par[par[i]]; i=par[i]\n return i\n for p in P:\n for i in range(27): \n a,b=f(i),f(p[i]); \n if a!=b: par[a]=b\n return len({f(i) for i in range(27)})\ndef gens_of(Gp): return Gp\n# dim (E/J2)^G = dim E^G - dim J2^G + dim ker(H^1(G,J2)->H^1(G,E))... compute directly: quotient fixed space\ndef quotient_fixed_dim(Gp):\n # E/C, compute dimension of {e mod C : g e - e in C for all g}\n Cbasis=[]; \n for c in C:\n x=int(''.join(map(str,c)),2)\n for b in Cbasis: x=min(x,x^b)\n if x: Cbasis.append(x)\n def red(x):\n for b in sorted(Cbasis,reverse=True): x=min(x,x^b)\n return x\n # reduce with proper echelon\n # build echelon basis with pivots\n ech=[]\n for x in Cbasis:\n for b in ech: x=min(x,x^b)\n if x: ech.append(x); ech.sort(reverse=True)\n def redE(x):\n for b in ech: x=min(x,x^b)\n return x\n P=[perm27(g) for g in Gp]\n def act(p,x):\n bits=[(x>>(26-i))&1 for i in range(27)]\n nb=[0]*27\n for i in range(27): nb[p[i]]=bits[i]\n return int(''.join(map(str,nb)),2)\n # quotient space basis: unit vectors not pivots\n # solve linear system: unknown e in E (27 bits) with (g-1)e in C for all g; then quotient by C\n # Build matrix of linear maps e -> redE((g-1)e) for generators g\n cols=[]\n for i in range(27):\n e=1<<(26-i)\n img=[]\n for p in P: img.append(redE(act(p,e)^e))\n cols.append(img)\n # kernel of map E -> (E/C)^k ; kernel contains C; dim kernel - dim C\n # represent map as vectors concatenated\n def concat(img): \n r=0\n for t in img: r=(r<<27)|t\n return r\n M=[concat(c) for c in cols]\n # kernel dimension = 27 - rank(M)\n basis=[]\n for x in M:\n for b in basis: x=min(x,x^b)\n if x: basis.append(x)\n return 27-len(basis)-len(ech)\nprint(\"dim J2^H =\",fixed_dim_V(H),\" dim E^H =\",fixed_dim_E(H),\" dim (E/J2)^H =\",quotient_fixed_dim(H))\n# projection to S5 on pairs {w, w+v0} inside the 10-orbit\npairs=[]; s=set()\nfor w in O10:\n if w in s: continue\n w2=idx[add(V[w],v0)]; pairs.append((w,w2)); s|={w,w2}\nassert len(pairs)==5\npairidx={}\nfor k,(a,b2) in enumerate(pairs): pairidx[a]=k; pairidx[b2]=k\ndef proj(g): return tuple(pairidx[g[pairs[k][0]]] for k in range(5))\nimgs={proj(g) for g in H}; print(\"|image in S5| =\",len(imgs))\nN=[g for g in H if proj(g)==tuple(range(5))]; print(\"|kernel N| =\",len(N))\n# N elementary abelian?\nprint(\"N elementary abelian:\", all(compose(g,g)==ident for g in N) and all(compose(g,h)==compose(h,g) for g in N for h in N))\n# normal closure of each nonzero element of N\ndef inv(g):\n r=[0]*64\n for i,j in enumerate(g): r[j]=i\n return tuple(r)\nok=True\nfor n in N:\n if n==ident: continue\n conj={compose(compose(h,n),inv(h)) for h in H}\n # span (group generated) in N\n grp={ident}; fr=[ident]\n while fr:\n nf=[]\n for a in fr:\n for c in conj:\n b=compose(a,c)\n if b not in grp: grp.add(b); nf.append(b)\n fr=nf\n if len(grp)!=16: ok=False\nprint(\"every nonzero element of N has normal closure N:\",ok)\n# cycle types on the three orbits\ndef ctype(g,orb):\n seen=set(); t=[]\n for i in orb:\n if i in seen: continue\n L=0; j=i\n while j not in seen: seen.add(j); j=g[j]; L+=1\n t.append(L)\n return tuple(sorted(t))\ndef stype(p):\n seen=set(); t=[]\n for i in range(5):\n if i in seen: continue\n L=0; j=i\n while j not in seen: seen.add(j); j=p[j]; L+=1\n t.append(L)\n return tuple(sorted(t))\ndef report(pattern,name):\n m=[g for g in H if (ctype(g,O10),ctype(g,O16))==pattern]\n print(name,\"pattern\",pattern,\": #elements\",len(m),\" projected S5 types\",Counter(stype(proj(g)) for g in m),\n \" fixed dims on V\",Counter(fixed_dim_V([g]) for g in m))\nreport(((1,1,4,4),(1,1,2,4,4,4)),\"1.1.12 Frob3: F10 (1,1,4,4), F16 (1,1,2,4,4,4)\")\n# Decomposition groups at 2 (tame): tau order 5, sigma tau sigma^-1 = tau^2, orbits (1);(5,5);(1,5,10)\ndef order(g):\n k=1; h=g\n while h!=ident: h=compose(g,h); k+=1\n return k\ndef gen_group(gs):\n grp={ident}; fr=[ident]\n while fr:\n nf=[]\n for a in fr:\n for c in gs:\n b=compose(c,a)\n if b not in grp: grp.add(b); nf.append(b)\n fr=nf\n return list(grp)\ndef orbit_sizes(Gp,orb):\n seen=set(); t=[]\n for i in orb:\n if i in seen: continue\n o={g[i] for g in Gp}; seen|=o; t.append(len(o))\n return tuple(sorted(t))\ntaus=[g for g in H if g!=ident and compose(compose(compose(compose(g,g),g),g),g)==ident]\nprint(\"#elements of order 5:\",len(taus))\nres=Counter(); Dorders=Counter(); seenD=set()\nfor t in taus:\n t2=compose(t,t)\n for s in H:\n if compose(compose(s,t),inv(s))==t2:\n D=gen_group([t,s]); key=frozenset(D)\n if key in seenD: continue\n seenD.add(key)\n pat=(orbit_sizes(D,O10),orbit_sizes(D,O16))\n if pat==((5,5),(1,5,10)):\n res[(len(D),fixed_dim_V(D))]+=1\nprint(\"dyadic decomposition groups with orbits (5,5),(1,5,10): (order, dim V^D) counts:\",res)\n" }, { "path": "anc/code/1.1.12/1.1.12f_descent.gp", "size_bytes": 4801, "sha256": "d8b1207041dc99737072f8290ca96672c6818bd26e2bde58e7899e64c3e09d58", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.12f 2-descent for C: G(u,v) = u^4-v^3-uv-u-1 = 0 (u = -x, v = y), written as\n\\\\ F(x,y) = -G = -x^4+y^3+xy+x+1 with x = u, y = v; h_m = eps (y - m x - b), eps = 1.\n\\\\ Bitangent algebra L = Q x F10 x F16 (rational bitangent v = -1, slope m = 0); S = {2, 3}.\n\\\\ (1) bases of Q(S,2), F10(S,2), F16(S,2): S-units proposed by bnfinit (GRH only proposes), checked\n\\\\ exactly (support in S), independence by valuation parities and quadratic residue characters;\n\\\\ (2) norm condition (sign, v_2, v_3); good primes 487, ..., 541 (images of all points of C(F_p));\n\\\\ (3) at 2: certified images of P - O (u = 0), of the 2-adic points with u = 2 and u = 4, of the point\n\\\\ t = 2 of the disk at O, and of R + R' - 2O with u(R) = sqrt 2;\n\\\\ at 3: images of P - O, and of the 3-adic points with u = 1 and u = 3;\n\\\\ (4) final space; delta(P - O) is nonzero and inside it.\n\\\\ At P (a contact point of the rational bitangent) the Q-component of delta(P - O) is the leading\n\\\\ coefficient 1/3 of v + 1 = u^4/3 + ... (1.1.12 text).\n\\\\ Usage: gp -q 1.1.12f_descent.gp < /dev/null (reads ../common/h31_descent_lib/)\ndefault(parisizemax, 4*10^9);\nread(\"../common/h31_descent_lib/descent_lib.gp\");\nread(\"../common/h31_descent_lib/descent_points.gp\");\nF = -x^4+y^3+x*y+x+1; eps = 1; Sp = [2, 3];\nfl = [m, m^10 - 24*m^6 - 48*m^2 - 16, m^16 + 24*m^12 + 48*m^11 + 624*m^8 - 192*m^7 + 160*m^6 - 1152*m^4 - 2304*m^3 + 960*m^2 - 64*m + 2304];\nt0 = getabstime();\ncomps = vector(3, i, mkcomp(F, fl[i], Sp, \"\"));\nprint(\"rational bitangent: slope \", comps[1][3], \", intercept \", comps[1][4]);\nprint(\"S-unit classes per component (Q, F10, F16): \", vector(3, i, #comps[i][6]), \"; total \", sum(i = 1, 3, #comps[i][6]));\n{ for(i = 1, 3, my(nf = comps[i][1].nf); foreach(comps[i][6], g, my(fa = idealfactor(nf, g)); for(j = 1, #fa[,1], if(setsearch(Set(Sp), fa[j,1].p) == 0, error(\"not an S-unit\"))))); }\nprint(\"all classes are S-units: 1\");\nAX = auxchars(comps, Sp, 400); GC = globcharmat(comps, AX);\nprint(\"rank of the character matrix (independence): \", matrank(Mod(GC,2)), \" of \", matsize(GC)[1]);\nCtot = normmat(comps, Sp); print(\"ambient \", matsize(Ctot)[1], \"; after the norm condition: \", seldim(Ctot));\n{ foreach([487, 491, 499, 503, 509, 521, 523, 541], p, my(gp = goodplace(comps, eps, F, p, 30)); Ctot = matconcat([Ctot, constraint(gp[1], gp[2])]);\n print(\"p = \", p, \": #affine points \", gp[3], \", local image dim \", f2span_rank(gp[2]), \" -> \", seldim(Ctot))); }\n\\\\ ---- local points\nPd = delta(comps, eps, 0, -1); print(\"delta at P, raw Q-component: \", Pd[1], \" (contact) -> replaced by 1/3\"); Pd[1] = 1/3;\nGc = numerator(subst(subst(F, x, t/w), y, 1/w) * w^4); print(\"chart at O: \", Gc);\npick(L, cond, what) = { my(S = select(cond, L)); if(#S != 1, error(Str(what, \": \", #S, \" roots\"))); S[1] };\ny2 = pick(polrootspadic(subst(F, x, 2), 2, 64), z -> 1, \"u = 2\");\ny4 = pick(polrootspadic(subst(F, x, 4), 2, 64), z -> 1, \"u = 4\");\nw2 = pick(polrootspadic(subst(Gc, t, 2), 2, 64), z -> valuation(z, 2) >= 1, \"t = 2\");\nqr = newtonr(substvec(F, [x, y], [r, 'W]), 'W, 1, 2, 2, 64);\nprint(\"2-adic points: v(u=2) = \", y2, \"; v(u=4) = \", y4, \"; w(t=2) = \", w2, \"; u = sqrt2: residual valuation \", qr[3]);\nI2 = [ptimg(comps, eps, 2, 2, y2), ptimg(comps, eps, 2, 4, y4), infimg(comps, eps, 2, 2, w2), quadimg(comps, eps, 2, 2, r, qr[1], qr[2], qr[3])];\nprint(\"certified (ok, margin): \", vector(4, k, I2[k][2..3]));\nif(vecmin(vector(4, k, I2[k][2])) == 0, error(\"precision not certified\"));\ny31 = pick(polrootspadic(subst(F, x, 1), 3, 40), z -> 1, \"u = 1\");\ny33 = pick(polrootspadic(subst(F, x, 3), 3, 40), z -> 1, \"u = 3\");\nprint(\"3-adic points: v(u=1) = \", y31, \"; v(u=3) = \", y33);\nI3 = [ptimg(comps, eps, 3, 1, y31), ptimg(comps, eps, 3, 3, y33)];\nprint(\"certified (ok, margin): \", vector(2, k, I3[k][2..3]));\nif(vecmin(vector(2, k, I3[k][2])) == 0, error(\"precision not certified\"));\npl2 = mkplace(comps, 2); G2 = globmat(comps, pl2);\nR2 = locimage(comps, pl2, concat([Pd], vector(4, k, I2[k][1])));\nprint(\"rank of the five 2-adic images: \", f2span_rank(R2), \" (= dim J(Q_2)/2J(Q_2) = 2 + 3 from 1.1.12b)\");\npl3 = mkplace(comps, 3); G3 = globmat(comps, pl3);\nR3 = locimage(comps, pl3, concat([Pd], vector(2, k, I3[k][1])));\nprint(\"rank of the three 3-adic images: \", f2span_rank(R3), \" (= dim J(Q_3)[2] = 3 from 1.1.12b)\");\nC2 = matconcat([Ctot, constraint(G2, R2)]); print(\"after the 2-adic condition: \", seldim(C2));\nC3 = matconcat([C2, constraint(G3, R3)]); print(\"after the 3-adic condition: \", seldim(C3), \" => rank J(Q) + dim J(Q)[2] <= \", seldim(C3));\nK = f2ker(C3~); sol = express(GC, charvec(comps, AX, Pd));\nprint(\"delta(P - O): nonzero \", sol != 0*sol, \"; in the final space \", matrank(Mod(matconcat([K, sol]), 2)) == matrank(Mod(K, 2)));\nprint(\"time \", getabstime() - t0, \" ms\");\nquit;\n" }, { "path": "anc/code/1.1.12/1.1.12g_points_F2.gp", "size_bytes": 1222, "sha256": "0ea74bb655a5d64d80aeef78c01658ef436473d645b59e67650be9c709101b34", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.12g #C(F_{2^k}) for k = 1, 2, 3, the numerator of the zeta function and #J(F_2), for\n\\\\ C: G(u,v) = u^4-v^3-uv-u-1 = 0 (good reduction at 2; one point O at infinity over every field,\n\\\\ since the line at infinity meets C only at O). Also div(v+1) = 4P - 4O, P = (0,-1).\n\\\\ Usage: gp -q 1.1.12g_points_F2.gp < /dev/null\nG = u^4-v^3-u*v-u-1;\ncnt(p, k) = { my(g = ffgen(p^k, 'a), r = ffprimroot(g), e = g^0, L = List([0*g]), c = 1);\n for(i = 1, p^k - 1, listput(L, e); e *= r); \\\\ all elements of F_{p^k}\n foreach(L, a, foreach(L, b, if(substvec(G, [u, v], [a, b]) == 0, c++))); c }; \\\\ affine points + O\nN = vector(3, k, cnt(2, k)); print(\"#C(F_2), #C(F_4), #C(F_8) = \", N);\nq = 2; s = vector(3, k, q^k + 1 - N[k]);\ne1 = s[1]; e2 = (e1*s[1] - s[2])/2; e3 = (e2*s[1] - e1*s[2] + s[3])/3;\nLp = 1 - e1*T + e2*T^2 - e3*T^3 + q*e2*T^4 - q^2*e1*T^5 + q^3*T^6;\nprint(\"numerator of Z(C/F_2, T) = \", Lp, \"; #J(F_2) = L(1) = \", subst(Lp, T, 1));\nprint(\"G(u,-1) = \", subst(G, v, -1), \" (4-fold contact of v = -1 at P); G_v(P) = \", substvec(deriv(G, v), [u, v], [0, -1]));\ns1 = O(u^8); for(k = 1, 8, s1 = (u^4 + 3*s1^2 - s1^3 - u*s1)/3 + O(u^8));\nprint(\"v + 1 = \", s1, \" at P (local parameter u)\");\nquit;\n" }, { "path": "anc/code/1.1.13/1.1.13a_geometry_fields.gp", "size_bytes": 4696, "sha256": "ca471cecc2b11e689f81bca356a965a5a1dc174f98ec99e7af7e0302545d7c2f", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.13a Geometry of C and the bitangent algebra.\n\\\\ Target F(x,y) = x^4+y^3+xy+y-1; x = x, v = -y: C: G(x,v) = x^4-v^3-(x+1)v-1 = 0, O = (0:1:0).\n\\\\ Checks: transport; smoothness at O (chart t = x/v, w = 1/v) and the rational hyperflex; affine\n\\\\ singular points through the critical algebra (G_x = 0 gives v = 4*x^3); bad primes, nodes and\n\\\\ their thickness; smoothness at the remaining small primes; factorisation of the bitangent slope\n\\\\ resultant (lines v = m x + b); signature, discriminant and decomposition of small primes in the\n\\\\ two fields. Usage: gp -q 1.1.13a_geometry_fields.gp < /dev/null\ndefault(parisizemax, 2*10^9);\ntmp = b + x + v + X + t + w + Z;\nF = x^4+y^3+x*y+y-1;\nG = x^4-v^3-(x+1)*v-1;\nprint(\"transport: F(x,-v) == G: \", substvec(F,[x,y],[x,-v]) == G);\nGc = numerator(substvec(G,[x,v],[t/w,1/w])*w^4);\nprint(\"chart at O: \", Gc, \"; d/dw at (0,0) = \", polcoef(polcoef(Gc,1,w),0,t), \" (unit in every characteristic)\");\nprint(\"line at infinity: w = 0 meets C where \", subst(Gc,w,0), \" = 0 (4-fold contact at O: rational hyperflex)\");\nGu = deriv(G,x); Gv = deriv(G,v);\nprint(\"G_x = \", Gu, \", G_v = \", Gv);\ncr = numerator(subst(Gv, v, 4*x^3)); cr = cr/content(cr);\nprint(\"critical algebra: \", cr, \" = \", factor(cr));\nvt = 12*G-3*x*Gu-4*v*Gv;\nprint(\"Euler identity: 12G - 3x G_x - 4v G_v = \", vt, \" => critical value = (\", vt, \")/12\");\n{\nforeach(factor(cr)[,1], c,\n my(d = poldegree(c), lc = pollead(c), g = lc^(d-1)*subst(c, x, X/lc), L = nfinit(g), uu = Mod(X/lc, g), vv = subst(4*x^3, x, uu),\n val = substvec(G, [x,v], [uu,vv]), hess = substvec(deriv(Gu,x)*deriv(Gv,v)-deriv(Gu,v)^2, [x,v], [uu,vv]), fa);\n if(substvec(Gu,[x,v],[uu,vv]) != 0 || substvec(Gv,[x,v],[uu,vv]) != 0, error(\"not a critical point\"));\n print(\"factor \", c, \": norm of the critical value \", factor(norm(val)), \"; norm of the Hessian \", factor(norm(hess)));\n fa = idealfactor(L, lift(val));\n for(i=1,#fa~, my(pr=fa[i,1]); if(pr.p > 3,\n print(\" p = \", pr.p, \": prime of residue degree \", pr.f, \", valuation of the critical value \", fa[i,2],\n \", Hessian valuation \", idealval(L, lift(hess), pr), \" -> \", pr.f, \" ordinary node(s) of thickness \", fa[i,2]))));\n}\nsing(p) = gcd([Mod(1,p)*polresultant(G,Gv,v), Mod(1,p)*polresultant(G,Gu,v), Mod(1,p)*polresultant(Gu,Gv,v)]);\n{foreach([2,3,5,7,11,13], p, my(g = sing(p)); print(\"p = \", p, \": \", if(poldegree(g) <= 0, \"no singular point (smooth fibre)\", Str(x, \"-coordinates of singular points: \", factor(g)))));}\n\\\\ the node at 13 (thickness 2): Newton-solve G_x = G_v = 0 in Z_13 from the singular point mod 13\n{my(p = 13, g = sing(13), x0, v0, X0, V0, J, d);\n if(poldegree(g) != 1, error(\"expected one singular x mod 13\"));\n x0 = lift(-polcoef(g,0)/polcoef(g,1)); v0 = lift(Mod(4*x0^3, p));\n X0 = Mod(x0, p^30); V0 = Mod(v0, p^30);\n for(it = 1, 10, J = [substvec(deriv(Gu,x),[x,v],[X0,V0]), substvec(deriv(Gu,v),[x,v],[X0,V0]); substvec(deriv(Gv,x),[x,v],[X0,V0]), substvec(deriv(Gv,v),[x,v],[X0,V0])];\n d = matsolve(J, [substvec(Gu,[x,v],[X0,V0]); substvec(Gv,[x,v],[X0,V0])]); X0 -= d[1,1]; V0 -= d[2,1]);\n print(\"p = 13: singular point (x,v) = \", [x0, v0], \" mod 13; v_13(G) at the 13-adic critical point = \", valuation(lift(substvec(G,[x,v],[X0,V0])), p),\n \", Hessian mod 13 = \", substvec(deriv(Gu,x)*deriv(Gv,v)-deriv(Gu,v)^2,[x,v],[x0,v0]) % p, \" -> ordinary node of thickness 2\");}\n\\\\ ---- bitangents v = m x + b\nQ = subst(G, v, m*x+b); e4 = polcoef(Q,4,x);\nq3=polcoef(Q,3,x)/e4; q2=polcoef(Q,2,x)/e4; q1=polcoef(Q,1,x)/e4; q0c=polcoef(Q,0,x)/e4;\nc1=q3/2; c0=(q2-c1^2)/2;\nR = polresultant(numerator(q1-2*c1*c0), numerator(q0c-c0^2), b);\nfaR = factor(R); print(\"Res_b factors (degree, multiplicity): \", vector(#faR~,i,[poldegree(faR[i,1]), faR[i,2]]));\n{for(i=1,#faR~, my(g = faR[i,1]/pollead(faR[i,1])); if(poldegree(g) <= 2, print(\" rational slope factor: \", g)));}\nf10 = m^10 + 10*m^9 + 48*m^8 + 144*m^7 + 288*m^6 + 384*m^5 + 344*m^4 + 224*m^3 + 96*m^2 - 16;\nf16 = m^16 - 8*m^15 + 36*m^14 - 112*m^13 + 272*m^12 - 528*m^11 + 872*m^10 - 1264*m^9 + 1920*m^8 - 3008*m^7 + 4256*m^6 - 4896*m^5 + 4224*m^4 - 2560*m^3 + 768*m^2 - 64*m + 128;\n{print(\"f10, f16 are factors: \", vector(#faR~,i, faR[i,1]/pollead(faR[i,1]) == f10) != 0, \" \", vector(#faR~,i, faR[i,1]/pollead(faR[i,1]) == f16) != 0,\n \"; irreducible: \", polisirreducible(f10), \" \", polisirreducible(f16), \"; 27 = 1 + 10 + 16: \", poldegree(R) == 27);}\n{\nforeach([[\"K10\", f10], [\"K16\", f16]], e, my(K = nfinit(e[2]));\n print(e[1], \": signature \", K.sign, \", |disc| = \", factor(abs(K.disc)), \"; nfcertify: \", nfcertify(K));\n foreach([2,3,5,13], p, print(\" p = \", p, \": (e,f) = \", [[pr.e, pr.f] | pr <- idealprimedec(K, p)])));\n}\nquit;\n" }, { "path": "anc/code/1.1.13/1.1.13b_orthogonal_group.py", "size_bytes": 8437, "sha256": "d62c7370ff8a3c3865d32c82979e215d0fddc9cfc9ff6e496152dc5c28092467", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"1.1.13b Finite group computations for the marked-bitangent code (no curve, no number field).\n\nV = F_2^6 with q(z) = z1 z2 + z3 z4 + z5 z6 + z5 + z6; the 27 nonzero isotropic vectors <-> the 27 finite\nbitangents; v0 = (1,0,0,0,0,0) <-> the rational bitangent. H = group generated by the transvections\nz -> z + B(z,a) a with q(a) = 1, B(a,v0) = 0. Prints |H|, its orbits, the code weights of\nV -> E = F_2^27, dim V^H, E^H, (E/V)^H, the map H -> S5 (pairs {w, w+v0} in the 10-orbit), its kernel N,\nnormal closures, the S5 images and fixed spaces of the elements with the Frobenius cycle types at 3 and 5 of\n1.1.13, and all tame decomposition groups (tau of order 5, sigma tau sigma^-1 = tau^2) with\norbit pattern (5,5), (5,1,10). Usage: python3 -I 1.1.13b_orthogonal_group.py (standard library)\n\"\"\"\nimport itertools, sys\nfrom collections import Counter\ndef q(z): return (z[0]*z[1]+z[2]*z[3]+z[4]*z[5]+z[4]+z[5])%2\ndef add(u,v): return tuple((a+b)%2 for a,b in zip(u,v))\ndef B(u,v): return (q(add(u,v))-q(u)-q(v))%2\nV=[tuple(t) for t in itertools.product([0,1],repeat=6)]\nzero=(0,)*6\niso=[v for v in V if v!=zero and q(v)==0]\nprint(\"nonzero isotropic:\",len(iso))\nv0=(1,0,0,0,0,0); assert v0 in iso\nidx={v:i for i,v in enumerate(V)}\n# transvections\ngens=[]\nfor a in V:\n if q(a)==1 and B(a,v0)==0:\n perm=tuple(idx[add(z,a) if B(z,a) else z] for z in V)\n gens.append(perm)\nprint(\"number of transvection generators:\",len(gens))\ndef compose(p,r): return tuple(p[r[i]] for i in range(len(r))) # p∘r\n# generate group by BFS\nident=tuple(range(64))\nG={ident}; frontier=[ident]\nwhile frontier:\n nf=[]\n for g in frontier:\n for s in gens:\n h=compose(s,g)\n if h not in G: G.add(h); nf.append(h)\n frontier=nf\nH=list(G); print(\"|H| =\",len(H))\n# check every element is orthogonal and fixes v0\nassert all(g[idx[v0]]==idx[v0] for g in H)\nassert all(q(V[g[i]])==q(V[i]) for g in H[:200] for i in range(64))\n# orbits on iso\nisoi=[idx[v] for v in iso]\norbs=[]; seen=set()\nfor i in isoi:\n if i in seen: continue\n o={g[i] for g in H}; seen|=o; orbs.append(sorted(o))\nprint(\"orbit sizes on 27:\",sorted(len(o) for o in orbs))\nO1=[o for o in orbs if len(o)==1][0]; O10=[o for o in orbs if len(o)==10][0]; O16=[o for o in orbs if len(o)==16][0]\nlab=O1+O10+O16 # labels of 27 bitangents ordered by orbit\n# code\ndef code(v): return tuple(B(v,V[w]) for w in lab)\nC=[code(v) for v in V]\nprint(\"code weights:\",sorted(Counter(sum(c) for c in C).items()))\n# rank of code (injective?)\ndef rank(vecs):\n rows=[int(''.join(map(str,v)),2) for v in vecs]\n r=0; rows=[x for x in rows if x]\n basis=[]\n for x in rows:\n for b in basis: x=min(x,x^b)\n if x: basis.append(x)\n return len(basis)\nprint(\"dim code image:\",rank(C))\n# invariants: J[2]^G = fixed vectors of V under group Gp (list of perms on V indices)\ndef fixed_dim_V(Gp):\n fixed=[v for v in V if all(V[g[idx[v]]]==v for g in Gp)]\n return len(fixed).bit_length()-1\ndef perm27(g): return tuple(lab.index(g[w]) for w in lab)\ndef fixed_dim_E(Gp):\n # orbits of Gp on 27 positions\n P=[perm27(g) for g in Gp]\n par=list(range(27))\n def f(i):\n while par[i]!=i: par[i]=par[par[i]]; i=par[i]\n return i\n for p in P:\n for i in range(27): \n a,b=f(i),f(p[i]); \n if a!=b: par[a]=b\n return len({f(i) for i in range(27)})\ndef gens_of(Gp): return Gp\n# dim (E/J2)^G = dim E^G - dim J2^G + dim ker(H^1(G,J2)->H^1(G,E))... compute directly: quotient fixed space\ndef quotient_fixed_dim(Gp):\n # E/C, compute dimension of {e mod C : g e - e in C for all g}\n Cbasis=[]; \n for c in C:\n x=int(''.join(map(str,c)),2)\n for b in Cbasis: x=min(x,x^b)\n if x: Cbasis.append(x)\n def red(x):\n for b in sorted(Cbasis,reverse=True): x=min(x,x^b)\n return x\n # reduce with proper echelon\n # build echelon basis with pivots\n ech=[]\n for x in Cbasis:\n for b in ech: x=min(x,x^b)\n if x: ech.append(x); ech.sort(reverse=True)\n def redE(x):\n for b in ech: x=min(x,x^b)\n return x\n P=[perm27(g) for g in Gp]\n def act(p,x):\n bits=[(x>>(26-i))&1 for i in range(27)]\n nb=[0]*27\n for i in range(27): nb[p[i]]=bits[i]\n return int(''.join(map(str,nb)),2)\n # quotient space basis: unit vectors not pivots\n # solve linear system: unknown e in E (27 bits) with (g-1)e in C for all g; then quotient by C\n # Build matrix of linear maps e -> redE((g-1)e) for generators g\n cols=[]\n for i in range(27):\n e=1<<(26-i)\n img=[]\n for p in P: img.append(redE(act(p,e)^e))\n cols.append(img)\n # kernel of map E -> (E/C)^k ; kernel contains C; dim kernel - dim C\n # represent map as vectors concatenated\n def concat(img): \n r=0\n for t in img: r=(r<<27)|t\n return r\n M=[concat(c) for c in cols]\n # kernel dimension = 27 - rank(M)\n basis=[]\n for x in M:\n for b in basis: x=min(x,x^b)\n if x: basis.append(x)\n return 27-len(basis)-len(ech)\nprint(\"dim J2^H =\",fixed_dim_V(H),\" dim E^H =\",fixed_dim_E(H),\" dim (E/J2)^H =\",quotient_fixed_dim(H))\n# projection to S5 on pairs {w, w+v0} inside the 10-orbit\npairs=[]; s=set()\nfor w in O10:\n if w in s: continue\n w2=idx[add(V[w],v0)]; pairs.append((w,w2)); s|={w,w2}\nassert len(pairs)==5\npairidx={}\nfor k,(a,b2) in enumerate(pairs): pairidx[a]=k; pairidx[b2]=k\ndef proj(g): return tuple(pairidx[g[pairs[k][0]]] for k in range(5))\nimgs={proj(g) for g in H}; print(\"|image in S5| =\",len(imgs))\nN=[g for g in H if proj(g)==tuple(range(5))]; print(\"|kernel N| =\",len(N))\n# N elementary abelian?\nprint(\"N elementary abelian:\", all(compose(g,g)==ident for g in N) and all(compose(g,h)==compose(h,g) for g in N for h in N))\n# normal closure of each nonzero element of N\ndef inv(g):\n r=[0]*64\n for i,j in enumerate(g): r[j]=i\n return tuple(r)\nok=True\nfor n in N:\n if n==ident: continue\n conj={compose(compose(h,n),inv(h)) for h in H}\n # span (group generated) in N\n grp={ident}; fr=[ident]\n while fr:\n nf=[]\n for a in fr:\n for c in conj:\n b=compose(a,c)\n if b not in grp: grp.add(b); nf.append(b)\n fr=nf\n if len(grp)!=16: ok=False\nprint(\"every nonzero element of N has normal closure N:\",ok)\n# cycle types on the three orbits\ndef ctype(g,orb):\n seen=set(); t=[]\n for i in orb:\n if i in seen: continue\n L=0; j=i\n while j not in seen: seen.add(j); j=g[j]; L+=1\n t.append(L)\n return tuple(sorted(t))\ndef stype(p):\n seen=set(); t=[]\n for i in range(5):\n if i in seen: continue\n L=0; j=i\n while j not in seen: seen.add(j); j=p[j]; L+=1\n t.append(L)\n return tuple(sorted(t))\ndef report(pattern,name):\n m=[g for g in H if (ctype(g,O10),ctype(g,O16))==pattern]\n print(name,\"pattern\",pattern,\": #elements\",len(m),\" projected S5 types\",Counter(stype(proj(g)) for g in m),\n \" fixed dims on V\",Counter(fixed_dim_V([g]) for g in m))\nreport(((2,8),(8,8)),\"1.1.13 Frob3: K10 (2,8), K16 (8,8)\")\nreport(((4,6),(4,12)),\"1.1.13 Frob5: K10 (4,6), K16 (4,12)\")\n# Decomposition groups at 2 (tame): tau order 5, sigma tau sigma^-1 = tau^2, orbits (1);(5,5);(1,5,10)\ndef order(g):\n k=1; h=g\n while h!=ident: h=compose(g,h); k+=1\n return k\ndef gen_group(gs):\n grp={ident}; fr=[ident]\n while fr:\n nf=[]\n for a in fr:\n for c in gs:\n b=compose(c,a)\n if b not in grp: grp.add(b); nf.append(b)\n fr=nf\n return list(grp)\ndef orbit_sizes(Gp,orb):\n seen=set(); t=[]\n for i in orb:\n if i in seen: continue\n o={g[i] for g in Gp}; seen|=o; t.append(len(o))\n return tuple(sorted(t))\ntaus=[g for g in H if g!=ident and compose(compose(compose(compose(g,g),g),g),g)==ident]\nprint(\"#elements of order 5:\",len(taus))\nres=Counter(); Dorders=Counter(); seenD=set()\nfor t in taus:\n t2=compose(t,t)\n for s in H:\n if compose(compose(s,t),inv(s))==t2:\n D=gen_group([t,s]); key=frozenset(D)\n if key in seenD: continue\n seenD.add(key)\n pat=(orbit_sizes(D,O10),orbit_sizes(D,O16))\n if pat==((5,5),(1,5,10)):\n res[(len(D),fixed_dim_V(D))]+=1\nprint(\"dyadic decomposition groups with orbits (5,5),(5,1,10): (order, dim V^D) counts:\",res)\n" }, { "path": "anc/code/1.1.13/1.1.13d_descent.gp", "size_bytes": 4903, "sha256": "7eefb9c501624e72a7bdb075ec367736e0912631f258a97a8febe77a9b61ae45", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.13d 2-descent for C: G(x,v) = x^4-v^3-(x+1)v-1 = 0 (v = -y), written as\n\\\\ F(x,y) = -G = -x^4+y^3+(x+1)y+1 with y = v; h_m = eps (y - m x - b), eps = 1.\n\\\\ Bitangent algebra L = Q x K10 x K16 (rational bitangent v = 2x - 2, slope m = 2); S = {2, 13}.\n\\\\ (1) bases of Q(S,2), K10(S,2), K16(S,2): S-units proposed by bnfinit (GRH only proposes), checked\n\\\\ exactly (support in S), independence by valuation parities and quadratic residue characters;\n\\\\ (2) norm condition (sign, v_2, v_13); 16 good primes 487, ..., 593 (images of all points of C(F_p));\n\\\\ (3) at 2: certified images of (a) P1 - O, (b) the 2-adic point with x = -3, (c) the point t = 2 of the\n\\\\ disk at O, (d) D1 - 2O, D1 cut out on v = -5x-7 by a quadratic factor over Z_2, (e) D2 - 2O on\n\\\\ v = -5x-5; (4) final space.\n\\\\ P1 = (1,0) is a contact point of the rational bitangent: its Q-component is the value of\n\\\\ 1/((v+x-1)^2+3x^2-5x+4) at P1, from (v-2x+2)((v+x-1)^2+3x^2-5x+4) = ((x-1)(x-3))^2 on C.\n\\\\ Usage: gp -q 1.1.13d_descent.gp < /dev/null (reads ../common/h31_descent_lib/)\ndefault(parisizemax, 4*10^9);\nread(\"../common/h31_descent_lib/descent_lib.gp\");\nread(\"../common/h31_descent_lib/descent_points.gp\");\nF = -x^4+y^3+(x+1)*y+1; eps = 1; Sp = [2, 13];\n{fl = [m-2, m^10 + 10*m^9 + 48*m^8 + 144*m^7 + 288*m^6 + 384*m^5 + 344*m^4 + 224*m^3 + 96*m^2 - 16,\n m^16 - 8*m^15 + 36*m^14 - 112*m^13 + 272*m^12 - 528*m^11 + 872*m^10 - 1264*m^9 + 1920*m^8 - 3008*m^7 + 4256*m^6 - 4896*m^5 + 4224*m^4 - 2560*m^3 + 768*m^2 - 64*m + 128];}\nt0 = getabstime();\ncomps = vector(3, i, mkcomp(F, fl[i], Sp, \"\"));\nprint(\"rational bitangent: slope \", comps[1][3], \", intercept \", comps[1][4]);\nprint(\"identity (v-2x+2)((v+x-1)^2+3x^2-5x+4) - ((x-1)(x-3))^2 = \", (y-2*x+2)*((y+x-1)^2+3*x^2-5*x+4) - ((x-1)*(x-3))^2, \" = F * \", ((y-2*x+2)*((y+x-1)^2+3*x^2-5*x+4) - ((x-1)*(x-3))^2) / F);\nprint(\"S-unit classes per component (Q, K10, K16): \", vector(3, i, #comps[i][6]), \"; total \", sum(i = 1, 3, #comps[i][6]));\n{ for(i = 1, 3, my(nf = comps[i][1].nf); foreach(comps[i][6], g, my(fa = idealfactor(nf, g)); for(j = 1, #fa[,1], if(setsearch(Set(Sp), fa[j,1].p) == 0, error(\"not an S-unit\"))))); }\nprint(\"all classes are S-units: 1\");\nAX = auxchars(comps, Sp, 400); GC = globcharmat(comps, AX);\nprint(\"rank of the character matrix (independence): \", matrank(Mod(GC,2)), \" of \", matsize(GC)[1]);\nCtot = normmat(comps, Sp); print(\"ambient \", matsize(Ctot)[1], \"; after the norm condition: \", seldim(Ctot));\n{ foreach([487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593], p, my(gp = goodplace(comps, eps, F, p, 30)); Ctot = matconcat([Ctot, constraint(gp[1], gp[2])]);\n print(\"p = \", p, \": #affine points \", gp[3], \", local image dim \", f2span_rank(gp[2]), \" -> \", seldim(Ctot))); }\n\\\\ ---- the prime 2\npick(L, cond, what) = { my(S = select(cond, L)); if(#S != 1, error(Str(what, \": \", #S, \" roots\"))); S[1] };\nP1 = delta(comps, eps, 1, 0); print(\"delta at P1, raw Q-component: \", P1[1], \" (contact) -> 1/((v+x-1)^2+3x^2-5x+4) = \", 1/((0+1-1)^2+3-5+4)); P1[1] = 1/((0+1-1)^2+3-5+4);\nym3 = pick(polrootspadic(subst(F, x, -3), 2, 64), z -> 1, \"x = -3\");\nGc = numerator(subst(subst(F, x, t/w), y, 1/w) * w^4); print(\"chart at O: \", Gc);\nw2 = pick(polrootspadic(subst(Gc, t, 2), 2, 64), z -> valuation(z, 2) >= 1, \"t = 2\");\nIb = ptimg(comps, eps, 2, -3, ym3); Ic = infimg(comps, eps, 2, 2, w2);\nlineimg(k, b0) = { my(q = subst(F, y, k*x + b0), fa, fz, g); q = q/pollead(q); fa = factorpadic(q, 2, 50)[,1];\n print(\"line v = \", k, \"x + \", b0, \": factorisation of G(x, line) mod 2: \", lift(factor(q*Mod(1,2))),\n \" (two coprime quadratics, Hensel); irreducible factors over Q_2 of degrees \", apply(poldegree, fa~));\n g = select(h -> poldegree(h) == 2, fa); if(#g != 1, error(\"expected one irreducible quadratic factor\"));\n dline_cert(comps, eps, k, b0, g[1], 2) };\nId = lineimg(-5, -7); Ie = lineimg(-5, -5);\nprint(\"certified: (b) \", Ib[2..3], \" (c) \", Ic[2..3], \" (d) \", Id[2], \" (e) \", Ie[2]);\nif(!(Ib[2] && Ic[2] && Id[2] && Ie[2]), error(\"precision not certified\"));\npl2 = mkplace(comps, 2); G2 = globmat(comps, pl2);\nR2 = locimage(comps, pl2, [P1, Ib[1], Ic[1], Id[1], Ie[1]]);\nprint(\"rank of the five 2-adic images: \", f2span_rank(R2), \" (= dim J(Q_2)/2J(Q_2) = 2 + 3 from 1.1.13b)\");\nC2 = matconcat([Ctot, constraint(G2, R2)]); print(\"after the 2-adic condition: \", seldim(C2), \" => rank J(Q) <= \", seldim(C2), \" - dim J(Q)[2] = \", seldim(C2) - 1);\nK = f2ker(C2~);\nP3 = delta(comps, eps, 3, 4); P3[1] = 1/((4+3-1)^2+27-15+4);\nPm = delta(comps, eps, -1, 0);\n{ foreach([[\"P- - O\", Pm], [\"P1 - O\", P1], [\"P1 + P3 - 2O\", vector(3, i, P1[i]*P3[i])]], e,\n my(sol = express(GC, charvec(comps, AX, e[2])));\n print(\"delta(\", e[1], \"): nonzero \", sol != 0*sol, \"; in the final space \", matrank(Mod(matconcat([K, sol]), 2)) == matrank(Mod(K, 2)))); }\nprint(\"time \", getabstime() - t0, \" ms\");\nquit;\n" }, { "path": "anc/code/1.1.13/1.1.13e_principal_divisors.gp", "size_bytes": 2211, "sha256": "60d1633fec5fcf7267bb3674bb4702dc46e6de44b5b57d8eabbc673dac6c06df", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.13e The principal divisors div(h1) = 22 P1 + E1 - 25 O, div(h+) = P- + 18 P1 + Q+ + E+ - 23 O,\n\\\\ div(h-) = 2 P- + 5 P1 + Q- + E- - 11 O on C: x^4-v^3-(x+1)v-1 = 0 (P- = (-1,0), P1 = (1,0),\n\\\\ Q+- = (1, alpha+-), alpha^2 = -2; h+- have coefficients in Q(sqrt -2), h+ vanishes at (1,a) and\n\\\\ h- at (1,a) with a = alpha- under the other embedding, see 1.1.13f). The functions are computed as\n\\\\ the one-dimensional kernels of the vanishing conditions in L(nO); then every claim is checked exactly.\n\\\\ Usage: gp -q 1.1.13e_principal_divisors.gp < /dev/null\ndefault(parisizemax, 2*10^9);\nread(\"1.1.13ef_lib.gp\");\nwtop(h) = { my(L = List()); for(i=0,8, for(j=0,2, my(c = polcoef(polcoef(h,i,x),j,y)); if(c != 0, listput(L, 3*i+4*j)))); L = vecsort(Vec(L),,4); [L[1], L[2]] };\nKQ = nfinit(Ka);\nordat(h, x0, y0, par) = { my(ser = locser(x0, y0, par)); valuation(subst(subst(h,x,ser[1]),y,ser[2]), s) };\n{\nforeach([[\"h1\", h1, 25, U1, E1, [[1,22]]], [\"h+\", hp, 23, Up, Ep, [[-1,1],[1,19]]], [\"h-\", hm, 11, Um, Em, [[-1,2],[1,6]]]], e,\n my(h = e[2][1], top = wtop(h), R = polresultant(F, h, y), q = R);\n print(\"== \", e[1], \": \", e[2][2], \" monomials, rank of the conditions \", e[2][3], \" (kernel of dimension 1)\");\n print(\" two largest weights \", top, \" => pole of order exactly \", top[1], \" at O\");\n print(\" order at P- = \", ordat(h,-1,0,\"y\"), \", at P1 = \", ordat(h,1,0,\"x\"),\n if(e[1] == \"h1\", \"\", Str(\", h(1, a) = \", subst(subst(h,x,1),y,al), \", h(1, -a) = \", subst(subst(h,x,1),y,-al))));\n foreach(e[6], k, q = q/(x-k[1])^k[2]);\n print(\" Res_v(G,h) = c * \", vector(#e[6], i, Str(\"(\", x - e[6][i][1], \")^\", e[6][i][2])), \" * U, deg U = \", poldegree(q),\n \"; U irreducible over Q(sqrt-2): \", #nffactor(KQ, e[4])[,1] == 1,\n \"; U(1) != 0: \", subst(e[4],x,1) != 0, \", U(-1) != 0: \", subst(e[4],x,-1) != 0);\n print(\" residual points: F(E) = 0: \", subst(subst(F,x,e[5][1]),y,e[5][2]) == 0, \", h(E) = 0: \", subst(subst(h,x,e[5][1]),y,e[5][2]) == 0);\n print(\" zeros counted: \", if(e[1]==\"h1\", \"22 + 3 = 25\", if(e[1]==\"h+\", \"1 + 18 + 1 + 3 = 23\", \"2 + 5 + 1 + 3 = 11\")), \" = pole order\"));\n}\nprint(\"h1 coefficients rational: \", type(content(h1[1])) != \"t_POLMOD\");\nquit;\n" }, { "path": "anc/code/1.1.13/1.1.13ef_lib.gp", "size_bytes": 2526, "sha256": "e72ece34a8aaf697246b42b3f6dd1268178884297ad6ac47ba76b197962b13d1", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Shared functions of 1.1.13e and 1.1.13f (from the reviewer scripts; PARI/GP).\n\\\\ C: G(x,v) = x^4-v^3-(x+1)v-1 = 0, written as F(x,y) = -G with y = v. omega = (1,x,v) dx/(3v^2+x+1).\n\\\\ a = sqrt(-2) (variable a, a^2 + 2 = 0); Q = (1, a) and its conjugate (1, -a); z: root of a residual cubic.\n[x, y, s, X];\nz = varlower(\"z\"); a = varlower(\"a\");\nF = -x^4+y^3+(x+1)*y+1;\nFx = deriv(F,x); Fy = deriv(F,y);\nKa = a^2+2; al = Mod(a, Ka);\nNS = 40;\n\\\\ local series at (x0,y0) with parameter \"x\" (x = x0 + s) or \"y\" (y = y0 + s): [x(s), y(s)]\nlocser(x0, y0, par) = {\n my(xs, ys);\n if(par == \"x\", xs = x0+s; ys = y0+O(s^NS); for(it=1,9, ys = ys - subst(subst(F,x,xs),y,ys)/subst(subst(Fy,x,xs),y,ys)),\n ys = y0+s; xs = x0+O(s^NS); for(it=1,9, xs = xs - subst(subst(F,y,ys),x,xs)/subst(subst(Fx,y,ys),x,xs)));\n [xs, ys]\n};\n\\\\ the function in L(nO) (monomials x^i y^j, j <= 2, 3i+4j <= n) with the vanishing conditions\n\\\\ conds = [[x0, y0, par, order], ...]; the kernel must be one-dimensional. Returns [h, #monomials, rank].\nmkh(n, conds) = {\n my(mons = List(), rows = List(), M, K, cv);\n for(j=0,2, for(i=0,n, if(3*i+4*j <= n, listput(mons, [i,j]))));\n foreach(conds, c, my(ser = locser(c[1], c[2], c[3]));\n for(k=0, c[4]-1, listput(rows, vector(#mons, r, polcoef(ser[1]^mons[r][1]*ser[2]^mons[r][2] + O(s^NS), k, s)))));\n M = matrix(#rows, #mons, r, c, rows[r][c]);\n K = matker(M); if(#K != 1, error(Str(\"kernel dim \", #K)));\n cv = K[,1];\n [sum(r=1, #mons, cv[r]*x^mons[r][1]*y^mons[r][2]), #mons, matrank(M)]\n};\n\\\\ residual cubic: Res_y(F,h) divided by the known factors (x - x_k)^(m_k)\nresidual(h, known) = { my(q = polresultant(F,h,y)); foreach(known, k, q = q/(x-k[1])^k[2]); if(poldegree(q) != 3, error(\"residual degree\")); q/pollead(q) };\n\\\\ the residual points: [x_E, y_E] as nested polmods (z a root of U)\nEpoint(h, U) = {\n my(Uz = subst(U,x,z), xe = Mod(z,Uz), g = gcd(subst(F,x,xe), subst(h,x,xe)));\n if(poldegree(g,y) != 1, error(\"E y not unique\"));\n [xe, -polcoef(g,0,y)/polcoef(g,1,y)]\n};\nh1 = mkh(25, [[1,0,\"x\",22]]); \\\\ div(h1) = 22 P1 + E1 - 25 O\nhp = mkh(23, [[-1,0,\"y\",1], [1,0,\"x\",18], [1,al,\"x\",1]]); \\\\ div(h+) = P- + 18 P1 + Q+ + E+ - 23 O\nhm = mkh(11, [[-1,0,\"y\",2], [1,0,\"x\",5], [1,al,\"x\",1]]); \\\\ div(h-) = 2P- + 5 P1 + Q- + E- - 11 O\nU1 = residual(h1[1], [[1,22]]); E1 = Epoint(h1[1], U1);\nUp = residual(hp[1], [[-1,1], [1,19]]); Ep = Epoint(hp[1], Up);\nUm = residual(hm[1], [[-1,2], [1,6]]); Em = Epoint(hm[1], Um);\n" }, { "path": "anc/code/1.1.13/1.1.13f_logs.gp", "size_bytes": 4273, "sha256": "989f02b516f3f92e1accf0ba90136ba2793f321b8c18e7d947910966bdd70cac", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.13f 3-adic logarithms on C: x^4-v^3-(x+1)v-1 = 0 for the basis omega = (1,x,v) dx/(3v^2+x+1):\n\\\\ traces of the tiny integrals to the residual points E1, E+, E- of 1.1.13e (unramified: expansion at\n\\\\ the endpoint e, 5 terms; ramified E-: expansion at P-, 18 terms), the table L = log[P1 - O],\n\\\\ log(Q+- - O) mod 27, the annihilators A, B, A.log(Q+- - O), and the coefficients of the chosen\n\\\\ differentials at the centres of the six residue disks (mod 3).\n\\\\ Usage: gp -q 1.1.13f_logs.gp < /dev/null\ndefault(parisizemax, 2*10^9);\nread(\"1.1.13ef_lib.gp\");\nomser(ser) = { my(xs = ser[1], ys = ser[2]); [1, xs, ys]*deriv(xs,s)/subst(subst(Fy,x,xs),y,ys) };\n\\\\ int from the point e' of the fibre x = c in the residue disk of e, to e: sum_n (-1)^n a_n delta^(n+1)/(n+1)\nlogE_unram(Ept, c, nterms) = {\n my(xe = Ept[1], ye = Ept[2], xs = xe+s, ys = ye+O(s^(nterms+1)), om, del = xe-c, res = vector(3));\n for(it=1,7, ys = ys - subst(subst(F,x,xs),y,ys)/subst(subst(Fy,x,xs),y,ys));\n om = omser([xs, ys]);\n for(j=1,3, my(S = 0); for(n=0, nterms-1, S += (-1)^n*polcoef(om[j],n,s)*del^(n+1)/(n+1)); res[j] = trace(S));\n res };\n\\\\ E- in the disk of P- (parameter v): Newton sums of v on E-\nlogE_ram(Ept, nterms) = {\n my(ser = locser(-1,0,\"y\"), om = omser(ser), ye = Ept[2], res = vector(3), pk = vector(nterms+1, k, trace(ye^k)));\n for(j=1,3, my(S = 0); for(n=0, nterms-1, S += polcoef(om[j],n,s)*pk[n+1]/(n+1)); res[j] = S);\n res };\n\\\\ 3-adic embedding a -> alpha with alpha^2 = -2, alpha == r (mod 3)\nemb(e, r, prec) = { my(alp = sqrt(-2+O(3^prec))); if((truncate(alp)-r) % 3 != 0, alp = -alp); if(type(e) == \"t_POLMOD\", subst(lift(e), a, alp), e+O(3^prec)) };\nmod3k(v, k) = vector(#v, j, truncate(v[j]+O(3^k)) % 3^k);\n\\\\ ---- positions of the residual points\nprint(\"E1: x-coordinates mod 3: \", lift(factor(U1*Mod(1,3))), \"; v3 of the charpoly of x-1: \", vector(4,k,valuation(polcoef(charpoly(E1[1]-1,X),k-1,X),3)));\nprint(\"E1: 3v^2+x+1 is a unit: v3(norm) = \", valuation(norm(subst(subst(Fy,x,E1[1]),y,E1[2])),3));\ncxp = charpoly(Ep[1], X); print(\"E+ (a -> alpha+ = 1 mod 3): charpoly of x mod 3 = \", Pol(vector(4,k, truncate(emb(polcoef(cxp,4-k,X),1,30)) % 3)));\ncym = charpoly(Em[2], X); print(\"E- (a -> alpha- = 2 mod 3): v3 of the charpoly coefficients of v: \", vector(4,k, valuation(emb(polcoef(cym,k-1,X),2,30),3)), \" (3-Eisenstein: v3(v) = 1/3)\");\nprint(\"E- : v3 of the charpoly coefficients of x+1: \", vector(4,k, valuation(emb(polcoef(charpoly(Em[1]+1,X),k-1,X),2,30),3)));\n\\\\ ---- the traces\nl1 = logE_unram(E1, 1, 5); lp = logE_unram(Ep, 0, 5); lm = logE_ram(Em, 18);\nlpe = vector(3,j, emb(lp[j], 1, 40)); lme = vector(3,j, emb(lm[j], 2, 40));\nprint(\"log(E1 - 3O) mod 81 = \", mod3k(l1, 4), \" (5 terms; omitted terms have valuation >= 5)\");\nprint(\"log(E+ - 3O) mod 81 = \", mod3k(lpe, 4), \" (5 terms)\");\nprint(\"log(E- - 3O) mod 81 = \", mod3k(lme, 4), \" (18 terms; omitted terms have valuation >= \", vecmin(vector(300,k, my(n=k+18); n/3 - valuation(n,3))), \")\");\nL = vector(3,j, -l1[j]/22 + O(3^40));\nLQp = -lpe - 18*L; LQm = -lme - 5*L;\nprint(\"L = log(P1 - O) mod 27: \", mod3k(L,3), \"; v3(L) = \", vector(3,j,valuation(L[j],3)));\nprint(\"log(Q+ - O) mod 27: \", mod3k(LQp,3), \"; log(Q- - O) mod 27: \", mod3k(LQm,3));\nA = [-L[2]/L[1], 1, 0]; B = [-L[3]/L[1], 0, 1];\nprint(\"A mod 9 = \", mod3k(A,2), \", A mod 3 = \", mod3k(A,1), \", B mod 3 = \", mod3k(B,1));\n{print(\"A.log(Q+ - O) mod 27 = \", truncate(A*LQp~ + O(3^3)) % 27, \", A.log(Q- - O) mod 27 = \", truncate(A*LQm~ + O(3^3)) % 27,\n \"; valuations \", valuation(A*LQp~,3), \", \", valuation(A*LQm~,3));}\n\\\\ ---- coefficients at the centres (omega/ds at the centre; mod 3)\nr3(e) = truncate(e + O(3)) % 3;\nprint(\"C(F_3) = O and \", [[i,j] | i<-[0..2]; j<-[0..2], substvec(F,[x,y],[i,j]) % 3 == 0]);\nprint(\"O (s = t): B.(0,0,-1) = -1 = \", r3(B*[0,0,-1]~), \" (mod 3)\");\nprint(\"P- (s = v): A.(1,-1,0)/(4x^3-v) = \", r3(A*[1,-1,0]~/(4*(-1)^3-0)));\nprint(\"P1 (s = x-1): B.(1,1,0)/(3v^2+x+1) = \", r3(B*[1,1,0]~/(0+1+1)));\nprint(\"P3 (s = x-3): A.(1,3,4)/(3v^2+x+1) = \", r3(A*[1,3,4]~/(3*16+3+1)));\nprint(\"Q+- (s = x-1): A.(1,1,alpha)/(3alpha^2+2) mod 3 = \", r3(A*[1,1,emb(al,1,40)]~/(3*emb(al,1,40)^2+2)), \", \", r3(A*[1,1,emb(al,2,40)]~/(3*emb(al,2,40)^2+2)), \" (A omega = 0 mod 3 at x = 1)\");\nquit;\n" }, { "path": "anc/code/1.1.14/1.1.14a_extra.gp", "size_bytes": 1488, "sha256": "ee15c8d60951082887e0689e15cbe1a8ac10e880fa8ba9b750661a8ff9d8203c", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.14 extra exact checks (PARI/GP): quadric data, tangent polynomial at P+ with the full 5x5 matrices,\n\\\\ discriminant of t^2+t+4 mod 7, Jacobian determinant at P+, fixed points of sigma.\nf = 3*t^6-18*t^5+36*t^3+6*t;\nprint(\"factor f: \", factor(f));\nprint(\"disc f: \", factor(poldisc(f)));\nprint(\"f(24) == 20748^2: \", subst(f,t,24)==20748^2, \" f'(24) mod 7: \", subst(f',t,24)%7);\n\\\\ coordinates (x,v,z) and (x,v,z,r,s)\nA1=[0,0,0;0,0,1/2;0,1/2,0]; A2=[1,0,0;0,0,0;0,0,0]; A3=-[0,0,1/2;0,1,-3/2;1/2,-3/2,3];\nprint(\"12*det(M(q1)-2tM(q2)+t^2M(q3)) == f: \", 12*matdet(A1-2*t*A2+t^2*A3)==f);\nB1=matconcat([A1,matrix(3,2);matrix(2,3),[3,0;0,0]]);\nB2=matconcat([A2,matrix(3,2);matrix(2,3),[0,3/2;3/2,0]]);\nB3=matconcat([A3,matrix(3,2);matrix(2,3),[0,0;0,3]]);\nP=[0,0,1,0,1]; w=[1,0,0,0,1/6];\nprint(\"P+ on D: \", [P*B1*P~, P*B2*P~, P*B3*P~], \" tangent: \", [P*B1*w~, P*B2*w~, P*B3*w~]);\nprint(\"a_{P+}(t) = \", w*B1*w~ - 2*t*w*B2*w~ + t^2*w*B3*w~);\nprint(\"disc(t^2+t+4) mod 7 = \", (1-16)%7, \" is square mod 7: \", issquare(Mod(1-16,7)));\n\\\\ Jacobian of (Q1,Q2,Q3) w.r.t. (v,r,s) at P+ (chart z=1): rows grad wrt v,r,s\nQ=[v*z+3*r^2, x^2+3*r*s, -(v^2-3*v*z+x*z+3*z^2)+3*s^2];\nJ=matrix(3,3,i,j,subst(subst(subst(subst(subst(deriv(Q[i],[v,r,s][j]),x,0),v,0),z,1),r,0),s,1)); print(\"Jacobian (v,r,s) at P+: \", J, \" det: \", matdet(J));\nprint(\"sigma fixed points: r=s=0 gives \", [x^2, v*z, -(v^2-3*v*z+x*z+3*z^2)]);\n\\\\ Mumford form of G: b(0)=0, b(24)=20748\nprint(\"1729*12 == 20748: \", 1729*12==20748);\n" }, { "path": "anc/code/1.1.14/1.1.14a_symbolic.py", "size_bytes": 2746, "sha256": "bb3fc4436a819034db294a0379ffd7c4ac10f8eef4974f8c699fb839527f2574", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Exact symbolic checks for x^4+y^3+xy+x+1=0 (source label TBTWO_25); no integer-point search.\n(Copy of TBTWO_25_symbolic_check.py without its block of checks for two other equations.)\n\nRequires Python 3.10+ and SymPy. Run:\n python3 -I 1.1.14a_symbolic.py\nThis checks identities and local Taylor coefficients, not the Selmer group\nor the theorems underlying the Prym/Chabauty construction.\n\"\"\"\nimport sympy as s\n\n\ndef main() -> None:\n x, y, v, z, r, h, t, u, w = s.symbols(\"x y v z r h t u w\")\n F = x**4 + y**3 + x*y + x + 1\n shifted = x**4 + v*(v**2 - 3*v + x + 3)\n assert s.expand(F.subs(y,v-1)-shifted) == 0\n\n # The d=9 square-gap identity, reduced by its defining equation.\n A, B = 2*w**2-6*u**4-1, 2*w**2+6*u**4+1\n E9 = 3*w**4-27*u**8-9*u**4-u*w-1\n assert s.expand(3*A*B-(4*u*w+1)-4*E9) == 0\n\n q1 = v*z\n q2 = x**2\n q3 = -(v**2-3*v*z+x*z+3*z**2)\n M = [s.hessian(q,(x,v,z))/2 for q in (q1,q2,q3)]\n f = 3*t**6-18*t**5+36*t**3+6*t\n assert s.expand(12*(M[0]-2*t*M[1]+t*t*M[2]).det()-f) == 0\n assert f.subs(t,24) == 20748**2\n assert 20748 % 7 == 0 and 20748 % 49 != 0\n assert int(s.diff(f,t).subs(t,24)) % 7 == 1\n assert (20748//7) % 7 == 3\n\n # Solve the formal implicit equations at P+=(0,0,1,0,1), one\n # coefficient at a time. All coefficients are exact rationals.\n N = 7\n vv, rr, hh = s.Integer(0), s.Integer(0), s.Integer(1)\n for j in range(1,N):\n a,b,c = s.symbols(f\"a{j} b{j} c{j}\")\n V,R,H = vv+a*x**j, rr+b*x**j, hh+c*x**j\n es = [V+3*R**2, x**2+3*R*H,\n -(V**2-3*V+x+3)+3*H**2]\n eqs = [s.expand(e).coeff(x,j) for e in es]\n sol = s.solve(eqs,(a,b,c),dict=True)\n assert len(sol) == 1\n vv,rr,hh = [s.expand(e.subs(sol[0])) for e in (V,R,H)]\n def trunc(e: s.Expr, n: int) -> s.Expr:\n return s.series(e,x,0,n).removeO().expand()\n assert trunc(hh,4) == 1+x/6-x*x/72+x**3/432\n assert trunc(rr,5) == -x*x/3+x**3/18-x**4/72\n assert trunc(vv,6) == -x**4/3+x**5/9\n\n a0 = 3*s.diff(rr,x)**2\n a1 = -2*(1+3*s.diff(rr,x)*s.diff(hh,x))\n a2 = -s.diff(vv,x)**2+3*s.diff(hh,x)**2\n assert trunc(a0,3) == 4*x*x/3\n assert trunc(a1,2) == -2+2*x/3\n assert trunc(a2,2) == s.Rational(1,12)-x/36\n # Small root: 2/3*x^2+O(x^3). The large root has no linear term.\n assert trunc(a0+a1*(2*x*x/3)+a2*(2*x*x/3)**2,3) == 0\n assert trunc(-a1/a2,2) == 24\n assert trunc(f.subs(t,2*x*x/3),3) == 4*x*x\n\n print(\"ALL SYMBOLIC CHECKS PASSED\")\n print(\"Local expansions at P_+:\")\n print(\"s =\",trunc(hh,4),\"+ O(x^4)\")\n print(\"r =\",trunc(rr,5),\"+ O(x^5)\")\n print(\"v =\",trunc(vv,6),\"+ O(x^6)\")\n print(\"Prym polynomial:\",f)\n\n\nif __name__ == \"__main__\":\n main()\n" }, { "path": "anc/code/1.1.14/1.1.14b_check_smooth.py", "size_bytes": 573, "sha256": "c002bcc71f60433b37d266491808e4e72910cb29151dd7f7b475adbb9c955943", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "from sage.all__sagemath_schemes import *\nfor p in [7, 0]:\n k = GF(p) if p else QQ\n R = PolynomialRing(k, 'x,v,z,r,s'); x,v,z,r,s = R.gens()\n es = [v*z + 3*r**2, x**2 + 3*r*s, -(v**2 - 3*v*z + x*z + 3*z**2) + 3*s**2]\n I = R.ideal(es)\n Jm = matrix(R, [[e.derivative(g) for g in R.gens()] for e in es])\n S = I + R.ideal(Jm.minors(3))\n print(\"p =\", p, \" dim(D affine cone) =\", I.dimension(), \" dim(singular locus cone) =\", S.dimension(), \"(<=0 means D smooth)\")\n if p == 0:\n print(\" genus check via Hilbert polynomial:\", I.hilbert_polynomial())\n" }, { "path": "anc/code/1.1.14/1.1.14b_prym_lpoly.m", "size_bytes": 1641, "sha256": "fc15adff763217bda0ab1cfa6f60e54d428e1f845afb3cf7fdb1b806250d12ca", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Independent check (Claude, 14 Oct 2026) for TBTWO-25.\n// D (genus 5, intersection of three quadrics in P^4) is an unramified double\n// cover of the original quartic C3: x^4 + v z (v^2 - 3 v z + x z + 3 z^2) = 0.\n// If Prym(D/C3) ~ J_H over Q with H: y^2 = 3t^6-18t^5+36t^3+6t (twist included),\n// then L_p(D) = L_p(C3) L_p(H) at every good prime.\nSetColumns(0);\nQ := Rationals(); P := PolynomialRing(Q);\nf := 3*t^6 - 18*t^5 + 36*t^3 + 6*t;\n// 12 det(M(q1) - 2t M(q2) + t^2 M(q3)) = f, from the three quadrics alone.\nP3 := PolynomialRing(Q,3);\nq1 := v*z; q2 := x^2; q3 := -(v^2 - 3*v*z + x*z + 3*z^2);\nM := func;\nPP := PolynomialRing(Q);\nMt := ChangeRing(M(q1),PP) - 2*T*ChangeRing(M(q2),PP) + T^2*ChangeRing(M(q3),PP);\nprint \"12*det =\", 12*Determinant(Mt), \" equals f:\", 12*Determinant(Mt) eq Evaluate(f,T);\n// q1*q3 - q2^2 is (minus) the projectivised original equation with y = v - 1.\nprint \"q1*q3-q2^2 =\", q1*q3 - q2^2;\nfor p in [5,7,11,13,17] do\n k := GF(p);\n P4 := ProjectiveSpace(k,4);\n D := Curve(P4, [V*Z+3*R^2, X^2+3*R*S, -(V^2-3*V*Z+X*Z+3*Z^2)+3*S^2]);\n P2 := ProjectiveSpace(k,2);\n C3 := Curve(P2, a^4 + b*c*(b^2 - 3*b*c + a*c + 3*c^2));\n kp := PolynomialRing(k);\n Hp := HyperellipticCurve(kp!f);\n ok := IsNonsingular(D) and IsNonsingular(C3) and Discriminant(kp!f) ne 0;\n if not ok then print \"p\", p, \"bad reduction, skipped\"; continue; end if;\n LD := LPolynomial(D); LC := LPolynomial(C3); LH := LPolynomial(Hp);\n print \"p\", p, \"genus D\", Genus(D), \" L(D)=L(C3)L(H):\", LD eq LC*LH, \" #J_H(F_p) =\", Evaluate(LH,1);\n print \" Cputime\", Cputime();\nend for;\n" }, { "path": "anc/code/1.1.14/1.1.14c_certificate.m", "size_bytes": 2718, "sha256": "4f41c637f977e15ebaa1ed0d6b65d0ba4fe6a70b998f96af2a99d14f29a77dc3", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "/*\nTBTWO_25 -- exact arithmetic certificate (Magma V2.29-10)\n\nStatement proved in the accompanying note:\n x^4 + y^3 + x*y + x + 1 = 0 over Z iff (x,y)=(0,-1).\n\nThis script checks the finite arithmetic ingredients. It is not a Lean\nformalization of the entire proof. The elementary descent and local\n7-adic uniqueness argument are given in Diop_TBTWO_25.pdf.\n\nThe tangent-polynomial formula is adapted from Nils Bruin,\nThe arithmetic of Prym varieties in genus 3, Section 6,\nhttps://arxiv.org/abs/math/0408069 and the author's routines.m.\nNo search over original integer solutions is performed.\n*/\n\nSetSeed(1);\n// Explicit unconditional class-group proof bound; do not replace by GRH.\nb1 := map Integers() |\n O :-> Maximum(50, BachBound(O) div 10)>;\nb2 := map Integers() |\n O :-> MinkowskiBound(O)>;\nSetClassGroupBoundMaps(b1, b2);\n\nQ := PolynomialRing(Rationals());\nf := 3*t^6 - 18*t^5 + 36*t^3 + 6*t;\nJ := Jacobian(HyperellipticCurve(f));\nassert #TwoSelmerGroup(J) eq 2;\nG := J![t^2-24*t, (1729/2)*t];\nassert G ne J!0;\nassert Evaluate(f,24) eq 20748^2;\nassert Valuation(20748,7) eq 1;\nassert Valuation(Evaluate(Derivative(f),24),7) eq 0;\nassert Integers()!Discriminant(f) mod 5 ne 0;\nassert Integers()!Discriminant(f) mod 7 ne 0;\n\nJ5 := Jacobian(HyperellipticCurve(PolynomialRing(GF(5))!f));\nassert #J5 eq 23;\n\nk := GF(7);\nU := PolynomialRing(k);\nJ7 := Jacobian(HyperellipticCurve(U!f));\nG7 := J7![u^2-24*u, (k!1729/2)*u];\nassert #J7 eq 32;\nassert #Points(J7) eq 32;\nassert Order(G7) eq 2;\n// Hence a rational rank-one generator can have only odd index relative to G.\nassert not exists{T : T in Points(J7) | 2*T eq G7};\n\nP4 := ProjectiveSpace(k,4);\nes := [ V*Z+3*R^2,\n X^2+3*R*S,\n -(V^2-3*V*Z+X*Z+3*Z^2)+3*S^2 ];\nD := Curve(P4,es);\nassert IsNonsingular(D);\nps := Points(D);\nassert #ps eq 8;\nms := [SymmetricMatrix(e) : e in es];\nallowed := [];\n\nfor P in ps do\n vv := Vector(Eltseq(P));\n M := Matrix([vv*m : m in ms]);\n K := Kernel(Transpose(M));\n // A tangent direction independent of the projective radial direction.\n w := ExtendBasis([K!vv],K)[2];\n a := InnerProduct(w*ms[1],w)\n - 2*u*InnerProduct(w*ms[2],w)\n + u^2*InnerProduct(w*ms[3],w);\n assert a ne 0;\n a /:= LeadingCoefficient(a);\n // Keep ALL Mumford b-polynomials: never select an arbitrary lift.\n candidates := Points(J7,a,2);\n assert #candidates gt 0;\n b := exists{T : T in candidates | T eq J7!0 or T eq G7};\n print Eltseq(P), a, b;\n if b then Append(~allowed,P); end if;\nend for;\nassert #allowed eq 2;\nassert &and[P[1] eq 0 and P[2] eq 0 and P[3] ne 0 : P in allowed];\nprint \"ALL ARITHMETIC CHECKS PASSED\";\n" }, { "path": "anc/code/1.1.14/1.1.14c_check_f7.py", "size_bytes": 2193, "sha256": "29fb397dfebb9c5038c9fa94f653432a7adfb99ac120297c54813031c7da58bb", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Enumerate D(F_7), check smoothness at F7-points, compute tangent polynomial a_p(t) (independent of w choice)\nimport itertools\np = 7\ndef norm(P):\n for c in P:\n if c % p:\n inv = pow(c, -1, p); return tuple((x*inv) % p for x in P)\n return None\ndef e1(P): x,v,z,r,s = P; return v*z + 3*r*r\ndef e2(P): x,v,z,r,s = P; return x*x + 3*r*s\ndef e3(P): x,v,z,r,s = P; return -(v*v - 3*v*z + x*z + 3*z*z) + 3*s*s\nE = [e1, e2, e3]\ndef grad(P):\n x,v,z,r,s = P\n return [[0, z, v, 6*r, 0],\n [2*x, 0, 0, 3*s, 3*r],\n [-z, -(2*v-3*z), -(-3*v + x + 6*z), 0, 6*s]]\ndef rank_mod(M):\n M = [[c % p for c in row] for row in M]; rk = 0; cols = len(M[0])\n for c in range(cols):\n piv = None\n for i in range(rk, len(M)):\n if M[i][c]: piv = i; break\n if piv is None: continue\n M[rk], M[piv] = M[piv], M[rk]\n inv = pow(M[rk][c], -1, p)\n M[rk] = [(a*inv) % p for a in M[rk]]\n for i in range(len(M)):\n if i != rk and M[i][c]:\n fac = M[i][c]; M[i] = [(a - fac*b) % p for a, b in zip(M[i], M[rk])]\n rk += 1\n return rk\npts = set()\nfor P in itertools.product(range(p), repeat=5):\n if all(c == 0 for c in P): continue\n if all(e(P) % p == 0 for e in E):\n pts.add(norm(P))\npts = sorted(pts)\nprint(\"#D(F7) =\", len(pts))\ndef qf(e, w): # evaluate homogeneous quadratic form\n return e(w) % p\nres = {}\nfor P in pts:\n G = grad(P)\n assert rank_mod(G) == 3, (\"singular F7 point\", P)\n # tangent vectors: kernel of G; enumerate all w in F7^5 with G w = 0 and w not in span(P)\n polys = set()\n for w in itertools.product(range(p), repeat=5):\n if any(sum(G[i][j]*w[j] for j in range(5)) % p for i in range(3)): continue\n if rank_mod([list(P), list(w)]) < 2: continue\n a0, a1, a2 = qf(e1, w), (-2*qf(e2, w)) % p, qf(e3, w)\n assert (a0, a1, a2) != (0, 0, 0)\n # normalise (projective in coefficient vector)\n lead = a2 if a2 else (a1 if a1 else a0)\n inv = pow(lead, -1, p)\n polys.add(((a2*inv) % p, (a1*inv) % p, (a0*inv) % p))\n res[P] = polys\n print(P, \" a_p (t^2,t,1 coeffs, normalised) =\", polys)\n" }, { "path": "anc/code/1.1.14/1.1.14c_check_jac7.py", "size_bytes": 1226, "sha256": "5a01e21c13a5ce01c2884f844b2abaab393afbf66822095f3e2295b28d4ba202", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "from sage.all__sagemath_schemes import *\nk = GF(7); R = PolynomialRing(k, 'u'); u = R.gen()\n# odd-degree model: t = 1/u, eta = Y/u^3 sends A0=(0,0) to infinity\nf = 3*u**6 - 18*u**5 + 36*u**3 + 6*u\nh = R(sum(f[i]*u**(6-i) for i in range(7)))\nprint(\"h =\", h, \" factor:\", h.factor())\nH = HyperellipticCurve(h); J = H.jacobian()\nprint(\"#J(F7) via frobenius poly:\", H.frobenius_polynomial()(1))\nJF = J(k)\n# G = [A0 + B0 - K] with B0 = (24, 20748) == (3,0) mod 7 -> u = 1/3 = 5, Y = 0\nG7 = JF([u - 5, R(0)])\nprint(\"G7 =\", G7, \" 2*G7 =\", 2*G7)\n# enumerate J(F7): all reduced divisors (a,b) with a monic deg<=2, b deg 0 else R(0)\n if d == 0 and b != 0: continue\n if b.degree() >= d and d > 0: continue\n if (b**2 - h) % a == 0:\n pts.append(JF([a, b]))\npts = list(set(pts))\nprint(\"#enumerated =\", len(pts))\nhalves = [T for T in pts if 2*T == G7]\nprint(\"solutions of 2T = G7 in J(F7):\", len(halves))\nprint(\"2-torsion count:\", len([T for T in pts if 2*T == JF(0)]))\n" }, { "path": "anc/code/1.1.14/1.1.14c_check_twist.py", "size_bytes": 3165, "sha256": "a40e29ca7f5dcad18bc6b0ae6d4c8d271fda1b29e0e01849ed1a9087555f70f3", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Sanity check of the twist of H: for points p in D(F_q), roots t_i of the tangent polynomial a_p\n# must satisfy: f(t_i) is a square in F_q(t_i) (the ruling containing the tangent line is defined there).\nimport itertools, sys\ndef check(p):\n def sq_Fp(a): a %= p; return a == 0 or pow(a, (p-1)//2, p) == 1\n fco = [0, 6, 0, 36, 0, -18, 3]\n def f_ev(t): return sum(c*pow(t, i, p) for i, c in enumerate(fco)) % p\n # F_{p^2} = F_p[T]/(T^2 + b T + c) elements as (u0,u1) meaning u0 + u1 T\n def run_quad(b, c):\n def mul(A, B):\n a0,a1 = A; b0,b1 = B\n # T^2 = -bT - c\n c0 = a0*b0 - c*a1*b1; c1 = a0*b1 + a1*b0 - b*a1*b1\n return (c0 % p, c1 % p)\n def pw(A, n):\n R = (1, 0)\n while n:\n if n & 1: R = mul(R, A)\n A = mul(A, A); n >>= 1\n return R\n T = (0, 1)\n fv = (0, 0); Tp = (1, 0)\n for cf in fco:\n fv = ((fv[0] + cf*Tp[0]) % p, (fv[1] + cf*Tp[1]) % p); Tp = mul(Tp, T)\n if fv == (0, 0): return True\n return pw(fv, (p*p - 1)//2) == (1, 0)\n def e(P):\n x,v,z,r,s = P\n return ((v*z + 3*r*r) % p, (x*x + 3*r*s) % p, (-(v*v - 3*v*z + x*z + 3*z*z) + 3*s*s) % p)\n def grad(P):\n x,v,z,r,s = P\n return [[0, z, v, 6*r, 0], [2*x, 0, 0, 3*s, 3*r], [-z, -(2*v-3*z), -(-3*v + x + 6*z), 0, 6*s]]\n reps = [(1, a, b) for a in range(p) for b in range(p)] + [(0, 1, b) for b in range(p)] + [(0, 0, 1)]\n good = bad = degen = 0; npts = 0\n for (x0, v0, z0) in reps:\n for perm in [(x0, v0, z0)]:\n x, v, z = perm\n for r in range(p):\n for s in range(p):\n P = (x, v, z, r, s)\n if e(P) != (0, 0, 0): continue\n npts += 1\n G = grad(P)\n # find tangent w not proportional to P: brute force small search\n w = None\n for cand in itertools.product(range(p), repeat=5):\n if all(sum(G[i][j]*cand[j] for j in range(5)) % p == 0 for i in range(3)):\n # not proportional to P\n prop = all((cand[i]*P[j] - cand[j]*P[i]) % p == 0 for i in range(5) for j in range(5))\n if not prop: w = cand; break\n x1, v1, z1, r1, s1 = w\n a0 = (v1*z1 + 3*r1*r1) % p\n a1 = (-2*(x1*x1 + 3*r1*s1)) % p\n a2 = (-(v1*v1 - 3*v1*z1 + x1*z1 + 3*z1*z1) + 3*s1*s1) % p\n if a2 == 0: degen += 1; continue\n inv = pow(a2, -1, p); b, c = a1*inv % p, a0*inv % p\n roots = [t for t in range(p) if (t*t + b*t + c) % p == 0]\n if roots:\n ok = all(sq_Fp(f_ev(t)) for t in roots)\n else:\n ok = run_quad(b, c)\n if ok: good += 1\n else: bad += 1\n return npts, good, bad, degen\nfor p in [11, 13, 17, 19]:\n print(p, \"(#D(F_p), consistent, inconsistent, a2=0 skipped) =\", check(p)); sys.stdout.flush()\n" }, { "path": "anc/code/1.1.14/1.1.14e_beta.gp", "size_bytes": 1642, "sha256": "f1789b1052f13f31359946490d34d04ab088e1f5e323196eac318f049da20ad2", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 7-adic logarithm of G = [B0 - A0] via tiny integral from W=(alpha,0) to B0=(24,20748)\ndefault(seriesprecision, 40);\nf = 3*t^6 - 18*t^5 + 36*t^3 + 6*t;\nprint(\"f(24) == 20748^2: \", subst(f,t,24) == 20748^2, \" v7(20748)=\", valuation(20748,7), \" f'(24) mod 7 = \", subst(f',t,24) % 7);\nprint(\"disc f mod 5,7: \", poldisc(f)%5, \" \", poldisc(f)%7, \" factor disc: \", factor(poldisc(f)));\nP = 7; prec = 25;\nrts = polrootspadic(f, P, prec);\nprint(\"7-adic roots of f: \", apply(z->lift(z) % 49, rts));\nal = 0; for(i=1,#rts, if(lift(rts[i]) % 7 == 3, al = rts[i]));\nprint(\"alpha mod 7^4 = \", lift(al) % 7^4);\n\\\\ g(tau) = f(alpha+tau); eta^2 = g(tau); tau = ginv(eta^2)\ng0 = subst(f, t, al + T);\ngs = sum(k=1,6, polcoef(g0,k,T)*T^k) + O(T^30);\nprint(\"v7 of f'(alpha): \", valuation(polcoef(g0,1,T),7));\nginv = serreverse(gs); \\\\ tau as series in u=eta^2\ntau = subst(ginv, T, e^2); \\\\ series in e\ndtau = deriv(tau, e);\nw0 = dtau/(2*e); \\\\ omega0 = dt/(2 eta) in d(eta)\nw1 = (al + tau)*w0;\nI0 = intformal(w0, e); I1 = intformal(w1, e);\neB = 20748;\nl0 = subst(truncate(I0), e, eB); l1 = subst(truncate(I1), e, eB);\nprint(\"v7(l0)=\", valuation(l0,7), \" v7(l1)=\", valuation(l1,7));\nbeta = l1/l0;\nprint(\"beta mod 7^6 = \", lift(beta + O(7^6)), \" beta mod 7 = \", lift(beta + O(7)));\nprint(\"check series coefficients of w0, w1 are 7-integral (min valuation): \", vecmin(apply(c->if(c==0,99,valuation(c,7)), Vec(truncate(w0)))), \" \", vecmin(apply(c->if(c==0,99,valuation(c,7)), Vec(truncate(w1)))));\n\\\\ Also the 2-torsion statement: A0=(0,0) and W=(alpha,0) are both Weierstrass points\nprint(\"f(0)=\", subst(f,t,0));\n" }, { "path": "anc/code/1.1.14/1.1.14f_series.py", "size_bytes": 4368, "sha256": "e171d4289d8ba119fdf19a1a9bcc21eb33eaadad52ddc20bccce37c7896b4cd8", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent local expansion at P+ / P- of D and pullback of omega0, omega1 (exact rationals)\nfrom fractions import Fraction as Fr\nimport sympy as sp\nN = 18 # truncation order in x\n\ndef mul(a, b):\n c = [Fr(0)]*N\n for i, ai in enumerate(a):\n if ai == 0: continue\n for j in range(N-i):\n c[i+j] += ai*b[j]\n return c\ndef add(*args):\n c = [Fr(0)]*N\n for a in args:\n for i in range(N): c[i] += a[i]\n return c\ndef sc(k, a): return [Fr(k)*ai for ai in a]\ndef const(k):\n c = [Fr(0)]*N; c[0] = Fr(k); return c\nX = [Fr(0)]*N; X[1] = Fr(1)\ndef inv(a):\n assert a[0] != 0\n b = [Fr(0)]*N; b[0] = 1/a[0]\n for n in range(1, N):\n s = sum(a[k]*b[n-k] for k in range(1, n+1))\n b[n] = -s/a[0]\n return b\ndef sqrt1(a): # sqrt with a[0] a nonzero rational square, choose positive root\n r0 = sp.sqrt(sp.Rational(a[0].numerator, a[0].denominator))\n assert r0.is_Rational\n b = [Fr(0)]*N; b[0] = Fr(int(r0.p), int(r0.q))\n for n in range(1, N):\n s = sum(b[k]*b[n-k] for k in range(1, n))\n b[n] = (a[n] - s)/(2*b[0])\n return b\ndef deriv(a):\n return [ (i+1)*a[i+1] for i in range(N-1)] + [Fr(0)]\ndef compose_poly(coeffs, t): # sum coeffs[k] t^k\n res = const(0); pw = const(1)\n for ck in coeffs:\n res = add(res, sc(ck, pw)); pw = mul(pw, t)\n return res\n\ndef solve_branch(sgn):\n # chart z=1: v = -3 r^2 ; r = -x^2/(3 s) ; 3 s^2 = v^2 - 3 v + x + 3, s(0)=sgn\n v = const(0); r = const(0); s = const(sgn)\n for it in range(3*N):\n v = sc(-3, mul(r, r))\n r = sc(Fr(-1, 3), mul(mul(X, X), inv(s)))\n rhs = sc(Fr(1, 3), add(mul(v, v), sc(-3, v), X, const(3)))\n s = sqrt1(rhs)\n if sgn < 0: s = sc(-1, s)\n # verify equations exactly to order N\n e1 = add(v, sc(3, mul(r, r)))\n e2 = add(mul(X, X), sc(3, mul(r, s)))\n e3 = add(sc(-1, add(mul(v, v), sc(-3, v), X, const(3))), sc(3, mul(s, s)))\n assert all(c == 0 for c in e1+e2+e3), \"expansion fails\"\n return v, r, s\n\nf = [0, 6, 0, 36, 0, -18, 3] # f(t) = 3t^6 - 18t^5 + 36t^3 + 6t\n\ndef v7(q):\n q = Fr(q)\n if q == 0: return 99\n n, d = q.numerator, q.denominator; e = 0\n while n % 7 == 0: n//=7; e+=1\n while d % 7 == 0: d//=7; e-=1\n return e\n\nfor sgn in (+1, -1):\n v, r, s = solve_branch(sgn)\n print(\"branch s(0)=%d\" % sgn)\n print(\" s:\", [str(c) for c in s[:5]]); print(\" r:\", [str(c) for c in r[:6]]); print(\" v:\", [str(c) for c in v[:7]])\n print(\" min v7 of coeffs (v,r,s):\", min(v7(c) for c in v+r+s))\n vp, rp, sp_ = deriv(v), deriv(r), deriv(s)\n # tangent vector w = (1, v', 0, r', s'); quadratic forms evaluated at w\n Q1 = sc(3, mul(rp, rp)) # vz+3r^2\n Q2 = add(const(1), sc(3, mul(rp, sp_))) # x^2+3rs\n Q3 = add(sc(-1, mul(vp, vp)), sc(3, mul(sp_, sp_))) # -(v^2-3vz+xz+3z^2)+3s^2 (z'=0)\n A0, A1, A2 = Q1, sc(-2, Q2), Q3\n print(\" a_p at x=0:\", A0[0], A1[0], A2[0])\n # small root t1: t = -(A0 + A2 t^2)/A1\n t1 = const(0)\n for it in range(2*N):\n t1 = mul(sc(-1, add(A0, mul(A2, mul(t1, t1)))), inv(A1))\n t2 = add(sc(-1, mul(A1, inv(A2))), sc(-1, t1))\n chk = add(A0, mul(A1, t2), mul(A2, mul(t2, t2)))\n assert all(c == 0 for c in chk)\n print(\" t1:\", [str(c) for c in t1[:5]]); print(\" t2:\", [str(c) for c in t2[:5]])\n print(\" min v7 t1,t2 coeffs:\", min(v7(c) for c in t1), min(v7(c) for c in t2), \" v7 of t2 coeffs k>=1:\", [v7(c) for c in t2[1:10]])\n # eta1 = x*sqrt(f(t1)/x^2), eta2 = sqrt(f(t2))\n ft1 = compose_poly(f, t1); assert ft1[0] == 0 and ft1[1] == 0\n g = ft1[2:] + [Fr(0), Fr(0)]\n # g valid to order N-2 only\n eta1_over_x = sqrt1(g)\n ft2 = compose_poly(f, t2)\n eta2 = sqrt1(ft2)\n print(\" eta1/x:\", [str(c) for c in eta1_over_x[:4]], \" eta2:\", [str(c) for c in eta2[:4]])\n print(\" v7 eta2 coeffs:\", [v7(c) for c in eta2[:12]])\n # pullbacks: S_i^(k) = t_i^k t_i' /(2 eta_i)\n t1p = deriv(t1)\n # t1'/(2 eta1) = (t1'/x)/(2 eta1/x)\n t1p_over_x = t1p[1:] + [Fr(0)]\n S1_0 = mul(t1p_over_x, inv(sc(2, eta1_over_x)))\n S1_1 = mul(t1, S1_0)\n S2_0 = mul(deriv(t2), inv(sc(2, eta2)))\n S2_1 = mul(t2, S2_0)\n M = N-4\n for name, S in ((\"S1_0\", S1_0), (\"S1_1\", S1_1), (\"S2_0\", S2_0), (\"S2_1\", S2_1)):\n print(\" %s first coeffs:\" % name, [str(c) for c in S[:3]], \" v7:\", [v7(c) for c in S[:M]])\n" }, { "path": "anc/code/1.1.15/q9_exact_mod2.py", "size_bytes": 6599, "sha256": "cecaae124430d58903dbacb8a9ca4cff96480b7d2b02c70eb964afb8672e20af", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Exact finite modular checks for the Q9 quadratic-Chabauty proof.\n\nNo bounded search for integer/rational points is performed.\nAll arithmetic is in Z/2^N Z, with rational arithmetic only for 2x2 matrices\nand short integrated power series. The infinite-tail justification is in\nproof.pdf (or proof.tex); this file checks the finite data, not that analytic theorem.\n\"\"\"\nfrom fractions import Fraction as Q\nimport json\n\nPREC=40\nDEG=64\nMOD=1<>=1\n return b\ndef inv(a):\n assert a[0]&1, 'Only invert 2-adic units in the power-series ring.'\n c=[pow(a[0],-1,MOD)]+[0]*(L-1)\n for i in range(1,L):\n c[i]=(-c[0]*sum(a[j]*c[i-j] for j in range(1,i+1)))%MOD\n return c\ndef div(a,b): return mul(a,inv(b))\ndef derivative(a): return [(i+1)*a[i+1]%MOD for i in range(L-1)]+[0]\ndef shift(a,n=1): return [0]*n+a[:L-n]\ndef v2(n):\n if n==0: return 10**9\n n=abs(n); return (n&-n).bit_length()-1\ndef modq(x,m=MOD):\n x=Q(x)\n assert x.denominator&1, ('nonintegral 2-adic rational',x)\n return x.numerator*pow(x.denominator,-1,m)%m\n\ndef tiny2(a):\n ans=0\n for n in range(1,L-2):\n v=v2(n); odd=n>>v\n ans+=a[n-1]*pow(2,n-v,MOD)*pow(odd,-1,MOD)\n return ans%MOD\n\ns=[0,1]+[0]*(L-2); one=const(1)\ndef curveF(x,y):\n return add(sub(power(x,4),power(x,2)),add(mul(x,y),power(y,3)))\n\n# Four residue discs. A uses y+1; B,D use x+1,x; E uses x/y.\ndiscs=[]\nfor k in range(4):\n if k==0:\n y=add(const(-1),s); x=const(-1)\n for _ in range(7):\n den=add(sub(scale(power(x,3),4),scale(x,2)),y)\n x=sub(x,div(curveF(x,y),den))\n z=div(power(y,2),x)\n den=sub(sub(scale(x,2),scale(power(x,3),4)),y)\n w1=div(x,den); w2=div(y,den)\n elif k==1:\n x=add(const(-1),s); y=const(0)\n for _ in range(7):\n y=sub(y,div(curveF(x,y),add(x,scale(power(y,2),3))))\n z=div(power(y,2),x)\n w1=inv(add(one,scale(z,3))); w2=mul(div(y,x),w1)\n elif k==2:\n V=one\n for _ in range(7):\n eq=sub(add(add(power(s,2),mul(s,power(V,3))),V),one)\n den=add(one,scale(mul(s,power(V,2)),3))\n V=sub(V,div(eq,den))\n x=s; y=mul(s,V); z=mul(s,power(V,2))\n w1=inv(add(one,scale(z,3))); w2=mul(V,w1)\n else:\n z=const(-1)\n for _ in range(7):\n eq=sub(add(add(mul(power(s,5),power(z,2)),z),one),s)\n z=sub(z,div(eq,add(one,scale(mul(power(s,5),z),2))))\n x=mul(power(s,2),z); y=mul(s,z)\n w2=inv(add(one,scale(mul(power(s,5),z),2))); w1=mul(s,w2)\n assert all(c==0 for c in curveF(x,y))\n assert sub(power(y,2),mul(x,z))==const(0)\n assert add(sub(power(x,3),x),mul(y,add(z,one)))==const(0)\n assert sub(add(power(z,2),z),mul(y,sub(one,power(x,2))))==const(0)\n eta=[scale(mul(y,w1),2),mul(x,w1)]\n discs.append((x,y,z,[w1,w2],eta))\n\n# Only integrations between the GIVEN points B->F and D->G.\nda=[tiny2(w) for w in discs[1][3]]\ndb=[tiny2(w) for w in discs[2][3]]\nea=[tiny2(w) for w in discs[1][4]]\neb=[tiny2(w) for w in discs[2][4]]\ni13=pow(13,-1,MOD)\nie=[(da[j]+2*db[j])*i13%MOD for j in range(2)]\niF=[(7*da[j]+db[j])*i13%MOD for j in range(2)]\nje=[(ea[j]+2*eb[j]+[4,0][j])*i13%MOD for j in range(2)]\njF=[(7*ea[j]+eb[j]+[2,0][j])*i13%MOD for j in range(2)]\n\nKE=[]; KF=[]\nxb,yb,zb,wb,_=discs[1]\nxd,yd,zd,wd,_=discs[2]\nfor a in (0,1):\n if a==0:\n nuB=mul(div(add(zb,one),xb),wb[0])\n nuD=scale(mul(power(V,2),wd[0]),-2)\n else:\n # The pole at F has been subtracted exactly before expansion.\n nuB=scale(mul(div(mul(yb,add(xb,one)),add(zb,one)),wb[0]),2)\n nuD=mul(div(add(zd,one),sub(xd,one)),wd[0])\n d1,d2=tiny2(nuB),tiny2(nuD)\n KE.append((d1+2*d2)*i13%MOD)\n KF.append((7*d1+d2)*i13%MOD)\n\ndef dot(a,b): return sum(x*y for x,y in zip(a,b))\nid=[-2*x for x in ie]; jd=[-2*x for x in je]\nIB=[id,iF]\nHB=[[( -2*KE[0]-dot(jd,id))%MOD,(KF[0]-dot(jd,iF))%MOD],\n [( -2*KE[1]-dot(jF,id))%MOD,(KF[1]-dot(jF,iF))%MOD]]\nassert (HB[0][1]-HB[1][0])%MOD==0\n\ndef mm(a,b):\n return [[sum(a[i][k]*b[k][j] for k in range(2)) for j in range(2)] for i in range(2)]\ndef trans(a): return [list(t) for t in zip(*a)]\ndet=IB[0][0]*IB[1][1]-IB[0][1]*IB[1][0]\nassert v2(det)==3\nBI=[[Q(IB[1][1],det),Q(-IB[0][1],det)],\n [Q(-IB[1][0],det),Q(IB[0][0],det)]]\nMrat=mm(mm(BI,HB),trans(BI))\n# Losing at most four absolute binary digits through the inversion is safe.\nMMOD=1<<(PREC-4)\nM=[[modq(z,MMOD) for z in row] for row in Mrat]\nassert M[0][1]==M[1][0]\nassert v2(M[0][0])==3 and v2(M[0][1])==0 and v2(M[1][1])==0\n\nII=[[3*x for x in ie],[ie[j]-iF[j] for j in range(2)],id,ie]\nJJ=[[3*je[j]-1 for j in range(2)],[je[j]-jF[j] for j in range(2)],jd,je]\n# Compute only the first seven q(2u) coefficients. The rest is bounded in text.\nrows=[]\nfor k,disc in enumerate(discs):\n w,eta=disc[3],disc[4]\n iv=[[Q(II[k][j])]+[Q(w[j][n-1],n) for n in range(1,8)] for j in range(2)]\n jv=[[Q(JJ[k][j])]+[Q(eta[j][n-1],n) for n in range(1,8)] for j in range(2)]\n coeff=[]\n for n in range(1,8):\n qd=Q(0)\n for j in range(2):\n for r in range(n):\n c=2*jv[j][r]+(je[j] if r==0 else 0)\n c+=sum(M[j][l]*(2*iv[l][r]+(ie[l] if r==0 else 0)) for l in range(2))\n qd-=w[j][n-1-r]*c\n coeff.append(modq(qd*Q(2**n,n),1<<16))\n e=3 if k==1 else 2\n reduction=[(a//(1<:=LaurentSeriesRing(K,DS);\nWW:=[]; TT:=[]; XX:=[]; YY:=[]; ZZ:=[];\nfor k in [1..4] do\n if k eq 1 then\n Y:=-1+s+O(s^DS); X:=-1+O(s^DS);\n for j in [1..8] do X-:=(X^4-X^2+X*Y+Y^3)/(4*X^3-2*X+Y); end for;\n Z:=Y^2/X; w1:=X/(2*X-4*X^3-Y); w2:=Y/(2*X-4*X^3-Y);\n elif k eq 2 then\n X:=-1+s+O(s^DS); Y:=O(s^DS);\n for j in [1..8] do Y-:=(X^4-X^2+X*Y+Y^3)/(X+3*Y^2); end for;\n Z:=Y^2/X; w1:=1/(1+3*Z); w2:=Y/X*w1;\n elif k eq 3 then\n V:=1+O(s^DS);\n for j in [1..8] do V-:=(s^2+s*V^3+V-1)/(1+3*s*V^2); end for;\n X:=s+O(s^DS); Y:=s*V; Z:=s*V^2; w1:=1/(1+3*Z); w2:=V*w1;\n else\n Z:=-1+O(s^DS);\n for j in [1..8] do Z-:=(s^5*Z^2+Z+1-s)/(1+2*s^5*Z); end for;\n X:=s^2*Z; Y:=s*Z; w2:=1/(1+2*s^5*Z); w1:=s*w2;\n end if;\n Append(~XX,X); Append(~YY,Y); Append(~ZZ,Z);\n Append(~WW,[w1,w2]); Append(~TT,[2*Y*w1,X*w1]);\nend for;\nfunction tiny(f,d)\n return &+[Coefficient(f,n-1)*d^n/n:n in [1..DS-4]];\nend function;\nda:=Vector(K,[tiny(w,K!2):w in WW[2]]);\ndb:=Vector(K,[tiny(w,K!2):w in WW[3]]);\nie:=(da+2*db)/13; iff:=(7*da+db)/13;\nea:=Vector(K,[tiny(w,K!2):w in TT[2]]);\neb:=Vector(K,[tiny(w,K!2):w in TT[3]]);\nje:=(ea+2*eb+Vector(K,[4,0]))/13;\njf:=(7*ea+eb+Vector(K,[2,0]))/13;\nprint \"I_E I_F\",ie,iff; print \"J_E J_F\",je,jf;\nKE:=[]; KF:=[];\nfor a in [0,1] do\n if a eq 0 then\n nuB:=(ZZ[2]+1)/XX[2]*WW[2][1];\n nuD:=-2*V^2*WW[3][1];\n else\n nuB:=2*YY[2]*(XX[2]+1)/(ZZ[2]+1)*WW[2][1];\n nuD:=(ZZ[3]+1)/(XX[3]-1)*WW[3][1];\n end if;\n da:=tiny(nuB,K!2); db:=tiny(nuD,K!2);\n Append(~KE,(da+2*db)/13); Append(~KF,(7*da+db)/13);\nend for;\nid:=-2*ie; jd:=-2*je;\nIB:=Matrix(K,[Eltseq(id),Eltseq(iff)]);\nHB:=Matrix(K,2,2,[-2*KE[1]-DotProduct(jd,id),KF[1]-DotProduct(jd,iff),-2*KE[2]-DotProduct(jf,id),KF[2]-DotProduct(jf,iff)]);\nprint \"symmetry valuation\",Valuation(HB[1,2]-HB[2,1]);\nMM:=IB^-1*HB*Transpose(IB^-1);\nprint \"log determinant\",Valuation(Determinant(IB)); print \"M\",MM;\nII:=[3*ie,ie-iff,-2*ie,ie]; JJ:=[3*je-Vector(K,[1,1]),je-jf,-2*je,je];\nfunction integ(f)\n return &+[Coefficient(f,n-1)/n*s^n:n in [1..DS-4]]+O(s^(DS-3));\nend function;\nfunction minval(cs)\n return Minimum([Valuation(a):a in cs|a ne 0]);\nend function;\nfor k in [1..4] do\n iv:=[R!II[k][j]+integ(WW[k][j]):j in [1..2]];\n jv:=[R!JJ[k][j]+integ(TT[k][j]):j in [1..2]];\n qp:=-&+[WW[k][j]*(2*jv[j]+je[j]+&+[MM[j,l]*(2*iv[l]+ie[l]):l in [1..2]]):j in [1..2]];\n qq:=integ(qp); cs:=[Coefficient(qq,n)*(K!2)^n:n in [1..DS-7]];\n ev:=minval(cs); P:=PolynomialRing(GF(2));\n red:=&+[GF(2)!(Integers()!(cs[n]/2^ev))*u^n:n in [1..20]];\n print \"disk\",k,\"minimum\",ev,\"reduction\",red;\n print \"tail\",minval(cs[21..#cs]);\n rt:=(k eq 4) select K!(-1/3) else K!1;\n print \"known second root value\",Valuation(&+[cs[n]*rt^n:n in [1..#cs]]);\nend for;\n" }, { "path": "anc/code/1.1.15/q9_rank_geometry.m", "size_bytes": 848, "sha256": "360296e3d92ab2d28d0977762a4bfa306804f9c073ef0423abeeb03b58282c72", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Executed with Magma V2.29-10. Unconditional class-group proof bounds.\n// No bounded rational/integer point search is used.\nSetSeed(261015);\nB1 := map Integers() | o :-> MinkowskiBound(o)>;\nSetClassGroupBoundMaps(B1,B1);\nR := PolynomialRing(Rationals());\nC := HyperellipticCurve(t+1,t^3);\nCs := HyperellipticCurve(t^6+4*t+4);\nprint \"discriminant\", Discriminant(C);\nr := RankBound(Jacobian(Cs));\nprint \"rank_upper_bound\",r;\nassert r eq 2;\nprint \"genus\", Genus(C);\nS := PolynomialRing(GF(8539));\nf := u^6+4*u+4;\nprint \"bad_fibre_gcd\", GCD(f,Derivative(f));\nprint \"ordinary_node_check\", GCD(GCD(f,Derivative(f)),Derivative(f,2));\n// The following are finite-field point counts, not Q9 integer searches.\nprint \"F2_curve_points\", #Points(ChangeRing(C,GF(2)));\nprint \"F2_Jacobian_order\", #Jacobian(ChangeRing(C,GF(2)));\n" }, { "path": "anc/code/1.1.15/q9_symbolic.py", "size_bytes": 3695, "sha256": "24ca3164defcce33ba57eacd7338bc1a3e7fa461bf34193e34b2e4818bb5800a", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Exact algebra for the Q9 proof. Requires sympy; no point search.\"\"\"\nfrom fractions import Fraction as F\nimport json\nimport sympy as S\n\nx,y,z,a,b,u,v,t=S.symbols('x y z a b u v t')\nf=x**4-x**2+x*y+y**3\nminimal=v**2+u**3*v-u-1\nassert S.expand(f.subs({x:-v,y:u*v}, simultaneous=True)-v**2*minimal)==0\npts={'A':(-1,-1,-1),'B':(-1,0,0),'C':(-1,1,-1),'D':(0,0,0),\n 'E':(0,0,-1),'F':(1,0,0),'G':(2,-2,2),'H':(4,-6,9)}\nfor p in pts.values():\n xx,yy,zz=p\n assert xx**4-xx**2+xx*yy+yy**3==0\n assert yy**2==xx*zz\n assert xx**3-xx+yy*(zz+1)==0\n assert zz**2+zz==yy*(1-xx**2)\n\n# Kernel identity. Denominators are cleared first; a zero numerator on a dense\n# open set proves the rational differential identity everywhere it is defined.\nzz=y*y/x; cc=b*b/a\nN=(zz+cc+1+b*y/x)/(x-a)\nNT=(cc+zz+1+y*b/a)/(a-x)\nexpr=(S.diff(N,a)*(1+3*cc)+S.diff(N,b)*(2-4*a*a-b/a)\n -S.diff(NT,x)*(1+3*zz)-S.diff(NT,y)*(2-4*x*x-y/x))\nexpected=2*b-2*y+a*y/x-x*b/a\nnum,den=S.fraction(S.factor(expr-expected))\ngb=S.groebner([f,b**3+a*b+a**4-a**2],y,b,x,a)\nassert gb.reduce(S.expand(num))[1]==0\n\n# Small exact rational power series for verifying every principal divisor.\nL=8\ndef C(n): return [F(n)]+[F(0)]*(L-1)\ndef add(A,B): return [p+q for p,q in zip(A,B)]\ndef neg(A): return [-p for p in A]\ndef sub(A,B): return add(A,neg(B))\ndef scale(A,c): return [p*c for p in A]\ndef mul(A,B): return [sum(A[i]*B[n-i] for i in range(n+1)) for n in range(L)]\ndef powr(A,n):\n R=C(1)\n for _ in range(n): R=mul(R,A)\n return R\ndef inv(A):\n assert A[0]!=0\n R=[1/A[0]]+[F(0)]*(L-1)\n for n in range(1,L): R[n]=-R[0]*sum(A[i]*R[n-i] for i in range(1,n+1))\n return R\ndef div(A,B): return mul(A,inv(B))\ns=C(0); s[1]=F(1); one=C(1)\nfunctions=['x','y','y-x','x+1','x+y','z-2x-1']\norders={name:{} for name in functions}\nfor label,(aa,bb,_) in pts.items():\n if label=='D':\n V=one\n for _ in range(4):\n eq=sub(add(add(powr(s,2),mul(s,powr(V,3))),V),one)\n V=sub(V,div(eq,add(one,scale(mul(s,powr(V,2)),3))))\n X=s; Y=mul(s,V); Z=mul(s,powr(V,2))\n elif label=='E':\n Z=C(-1)\n for _ in range(4):\n eq=sub(add(add(mul(powr(s,5),powr(Z,2)),Z),one),s)\n Z=sub(Z,div(eq,add(one,scale(mul(powr(s,5),Z),2))))\n X=mul(powr(s,2),Z); Y=mul(s,Z)\n else:\n X=add(C(aa),s); Y=C(bb)\n for _ in range(4):\n eq=add(sub(powr(X,4),powr(X,2)),add(mul(X,Y),powr(Y,3)))\n Y=sub(Y,div(eq,add(X,scale(powr(Y,2),3))))\n Z=div(powr(Y,2),X)\n values=[X,Y,sub(Y,X),add(X,one),add(X,Y),sub(sub(Z,scale(X,2)),one)]\n for name,A in zip(functions,values):\n k=next(i for i,q in enumerate(A) if q!=0)\n if k: orders[name][label]=k\nexpected_orders=[{'D':1,'E':2},{'B':1,'F':1,'D':1,'E':1},\n {'A':1,'D':2,'E':1},{'A':1,'B':1,'C':1},\n {'C':1,'G':1,'D':1,'E':1},{'A':3,'C':1,'H':1}]\nassert list(orders.values())==expected_orders\npole_orders=[3,4,4,3,4,5]\nassert [sum(q.values()) for q in orders.values()]==pole_orders\n\n# Only the linear and quadratic terms of the normalized logarithms contribute\n# to Res(log(f) eta_1), Res(log(f) eta_2).\n# rho = 1+O(t^5), so these normalized functions suffice modulo t^3.\nnormalized=[1,1,1+t,1,1-t,1-2*t*t]\nresidues=[]\nfor ff in normalized:\n lg=S.series(S.log(ff),t,0,3).removeO().expand()\n residues.append([int(2*lg.coeff(t,2)),int(-lg.coeff(t,1))])\nassert residues==[[0,0],[0,0],[-1,-1],[0,0],[-1,1],[-4,0]]\nprint(json.dumps({'normalization_identity':True,'given_points_verified':8,\n 'kernel_groebner_remainder':0,'principal_divisor_zero_orders':orders,\n 'eta_reciprocity_residues':residues,'all_symbolic_checks_passed':True},indent=2))\n" }, { "path": "anc/code/1.1.2/1.1.2a_bitangent.gp", "size_bytes": 567, "sha256": "2e338ced490137167e114b4523be43b1024f58185b7db75ee9c3617414814bf9", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "F=u^3+u+z^4+z;\nG=Pol(subst(F,u,m*z+b),z);\na=m^3/2; c=(polcoeff(G,2,z)-a^2)/2;\ne1=polcoeff(G,1,z)-2*a*c; e2=polcoeff(G,0,z)-c^2;\nR=polresultant(numerator(e1),numerator(e2),b);\nfR=factor(R);\nf27=m^27+480*m^19-1344*m^18-34560*m^11-70656*m^10-40704*m^9-16384*m^3+12288*m-4096;\ng=fR[1,1]; g=g/pollead(g);\nprint(\"R content/lead: \", content(R), \" deg \", poldegree(R));\nprint(\"deg27 factor == TeX f: \", g==f27);\nprint(\"irreducible: \", polisirreducible(f27));\nprint(\"real roots (signature r1): \", polsturm(f27));\n\\\\ also check the factor e1 gives b uniquely: solve b from gcd\n" }, { "path": "anc/code/1.1.2/1.1.2a_descent.gp", "size_bytes": 5576, "sha256": "c63b858cafc6daad7e90ab1e982aeeff0ec7449a8581e501a1c44b2f00a90c5d", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.2a (descent part): 16 elements of K(S,2), S = {2}; norm, good-prime and dyadic conditions.\n\\\\ bnfinit/bnfsunit only propose the 16 elements; support, norms, independence and all conditions are checked here.\ndefault(parisizemax, 4*10^9);\nread(\"descent_common.gp\");\nF=y^3+y+x^4+x; \\\\ 1162 with (x,y)=(z,u): u^3+u+z^4+z\nsp=slopepoly(F); fa=sp[1];\nprint(\"resultant factor degrees: \", vector(#fa~,i,poldegree(fa[i,1])));\nf=fa[1,1]; f=f/pollead(f);\nfT=m^27+480*m^19-1344*m^18-34560*m^11-70656*m^10-40704*m^9-16384*m^3+12288*m-4096;\nprint(\"slope poly == TeX: \", f==fT);\nbK=intercept(F,f);\nprint(\"intercept denom factor: \", factor(denominator(content(bK))));\nt0=getwalltime();\nnf=nfinit([f,factor(poldisc(f))]);\nbnf=bnfinit(nf,1);\nprint(\"bnf time \", getwalltime()-t0, \" cyc \", bnf.cyc, \" reg \", bnf.reg);\npr2=idealprimedec(nf,2);\nsu=bnfsunit(bnf,pr2);\nprint(\"sunit time \", getwalltime()-t0, \" #S-units \", #su[1]);\ngens=concat([[Mod(-1,f)], bnf.fu, apply(t->Mod(t,f),su[1])]);\nprint(\"#gens \", #gens);\n\\\\ verify: units integral with norm +-1; S-unit supported on pr2\n{for(i=1,#gens, my(e=gens[i], v=nfalgtobasis(nf,e), N=norm(e));\n if(i<=15, if(denominator(v)!=1 || abs(N)!=1, error(\"unit check fails \",i)),\n my(fac=idealfactor(nf,e)); if(#fac~!=1 || fac[1,1].p!=2, error(\"S-unit support fails\"));print(\"S-unit ideal: pr2^\",fac[1,2], \" norm \", N)));}\nprint(\"units verified: integral, norm +-1; S-unit support verified\");\n\\\\ independence mod squares: characters at split primes + valuation at pr2\n{chars=List(); cnt=0;\nforprime(p=1000,10^6, if(denominator(content(bK))%p==0, next); if(poldisc(f)%p==0,next);\n my(rts=polrootsmod(f,p)); if(#rts==0,next);\n listput(chars,[p,lift(rts[1])]); cnt++; if(cnt>=60,break));}\nMat1=matrix(#gens, 1+#chars);\n{for(i=1,#gens, Mat1[i,1]=nfeltval(nf,gens[i],pr2[1])%2;\n for(j=1,#chars, my(p=chars[j][1],r=chars[j][2],ev=subst(lift(gens[i]),m,Mod(r,p))); Mat1[i,1+j]=if(kronecker(lift(ev),p)==1,0,1)));}\nprint(\"rank of character matrix mod 2: \", matrank(Mat1*Mod(1,2)), \" (need \", #gens, \")\");\n\nng=#gens;\nprint(\"norm of S-unit gen: \", norm(gens[ng]));\n\\\\ ---- norm-square conditions: sign and v_2 parity ----\n{normrows=matrix(2,ng,i,j, my(N=norm(gens[j])); if(i==1, N<0, valuation(N,2)%2));}\n\\\\ ---- good prime local images ----\nhval(P,g,p)={my(mv=Mod(m*Mod(1,p),g), bv=redmod(bK,p,g)); -(P[2]-mv*P[1]-bv)};\nlocalimage(p)={my(fa=factormod(f,p), gs, nv, imgs=List(), nz=0, nz1=0, Lp, rows, pts=0);\n gs=vector(#fa~,i,fa[i,1]); nv=#gs;\n for(xx=0,p-1, my(c=Mod(xx,p)^4+Mod(xx,p), rts=polrootsmod(y^3+y+lift(c),p));\n for(k=1,#rts, my(P=[Mod(xx,p),rts[k]], vec=vector(nv), zeros=List());\n pts++;\n for(j=1,nv, my(hv=hval(P,gs[j],p)); if(hv==0, listput(zeros,j), vec[j]=legK(hv,p,gs[j])));\n if(#zeros==1, my(j0=zeros[1]); vec[j0]=sum(j=1,nv,vec[j])%2; nz1++);\n if(#zeros>=2, nz++; next);\n listput(imgs, vec)));\n Lp=if(#imgs, matimage(Mat(Col(imgs))~*Mod(1,2)), matrix(nv,0));\n \\\\ global rows: character vector of each generator\n rows=matrix(nv,ng,j,i, legK(redmod(lift(gens[i]),p,gs[j]),p,gs[j]));\n [Lp, rows, nv, pts+1, nz1, nz, vector(nv,j,poldegree(gs[j]))]};\n\\\\ candidate space: kernel of stacked conditions\nV=matkerMod2(Mrows)=lift(matker(Mrows*Mod(1,2)));\ncond=normrows*Mod(1,2);\nK0=matker(cond); print(\"after norm-square: dim \", #K0);\nKcur=K0;\n{foreach([487,491,499,503], p,\n my(LI=localimage(p), Lp=LI[1], rows=LI[2]*Mod(1,2), Q, proj);\n print(\"p=\",p,\" #C(F_p)=\",LI[4],\" factor degrees \",LI[7],\" #v=\",LI[3],\" dim local image=\",#Lp, \" pts with one zero \",LI[5], \" with >=2 zeros \", LI[6]);\n \\\\ condition: rows*a lies in span(Lp): use complement projection\n Q=if(#Lp==0, matid(LI[3])*Mod(1,2), matker(Mat(Lp)~));\n proj=Q~*rows;\n Kcur=Kcur*matker(proj*Kcur);\n print(\" candidate dim now \", #Kcur));}\n\\\\ dyadic local image and final Selmer bound for 1162 (appended to part B state)\npr=pr2[1]; ee=pr.e; print(\"pr2 e,f = \", [pr.e, pr.f]);\nbid=idealstar(nf, idealpow(nf,pr,2*ee+1));\ncyc=bid.cyc; evenidx=select(c->c%2==0, cyc, 1);\nprint(\"(O/pr^19)^* cyc length \", #cyc, \" #even components \", #evenidx, \" => dim K_v*/sq = \", #evenidx+1);\n{pi0=0; for(i=1,#nf.zk, my(c=nf.zk[i]); for(s=0,3, my(t=c+s); if(nfeltval(nf,t,pr)==1, pi0=t; break(2))));}\nif(pi0==0, pi0=pr.gen[2]);\nprint(\"uniformizer valuation: \", nfeltval(nf,pi0,pr));\nsqclass(a)={my(k=nfeltval(nf,a,pr), u=a/Mod(pi0,f)^k, lg=ideallog(nf,u,bid)); concat([k%2], vector(#evenidx,i,lg[evenidx[i]]%2))};\n\\\\ sanity: square classes of squares vanish, multiplicativity\n{my(t1=Mod(nf.zk[2]+3,f), t2=Mod(nf.zk[5]-1,f)); print(\"sanity sq(t^2)=0: \", sqclass(t1^2)==vector(#evenidx+1), \" mult: \", (sqclass(t1*t2)-sqclass(t1)-sqclass(t2))%2==vector(#evenidx+1));}\n\\\\ Q_2 points: u integer, z lifted by Newton (F_z = 4z^3+1 is a 2-adic unit)\nNP=300;\nliftz(u0,z0)={my(z=z0, md=2^NP); for(i=1,12, z=(z-(u0^3+u0+z^4+z)*lift(Mod(4*z^3+1,md)^-1))%md); if((u0^3+u0+z^4+z)%md!=0, error(\"lift\")); z};\nhP(u0,z)=Mod(-(u0-m*z-bK), f);\nimgs=List(); vals=List();\n{for(u0=-12,12, for(z0=0,1, my(z=liftz(u0,z0), a=hP(u0,z), k=nfeltval(nf,a,pr)); listput(vals,k); if(k>200, next); listput(imgs, sqclass(a))));}\nprint(\"valuations seen: \", vecsort(Vec(vals),,8));\nL2=matimage(Mat(Col(imgs))~*Mod(1,2));\nprint(\"number of Q_2-points used \", #imgs, \"; dim span of dyadic images = \", #L2, \" (must be <= dim J(Q_2)/2 = 3)\");\n\\\\ apply to global candidates\ncand=Kcur;\nG2=matrix(#evenidx+1, ng, i,j, sqclass(gens[j])[i])*Mod(1,2);\nQ2=matker(Mat(L2)~);\nfin=cand*matker(Q2~*G2*cand);\nprint(\"final Selmer upper bound dim (after norm, 487..503, dyadic): \", #fin);\n" }, { "path": "anc/code/1.1.2/1.1.2a_field.gp", "size_bytes": 807, "sha256": "cf47faa7ad7044b7e078d5fd49ebffbe75908fa4e046094ae67d58bc6c32ad23", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisizemax, 2*10^9); default(factor_proven,1);\nf27=m^27+480*m^19-1344*m^18-34560*m^11-70656*m^10-40704*m^9-16384*m^3+12288*m-4096;\nd=poldisc(f27);\nP=[2,3,5,11,277,5479,66943,148835457319];\nprint(\"poldisc factorization (proven): \", factor(d));\nnf=nfinit([f27, factor(d)]);\nD=nf.disc; print(\"field disc: \", factor(D), \" sign \", sign(D));\nprint(\"TeX claim 2^24*277^6*66943^6 match |D|: \", abs(D)==2^24*277^6*66943^6);\nprint(\"signature: \", nf.sign);\ndec=idealprimedec(nf,2); print(\"primes above 2: \", vector(#dec,i,[dec[i].e,dec[i].f]));\nfor(p=3,3, dec=idealprimedec(nf,p); print(\"primes above \",p,\": \",vector(#dec,i,[dec[i].e,dec[i].f])));\ndec=idealprimedec(nf,277); print(\"277: \",vector(#dec,i,[dec[i].e,dec[i].f]));\ndec=idealprimedec(nf,66943); print(\"66943: \",vector(#dec,i,[dec[i].e,dec[i].f]));\n" }, { "path": "anc/code/1.1.2/1.1.2a_nodes.gp", "size_bytes": 989, "sha256": "03bda336b5d792a8e72cbeb7772667aff6b6cd3122cc561d40450d518e15cd10", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ BPS support: nodes at 277 and 66943 for u^3+u+z^4+z\nF(u,z)=u^3+u+z^4+z;\n{foreach([277,66943],p,\n my(z0=Mod(243,p)/256, u0=-9*z0/8, N=20, zc, uc, Fc, H);\n print(\"p=\",p,\" F,Fu,Fz at node: \", [F(u0,z0), 3*u0^2+1, 4*z0^3+1]);\n H=matdet([6*u0,0;0,12*z0^2]); print(\" Hessian det mod p: \", H);\n \\\\ Z_p critical point by Hensel\n uc=u0+O(p^N); zc=z0+O(p^N); uc=lift(u0)+O(p^N); zc=lift(z0)+O(p^N);\n for(i=1,8, uc=uc-(3*uc^2+1)/(6*uc); zc=zc-(4*zc^3+1)/(12*zc^2));\n print(\" critical pt residual: \", [valuation(3*uc^2+1,p), valuation(4*zc^3+1,p)], \" v_p(F(crit)) = thickness = \", valuation(F(uc,zc),p));\n \\\\ count singular points of reduction over F_p (affine) by brute force over small subset: use elimination uniqueness\n );}\n\\\\ number of geometric singular points: solve system over Q-bar mod p via resultants\n{foreach([277,66943],p, my(R=polresultant(Mod(1,p)*(3*'u^2+1), Mod(1,p)*('u^3+'u+'z^4+'z),'u), g=gcd(R, Mod(1,p)*(4*'z^3+1)));\n print(\"p=\",p,\" gcd for singular z: \", g));}\n" }, { "path": "anc/code/1.1.2/1.1.2bcd_classgroup.sh", "size_bytes": 892, "sha256": "f30d6ab2f201e63309ec001288cd607d4813e45290a3a96f5561173bf82003ca", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/sh\n# 1.1.2b, 1.1.2c, 1.1.2d with the shared tools in code/common/h31_classgroup (FULL run; see README for\n# the run times and for the slices that were run here). Large files go to work/ (not in the bundle).\n# W = number of worker processes.\nset -e\ncd \"$(dirname \"$0\")\"\nCG=../common/h31_classgroup\nPRM=data/classgroup_params.json\nW=${W:-2}\nmkdir -p work\necho \"== 1.1.2b: all prime ideals of norm < 10^8\"\npython3 $CG/count_ideals.py $PRM --workers $W --out work/counts.npz\necho \"== 1.1.2c: strict norm-induction witnesses for all prime ideals of norm <= 5·10^6 (bnfinit only proposes)\"\npython3 $CG/witnesses.py $PRM --workers $W --out work/witnesses.jsonl.gz\necho \"== 1.1.2c: exact check against an independent list of the prime ideals\"\npython3 $CG/check_witnesses.py $PRM work/witnesses.jsonl.gz\necho \"== 1.1.2d: B^-(f) in 224-bit Arb balls\"\npython3 $CG/bound.py $PRM work/counts.npz\n" }, { "path": "anc/code/1.1.2/1.1.2e_disks.gp", "size_bytes": 1161, "sha256": "d092847c60acb12df7ee17269073677d32dbbe1345aa6e6222c7cdf5ea285f76", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "x; y; s; t; w;\n\\\\ 1162 curve in (u,z): u^3+u+z^4+z ; use y=u, x=z\nF=y^3+y+x^4+x;\npts=List(); {for(a=0,2, for(b=0,2, if((b^3+b+a^4+a)%3==0, listput(pts,[b,a]))));}\nprint(\"affine F_3 points (u,z): \", pts);\n\\\\ infinity chart: w=1/u, t=z/u\nG=w+t^4+(1+t)*w^3; print(\"chart identity: \", subst(subst(F,y,1/w),x,t/w)*w^4==G);\nNS=40; ws=O(t^NS); {for(i=1,10, ws=ws-subst(G,w,ws)/subst(deriv(G,w),w,ws));}\nus=1/ws; zs=t/ws;\nom1=[1,zs,us]*deriv(zs,t)/(3*us^2+1);\nom2=[-ws,-t,-1]/(1+3*(1+t)*ws^2);\nprint(\"differential identity at infinity: \", vector(3,k, valuation(om1[k]-om2[k],t)>=NS-14));\nlam=[2,1,1];\nprint(\"lambda.omega mod 3 at infinity (t=0): \", Mod(lam*vector(3,k,polcoeff(om2[k],0,t))~,3));\n{for(i=1,#pts, my(u0=pts[i][1], z0=pts[i][2]); print(\"disk (u,z)=\",[u0,z0],\": lambda.omega const = \", Mod((lam*[1,z0,u0]~)/(3*u0^2+1),3)));}\n\\\\ points over F_9, F_27 for L-polynomial of reduction mod 3 (good reduction)\ncnt(q)={my(g=ffgen(q,'a), c=1); for(i=0,q-1, my(zz=if(i==0,0*g,g^i)); for(j=0,q-1, my(uu=if(j==0,0*g,g^j)); if(uu^3+uu+zz^4+zz==0, c++))); c};\n\\\\ careful: enumeration over all field elements: 0 and g^i for i=0..q-2 (g generator of multiplicative group?)\n" }, { "path": "anc/code/1.1.2/1.1.2e_logs.gp", "size_bytes": 3311, "sha256": "0dce2e46e384bb8d327d1de671c6193c395da982b8fa9810081a5d52a1db8942", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent recomputation of 3-adic logs of [P_i - oo] for C: u^3+u+z^4+z=0 (1162)\ndefault(parisizemax, 2*10^9);\nx; u; z; s; t;\nFF=u^3+u+z^4+z;\nmons=List(); {for(a=0,2, for(j=0,15, if(4*a+3*j<=31, listput(mons,[a,j]))));}\nNT=32;\nbranch(uP,zP)={my(us=uP+O(s^NT)); for(i=1,6, us=us-subst(subst(FF,u,us),z,zP+s)/subst(subst(deriv(FF,u),u,us),z,zP+s)); us};\ncontact(uP,zP)={my(us=branch(uP,zP), M, kk, h);\n M=matrix(28,#mons,i,j, polcoeff(us^mons[j][1]*(zP+s)^mons[j][2] + O(s^NT), i-1, s));\n kk=matker(M); if(#kk!=1, error(\"kernel dim \",#kk));\n h=sum(j=1,#mons, kk[j,1]*u^mons[j][1]*z^mons[j][2]); h=h/content(h); h};\nPR=60; \\\\ 3-adic precision\nNS=70; \\\\ number of series terms in tiny integrals\n\\\\ tiny integral of (1,z,u)dz/(3u^2+1) from (uf,c) to (ue,ze) along branch through (uf,c); c in Z, uf,ze,ue in a 3-adic ring\ntiny(uf,c,ze)={my(us=uf, ser, w, I=vector(3), dl=ze-c, pw);\n \\\\ power series u(s) with coefficients in ring of uf: Newton on series\n us=uf+O(s^NS); for(i=1,8, us=us-(us^3+us+(c+s)^4+(c+s))/(3*us^2+1));\n w=1/(3*us^2+1);\n ser=[w, (c+s)*w, us*w];\n for(k=1,3, my(sr=ser[k]); I[k]=sum(j=0,NS-1, polcoeff(sr,j,s)*dl^(j+1)/(j+1)));\n I};\nP=[[0,0],[0,-1]];\nLOGS=vector(2);\n{for(i=1,2, my(uP=P[i][1], zP=P[i][2], h=contact(uP,zP), R, d, mult, r1, uE, fac, c, tot=vector(3));\n print(\"P\",i-1,\"=(u,z)=\",P[i],\": u*z^9 coefficient nonzero: \", polcoeff(polcoeff(h,1,u),9,z)!=0);\n R=polresultant(FF,h,u); mult=valuation(R, z-zP); d=R/(z-zP)^mult; d=d/pollead(d);\n print(\" Res_u(F,h) deg \", poldegree(R,z), \"; multiplicity at z(P) \", mult, \"; residual cubic irreducible over Q: \", polisirreducible(d));\n print(\" v_3 of residual coefficients: \", vector(4,k,valuation(polcoeff(d,k-1,z),3)), \"; v_3(disc d) = \", valuation(poldisc(d),3));\n print(\" d mod 3 = \", lift(factormod(d,3)));\n r1=(Mod(1,d)*FF) % (Mod(1,d)*h); if(poldegree(r1,u)!=1, error(\"not linear\"));\n uE=-polcoeff(r1,0,u)/polcoeff(r1,1,u);\n if(subst(FF,u,uE)!=0 || subst(h,u,uE)!=0, error(\"uE\"));\n \\\\ factor d over Q_3\n fac=factorpadic(d,3,PR); print(\" 3-adic factor degrees of d: \", vector(#fac~,k,poldegree(fac[k,1])));\n c=lift(polrootsmod(d,3)[1]); print(\" fiber z = \", c, \" mod 3\");\n for(k=1,#fac~, my(g=fac[k,1], dg=poldegree(g), th, ze, ue, uf, I, cp);\n if(dg==1, ze=-polcoeff(g,0)/polcoeff(g,1); ue=subst(lift(uE),z,ze),\n th=Mod(t,subst(g,z,t)); ze=th; ue=subst(lift(uE),z,th));\n \\\\ Hensel-lift fiber point u-coordinate from ue: root of u^3+u+c^4+c\n uf=ue; for(j=1,10, uf=uf-(uf^3+uf+c^4+c)/(3*uf^2+1));\n print(\" factor deg \", dg, \": v(ze-c)=\", valuation(if(dg==1,ze-c,norm(ze-c)),3), \" fiber u mod 3 (charpoly) \", if(dg==1, lift(Mod(truncate(uf),3)), lift(Mod(charpoly(uf)*1,3))));\n I=tiny(uf,c,ze);\n if(dg>1, I=vector(3,k,trace(I[k])));\n tot+=I);\n \\\\ log(P - oo) = -(1/28) * log(E - fiber) \n LOGS[i]=-tot/28;\n print(\" log(P\",i-1,\"-oo) mod 3^10 = \", vector(3,k,lift(Mod(truncate(LOGS[i][k]),3^10))),\" ; valuations \", vector(3,k,valuation(LOGS[i][k],3))));}\nL0=LOGS[1]; L1=LOGS[2];\ncr=[L0[2]*L1[3]-L0[3]*L1[2], L0[3]*L1[1]-L0[1]*L1[3], L0[1]*L1[2]-L0[2]*L1[1]];\nvm=vecmin(vector(3,k,valuation(cr[k],3)));\nprint(\"cross product valuations: \", vector(3,k,valuation(cr[k],3)), \" primitive annihilator mod 3: \", vector(3,k,lift(Mod(truncate(cr[k]/3^vm),3))));\n" }, { "path": "anc/code/1.1.2/descent_common.gp", "size_bytes": 1307, "sha256": "6b126bdc850ab27e6d48491bfdb7f5c6143fbf413161ce77df3566285ba51af7", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent marked-bitangent 2-descent replay (auditor C, own code).\n\\\\ Curve F(x,y)=y^3+...+x^4 with hyperflex at infinity; bitangents y = m x + b.\nx; y; b; m;\n\\\\ ---------- field and intercept ----------\nslopepoly(F)={my(G,a,c,e1,e2,R,fa);\n G=Pol(subst(F,y,m*x+b),x);\n if(polcoeff(G,4,x)!=1, error(\"not monic quartic in x\"));\n a=polcoeff(G,3,x)/2; c=(polcoeff(G,2,x)-a^2)/2;\n e1=polcoeff(G,1,x)-2*a*c; e2=polcoeff(G,0,x)-c^2;\n R=polresultant(e1,e2,b); fa=factor(R); [fa, e1, e2]};\nintercept(F,f)={my(mm=Mod(m,f),G,a,c,e1,e2,r,bK,cK,chk);\n G=Pol(subst(F,y,mm*x+b),x);\n a=polcoeff(G,3,x)/2; c=(polcoeff(G,2,x)-a^2)/2;\n e1=polcoeff(G,1,x)-2*a*c; e2=polcoeff(G,0,x)-c^2;\n \\\\ e1, e2 polynomials in b with K coefficients; Euclid\n r=e2%e1; if(poldegree(r,b)!=1, error(\"remainder not linear\"));\n bK=-polcoeff(r,0,b)/polcoeff(r,1,b);\n if(subst(e1,b,bK)!=0 || subst(e2,b,bK)!=0, error(\"intercept fails\"));\n cK=subst(c,b,bK);\n chk=subst(F,y,mm*x+bK)-(x^2+subst(a,b,bK)*x+cK)^2;\n if(chk!=0, error(\"square identity fails\"));\n lift(bK)};\n\\\\ ---------- square-class characters ----------\n\\\\ reduce element (poly in m, rational coeffs) mod (p, g)\nredmod(e,p,g)=Mod(e*Mod(1,p),g);\nlegK(ev,p,g)={my(q=p^poldegree(g),t); if(ev==0, return(-1)); t=lift(ev^((q-1)/2)); if(t==1,0, if(t==-1,1,error(\"leg\")))};\n" }, { "path": "anc/code/1.1.3/1.1.3a_field.gp", "size_bytes": 1315, "sha256": "21de2865b07f7c4dde32fdf872d3632351b2d7cd3ce2c5c53e80cd7c6f7f484f", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisizemax, 4*10^9);\ndefault(factor_proven,1);\nf=m^27 - 48*m^22 + 144*m^17 + 17280*m^15 + 832*m^12 + 64512*m^10 - 2560*m^7 + 27648*m^5 - 110592*m^3 - 1024*m^2 + 4096;\nD=poldisc(f); fD=factor(D);\nprint(\"poldisc factorization (proven): \", fD);\nnf=nfinit([f,fD]);\nprint(\"field disc: \", factor(nf.disc), \" matches 2^20*4463467^6: \", abs(nf.disc)==2^20*4463467^6, \" sign \", sign(nf.disc));\nprint(\"signature \", nf.sign);\ndec=idealprimedec(nf,2); print(\"primes above 2 (e,f): \", vector(#dec,i,[dec[i].e,dec[i].f]));\ndec=idealprimedec(nf,17); print(\"primes above 17 (e,f): \", vector(#dec,i,[dec[i].e,dec[i].f]));\ndec=idealprimedec(nf,3); print(\"primes above 3 (e,f): \", vector(#dec,i,[dec[i].e,dec[i].f]));\n\\\\ node thickness\nF(X,Y)=X^4+Y^3+X*Y+1;\n{foreach([17,4463467],p, my(x0=Mod(-5,p)/144, y0=-4*x0^3, xc, yc, H, N=30);\n print(\"p=\",p,\" F,Fx,Fy at node: \", [F(x0,y0), 4*x0^3+y0, 3*y0^2+x0]);\n H=matdet([12*x0^2,1;1,6*y0]); print(\" Hessian det mod p: \", H);\n \\\\ Newton on gradient system in Z_p\n xc=lift(x0)+O(p^N); yc=lift(y0)+O(p^N);\n for(i=1,10, my(J=[12*xc^2,1;1,6*yc], g=[4*xc^3+yc; 3*yc^2+xc], d=matsolve(J,g)); xc-=d[1,1]; yc-=d[2,1]);\n print(\" gradient at Z_p critical point valuations \", [valuation(4*xc^3+yc,p), valuation(3*yc^2+xc,p)], \"; thickness v_p(F(crit)) = \", valuation(F(xc,yc),p)));}\n" }, { "path": "anc/code/1.1.3/1.1.3a_geometry.gp", "size_bytes": 1256, "sha256": "96996a757ff6840b8d41507114fcd6fde4daed8b75a6651cc58873ff1cb28ccb", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisizemax, 4*10^9);\nread(\"descent_common.gp\");\nF=x^4+y^3+x*y+1;\n\\\\ transport: identity; claimed set\nprint(\"claimed pts on curve: \", [subst(subst(F,x,0),y,-1), subst(subst(F,x,1),y,-1)]);\n\\\\ singular points: affine\nFx=deriv(F,x); Fy=deriv(F,y);\nR1=polresultant(F,Fx,y); R2=polresultant(F,Fy,y); R3=polresultant(Fx,Fy,y);\ng=gcd(gcd(R1,R2),R3); print(\"char-0 affine singular x gcd: \", g);\nprint(\"3*144^4-5^5 = \", 3*144^4-5^5, \" = \", factor(3*144^4-5^5), \" isprime(4463467)=\", isprime(4463467));\n\\\\ singular primes: discriminant via resultants of resultants (primes p where sing pts exist mod p)\nr=polresultant(R1,R3,x); print(\"elimination resultant factor (small primes trial): \", factor(r,10^6));\n\\\\ infinity chart t^4+w+t*w^2+w^4: dG/dw at (0,0)\nG=t^4+w+t*w^2+w^4; print(\"infinity chart check: F(t/w,1/w)*w^4 = \", simplify(subst(subst(F,x,t/w),y,1/w)*w^4 - G)==0, \" dG/dw(0,0) = \", subst(subst(deriv(G,w),t,0),w,0));\nsp=slopepoly(F); fa=sp[1];\nprint(\"slope resultant factor degrees: \", vector(#fa~,i,[poldegree(fa[i,1]),fa[i,2]]));\nf=fa[1,1]; f=f/pollead(f); print(\"slope polynomial: \", f);\nprint(\"irreducible: \", polisirreducible(f), \" real roots: \", polsturm(f));\nD=poldisc(f); fd=factor(D,10^7); print(\"poldisc partial factorization: \", fd);\n" }, { "path": "anc/code/1.1.3/1.1.3bc_classgroup.sh", "size_bytes": 788, "sha256": "c459e5d1ed7c2789d05ebb6faa0917fc90703ab1dde6d63a54f7bc632d57a810", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/sh\n# 1.1.3b and 1.1.3c with the shared tools in code/common/h31_classgroup (about one minute).\n# Large intermediate files go to work/ (not part of the bundle).\nset -e\ncd \"$(dirname \"$0\")\"\nCG=../common/h31_classgroup\nPRM=data/classgroup_params.json\nmkdir -p work\necho \"== 1.1.3b (i): prime ideals of norm < 10^6\"\npython3 $CG/count_ideals.py $PRM --out work/counts.npz\necho \"== 1.1.3b (ii): generators of the prime ideals of norm <= 10^4 (bnfinit only proposes)\"\npython3 $CG/witnesses.py $PRM --direct --out work/generators.jsonl.gz\necho \"== 1.1.3b (ii): exact check against an independent list of the prime ideals\"\npython3 $CG/check_witnesses.py $PRM work/generators.jsonl.gz\necho \"== 1.1.3c: B^-(f), 64 cells, T = log 10^6, 224-bit balls\"\npython3 $CG/bound.py $PRM work/counts.npz\n" }, { "path": "anc/code/1.1.3/1.1.3d_descent.gp", "size_bytes": 4707, "sha256": "ba353fcc308865c7f3f18a6909e2064ad29629ca16ca6a6f4ab31030a3091e75", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisizemax, 4*10^9); default(factor_proven,1);\nread(\"descent_common.gp\");\nF=x^4+y^3+x*y+1;\nf=m^27 - 48*m^22 + 144*m^17 + 17280*m^15 + 832*m^12 + 64512*m^10 - 2560*m^7 + 27648*m^5 - 110592*m^3 - 1024*m^2 + 4096;\nbK=intercept(F,f);\nprint(\"intercept denominator: \", factor(denominator(content(bK))));\nt0=getwalltime();\nnf=nfinit([f,factor(poldisc(f))]);\nbnf=bnfinit(nf,1);\nprint(\"bnfinit ms \", getwalltime()-t0, \" Cl (GRH) \", bnf.cyc);\nS=concat(idealprimedec(nf,2), idealprimedec(nf,17));\nsu=bnfsunit(bnf,S);\nprint(\"bnfsunit ms \", getwalltime()-t0, \" #S-units \", #su[1], \" S-class group \", su[5]);\ngens=concat([[Mod(-1,f)], bnf.fu, apply(t->Mod(t,f),su[1])]);\nng=#gens; print(\"#generators \", ng);\n{for(i=1,ng, my(e=gens[i], N=norm(e), fac);\n if(i<=15, if(denominator(nfalgtobasis(nf,e))!=1 || abs(N)!=1, error(\"unit fail \",i)),\n fac=idealfactor(nf,lift(e)); for(k=1,#fac~, if(fac[k,1].p!=2 && fac[k,1].p!=17, error(\"support fail \",i)))));}\nprint(\"verified: 15 units (integral, norm +-1) and \", ng-15, \" S-units supported on primes above 2,17\");\n\\\\ independence mod squares: valuations at S + characters at split primes\n{chars=List(); cnt=0; forprime(p=1000,10^6, if(poldisc(f)%p==0 || denominator(content(bK))%p==0, next);\n my(rts=polrootsmod(f,p)); if(#rts==0,next); listput(chars,[p,lift(rts[1])]); cnt++; if(cnt>=80,break));}\nMat1=matrix(ng, #S+#chars);\n{for(i=1,ng, for(k=1,#S, Mat1[i,k]=nfeltval(nf,gens[i],S[k])%2);\n for(j=1,#chars, my(p=chars[j][1], r=chars[j][2], ev=subst(lift(gens[i]),m,Mod(r,p))); Mat1[i,#S+j]=if(kronecker(lift(ev),p)==1,0,1)));}\nprint(\"rank mod 2 of [valuations | characters]: \", matrank(Mat1*Mod(1,2)), \" (need \", ng, \")\");\n\\\\ norm-square: sign, v_2, v_17\nnormrows=matrix(3,ng,i,j, my(N=norm(gens[j])); if(i==1, N<0, if(i==2, valuation(N,2)%2, valuation(N,17)%2)));\nKcur=matker(normrows*Mod(1,2)); print(\"after norm-square: dim \", #Kcur);\nhval(P,g,p)={my(mv=Mod(m*Mod(1,p),g), bv=redmod(bK,p,g)); -(P[2]-mv*P[1]-bv)};\nlocalimage(p)={my(fa=factormod(f,p), gs, nv, imgs=List(), nz=0, nz1=0, Lp, rows, pts=0);\n gs=vector(#fa~,i,fa[i,1]); nv=#gs;\n for(xx=0,p-1, my(X=Mod(xx,p), rts=polrootsmod(y^3+lift(X)*y+lift(X^4+1),p));\n for(k=1,#rts, my(P=[X,rts[k]], vec=vector(nv), zeros=List());\n pts++;\n for(j=1,nv, my(hv=hval(P,gs[j],p)); if(hv==0, listput(zeros,j), vec[j]=legK(hv,p,gs[j])));\n if(#zeros==1, my(j0=zeros[1]); vec[j0]=sum(j=1,nv,vec[j])%2; nz1++);\n if(#zeros>=2, nz++; next);\n listput(imgs, vec)));\n Lp=if(#imgs, matimage(Mat(Col(imgs))~*Mod(1,2)), matrix(nv,0));\n rows=matrix(nv,ng,j,i, legK(redmod(lift(gens[i]),p,gs[j]),p,gs[j]));\n [Lp, rows, nv, pts+1, nz1, nz, vector(nv,j,poldegree(gs[j]))]};\n{foreach([487,491,499,503,509,521], p,\n my(LI=localimage(p), Lp=LI[1], rows=LI[2]*Mod(1,2), Q, proj);\n print(\"p=\",p,\" #C(F_p)=\",LI[4],\" deg \",LI[7],\" dim local image=\",#Lp, \" one-zero pts \",LI[5], \" multi-zero pts \", LI[6]);\n if(LI[6]>0, error(\"multi-zero point: local image may be incomplete\"));\n Q=if(#Lp==0, matid(LI[3])*Mod(1,2), matker(Mat(Lp)~));\n Kcur=Kcur*matker(Q~*rows*Kcur);\n print(\" candidate dim now \", #Kcur));}\n\\\\ ---------------- dyadic ----------------\nP2=idealprimedec(nf,2);\nBID=vector(#P2,k, idealstar(nf, idealpow(nf,P2[k],2*P2[k][3]+1)));\nEV=vector(#P2,k, select(c->c%2==0, BID[k].cyc, 1));\nPI=vector(#P2,k, my(pp=P2[k], res=0); for(i=1,#nf.zk, for(s=-2,2, my(c=nf.zk[i]+s); if(nfeltval(nf,c,pp)==1, res=c; break(2)))); if(res==0, error(\"no unif\")); res);\nprint(\"dyadic local square-class dims: \", vector(#P2,k,#EV[k]+1), \" total \", sum(k=1,#P2,#EV[k]+1));\nsqc(a)={my(v=[]); for(k=1,#P2, my(pp=P2[k], kv=nfeltval(nf,a,pp), uu=a/Mod(lift(PI[k]),f)^kv, lg=ideallog(nf,uu,BID[k]));\n v=concat(v, concat([kv%2], vector(#EV[k],i,lg[EV[k][i]]%2)))); v};\nNP=300; md=2^NP;\nlifty(x0,y0)={my(yy=y0); for(i=1,12, yy=(yy-(x0^4+yy^3+x0*yy+1)*lift(Mod(3*yy^2+x0,md)^-1))%md); if((x0^4+yy^3+x0*yy+1)%md, error(\"lifty\")); yy};\nliftx(x0,y0)={my(xx=x0); for(i=1,12, xx=(xx-(xx^4+y0^3+xx*y0+1)*lift(Mod(4*xx^3+y0,md)^-1))%md); if((xx^4+y0^3+xx*y0+1)%md, error(\"liftx\")); xx};\nimgs=List(); vals=List();\n{for(a=-10,10, my(pt);\n pt=[2*a, lifty(2*a,1)]; listput(imgs, sqc(Mod(-(pt[2]-m*pt[1]-bK),f)));\n pt=[2*a+1, lifty(2*a+1,0)]; listput(imgs, sqc(Mod(-(pt[2]-m*pt[1]-bK),f)));\n pt=[liftx(1,2*a+1), 2*a+1]; listput(imgs, sqc(Mod(-(pt[2]-m*pt[1]-bK),f))));}\nL2=matimage(Mat(Col(imgs))~*Mod(1,2));\nprint(\"Q_2-points used: \", #imgs, \"; dim span of dyadic images = \", #L2, \" (theory: = dim J(Q_2)/2J(Q_2) = 5)\");\nG2=matrix(#imgs[1], ng, i,j, sqc(gens[j])[i])*Mod(1,2);\nQ2=matker(Mat(L2)~);\nfin=Kcur*matker(Q2~*G2*Kcur);\nprint(\"final 2-Selmer upper bound (norm, 6 good primes, dyadic): \", #fin);\n" }, { "path": "anc/code/1.1.3/1.1.3e_chabauty.gp", "size_bytes": 4006, "sha256": "589a6565e63b80fb033b2900cf005f1374c8db94cc0b08c6036b4a498f2ea17a", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent recomputation of the 3-adic Chabauty data for 1033: x^4+y^3+xy+1=0\ndefault(parisizemax, 2*10^9);\nx; y; s; t; w;\nF=x^4+y^3+x*y+1;\n\\\\ F_3 points (affine) and projective closure\npts=List(); {for(a=0,2, for(b=0,2, if((a^4+b^3+a*b+1)%3==0, listput(pts,[a,b]))));}\nprint(\"affine F_3 points: \", pts);\nprint(\"reductions: P0=(0,-1)->\", [0, (-1)%3], \" P1=(1,-1)->\", [1,(-1)%3]);\n\\\\ smoothness mod 3: Fx = 4x^3+y, Fy=3y^2+x\n{my(ok=1); for(a=0,2,for(b=0,2, if((a^4+b^3+a*b+1)%3==0 && (4*a^3+b)%3==0 && (3*b^2+a)%3==0, ok=0))); print(\"affine smooth mod 3 (F_3-points): \", ok);}\n\\\\ singular over F_3-bar: Fy = x mod 3 -> x=0 -> Fx = y -> y=0 -> F(0,0)=1 != 0 : smooth (done by hand, recheck)\nprint(\"F(0,0) mod 3 = \", 1);\nNS=60; PR=50;\n\\\\ ---- infinity chart ----\nG=t^4+w+t*w^2+w^4;\nprint(\"chart identity: \", subst(subst(F,x,t/w),y,1/w)*w^4==G);\nws=O(t^NS); {for(i=1,10, ws=ws-subst(G,w,ws)/subst(deriv(G,w),w,ws));}\nprint(\"w(t) leading: \", ws+O(t^9));\n\\\\ check claimed differential formula against (1,x,y)dx/(3y^2+x)\nxs=t/ws; ys=1/ws;\nom1=[1,xs,ys]*deriv(xs,t)/(3*ys^2+xs);\nom2=-[ws,t,1]/(1+2*t*ws+4*ws^3);\nprint(\"differential identity at infinity: \", vector(3,k, valuation(om1[k]-om2[k],t)>=NS-12));\ntQ=3/82;\n\\\\ Q on curve?\nprint(\"Q=(-1/27,-82/81) on C: \", subst(subst(F,x,-1/27),y,-82/81)==0, \" t(Q) = \", (-1/27)/(-82/81), \" w(Q) = \", 1/(-82/81));\nprint(\"line y=x/3-1: F(x,x/3-1) = \", factor(subst(F,y,x/3-1)));\nlogQ=vector(3,k, my(sr=om2[k]); sum(j=0,NS-2, polcoeff(sr,j,t)*(tQ+O(3^PR))^(j+1)/(j+1)));\n\\\\ series truncation: om2 known mod t^NS; terms j>=NS-1 have valuation >= NS-v(NS) >> 10\nL0=-logQ/3;\nprint(\"L0 mod 9 = \", vector(3,k,lift(Mod(truncate(L0[k]),9))), \" v_3(L0) = \", vector(3,k,valuation(L0[k],3)));\n\\\\ ---- tangent line at P1 ----\nprint(\"tangent line: F(x,-(3x+1)/4) = \", factor(subst(F,y,-(3*x+1)/4)));\nqp=64*x^2+101*x+63;\nr0=0+O(3^PR); r1=1+O(3^PR);\n{for(i=1,60, r0=r0-subst(qp,x,r0)/subst(deriv(qp),x,r0); r1=r1-subst(qp,x,r1)/subst(deriv(qp),x,r1));}\nprint(\"a0 mod 9 = \", lift(Mod(truncate(r0),9)), \" a1 mod 9 = \", lift(Mod(truncate(r1),9)), \" residuals \", [valuation(subst(qp,x,r0),3), valuation(subst(qp,x,r1),3)]);\n\\\\ disk at P0=(0,-1): parameter s=y+1, x(s) with F_x unit\nxs0=O(s^NS); {for(i=1,10, xs0=xs0-subst(subst(F,y,-1+s),x,xs0)/subst(subst(deriv(F,x),y,-1+s),x,xs0));}\nomP0=-[1,xs0,-1+s]/(4*xs0^3+(-1+s));\n\\\\ disk at P1=(1,-1): parameter s=x-1, y(s) with F_y unit\nys1=-1+O(s^NS); {for(i=1,10, ys1=ys1-subst(subst(F,x,1+s),y,ys1)/subst(subst(deriv(F,y),x,1+s),y,ys1));}\nomP1=[1,1+s,ys1]/(3*ys1^2+(1+s));\nprint(\"constant coeffs: at P0 \", vector(3,k,polcoeff(omP0[k],0,s)), \" at P1 \", vector(3,k,polcoeff(omP1[k],0,s)));\nprint(\"integrality of series coeffs (min v_3 over first \", NS-1, \"): P0 \", vecmin(concat(vector(3,k,vector(NS-1,j,if(polcoeff(omP0[k],j-1,s)==0,99,valuation(polcoeff(omP0[k],j-1,s),3)))))), \" P1 \", vecmin(concat(vector(3,k,vector(NS-1,j,if(polcoeff(omP1[k],j-1,s)==0,99,valuation(polcoeff(omP1[k],j-1,s),3)))))));\nsA=-(3*r0+1)/4+1; \\\\ y(A)+1\nsB=r1-1; \\\\ x(B)-1\nprint(\"s(A) mod 9 = \", lift(Mod(truncate(sA),9)), \" s(B) mod 9 = \", lift(Mod(truncate(sB),9)));\nTA=vector(3,k, sum(j=0,NS-2, polcoeff(omP0[k],j,s)*sA^(j+1)/(j+1)));\nTB=vector(3,k, sum(j=0,NS-2, polcoeff(omP1[k],j,s)*sB^(j+1)/(j+1)));\nTT=TA+TB;\nprint(\"T mod 9 = \", vector(3,k,lift(Mod(truncate(TT[k]),9))));\nL1=-(L0+TT)/3;\nprint(\"L1 = -(L0+T)/3 valuations \", vector(3,k,valuation(L1[k],3)));\ncr=[L0[2]*TT[3]-L0[3]*TT[2], L0[3]*TT[1]-L0[1]*TT[3], L0[1]*TT[2]-L0[2]*TT[1]];\nprint(\"cross product L0 x T mod 9 = \", vector(3,k,lift(Mod(truncate(cr[k]),9))), \" valuations \", vector(3,k,valuation(cr[k],3)));\nlam=cr/3;\nprint(\"lambda mod 3 = \", vector(3,k,lift(Mod(truncate(lam[k]),3))), \" lambda.L0 = \", lam*L0~, \" lambda.L1 = \", lam*L1~);\n\\\\ annihilating differential constant coefficient in each disk\nprint(\"lambda.omega constant coeff: P0 \", valuation(lam*vector(3,k,polcoeff(omP0[k],0,s))~,3), \" P1 \", valuation(lam*vector(3,k,polcoeff(omP1[k],0,s))~,3), \" (0 = unit)\");\n" }, { "path": "anc/code/1.1.3/descent_common.gp", "size_bytes": 1307, "sha256": "6b126bdc850ab27e6d48491bfdb7f5c6143fbf413161ce77df3566285ba51af7", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent marked-bitangent 2-descent replay (auditor C, own code).\n\\\\ Curve F(x,y)=y^3+...+x^4 with hyperflex at infinity; bitangents y = m x + b.\nx; y; b; m;\n\\\\ ---------- field and intercept ----------\nslopepoly(F)={my(G,a,c,e1,e2,R,fa);\n G=Pol(subst(F,y,m*x+b),x);\n if(polcoeff(G,4,x)!=1, error(\"not monic quartic in x\"));\n a=polcoeff(G,3,x)/2; c=(polcoeff(G,2,x)-a^2)/2;\n e1=polcoeff(G,1,x)-2*a*c; e2=polcoeff(G,0,x)-c^2;\n R=polresultant(e1,e2,b); fa=factor(R); [fa, e1, e2]};\nintercept(F,f)={my(mm=Mod(m,f),G,a,c,e1,e2,r,bK,cK,chk);\n G=Pol(subst(F,y,mm*x+b),x);\n a=polcoeff(G,3,x)/2; c=(polcoeff(G,2,x)-a^2)/2;\n e1=polcoeff(G,1,x)-2*a*c; e2=polcoeff(G,0,x)-c^2;\n \\\\ e1, e2 polynomials in b with K coefficients; Euclid\n r=e2%e1; if(poldegree(r,b)!=1, error(\"remainder not linear\"));\n bK=-polcoeff(r,0,b)/polcoeff(r,1,b);\n if(subst(e1,b,bK)!=0 || subst(e2,b,bK)!=0, error(\"intercept fails\"));\n cK=subst(c,b,bK);\n chk=subst(F,y,mm*x+bK)-(x^2+subst(a,b,bK)*x+cK)^2;\n if(chk!=0, error(\"square identity fails\"));\n lift(bK)};\n\\\\ ---------- square-class characters ----------\n\\\\ reduce element (poly in m, rational coeffs) mod (p, g)\nredmod(e,p,g)=Mod(e*Mod(1,p),g);\nlegK(ev,p,g)={my(q=p^poldegree(g),t); if(ev==0, return(-1)); t=lift(ev^((q-1)/2)); if(t==1,0, if(t==-1,1,error(\"leg\")))};\n" }, { "path": "anc/code/1.1.4/1.1.4a_basic.gp", "size_bytes": 1218, "sha256": "7fc4d0b68a558a76f5b649b6141fe07d2519ea2faf46b05a34ad681a1430753c", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Basic checks for 4230 and 4227\ndefault(parisize, 200000000);\n\\\\ transport checks\nFt1 = x^4+y^3+2*x-y; M1 = v^4-u^3+u+2*v;\nprint(\"4230 transport: \", subst(subst(Ft1,x,v),y,-u) - M1);\nFt2 = x^4+y^3+2*x+y; M2 = v^4+u^3+u+2*v;\nprint(\"4227 transport: \", subst(subst(Ft2,x,v),y,u) - M2);\n\\\\ claimed sets\nS1 = [[-8,-16],[0,-1],[0,0],[0,1]]; for(i=1,#S1, print1(subst(subst(Ft1,x,S1[i][1]),y,S1[i][2]),\" \")); print();\nS2 = [[0,0],[8,-16]]; for(i=1,#S2, print1(subst(subst(Ft2,x,S2[i][1]),y,S2[i][2]),\" \")); print();\n\\\\ source curve 4230: C1: Y^4 - X^3 + X + 2Y = 0 (X=u, Y=v)\nC1 = Y^4 - X^3 + X + 2*Y;\nsrc1 = [[-1,0],[0,0],[1,0],[16,-8]]; for(i=1,#src1, print1(subst(subst(C1,X,src1[i][1]),Y,src1[i][2]),\" \")); print();\n\\\\ map src->target (x,y)=(v,-u)=(Y,-X)\nprint(vecsort(vector(4,i,[src1[i][2],-src1[i][1]])));\nC2 = X^3 + X + Y^4 + 2*Y;\nsrc2 = [[0,0],[-16,8]]; for(i=1,#src2, print1(subst(subst(C2,X,src2[i][1]),Y,src2[i][2]),\" \")); print();\nprint(vecsort(vector(2,i,[src2[i][2],src2[i][1]])));\n\\\\ bad primes: affine singular points\nN1 = polresultant(3*X^2-1, polresultant(2*Y^3+1, C1, Y), X); print(\"N1=\",N1,\" \",factor(N1));\nN2 = polresultant(3*X^2+1, polresultant(2*Y^3+1, C2, Y), X); print(\"N2=\",N2,\" \",factor(N2));\n" }, { "path": "anc/code/1.1.4/1.1.4a_bitangent.gp", "size_bytes": 1359, "sha256": "94114b331812620c901ea08605f469ac4bc81b8a5098ebc8afb66466c00e210c", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 400000000);\n\\\\ 4230 source: Y^4 - X^3 + X + 2Y, line X = m*Y + n\nC1 = Y^4 - X^3 + X + 2*Y;\nq1 = subst(C1, X, m*Y+n); q1 = Pol(q1, Y);\nB=polcoef(q1,3,Y); Cc=polcoef(q1,2,Y); D=polcoef(q1,1,Y); E=polcoef(q1,0,Y);\nprint([polcoef(q1,4,Y), B, Cc, D, E]);\ne1 = 8*D-4*B*Cc+B^3; e2 = 64*E-(4*Cc-B^2)^2;\nR1 = polresultant(e1, e2, n);\nfa = factor(R1); print(fa[,2]~, \" degs \", vector(#fa~,i,poldegree(fa[i,1])));\nf1 = m^27-480*m^19+2688*m^18-34560*m^11-141312*m^10-162816*m^9+16384*m^3-49152*m+32768;\nfor(i=1,#fa~, if(poldegree(fa[i,1])==27, print(\"4230 deg27 factor matches f: \", fa[i,1]==f1 || fa[i,1]==-f1, \" \", fa[i,1])));\nprint(fa);\n\\\\ 4227 source: X^3 + X + Y^4 + 2Y, line X = m*Y + n (u = m z + b)\nC2 = X^3 + X + Y^4 + 2*Y;\nq2 = subst(C2, X, m*Y+n); q2 = Pol(q2, Y);\nB=polcoef(q2,3,Y); Cc=polcoef(q2,2,Y); D=polcoef(q2,1,Y); E=polcoef(q2,0,Y);\nprint([polcoef(q2,4,Y), B, Cc, D, E]);\ne1b = 8*D-4*B*Cc+B^3; e2b = 64*E-(4*Cc-B^2)^2;\nR2 = polresultant(e1b, e2b, n);\nfb = factor(R2); print(fb);\ng2 = m^27+480*m^19-2688*m^18-34560*m^11-141312*m^10-162816*m^9-16384*m^3+49152*m-32768;\nfor(i=1,#fb~, if(poldegree(fb[i,1])==27, print(\"4227 deg27 factor matches g: \", fb[i,1]==g2 || fb[i,1]==-g2)));\nprint(\"irreducible f1: \", polisirreducible(f1), \" g2: \", polisirreducible(g2));\nprint(\"polsturm f1 real roots: \", polsturm(f1), \" g2: \", polsturm(g2));\n" }, { "path": "anc/code/1.1.4/1.1.4a_field.gp", "size_bytes": 1349, "sha256": "452ffe2e7d91fc5047ad7f252fb643add6d0a47b5e7e74e72a069096955d68e2", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 800000000);\n\\r polys.gp\nprint(isprime(11719983672151), \" \", isprime(93374840354982927532779252030629), \" \", isprime(14365291), \" \", isprime(172681));\nfa1 = [2,3,13,43,83,172681,11719983672151];\nfa2 = [2,3,5,139,281,93374840354982927532779252030629];\nK1 = nfinit([f1, fa1]); print(\"K1 sig \", K1.sign, \" disc \", factor(K1.disc), \" \", K1.disc);\nprint(\" claimed \", 2^28*83^6*172681^6, \" eq \", abs(K1.disc)==2^28*83^6*172681^6, \" eq2 \", abs(K1.disc)==2326889515985953907282417842991419362237373569040384);\nprint(\" index \", K1.index);\nprint(\" certify K1: \", nfcertify(K1));\nK2 = nfinit([g2, fa2]); print(\"K2 sig \", K2.sign, \" disc \", factor(K2.disc));\nprint(\" claimed eq \", abs(K2.disc)==2^28*14365291^6, \" index \", K2.index);\nprint(\" certify K2: \", nfcertify(K2));\nP1 = idealprimedec(K1,2); print(\"K1 primes over 2 (e,f): \", vector(#P1,i,[P1[i].e,P1[i].f]));\nP2 = idealprimedec(K2,2); print(\"K2 primes over 2 (e,f): \", vector(#P2,i,[P2[i].e,P2[i].f]));\n\\\\ other ramification\nprint(\"K1 ram 83: \", vector(#idealprimedec(K1,83),i,[idealprimedec(K1,83)[i].e,idealprimedec(K1,83)[i].f]));\nprint(\"K1 ram 172681: \", vector(#idealprimedec(K1,172681),i,[idealprimedec(K1,172681)[i].e,idealprimedec(K1,172681)[i].f]));\nprint(\"K2 ram q: \", vector(#idealprimedec(K2,14365291),i,[idealprimedec(K2,14365291)[i].e,idealprimedec(K2,14365291)[i].f]));\n\n" }, { "path": "anc/code/1.1.4/1.1.4a_nodes.gp", "size_bytes": 1629, "sha256": "d960828d79ae2d26377ae6c4621c11051bdf5da58f0dae8781a964153b53b84d", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 4230 source: F = y^4 - x^3 + x + 2y ; lift (2187/128, -243/32)\nF = y^4 - x^3 + x + 2*y; xc = 2187/128; yc = -243/32;\nev(G) = subst(subst(G, x, xc), y, yc);\nprint(\"4230: F(xc,yc) = \", ev(F), \" = \", factor(ev(F)));\nprint(\" 4x+9y: \", 4*xc + 9*yc);\nforeach([83,172681], p, print(\" p=\",p,\": v(F)=\",valuation(ev(F),p),\" v(Fx)=\",valuation(ev(deriv(F,x)),p),\" v(Fy)=\",valuation(ev(deriv(F,y)),p), \" v(Hess)=\", valuation(ev(deriv(deriv(F,x),x)*deriv(deriv(F,y),y) - deriv(deriv(F,x),y)^2), p)));\n\\\\ uniqueness of singular point mod p: solve Fx=Fy=F=0 over Fp\nforeach([83,172681], p, my(cnt=0, rx = polrootsmod(Mod(1,p)*(1-3*x^2), p), ry = polrootsmod(Mod(1,p)*(4*y^3+2), p)); for(i=1,#rx, for(j=1,#ry, if(subst(subst(F,x,lift(rx[i])),y,lift(ry[j])) % p == 0, cnt++))); print(\" F_p-rational affine sing pts at \", p, \": \", cnt));\n\\\\ geometric: over algebraic closure, the system 3x^2=1, 2y^3=-1, F=0 -> elimination gave unique (x,y) when p | Res; check via gcd in Fp[y]\nforeach([83,172681], p, my(g = gcd(Mod(1,p)*(243*y^2-16), Mod(1,p)*(2*y^3+1))); print(\" gcd degree in y at \", p, \": \", poldegree(g)));\n\\\\ 4227: F = u^3+u+z^4+2z, lift (-2187/128, 243/32)\nG = x^3 + x + y^4 + 2*y; xc = -2187/128; yc = 243/32;\nq = 14365291;\nprint(\"4227: G(c) = \", factor(ev(G)), \" v_q(G)=\", valuation(ev(G),q), \" v(Gu)=\", valuation(ev(deriv(G,x)),q), \" v(Gz)=\", valuation(ev(deriv(G,y)),q), \" v(Hess)=\", valuation(ev(deriv(deriv(G,x),x)*deriv(deriv(G,y),y)-deriv(deriv(G,x),y)^2), q));\nprint(\" identity 12F-4uFu-3zFz = \", 12*G - 4*x*deriv(G,x) - 3*y*deriv(G,y));\nprint(\" gcd degree: \", poldegree(gcd(Mod(1,q)*(243*y^2+16), Mod(1,q)*(2*y^3+1))));\n" }, { "path": "anc/code/1.1.4/1.1.4bcd_classgroup.sh", "size_bytes": 898, "sha256": "355e85e53c0b057eb82cee8367f27344efdda39ac5fdbd2f40984c37aae6e2e0", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/sh\n# 1.1.4b, 1.1.4c, 1.1.4d with the shared tools in code/common/h31_classgroup (FULL run; see README for\n# the run times and for the slices that were run here). Large files go to work/ (not in the bundle).\n# W = number of worker processes.\nset -e\ncd \"$(dirname \"$0\")\"\nCG=../common/h31_classgroup\nPRM=data/classgroup_params.json\nW=${W:-2}\nmkdir -p work\necho \"== 1.1.4b: all prime ideals of norm < 5·10^8\"\npython3 $CG/count_ideals.py $PRM --workers $W --out work/counts.npz\necho \"== 1.1.4c: strict norm-induction witnesses for all prime ideals of norm <= 2.02·10^6 (bnfinit only proposes)\"\npython3 $CG/witnesses.py $PRM --workers $W --out work/witnesses.jsonl.gz\necho \"== 1.1.4c: exact check against an independent list of the prime ideals\"\npython3 $CG/check_witnesses.py $PRM work/witnesses.jsonl.gz\necho \"== 1.1.4d: B^-(f) in 224-bit Arb balls\"\npython3 $CG/bound.py $PRM work/counts.npz\n" }, { "path": "anc/code/1.1.4/1.1.4e_dyadic_points.gp", "size_bytes": 968, "sha256": "3ea8bcab7a37787e713886869a51369a7d7b979859daa58ff0cf7ef13a8921a2", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 800000000);\nX;Y;W;\n\\r polys.gp\n\\r eta.gp\n\\r selmer_lib.gp\nFF=f1; ETA=eta1;\nK = nfinit([FF, [2,3,13,43,83,172681,11719983672151]]);\nS = idealprimedec(K, 2); print(\"dyadic (e,f): \", vector(#S,k,[S[k][3],S[k][4]]));\nDD = vector(#S, k, dyadic_setup(K, S[k]));\nEV(x0, y0) = Mod(x0 - m*y0, FF) - Mod(ETA, FF);\nPR=80;\nrts = polrootspadic(X^3 - X - (2^4 + 2*2), 2, PR); xA = 0; for(i=1,#rts, if(valuation(rts[i],2) >= 1, xA = truncate(rts[i])));\nprint(\"xA mod 2^36 = \", xA % 2^36);\nrw = polrootspadic(2^4 - W + (1+2*2)*W^3, 2, PR); wA = 0; for(i=1,#rw, if(valuation(rw[i],2) >= 1, wA = truncate(rw[i])));\nprint(\"wA mod 2^36 = \", wA % 2^36);\npts = [EV(0,0), EV(xA,2), EV(1,0), Mod((1 - (1+2*2)*wA^2)*(1 - m*2 - ETA*wA), FF)];\nrows = matrix(4, #dyadic_all(K, DD, 3)); for(j=1,4, my(v=dyadic_all(K,DD,pts[j])); for(r=1,#v, rows[j,r]=v[r]));\nprint(\"rank of four source points: \", f2rank(rows));\nprint(\"rank of G0,G1: \", f2rank(matconcat([rows[1,]; rows[3,]])));\n" }, { "path": "anc/code/1.1.4/1.1.4e_selmer.gp", "size_bytes": 3180, "sha256": "3bb715195faf1d79916172e764b8622361de847c0e4052b7efbf62c791eaf2b9", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 1500000000);\nX;Y;W;\n\\r polys.gp\n\\r eta.gp\n\\r selmer_lib.gp\nFF = f1; ETA = eta1;\nK = nfinit([FF, [2,3,13,43,83,172681,11719983672151]]);\nread(\"data/4230_S_unit_representatives.gp\"); \\\\ the 18 supplied representatives (no bnfinit)\nS = idealprimedec(K, 2); print(\"dyadic (e,f): \", vector(#S,k,[S[k][3],S[k][4]]));\nB = apply(b -> Mod(b, FF), B4230); nB = #B; print(\"K(S,2) basis size: \", nB);\nokS = 1; for(i=1,nB, my(F = idealfactor(K, B[i])); for(j=1,#F~, if(F[j,1].p != 2, okS = 0)));\nprint(\"basis elements supported on the primes above 2: \", okS);\nDD = vector(#S, k, dyadic_setup(K, S[k]));\ndimloc = #dyadic_all(K, DD, 3); print(\"dim of prod K_P^*/squares: \", dimloc);\nL2 = matrix(dimloc, nB); for(i=1,nB, my(vv = dyadic_all(K, DD, B[i])); for(r=1,dimloc, L2[r,i] = vv[r]));\nprint(\"independence rank of basis via dyadic classes: \", f2rank(L2));\nnd = vector(nB, i, normdata(K, B[i]));\nnormrows = matrix(2, nB, r, c, nd[c][r]);\nprint(\"norm data [neg sign, v2 parity]: \", nd);\nEV(x0, y0) = Mod(x0 - m*y0, FF) - Mod(ETA, FF);\nPR = 80;\nrts = polrootspadic(X^3 - X - (2^4 + 2*2), 2, PR); xA = 0; for(i=1,#rts, if(valuation(rts[i],2) >= 1, xA = truncate(rts[i])));\nrw = polrootspadic(2^4 - W + (1+2*2)*W^3, 2, PR); wA = 0; for(i=1,#rw, if(valuation(rw[i],2) >= 1, wA = truncate(rw[i])));\nrts4 = polrootspadic(X^3 - X - (4^4 + 2*4), 2, PR);\nrw2 = polrootspadic(4^4 - W + (1+2*4)*W^3, 2, PR); wB = 0; for(i=1,#rw2, if(valuation(rw2[i],2) >= 1, wB = truncate(rw2[i])));\nlocpts = List();\nlistput(locpts, [\"(0,0)\", EV(0,0)]); listput(locpts, [\"(1,0)\", EV(1,0)]); listput(locpts, [\"(-1,0)\", EV(-1,0)]); listput(locpts, [\"(16,-8)\", EV(16,-8)]);\nlistput(locpts, [\"(xA,2)\", EV(xA, 2)]);\nfor(i=1,#rts4, listput(locpts, [Str(\"(r\",i,\",4)\"), EV(truncate(rts4[i]), 4)]));\nlistput(locpts, [\"inf t=2\", Mod((1 - (1+2*2)*wA^2)*(1 - m*2 - ETA*wA), FF)]);\nlistput(locpts, [\"inf t=4\", Mod((1 - (1+2*4)*wB^2)*(1 - m*4 - ETA*wB), FF)]);\nlocrows = matrix(0, dimloc);\n{\nfor(j=1,#locpts, my(xi = locpts[j][2], vv, vals = vector(#S,k,nfeltval(K, xi, S[k])));\n for(k=1,#S, if(vals[k] + 2*S[k][3] >= PR*S[k][3] - 2, print(\"PRECISION WARNING \", locpts[j][1])));\n vv = dyadic_all(K, DD, xi); locrows = matconcat([locrows; Mat(vv)]);\n print(locpts[j][1], \" vals \", vals, \" cumulative rank \", f2rank(locrows)));\n}\nIm2 = Mod(locrows, 2); print(\"dyadic image rank: \", matrank(Im2));\ncond2 = lift(matker(Im2)~ * Mod(L2,2));\nCURVE = Y^4 - X^3 + X + 2*Y;\nEVF(x0, y0, g, eg) = x0 - g*y0 - eg;\nallc = normrows; print(\"after norm: dim \", nB - f2rank(allc));\n{\nforeach([487,491,499,503,509,521,523], p,\n my(res = goodimage(K, ETA, CURVE, EVF, p), GS = res[1], IM = res[2], lp, cnd);\n lp = matrix(#GS, nB); for(c=1,nB, my(ch = gp_char(K, B[c], GS)); for(a=1,#GS, lp[a,c] = ch[a]));\n cnd = lift(matker(IM)~ * Mod(lp,2));\n allc = matconcat([allc; cnd]);\n print(\"p=\", p, \" #primes \", #GS, \" f's \", vector(#GS,i,GS[i][1][4]), \" #aff pts \", matsize(IM)[1], \" zero-hist \", res[3], \" img rank \", matrank(IM), \" | global dim \", nB - f2rank(allc)));\n}\nallc2 = matconcat([allc; cond2]);\nsel = matker(Mod(allc2,2)); print(\"FINAL fake Selmer dim (norm+good primes+2): \", #sel);\nprint(\"Selmer basis: \", lift(sel)~);\n" }, { "path": "anc/code/1.1.4/1.1.4f_divisors.gp", "size_bytes": 922, "sha256": "09668c6af25a75695d54ea7feb0d616be465773f50d04f446e45c6482301aa06", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 400000000);\ndefault(seriesprecision, 40);\nC1 = y^4 - x^3 + x + 2*y;\n\\\\ check div(x+2y) and div(y)\nprint(\"x+2y restricted: \", factor(subst(C1, x, -2*y)));\nprint(\"y=0: \", factor(subst(C1, y, 0)));\n\\\\ series x(y) at P1=(1,0): solve x - x^3 = -2y - y^4, x(0)=1, Newton\nNS = 30;\nxs = 1 + O(y^NS);\nfor(it=1,8, xs = xs - (xs - xs^3 + 2*y + y^4)/(1 - 3*xs^2));\nprint(\"x(y) at P1 first terms: \", xs + O(y^6));\n\\\\ basis of L(10 O): weights x:4, y:3\nbas = [1, y, x, y^2, x*y, x^2, y^3, x*y^2];\nser = vector(#bas, i, subst(bas[i], x, xs));\nMt = matrix(7, #bas, r, c, polcoef(ser[c] + O(y^NS), r-1, y));\nker = matker(Mt); print(\"kernel dim: \", #ker);\nk = ker[,1]; k = k / content(k);\nf10 = sum(i=1,#bas, k[i]*bas[i]); print(\"f10 = \", f10);\n\\\\ order at P1\ns = subst(f10, x, xs); print(\"valuation at P1: \", valuation(s, y));\n\\\\ residual: resultant in x\nR = polresultant(f10, C1, x); print(\"Res_x factor: \", factor(R));\n" }, { "path": "anc/code/1.1.4/1.1.4f_residual.gp", "size_bytes": 750, "sha256": "646629c217e09c811f9804e57789f1827748f96e45dcc25e387ee4c05de8e0c0", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 400000000);\nC1 = y^4 - x^3 + x + 2*y;\nf10 = -13043*x^2 + (27304*y^2 + 22862*y + 19496)*x + (-5780*y^3 - 47008*y^2 - 16272*y - 6453);\nc = 20355361790464*y^3 + 44763113579296*y^2 + 24093145816861*y + 26194544526168;\nprint(\"factor c: \", factor(c), \" irreducible: \", polisirreducible(c));\nprint(\"c content/2-val of coeffs: \", vector(4,i,valuation(polcoef(c,i-1),2)));\nprint(\"newton polygon slopes 2: \", newtonpoly(c, 2));\nfp = factorpadic(c, 2, 60); print(fp);\n\\\\ x as a function of y on the cubic: gcd of f10 and C1 in (Q[y]/c)[x]\nF10 = subst(f10, y, Mod(y, c)); CC = subst(C1, y, Mod(y,c));\ngg = gcd(Pol(F10, x), Pol(CC, x)); print(\"gcd degree: \", poldegree(gg,x));\nxval = -polcoef(gg,0,x)/polcoef(gg,1,x); print(\"x = \", lift(xval));\n" }, { "path": "anc/code/1.1.4/1.1.4fg_logs_even.gp", "size_bytes": 4072, "sha256": "8c6ae0aaa07685b60f5b5c27e2688b954a015b4c14aa1f7ecf17513b2f2c037b", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 800000000); default(debugmem,0);\nNS = 60; PR = 200;\nC1 = y^4 - x^3 + x + 2*y;\nc = 20355361790464*y^3 + 44763113579296*y^2 + 24093145816861*y + 26194544526168;\nxval = 93188552/76623801*y^2 + 144556901/153247602*y - 10271025/25541267;\n\\\\ ---- even chart at P0: x(y), x(0)=0\nxe = O(y^NS); for(it=1,9, xe = xe - (xe - xe^3 + 2*y + y^4)/(1 - 3*xe^2));\nprint(\"even branch check: \", valuation(xe - xe^3 + 2*y + y^4, y) >= NS);\nwe = [1, y, xe] / (1 - 3*xe^2); \\\\ omega_i = we[i] dy\nIe = vector(3, i, intformal(we[i], y));\n\\\\ coefficients in t (y=2t)\nEt = vector(3,i, subst(Ie[i], y, 2*t));\nprint(\"even chart t-coeffs (deg1..4) for omega_0,1,2: \");\nfor(i=1,3, print(\" \", vector(4,k,polcoef(Et[i],k,t))));\n\\\\ min valuation of tail coefficients degrees 5..NS-1 relative to bound n - v2(n)\nok=1; for(i=1,3, for(n=5,NS-1, cc=polcoef(Et[i],n,t); if(cc!=0 && valuation(cc,2) < n - valuation(n,2), ok=0; print(\"tail violation \",i,\" \",n)))); print(\"even tail bound n-v(n) holds: \", ok);\n\\\\ integral P0 -> P* (y=-8)\nyst = -8 + O(2^PR);\nIstar = vector(3,i, subst(truncate(Ie[i]), y, yst));\nL0 = -Istar/4;\nprint(\"v2(log G0) = \", vector(3,i,valuation(L0[i],2)));\n\\\\ ---- P1 chart: x(y), x(0)=1\nx1 = 1 + O(y^NS); for(it=1,9, x1 = x1 - (x1 - x1^3 + 2*y + y^4)/(1 - 3*x1^2));\nprint(\"P1 branch check: \", valuation(x1 - x1^3 + 2*y + y^4, y) >= NS);\nw1 = [1, y, x1] / (1 - 3*x1^2); I1 = vector(3,i, truncate(intformal(w1[i], y)));\n\\\\ 2-adic root of c with v=3\nfp = factorpadic(c, 2, PR);\nlin = 0; quad = 0; for(i=1,#fp~, if(poldegree(fp[i,1])==1, lin = fp[i,1], quad = fp[i,1]));\ny1 = -polcoef(lin,0)/polcoef(lin,1); print(\"v2(y1) = \", valuation(y1,2));\nx1v = subst(xval, y, y1); print(\"x(Q1) mod 64 = \", lift(Mod(truncate(x1v),64)), \" v2(x(Q1)-1) = \", valuation(x1v-1,2));\nprint(\"C1 at Q1: \", valuation(subst(subst(C1,x,x1v),y,y1),2));\n\\\\ check Q1 lies on the branch through P1: compare x1(y1) with x1v\nprint(\"branch agreement v2: \", valuation(subst(truncate(x1),y,y1) - x1v, 2));\nIQ1 = vector(3,i, subst(I1[i], y, y1));\n\\\\ ---- infinity chart: t = y/x, w = 1/x, t^4 - w + (1+2t) w^3 = 0\nws = O(t^NS); for(it=1,9, ws = ws - (t^4 - ws + (1+2*t)*ws^3)/(-1 + 3*(1+2*t)*ws^2));\nprint(\"inf branch check: \", valuation(t^4 - ws + (1+2*t)*ws^3, t) >= NS);\nxs = 1/ws; ys = t/ws;\ndys = deriv(ys, t);\nwinf = vector(3,i, [1, ys, xs][i] * dys / (1 - 3*xs^2));\nprint(\"inf forms valuations in t: \", vector(3,i,valuation(winf[i],t)));\nprint(\"inf forms first coeffs: \", vector(3,i, Vec(winf[i])[1..4]));\n\\\\ integrality of inf form coefficients\nokI = 1; for(i=1,3, v = Vec(winf[i]); for(k=1,#v, if(v[k]!=0 && valuation(v[k],2)<0, okI=0))); print(\"inf forms integral: \", okI);\nIinf = vector(3,i, truncate(intformal(winf[i], t)));\n\\\\ evaluate on the quadratic factor\nY = Mod(y, quad); X = subst(xval, y, Y);\nprint(\"v2 of norm of x on pair: \", valuation(norm(X),2), \" (=> v(x) = \", valuation(norm(X),2)/2, \")\");\nT = Y / X; print(\"v2 norm t: \", valuation(norm(T),2));\nWv = 1/X; \n\\\\ check the pair lies on infinity branch: w(t) vs 1/x\nprint(\"branch agreement (norm val): \", valuation(norm(subst(truncate(ws), t, T) - Wv),2));\nIpair = vector(3,i, trace(subst(Iinf[i], t, T)));\n\\\\ total\nL1 = -(IQ1 + Ipair)/8;\nprint(\"v2(log G1) = \", vector(3,i,valuation(L1[i],2)));\n\\\\ annihilator\na = [L0[2]*L1[3]-L0[3]*L1[2], L0[3]*L1[1]-L0[1]*L1[3], L0[1]*L1[2]-L0[2]*L1[1]];\nmv = vecmin(vector(3,i,valuation(a[i],2))); a = a/2^mv;\nprint(\"annihilator primitive mod 8 (scaled so that a1 = 1 mod 8 unit-normalized): \");\n\\\\ normalize by making a[2] = 1 (a1 odd expected)\nan = a / a[2]; print(\" a/a1 mod 8 = \", vector(3,i, lift(Mod(truncate(an[i]),8))), \" (valuations \", vector(3,i,valuation(a[i],2)), \")\");\nprint(\" check a.L0 = \", valuation(a*L0~,2), \" a.L1 = \", valuation(a*L1~,2));\n\\\\ determinant in coordinates 0 and 2\nDel = L0[1]*L1[3] - L1[1]*L0[3]; print(\"v2(Delta) = \", valuation(Del,2), \" products: \", valuation(L0[1]*L1[3],2), \" \", valuation(L1[1]*L0[3],2));\nprint(\"L0 mod 2^20 (scaled): \", vector(3,i, L0[i] + O(2^20)));\nprint(\"L1: \", vector(3,i, L1[i] + O(2^20)));\nwrite(\"work/logs4230.txt\", [L0, L1]);\n\n" }, { "path": "anc/code/1.1.4/1.1.4g_odd.gp", "size_bytes": 1926, "sha256": "582b5f06350cc3bde89a7f86459c6db14f8976491bfd1b798c9eace15c134270", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 400000000);\nt; \nNS = 60; PR = 120;\nL = read(\"work/logs4230.txt\"); L0 = L[1]; L1 = L[2];\na = [L0[2]*L1[3]-L0[3]*L1[2], L0[3]*L1[1]-L0[1]*L1[3], L0[1]*L1[2]-L0[2]*L1[1]];\nmv = vecmin(vector(3,i,valuation(a[i],2))); a = a/2^mv; print(\"a vals \", vector(3,i,valuation(a[i],2)));\n{\nforeach([1,-1], ep,\n my(v = O(t^NS), D, Dinv, H, Hp, C, w0, w1, w2, I0, I2);\n for(it=1,9, v = v - (v + 6*ep*v^2 + 8*v^3 - 32*t^4 - t)/(1 + 12*ep*v + 24*v^2));\n if(valuation(v + 6*ep*v^2 + 8*v^3 - 32*t^4 - t, t) < NS, error(\"branch\"));\n my(okv = 1); for(j=1,NS-1, my(c=polcoef(v,j,t)); if(c!=0 && valuation(c,2) < j-1, okv=0)); \n D = 1 + 12*ep*v + 24*v^2; Dinv = 1/D;\n my(okd = 1); for(j=1,NS-1, my(c=polcoef(Dinv,j,t)); if(c!=0 && valuation(c,2) < j+1, okd=0));\n \\\\ check pullback: x = ep+4v, y = 4t; omega = (1,y,x) dy/(1-3x^2)\n my(xx = ep + 4*v, yy = 4*t, pb = [1, yy, xx]*deriv(yy,t)/(1 - 3*xx^2), cl = -2*[1, 4*t, ep+4*v]/D);\n print(\"eps=\",ep,\" v bound j-1: \", okv, \" Dinv bound j+1: \", okd, \" pullback identity: \", vector(3,i,valuation(pb[i]-cl[i],t)));\n C = a[1] + ep*a[3]; print(\" v(C_eps) = \", valuation(C,2));\n H = intformal(sum(i=1,3, a[i]*pb[i]))/(-4);\n print(\" [t]H = C/2? \", valuation(polcoef(H,1,t) - C/2, 2), \" [t^2]H = a1+a2-3eC? \", valuation(polcoef(H,2,t) - (a[2]+a[3]-3*ep*C),2));\n print(\" vals of [t^1..t^8]H: \", vector(8,k,valuation(polcoef(H,k,t),2)));\n my(okh=1); for(mm=3,NS-1, my(c=polcoef(H,mm,t)); if(valuation(c,2) < mm - valuation(mm,2), okh=0)); print(\" tail m - v(m): \", okh);\n \\\\ I0/(-2), I2/(-2) for odd t: check coefficient structure t + 2Z2 and ep t + 2Z2\n I0 = intformal(pb[1])/(-2); I2 = intformal(pb[3])/(-2);\n my(ok0=1, ok2=1); for(k=2,NS-1, if(valuation(polcoef(I0,k,t),2) < 1, ok0=0); if(valuation(polcoef(I2,k,t),2) < 1, ok2=0));\n print(\" I0/(-2) = t + (coeffs >=1): \", polcoef(I0,1,t)==1 && ok0, \" I2/(-2) = eps t + (>=1): \", polcoef(I2,1,t)==ep && ok2);\n);\n}\n" }, { "path": "anc/code/1.1.4/data/4230_S_unit_representatives.gp", "size_bytes": 20702, "sha256": "26f175e7135df7c6f176de4474d60ce51c774a24751d0da3805b0a80db8e8ee7", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ the 18 S-unit candidates of the source (4230_descent_input.json), as polynomials in m\n{\nB4230 = [\n((-1)*m^0),\n((2452589049810229/1511877893707479)*m^0+(-9204450681377507/1511877893707479)*m^1+(8487346026220255/4535633681122437)*m^2+(109447449240579175/9071267362244874)*m^3+(47452135673245549/9071267362244874)*m^4+(-399459170546572027/36285069448979496)*m^5+(-31507860042048785/2015837191609972)*m^6+(49027383684190879/12095023149659832)*m^7+(2275446784924162153/72570138897958992)*m^8+(3245686855146177845/145140277795917984)*m^9+(1394229975378796033/290280555591835968)*m^10+(-17103657060123995/290280555591835968)*m^11+(-11821201366211465/96760185197278656)*m^12+(20437576074095921/290280555591835968)*m^13+(10553994752325605/64506790131519104)*m^14+(2139469286950097/32253395065759552)*m^15+(-19716503957889295/96760185197278656)*m^16+(-399248328310239251/1161122222367343872)*m^17+(19563130910991725/290280555591835968)*m^18+(-4322721268189/516054321052152832)*m^19+(-109414680008273/4644488889469375488)*m^20+(-461843416121131/9288977778938750976)*m^21+(53515820323895/3096325926312916992)*m^22+(49488613396721/774081481578229248)*m^23+(55899037925533/1548162963156458496)*m^24+(-286373165352117/4128434568417222656)*m^25+(-10426060889501951/74311822231510007808)*m^26),\n((-316528178098055087/19654412618197227)*m^0+(11497320811758955/19654412618197227)*m^1+(-19156426157581969/19654412618197227)*m^2+(-92120321595311407/9071267362244874)*m^3+(-79593338964324215/6047511574829916)*m^4+(-883821240805668287/36285069448979496)*m^5+(-391176516946391399/12095023149659832)*m^6+(-326693722184732635/6047511574829916)*m^7+(-5890871245905796439/72570138897958992)*m^8+(-89815913426388348881/1886823611346933792)*m^9+(-12408018272301024457/1257882407564622528)*m^10+(20623223594509567/157235300945577816)*m^11+(130646241339039629/1886823611346933792)*m^12+(363546534435492307/3773647222693867584)*m^13+(665706977460843515/2515764815129245056)*m^14+(1065176663874645989/5031529630258490112)*m^15+(1401329738363454863/2515764815129245056)*m^16+(9845174631233352631/15094588890775470336)*m^17+(-227565287830739957/1677176543419496704)*m^18+(-132156424468033/5031529630258490112)*m^19+(890011019145869/20126118521033960448)*m^20+(4055796790813763/120756711126203762688)*m^21+(5051728348069099/120756711126203762688)*m^22+(25581350216363399/241513422252407525376)*m^23+(5897505472049117/60378355563101881344)*m^24+(108518901390903061/483026844504815050752)*m^25+(30351885326706083/107339298778847789056)*m^26),\n((3980015300752357/58963237854591681)*m^0+(-5987836413138461/58963237854591681)*m^1+(3341815724583208/58963237854591681)*m^2+(-18202655527056/503959297902493)*m^3+(10857724349472/503959297902493)*m^4+(-6476537331264/503959297902493)*m^5+(3863197706368/503959297902493)*m^6+(-6913090632448/1511877893707479)*m^7+(12370793763328/4535633681122437)*m^8+(-16980686115855235/943411805673466896)*m^9+(2042249812389573/52411766981859272)*m^10+(-481266801379773/26205883490929636)*m^11+(143535712692213/13102941745464818)*m^12+(-42808896767853/6551470872732409)*m^13+(25535131405386/6551470872732409)*m^14+(-15231481890932/6551470872732409)*m^15+(27256336015352/19654412618197227)*m^16+(-48774496027472/58963237854591681)*m^17+(248583972412693/2515764815129245056)*m^18+(3692584153809/419294135854874176)*m^19+(-1101297028329/209647067927437088)*m^20+(328457008449/104823533963718544)*m^21+(-97960862169/52411766981859272)*m^22+(29216397489/26205883490929636)*m^23+(-8713662409/13102941745464818)*m^24+(7796434787/19654412618197227)*m^25+(-13951514882/58963237854591681)*m^26),\n((-88267438766630161/58963237854591681)*m^0+(86299877007853082/19654412618197227)*m^1+(301068273926974079/58963237854591681)*m^2+(16696383911677607/6047511574829916)*m^3+(-347694303286331/4535633681122437)*m^4+(-204601642285497845/36285069448979496)*m^5+(-263616659325092537/18142534724489748)*m^6+(-1748691026670444649/72570138897958992)*m^7+(-4180965174602017535/145140277795917984)*m^8+(-28847495653742178611/1886823611346933792)*m^9+(-1395949183942972379/471705902836733448)*m^10+(-126577859809229795/3773647222693867584)*m^11+(3206527273072417/3773647222693867584)*m^12+(204327542034201199/7547294445387735168)*m^13+(565105350476469611/7547294445387735168)*m^14+(2406524736306084647/15094588890775470336)*m^15+(3080791297681888927/15094588890775470336)*m^16+(322167578749477609/1677176543419496704)*m^17+(-1261350710795884031/30189177781550940672)*m^18+(594504732446561/30189177781550940672)*m^19+(-594295630414627/60378355563101881344)*m^20+(-17543368587229/10063059260516980224)*m^21+(1160016355055809/120756711126203762688)*m^22+(395641064754779/13417412347355973632)*m^23+(31157768207593537/483026844504815050752)*m^24+(4690767977811431/53669649389423894528)*m^25+(4672973604947683/53669649389423894528)*m^26),\n((2404072736133685991/58963237854591681)*m^0+(74165082727409174/19654412618197227)*m^1+(247268846790484358/58963237854591681)*m^2+(12379299315392290/503959297902493)*m^3+(115874623504551553/3023755787414958)*m^4+(707582895074146705/12095023149659832)*m^5+(354166615424470843/4031674383219944)*m^6+(4794897773540718385/36285069448979496)*m^7+(2482519856398548079/12095023149659832)*m^8+(237064213198833708697/1886823611346933792)*m^9+(100116391752407899493/3773647222693867584)*m^10+(-575409486131163383/3773647222693867584)*m^11+(-810406853002730423/3773647222693867584)*m^12+(-2650415330378525875/7547294445387735168)*m^13+(-7647223382783055791/15094588890775470336)*m^14+(-723588416786430461/943411805673466896)*m^15+(-5789660807709905717/5031529630258490112)*m^16+(-6169573460869475739/3354353086838993408)*m^17+(22341970327662262109/60378355563101881344)*m^18+(-1503929844280009/30189177781550940672)*m^19+(-1976371177417367/30189177781550940672)*m^20+(-3676988476231451/40252237042067920896)*m^21+(-35459061930080579/241513422252407525376)*m^22+(-51834664887058597/241513422252407525376)*m^23+(-8684146690181411/26834824694711947264)*m^24+(-78226015353886195/161008948168271683584)*m^25+(-15517107883439099/20126118521033960448)*m^26),\n((450963593781261343/19654412618197227)*m^0+(74770704535928026/58963237854591681)*m^1+(-475961340135423821/39308825236394454)*m^2+(-108846995551881776/4535633681122437)*m^3+(-762474647602543889/18142534724489748)*m^4+(-224166983948652556/4535633681122437)*m^5+(-431425178720709799/12095023149659832)*m^6+(133147643141102957/72570138897958992)*m^7+(811818148730993977/12095023149659832)*m^8+(49116931027664263783/943411805673466896)*m^9+(22522553213184883669/1886823611346933792)*m^10+(466331924859224509/3773647222693867584)*m^11+(2100697917096979513/7547294445387735168)*m^12+(221524597394424817/628941203782311264)*m^13+(5005280963885266547/15094588890775470336)*m^14+(1152739578958444271/15094588890775470336)*m^15+(-8148614410002943951/30189177781550940672)*m^16+(-26774866694735007481/30189177781550940672)*m^17+(10030816675367735075/60378355563101881344)*m^18+(-272608115873539/30189177781550940672)*m^19+(5362894904225089/120756711126203762688)*m^20+(13467102628114847/120756711126203762688)*m^21+(36460687896963181/241513422252407525376)*m^22+(12098417556918821/80504474084135841792)*m^23+(26697694383905221/483026844504815050752)*m^24+(-1214998811039971/13417412347355973632)*m^25+(-334355779922337587/966053689009630101504)*m^26),\n((1430096061997642459/19654412618197227)*m^0+(-169385158323940171/19654412618197227)*m^1+(257594801463857254/58963237854591681)*m^2+(86684364711789269/1511877893707479)*m^3+(446628513960314077/9071267362244874)*m^4+(1625920615867807739/18142534724489748)*m^5+(1569621109793557663/9071267362244874)*m^6+(5504324431831724849/24190046299319664)*m^7+(12375470353461144043/36285069448979496)*m^8+(22416001815273569891/104823533963718544)*m^9+(28903342748786526769/628941203782311264)*m^10+(-73698618207876071/235852951418366724)*m^11+(-4102818590776471231/7547294445387735168)*m^12+(-150793170894643141/1257882407564622528)*m^13+(-8321700754606023437/7547294445387735168)*m^14+(-24462176986332375023/15094588890775470336)*m^15+(-48113489196426442333/30189177781550940672)*m^16+(-32685543413551950419/10063059260516980224)*m^17+(2151090272770871491/3354353086838993408)*m^18+(-301657780436413/5031529630258490112)*m^19+(-15335943340370683/120756711126203762688)*m^20+(-13586339668516123/60378355563101881344)*m^21+(-5113747397099629/60378355563101881344)*m^22+(-1605263494168547/3773647222693867584)*m^23+(-327879081116084111/483026844504815050752)*m^24+(-114992273429904443/161008948168271683584)*m^25+(-107537656291989775/80504474084135841792)*m^26),\n((-53232828365627513/1511877893707479)*m^0+(181987447096172336/4535633681122437)*m^1+(41033048793066529/1007918595804986)*m^2+(231120457699060685/4535633681122437)*m^3+(198326220212312993/9071267362244874)*m^4+(-42656533588748087/12095023149659832)*m^5+(-677720115791741243/9071267362244874)*m^6+(-3257603393596993223/18142534724489748)*m^7+(-4962640093128002551/18142534724489748)*m^8+(-23457047017708926589/145140277795917984)*m^9+(-1094791131260326983/32253395065759552)*m^10+(-809993237608109/36285069448979496)*m^11+(-205790678430393173/290280555591835968)*m^12+(62507865323652685/145140277795917984)*m^13+(-95329012011961465/1161122222367343872)*m^14+(1430434930748145523/1161122222367343872)*m^15+(980928533392252837/580561111183671936)*m^16+(5250129675922509245/2322244444734687744)*m^17+(-2158123276913464279/4644488889469375488)*m^18+(-933711270069073/4644488889469375488)*m^19+(-194567669111639/4644488889469375488)*m^20+(-1254357726755977/4644488889469375488)*m^21+(2082190230786949/18577955557877501952)*m^22+(-16560337272313/1548162963156458496)*m^23+(8473651826753677/18577955557877501952)*m^24+(2931055941957775/4128434568417222656)*m^25+(35960471870119253/37155911115755003904)*m^26),\n((865242448497786271/58963237854591681)*m^0+(-145129671207846437/58963237854591681)*m^1+(-1346229400430108015/117926475709183362)*m^2+(-93577918469434805/6047511574829916)*m^3+(-210531570365782403/9071267362244874)*m^4+(-138555365042284919/6047511574829916)*m^5+(-226178423082598691/18142534724489748)*m^6+(60145922863791181/6047511574829916)*m^7+(7086109992594518365/145140277795917984)*m^8+(5589295560845673959/157235300945577816)*m^9+(10024346281382149799/1257882407564622528)*m^10+(313660615114432909/3773647222693867584)*m^11+(8818271834439082/58963237854591681)*m^12+(16012567397827267/78617650472788908)*m^13+(226634882154170519/2515764815129245056)*m^14+(159593408798243195/7547294445387735168)*m^15+(-3592904281469790191/15094588890775470336)*m^16+(-2905443122553554785/5031529630258490112)*m^17+(185265083797691387/1677176543419496704)*m^18+(9162309049685/838588271709748352)*m^19+(2020202732872837/60378355563101881344)*m^20+(3737304466838897/60378355563101881344)*m^21+(5241706225527791/60378355563101881344)*m^22+(2965086747138119/60378355563101881344)*m^23+(892651624202313/53669649389423894528)*m^24+(-2583902559796945/30189177781550940672)*m^25+(-222277889249256251/966053689009630101504)*m^26),\n((-2552773831679115085/58963237854591681)*m^0+(-59057062641531673/19654412618197227)*m^1+(-28869116931486998/6551470872732409)*m^2+(-119563049209131413/4535633681122437)*m^3+(-344621289833041327/9071267362244874)*m^4+(-238328976131135561/4031674383219944)*m^5+(-285817552368509627/3023755787414958)*m^6+(-10644622970722649731/72570138897958992)*m^7+(-16418351677185372293/72570138897958992)*m^8+(-28871094737093998189/209647067927437088)*m^9+(-36479091894276814465/1257882407564622528)*m^10+(598563292465132589/3773647222693867584)*m^11+(92418540531884597/419294135854874176)*m^12+(152025744866690225/471705902836733448)*m^13+(8114416059334715365/15094588890775470336)*m^14+(803035217493850831/943411805673466896)*m^15+(6494428646695237205/5031529630258490112)*m^16+(60448373942103711605/30189177781550940672)*m^17+(-24401698064690190473/60378355563101881344)*m^18+(2612385160817233/60378355563101881344)*m^19+(1357900452023989/20126118521033960448)*m^20+(3782138601417403/40252237042067920896)*m^21+(33013849627499569/241513422252407525376)*m^22+(54212717260209713/241513422252407525376)*m^23+(28721251947017447/80504474084135841792)*m^24+(3648767538522783/6708706173677986816)*m^25+(203360765647635931/241513422252407525376)*m^26),\n((-789255117699134837/58963237854591681)*m^0+(190170979871334299/19654412618197227)*m^1+(449769866605701043/39308825236394454)*m^2+(53445050123231048/4535633681122437)*m^3+(85772888999975767/4535633681122437)*m^4+(59781355702523807/9071267362244874)*m^5+(156176280976619617/36285069448979496)*m^6+(-2334570270752003081/72570138897958992)*m^7+(-4336874156124545905/72570138897958992)*m^8+(-62437140021404954945/1886823611346933792)*m^9+(-12285071476627578077/1886823611346933792)*m^10+(13385841605419948/58963237854591681)*m^11+(-22331421488423963/78617650472788908)*m^12+(-401610382898763521/3773647222693867584)*m^13+(1912789081969727993/15094588890775470336)*m^14+(-551034799823445329/3773647222693867584)*m^15+(2421824899251351605/3773647222693867584)*m^16+(11153493030424751939/30189177781550940672)*m^17+(-1723877019750962449/20126118521033960448)*m^18+(-3571395905260271/30189177781550940672)*m^19+(158369179873369/2515764815129245056)*m^20+(-952553733797197/10063059260516980224)*m^21+(-13603767544895933/241513422252407525376)*m^22+(2973031535880635/80504474084135841792)*m^23+(-1440852289007401/30189177781550940672)*m^24+(2317058094041341/10063059260516980224)*m^25+(172478553476379103/966053689009630101504)*m^26),\n((-372925433517678013/58963237854591681)*m^0+(-242895601061109998/58963237854591681)*m^1+(35575216996085264/19654412618197227)*m^2+(43636276983083035/6047511574829916)*m^3+(96866880723155923/9071267362244874)*m^4+(424459336874083297/36285069448979496)*m^5+(40524167111476429/3023755787414958)*m^6+(347652769512730973/24190046299319664)*m^7+(485596063391641043/145140277795917984)*m^8+(-27915919430058887/13102941745464818)*m^9+(-138773216343784637/157235300945577816)*m^10+(-7241415665038355/157235300945577816)*m^11+(-22509339320839907/314470601891155632)*m^12+(-613931743378949249/7547294445387735168)*m^13+(-146772895366483885/1886823611346933792)*m^14+(-1542856657604119469/15094588890775470336)*m^15+(-1385012718172874831/15094588890775470336)*m^16+(2685934077091895485/30189177781550940672)*m^17+(-92506315516505903/7547294445387735168)*m^18+(32636762157253/7547294445387735168)*m^19+(-960306937121047/60378355563101881344)*m^20+(-3566832176452589/120756711126203762688)*m^21+(-2154474340996727/60378355563101881344)*m^22+(-8537131990870207/241513422252407525376)*m^23+(-7141108272644669/161008948168271683584)*m^24+(-10161671645062961/241513422252407525376)*m^25+(2058762028098673/80504474084135841792)*m^26),\n((-13810873009495499521/58963237854591681)*m^0+(1826147520967407913/19654412618197227)*m^1+(24978613104610251709/117926475709183362)*m^2+(1539877951811619101/6047511574829916)*m^3+(1653205020738964252/4535633681122437)*m^4+(11964940265849358193/36285069448979496)*m^5+(1358878869162938465/36285069448979496)*m^6+(-4751716847795168887/9071267362244874)*m^7+(-181906279481630677499/145140277795917984)*m^8+(-1550881927291272689987/1886823611346933792)*m^9+(-2331989025804344905/13102941745464818)*m^10+(-2655121677158139679/1886823611346933792)*m^11+(-18682741341720128839/7547294445387735168)*m^12+(-1329263681524462163/471705902836733448)*m^13+(-21093292855263919661/15094588890775470336)*m^14+(32704749475835083757/15094588890775470336)*m^15+(24070295606962364731/3354353086838993408)*m^16+(376116500404012573243/30189177781550940672)*m^17+(-148769586569765030021/60378355563101881344)*m^18+(-13528092311589347/60378355563101881344)*m^19+(-68110839868855793/120756711126203762688)*m^20+(-41129709823672811/40252237042067920896)*m^21+(-297264509839069687/241513422252407525376)*m^22+(-59549192738736265/80504474084135841792)*m^23+(162766437124863983/241513422252407525376)*m^24+(673800987388963013/241513422252407525376)*m^25+(4958862248160987523/966053689009630101504)*m^26),\n((-11975860028151239/1511877893707479)*m^0+(1173529267244941/4535633681122437)*m^1+(8086812920644193/9071267362244874)*m^2+(-47205508624290953/9071267362244874)*m^3+(-194293889694638233/18142534724489748)*m^4+(-207426781981564453/12095023149659832)*m^5+(-1016215179369079471/36285069448979496)*m^6+(-963138509253313807/24190046299319664)*m^7+(-672993978408554825/12095023149659832)*m^8+(-5051867428185556453/145140277795917984)*m^9+(-2214896394501310471/290280555591835968)*m^10+(-13045857780906227/145140277795917984)*m^11+(12458835669144395/145140277795917984)*m^12+(12466096984794253/96760185197278656)*m^13+(8602263618651141/129013580263038208)*m^14+(213134003293073393/580561111183671936)*m^15+(245777434869163261/1161122222367343872)*m^16+(1263964172866274963/2322244444734687744)*m^17+(-492953522265144823/4644488889469375488)*m^18+(17606594058719/2322244444734687744)*m^19+(-24130639083707/774081481578229248)*m^20+(252297095215349/9288977778938750976)*m^21+(981015714407329/18577955557877501952)*m^22+(643786107343813/18577955557877501952)*m^23+(2648584412822201/18577955557877501952)*m^24+(161584693756195/1548162963156458496)*m^25+(8216884450821299/37155911115755003904)*m^26),\n((-77257518745778330/58963237854591681)*m^0+(-6544154905243835/19654412618197227)*m^1+(387889855054459847/117926475709183362)*m^2+(9299477747692325/9071267362244874)*m^3+(-19613710287445709/9071267362244874)*m^4+(-58410580420095781/18142534724489748)*m^5+(-7977458692254685/18142534724489748)*m^6+(156151441171687105/36285069448979496)*m^7+(81664055383492591/18142534724489748)*m^8+(1533855438059497259/471705902836733448)*m^9+(20986917922298322925/3773647222693867584)*m^10+(11736783435988500971/3773647222693867584)*m^11+(-437649109618130461/1257882407564622528)*m^12+(-1740533978448003463/3773647222693867584)*m^13+(1037960898233805617/7547294445387735168)*m^14+(70235369263305477/1677176543419496704)*m^15+(-151006924132514897/1886823611346933792)*m^16+(-7581399054510181/419294135854874176)*m^17+(-474136756426594075/30189177781550940672)*m^18+(-925087036344628819/15094588890775470336)*m^19+(1347143515828296541/60378355563101881344)*m^20+(955426035635875331/120756711126203762688)*m^21+(-46553276412415183/10063059260516980224)*m^22+(-98828811128697031/120756711126203762688)*m^23+(209046939628564885/241513422252407525376)*m^24+(3725102770420813/161008948168271683584)*m^25+(-17151219738808015/107339298778847789056)*m^26),\n((6475313345988671/58963237854591681)*m^0+(32848888254414145/19654412618197227)*m^1+(-147054670740504086/58963237854591681)*m^2+(12337684526860573/6047511574829916)*m^3+(-588456504370921/9071267362244874)*m^4+(-109104511927873943/36285069448979496)*m^5+(-86947837226064089/36285069448979496)*m^6+(-126719448068141/12095023149659832)*m^7+(-459897423027512827/145140277795917984)*m^8+(-3030533154118746019/943411805673466896)*m^9+(-3422419812436914853/3773647222693867584)*m^10+(138844033859126389/1257882407564622528)*m^11+(-79109316173006645/628941203782311264)*m^12+(335884660173290023/3773647222693867584)*m^13+(-4416073566098075/2515764815129245056)*m^14+(231313805155390775/15094588890775470336)*m^15+(-327049806332071915/15094588890775470336)*m^16+(231786236954673655/3354353086838993408)*m^17+(-44306975758824187/3773647222693867584)*m^18+(-634497639856663/30189177781550940672)*m^19+(2251139664136393/60378355563101881344)*m^20+(-4869393749880535/120756711126203762688)*m^21+(24487709599973/943411805673466896)*m^22+(973145288137961/241513422252407525376)*m^23+(3091763906977505/483026844504815050752)*m^24+(-370933906788999/53669649389423894528)*m^25+(7879023802293037/322017896336543367168)*m^26),\n((-125683168096159/4535633681122437)*m^0+(-807216771104253/503959297902493)*m^1+(20194935305174980/4535633681122437)*m^2+(-31738524724379239/6047511574829916)*m^3+(20843119172726212/4535633681122437)*m^4+(-80808441045930311/18142534724489748)*m^5+(82214358150745985/18142534724489748)*m^6+(-316854404985410279/72570138897958992)*m^7+(-5832714688425707/16126697532879776)*m^8+(82637351930294741/16126697532879776)*m^9+(521456118366261869/290280555591835968)*m^10+(-3243029877329897/96760185197278656)*m^11+(8358622473001621/48380092598639328)*m^12+(-67552872204618305/290280555591835968)*m^13+(295452990825846503/1161122222367343872)*m^14+(-154180433648540671/580561111183671936)*m^15+(38990316413458891/145140277795917984)*m^16+(-13785990310824727/72570138897958992)*m^17+(126769517805014423/4644488889469375488)*m^18+(-2363948139988613/4644488889469375488)*m^19+(-66437999826377/4644488889469375488)*m^20+(1290529961418161/9288977778938750976)*m^21+(-1583786559051709/18577955557877501952)*m^22+(160085956859765/2322244444734687744)*m^23+(-3022033015390061/37155911115755003904)*m^24+(1608619387611061/18577955557877501952)*m^25+(-695680380220465/12385303705251667968)*m^26)];\n}\n" }, { "path": "anc/code/1.1.4/eta.gp", "size_bytes": 2286, "sha256": "b68c61fb7e519950301d56c246aafc33b67844ccda6bca74b3320f71fc2de4ab", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "eta1 = 1004441036273119/120756711126203762688*m^26 + 821058302292751/120756711126203762688*m^25 + 1128494062201015/120756711126203762688*m^24 + 613087052943043/120756711126203762688*m^23 + 1477151744934349/120756711126203762688*m^22 + 13951514882/58963237854591681*m^21 - 7796434787/19654412618197227*m^20 + 8713662409/13102941745464818*m^19 - 5023607568445067/1257882407564622528*m^18 + 24021408564875633/1257882407564622528*m^17 + 17343220669090565/1257882407564622528*m^16 + 28539006259083179/1257882407564622528*m^15 + 305300031414751/39308825236394454*m^14 + 82471913743910851/2515764815129245056*m^13 + 48774496027472/58963237854591681*m^12 - 27256336015352/19654412618197227*m^11 - 14944763688969329/52411766981859272*m^10 - 222377617431156955/157235300945577816*m^9 - 10609514015086785/4031674383219944*m^8 - 10538938806815217/4031674383219944*m^7 - 10657256067741081/4031674383219944*m^6 - 10458900659718309/4031674383219944*m^5 - 37696699933300439/18142534724489748*m^4 - 12370793763328/4535633681122437*m^3 + 8305138824850424/58963237854591681*m^2 + 6116472286696952/58963237854591681*m - 14320877505188848/58963237854591681;\neta2 = -947295631316447/113383582397074114560*m^26 - 763912897336079/113383582397074114560*m^25 - 1071348657244343/113383582397074114560*m^24 - 555941647986371/113383582397074114560*m^23 - 1420006339977677/113383582397074114560*m^22 + 13951514882/55363077342321345*m^21 - 7796434787/18454359114107115*m^20 + 8713662409/12302906076071410*m^19 - 4737880543661707/1181078983302855360*m^18 + 22707064250872177/1181078983302855360*m^17 + 16028876355087109/1181078983302855360*m^16 + 27224661945079723/1181078983302855360*m^15 + 264226771602143/36908718228214230*m^14 + 79843225115903939/2362157966605710720*m^13 - 48774496027472/55363077342321345*m^12 + 27256336015352/18454359114107115*m^11 + 14087582614619249/49211624304285640*m^10 + 209291319696079067/147634872912856920*m^9 + 129523307667497421/49211624304285640*m^8 + 128605829959967037/49211624304285640*m^7 + 130143954352003269/49211624304285640*m^6 + 127565334047707233/49211624304285640*m^5 + 460879327660910827/221452309369285380*m^4 - 160820318923264/55363077342321345*m^3 + 7847975585197048/55363077342321345*m^2 + 5659309047043576/55363077342321345*m - 13406551025882096/55363077342321345;\n" }, { "path": "anc/code/1.1.4/polys.gp", "size_bytes": 176, "sha256": "0cb8cd2981e972e0e38f058c3c1e065ce9f2b881b1e0e9793046268b66e8b4c0", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "f1 = m^27-480*m^19+2688*m^18-34560*m^11-141312*m^10-162816*m^9+16384*m^3-49152*m+32768;\ng2 = m^27+480*m^19-2688*m^18-34560*m^11-141312*m^10-162816*m^9-16384*m^3+49152*m-32768;\n" }, { "path": "anc/code/1.1.4/selmer_lib.gp", "size_bytes": 2708, "sha256": "5adf69268504bc7a8eec672d2f9f89ad74c08ac11dff35b32dfe8d047c031daf", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent fake-2-Selmer computation helpers (marked-bitangent descent). Works with famat (compact) elements.\nf2rank(M) = matrank(Mod(M,2));\ntofam(x) = if(type(x)==\"t_MAT\", x, Mat([x, 1]));\nks2basis(bnf, S) = bnfunits(bnf, S)[1];\ndyadic_setup(K, P) = {\n my(e = P[3], bid = idealstar(K, idealpow(K, P, 2*e+1), 1), pi = nfbasistoalg(K, P[2]));\n if(nfeltval(K, pi, P) != 1, error(\"pr gen not uniformizer\"));\n [P, bid, pi];\n}\ndyadic_vec(K, D, xi) = {\n my(P = D[1], bid = D[2], pi = D[3], fx = tofam(xi), v = nfeltval(K, fx, P), u, lg, cyc = bid.cyc, out = [v % 2]);\n u = matconcat([fx; Mat([pi, -v])]);\n lg = ideallog(K, u, bid);\n for(i=1, #cyc, if(cyc[i] % 2 == 0, out = concat(out, lg[i] % 2)));\n out;\n}\ndyadic_all(K, DD, xi) = { my(out = []); for(k=1, #DD, out = concat(out, dyadic_vec(K, DD[k], xi))); out; }\n\\\\ sign and 2-adic valuation parity of the norm of famat\nnormdata(K, xi) = { my(fx = tofam(xi), sg = 0, v2 = 0); for(j=1, matsize(fx)[1], my(N = norm(nfbasistoalg(K, fx[j,1])), e = fx[j,2] % 2); if(e, if(N < 0, sg++); v2 += valuation(N, 2))); [sg % 2, v2 % 2]; }\n\\\\ good prime setup: list of [pr, modpr, generator image of m]\ngoodprime_setup(K, p) = {\n my(PL = idealprimedec(K, p));\n vector(#PL, i, my(mp = nfmodprinit(K, PL[i]), g = nfmodpr(K, Mod(m, K.pol), mp)); [PL[i], mp, g]);\n}\nffconv(b, a) = { my(g = ffgen(a)); if(type(b)==\"t_FFELT\", b, if(type(b)==\"t_POL\", subst(b, variable(b), g), b*g^0)); }\ngp_char(K, xi, GS) = vector(#GS, i, my(a = GS[i][3], z = ffconv(nfmodpr(K, tofam(xi), GS[i][2]), a)); if(z==0, error(\"not unit\")); if(issquare(z), 0, 1));\n\\\\ local image at good prime p, from all affine points of the curve (O has trivial image)\ngoodimage(K, ETA, CURVE, EVF, p) = {\n my(GS = goodprime_setup(K, p), r = #GS, img = List(), nzero = [0,0,0], Fp = Mod(1,p)*CURVE, etag, gens);\n gens = vector(r, i, GS[i][3]);\n etag = vector(r, i, nfmodpr(K, Mod(ETA, K.pol), GS[i][2]));\n for(x0 = 0, p-1, my(rt = polrootsmod(subst(Fp, X, x0), p));\n for(j=1, #rt, my(y0 = rt[j], vals = vector(r, i, EVF(x0*gens[i]^0, y0*gens[i]^0, gens[i], etag[i])), z = 0, vec = vector(r));\n for(i=1,r, if(vals[i]==0, z++, vec[i] = if(issquare(vals[i]),0,1)));\n if(z == 1, my(iz = 0); for(i=1,r, if(vals[i]==0, iz=i)); vec[iz] = sum(i=1,r,vec[i]) % 2);\n if(z >= 2,\n my(cub = lift(subst(Fp, X, x0)) \\ (Y - lift(y0)));\n if(polcoef(cub,3,Y)!=1, error(\"cubic not monic\"));\n vec = vector(r, i, my(nv = polresultant(cub*gens[i]^0, EVF(x0*gens[i]^0, Y, gens[i], etag[i]), Y));\n if(nv==0, error(\"line trick fails\")); if(issquare(nv),0,1)));\n nzero[min(z,2)+1]++;\n listput(img, vec)));\n [GS, Mod(matrix(#img, r, a, b, img[a][b]), 2), nzero];\n}\n" }, { "path": "anc/code/1.1.5/1.1.5a_basic.gp", "size_bytes": 1218, "sha256": "7fc4d0b68a558a76f5b649b6141fe07d2519ea2faf46b05a34ad681a1430753c", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Basic checks for 4230 and 4227\ndefault(parisize, 200000000);\n\\\\ transport checks\nFt1 = x^4+y^3+2*x-y; M1 = v^4-u^3+u+2*v;\nprint(\"4230 transport: \", subst(subst(Ft1,x,v),y,-u) - M1);\nFt2 = x^4+y^3+2*x+y; M2 = v^4+u^3+u+2*v;\nprint(\"4227 transport: \", subst(subst(Ft2,x,v),y,u) - M2);\n\\\\ claimed sets\nS1 = [[-8,-16],[0,-1],[0,0],[0,1]]; for(i=1,#S1, print1(subst(subst(Ft1,x,S1[i][1]),y,S1[i][2]),\" \")); print();\nS2 = [[0,0],[8,-16]]; for(i=1,#S2, print1(subst(subst(Ft2,x,S2[i][1]),y,S2[i][2]),\" \")); print();\n\\\\ source curve 4230: C1: Y^4 - X^3 + X + 2Y = 0 (X=u, Y=v)\nC1 = Y^4 - X^3 + X + 2*Y;\nsrc1 = [[-1,0],[0,0],[1,0],[16,-8]]; for(i=1,#src1, print1(subst(subst(C1,X,src1[i][1]),Y,src1[i][2]),\" \")); print();\n\\\\ map src->target (x,y)=(v,-u)=(Y,-X)\nprint(vecsort(vector(4,i,[src1[i][2],-src1[i][1]])));\nC2 = X^3 + X + Y^4 + 2*Y;\nsrc2 = [[0,0],[-16,8]]; for(i=1,#src2, print1(subst(subst(C2,X,src2[i][1]),Y,src2[i][2]),\" \")); print();\nprint(vecsort(vector(2,i,[src2[i][2],src2[i][1]])));\n\\\\ bad primes: affine singular points\nN1 = polresultant(3*X^2-1, polresultant(2*Y^3+1, C1, Y), X); print(\"N1=\",N1,\" \",factor(N1));\nN2 = polresultant(3*X^2+1, polresultant(2*Y^3+1, C2, Y), X); print(\"N2=\",N2,\" \",factor(N2));\n" }, { "path": "anc/code/1.1.5/1.1.5a_bitangent.gp", "size_bytes": 1359, "sha256": "94114b331812620c901ea08605f469ac4bc81b8a5098ebc8afb66466c00e210c", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 400000000);\n\\\\ 4230 source: Y^4 - X^3 + X + 2Y, line X = m*Y + n\nC1 = Y^4 - X^3 + X + 2*Y;\nq1 = subst(C1, X, m*Y+n); q1 = Pol(q1, Y);\nB=polcoef(q1,3,Y); Cc=polcoef(q1,2,Y); D=polcoef(q1,1,Y); E=polcoef(q1,0,Y);\nprint([polcoef(q1,4,Y), B, Cc, D, E]);\ne1 = 8*D-4*B*Cc+B^3; e2 = 64*E-(4*Cc-B^2)^2;\nR1 = polresultant(e1, e2, n);\nfa = factor(R1); print(fa[,2]~, \" degs \", vector(#fa~,i,poldegree(fa[i,1])));\nf1 = m^27-480*m^19+2688*m^18-34560*m^11-141312*m^10-162816*m^9+16384*m^3-49152*m+32768;\nfor(i=1,#fa~, if(poldegree(fa[i,1])==27, print(\"4230 deg27 factor matches f: \", fa[i,1]==f1 || fa[i,1]==-f1, \" \", fa[i,1])));\nprint(fa);\n\\\\ 4227 source: X^3 + X + Y^4 + 2Y, line X = m*Y + n (u = m z + b)\nC2 = X^3 + X + Y^4 + 2*Y;\nq2 = subst(C2, X, m*Y+n); q2 = Pol(q2, Y);\nB=polcoef(q2,3,Y); Cc=polcoef(q2,2,Y); D=polcoef(q2,1,Y); E=polcoef(q2,0,Y);\nprint([polcoef(q2,4,Y), B, Cc, D, E]);\ne1b = 8*D-4*B*Cc+B^3; e2b = 64*E-(4*Cc-B^2)^2;\nR2 = polresultant(e1b, e2b, n);\nfb = factor(R2); print(fb);\ng2 = m^27+480*m^19-2688*m^18-34560*m^11-141312*m^10-162816*m^9-16384*m^3+49152*m-32768;\nfor(i=1,#fb~, if(poldegree(fb[i,1])==27, print(\"4227 deg27 factor matches g: \", fb[i,1]==g2 || fb[i,1]==-g2)));\nprint(\"irreducible f1: \", polisirreducible(f1), \" g2: \", polisirreducible(g2));\nprint(\"polsturm f1 real roots: \", polsturm(f1), \" g2: \", polsturm(g2));\n" }, { "path": "anc/code/1.1.5/1.1.5a_code_weights.py", "size_bytes": 541, "sha256": "9f27a96fc5d1e5683a61ae452cfc8eec06009acf387847aea6b5c92de6201092", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import itertools\ndef q(v): return (v[0]*v[1]+v[2]*v[3]+v[4]*v[5]+v[4]+v[5])%2\ndef B(v,w): return (q([(a+b)%2 for a,b in zip(v,w)])-q(v)-q(w))%2\nV=list(itertools.product([0,1],repeat=6))\niso=[w for w in V if any(w) and q(w)==0]\nprint(\"nonzero isotropic:\",len(iso))\nwts=set()\nimg=set()\nfor v in V:\n word=tuple(B(v,w) for w in iso)\n img.add(word)\n if any(v): wts.add(sum(word))\nprint(\"weights:\",sorted(wts),\"injective:\",len(img)==64)\n# sum of isotropic vectors\nprint(\"sum of iso vectors:\",[sum(w[i] for w in iso)%2 for i in range(6)])\n" }, { "path": "anc/code/1.1.5/1.1.5a_field.gp", "size_bytes": 1349, "sha256": "452ffe2e7d91fc5047ad7f252fb643add6d0a47b5e7e74e72a069096955d68e2", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 800000000);\n\\r polys.gp\nprint(isprime(11719983672151), \" \", isprime(93374840354982927532779252030629), \" \", isprime(14365291), \" \", isprime(172681));\nfa1 = [2,3,13,43,83,172681,11719983672151];\nfa2 = [2,3,5,139,281,93374840354982927532779252030629];\nK1 = nfinit([f1, fa1]); print(\"K1 sig \", K1.sign, \" disc \", factor(K1.disc), \" \", K1.disc);\nprint(\" claimed \", 2^28*83^6*172681^6, \" eq \", abs(K1.disc)==2^28*83^6*172681^6, \" eq2 \", abs(K1.disc)==2326889515985953907282417842991419362237373569040384);\nprint(\" index \", K1.index);\nprint(\" certify K1: \", nfcertify(K1));\nK2 = nfinit([g2, fa2]); print(\"K2 sig \", K2.sign, \" disc \", factor(K2.disc));\nprint(\" claimed eq \", abs(K2.disc)==2^28*14365291^6, \" index \", K2.index);\nprint(\" certify K2: \", nfcertify(K2));\nP1 = idealprimedec(K1,2); print(\"K1 primes over 2 (e,f): \", vector(#P1,i,[P1[i].e,P1[i].f]));\nP2 = idealprimedec(K2,2); print(\"K2 primes over 2 (e,f): \", vector(#P2,i,[P2[i].e,P2[i].f]));\n\\\\ other ramification\nprint(\"K1 ram 83: \", vector(#idealprimedec(K1,83),i,[idealprimedec(K1,83)[i].e,idealprimedec(K1,83)[i].f]));\nprint(\"K1 ram 172681: \", vector(#idealprimedec(K1,172681),i,[idealprimedec(K1,172681)[i].e,idealprimedec(K1,172681)[i].f]));\nprint(\"K2 ram q: \", vector(#idealprimedec(K2,14365291),i,[idealprimedec(K2,14365291)[i].e,idealprimedec(K2,14365291)[i].f]));\n\n" }, { "path": "anc/code/1.1.5/1.1.5a_nodes.gp", "size_bytes": 1629, "sha256": "d960828d79ae2d26377ae6c4621c11051bdf5da58f0dae8781a964153b53b84d", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 4230 source: F = y^4 - x^3 + x + 2y ; lift (2187/128, -243/32)\nF = y^4 - x^3 + x + 2*y; xc = 2187/128; yc = -243/32;\nev(G) = subst(subst(G, x, xc), y, yc);\nprint(\"4230: F(xc,yc) = \", ev(F), \" = \", factor(ev(F)));\nprint(\" 4x+9y: \", 4*xc + 9*yc);\nforeach([83,172681], p, print(\" p=\",p,\": v(F)=\",valuation(ev(F),p),\" v(Fx)=\",valuation(ev(deriv(F,x)),p),\" v(Fy)=\",valuation(ev(deriv(F,y)),p), \" v(Hess)=\", valuation(ev(deriv(deriv(F,x),x)*deriv(deriv(F,y),y) - deriv(deriv(F,x),y)^2), p)));\n\\\\ uniqueness of singular point mod p: solve Fx=Fy=F=0 over Fp\nforeach([83,172681], p, my(cnt=0, rx = polrootsmod(Mod(1,p)*(1-3*x^2), p), ry = polrootsmod(Mod(1,p)*(4*y^3+2), p)); for(i=1,#rx, for(j=1,#ry, if(subst(subst(F,x,lift(rx[i])),y,lift(ry[j])) % p == 0, cnt++))); print(\" F_p-rational affine sing pts at \", p, \": \", cnt));\n\\\\ geometric: over algebraic closure, the system 3x^2=1, 2y^3=-1, F=0 -> elimination gave unique (x,y) when p | Res; check via gcd in Fp[y]\nforeach([83,172681], p, my(g = gcd(Mod(1,p)*(243*y^2-16), Mod(1,p)*(2*y^3+1))); print(\" gcd degree in y at \", p, \": \", poldegree(g)));\n\\\\ 4227: F = u^3+u+z^4+2z, lift (-2187/128, 243/32)\nG = x^3 + x + y^4 + 2*y; xc = -2187/128; yc = 243/32;\nq = 14365291;\nprint(\"4227: G(c) = \", factor(ev(G)), \" v_q(G)=\", valuation(ev(G),q), \" v(Gu)=\", valuation(ev(deriv(G,x)),q), \" v(Gz)=\", valuation(ev(deriv(G,y)),q), \" v(Hess)=\", valuation(ev(deriv(deriv(G,x),x)*deriv(deriv(G,y),y)-deriv(deriv(G,x),y)^2), q));\nprint(\" identity 12F-4uFu-3zFz = \", 12*G - 4*x*deriv(G,x) - 3*y*deriv(G,y));\nprint(\" gcd degree: \", poldegree(gcd(Mod(1,q)*(243*y^2+16), Mod(1,q)*(2*y^3+1))));\n" }, { "path": "anc/code/1.1.5/1.1.5a_quadpts.py", "size_bytes": 2216, "sha256": "81c791d53fdb7ba3ef5171a5f6387e8bcb62e538f650e69a5dd3aa595a1bdce7", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Hensel-lift points of u^3+u+z^4+2z=0 over quadratic 2-adic rings Z_2[s].\n# typ d: s^2 = d (d in {2,-2,6,-6,-1,10,...}); typ 3 means s^2 + s + 1 = 0.\nimport sys\nN = 60; MOD = 2**N\ndef mul(a, b, typ):\n a0,a1 = a; b0,b1 = b\n if typ == 3: # s^2 = -s - 1\n c0 = a0*b0 - a1*b1; c1 = a0*b1 + a1*b0 - a1*b1\n else:\n c0 = a0*b0 + typ*a1*b1; c1 = a0*b1 + a1*b0\n return (c0 % MOD, c1 % MOD)\ndef add(a,b): return ((a[0]+b[0])%MOD, (a[1]+b[1])%MOD)\ndef sc(k,a): return ((k*a[0])%MOD, (k*a[1])%MOD)\ndef norm(a, typ):\n a0,a1=a\n return (a0*a0 - a0*a1 + a1*a1) if typ==3 else (a0*a0 - typ*a1*a1)\ndef inv(a, typ):\n n = norm(a,typ) % MOD\n assert n % 2 == 1, \"non-unit derivative\"\n ni = pow(n, -1, MOD)\n a0,a1 = a\n conj = ((a0 - a1) % MOD, (-a1) % MOD) if typ == 3 else (a0, (-a1) % MOD)\n return sc(ni, conj)\ndef F(u, z, typ):\n u3 = mul(mul(u,u,typ),u,typ); z2 = mul(z,z,typ); z4 = mul(z2,z2,typ)\n return add(add(add(u3,u), z4), sc(2,z))\ndef dF(u, typ): return add(sc(3, mul(u,u,typ)), (1,0))\ndef lift(u, z, typ):\n for _ in range(80):\n u = add(u, sc(-1, mul(F(u,z,typ), inv(dF(u,typ),typ), typ)))\n r = F(u,z,typ)\n assert r == (0,0), r\n return u\nout = []\ncases = [(2,(0,1),(0,0)), (3,(0,1),(1,1)), (-1,(0,1),(0,0)), (-2,(0,1),(0,0)), (6,(0,1),(0,0)), (-6,(0,1),(0,0)), (2,(0,2),(0,0)), (-1,(2,1),(0,0)),(10,(0,1),(0,0)),(-10,(0,1),(0,0)),(3,(1,1),(0,0)),(3,(0,2),(0,0)),(-5,(0,1),(1,0)),(5,(1,1),(0,0)),(-3,(1,1),(0,0)),(3,(1,0),(0,1))]\nfor typ, z, u0 in cases:\n try:\n u = lift(u0, z, typ)\n out.append((typ, u[0], u[1], z[0], z[1], N))\n print(\"ok\", typ, z, u0, \"->\", u, file=sys.stderr)\n except AssertionError as e:\n print(\"fail\", typ, z, u0, e, file=sys.stderr)\nimport os\nos.makedirs(\"work\", exist_ok=True)\nwith open(os.path.join(\"work\", \"quadpts4227.gp\"),\"w\") as fh:\n for o in out:\n fh.write(\"[%d, %d, %d, %d, %d, %d]\\n\" % o)\n# compare with TeX values\nprint(\"TeX sqrt2 point u = 25997429148+66996318958*s mod 2^36; ours:\", [x % 2**36 for x in lift((0,0),(0,1),2)], file=sys.stderr)\nprint(\"TeX theta point u = 37685859149+46300394677*th mod 2^36; ours:\", [x % 2**36 for x in lift((1,1),(0,1),3)], file=sys.stderr)\n" }, { "path": "anc/code/1.1.5/1.1.5a_selmer.gp", "size_bytes": 3512, "sha256": "0569658250785b33b4ec0280352b161d8fe5b239ad679c2d064a266159f93911", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 1500000000);\nX;Y;W;\n\\r polys.gp\n\\r eta.gp\n\\r selmer_lib.gp\nFF = g2; ETA = eta2;\nK = nfinit([FF, [2,3,5,139,281,93374840354982927532779252030629]]);\nread(\"data/4227_S_unit_representatives.gp\"); \\\\ the 18 supplied representatives (no bnfinit)\nS = idealprimedec(K, 2); print(\"dyadic (e,f): \", vector(#S,k,[S[k][3],S[k][4]]));\nB = apply(b -> Mod(b, FF), B4227); nB = #B; print(\"K(S,2) basis size: \", nB);\nokS = 1; for(i=1,nB, my(F = idealfactor(K, B[i])); for(j=1,#F~, if(F[j,1].p != 2, okS = 0)));\nprint(\"basis elements supported on the primes above 2: \", okS);\nDD = vector(#S, k, dyadic_setup(K, S[k]));\ndimloc = #dyadic_all(K, DD, 3); print(\"dim of prod K_P^*/squares: \", dimloc);\nL2 = matrix(dimloc, nB); for(i=1,nB, my(vv = dyadic_all(K, DD, B[i])); for(r=1,dimloc, L2[r,i] = vv[r]));\nprint(\"independence rank of basis via dyadic classes: \", f2rank(L2));\nnd = vector(nB, i, normdata(K, B[i]));\nnormrows = matrix(2, nB, r, c, nd[c][r]);\n\\\\ normalized evaluation h = -(u - m z - b)\nEV(u0, z0) = -(Mod(u0 - m*z0, FF) - Mod(ETA, FF));\nPR = 80;\nlocpts = List();\nlistput(locpts, [\"(0,0)\", EV(0,0)]); listput(locpts, [\"(-16,8)\", EV(-16,8)]);\nfor(zz=1,6, my(z0 = 2*zz, rts = polrootspadic(X^3 + X + z0^4 + 2*z0, 2, PR)); for(i=1,#rts, if(valuation(rts[i],2)>=1, listput(locpts, [Str(\"(u,\",z0,\")\"), EV(truncate(rts[i]), z0)]))));\nfor(tt=1,6, my(t0 = 2*tt, rw = polrootspadic(W + t0^4 + (1+2*t0)*W^3, 2, PR)); for(i=1,#rw, if(valuation(rw[i],2)>=1, my(w0 = truncate(rw[i])); listput(locpts, [Str(\"inf t=\",t0), Mod((1 + (1+2*t0)*w0^2)*(1 - m*t0 - ETA*w0), FF)]))));\n\\\\ quadratic trace divisors read from file (computed in python): [d-type, c0 parts]\nlocrows = matrix(0, dimloc);\n{\nfor(j=1,#locpts, my(xi = locpts[j][2], vv, vals = vector(#S,k,nfeltval(K, xi, S[k])));\n for(k=1,#S, if(vals[k] + 2*S[k][3] >= PR*S[k][3] - 2, print(\"PRECISION WARNING \", locpts[j][1])));\n vv = dyadic_all(K, DD, xi); locrows = matconcat([locrows; Mat(vv)]);\n print(locpts[j][1], \" vals \", vals, \" cumulative rank \", f2rank(locrows)));\n}\n\\\\ quadratic divisors\nQD = readvec(\"work/quadpts4227.gp\");\n{\nfor(j=1,#QD, my(typ = QD[j][1], u0 = QD[j][2], u1 = QD[j][3], z0 = QD[j][4], z1 = QD[j][5], N = QD[j][6], c0, c1, xi, vals, vv);\n c0 = Mod(u0 - m*z0, FF) - Mod(ETA,FF); c1 = Mod(u1 - m*z1, FF);\n xi = if(typ==2, c0^2 - 2*c1^2, if(typ==3, c0^2 - c0*c1 + c1^2, c0^2 - typ*c1^2));\n vals = vector(#S,k,nfeltval(K, xi, S[k]));\n for(k=1,#S, if(vals[k] + 2*S[k][3] >= N*S[k][3] - 2, print(\"PRECISION WARNING quad \", j)));\n vv = dyadic_all(K, DD, xi); locrows = matconcat([locrows; Mat(vv)]);\n print(\"quad \", QD[j], \" vals \", vals, \" cumulative rank \", f2rank(locrows)));\n}\nIm2 = Mod(locrows, 2); print(\"dyadic image rank: \", matrank(Im2));\ncond2 = lift(matker(Im2)~ * Mod(L2,2));\nCURVE = X^3 + X + Y^4 + 2*Y;\nEVF(x0, y0, g, eg) = -(x0 - g*y0 - eg);\nallc = normrows; print(\"after norm: dim \", nB - f2rank(allc));\n{\nforeach([487,491,499,503,509,521,523], p,\n my(res = goodimage(K, ETA, CURVE, EVF, p), GS = res[1], IM = res[2], lp, cnd);\n lp = matrix(#GS, nB); for(c=1,nB, my(ch = gp_char(K, B[c], GS)); for(a=1,#GS, lp[a,c] = ch[a]));\n cnd = lift(matker(IM)~ * Mod(lp,2));\n allc = matconcat([allc; cnd]);\n print(\"p=\", p, \" #primes \", #GS, \" f's \", vector(#GS,i,GS[i][1][4]), \" #aff pts \", matsize(IM)[1], \" zero-hist \", res[3], \" img rank \", matrank(IM), \" | global dim \", nB - f2rank(allc)));\n}\nallc2 = matconcat([allc; cond2]);\nsel = matker(Mod(allc2,2)); print(\"FINAL fake Selmer dim (norm+good primes+2): \", #sel);\n" }, { "path": "anc/code/1.1.5/1.1.5bcd_classgroup.sh", "size_bytes": 892, "sha256": "369fba239448a4f9783fbc110705f7085b221eef3fcfc1c0fe1a0b6e52583140", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/sh\n# 1.1.5b, 1.1.5c, 1.1.5d with the shared tools in code/common/h31_classgroup (FULL run; see README for\n# the run times and for the slices that were run here). Large files go to work/ (not in the bundle).\n# W = number of worker processes.\nset -e\ncd \"$(dirname \"$0\")\"\nCG=../common/h31_classgroup\nPRM=data/classgroup_params.json\nW=${W:-2}\nmkdir -p work\necho \"== 1.1.5b: all prime ideals of norm < 10^8\"\npython3 $CG/count_ideals.py $PRM --workers $W --out work/counts.npz\necho \"== 1.1.5c: strict norm-induction witnesses for all prime ideals of norm <= 6·10^6 (bnfinit only proposes)\"\npython3 $CG/witnesses.py $PRM --workers $W --out work/witnesses.jsonl.gz\necho \"== 1.1.5c: exact check against an independent list of the prime ideals\"\npython3 $CG/check_witnesses.py $PRM work/witnesses.jsonl.gz\necho \"== 1.1.5d: B^-(f) in 224-bit Arb balls\"\npython3 $CG/bound.py $PRM work/counts.npz\n" }, { "path": "anc/code/1.1.5/1.1.5e_hP_check.gp", "size_bytes": 2785, "sha256": "238f270d1433ad1ad69bb20d27512ca2c36975198484465261295be76b544500", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 1000000000);\ny; s; t; w;\nNS = 60; PR = 1500;\nC = x^3 + x + y^4 + 2*y;\nup = O(y^NS); for(it=1,9, up = up - (up^3 + up + y^4 + 2*y)/(3*up^2+1));\nwP = [1, y, up]/(3*up^2+1); IP = vector(3,i, truncate(intformal(wP[i], y)));\nbas = List(); for(a=0,2, for(b=0,10, if(4*a+3*b<=31, listput(bas, x^a*y^b)))); bas = Vec(bas);\nM = matrix(28, #bas, r, j, polcoef(subst(bas[j], x, up), r-1, y));\nkr = matker(M); print(\"h_P kernel dim: \", #kr);\nkv = kr[,1]; kv = kv/content(kv); hP = sum(j=1,#bas, kv[j]*bas[j]);\nprint(\"coef u*z^9: \", polcoef(polcoef(hP,1,x),9,y) != 0, \" ord at P: \", valuation(subst(hP,x,up), y));\nRP = polresultant(hP, C, x); fr = factor(RP); print(\"Res factors (deg,mult): \", vector(#fr~,i,[poldegree(fr[i,1]), fr[i,2]]));\nqP = 0; for(i=1,#fr~, if(poldegree(fr[i,1])==3, qP = fr[i,1])); print(\"qP irreducible: \", polisirreducible(qP), \" root vals: \", newtonpoly(qP,2));\ng = gcd(subst(Pol(hP,x), y, Mod(y,qP)), subst(Pol(C,x), y, Mod(y,qP))); uP = lift(-polcoef(g,0,x)/polcoef(g,1,x));\nfp = factorpadic(qP, 2, PR); lin = 0; quad = 0; for(i=1,#fp~, if(poldegree(fp[i,1])==1, lin = fp[i,1], quad = fp[i,1]));\nz1 = -polcoef(lin,0)/polcoef(lin,1); u1 = subst(uP, y, z1); print(\"rational endpoint v(z)=\", valuation(z1,2), \" v(u)=\", valuation(u1,2), \" on P-branch: \", valuation(subst(truncate(up),y,z1)-u1,2));\nTP = vector(3,i, subst(IP[i], y, z1));\nZ = Mod(y, quad); U = subst(uP, y, Z);\nprint(\"pair: v(N(z))=\", valuation(norm(Z),2), \" v(N(u))=\", valuation(norm(U),2), \" v(N(u^2+1))=\", valuation(norm(U^2+1),2));\niL = U; for(k=1,8, iL = (iL - 1/iL)/2); print(\" iL^2+1 norm val: \", valuation(norm(iL^2+1),2), \" v(N(u - iL)) = \", valuation(norm(U - iL),2));\ntL = Z/2;\n\\\\ Q+ chart series over Q(i): -v + 3 i v^2 + 2 v^3 + 4 t^4 + t = 0\nII = Mod(w, w^2+1);\nvs = O(t^NS); for(it=1,9, vs = vs - (-vs + 3*II*vs^2 + 2*vs^3 + 4*t^4 + t)/(-1 + 6*II*vs + 6*vs^2));\nprint(\"Q chart branch ok: \", valuation(-vs + 3*II*vs^2 + 2*vs^3 + 4*t^4 + t, t) >= NS);\n\\\\ pullback check: u = I + 2v, z = 2t; omega = (1,z,u) dz/(3u^2+1)\nuu = II + 2*vs; zz = 2*t; pb = [1, zz, uu]*deriv(zz,t)/(3*uu^2+1);\ncl = -[1, 2*t, II + 2*vs]/(1 - 6*II*vs - 6*vs^2); print(\"pullback identity: \", vector(3,i,valuation(pb[i]-cl[i],t)));\nokint = 1; for(i=1,3, for(k=0,NS-1, my(c = lift(polcoef(pb[i],k,t))); for(j=0,1, if(polcoef(c,j,w)!=0 && valuation(polcoef(c,j,w),2) < 0, okint=0)))); print(\"Q-chart form coefficients integral: \", okint);\nIQ = vector(3,i, intformal(pb[i]));\nevalQ(ser) = { my(acc = 0); for(k=1, NS-1, my(c = lift(polcoef(ser,k,t))); acc += (polcoef(c,0,w) + polcoef(c,1,w)*iL) * tL^k); acc; }\nTQ = vector(3,i, trace(evalQ(IQ[i])));\nTP = TP + TQ;\nLP = -TP/28;\nprint(\"L_P via h_P route mod 2^16: \", vector(3,i, lift(Mod(truncate(LP[i]),2^16))), \" (u+2z route gave [510, 3064, 32784])\");\n" }, { "path": "anc/code/1.1.5/1.1.5ef_logs.gp", "size_bytes": 3968, "sha256": "254b56efac4765e4c32fc3678faeb0dd055c866739094e67eaa601dd49732204", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 1000000000);\ny; s; t; w;\nNS = 60; PR = 200;\n\\\\ curve u^3+u+z^4+2z = 0, variables: x=u, y=z (x has higher priority)\nC = x^3 + x + y^4 + 2*y;\n\\\\ P-branch: u(z), u(0)=0\nup = O(y^NS); for(it=1,9, up = up - (up^3 + up + y^4 + 2*y)/(3*up^2+1));\nprint(\"P branch ok: \", valuation(subst(C, x, up), y) >= NS);\nwP = [1, y, up]/(3*up^2+1);\nIP = vector(3,i, truncate(intformal(wP[i], y)));\n\\\\ t-coefficients on z=2t chart, check TeX formulas\nEt = vector(3,i, subst(IP[i], y, 2*t)); for(i=1,3, print(\" omega_\",i-1,\" t-coeffs 1..4: \", vector(4,k,polcoef(Et[i],k,t))));\nok=1; for(i=1,3, for(n=5,NS-1, my(cc=polcoef(Et[i],n,t)); if(cc!=0 && valuation(cc,2) < n - valuation(n,2), ok=0))); print(\"tail bound n-v(n): \", ok);\n\\\\ L_P via div(u+2z) = 3P + R - 4O, R=(-16,8)\nprint(\"u+2z restricted: \", factor(subst(C, x, -2*y)));\nIR = vector(3,i, subst(IP[i], y, 8 + O(2^PR)));\nLP = -IR/4;\nprint(\"v2(L_P) = \", vector(3,i,valuation(LP[i],2)), \" L_P mod 2^16: \", vector(3,i, lift(Mod(truncate(LP[i]), 2^16))));\n\\\\ ---- h_D: L(31 O) basis u^a z^b, a<=2, 4a+3b<=31; vanish to order 14 at the two points of D\nbas = List(); for(a=0,2, for(b=0,10, if(4*a+3*b<=31, listput(bas, x^a*y^b)))); bas = Vec(bas); print(\"dim L(31O) basis: \", #bas);\n\\\\ local expansion at (1-zeta, zeta), zeta^2-zeta+1=0, param s=z-zeta (variable 's')\nze = Mod(w, w^2-w+1);\nus = 1 - ze + O(s^20); for(it=1,7, us = us - (us^3 + us + (ze+s)^4 + 2*(ze+s))/(3*us^2+1));\nprint(\"D branch ok: \", valuation(us^3 + us + (ze+s)^4 + 2*(ze+s), s) >= 20);\ncols = vector(#bas, j, my(ser = subst(subst(bas[j], x, us), y, ze + s)); vector(14, k, polcoef(ser, k-1, s)));\nM = matrix(28, #bas, r, j, my(c = cols[j][(r+1)\\2]); polcoef(lift(c), (r+1)%2, w));\nkr = matker(M); print(\"kernel dim: \", #kr);\nkv = kr[,1]; kv = kv/content(kv); hD = sum(j=1,#bas, kv[j]*bas[j]);\n\\\\ check pole order 31: coefficient of u*z^9 (weight 31)\nprint(\"coef of u*z^9 (weight 31): \", polcoef(polcoef(hD,1,x),9,y));\nRD = polresultant(hD, C, x); fr = factor(RD); print(\"Res factors: \", vector(#fr~,i,[poldegree(fr[i,1]), fr[i,2]]));\nqD = 0; for(i=1,#fr~, if(poldegree(fr[i,1])==3, qD = fr[i,1])); print(\"qD = \", qD, \" irreducible: \", polisirreducible(qD));\nprint(\"qD root valuations (newton): \", newtonpoly(qD, 2));\n\\\\ u as function of z on qD\ng = gcd(subst(Pol(hD,x), y, Mod(y,qD)), subst(Pol(C,x), y, Mod(y,qD))); print(\"gcd deg \", poldegree(g,x));\nuD = lift(-polcoef(g,0,x)/polcoef(g,1,x));\nrr = polrootspadic(qD, 2, PR); print(\"roots v: \", vector(#rr,i,valuation(rr[i],2)));\n\\\\ infinity chart: t = z/u, w = 1/u: w + t^4 + (1+2t) w^3 = 0\nwi = O(t^NS); for(it=1,9, wi = wi - (wi + t^4 + (1+2*t)*wi^3)/(1 + 3*(1+2*t)*wi^2));\nui = 1/wi; zi = t/wi; dz = deriv(zi, t);\nwinf = vector(3,i, [1, zi, ui][i]*dz/(3*ui^2+1));\nprint(\"inf forms: vals \", vector(3,i,valuation(winf[i],t)), \" TeX says -(w,t,1)/(1+3(1+2t)w^2) dt: diff \", vector(3,i, valuation(winf[i] + [wi,t,1][i]/(1+3*(1+2*t)*wi^2), t)));\nIinf = vector(3,i, truncate(intformal(winf[i], t)));\nTD = vector(3, i, 0);\n{\nfor(j=1,#rr, my(z0 = rr[j], u0 = subst(uD, y, z0), vz = valuation(z0,2));\n print(\" endpoint v(z)=\", vz, \" v(u)=\", valuation(u0,2), \" curve \", valuation(subst(subst(C,x,u0),y,z0),2));\n if(vz > 0, my(br = valuation(subst(truncate(up), y, z0) - u0, 2)); print(\" on P-branch to \", br); TD += vector(3,i, subst(IP[i], y, z0)),\n my(t0 = z0/u0, w0 = 1/u0); print(\" inf: v(t)=\", valuation(t0,2), \" v(w)=\", valuation(w0,2), \" branch \", valuation(subst(truncate(wi), t, t0) - w0, 2)); TD += vector(3,i, subst(Iinf[i], t, t0)));\n);\n}\nLD = (-TD - 2*LP)/14;\nprint(\"v2(L_D) = \", vector(3,i,valuation(LD[i],2)), \" L_D mod 2^16: \", vector(3,i, lift(Mod(truncate(LD[i]), 2^16))));\nlam = [LP[2]*LD[3]-LP[3]*LD[2], LP[3]*LD[1]-LP[1]*LD[3], LP[1]*LD[2]-LP[2]*LD[1]];\nmv = vecmin(vector(3,i,valuation(lam[i],2))); lam = lam/2^mv; lam = lam/lam[3];\nprint(\"annihilator normalized a2=1, mod 8: \", vector(3,i, lift(Mod(truncate(lam[i]),8))), \" vals \", vector(3,i,valuation(lam[i],2)));\n" }, { "path": "anc/code/1.1.5/data/4227_S_unit_representatives.gp", "size_bytes": 21003, "sha256": "5bc81b02c6c53a1713e75bd392274ef1e703bf05da659f8487fc922e1ff1406d", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ the 18 S-unit representatives of the source (SH/inputs/4227_descent_input.json), as polynomials in m\n{\nB4227 = [\n((-1)*m^0),\n((2516576946034601/1230290607607141)*m^0+(-13068072484747843/11072615468464269)*m^1+(-32308166393905988/11072615468464269)*m^2+(-28403854944621775/11072615468464269)*m^3+(-15584506623628441/11072615468464269)*m^4+(72343019123225015/11072615468464269)*m^5+(683458225726868927/88580923747714152)*m^6+(248994861583176253/44290461873857076)*m^7+(-245316407841897877/177161847495428304)*m^8+(-1566581616941172239/354323694990856608)*m^9+(-366134749764915511/354323694990856608)*m^10+(-22201498115752007/118107898330285536)*m^11+(19864498314093901/177161847495428304)*m^12+(-66023027457574267/708647389981713216)*m^13+(2785509096783893/14763487291285692)*m^14+(-2200253324397121/44290461873857076)*m^15+(242098770782639353/2834589559926852864)*m^16+(-318182945411488249/2834589559926852864)*m^17+(33096230337934829/1889726373284568576)*m^18+(-178426142287747/2834589559926852864)*m^19+(663143018154599/11338358239707411456)*m^20+(-88097725447553/2834589559926852864)*m^21+(657820666761631/22676716479414822912)*m^22+(-183948318092659/2834589559926852864)*m^23+(103148621828819/15117810986276548608)*m^24+(-2764992566622311/90706865917659291648)*m^25+(182760071582165/5039270328758849536)*m^26),\n((4265742325535717/55363077342321345)*m^0+(-6730726677575197/55363077342321345)*m^1+(3798978964236584/55363077342321345)*m^2+(-236634521851728/6151453038035705)*m^3+(141150416543136/6151453038035705)*m^4+(-84194985306432/6151453038035705)*m^5+(50221570182784/6151453038035705)*m^6+(-89870178221824/18454359114107115)*m^7+(160820318923264/55363077342321345)*m^8+(55002549378497411/885809237477141520)*m^9+(-1185068738039493/49211624304285640)*m^10+(481266801379773/24605812152142820)*m^11+(-143535712692213/12302906076071410)*m^12+(42808896767853/6151453038035705)*m^13+(-25535131405386/6151453038035705)*m^14+(15231481890932/6151453038035705)*m^15+(-27256336015352/18454359114107115)*m^16+(48774496027472/55363077342321345)*m^17+(-322870077154027/2362157966605710720)*m^18+(3692584153809/393692994434285120)*m^19+(-1101297028329/196846497217142560)*m^20+(328457008449/98423248608571280)*m^21+(-97960862169/49211624304285640)*m^22+(29216397489/24605812152142820)*m^23+(-8713662409/12302906076071410)*m^24+(7796434787/18454359114107115)*m^25+(-13951514882/55363077342321345)*m^26),\n((-114478150468884097/55363077342321345)*m^0+(74183006808592787/55363077342321345)*m^1+(386460120058041121/55363077342321345)*m^2+(-564078749449849211/110726154684642690)*m^3+(-576851787412300817/73817436456428460)*m^4+(1480781669287267339/442904618738570760)*m^5+(1675731296949323779/147634872912856920)*m^6+(-248540751949014137/36908718228214230)*m^7+(-12465183040804906889/885809237477141520)*m^8+(-11013690647199519277/1771618474954283040)*m^9+(-2107023076448175989/3543236949908566080)*m^10+(-115280354360422231/1771618474954283040)*m^11+(-141572805664512863/1771618474954283040)*m^12+(-117850174331122693/3543236949908566080)*m^13+(97125220573187193/787385988868570240)*m^14+(365638739148206789/4724315933211421440)*m^15+(-187150583046580063/787385988868570240)*m^16+(-323289484081311667/14172947799634264320)*m^17+(157863042780177697/14172947799634264320)*m^18+(-213650742708617/3149543955474280960)*m^19+(675130859072597/56691791198537057280)*m^20+(402145567529293/12598175821897123840)*m^21+(2050002189814541/113383582397074114560)*m^22+(-9676271972908439/226767164794148229120)*m^23+(-2064454595902433/56691791198537057280)*m^24+(37155250328219213/453534329588296458240)*m^25+(20966176591099913/907068659176592916480)*m^26),\n((41583013341515183/55363077342321345)*m^0+(-27674497966939706/18454359114107115)*m^1+(-313101781877239603/110726154684642690)*m^2+(-310082265730853687/221452309369285380)*m^3+(-48817463528630659/24605812152142820)*m^4+(-2329805051076004481/442904618738570760)*m^5+(-1201793170344435401/147634872912856920)*m^6+(-5754528648680492333/885809237477141520)*m^7+(-8807447656708521203/1771618474954283040)*m^8+(-743790409513000687/295269745825713840)*m^9+(-904115791145856287/1771618474954283040)*m^10+(-4201514391719607/98423248608571280)*m^11+(84718061588157509/3543236949908566080)*m^12+(-143668737996880153/3543236949908566080)*m^13+(-60972102454835933/1181078983302855360)*m^14+(-303362934233908951/4724315933211421440)*m^15+(-240317112371340319/14172947799634264320)*m^16+(-82014542886925907/2362157966605710720)*m^17+(11288483885602633/1574771977737140480)*m^18+(-5668917474311/3543236949908566080)*m^19+(114683147829629/7086473899817132160)*m^20+(-165709738013927/28345895599268528640)*m^21+(175833348515179/12598175821897123840)*m^22+(545675501179259/25196351643794247680)*m^23+(4198509139078357/151178109862765486080)*m^24+(5113545144985703/453534329588296458240)*m^25+(6770555991784829/453534329588296458240)*m^26),\n((51397892902460083/18454359114107115)*m^0+(-493401935438512784/55363077342321345)*m^1+(395862861643877773/55363077342321345)*m^2+(1122790631693641736/55363077342321345)*m^3+(79948946505878319/12302906076071410)*m^4+(-641298544480257583/73817436456428460)*m^5+(8792079428364210941/442904618738570760)*m^6+(40857597837910516081/885809237477141520)*m^7+(1357636156550789773/55363077342321345)*m^8+(6695770842563184439/1771618474954283040)*m^9+(-77986911566133881/1771618474954283040)*m^10+(40859600714490143/442904618738570760)*m^11+(691369691351682917/3543236949908566080)*m^12+(-810006841152693803/7086473899817132160)*m^13+(-231083411942412611/1771618474954283040)*m^14+(1809764507855466739/3543236949908566080)*m^15+(650087080673180123/2362157966605710720)*m^16+(-1084357693622802541/14172947799634264320)*m^17+(3473508603763139/1574771977737140480)*m^18+(-1377950085030833/56691791198537057280)*m^19+(-366638544368279/9448631866422842880)*m^20+(-2257756149147361/28345895599268528640)*m^21+(807130594400557/28345895599268528640)*m^22+(336683980483593/6299087910948561920)*m^23+(-319538725326077/1771618474954283040)*m^24+(-30534334451598013/226767164794148229120)*m^25+(666790781141959/151178109862765486080)*m^26),\n((-36995951570914253/55363077342321345)*m^0+(47455928433126866/18454359114107115)*m^1+(188560809455415713/110726154684642690)*m^2+(-81480424480532542/55363077342321345)*m^3+(-290914681146003886/55363077342321345)*m^4+(-387407877610500779/73817436456428460)*m^5+(-349576968250314701/221452309369285380)*m^6+(630825591766173887/98423248608571280)*m^7+(1724592159082613623/110726154684642690)*m^8+(8858589983397347521/885809237477141520)*m^9+(218975852293748979/98423248608571280)*m^10+(-139033868346498743/3543236949908566080)*m^11+(-256211048845539083/7086473899817132160)*m^12+(-41511214774551569/1181078983302855360)*m^13+(-3314601775454091/98423248608571280)*m^14+(353020352029821593/14172947799634264320)*m^15+(2714043478420129783/28345895599268528640)*m^16+(469645766949309201/3149543955474280960)*m^17+(-52747158759285449/1771618474954283040)*m^18+(-1570199750016979/56691791198537057280)*m^19+(1117779153243941/113383582397074114560)*m^20+(426874893098647/28345895599268528640)*m^21+(893708715153617/56691791198537057280)*m^22+(869873564548091/56691791198537057280)*m^23+(-987951030050807/151178109862765486080)*m^24+(-16686446744542513/453534329588296458240)*m^25+(-28142521633546639/453534329588296458240)*m^26),\n((-606815603734040939/55363077342321345)*m^0+(1333752080779250209/55363077342321345)*m^1+(-2487204492417534611/110726154684642690)*m^2+(2953525140151415621/221452309369285380)*m^3+(-770463187648327349/73817436456428460)*m^4+(1659373914876722111/147634872912856920)*m^5+(-3215527604960166043/221452309369285380)*m^6+(11931639547944102149/885809237477141520)*m^7+(-13608838928154070801/1771618474954283040)*m^8+(-13883422284781911443/590539491651427680)*m^9+(-11679599773367430079/1771618474954283040)*m^10+(-3943276022679355639/3543236949908566080)*m^11+(613977530001341203/590539491651427680)*m^12+(-2133926341455539279/2362157966605710720)*m^13+(3797503421178119531/4724315933211421440)*m^14+(-11344046318495772821/14172947799634264320)*m^15+(11476586662593834197/14172947799634264320)*m^16+(-20389435541439767653/28345895599268528640)*m^17+(6053392129224235201/56691791198537057280)*m^18+(-2155534376752893/6299087910948561920)*m^19+(2498699246169233/7086473899817132160)*m^20+(-36689742130566871/113383582397074114560)*m^21+(63087939626086639/226767164794148229120)*m^22+(-56517442613038493/226767164794148229120)*m^23+(38267099306340889/151178109862765486080)*m^24+(-116070788052991519/453534329588296458240)*m^25+(67057355571357707/302356219725530972160)*m^26),\n((-247566963353373877/55363077342321345)*m^0+(545840143871579842/55363077342321345)*m^1+(-230187375544037744/55363077342321345)*m^2+(-588966128337816641/110726154684642690)*m^3+(2335135558479607739/221452309369285380)*m^4+(-4915581468109613411/442904618738570760)*m^5+(28984847427718951/221452309369285380)*m^6+(449967901060977002/55363077342321345)*m^7+(-3999881813904292847/442904618738570760)*m^8+(-525909489330727946/55363077342321345)*m^9+(-1974646598155063493/1181078983302855360)*m^10+(-1515493866310671697/3543236949908566080)*m^11+(466852910470999351/2362157966605710720)*m^12+(101726992235130943/885809237477141520)*m^13+(-5299656431308094671/14172947799634264320)*m^14+(4949760523927034347/14172947799634264320)*m^15+(-2804537215742290643/28345895599268528640)*m^16+(-123499424471398889/787385988868570240)*m^17+(1678998354152652653/56691791198537057280)*m^18+(-4390113298014773/28345895599268528640)*m^19+(4966461889412123/37794527465691371520)*m^20+(-470812166051119/9448631866422842880)*m^21+(-11714311263270043/226767164794148229120)*m^22+(4905815248136281/37794527465691371520)*m^23+(-48389497279263059/453534329588296458240)*m^24+(2678435503824871/151178109862765486080)*m^25+(9302279819501063/151178109862765486080)*m^26),\n((250449972488098391/18454359114107115)*m^0+(-656851324733656868/55363077342321345)*m^1+(-1009861877492340404/55363077342321345)*m^2+(-676307223783717259/73817436456428460)*m^3+(259983964613679026/55363077342321345)*m^4+(3228440071410922061/110726154684642690)*m^5+(3465277490446882847/73817436456428460)*m^6+(22914672269593076687/885809237477141520)*m^7+(-22982642786940760811/590539491651427680)*m^8+(-16758495758908255553/442904618738570760)*m^9+(-32968936515776680759/3543236949908566080)*m^10+(-323054319993554567/3543236949908566080)*m^11+(-137644752099060311/3543236949908566080)*m^12+(464681098091309207/3543236949908566080)*m^13+(641889994798630913/1771618474954283040)*m^14+(2518827099612355091/7086473899817132160)*m^15+(-1346074703964795169/14172947799634264320)*m^16+(-20197604066032658189/28345895599268528640)*m^17+(1207907549232371753/9448631866422842880)*m^18+(485546894953561/14172947799634264320)*m^19+(95622894373873/2362157966605710720)*m^20+(152646033122317/7086473899817132160)*m^21+(-284784449621593/6299087910948561920)*m^22+(-32412150320033629/226767164794148229120)*m^23+(-71519426843371369/453534329588296458240)*m^24+(3269827259501653/453534329588296458240)*m^25+(80539224607515301/302356219725530972160)*m^26),\n((287630422171304213/55363077342321345)*m^0+(-164372887304819833/55363077342321345)*m^1+(-141372584442278963/110726154684642690)*m^2+(-403384094346560177/221452309369285380)*m^3+(-1860699699926494141/221452309369285380)*m^4+(-1693493924929378147/147634872912856920)*m^5+(-3832647608340755089/221452309369285380)*m^6+(-28613595633969253543/885809237477141520)*m^7+(-86366375165949339563/1771618474954283040)*m^8+(-5539512199909375663/196846497217142560)*m^9+(-3246246568878405029/590539491651427680)*m^10+(-36375122391054161/295269745825713840)*m^11+(255578592221867863/7086473899817132160)*m^12+(-24445793624746701/196846497217142560)*m^13+(-24101465251598747/295269745825713840)*m^14+(-1001489191408191469/7086473899817132160)*m^15+(-9924935469818002643/28345895599268528640)*m^16+(-1762326522068458829/4724315933211421440)*m^17+(247974399662785071/3149543955474280960)*m^18+(-1037708960364377/18897263732845685760)*m^19+(1345888813031813/37794527465691371520)*m^20+(-789629181731743/113383582397074114560)*m^21+(5111576716042361/113383582397074114560)*m^22+(8687049991579141/226767164794148229120)*m^23+(1498716717088667/25196351643794247680)*m^24+(63877404742564793/453534329588296458240)*m^25+(4646910421475879/28345895599268528640)*m^26),\n((631087354696760393/55363077342321345)*m^0+(-1487917252664252743/55363077342321345)*m^1+(1076066228912859121/55363077342321345)*m^2+(410612892913110047/55363077342321345)*m^3+(-3385029953850444583/110726154684642690)*m^4+(14992846396004468239/442904618738570760)*m^5+(-3591784974842261279/221452309369285380)*m^6+(-4614297420512687981/295269745825713840)*m^7+(1574891591992393721/55363077342321345)*m^8+(2301718821069395663/110726154684642690)*m^9+(11173381562189604301/3543236949908566080)*m^10+(3353264698177982353/3543236949908566080)*m^11+(-2237293720396769191/3543236949908566080)*m^12+(-579439177825843433/3543236949908566080)*m^13+(6530716430302303777/7086473899817132160)*m^14+(-8109044554286076469/7086473899817132160)*m^15+(1075476362645375327/1771618474954283040)*m^16+(1525746607321977379/7086473899817132160)*m^17+(-92500105800512161/1771618474954283040)*m^18+(4265387636205113/18897263732845685760)*m^19+(-17669380200530563/56691791198537057280)*m^20+(6774606329648119/37794527465691371520)*m^21+(1317533535884627/14172947799634264320)*m^22+(-8220107255679441/25196351643794247680)*m^23+(83304039877980173/226767164794148229120)*m^24+(-18154010343288583/113383582397074114560)*m^25+(-98669369349698437/907068659176592916480)*m^26),\n((137465308779518503/55363077342321345)*m^0+(-162845468341648943/55363077342321345)*m^1+(94120138936277013/12302906076071410)*m^2+(-769160194895476409/73817436456428460)*m^3+(531575295082860929/36908718228214230)*m^4+(141469595148075711/49211624304285640)*m^5+(99406900159559737/73817436456428460)*m^6+(-10297126764148591693/885809237477141520)*m^7+(36234704181302704187/1771618474954283040)*m^8+(46915130541256727173/1771618474954283040)*m^9+(12155704609774768783/1771618474954283040)*m^10+(619463908222315319/1771618474954283040)*m^11+(-2894687992079466367/7086473899817132160)*m^12+(981355683893163641/1771618474954283040)*m^13+(-5667300862787090801/14172947799634264320)*m^14+(3630978102386701027/14172947799634264320)*m^15+(-9693709739598239873/28345895599268528640)*m^16+(8826718994125155313/14172947799634264320)*m^17+(-5760877440091633387/56691791198537057280)*m^18+(626960862434227/4724315933211421440)*m^19+(-11889285890759531/113383582397074114560)*m^20+(942371979276827/7086473899817132160)*m^21+(-13802140483666291/75589054931382743040)*m^22+(26317370612359601/226767164794148229120)*m^23+(-16885203232256477/226767164794148229120)*m^24+(6457057251973391/56691791198537057280)*m^25+(-191669123787834197/907068659176592916480)*m^26),\n((198565877568779287/11072615468464269)*m^0+(-189151915093252219/11072615468464269)*m^1+(-326731633521909667/11072615468464269)*m^2+(108271348350605117/3690871822821423)*m^3+(942964706666462009/22145230936928538)*m^4+(-3031849097011192009/88580923747714152)*m^5+(-5047117971256533641/88580923747714152)*m^6+(814079385442706365/22145230936928538)*m^7+(724385483760525965/11072615468464269)*m^8+(9246087565975020341/354323694990856608)*m^9+(222334918365362971/78738598886857024)*m^10+(23483682850268491/708647389981713216)*m^11+(900119929542042329/1417294779963426432)*m^12+(-5917529939502203/472431593321142144)*m^13+(-1148409240400902203/1417294779963426432)*m^14+(-26716921586828641/236215796660571072)*m^15+(5906931917938728371/5669179119853705728)*m^16+(474730808270301979/5669179119853705728)*m^17+(-66057053240992837/1417294779963426432)*m^18+(2533781133097051/11338358239707411456)*m^19+(193926400115749/7558905493138274304)*m^20+(-2634094310054689/11338358239707411456)*m^21+(-850620163571969/22676716479414822912)*m^22+(278351022907229/944863186642284288)*m^23+(955755715555797/10078540657517699072)*m^24+(-16810919745627193/45353432958829645824)*m^25+(-5890075269935779/60471243945106194432)*m^26),\n((-481028638863137513/55363077342321345)*m^0+(1647953637210973733/55363077342321345)*m^1+(-1464637869718008041/55363077342321345)*m^2+(2871710567540309437/221452309369285380)*m^3+(-1864578084470362919/221452309369285380)*m^4+(5012340753091799317/147634872912856920)*m^5+(-774920021043164581/36908718228214230)*m^6+(32742450609956203/147634872912856920)*m^7+(-2348848056545538577/1771618474954283040)*m^8+(-28691680951894083263/1771618474954283040)*m^9+(-555862201512696623/110726154684642690)*m^10+(-4486023229553066233/3543236949908566080)*m^11+(1046743137032369269/885809237477141520)*m^12+(-563847632358255017/590539491651427680)*m^13+(1864960869637568549/1574771977737140480)*m^14+(-2044755655495926073/1574771977737140480)*m^15+(286602470005656823/295269745825713840)*m^16+(-2180650825418188117/3543236949908566080)*m^17+(1616270654974789049/18897263732845685760)*m^18+(-20417586917666039/56691791198537057280)*m^19+(23078854597232483/56691791198537057280)*m^20+(-20781149189091671/56691791198537057280)*m^21+(65663206883926093/226767164794148229120)*m^22+(-5510206922501861/14172947799634264320)*m^23+(187520417538653819/453534329588296458240)*m^24+(-8137545189452083/28345895599268528640)*m^25+(161046950476136117/907068659176592916480)*m^26),\n((6083921107665454526/55363077342321345)*m^0+(-14483337617950906441/55363077342321345)*m^1+(13149601882140264452/55363077342321345)*m^2+(-42014183866606419949/221452309369285380)*m^3+(11379666632722555217/55363077342321345)*m^4+(-6846647643407110141/36908718228214230)*m^5+(2680330783471966096/18454359114107115)*m^6+(-16792978243553847709/98423248608571280)*m^7+(348235957491728361379/1771618474954283040)*m^8+(682250030422358548691/1771618474954283040)*m^9+(186983297001555211081/1771618474954283040)*m^10+(14873353951063944997/1181078983302855360)*m^11+(-85615761142523459149/7086473899817132160)*m^12+(85541253730075028233/7086473899817132160)*m^13+(-84218603522956755581/7086473899817132160)*m^14+(155788527728635278419/14172947799634264320)*m^15+(-298887656745762351371/28345895599268528640)*m^16+(25597767537409413011/2362157966605710720)*m^17+(-5863603578705538789/3543236949908566080)*m^18+(4938646119778481/1181078983302855360)*m^19+(-148767206360123129/37794527465691371520)*m^20+(429714147392221969/113383582397074114560)*m^21+(-9004806090399761/2362157966605710720)*m^22+(423911048509988771/113383582397074114560)*m^23+(-48469938480009319/14172947799634264320)*m^24+(500455560446331977/151178109862765486080)*m^25+(-519861740985728389/151178109862765486080)*m^26),\n((12342201924307837/18454359114107115)*m^0+(-148043903459344861/55363077342321345)*m^1+(-128298390185171477/36908718228214230)*m^2+(-863800963534805959/221452309369285380)*m^3+(-317092763588794109/73817436456428460)*m^4+(-630585599915964793/110726154684642690)*m^5+(-3507799908122756261/442904618738570760)*m^6+(-9623541596689175321/885809237477141520)*m^7+(-23082571606275740551/1771618474954283040)*m^8+(-12101472227319891379/1771618474954283040)*m^9+(-816726245209372463/590539491651427680)*m^10+(44745996368595143/1771618474954283040)*m^11+(-486749502685134329/7086473899817132160)*m^12+(-36764404684064117/7086473899817132160)*m^13+(-968756216445134387/14172947799634264320)*m^14+(-176976754982556229/3543236949908566080)*m^15+(-2829623532011759341/28345895599268528640)*m^16+(-49720306253508841/590539491651427680)*m^17+(1068914031373812251/56691791198537057280)*m^18+(27936288797717/885809237477141520)*m^19+(-6126008618508517/113383582397074114560)*m^20+(747852914636627/56691791198537057280)*m^21+(952073007280433/75589054931382743040)*m^22+(839258531193379/28345895599268528640)*m^23+(1722778875721847/75589054931382743040)*m^24+(1152504826781671/28345895599268528640)*m^25+(35091112378639121/907068659176592916480)*m^26),\n((-2342295577991459003/55363077342321345)*m^0+(432722041917243178/55363077342321345)*m^1+(191604474399843878/18454359114107115)*m^2+(-149021870766085729/18454359114107115)*m^3+(535392085664028944/55363077342321345)*m^4+(9735724691722767073/221452309369285380)*m^5+(3999070278806717296/55363077342321345)*m^6+(6132301631589081838/55363077342321345)*m^7+(89409084316909788107/442904618738570760)*m^8+(115826302586552641031/885809237477141520)*m^9+(50422156854387744907/1771618474954283040)*m^10+(-148601817047392639/1771618474954283040)*m^11+(-103566247037372647/1771618474954283040)*m^12+(1795436953224227011/7086473899817132160)*m^13+(6939022860811701061/14172947799634264320)*m^14+(229621222931094763/393692994434285120)*m^15+(14273698994804065799/14172947799634264320)*m^16+(56960001693490460819/28345895599268528640)*m^17+(-22380705905543349613/56691791198537057280)*m^18+(-115074321062203/18897263732845685760)*m^19+(1824725900331233/56691791198537057280)*m^20+(1609572725256679/56691791198537057280)*m^21+(-20136338585584207/226767164794148229120)*m^22+(-44862811212893921/226767164794148229120)*m^23+(-7150208075336371/28345895599268528640)*m^24+(-47584071430484927/113383582397074114560)*m^25+(-746048852892562313/907068659176592916480)*m^26)];\n}\n" }, { "path": "anc/code/1.1.5/eta.gp", "size_bytes": 2286, "sha256": "b68c61fb7e519950301d56c246aafc33b67844ccda6bca74b3320f71fc2de4ab", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "eta1 = 1004441036273119/120756711126203762688*m^26 + 821058302292751/120756711126203762688*m^25 + 1128494062201015/120756711126203762688*m^24 + 613087052943043/120756711126203762688*m^23 + 1477151744934349/120756711126203762688*m^22 + 13951514882/58963237854591681*m^21 - 7796434787/19654412618197227*m^20 + 8713662409/13102941745464818*m^19 - 5023607568445067/1257882407564622528*m^18 + 24021408564875633/1257882407564622528*m^17 + 17343220669090565/1257882407564622528*m^16 + 28539006259083179/1257882407564622528*m^15 + 305300031414751/39308825236394454*m^14 + 82471913743910851/2515764815129245056*m^13 + 48774496027472/58963237854591681*m^12 - 27256336015352/19654412618197227*m^11 - 14944763688969329/52411766981859272*m^10 - 222377617431156955/157235300945577816*m^9 - 10609514015086785/4031674383219944*m^8 - 10538938806815217/4031674383219944*m^7 - 10657256067741081/4031674383219944*m^6 - 10458900659718309/4031674383219944*m^5 - 37696699933300439/18142534724489748*m^4 - 12370793763328/4535633681122437*m^3 + 8305138824850424/58963237854591681*m^2 + 6116472286696952/58963237854591681*m - 14320877505188848/58963237854591681;\neta2 = -947295631316447/113383582397074114560*m^26 - 763912897336079/113383582397074114560*m^25 - 1071348657244343/113383582397074114560*m^24 - 555941647986371/113383582397074114560*m^23 - 1420006339977677/113383582397074114560*m^22 + 13951514882/55363077342321345*m^21 - 7796434787/18454359114107115*m^20 + 8713662409/12302906076071410*m^19 - 4737880543661707/1181078983302855360*m^18 + 22707064250872177/1181078983302855360*m^17 + 16028876355087109/1181078983302855360*m^16 + 27224661945079723/1181078983302855360*m^15 + 264226771602143/36908718228214230*m^14 + 79843225115903939/2362157966605710720*m^13 - 48774496027472/55363077342321345*m^12 + 27256336015352/18454359114107115*m^11 + 14087582614619249/49211624304285640*m^10 + 209291319696079067/147634872912856920*m^9 + 129523307667497421/49211624304285640*m^8 + 128605829959967037/49211624304285640*m^7 + 130143954352003269/49211624304285640*m^6 + 127565334047707233/49211624304285640*m^5 + 460879327660910827/221452309369285380*m^4 - 160820318923264/55363077342321345*m^3 + 7847975585197048/55363077342321345*m^2 + 5659309047043576/55363077342321345*m - 13406551025882096/55363077342321345;\n" }, { "path": "anc/code/1.1.5/polys.gp", "size_bytes": 176, "sha256": "0cb8cd2981e972e0e38f058c3c1e065ce9f2b881b1e0e9793046268b66e8b4c0", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "f1 = m^27-480*m^19+2688*m^18-34560*m^11-141312*m^10-162816*m^9+16384*m^3-49152*m+32768;\ng2 = m^27+480*m^19-2688*m^18-34560*m^11-141312*m^10-162816*m^9-16384*m^3+49152*m-32768;\n" }, { "path": "anc/code/1.1.5/selmer_lib.gp", "size_bytes": 2708, "sha256": "5adf69268504bc7a8eec672d2f9f89ad74c08ac11dff35b32dfe8d047c031daf", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent fake-2-Selmer computation helpers (marked-bitangent descent). Works with famat (compact) elements.\nf2rank(M) = matrank(Mod(M,2));\ntofam(x) = if(type(x)==\"t_MAT\", x, Mat([x, 1]));\nks2basis(bnf, S) = bnfunits(bnf, S)[1];\ndyadic_setup(K, P) = {\n my(e = P[3], bid = idealstar(K, idealpow(K, P, 2*e+1), 1), pi = nfbasistoalg(K, P[2]));\n if(nfeltval(K, pi, P) != 1, error(\"pr gen not uniformizer\"));\n [P, bid, pi];\n}\ndyadic_vec(K, D, xi) = {\n my(P = D[1], bid = D[2], pi = D[3], fx = tofam(xi), v = nfeltval(K, fx, P), u, lg, cyc = bid.cyc, out = [v % 2]);\n u = matconcat([fx; Mat([pi, -v])]);\n lg = ideallog(K, u, bid);\n for(i=1, #cyc, if(cyc[i] % 2 == 0, out = concat(out, lg[i] % 2)));\n out;\n}\ndyadic_all(K, DD, xi) = { my(out = []); for(k=1, #DD, out = concat(out, dyadic_vec(K, DD[k], xi))); out; }\n\\\\ sign and 2-adic valuation parity of the norm of famat\nnormdata(K, xi) = { my(fx = tofam(xi), sg = 0, v2 = 0); for(j=1, matsize(fx)[1], my(N = norm(nfbasistoalg(K, fx[j,1])), e = fx[j,2] % 2); if(e, if(N < 0, sg++); v2 += valuation(N, 2))); [sg % 2, v2 % 2]; }\n\\\\ good prime setup: list of [pr, modpr, generator image of m]\ngoodprime_setup(K, p) = {\n my(PL = idealprimedec(K, p));\n vector(#PL, i, my(mp = nfmodprinit(K, PL[i]), g = nfmodpr(K, Mod(m, K.pol), mp)); [PL[i], mp, g]);\n}\nffconv(b, a) = { my(g = ffgen(a)); if(type(b)==\"t_FFELT\", b, if(type(b)==\"t_POL\", subst(b, variable(b), g), b*g^0)); }\ngp_char(K, xi, GS) = vector(#GS, i, my(a = GS[i][3], z = ffconv(nfmodpr(K, tofam(xi), GS[i][2]), a)); if(z==0, error(\"not unit\")); if(issquare(z), 0, 1));\n\\\\ local image at good prime p, from all affine points of the curve (O has trivial image)\ngoodimage(K, ETA, CURVE, EVF, p) = {\n my(GS = goodprime_setup(K, p), r = #GS, img = List(), nzero = [0,0,0], Fp = Mod(1,p)*CURVE, etag, gens);\n gens = vector(r, i, GS[i][3]);\n etag = vector(r, i, nfmodpr(K, Mod(ETA, K.pol), GS[i][2]));\n for(x0 = 0, p-1, my(rt = polrootsmod(subst(Fp, X, x0), p));\n for(j=1, #rt, my(y0 = rt[j], vals = vector(r, i, EVF(x0*gens[i]^0, y0*gens[i]^0, gens[i], etag[i])), z = 0, vec = vector(r));\n for(i=1,r, if(vals[i]==0, z++, vec[i] = if(issquare(vals[i]),0,1)));\n if(z == 1, my(iz = 0); for(i=1,r, if(vals[i]==0, iz=i)); vec[iz] = sum(i=1,r,vec[i]) % 2);\n if(z >= 2,\n my(cub = lift(subst(Fp, X, x0)) \\ (Y - lift(y0)));\n if(polcoef(cub,3,Y)!=1, error(\"cubic not monic\"));\n vec = vector(r, i, my(nv = polresultant(cub*gens[i]^0, EVF(x0*gens[i]^0, Y, gens[i], etag[i]), Y));\n if(nv==0, error(\"line trick fails\")); if(issquare(nv),0,1)));\n nzero[min(z,2)+1]++;\n listput(img, vec)));\n [GS, Mod(matrix(#img, r, a, b, img[a][b]), 2), nzero];\n}\n" }, { "path": "anc/code/1.1.6/1.1.6a_bitangent.gp", "size_bytes": 1383, "sha256": "06f1d2e27f78b2905ad94fc93dd4a509dc51a24b84e08eb69eea28a449ad7fcd", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ independent bitangent slope polynomial for both curves\ndefault(parisize, 400000000);\nbit(sgn) = {\n my(B,C,D,E,g1,g2,r,fa);\n \\\\ curve sgn*z^4 + u^3+u^2+z = 0, line u = m z + n\n B = m^3; C = m^2*(3*n+1); D = m*(3*n^2+2*n)+1; E = n^3+n^2;\n \\\\ sgn*z^4 + B z^3 + C z^2 + D z + E = sgn*(z^2+al z+be)^2\n \\\\ divide by sgn: z^4 + (B/sgn) z^3 + ...\n my(b=B/sgn,c=C/sgn,d=D/sgn,e=E/sgn);\n g1 = numerator(8*d - 4*b*c + b^3);\n g2 = numerator(64*e - (4*c-b^2)^2);\n r = polresultant(g1, g2, n);\n fa = factor(r);\n [r, fa]\n};\nF1 = bit(1); print(\"4564 resultant factorization degrees: \", apply(poldegree, F1[2][,1]~), \" mult \", F1[2][,2]~);\nF2 = bit(-1); print(\"4569 resultant factorization degrees: \", apply(poldegree, F2[2][,1]~), \" mult \", F2[2][,2]~);\nf1 = m^27-160*m^19-1344*m^18+1280*m^15-3840*m^11+23552*m^10-40704*m^9+4096*m^7-8192*m^6-4096*m-4096;\nf2 = m^27-160*m^19-1344*m^18-1280*m^15-3840*m^11+23552*m^10-40704*m^9-4096*m^7+8192*m^6-4096*m-4096;\nfor(i=1,#F1[2][,1], if(poldegree(F1[2][i,1])==27, print(\"4564 deg27 factor == claimed f: \", F1[2][i,1]==f1 || F1[2][i,1]==-f1)));\nfor(i=1,#F2[2][,1], if(poldegree(F2[2][i,1])==27, print(\"4569 deg27 factor == claimed f: \", F2[2][i,1]==f2 || F2[2][i,1]==-f2)));\nprint(\"irreducible: \", polisirreducible(f1), \" \", polisirreducible(f2));\nprint(\"signature (real roots): \", polsturm(f1), \" \", polsturm(f2));\nprint(F1[2]); print(F2[2]);\n" }, { "path": "anc/code/1.1.6/1.1.6a_field.gp", "size_bytes": 649, "sha256": "90c31d141882a011d96c4e3eb6975a870f00347d9eb8c11a32749fb9a8b2106e", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 800000000);\nf1 = x^27-160*x^19-1344*x^18+1280*x^15-3840*x^11+23552*x^10-40704*x^9+4096*x^7-8192*x^6-4096*x-4096;\nf2 = x^27-160*x^19-1344*x^18-1280*x^15-3840*x^11+23552*x^10-40704*x^9-4096*x^7+8192*x^6-4096*x-4096;\n{\nfor(k=1,2, f = if(k==1,f1,f2);\n d = poldisc(f);\n fa = factor(d, 10^7);\n print(\"case \",k,\": poldisc partial factorization: \", fa);\n \\\\ check that the cofactor is fully factored\n print(\" all factors prime? \", vector(#fa~, i, isprime(fa[i,1])));\n nf = nfinit([f, fa[,1]~]);\n print(\" nf disc = \", factor(nf.disc), \" sign=\", nf.sign, \" index=\", factor(nf.index));\n print(\" nfcertify: \", nfcertify(nf));\n);\n}\n" }, { "path": "anc/code/1.1.6/1.1.6a_selmer.py", "size_bytes": 15605, "sha256": "097d520d00856d55d64c48497ceb0b2f33a20d21a49e8664f031e7b9e55f45db", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent recomputation of the 2-Selmer (fake descent) bound for 4564 / 4569.\n# Inputs taken from the supplied JSON: field poly (rechecked against our own resultant),\n# bitangent intercepts eta (rechecked exactly), and S-unit candidates (support and\n# independence rechecked here). All local images are recomputed with our own code.\nimport sys, json, time\nimport cypari2\npari = cypari2.Pari(); pari.allocatemem(3*10**9)\ncase, jfile = sys.argv[1], sys.argv[2]\nd = json.load(open(jfile))\nt0 = time.time()\nx = pari('x')\nf = sum(pari(c)*x**i for i, c in enumerate(d['field_polynomial_coefficients']))\nfown = {'4564': pari('x^27-160*x^19-1344*x^18+1280*x^15-3840*x^11+23552*x^10-40704*x^9+4096*x^7-8192*x^6-4096*x-4096'),\n '4569': pari('x^27-160*x^19-1344*x^18-1280*x^15-3840*x^11+23552*x^10-40704*x^9-4096*x^7+8192*x^6-4096*x-4096')}[case]\nassert f == fown, 'field poly mismatch'\nsgn = 1 if case == '4564' else -1 # curve: sgn*z^4 + u^3 + u^2 + z = 0\nSprimes = [2, 3] if case == '4564' else [2, 3, 5]\nfa = pari.factor(pari.poldisc(f), 10**7)\nnf = pari.nfinit([f, fa[0]]); assert len(pari.nfcertify(nf)) == 0\ndef el(coeffs):\n return pari.nfalgtobasis(nf, pari.Mod(sum(pari(c)*x**i for i, c in enumerate(coeffs)), f))\nm = pari.nfalgtobasis(nf, pari.Mod(x, f))\neta = el(d['bitangent_intercept_coefficients'])\nmul = lambda a, b: pari.nfeltmul(nf, a, b)\nadd = lambda a, b: pari.nfeltadd(nf, a, b)\nsc = lambda c, a: pari.nfeltmul(nf, pari(c), a)\none = pari.nfalgtobasis(nf, pari.Mod(1, f))\n# exact bitangent check\nB = pari.nfeltpow(nf, m, 3); m2 = pari.nfeltpow(nf, m, 2)\nC = mul(m2, add(sc(3, eta), one))\nDd = add(mul(m, add(sc(3, mul(eta, eta)), sc(2, eta))), one)\nE = add(pari.nfeltpow(nf, eta, 3), mul(eta, eta))\nb, c_, d_, e_ = [sc(sgn, t) for t in (B, C, Dd, E)]\ng1 = add(add(sc(8, d_), sc(-4, mul(b, c_))), pari.nfeltpow(nf, b, 3))\nq = add(sc(4, c_), sc(-1, mul(b, b)))\ng2 = add(sc(64, e_), sc(-1, mul(q, q)))\nprint('bitangent identities exact zero:', pari.nfeltnorm(nf, g1) == 0, pari.nfeltnorm(nf, g2) == 0, flush=True)\n# h = normalized bitangent function value: 4564: eta + m z - u ; 4569: u - m z - eta\ndef hval(u, z):\n base = add(sc(-u, one), add(sc(z, m), eta)) # eta + m z - u\n return base if case == '4564' else sc(-1, base)\ncands = [el(cc) for cc in d['S_unit_candidates']]\nN = len(cands); print('candidates', N, flush=True)\n# support\nSids = []\nfor p in Sprimes:\n for pr in pari.idealprimedec(nf, p): Sids.append(pr)\nprint('primes above S:', len(Sids), [(int(pr[0]), int(pr[2]), int(pr[3])) for pr in Sids], flush=True)\nfor i, cnd in enumerate(cands):\n fac = pari.idealfactor(nf, cnd)\n ps = set(int(pr[0]) for pr in fac[0])\n assert ps <= set(Sprimes), ('support', i, ps)\nprint('all candidates supported above S: OK', flush=True)\n# ---- characters\ndef bits_to_int(bits):\n return sum((int(bv) & 1) << k for k, bv in enumerate(bits))\ndef rank(vecs):\n basis = [] # list of (pivotbit, vec)\n r = 0\n piv = {}\n for v in vecs:\n for pb, bv in piv.items():\n if (v >> pb) & 1: v ^= bv\n if v:\n pb = v.bit_length() - 1\n # reduce existing\n for k in list(piv):\n if (piv[k] >> pb) & 1: piv[k] ^= v\n piv[pb] = v; r += 1\n return r\nval = [[int(pari.nfeltval(nf, cnd, pr)) & 1 for pr in Sids] for cnd in cands]\ndef modpr_init(pr): return pari.nfmodprinit(nf, pr)\ndef qchar(a, modpr):\n r = pari.nfmodpr(nf, a, modpr)\n if r == 0: return None\n return 0 if pari.issquare(r) else 1\n# independence: valuation characters + residue characters at good degree-1 primes\nextra = []\npp = 101\nwhile True:\n pp = int(pari.nextprime(pp + 1))\n if pp in (601, 857, 17, 1289): continue\n for pr in pari.idealprimedec(nf, pp):\n if int(pr[3]) == 1 and int(pr[2]) == 1:\n extra.append(modpr_init(pr))\n if len(extra) >= 60: break\nchars = [val[i] + [qchar(cnd, mp) for mp in extra] for i, cnd in enumerate(cands)]\n# matrix rank over F2: rows = candidates\nrows = [bits_to_int(r) for r in chars]\nprint('rank of candidates under valuation+residue characters:', rank(rows), 'of', N, flush=True)\n# ---- global constraints: kernel of linear map L: F2^N -> F2^k ; columns accumulate\ncols = [] # each constraint is a function: candidate index -> bit ; store as list of bit-vectors over candidates\ndef add_constraint(bitlist): # bitlist[i] = value of the linear functional on candidate i\n cols.append(bits_to_int(bitlist))\ndef kernel_dim():\n # rows r_i = vector of constraint values for candidate i; kernel of x -> sum x_i r_i\n Rows = []\n for i in range(N):\n Rows.append(sum(((cvec >> i) & 1) << j for j, cvec in enumerate(cols)))\n return N - rank(Rows)\ndef kernel_basis():\n Rows = []\n for i in range(N):\n Rows.append(sum(((cvec >> i) & 1) << j for j, cvec in enumerate(cols)))\n # Gaussian elimination keeping track of combinations\n aug = [(Rows[i], 1 << i) for i in range(N)]\n piv = []\n basis = []\n rowsred = []\n for v, comb in aug:\n for (pv, pc, pb) in rowsred:\n if (v >> pb) & 1: v ^= pv; comb ^= pc\n if v:\n rowsred.append((v, comb, v.bit_length() - 1))\n else:\n basis.append(comb)\n return basis\nnorms = [pari.nfeltnorm(nf, cnd) for cnd in cands]\nadd_constraint([1 if nn < 0 else 0 for nn in norms])\nfor p in Sprimes:\n add_constraint([int(pari.valuation(nn, p)) & 1 for nn in norms])\nprint('after norm conditions: dim', kernel_dim(), flush=True)\ngoodp = [487, 491, 499, 503, 509, 521, 523]\nfor p in goodp:\n prs = pari.idealprimedec(nf, p)\n assert all(int(pr[2]) == 1 for pr in prs)\n degs = sorted(int(pr[3]) for pr in prs)\n mps = [modpr_init(pr) for pr in prs]\n mbar = [pari.nfmodpr(nf, m, mp) for mp in mps]\n ebar = [pari.nfmodpr(nf, eta, mp) for mp in mps]\n # curve points over F_p\n pts = []\n for u in range(p):\n for z in range(p):\n if (sgn*z**4 + u**3 + u**2 + z) % p == 0: pts.append((u, z))\n imgs = []; ncontact = 0\n for (u, z) in pts:\n vec = []; zero = []\n for k in range(len(mps)):\n hv = (ebar[k] + mbar[k]*z - u) * sgn\n if hv == 0: zero.append(k); vec.append(0)\n else: vec.append(0 if pari.issquare(hv) else 1)\n if zero:\n assert len(zero) == 1 and degs and int(prs[zero[0]][3]) == 1, ('contact', p, u, z, zero)\n ncontact += 1\n vec[zero[0]] = sum(vec) & 1\n imgs.append(bits_to_int(vec))\n W = rank(imgs)\n # candidate residue characters at these primes\n cv = [[qchar(cnd, mp) for mp in mps] for cnd in cands]\n assert all(cc is not None for row in cv for cc in row)\n # constraint: char(x) in span(imgs). Compute complement functionals: annihilator of W in F2^k\n k = len(mps)\n # basis of W\n wb = []\n for v in imgs:\n for bv in wb:\n if (v ^ bv) < v: v ^= bv\n if v:\n wb.append(v); wb.sort(reverse=True)\n # annihilator: all a in F2^k with =0 for w in wb (k small: brute force)\n ann = [a for a in range(1, 1 << k) if all(bin(a & w).count('1') % 2 == 0 for w in wb)]\n annb = []\n for a in ann:\n if rank(annb + [a]) > len(annb): annb.append(a)\n for a in annb:\n add_constraint([sum(cv[i][j] for j in range(k) if (a >> j) & 1) & 1 for i in range(N)])\n print('p=%d #C(F_p)=%d (incl. inf) degrees=%s contacts=%d dim local image=%d -> remaining dim %d' %\n (p, len(pts) + 1, degs, ncontact, W, kernel_dim()), flush=True)\nG = kernel_basis()\nprint('remaining basis size', len(G), 'time', round(time.time() - t0, 1), flush=True)\njson.dump({'G': [str(g) for g in G]}, open('work/selmer_%s_G.json' % case, 'w'))\n# ---- the prime 2: brute force with exact local-square tests\npr2 = pari.idealprimedec(nf, 2)\nprint('primes above 2:', [(int(pr[2]), int(pr[3])) for pr in pr2], flush=True)\nassert len(pr2) == 1\nP2 = pr2[0]\ndef prod_subset(mask):\n r = one\n for i in range(N):\n if (mask >> i) & 1: r = mul(r, cands[i])\n return r\nGel = [prod_subset(g) for g in G]\nlocpts = [(0, 0), (1, 398796270), (1, 823490285)] if case == '4564' else None\nif len(sys.argv) > 3:\n locpts = json.loads(sys.argv[3])\n# own Hensel lifting of the local points to 2^60\ndef hensel(u, z0, prec=60):\n mod = 2**prec; z = z0\n for _ in range(80):\n F = (sgn*z**4 + u**3 + u**2 + z) % mod\n dF = (4*sgn*z**3 + 1) % mod\n z = (z - F * pow(dF, -1, mod)) % mod\n assert (sgn*z**4 + u**3 + u**2 + z) % mod == 0\n return z\nlp = []\nfor (u, z) in locpts:\n zz = hensel(u, z % 4) if u != 0 or z != 0 else 0\n if (u, z) != (0, 0) and z >= 4:\n assert zz % 2**30 == z % 2**30, ('local point mismatch', u, z, zz % 2**30)\n lp.append(hval(u, zz))\n print('local point u=%d z=%d (2^60 lift) v_p(h)=%s' % (u, zz, [int(pari.nfeltval(nf, hval(u, zz), P2))]), flush=True)\n\n# 2-adic square-class coordinates: (v mod 2, unit part in (O/p^19)^*/squares) via ideallog\npi0 = P2[1]\nassert int(pari.nfeltval(nf, pi0, P2)) == 1\ne2 = int(P2[2]); modulus = pari.idealpow(nf, P2, 2*e2 + 1)\nbid = pari.idealstar(nf, modulus, 1)\ncyc = [int(cc) for cc in bid[1][1]]\nevenidx = [i for i, cc in enumerate(cyc) if cc % 2 == 0]\nprint('(O/p^19)^* cyclic structure has', len(evenidx), 'even factors; local square-class dim =', len(evenidx) + 1, '(expected', 27 + 2, ')', flush=True)\ndef char2(a):\n v = int(pari.nfeltval(nf, a, P2))\n u = pari.nfeltmul(nf, a, pari.nfeltpow(nf, pi0, -v))\n den = pari.denominator(pari.Vec(u)) if False else pari.denominator(u)\n assert int(den) % 2 == 1\n u1 = pari.nfeltmul(nf, u, pari(den)**2)\n assert int(pari.nfeltval(nf, u1, P2)) == 0\n lg = pari.ideallog(nf, u1, bid)\n return [v & 1] + [int(lg[i]) & 1 for i in evenidx]\ndef issq2(a): return int(pari.nfislocalpower(nf, P2, a, 2)) == 1\nlpc = [bits_to_int(char2(a)) for a in lp]\nprint('local point images: rank', rank(lpc), flush=True)\n# cross-check char2 against PARI's nfislocalpower on the local points and pairwise products\nfor i in range(3):\n assert (lpc[i] == 0) == issq2(lp[i])\n for j in range(i+1, 3):\n assert ((lpc[i] ^ lpc[j]) == 0) == issq2(mul(lp[i], lp[j]))\nprint('char2 consistent with nfislocalpower on local points', flush=True)\nGc = [bits_to_int(char2(a)) for a in Gel]\nprint('char2 of G basis computed, time', round(time.time()-t0,1), flush=True)\n# subspace of span(G) mapping into W2\ndef subspace_into(gvecs, Wvecs, nbits):\n # return list of masks (over gvecs) forming a basis of {x : sum x_i g_i in span W}\n # linear map x -> (sum x_i g_i) mod W ; compute kernel via elimination\n # reduce each g_i modulo W basis (echelon)\n wb = {}\n for w in Wvecs:\n for pb, bv in wb.items():\n if (w >> pb) & 1: w ^= bv\n if w:\n pb = w.bit_length() - 1\n for k in list(wb):\n if (wb[k] >> pb) & 1: wb[k] ^= w\n wb[pb] = w\n def red(v):\n for pb in sorted(wb, reverse=True):\n if (v >> pb) & 1: v ^= wb[pb]\n return v\n rowsred = []; basis = []\n for i, g in enumerate(gvecs):\n v = red(g); comb = 1 << i\n for (pv, pc, pb) in rowsred:\n if (v >> pb) & 1: v ^= pv; comb ^= pc\n if v: rowsred.append((v, comb, v.bit_length() - 1))\n else: basis.append(comb)\n return basis\nK2 = subspace_into(Gc, lpc, 30)\nprint('dimension after 2-adic condition:', len(K2), flush=True)\ndef combine(vecs, mask):\n r = 0\n for i, v in enumerate(vecs):\n if (mask >> i) & 1: r ^= v\n return r\nfinal = K2\nif case == '4569':\n pr5 = pari.idealprimedec(nf, 5)\n print('primes above 5:', [(int(pr[2]), int(pr[3])) for pr in pr5], flush=True)\n mp5 = [modpr_init(pr) for pr in pr5]\n def char5(a):\n out = []\n for pr, mp in zip(pr5, mp5):\n v = int(pari.nfeltval(nf, a, pr))\n ua = pari.nfeltmul(nf, a, pari(5)**(-v))\n out += [v & 1, qchar(ua, mp)]\n return out\n mod = 5**80; zz = 4\n for _ in range(400):\n F = (-zz**4 + 2 + zz) % mod\n if F == 0: break\n dF = (-4*zz**3 + 1); vd = 0\n while dF % 5 == 0: dF //= 5; vd += 1\n zz = (zz - (F // 5**vd) * pow(dF, -1, mod)) % mod\n Fv = (-zz**4 + 2 + zz) % mod\n print('5-adic u=1 point: z mod 25 =', zz % 25, ' residual zero mod 5^80:', Fv == 0, flush=True)\n v5 = char5(hval(1, zz))\n print('5-adic character vector (val,res per prime) of u=1 point:', v5, flush=True)\n # also: images of all F_5-liftable smooth points (sanity: should lie in span(v5))\n G5 = [bits_to_int(char5(a)) for a in Gel]\n K2v = [combine(G5, mk) for mk in K2]\n K5 = subspace_into(K2v, [bits_to_int(v5)], 10)\n print('dimension after 5-adic condition (image = line of u=1 point):', len(K5), flush=True)\n # check other 5-adic points' images lie in span(v5): smooth F_5 points lifted\n others = []\n for u in range(5):\n for z in range(5):\n if (-z**4 + u**3 + u**2 + z) % 5 == 0 and (u, z) != (1, 4):\n zz2 = z; uu2 = u\n if (-4*z**3 + 1) % 5:\n for _ in range(100):\n zz2 = (zz2 - ((-zz2**4 + u**3 + u**2 + zz2) * pow(-4*zz2**3 + 1, -1, mod))) % mod\n else:\n for _ in range(100):\n uu2 = (uu2 - ((-z**4 + uu2**3 + uu2**2 + z) * pow(3*uu2**2 + 2*uu2, -1, mod))) % mod\n assert (-zz2**4 + uu2**3 + uu2**2 + zz2) % mod == 0\n others.append(((u, z), char5(hval(uu2, zz2))))\n print('images of lifts of smooth F_5 points:', [(pt, bits_to_int(c) in (0, bits_to_int(v5))) for pt, c in others], flush=True)\n final = [combine(K2, mk) for mk in K5] # masks over G\n# images of the two generators: is each in the final group? Use injective character map on K(S,2)\nextra_pr = []\npp = 101\nwhile len(extra_pr) < len(extra):\n pp = int(pari.nextprime(pp + 1))\n if pp in (601, 857, 17, 1289): continue\n for pr in pari.idealprimedec(nf, pp):\n if int(pr[3]) == 1 and int(pr[2]) == 1: extra_pr.append(pr)\nextra_pr = extra_pr[:len(extra)]\ndef qchar_adj(a, mp, pr):\n v = int(pari.nfeltval(nf, a, pr))\n assert v % 2 == 0, 'odd valuation outside S'\n return qchar(pari.nfeltmul(nf, a, pari(int(pr[0]))**(-v)), mp)\nallchar = lambda a: [int(pari.nfeltval(nf, a, pr)) & 1 for pr in Sids] + [qchar_adj(a, mp, pr) for mp, pr in zip(extra, extra_pr)]\ncandch = [bits_to_int(allchar(cnd)) for cnd in cands]\ndef in_span(vecs, t):\n return rank(vecs + [t]) == rank(vecs)\nif case == '4564':\n known = [('P0', hval(0, 0)), ('P1', hval(0, -1)), ('A', hval(-1, 0)), ('B', hval(-1, -1)), ('R', hval(-3, 2))]\nelse:\n known = [('(0,1)', hval(0, 1)), ('(1,-1)', hval(1, -1)), ('(0,0)', hval(0, 0)), ('(-1,0)', hval(-1, 0)), ('(-1,1)', hval(-1, 1)), ('(6,4)', hval(6, 4))]\n# final group elements as global character vectors\ndef Gmask_to_cand(mask):\n r = 0\n for i, g in enumerate(G):\n if (mask >> i) & 1: r ^= g\n return r\nfinalch = [combine(candch, Gmask_to_cand(mk)) for mk in final]\nfor kname, kv in known:\n nn = pari.nfeltnorm(nf, kv)\n kc = bits_to_int(allchar(kv))\n print('known point %s: norm square>0: %s ; image in K(S,2) span: %s ; image in final Selmer-type group: %s' %\n (kname, bool(nn > 0 and pari.issquare(nn)), in_span(candch, kc), in_span(finalch, kc)), flush=True)\nk0 = bits_to_int(allchar(known[0][1])); k1 = bits_to_int(allchar(known[1][1]))\nprint('images of', known[0][0], known[1][0], 'independent mod squares:', rank([k0, k1]) == 2, ' final dim:', len(final), flush=True)\nprint('total time', round(time.time()-t0,1))\n" }, { "path": "anc/code/1.1.6/1.1.6a_transport.gp", "size_bytes": 1412, "sha256": "c928f233d7f16c77affaeb93e6820130ac536606a4e31ab20d27e8583003028e", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ transport identities and solution sets\nF4564(x,y) = x^4+y^3+y^2+x;\nM4564(u,v) = v^4+u^3+u^2+v;\nF4569(x,y) = x^4+y^3-y^2+x;\nM4569(u,v) = -v^4+u^3+u^2+v;\nprint(\"4564: F(v,u) == M(u,v): \", F4564(v,u) == M4564(u,v));\nprint(\"4569: F(-v,-u) == -M(u,v): \", F4569(-v,-u) == -M4569(u,v));\nS1 = [[-1,-1],[-1,0],[0,-1],[0,0],[2,-3]]; P1 = [[0,0],[0,-1],[-1,0],[-1,-1],[-3,2]]; \\\\ (u,z) source points\nprint(\"4564 target set satisfies F: \", vector(#S1,i,F4564(S1[i][1],S1[i][2])));\nprint(\"4564 source points mapped (x,y)=(z,u): \", Set(vector(#P1,i,[P1[i][2],P1[i][1]])) == Set(S1));\nS2 = [[-4,-6],[-1,0],[-1,1],[0,0],[0,1],[1,-1]]; P2 = [[1,-1],[-1,0],[0,0],[-1,1],[0,1],[6,4]];\nprint(\"4569 target set satisfies F: \", vector(#S2,i,F4569(S2[i][1],S2[i][2])));\nprint(\"4569 source points mapped (x,y)=(-z,-u): \", Set(vector(#P2,i,[-P2[i][2],-P2[i][1]])) == Set(S2));\nprint(\"4569 boxed set at TeX 5190 satisfies TARGET F? \", vector(#P2,i,F4569(P2[i][1],P2[i][2])));\n\\\\ divisor identities: substitute and factor\nC1 = u^3+u^2+z^4+z; C2 = u^3+u^2-z^4+z;\nprint(\"4564 u=-z-1: \", factor(subst(C1,u,-z-1)), \" z=0: \", factor(subst(C1,z,0)), \" z=-1: \", factor(subst(C1,z,-1)));\nprint(\"4569 u=-z: \", factor(subst(C2,u,-z)), \" z=0: \", factor(subst(C2,z,0)), \" z=1: \", factor(subst(C2,z,1)));\nprint(\"Res(81z+16,4z^3+1)=\", polresultant(81*z+16,4*z^3+1), \" Res(81z+16,4z^3-1)=\", polresultant(81*z+16,4*z^3-1), \" \", factor(547825));\n" }, { "path": "anc/code/1.1.6/1.1.6bc_classgroup.sh", "size_bytes": 847, "sha256": "f07be7cc07cfd946d62134bc241ab49d6141f1f5bfd666d8bbbeb108a2267186", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/sh\n# 1.1.6b and 1.1.6c with the shared tools in code/common/h31_classgroup (FULL run; see README).\n# Large files go to work/ (not in the bundle). W = number of worker processes.\nset -e\ncd \"$(dirname \"$0\")\"\nCG=../common/h31_classgroup\nPRM=data/classgroup_params.json\nW=${W:-1}\nmkdir -p work\necho \"== 1.1.6b: generators of all prime ideals of norm <= principal_bound (bnfinit only proposes)\"\npython3 $CG/witnesses.py $PRM --direct --workers $W --out work/generators.jsonl.gz\necho \"== 1.1.6b: exact check against an independent list of the prime ideals\"\npython3 $CG/check_witnesses.py $PRM work/generators.jsonl.gz\necho \"== 1.1.6c: all prime ideals of norm < e^T, and the one-cell bound B_0 (without the small exponential terms)\"\npython3 $CG/count_ideals.py $PRM --out work/counts.npz\npython3 $CG/bound.py $PRM work/counts.npz --no-exp-terms\n" }, { "path": "anc/code/1.1.6/1.1.6c_B0.gp", "size_bytes": 705, "sha256": "8301fe95770f39a0b4ad16d4b34fa4f1f138813d7f89df6cfd03e6538c3d8330", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 400000000); default(realprecision, 60);\nf = x^27-160*x^19-1344*x^18+1280*x^15-3840*x^11+23552*x^10-40704*x^9+4096*x^7-8192*x^6-4096*x-4096;\nnf = nfinit([f, [2,3,601,857]]);\nDf=poldisc(f); print(factor(Df,10^6)); n=27; a = nf.sign[1]/n; T=13; D=abs(nf.disc); eT=exp(T);\nS=0.; cnt=0; terms=0;\n{\nforprime(p=2, 450000,\n if(p<=700 || Df%p==0, my(dec=idealprimedec(nf,p)); L=apply(P->p^P.f, dec), L=vector(#polrootsmod(f,p), i, p));\n for(i=1,#L, N=L[i]; if(N<=450000, cnt++); m=1; while(N^m < eT, S += log(N)/(N^m+1)*(1-m*log(N)/T); terms++; m++)));\n}\nB0 = Euler + log(4*Pi) + a - Pi^2/(4*T) - 2*a*log(2)/T - log(D)/n + 4*S/n;\nprint(\"ideals<=450000: \", cnt, \" terms \", terms, \" B0 = \", B0);\n" }, { "path": "anc/code/1.1.6/1.1.6d_logs.gp", "size_bytes": 56, "sha256": "4afc40ecd59c1a00f17b532e9ec53c40a1ba1dcec7c0f729167eb051db38647f", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "sg = 1; pts = [0, -1]; mm = 35;\nread(\"tinylog_run.gp\");\n" }, { "path": "anc/code/1.1.6/1.1.6df_counts.gp", "size_bytes": 170, "sha256": "5a5dda4f6cbc65df53d7348d19fed3641ee90928e04c7966220ab4217068ea37", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "read(\"count.gp\");\nr = Lpoly(1, 2); print(\"4564 p=2: \", r[1], \" #J=\", r[3]);\nr = Lpoly(1, 23); print(\"4564 p=23: \", r[1], \" L=\", r[2], \" #J=\", r[3], \" = \", factor(r[3]));\n" }, { "path": "anc/code/1.1.6/1.1.6e_zero_tree.gp", "size_bytes": 2075, "sha256": "0d932b0513cb1ddd32025b5469d93317591e7d01728374f2efc3fddb0a0a84b8", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "read(\"tinylog.gp\");\nUU = varlower(\"UU\"); s;\nsg = 1; pts = [0, -1]; mm = 35;\nread(\"tinylog_run.gp\");\nread(\"chab2.gp\");\nL0 = logD[1]; L1 = logD[2];\ncr = [L0[2]*L1[3]-L0[3]*L1[2], L0[3]*L1[1]-L0[1]*L1[3], L0[1]*L1[2]-L0[2]*L1[1]];\nvc = vecmin(apply(c->valuation(c,2), cr));\nprint(\"cross product common valuation: \", vc);\na = cr / 2^vc; a = a / a[1];\nprint(\"primitive annihilator normalized a0=1, mod 2^24: \", apply(c->lift(Mod(truncate(c),2^24)), a));\nprint(\"their a (mod 2^22) normalized: \", lift(Mod([699041,3772347,3371045],2^22)/699041), \" their lift mod 2^24 normalized: \", lift(Mod([699041,7966651,11759653],2^24)/699041));\nprint(\"a . L0, a . L1 valuations: \", valuation(a*L0~,2), \" \", valuation(a*L1~,2));\n\\\\ half-log matrix (first two coordinates)\nM = [L0[1]/2, L1[1]/2; L0[2]/2, L1[2]/2];\nprint(\"half-log vectors mod 2: \", apply(c->lift(Mod(truncate(c),2)), L0/2), \" \", apply(c->lift(Mod(truncate(c),2)), L1/2), \" det(first two rows) valuation: \", valuation(matdet(M),2));\nMinv = M^(-1);\ndisks = [[0, 0, 0, L0, \"P0\"], [0, 0, -1, L1, \"P1\"], [0, -1, 0, -2*L0, \"A\"], [0, -1, -1, -2*L1, \"B\"], [1, 0, 0, [0,0,0], \"inf\"]];\ntot = 0;\n{\nfor(i=1, #disks,\n D = disks[i];\n Iv = if(D[1]==0, serfin(sg, D[2], D[3]), serinf(sg));\n Gs = a * Iv~; \\\\ series in t\n P = subst(truncate(Gs), t, 2*s);\n P = P + O(2^60); \\\\ coefficientwise: make padic\n P = Pol(apply(c->c + O(2^50), Vec(P)), s);\n out = balls(P, 0, 0, 0);\n nz = sum(k=1, #out, out[k][4]);\n tot += nz;\n print(\"disk \", D[5], \": balls \", Vec(out), \" zeros: \", nz);\n for(k=1, #out, if(out[k][4] == 1,\n sv = refine(P, out[k][1], out[k][2]);\n tv = 2*sv;\n Lq = D[4] + evalI(Iv, tv);\n cc = Minv * [Lq[1]/2, Lq[2]/2]~;\n c0 = lift(Mod(truncate(cc[1]), 2^11)); c1 = lift(Mod(truncate(cc[2]), 2^11));\n print(\" zero s mod 2^14 = \", lift(Mod(truncate(sv), 2^14)), \" (c0,c1) mod 128 = (\", c0%128, \",\", c1%128, \") 70c0+c1 mod 128 = \", (70*c0+c1)%128,\n \" third-coordinate consistency v2(L - c0 L0 - c1 L1) = \", valuation(Lq - cc[1]*L0 - cc[2]*L1, 2))));\n);\nprint(\"total zeros: \", tot);\n}\n" }, { "path": "anc/code/1.1.6/1.1.6f_sieve23.py", "size_bytes": 2025, "sha256": "349a1bb0bc5ed0e905373b38dca41061c68b25a24e8c693803ac97fce691a29e", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent finite-field Jacobian computations (Sage function-field Jacobian, Hess model).\n# usage: sieve_sage.py case p\nimport sys, time, json\nt0 = time.time()\nfrom sage.all__sagemath_schemes import *\ncase, p = sys.argv[1], int(sys.argv[2])\nsg = 1 if case == '4564' else -1\nk = GF(p)\nK = FunctionField(k, 'x'); x = K.gen() # x = z\nR = PolynomialRing(K, 'Y'); Y = R.gen()\nL = K.extension(Y**3 + Y**2 + sg*x**4 + x, 'y'); y = L.gen() # y = u\npls = L.places(1)\ninf = [P for P in pls if P.is_infinite_place()]\nassert len(inf) == 1; inf = inf[0]\ndef coords(P):\n if P.is_infinite_place(): return None\n a = [c for c in k if (x - c).valuation(P) > 0][0]\n b = [c for c in k if (y - c).valuation(P) > 0][0]\n return (int(a), int(b)) # (z, u)\npts = {coords(P): P for P in pls}\nprint('#C(F_p) =', len(pls), flush=True)\nJ = L.jacobian().group()\ndef cls(P): return J.point(P.divisor() - inf.divisor()) if P is not inf else J.point(L.divisor_group().zero())\ndef place_zu(zz, uu): return pts[(zz % p, uu % p)]\nout = {}\nif case == '4564':\n D0 = cls(place_zu(0, 0)); D1 = cls(place_zu(-1, 0)) # P0=(u,z)=(0,0), P1=(0,-1)\n N = 11392; odd = 89\n assert N * D0 == J.zero() and N * D1 == J.zero()\n H1 = odd * D1; H0 = odd * D0\n order = next(2**e for e in range(8) if (2**e) * H1 == J.zero())\n print('order of H1 = 89*D1:', order, flush=True)\n mults = [J.zero()]\n for i in range(1, order): mults.append(mults[-1] + H1)\n k0 = [i for i in range(order) if mults[i] == H0]\n print('H0 = k*H1 with k =', k0, flush=True)\n Rset = []\n for P in pls:\n c = odd * cls(P)\n ks = [i for i in range(order) if mults[i] == c]\n assert len(ks) == 1\n Rset.append(ks[0])\n print('R =', sorted(set(Rset)), flush=True)\n their = {0,1,2,4,6,8,23,24,33,35,52,58,70,99,101,116,117,126,127}\n print('matches supplied R:', set(Rset) == their, flush=True)\n for v in [44, 11, 31, 104]:\n print('extra-zero value', v, 'in R:', v in set(Rset))\nprint('time', time.time() - t0)\n" }, { "path": "anc/code/1.1.6/chab2.gp", "size_bytes": 1639, "sha256": "a5163e56626650e0195aacd5fffb6673b3c9a58548a1892882b93bb3e8b489f4", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent dyadic Chabauty zero computation (4564). Requires L0, L1 (logs of D0,D1) as 2-adic vectors.\n\\\\ disks: list of [type, uc, zc, logcentre]; type 0 = finite chart (param t=u-uc), 1 = infinity chart (t=z/u)\nNS = 120;\nserfin(sg, uc, zc) = {\n my(Z = zser(sg, uc, zc, NS+2), den = 4*sg*Z^3+1);\n vector(3, j, intformal([-1/den, -Z/den, -(uc+t)/den][j]))\n};\nserinf(sg) = {\n my(W = O(t^(NS+2)), Gw);\n for(k=1, 40, W = -(W^2 + t*W^3 + sg*t^4) + O(t^(NS+2))); \\\\ w + w^2 + t w^3 + sg t^4 = 0 (sg=+1: 4564)\n Gw = 1 + 2*W + 3*t*W^2;\n vector(3, j, intformal([-W/Gw, -t/Gw, -1/Gw][j]))\n};\n\\\\ evaluate integrated vector series at t value (padic)\nevalI(I, tv) = vector(3, j, subst(truncate(I[j]), t, tv));\n\\\\ valuation of padic, with precision handling\npv(c) = if(c == 0, padicprec(c, 2), valuation(c, 2));\n\\\\ recursive ball analysis of P(s) on s = c + 2^d r\nballs(P, c, d, depth) = {\n my(Q = subst(P, s, c + 2^d * s), co, vs, mn, N);\n co = Vecrev(Q);\n vs = vector(#co, k, pv(co[k]));\n mn = vecmin(vs);\n N = 0; for(k=1, #co, if(vs[k] == mn, N = k-1));\n for(k=1,#co, if(co[k]==0 && padicprec(co[k],2) <= mn, error(\"precision insufficient at ball \", c, \" \", d)));\n if(N == 0, return([[c, d, mn, 0]]));\n if(N == 1, return([[c, d, mn, 1]]));\n if(depth > 12, error(\"too deep\"));\n concat(balls(P, c, d+1, depth+1), balls(P, c + 2^d, d+1, depth+1));\n};\n\\\\ Newton refine root in ball\nrefine(P, c, d) = {\n my(Q = subst(P, s, c + 2^d * s), mn, rv = 0, dQ);\n mn = vecmin(apply(x->pv(x), Vecrev(Q)));\n Q = Q / 2^mn; dQ = deriv(Q, s);\n rv = 0 + O(2^40);\n for(k=1, 60, rv = rv - subst(Q, s, rv)/subst(dQ, s, rv));\n c + 2^d * rv\n};\n" }, { "path": "anc/code/1.1.6/count.gp", "size_bytes": 877, "sha256": "ad30e39fd94493af17cca263f3ec6bdc10d53d99da9818a2753cd6eb123fd986", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ point counts over F_{p^k}, k=1..3, for u^3+u^2+sg*z^4+z=0 (+1 point at infinity), L-polynomial, #J(F_p)\ncnt(sg, p, k) = {\n my(T = ffinit(p, k, 'a), g = ffgen(T, 'a), N = 1, c, rts, elts);\n elts = if(k == 1, vector(p, i, (i-1)*g^0), vector(p^k, i, my(v = digits(i-1+p^k, p)); sum(j=2, k+1, v[j]*g^(j-2))));\n for(i=1, #elts, my(zz = elts[i]); c = sg*zz^4 + zz;\n rts = polrootsmod(Pol([1, 1, 0, 0]) + c, [p, T]); \\\\ u^3+u^2+c\n N += #rts);\n N\n};\nLpoly(sg, p) = {\n my(N = vector(3, k, cnt(sg, p, k)), S = vector(3, k, p^k + 1 - N[k]), a = vector(3));\n \\\\ Newton: S_k power sums of Frobenius roots (alpha), L(T) = prod(1 - alpha T) = 1 + a1 T + a2 T^2 + ...\n a[1] = -S[1];\n a[2] = -(S[2] + a[1]*S[1])/2;\n a[3] = -(S[3] + a[1]*S[2] + a[2]*S[1])/3;\n my(L = 1 + a[1]*'T + a[2]*'T^2 + a[3]*'T^3 + p*a[2]*'T^4 + p^2*a[1]*'T^5 + p^3*'T^6);\n [N, L, subst(L, 'T, 1)]\n};\n" }, { "path": "anc/code/1.1.6/tinylog.gp", "size_bytes": 1232, "sha256": "eaf854accc12481cdf83509037f4993986c569ee3d5306134487a5de5303661a", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent dyadic tiny-log computation for 4564 (sg=+1) and 4569 (sg=-1).\n\\\\ Curve: u^3+u^2+sg*z^4+z = 0; omega = (1,z,u) dz/F_u = -(1,z,u) du/F_z.\ndefault(realprecision, 50); u; z; t;\nFc(sg) = u^3+u^2+sg*z^4+z;\n\\\\ implicit z(t) at center (uc,zc), u = uc + t, F_z(uc,zc) must be a unit\nzser(sg, uc, zc, N) = {\n my(Z = zc + O(t^N), G);\n for(k=1, ceil(log(N)/log(2))+3,\n G = subst(subst(Fc(sg), u, uc + t + O(t^N)), z, Z);\n Z = Z - G/(4*sg*Z^3+1));\n Z\n};\n\\\\ integrated differential vector (series in t) at center\nintser(sg, uc, zc, N) = {\n my(Z = zser(sg, uc, zc, N), den = 4*sg*Z^3+1, w);\n w = [-1/den, -Z/den, -(uc+t)/den];\n vector(3, j, intformal(w[j]))\n};\n\\\\ principal function h in L((m+3)inf) vanishing to order m at P=(0,zP) (u is a local parameter there)\nhfun(sg, zP, m) = {\n my(N = m + 2, Z = zser(sg, 0, zP, N), mons = List(), M, ker, h);\n for(b=0,2, for(a=0, (m+3-4*b)\\3, listput(mons, [a,b])));\n M = matrix(m, #mons, i, j, polcoeff(Z^mons[j][1] * t^mons[j][2] + O(t^N), i-1));\n ker = matker(M);\n if(#ker != 1, error(\"kernel dim \", #ker));\n h = sum(j=1, #mons, ker[j,1] * z^mons[j][1] * u^mons[j][2]);\n h = h / content(h);\n my(ser = subst(subst(h, u, t), z, Z));\n [h, valuation(ser, t), #mons]\n};\n" }, { "path": "anc/code/1.1.6/tinylog_run.gp", "size_bytes": 2810, "sha256": "f3540144d6c50063833e0f01d024e401472e0a37e42927acb99876c3814a83db", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ usage: set sg, pts (list of [zP]), m, centers (list of [uc,zc]) before reading\nread(\"tinylog.gp\");\nUU = varlower(\"UU\"); tmpz = z; tmpt = t;\nK = 90; \\\\ 2-adic working precision\nNser = 160;\nlogD = vector(#pts);\n{\nfor(ip=1, #pts,\n zP = pts[ip];\n H = hfun(sg, zP, mm);\n h = H[1];\n print(\"P=(0,\", zP, \"): #monomials=\", H[3], \" ord_P(h)=\", H[2], \" max |coeff| digits \", #Str(vecmax(abs(Vec(apply(x->content(x), Vec(h)))))));\n Nm = polresultant(Fc(sg), h, z);\n print(\" deg_u N(h) = \", poldegree(Nm, u), \" v_u(N(h)) = \", valuation(Nm, u));\n p = Nm / u^valuation(Nm,u); p = p/pollead(p);\n print(\" residual u-polynomial p(U) = \", p, \" irreducible over Q: \", polisirreducible(p));\n print(\" p mod 2 = \", Mod(1,2)*p, \" (integral at 2: \", vecmin(apply(c->valuation(c,2), Vec(p))) >= 0, \")\");\n \\\\ z on the residual divisor: gcd in Q[U]/(p)\n pU = subst(p, u, UU); g = gcd(subst(Fc(sg), u, Mod(UU, pU)), subst(h, u, Mod(UU, pU)));\n if(poldegree(g, z) != 1, error(\"gcd not linear\"));\n zE = -polcoeff(g, 0, z)/polcoeff(g, 1, z);\n zE = subst(lift(zE), UU, u); print(\" z on E as polynomial in u: \", zE, \" ; coefficients' 2-valuations \", apply(c->valuation(c,2), Vec(zE)));\n \\\\ 2-adic factorization of p\n fp = factorpadic(p, 2, K);\n print(\" 2-adic factor degrees: \", apply(poldegree, fp[,1]~));\n tot = [0,0,0];\n for(k=1, #fp[,1],\n q = fp[k,1]; q = q/pollead(q);\n \\\\ decide centre by reduction of the roots: u mod 2 and z mod 2\n q2 = Mod(1,2)*apply(c->truncate(c), q);\n uc = if(polcoeff(q2,0)==0, 0, -1);\n \\\\ z coordinate parity on this factor: zE mod q\n zq = lift(Mod(zE, q));\n zc = if(vecmin(apply(c->valuation(c,2), Vec(zq + O(2^K)))) >= 1, 0, 1);\n if(uc==0 && zc==1, zc = if(sg==1,-1,1));\n if(uc==-1 && zc==1, zc = if(sg==1,-1,1));\n print(\" factor deg \", poldegree(q), \" centre (\", uc, \",\", zc, \") min v2 of z-coords poly: \", vecmin(apply(c->valuation(c,2), Vec(zq + O(2^K)))));\n Iv = intser(sg, uc, zc, Nser);\n \\\\ roots tau = U - uc of q: power sums via Newton\n qt = subst(q, u, u + uc); \\\\ polynomial in u whose roots are t = U - uc\n d = poldegree(qt); co = Vec(qt); \\\\ monic\n psum = vector(Nser+1);\n e = vector(d, i, (-1)^i * co[i+1]); \\\\ elementary symmetric\n for(n=1, Nser, psum[n] = (-1)^(n-1)*n*if(n<=d, e[n], 0) + sum(i=1, min(n-1,d), (-1)^(i-1)*e[i]*psum[n-i]));\n print(\" min valuation of roots ~ \", vecmin(vector(d, i, valuation(e[i],2)/i)));\n for(j=1,3, tot[j] += sum(n=1, Nser-1, polcoeff(Iv[j], n) * psum[n]));\n \\\\ check h vanishes on these points: sum over roots of h(t, z(t))^2? use norm-free check: reduce series mod q\n );\n logD[ip] = -tot/mm;\n print(\" log D (mod 2^30): \", apply(c -> lift(Mod(truncate(c + O(2^30)), 2^30)), logD[ip]));\n print(\" valuations: \", apply(c->valuation(c,2), logD[ip]));\n);\n}\n" }, { "path": "anc/code/1.1.7/1.1.7a_bitangent.gp", "size_bytes": 1383, "sha256": "06f1d2e27f78b2905ad94fc93dd4a509dc51a24b84e08eb69eea28a449ad7fcd", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ independent bitangent slope polynomial for both curves\ndefault(parisize, 400000000);\nbit(sgn) = {\n my(B,C,D,E,g1,g2,r,fa);\n \\\\ curve sgn*z^4 + u^3+u^2+z = 0, line u = m z + n\n B = m^3; C = m^2*(3*n+1); D = m*(3*n^2+2*n)+1; E = n^3+n^2;\n \\\\ sgn*z^4 + B z^3 + C z^2 + D z + E = sgn*(z^2+al z+be)^2\n \\\\ divide by sgn: z^4 + (B/sgn) z^3 + ...\n my(b=B/sgn,c=C/sgn,d=D/sgn,e=E/sgn);\n g1 = numerator(8*d - 4*b*c + b^3);\n g2 = numerator(64*e - (4*c-b^2)^2);\n r = polresultant(g1, g2, n);\n fa = factor(r);\n [r, fa]\n};\nF1 = bit(1); print(\"4564 resultant factorization degrees: \", apply(poldegree, F1[2][,1]~), \" mult \", F1[2][,2]~);\nF2 = bit(-1); print(\"4569 resultant factorization degrees: \", apply(poldegree, F2[2][,1]~), \" mult \", F2[2][,2]~);\nf1 = m^27-160*m^19-1344*m^18+1280*m^15-3840*m^11+23552*m^10-40704*m^9+4096*m^7-8192*m^6-4096*m-4096;\nf2 = m^27-160*m^19-1344*m^18-1280*m^15-3840*m^11+23552*m^10-40704*m^9-4096*m^7+8192*m^6-4096*m-4096;\nfor(i=1,#F1[2][,1], if(poldegree(F1[2][i,1])==27, print(\"4564 deg27 factor == claimed f: \", F1[2][i,1]==f1 || F1[2][i,1]==-f1)));\nfor(i=1,#F2[2][,1], if(poldegree(F2[2][i,1])==27, print(\"4569 deg27 factor == claimed f: \", F2[2][i,1]==f2 || F2[2][i,1]==-f2)));\nprint(\"irreducible: \", polisirreducible(f1), \" \", polisirreducible(f2));\nprint(\"signature (real roots): \", polsturm(f1), \" \", polsturm(f2));\nprint(F1[2]); print(F2[2]);\n" }, { "path": "anc/code/1.1.7/1.1.7a_field.gp", "size_bytes": 649, "sha256": "90c31d141882a011d96c4e3eb6975a870f00347d9eb8c11a32749fb9a8b2106e", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 800000000);\nf1 = x^27-160*x^19-1344*x^18+1280*x^15-3840*x^11+23552*x^10-40704*x^9+4096*x^7-8192*x^6-4096*x-4096;\nf2 = x^27-160*x^19-1344*x^18-1280*x^15-3840*x^11+23552*x^10-40704*x^9-4096*x^7+8192*x^6-4096*x-4096;\n{\nfor(k=1,2, f = if(k==1,f1,f2);\n d = poldisc(f);\n fa = factor(d, 10^7);\n print(\"case \",k,\": poldisc partial factorization: \", fa);\n \\\\ check that the cofactor is fully factored\n print(\" all factors prime? \", vector(#fa~, i, isprime(fa[i,1])));\n nf = nfinit([f, fa[,1]~]);\n print(\" nf disc = \", factor(nf.disc), \" sign=\", nf.sign, \" index=\", factor(nf.index));\n print(\" nfcertify: \", nfcertify(nf));\n);\n}\n" }, { "path": "anc/code/1.1.7/1.1.7a_normdim.py", "size_bytes": 869, "sha256": "d475f1344d0feed629d5997daf2d671d13ee760f9c3560b954ff5bdc22de5f3a", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import json, sys\nimport cypari2\npari = cypari2.Pari()\npari.allocatemem(400*10**6)\npath, primes = sys.argv[1], [int(x) for x in sys.argv[2].split(',')]\nd = json.load(open(path))\nf = pari('Pol([' + ','.join(reversed(d['field_polynomial_coefficients'])) + '])')\nf = pari.subst(f, 'x', 'y')\ngens = [pari('Mod(Pol([' + ','.join(reversed(c)) + ']),1)') for c in d['S_unit_candidates']]\nrows = []\nnorms = []\nfor c in d['S_unit_candidates']:\n pol = pari('Pol([' + ','.join(reversed(c)) + '],y)')\n n = pari.norm(pari.Mod(pol, f))\n norms.append(n)\nrows.append([int(n < 0) for n in norms])\nfor p in primes:\n rows.append([int(pari.valuation(n, p) % 2) for n in norms])\nM = pari.matrix(len(rows), len(norms), [x for r in rows for x in r])\nM = pari.Mod(M, 2)\nprint('n gens', len(norms), 'norm-condition rank', pari.matrank(M), 'kernel dim', len(norms) - pari.matrank(M))\n" }, { "path": "anc/code/1.1.7/1.1.7a_selmer.py", "size_bytes": 15605, "sha256": "097d520d00856d55d64c48497ceb0b2f33a20d21a49e8664f031e7b9e55f45db", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent recomputation of the 2-Selmer (fake descent) bound for 4564 / 4569.\n# Inputs taken from the supplied JSON: field poly (rechecked against our own resultant),\n# bitangent intercepts eta (rechecked exactly), and S-unit candidates (support and\n# independence rechecked here). All local images are recomputed with our own code.\nimport sys, json, time\nimport cypari2\npari = cypari2.Pari(); pari.allocatemem(3*10**9)\ncase, jfile = sys.argv[1], sys.argv[2]\nd = json.load(open(jfile))\nt0 = time.time()\nx = pari('x')\nf = sum(pari(c)*x**i for i, c in enumerate(d['field_polynomial_coefficients']))\nfown = {'4564': pari('x^27-160*x^19-1344*x^18+1280*x^15-3840*x^11+23552*x^10-40704*x^9+4096*x^7-8192*x^6-4096*x-4096'),\n '4569': pari('x^27-160*x^19-1344*x^18-1280*x^15-3840*x^11+23552*x^10-40704*x^9-4096*x^7+8192*x^6-4096*x-4096')}[case]\nassert f == fown, 'field poly mismatch'\nsgn = 1 if case == '4564' else -1 # curve: sgn*z^4 + u^3 + u^2 + z = 0\nSprimes = [2, 3] if case == '4564' else [2, 3, 5]\nfa = pari.factor(pari.poldisc(f), 10**7)\nnf = pari.nfinit([f, fa[0]]); assert len(pari.nfcertify(nf)) == 0\ndef el(coeffs):\n return pari.nfalgtobasis(nf, pari.Mod(sum(pari(c)*x**i for i, c in enumerate(coeffs)), f))\nm = pari.nfalgtobasis(nf, pari.Mod(x, f))\neta = el(d['bitangent_intercept_coefficients'])\nmul = lambda a, b: pari.nfeltmul(nf, a, b)\nadd = lambda a, b: pari.nfeltadd(nf, a, b)\nsc = lambda c, a: pari.nfeltmul(nf, pari(c), a)\none = pari.nfalgtobasis(nf, pari.Mod(1, f))\n# exact bitangent check\nB = pari.nfeltpow(nf, m, 3); m2 = pari.nfeltpow(nf, m, 2)\nC = mul(m2, add(sc(3, eta), one))\nDd = add(mul(m, add(sc(3, mul(eta, eta)), sc(2, eta))), one)\nE = add(pari.nfeltpow(nf, eta, 3), mul(eta, eta))\nb, c_, d_, e_ = [sc(sgn, t) for t in (B, C, Dd, E)]\ng1 = add(add(sc(8, d_), sc(-4, mul(b, c_))), pari.nfeltpow(nf, b, 3))\nq = add(sc(4, c_), sc(-1, mul(b, b)))\ng2 = add(sc(64, e_), sc(-1, mul(q, q)))\nprint('bitangent identities exact zero:', pari.nfeltnorm(nf, g1) == 0, pari.nfeltnorm(nf, g2) == 0, flush=True)\n# h = normalized bitangent function value: 4564: eta + m z - u ; 4569: u - m z - eta\ndef hval(u, z):\n base = add(sc(-u, one), add(sc(z, m), eta)) # eta + m z - u\n return base if case == '4564' else sc(-1, base)\ncands = [el(cc) for cc in d['S_unit_candidates']]\nN = len(cands); print('candidates', N, flush=True)\n# support\nSids = []\nfor p in Sprimes:\n for pr in pari.idealprimedec(nf, p): Sids.append(pr)\nprint('primes above S:', len(Sids), [(int(pr[0]), int(pr[2]), int(pr[3])) for pr in Sids], flush=True)\nfor i, cnd in enumerate(cands):\n fac = pari.idealfactor(nf, cnd)\n ps = set(int(pr[0]) for pr in fac[0])\n assert ps <= set(Sprimes), ('support', i, ps)\nprint('all candidates supported above S: OK', flush=True)\n# ---- characters\ndef bits_to_int(bits):\n return sum((int(bv) & 1) << k for k, bv in enumerate(bits))\ndef rank(vecs):\n basis = [] # list of (pivotbit, vec)\n r = 0\n piv = {}\n for v in vecs:\n for pb, bv in piv.items():\n if (v >> pb) & 1: v ^= bv\n if v:\n pb = v.bit_length() - 1\n # reduce existing\n for k in list(piv):\n if (piv[k] >> pb) & 1: piv[k] ^= v\n piv[pb] = v; r += 1\n return r\nval = [[int(pari.nfeltval(nf, cnd, pr)) & 1 for pr in Sids] for cnd in cands]\ndef modpr_init(pr): return pari.nfmodprinit(nf, pr)\ndef qchar(a, modpr):\n r = pari.nfmodpr(nf, a, modpr)\n if r == 0: return None\n return 0 if pari.issquare(r) else 1\n# independence: valuation characters + residue characters at good degree-1 primes\nextra = []\npp = 101\nwhile True:\n pp = int(pari.nextprime(pp + 1))\n if pp in (601, 857, 17, 1289): continue\n for pr in pari.idealprimedec(nf, pp):\n if int(pr[3]) == 1 and int(pr[2]) == 1:\n extra.append(modpr_init(pr))\n if len(extra) >= 60: break\nchars = [val[i] + [qchar(cnd, mp) for mp in extra] for i, cnd in enumerate(cands)]\n# matrix rank over F2: rows = candidates\nrows = [bits_to_int(r) for r in chars]\nprint('rank of candidates under valuation+residue characters:', rank(rows), 'of', N, flush=True)\n# ---- global constraints: kernel of linear map L: F2^N -> F2^k ; columns accumulate\ncols = [] # each constraint is a function: candidate index -> bit ; store as list of bit-vectors over candidates\ndef add_constraint(bitlist): # bitlist[i] = value of the linear functional on candidate i\n cols.append(bits_to_int(bitlist))\ndef kernel_dim():\n # rows r_i = vector of constraint values for candidate i; kernel of x -> sum x_i r_i\n Rows = []\n for i in range(N):\n Rows.append(sum(((cvec >> i) & 1) << j for j, cvec in enumerate(cols)))\n return N - rank(Rows)\ndef kernel_basis():\n Rows = []\n for i in range(N):\n Rows.append(sum(((cvec >> i) & 1) << j for j, cvec in enumerate(cols)))\n # Gaussian elimination keeping track of combinations\n aug = [(Rows[i], 1 << i) for i in range(N)]\n piv = []\n basis = []\n rowsred = []\n for v, comb in aug:\n for (pv, pc, pb) in rowsred:\n if (v >> pb) & 1: v ^= pv; comb ^= pc\n if v:\n rowsred.append((v, comb, v.bit_length() - 1))\n else:\n basis.append(comb)\n return basis\nnorms = [pari.nfeltnorm(nf, cnd) for cnd in cands]\nadd_constraint([1 if nn < 0 else 0 for nn in norms])\nfor p in Sprimes:\n add_constraint([int(pari.valuation(nn, p)) & 1 for nn in norms])\nprint('after norm conditions: dim', kernel_dim(), flush=True)\ngoodp = [487, 491, 499, 503, 509, 521, 523]\nfor p in goodp:\n prs = pari.idealprimedec(nf, p)\n assert all(int(pr[2]) == 1 for pr in prs)\n degs = sorted(int(pr[3]) for pr in prs)\n mps = [modpr_init(pr) for pr in prs]\n mbar = [pari.nfmodpr(nf, m, mp) for mp in mps]\n ebar = [pari.nfmodpr(nf, eta, mp) for mp in mps]\n # curve points over F_p\n pts = []\n for u in range(p):\n for z in range(p):\n if (sgn*z**4 + u**3 + u**2 + z) % p == 0: pts.append((u, z))\n imgs = []; ncontact = 0\n for (u, z) in pts:\n vec = []; zero = []\n for k in range(len(mps)):\n hv = (ebar[k] + mbar[k]*z - u) * sgn\n if hv == 0: zero.append(k); vec.append(0)\n else: vec.append(0 if pari.issquare(hv) else 1)\n if zero:\n assert len(zero) == 1 and degs and int(prs[zero[0]][3]) == 1, ('contact', p, u, z, zero)\n ncontact += 1\n vec[zero[0]] = sum(vec) & 1\n imgs.append(bits_to_int(vec))\n W = rank(imgs)\n # candidate residue characters at these primes\n cv = [[qchar(cnd, mp) for mp in mps] for cnd in cands]\n assert all(cc is not None for row in cv for cc in row)\n # constraint: char(x) in span(imgs). Compute complement functionals: annihilator of W in F2^k\n k = len(mps)\n # basis of W\n wb = []\n for v in imgs:\n for bv in wb:\n if (v ^ bv) < v: v ^= bv\n if v:\n wb.append(v); wb.sort(reverse=True)\n # annihilator: all a in F2^k with =0 for w in wb (k small: brute force)\n ann = [a for a in range(1, 1 << k) if all(bin(a & w).count('1') % 2 == 0 for w in wb)]\n annb = []\n for a in ann:\n if rank(annb + [a]) > len(annb): annb.append(a)\n for a in annb:\n add_constraint([sum(cv[i][j] for j in range(k) if (a >> j) & 1) & 1 for i in range(N)])\n print('p=%d #C(F_p)=%d (incl. inf) degrees=%s contacts=%d dim local image=%d -> remaining dim %d' %\n (p, len(pts) + 1, degs, ncontact, W, kernel_dim()), flush=True)\nG = kernel_basis()\nprint('remaining basis size', len(G), 'time', round(time.time() - t0, 1), flush=True)\njson.dump({'G': [str(g) for g in G]}, open('work/selmer_%s_G.json' % case, 'w'))\n# ---- the prime 2: brute force with exact local-square tests\npr2 = pari.idealprimedec(nf, 2)\nprint('primes above 2:', [(int(pr[2]), int(pr[3])) for pr in pr2], flush=True)\nassert len(pr2) == 1\nP2 = pr2[0]\ndef prod_subset(mask):\n r = one\n for i in range(N):\n if (mask >> i) & 1: r = mul(r, cands[i])\n return r\nGel = [prod_subset(g) for g in G]\nlocpts = [(0, 0), (1, 398796270), (1, 823490285)] if case == '4564' else None\nif len(sys.argv) > 3:\n locpts = json.loads(sys.argv[3])\n# own Hensel lifting of the local points to 2^60\ndef hensel(u, z0, prec=60):\n mod = 2**prec; z = z0\n for _ in range(80):\n F = (sgn*z**4 + u**3 + u**2 + z) % mod\n dF = (4*sgn*z**3 + 1) % mod\n z = (z - F * pow(dF, -1, mod)) % mod\n assert (sgn*z**4 + u**3 + u**2 + z) % mod == 0\n return z\nlp = []\nfor (u, z) in locpts:\n zz = hensel(u, z % 4) if u != 0 or z != 0 else 0\n if (u, z) != (0, 0) and z >= 4:\n assert zz % 2**30 == z % 2**30, ('local point mismatch', u, z, zz % 2**30)\n lp.append(hval(u, zz))\n print('local point u=%d z=%d (2^60 lift) v_p(h)=%s' % (u, zz, [int(pari.nfeltval(nf, hval(u, zz), P2))]), flush=True)\n\n# 2-adic square-class coordinates: (v mod 2, unit part in (O/p^19)^*/squares) via ideallog\npi0 = P2[1]\nassert int(pari.nfeltval(nf, pi0, P2)) == 1\ne2 = int(P2[2]); modulus = pari.idealpow(nf, P2, 2*e2 + 1)\nbid = pari.idealstar(nf, modulus, 1)\ncyc = [int(cc) for cc in bid[1][1]]\nevenidx = [i for i, cc in enumerate(cyc) if cc % 2 == 0]\nprint('(O/p^19)^* cyclic structure has', len(evenidx), 'even factors; local square-class dim =', len(evenidx) + 1, '(expected', 27 + 2, ')', flush=True)\ndef char2(a):\n v = int(pari.nfeltval(nf, a, P2))\n u = pari.nfeltmul(nf, a, pari.nfeltpow(nf, pi0, -v))\n den = pari.denominator(pari.Vec(u)) if False else pari.denominator(u)\n assert int(den) % 2 == 1\n u1 = pari.nfeltmul(nf, u, pari(den)**2)\n assert int(pari.nfeltval(nf, u1, P2)) == 0\n lg = pari.ideallog(nf, u1, bid)\n return [v & 1] + [int(lg[i]) & 1 for i in evenidx]\ndef issq2(a): return int(pari.nfislocalpower(nf, P2, a, 2)) == 1\nlpc = [bits_to_int(char2(a)) for a in lp]\nprint('local point images: rank', rank(lpc), flush=True)\n# cross-check char2 against PARI's nfislocalpower on the local points and pairwise products\nfor i in range(3):\n assert (lpc[i] == 0) == issq2(lp[i])\n for j in range(i+1, 3):\n assert ((lpc[i] ^ lpc[j]) == 0) == issq2(mul(lp[i], lp[j]))\nprint('char2 consistent with nfislocalpower on local points', flush=True)\nGc = [bits_to_int(char2(a)) for a in Gel]\nprint('char2 of G basis computed, time', round(time.time()-t0,1), flush=True)\n# subspace of span(G) mapping into W2\ndef subspace_into(gvecs, Wvecs, nbits):\n # return list of masks (over gvecs) forming a basis of {x : sum x_i g_i in span W}\n # linear map x -> (sum x_i g_i) mod W ; compute kernel via elimination\n # reduce each g_i modulo W basis (echelon)\n wb = {}\n for w in Wvecs:\n for pb, bv in wb.items():\n if (w >> pb) & 1: w ^= bv\n if w:\n pb = w.bit_length() - 1\n for k in list(wb):\n if (wb[k] >> pb) & 1: wb[k] ^= w\n wb[pb] = w\n def red(v):\n for pb in sorted(wb, reverse=True):\n if (v >> pb) & 1: v ^= wb[pb]\n return v\n rowsred = []; basis = []\n for i, g in enumerate(gvecs):\n v = red(g); comb = 1 << i\n for (pv, pc, pb) in rowsred:\n if (v >> pb) & 1: v ^= pv; comb ^= pc\n if v: rowsred.append((v, comb, v.bit_length() - 1))\n else: basis.append(comb)\n return basis\nK2 = subspace_into(Gc, lpc, 30)\nprint('dimension after 2-adic condition:', len(K2), flush=True)\ndef combine(vecs, mask):\n r = 0\n for i, v in enumerate(vecs):\n if (mask >> i) & 1: r ^= v\n return r\nfinal = K2\nif case == '4569':\n pr5 = pari.idealprimedec(nf, 5)\n print('primes above 5:', [(int(pr[2]), int(pr[3])) for pr in pr5], flush=True)\n mp5 = [modpr_init(pr) for pr in pr5]\n def char5(a):\n out = []\n for pr, mp in zip(pr5, mp5):\n v = int(pari.nfeltval(nf, a, pr))\n ua = pari.nfeltmul(nf, a, pari(5)**(-v))\n out += [v & 1, qchar(ua, mp)]\n return out\n mod = 5**80; zz = 4\n for _ in range(400):\n F = (-zz**4 + 2 + zz) % mod\n if F == 0: break\n dF = (-4*zz**3 + 1); vd = 0\n while dF % 5 == 0: dF //= 5; vd += 1\n zz = (zz - (F // 5**vd) * pow(dF, -1, mod)) % mod\n Fv = (-zz**4 + 2 + zz) % mod\n print('5-adic u=1 point: z mod 25 =', zz % 25, ' residual zero mod 5^80:', Fv == 0, flush=True)\n v5 = char5(hval(1, zz))\n print('5-adic character vector (val,res per prime) of u=1 point:', v5, flush=True)\n # also: images of all F_5-liftable smooth points (sanity: should lie in span(v5))\n G5 = [bits_to_int(char5(a)) for a in Gel]\n K2v = [combine(G5, mk) for mk in K2]\n K5 = subspace_into(K2v, [bits_to_int(v5)], 10)\n print('dimension after 5-adic condition (image = line of u=1 point):', len(K5), flush=True)\n # check other 5-adic points' images lie in span(v5): smooth F_5 points lifted\n others = []\n for u in range(5):\n for z in range(5):\n if (-z**4 + u**3 + u**2 + z) % 5 == 0 and (u, z) != (1, 4):\n zz2 = z; uu2 = u\n if (-4*z**3 + 1) % 5:\n for _ in range(100):\n zz2 = (zz2 - ((-zz2**4 + u**3 + u**2 + zz2) * pow(-4*zz2**3 + 1, -1, mod))) % mod\n else:\n for _ in range(100):\n uu2 = (uu2 - ((-z**4 + uu2**3 + uu2**2 + z) * pow(3*uu2**2 + 2*uu2, -1, mod))) % mod\n assert (-zz2**4 + uu2**3 + uu2**2 + zz2) % mod == 0\n others.append(((u, z), char5(hval(uu2, zz2))))\n print('images of lifts of smooth F_5 points:', [(pt, bits_to_int(c) in (0, bits_to_int(v5))) for pt, c in others], flush=True)\n final = [combine(K2, mk) for mk in K5] # masks over G\n# images of the two generators: is each in the final group? Use injective character map on K(S,2)\nextra_pr = []\npp = 101\nwhile len(extra_pr) < len(extra):\n pp = int(pari.nextprime(pp + 1))\n if pp in (601, 857, 17, 1289): continue\n for pr in pari.idealprimedec(nf, pp):\n if int(pr[3]) == 1 and int(pr[2]) == 1: extra_pr.append(pr)\nextra_pr = extra_pr[:len(extra)]\ndef qchar_adj(a, mp, pr):\n v = int(pari.nfeltval(nf, a, pr))\n assert v % 2 == 0, 'odd valuation outside S'\n return qchar(pari.nfeltmul(nf, a, pari(int(pr[0]))**(-v)), mp)\nallchar = lambda a: [int(pari.nfeltval(nf, a, pr)) & 1 for pr in Sids] + [qchar_adj(a, mp, pr) for mp, pr in zip(extra, extra_pr)]\ncandch = [bits_to_int(allchar(cnd)) for cnd in cands]\ndef in_span(vecs, t):\n return rank(vecs + [t]) == rank(vecs)\nif case == '4564':\n known = [('P0', hval(0, 0)), ('P1', hval(0, -1)), ('A', hval(-1, 0)), ('B', hval(-1, -1)), ('R', hval(-3, 2))]\nelse:\n known = [('(0,1)', hval(0, 1)), ('(1,-1)', hval(1, -1)), ('(0,0)', hval(0, 0)), ('(-1,0)', hval(-1, 0)), ('(-1,1)', hval(-1, 1)), ('(6,4)', hval(6, 4))]\n# final group elements as global character vectors\ndef Gmask_to_cand(mask):\n r = 0\n for i, g in enumerate(G):\n if (mask >> i) & 1: r ^= g\n return r\nfinalch = [combine(candch, Gmask_to_cand(mk)) for mk in final]\nfor kname, kv in known:\n nn = pari.nfeltnorm(nf, kv)\n kc = bits_to_int(allchar(kv))\n print('known point %s: norm square>0: %s ; image in K(S,2) span: %s ; image in final Selmer-type group: %s' %\n (kname, bool(nn > 0 and pari.issquare(nn)), in_span(candch, kc), in_span(finalch, kc)), flush=True)\nk0 = bits_to_int(allchar(known[0][1])); k1 = bits_to_int(allchar(known[1][1]))\nprint('images of', known[0][0], known[1][0], 'independent mod squares:', rank([k0, k1]) == 2, ' final dim:', len(final), flush=True)\nprint('total time', round(time.time()-t0,1))\n" }, { "path": "anc/code/1.1.7/1.1.7a_transport.gp", "size_bytes": 1412, "sha256": "c928f233d7f16c77affaeb93e6820130ac536606a4e31ab20d27e8583003028e", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ transport identities and solution sets\nF4564(x,y) = x^4+y^3+y^2+x;\nM4564(u,v) = v^4+u^3+u^2+v;\nF4569(x,y) = x^4+y^3-y^2+x;\nM4569(u,v) = -v^4+u^3+u^2+v;\nprint(\"4564: F(v,u) == M(u,v): \", F4564(v,u) == M4564(u,v));\nprint(\"4569: F(-v,-u) == -M(u,v): \", F4569(-v,-u) == -M4569(u,v));\nS1 = [[-1,-1],[-1,0],[0,-1],[0,0],[2,-3]]; P1 = [[0,0],[0,-1],[-1,0],[-1,-1],[-3,2]]; \\\\ (u,z) source points\nprint(\"4564 target set satisfies F: \", vector(#S1,i,F4564(S1[i][1],S1[i][2])));\nprint(\"4564 source points mapped (x,y)=(z,u): \", Set(vector(#P1,i,[P1[i][2],P1[i][1]])) == Set(S1));\nS2 = [[-4,-6],[-1,0],[-1,1],[0,0],[0,1],[1,-1]]; P2 = [[1,-1],[-1,0],[0,0],[-1,1],[0,1],[6,4]];\nprint(\"4569 target set satisfies F: \", vector(#S2,i,F4569(S2[i][1],S2[i][2])));\nprint(\"4569 source points mapped (x,y)=(-z,-u): \", Set(vector(#P2,i,[-P2[i][2],-P2[i][1]])) == Set(S2));\nprint(\"4569 boxed set at TeX 5190 satisfies TARGET F? \", vector(#P2,i,F4569(P2[i][1],P2[i][2])));\n\\\\ divisor identities: substitute and factor\nC1 = u^3+u^2+z^4+z; C2 = u^3+u^2-z^4+z;\nprint(\"4564 u=-z-1: \", factor(subst(C1,u,-z-1)), \" z=0: \", factor(subst(C1,z,0)), \" z=-1: \", factor(subst(C1,z,-1)));\nprint(\"4569 u=-z: \", factor(subst(C2,u,-z)), \" z=0: \", factor(subst(C2,z,0)), \" z=1: \", factor(subst(C2,z,1)));\nprint(\"Res(81z+16,4z^3+1)=\", polresultant(81*z+16,4*z^3+1), \" Res(81z+16,4z^3-1)=\", polresultant(81*z+16,4*z^3-1), \" \", factor(547825));\n" }, { "path": "anc/code/1.1.7/1.1.7bc_classgroup.sh", "size_bytes": 847, "sha256": "8e445aa6cf2d063d58ff7efcd6dbe66b82eb998675c6685b305067e35b3a2515", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/sh\n# 1.1.7b and 1.1.7c with the shared tools in code/common/h31_classgroup (FULL run; see README).\n# Large files go to work/ (not in the bundle). W = number of worker processes.\nset -e\ncd \"$(dirname \"$0\")\"\nCG=../common/h31_classgroup\nPRM=data/classgroup_params.json\nW=${W:-1}\nmkdir -p work\necho \"== 1.1.7b: generators of all prime ideals of norm <= principal_bound (bnfinit only proposes)\"\npython3 $CG/witnesses.py $PRM --direct --workers $W --out work/generators.jsonl.gz\necho \"== 1.1.7b: exact check against an independent list of the prime ideals\"\npython3 $CG/check_witnesses.py $PRM work/generators.jsonl.gz\necho \"== 1.1.7c: all prime ideals of norm < e^T, and the one-cell bound B_0 (without the small exponential terms)\"\npython3 $CG/count_ideals.py $PRM --out work/counts.npz\npython3 $CG/bound.py $PRM work/counts.npz --no-exp-terms\n" }, { "path": "anc/code/1.1.7/1.1.7c_B0.gp", "size_bytes": 756, "sha256": "cf4d2a26afbe9ebd28658e84b59b53eb72b10b5e13a3c6b6e1d70b64729b6e52", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisize, 400000000); default(realprecision, 50);\nf = x^27-160*x^19-1344*x^18-1280*x^15-3840*x^11+23552*x^10-40704*x^9-4096*x^7+8192*x^6-4096*x-4096;\nnf = nfinit([f, [2,3,17,1289]]);\nprint(\"certify: \", nfcertify(nf), \" disc \", factor(nf.disc), \" sign \", nf.sign);\nn=27; a = nf.sign[1]/n; T=8; D=abs(nf.disc);\ncnt=0; S=0.;\nforprime(p=2, 3000, dec=idealprimedec(nf,p); for(i=1,#dec, N=p^dec[i].f; if(N<=3000, cnt++); m=1; while(N^m < exp(T), S += log(N)/(N^m+1)*(1-m*log(N)/T); m++)));\nB0 = Euler + log(4*Pi) + a - Pi^2/(4*T) - 2*a*log(2)/T - log(D)/n + 4*S/n;\nprint(\"prime ideals norm<=3000: \", cnt, \" B0 = \", B0);\n\\\\ 4569 2-adic and 3-adic and 5-adic splitting\nfor(q=2,5, if(isprime(q), print(q, \": \", apply(P->[P.e,P.f], idealprimedec(nf,q)))));\n" }, { "path": "anc/code/1.1.7/1.1.7d_o6minus.py", "size_bytes": 2668, "sha256": "2b6a129fe3d65eba53a5da91d4139215976799fcd1a9bf3c7c4b7422274347d5", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent enumeration of O(q), q = v1v2+v3v4+v5v6+v5+v6 on F_2^6 (minus type), and the\n# catalogue of (dim fixed space, rank of coinvariant map J[2]/(F-1) -> E/(F-1)E) by cycle type on the\n# 27 nonzero isotropic vectors. Also code weights of the embedding V -> F_2^27.\nfrom collections import Counter\ndef q(v):\n b = [(v >> i) & 1 for i in range(6)]\n return (b[0]*b[1] + b[2]*b[3] + b[4]*b[5] + b[4] + b[5]) & 1\ndef B(v, w): return q(v ^ w) ^ q(v) ^ q(w)\niso = [v for v in range(1, 64) if q(v) == 0]\nnons = [a for a in range(64) if q(a) == 1]\nprint('nonzero isotropic:', len(iso), ' nonsingular (reflection) vectors:', len(nons))\nweights = Counter(sum(B(v, w) for w in iso) for v in range(1, 64))\nprint('code weights of nonzero v:', dict(weights))\nprint('sum of isotropic vectors:', __import__('functools').reduce(lambda a, b: a ^ b, iso))\n# represent group element by images of basis vectors e_0..e_5 (tuple)\ndef apply(g, v):\n r = 0\n for i in range(6):\n if (v >> i) & 1: r ^= g[i]\n return r\ndef compose(g, h): # g after h\n return tuple(apply(g, h[i]) for i in range(6))\nrefl = [tuple((1 << i) ^ (a if B(1 << i, a) else 0) for i in range(6)) for a in nons]\nident = tuple(1 << i for i in range(6))\nseen = {ident}; frontier = [ident]\nwhile frontier:\n nxt = []\n for g in frontier:\n for r in refl:\n h = compose(r, g)\n if h not in seen: seen.add(h); nxt.append(h)\n frontier = nxt\nprint('group order', len(seen))\nassert all(q(apply(g, v)) == q(v) for g in list(seen)[:500] for v in range(64))\nidx = {v: i for i, v in enumerate(iso)}\ndef rank2(vecs):\n piv = {}\n r = 0\n for v in vecs:\n for pb in sorted(piv, reverse=True):\n if (v >> pb) & 1: v ^= piv[pb]\n if v: piv[v.bit_length() - 1] = v; r += 1\n return r\ncat = Counter()\nfor g in seen:\n perm = [idx[apply(g, v)] for v in iso]\n vis = [False]*27; cyc = []; orbits = []\n for s in range(27):\n if not vis[s]:\n L = 0; t = s; orb = []\n while not vis[t]: vis[t] = True; orb.append(t); t = perm[t]; L += 1\n cyc.append(L); orbits.append(orb)\n ct = tuple(sorted(cyc))\n if ct != (3, 6, 6, 6, 6): continue\n # fixed space dim\n fixdim = 6 - rank2([apply(g, 1 << i) ^ (1 << i) for i in range(6)])\n # coinvariant map v -> (sum_{w in O} B(v,w))_O ; rank on V (kills (F-1)V automatically)\n imgs = []\n for i in range(6):\n v = 1 << i\n imgs.append(sum(((sum(B(v, iso[w]) for w in O) & 1) << k) for k, O in enumerate(orbits)))\n cat[(fixdim, rank2(imgs))] += 1\nprint('cycle type (3,6,6,6,6) catalogue {(dim J[2]^F, coinvariant rank): count}:', dict(cat))\n" }, { "path": "anc/code/1.1.7/1.1.7e_logs2.gp", "size_bytes": 922, "sha256": "3ba78b746a78c706dd20aa7b08c6c899138543f0bffdccd614fc0c3d5316d739", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "read(\"logs.gp\");\nsg = -1; CENTRES = [[0,0],[0,1],[-1,0],[-1,1]];\nr00 = taillog(sg, 2, 0, 0, 35, 100, 220); print(\"D(0,0): centres \", r00[2]);\nr01 = taillog(sg, 2, 0, 1, 35, 100, 220); print(\"G1=D(0,1): centres \", r01[2]);\nr1m = taillog(sg, 2, 1, -1, 35, 100, 220); print(\"G2=D(1,-1): centres \", r1m[2]);\nshow(L) = apply(c->lift(Mod(truncate(c), 2^40)), L);\nprint(\"log D(0,0) mod 2^40: \", show(r00[1]), \" claimed [714153886116, 445000321592, 1048252576132]\");\nprint(\"log G1 mod 2^40: \", show(r01[1]), \" claimed [578889133504, 570949811744, 721623895966]\");\nprint(\"log G2 mod 2^40: \", show(r1m[1]), \" claimed [771568004334, 348449650948, 747253421788]\");\nprint(\"relation D(0,0) = 2G1 - 2G2: valuation of difference \", apply(c->valuation(c,2), r00[1] - 2*r01[1] + 2*r1m[1]));\nprint(\"half-log vectors mod 2: G1 \", apply(c->lift(Mod(truncate(c/2),2)), r01[1]), \" G2 \", apply(c->lift(Mod(truncate(c/2),2)), r1m[1]));\n" }, { "path": "anc/code/1.1.7/1.1.7eh_count.c", "size_bytes": 2644, "sha256": "9f5fc60ed7162d4831c03a9a29fb218a029693b9b1bd08ff0a006302a8d4242c", "mode": 420, "language": "C", "encoding": "utf-8", "text": "/* #C(F_{p^k}) for u^3+u^2+sg*z^4+z=0 (projective; one point at infinity), k=1,2,3,\n via histograms of u -> u^3+u^2 and z -> -(sg z^4 + z). Field F_p[x]/(m(x)), m irreducible. */\n#include \n#include \n#include \ntypedef int64_t i64;\nstatic i64 p; static int k; static i64 m0, m1, m2; /* modulus x^k + m_{k-1} x^{k-1} + ... + m0 (monic) */\ntypedef struct { i64 c[3]; } el;\nstatic el mul(el a, el b) {\n i64 r[5] = {0,0,0,0,0};\n for (int i = 0; i < k; i++) for (int j = 0; j < k; j++) r[i+j] = (r[i+j] + a.c[i]*b.c[j]) % p;\n /* reduce: x^k = -(m_{k-1} x^{k-1} + ... + m0) */\n i64 mm[3] = {m0, m1, m2};\n for (int d = 2*k-2; d >= k; d--) {\n i64 t = r[d]; r[d] = 0;\n if (!t) continue;\n for (int i = 0; i < k; i++) r[d-k+i] = ((r[d-k+i] - t*mm[i]) % p + p) % p;\n }\n el o; for (int i = 0; i < 3; i++) o.c[i] = (i < k) ? r[i] : 0; return o;\n}\nstatic el add(el a, el b) { el o; for (int i=0;i<3;i++) o.c[i] = (a.c[i]+b.c[i])%p; return o; }\nstatic el neg(el a) { el o; for (int i=0;i<3;i++) o.c[i] = (p - a.c[i])%p; return o; }\nstatic i64 idx(el a) { i64 r = 0; for (int i = k-1; i >= 0; i--) r = r*p + a.c[i]; return r; }\nint main(int argc, char **argv) {\n p = atoll(argv[1]); k = atoi(argv[2]); int sg = atoi(argv[3]);\n /* find irreducible modulus: k=1 trivial; k=2: x^2 - n (n non-square); k=3: x^3 + a x + b with no roots */\n m0 = m1 = m2 = 0;\n if (k == 2) {\n for (i64 b = 1; ; b++) { for (i64 a = 0; a < p; a++) { int root = 0;\n for (i64 x = 0; x < p; x++) if (((x*x) + a*x + b) % p == 0) { root = 1; break; }\n if (!root) { m0 = b%p; m1 = a; goto found2; } } }\n found2:;\n } else if (k == 3) {\n for (i64 b = 1; ; b++) { for (i64 a = 0; a < p; a++) { int root = 0;\n for (i64 x = 0; x < p; x++) if (((x*x%p)*x + a*x + b) % p == 0) { root = 1; break; }\n if (!root) { m0 = b%p; m1 = a; goto found; } } }\n found:;\n }\n i64 q = 1; for (int i = 0; i < k; i++) q *= p;\n uint8_t *A = calloc(q, 1), *B = calloc(q, 1);\n if (!A || !B) { fprintf(stderr, \"alloc\\n\"); return 1; }\n el one = {{1,0,0}};\n for (i64 i = 0; i < q; i++) {\n el a; i64 t = i; for (int j = 0; j < 3; j++) { a.c[j] = (j < k) ? t % p : 0; if (j < k) t /= p; }\n el a2 = mul(a, a), a3 = mul(a2, a), a4 = mul(a2, a2);\n el v = add(a3, a2); /* u^3+u^2 */\n el w = add(a4, a); if (sg < 0) w = add(neg(a4), a); /* sg z^4 + z */\n w = neg(w); /* u^3+u^2 = -(sg z^4 + z) */\n A[idx(v)]++; B[idx(w)]++;\n }\n i64 N = 1; /* point at infinity */\n for (i64 i = 0; i < q; i++) N += (i64)A[i] * B[i];\n printf(\"%lld\\n\", (long long)N);\n return 0;\n}\n" }, { "path": "anc/code/1.1.7/1.1.7eh_lpoly.gp", "size_bytes": 394, "sha256": "ee9b892efb7fe63df1d9449bcfdd8bf790acacee0b3b5af0def0fa275611103b", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "Lp(p, N) = { my(S = vector(3, k, p^k + 1 - N[k]), a = vector(3));\n a[1] = -S[1]; a[2] = -(S[2] + a[1]*S[1])/2; a[3] = -(S[3] + a[1]*S[2] + a[2]*S[1])/3;\n my(L = 1 + a[1]*'T + a[2]*'T^2 + a[3]*'T^3 + p*a[2]*'T^4 + p^2*a[1]*'T^5 + p^3*'T^6);\n [L, subst(L,'T,1), factor(subst(L,'T,1))] };\nprint(Lp(293, [284, 85720, 25164212]));\nprint(Lp(509, [510, 259528, 131838318]));\nprint(Lp(2, [5,9,5]));\n" }, { "path": "anc/code/1.1.7/1.1.7f_zero_tree2.gp", "size_bytes": 1652, "sha256": "b07678ba889c6ba9baee06fe550a648c9e8ccc1b2dbc64f883bfe8201102cb24", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "read(\"logs.gp\");\ns;\nread(\"balls.gp\");\nsg = -1; CENTRES = [[0,0],[0,1],[-1,0],[-1,1]];\nL00 = taillog(sg, 2, 0, 0, 35, 100, 220)[1];\nLG1 = taillog(sg, 2, 0, 1, 35, 100, 220)[1];\nLG2 = taillog(sg, 2, 1, -1, 35, 100, 220)[1];\ncr = [LG1[2]*LG2[3]-LG1[3]*LG2[2], LG1[3]*LG2[1]-LG1[1]*LG2[3], LG1[1]*LG2[2]-LG1[2]*LG2[1]];\nvc = vecmin(apply(c->valuation(c,2), cr)); a = cr/2^vc; a = a/a[2];\nprint(\"cross product common valuation \", vc, \"; annihilator normalised by middle coeff, mod 2^38: \", apply(c->lift(Mod(truncate(c),2^38)), a));\nM = [LG1[1]/2, LG2[1]/2; LG1[3]/2, LG2[3]/2]; print(\"minor rows 0,2 det valuation: \", valuation(matdet(M),2)); Minv = M^(-1);\nNS = 120;\ndisks = [[0, 0, 0, L00, \"(0,0)\"], [0, 0, 1, LG1, \"(0,1)\"], [0, -1, 0, -2*L00, \"(-1,0)\"], [0, -1, 1, -2*LG1, \"(-1,1)\"], [1, 0, 0, [0,0,0], \"O\"]];\ntot = 0;\n{\nfor(i=1, #disks,\n D = disks[i];\n Iv = if(D[1]==0, serfin(sg, D[2], D[3], NS), serinf(sg, NS));\n Gs = a * Iv~;\n P = subst(truncate(Gs), t, 2*s);\n P = Pol(apply(c->c + O(2^60), Vec(P)), s);\n out = balls(P, 0, 0, 0, 2);\n nz = sum(k=1, #out, out[k][4]); tot += nz;\n print(\"disk \", D[5], \": balls [c,d,v,zeros] \", out);\n for(k=1, #out, if(out[k][4] == 1,\n sv = refine(P, out[k][1], out[k][2], 2);\n Lq = D[4] + evalI(Iv, 2*sv);\n cc = Minv * [Lq[1]/2, Lq[3]/2]~;\n print(\" zero s mod 2^20 = \", lift(Mod(truncate(sv), 2^20)), \" (a,b) mod 2^16 = (\", lift(Mod(truncate(cc[1]), 2^16)), \",\", lift(Mod(truncate(cc[2]), 2^16)), \") mod 512: (\", lift(Mod(truncate(cc[1]), 512)), \",\", lift(Mod(truncate(cc[2]), 512)), \") consistency v2 = \", valuation(Lq - cc[1]*LG1 - cc[2]*LG2, 2))));\n);\nprint(\"total zeros \", tot);\n}\n" }, { "path": "anc/code/1.1.7/1.1.7g_logs3.gp", "size_bytes": 836, "sha256": "abbcebfcc8a9c14c315cb8b5638c5af8ff8aaf31f3c56e5322deca776eb2cc2e", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisizemax, 4*10^9);\nread(\"logs.gp\");\nsg = -1; CENTRES = [];\ngettime();\nr00 = taillog(sg, 3, 0, 0, 63, 120, 300); print(\"D(0,0) at 3: centres \", r00[2], \" \", gettime(), \"ms\");\nr1m = taillog(sg, 3, 1, -1, 63, 120, 300); print(\"D(1,-1) at 3: centres \", r1m[2], \" \", gettime(), \"ms\");\nsh(L) = apply(c->lift(Mod(truncate(3*c), 3^24)), L);\nprint(\"3 log D(0,0) mod 3^24: \", sh(r00[1]), \" claimed [265295843469, 256546487256, 167647527990]\");\nprint(\"3 log D(1,-1) mod 3^24: \", sh(r1m[1]), \" claimed [247088970603, 249160065058, 89859469233]\");\nprint(\"valuations: \", apply(c->valuation(c,3), r00[1]), \" \", apply(c->valuation(c,3), r1m[1]));\n\\\\ precision check: recompute with fewer terms and compare\nr00b = taillog(sg, 3, 0, 0, 63, 120, 200); print(\"stability (NS 200 vs 300) v3 diff: \", apply(c->valuation(c,3), r00b[1]-r00[1]));\n" }, { "path": "anc/code/1.1.7/1.1.7g_zero_tree3.gp", "size_bytes": 3146, "sha256": "a8721cf948ef3ea4729d7d41ab1a7bb81977db3b002a9208537db3d067214ea0", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "default(parisizemax, 4*10^9);\nread(\"logs.gp\");\ns;\nread(\"balls.gp\");\nsg = -1; CENTRES = [];\nL00 = taillog(sg, 3, 0, 0, 63, 120, 300)[1];\nLG2 = taillog(sg, 3, 1, -1, 63, 120, 300)[1];\nLG1 = LG2 + L00/2;\nX1 = 3*LG1; X2 = 3*LG2;\ncr = [X1[2]*X2[3]-X1[3]*X2[2], X1[3]*X2[1]-X1[1]*X2[3], X1[1]*X2[2]-X1[2]*X2[1]];\nvc = vecmin(apply(c->valuation(c,3), cr)); a = cr/3^vc;\nprint(\"cross product common valuation \", vc);\nth = [16280295932, 6711384369, 10302306500];\nprint(\"annihilator proportional to supplied one mod 3^22: \", apply(c->lift(Mod(truncate(c), 3^22)), a/a[1]) == lift(Mod(th,3^22)/th[1]), \" reduction mod 3 of supplied: \", th % 3);\na = a / a[1];\n\\\\ coefficient matrix rows 1,2 (0-based) of 3log\nM = [X1[2], X2[2]; X1[3], X2[3]]; print(\"det valuation: \", valuation(matdet(M),3)); Minv = M^(-1);\ncoef(Lq) = Minv * [3*Lq[2], 3*Lq[3]]~;\nNS = 140;\n\\\\ chart for (-1,1): parameter t = z - 1, u = u(t)\nuserz(uc, zc, N) = { my(U = uc + O(t^N), G);\n for(k=1, 12, G = subst(subst(Fc(sg), z, zc + t + O(t^N)), u, U); U = U - G/(3*U^2+2*U)); U };\nserz(uc, zc, N) = { my(U = userz(uc, zc, N+2), den = 3*U^2 + 2*U);\n vector(3, j, intformal([1/den, (zc+t)/den, U/den][j])) };\n\\\\ cusp chart: u = 3a, z = 1 + 3b(a)\nbser(N) = { my(b = O(t^N)); for(k=1, N, b = t^2 + 3*t^3 - 6*b^2 - 12*b^3 - 9*b^4 + O(t^N)); b };\nsercusp(N) = { my(b = bser(N+2), den = 1 + 12*b + 36*b^2 + 36*b^3);\n vector(3, j, intformal([1/den, (1+3*b)/den, 3*t/den][j])) };\ndisks = [[\"f\", 0, 0, L00, \"(0,0)\"], [\"f\", 1, -1, LG2, \"(1,-1)\"], [\"f\", -1, 0, -2*L00, \"(-1,0)\"], [\"z\", -1, 1, -2*LG1, \"(-1,1)\"], [\"inf\", 0, 0, [0,0,0], \"O\"], [\"cusp\", 0, 1, LG1, \"cusp (0,1)\"]];\ntot = 0;\n{\nfor(i=1, #disks,\n D = disks[i];\n if(D[1] == \"f\", Iv = serfin(sg, D[2], D[3], NS));\n if(D[1] == \"z\", Iv = serz(D[2], D[3], NS));\n if(D[1] == \"inf\", Iv = serinf(sg, NS));\n if(D[1] == \"cusp\", Iv = sercusp(260);\n \\\\ check the claimed coefficient bound v3(coef of a^n) >= ceil((n-1)/4) - v3(n)\n my(okb = 1, mtail = 1000); for(n=1, 259, for(j=1,3, my(c = polcoeff(Iv[j], n)); if(c != 0 && valuation(c,3) < ceil((n-1)/4) - valuation(n,3), okb = 0); if(n >= 121 && c != 0, mtail = min(mtail, valuation(c,3)))));\n print(\"cusp chart: coefficient bound holds for n<260: \", okb, \"; min valuation of coefficients n in [121,259]: \", mtail));\n Gs = a * Iv~;\n sc = if(D[1] == \"cusp\", 1, 3);\n P = subst(truncate(Gs), t, sc*s);\n P = Pol(apply(c->c + O(3^60), Vec(P)), s);\n out = balls(P, 0, 0, 0, 3);\n nz = sum(k=1, #out, out[k][4]); tot += nz;\n print(\"disk \", D[5], \": #balls \", #out, \" zeros \", nz, \" max removed valuation \", vecmax(apply(x->x[3], out)), \" max depth \", vecmax(apply(x->x[2], out)));\n for(k=1, #out, if(out[k][4] == 1,\n sv = refine(P, out[k][1], out[k][2], 3);\n Lq = D[4] + evalI(Iv, sc*sv);\n cc = coef(Lq);\n print(\" zero param mod 3^12 = \", lift(Mod(truncate(sv), 3^12)), \" (a,b) valuations \", [valuation(cc[1],3), valuation(cc[2],3)], \" (a,b) mod 3^8 = (\", lift(Mod(truncate(cc[1]), 3^8)), \",\", lift(Mod(truncate(cc[2]), 3^8)), \") mod 81: (\", lift(Mod(truncate(cc[1]), 81)), \",\", lift(Mod(truncate(cc[2]), 81)), \")\")));\n);\nprint(\"total ternary zeros \", tot);\n}\n" }, { "path": "anc/code/1.1.7/1.1.7h_sieve.py", "size_bytes": 2757, "sha256": "17084e86ea6edcd476899b999b2c33c2f4826ba88ff6d09a25c5c18bca637403", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent finite-field Jacobian comparisons for 4569 at 509 and 293 (Sage Hess-model Jacobian).\nimport sys, time\nt0 = time.time()\nfrom sage.all__sagemath_schemes import *\np = int(sys.argv[1])\nk = GF(p)\nK = FunctionField(k, 'x'); x = K.gen() # x = z\nR = PolynomialRing(K, 'Y'); Y = R.gen()\nL = K.extension(Y**3 + Y**2 - x**4 + x, 'y'); y = L.gen() # y = u\npls = L.places(1)\ninf = [P for P in pls if P.is_infinite_place()][0]\nJ = L.jacobian().group()\ndef coords(P):\n if P.is_infinite_place(): return 'O'\n kP, fr, to = P.residue_field()\n a = to(x); b = to(y)\n return (int(b), int(a)) # (u, z)\npts = {coords(P): P for P in pls}\ndef cls(P): return J.zero() if P is inf else J.point(P.divisor() - inf.divisor())\nG1 = cls(pts[(0, 1)]); G2 = cls(pts[(1, p - 1)])\nprint('#C(F_p) =', len(pls), ' time', round(time.time()-t0,1), flush=True)\nif p == 509:\n N = 131974656; m2 = N // 512\n # consistency of #J: N kills G1, G2 and some point classes\n for P in list(pls)[:5] + [pts[(0,1)], pts[(1,p-1)]]:\n assert N * cls(P) == J.zero()\n # exponent evidence: order of G1 (prime factors of N: 2,3,11,73,107)\n fac = factor(N)\n def order(D):\n o = N\n for (q, e) in fac:\n while o % q == 0 and (o // q) * D == J.zero(): o //= q\n return o\n print('order(G1) =', order(G1), ' order(G2) =', order(G2), flush=True)\n target = m2 * (304 * G1)\n hits = [coords(P) for P in pls if m2 * cls(P) == target]\n print('R_2 (304,0) mod 512: matching residue points:', hits, ' time', round(time.time()-t0,1), flush=True)\nif p == 293:\n N = 24294816; m2 = N // 32; m3 = N // 81\n for P in list(pls)[:5]:\n assert N * cls(P) == J.zero()\n fac = factor(N)\n def order(D):\n o = N\n for (q, e) in fac:\n while o % q == 0 and (o // q) * D == J.zero(): o //= q\n return o\n print('order(G1) =', order(G1), ' order(G2) =', order(G2), flush=True)\n t2 = m2 * (10 * G1 + 6 * G2)\n cand = [P for P in pls if m2 * cls(P) == t2]\n print('Q_2 (10,6) mod 32: residue points with matching 2-primary class:', sorted([coords(P) for P in cand], key=str), flush=True)\n tq = m3 * (32 * G1 + 22 * G2); tr = m3 * (2 * G1 + 26 * G2)\n for P in cand:\n c3 = m3 * cls(P)\n print(' ', coords(P), ' equals Q_3 class:', c3 == tq, ' equals R_3 class:', c3 == tr, flush=True)\n # sanity: known rational points satisfy their own conditions\n for name, pt, ab in [('(6,4)', (6, 4), (-11, 9)), ('(0,0)', (0, 0), (2, -2)), ('(-1,0)', (p-1, 0), (-4, 4))]:\n D = cls(pts[pt]); e = ab[0] * G1 + ab[1] * G2\n print('sanity', name, '2-primary ok:', m2 * D == m2 * e, ' 3-primary ok:', m3 * D == m3 * e, flush=True)\nprint('time', round(time.time() - t0, 1))\n" }, { "path": "anc/code/1.1.7/balls.gp", "size_bytes": 1020, "sha256": "1f0bf80aafe8e66cc8b5fdc987f551120930584a9aae27cf92e36857a3340384", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Weierstrass-degree ball tree for a polynomial P(s) with p-adic coefficients (prime ell)\npv(c, ell) = if(c == 0, padicprec(c, ell), valuation(c, ell));\nballs(P, c, d, depth, ell) = {\n my(Q = subst(P, s, c + ell^d * s), co, vs, mn, N, res);\n co = Vecrev(Q);\n vs = vector(#co, k, pv(co[k], ell));\n mn = vecmin(vs);\n N = 0; for(k=1, #co, if(vs[k] == mn, N = k-1));\n for(k=1,#co, if(co[k]==0 && padicprec(co[k],ell) <= mn, error(\"precision insufficient at ball \", c, \" \", d)));\n if(N == 0, return([[c, d, mn, 0]]));\n if(N == 1, return([[c, d, mn, 1]]));\n if(depth > 14, error(\"too deep\"));\n res = [];\n for(j=0, ell-1, res = concat(res, balls(P, c + j*ell^d, d+1, depth+1, ell)));\n res\n};\nrefine(P, c, d, ell) = {\n my(Q = subst(P, s, c + ell^d * s), mn, rv, dQ);\n mn = vecmin(apply(x->pv(x, ell), Vecrev(Q)));\n Q = Q / ell^mn; dQ = deriv(Q, s);\n rv = 0 + O(ell^40);\n for(k=1, 80, rv = rv - subst(Q, s, rv)/subst(dQ, s, rv));\n c + ell^d * rv\n};\nevalI(Iv, tv) = vector(3, j, subst(truncate(Iv[j]), t, tv));\n" }, { "path": "anc/code/1.1.7/logs.gp", "size_bytes": 4204, "sha256": "8cb74c469816de8c2854fb2cba5cdb2f7642d98298ee96186997b1d758e6d059", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ General independent tiny-log computation: curve u^3+u^2+sg*z^4+z=0, prime ell,\n\\\\ principal function h with div(h) = m*P + E - (m+3)O, P=(uc,zc) with F_z(P) != 0.\n\\\\ log[P-O] = -(1/m) * log[E-3O] = -(1/m) * ( sum_Q int_{centre(Q)}^{Q} omega + sum_Q log[centre(Q)-O] ).\n\\\\ We require the multiset of centres to be either {O,O,O} or {(0,c),(0,c),(-1,c)} = div(z-c)+3O.\nu; z; t; UU = varlower(\"UU\");\nFc(sg) = u^3+u^2+sg*z^4+z;\nzser(sg, uc, zc, N) = {\n my(Z = zc + O(t^N), G);\n for(k=1, ceil(log(N)/log(2))+4,\n G = subst(subst(Fc(sg), u, uc + t + O(t^N)), z, Z);\n Z = Z - G/(4*sg*Z^3+1));\n Z\n};\nserfin(sg, uc, zc, N) = {\n my(Z = zser(sg, uc, zc, N+2), den = 4*sg*Z^3+1);\n vector(3, j, intformal([-1/den, -Z/den, -(uc+t)/den][j]))\n};\nserinf(sg, N) = {\n my(W = O(t^(N+2)), Gw);\n for(k=1, N, W = -(W^2 + t*W^3 + sg*t^4) + O(t^(N+2)));\n Gw = 1 + 2*W + 3*t*W^2;\n vector(3, j, intformal([-W/Gw, -t/Gw, -1/Gw][j]))\n};\nhfun(sg, uc, zc, m) = {\n my(N = m + 2, Z = zser(sg, uc, zc, N), mons = List(), M, ker, h, ser);\n for(b=0,2, for(a=0, (m+3-4*b)\\3, listput(mons, [a,b])));\n M = matrix(m, #mons, i, j, polcoeff(Z^mons[j][1] * (uc+t)^mons[j][2] + O(t^N), i-1));\n ker = matker(M);\n if(#ker != 1, error(\"kernel dim \", #ker));\n h = sum(j=1, #mons, ker[j,1] * z^mons[j][1] * u^mons[j][2]);\n h = h / content(h);\n ser = subst(subst(h, u, uc + t), z, Z);\n [h, valuation(ser, t), #mons]\n};\n\\\\ main: returns [log vector, info]\ntaillog(sg, ell, uc, zc, m, K, NS) = {\n my(H = hfun(sg, uc, zc, m), h = H[1], Nm, p, pU, g, zE, fp, tot = [0,0,0], cent = List(), q, Tq, zq, vu, info);\n if(H[2] != m, error(\"order at P is \", H[2]));\n Nm = polresultant(Fc(sg), h, z);\n if(poldegree(Nm, u) != m + 3, error(\"deg N(h)\"));\n p = Nm / (u - uc)^m; if(type(p) != \"t_POL\" || poldegree(p) != 3, error(\"residual not cubic\"));\n p = p / pollead(p);\n if(!polisirreducible(p), print(\" (residual cubic reducible over Q)\"));\n pU = subst(p, u, UU);\n g = gcd(subst(Fc(sg), u, Mod(UU, pU)), subst(h, u, Mod(UU, pU)));\n if(poldegree(g, z) != 1, error(\"gcd not linear\"));\n zE = subst(lift(-polcoeff(g, 0, z)/polcoeff(g, 1, z)), UU, u);\n fp = factorpadic(p, ell, K);\n for(k=1, #fp[,1],\n q = fp[k,1]; q = q / pollead(q);\n vu = vecmin(vector(poldegree(q), i, valuation(polcoeff(q, poldegree(q)-i), ell)/i)); \\\\ min valuation of roots\n if(vu < 0,\n \\\\ roots with negative valuation: candidate infinity disk; t = z/u\n Tq = Mod(zE, q) / Mod(u, q);\n my(Wq = 1/Mod(u, q));\n my(vt = vecmin(apply(c->valuation(c, ell), Vec(charpoly(Tq, 'X) - 'X^poldegree(q)))));\n if(vt <= 0, error(\"not in infinity disk\"));\n my(Iv = serinf(sg, NS));\n for(j=1,3, tot[j] += sum(n=1, NS, polcoeff(Iv[j], n) * trace(Tq^n)));\n for(i=1, poldegree(q), listput(cent, \"O\")),\n \\\\ finite\n my(ured = Mod(1, ell) * Pol(apply(c->truncate(c), Vec(q)), u), ucq, zcq);\n if(poldegree(q) == 1, ucq = -polcoeff(q, 0),\n \\\\ all roots congruent? take centre from reduction: q mod ell = (u - c)^d\n my(fq = factor(ured)); if(#fq[,1] != 1 || poldegree(fq[1,1]) != 1, error(\"factor not in a single disk\"));\n ucq = lift(-polcoeff(fq[1,1], 0)));\n ucq = if(type(ucq)==\"t_PADIC\", lift(Mod(truncate(ucq), ell)), lift(Mod(ucq, ell)));\n zq = Mod(zE, q);\n \\\\ choose a rational centre (from CENTRES) congruent to (u,z) mod ell, verified by charpoly valuations\n my(found = 0);\n for(ic = 1, #CENTRES, my(cu = CENTRES[ic][1], cz = CENTRES[ic][2]);\n if(Mod(cu - ucq, ell) == 0,\n my(cpu = charpoly(Mod(u, q) - cu, 'X), cpz = charpoly(zq - cz, 'X));\n if(vecmin(apply(x->valuation(x, ell), Vec(cpu - 'X^poldegree(q)))) > 0 &&\n vecmin(apply(x->valuation(x, ell), Vec(cpz - 'X^poldegree(q)))) > 0,\n ucq = cu; zcq = cz; found = 1)));\n if(!found, error(\"no rational centre for factor\"));\n if(subst(subst(Fc(sg), u, ucq), z, zcq) != 0, error(\"centre not on curve\"));\n my(Iv = serfin(sg, ucq, zcq, NS), Tf = Mod(u, q) - ucq);\n for(j=1,3, tot[j] += sum(n=1, NS, polcoeff(Iv[j], n) * trace(Tf^n)));\n for(i=1, poldegree(q), listput(cent, [ucq, zcq])));\n );\n [-tot/m, Vec(cent), [H[3], H[2], fp[,1]~]]\n};\n" }, { "path": "anc/code/1.1.8/1.1.8a_geometry_field.gp", "size_bytes": 4066, "sha256": "9c9e0d8f7b1af1a6984b5f76db06d7e3773907e669c002ed9718fef8b21e8ef9", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.8a Geometry of C and the bitangent field K.\n\\\\ Target F(x,y) = x^4+y^3+2x-y+1. Proof coordinates u = -y, z = x:\n\\\\ C: G(u,z) = -u^3+u+z^4+2z+1 = 0, hyperflex O = [U:Z:W] = [1:0:0].\n\\\\ Checks: transport; smoothness at O and hyperflex; bad primes from the critical algebra\n\\\\ u^2 = 1/3, z^3 = -1/2 (critical value (4u+9z+6)/6) and node thickness; the bitangent slope\n\\\\ polynomial f (own elimination), irreducibility and the eta identity; maximal order of\n\\\\ K = Q[m]/(f) (nfcertify), signature, discriminant, primes over 2.\n\\\\ Usage: gp -q 1.1.8a_geometry_field.gp < /dev/null\ndefault(parisizemax, 2*10^9);\ntmp = e + z + u + X + W + Z; \\\\ variable priority: m lowest\nF = x^4+y^3+2*x-y+1;\nG = -u^3+u+z^4+2*z+1;\nprint(\"transport F(z,-u) == G(u,z): \", substvec(F,[x,y],[z,-u]) == G);\n\\\\ ---- O = [1:0:0]: chart U = 1, coordinates (Z,W)\nGh = numerator(substvec(G,[u,z],[1/W,Z/W])*W^4);\nprint(\"chart at O: \", Gh, \"; d/dW at (0,0) = \", polcoef(polcoef(Gh,1,W),0,Z), \" (unit in every characteristic)\");\nprint(\"line W=0 meets C in: \", subst(Gh,W,0), \" (4-fold at O: hyperflex)\");\n\\\\ ---- critical algebra and bad primes\nGu = deriv(G,u); Gz = deriv(G,z);\nprint(\"G_u = \", Gu, \", G_z = \", Gz, \"; 12G - 4u G_u - 3z G_z = \", 12*G-4*u*Gu-3*z*Gz, \" => value at a critical point = (4u+9z+6)/6\");\n\\\\ critical field L = Q(sqrt3, 4^(1/3)), u = s/3, z = -c/2 with s^2 = 3, c^3 = 4\npc = polcompositum(X^2-3, X^3-4, 1)[1];\nL = nfinit(pc[1]); s = pc[2]; c = pc[3];\nuu = s/3; zz = -c/2;\nprint(\"critical point check: \", [subst(Gu,u,uu), substvec(Gz,[z],[zz])]);\nval = substvec(G,[u,z],[uu,zz]);\nnormc = norm(val);\nprint(\"critical value == (4u+9z+6)/6: \", val == (4*uu+9*zz+6)/6);\nprint(\"critical_value_norm = \", normc, \" = \", factor(numerator(normc)), \" / \", factor(denominator(normc)));\nhess = substvec(deriv(Gu,u)*deriv(Gz,z) - deriv(Gu,z)^2, [u,z], [uu,zz]);\nprint(\"norm of the Hessian at the critical point = \", factor(norm(hess)), \" (unit away from 2,3)\");\nfa = idealfactor(L, lift(val));\n{for(i=1,#fa~, my(pr=fa[i,1]); if(pr.p>3,\n print(\" bad p = \", pr.p, \": prime of L with residue degree \", pr.f, \", valuation of critical value \", fa[i,2],\n \" -> \", pr.f, \" geometric node(s) of thickness \", fa[i,2])));}\n\\\\ p = 2, 3 directly: affine F_p-singular points (and O is smooth by the chart above)\n{for(p=2,3, my(Lp=List()); for(a=0,p-1,for(b=0,p-1, if(substvec(G,[u,z],[a,b])%p==0 && substvec(Gu,[u,z],[a,b])%p==0 && substvec(Gz,[u,z],[a,b])%p==0, listput(Lp,[a,b]))));\n print(\"p = \", p, \": affine F_p-rational singular points \", Lp));}\nprint(\"p = 3: G_u = 1-3u^2 == 1 (mod 3), so C is smooth at 3\");\n\\\\ ---- bitangents u = m z + e: own elimination\nQ = -(m*z+e)^3 + (m*z+e) + z^4 + 2*z + 1;\nq3=polcoef(Q,3,z); q2=polcoef(Q,2,z); q1=polcoef(Q,1,z); q0=polcoef(Q,0,z);\npp=q3/2; qq=(q2-pp^2)/2;\nR = polresultant(numerator(2*pp*qq-q1), numerator(qq^2-q0), e);\nfaR = factor(R);\nprint(\"Res_e factors (degree, multiplicity): \", vector(#faR~,i,[poldegree(faR[i,1]), faR[i,2]]));\nf = 0; for(i=1,#faR~, if(poldegree(faR[i,1])==27, f = faR[i,1]/pollead(faR[i,1])));\nf8 = m^27-480*m^19+2688*m^18+17280*m^15-34560*m^11-141312*m^10-162816*m^9+165888*m^7+221184*m^6-94208*m^3-49152*m+32768;\nprint(\"degree-27 factor == f: \", f == f8, \"; f irreducible: \", polisirreducible(f8), \"; real roots: \", polsturm(f8));\ne8 = -Mod(11*m^13-112*m^5-224*m^4+192*m, f8)/Mod(8*(13*m^9+16*m-16), f8);\nmm = Mod(m, f8);\n{print(\"identity F(m z+eta, z) = (z^2 - m^3 z/2 - 3 m^2 eta/2 - m^6/8)^2: \",\n -(mm*z+e8)^3 + (mm*z+e8) + z^4 + 2*z + 1 == (z^2 - mm^3/2*z - 3*mm^2*e8/2 - mm^6/8)^2);}\n\\\\ ---- the field\nprint(\"poldisc(f) (trial division to 1e7): \", factor(poldisc(f8), 10^7));\nt0 = getabstime();\nK = nfinit([f8, [2,3,5,7,11,13,431,659,12527563]]);\nprint(\"nfcertify (empty = maximal order certified): \", nfcertify(K));\nprint(\"signature \", K.sign, \"; disc \", K.disc, \" = \", factor(K.disc));\nprint(\"disc == 2^30 5^10 431^6 659^6: \", K.disc == 2^30*5^10*431^6*659^6);\nP = idealprimedec(K,2); print(\"primes over 2 (e,f): \", vector(#P,i,[P[i].e,P[i].f]), \" (\", getabstime()-t0, \" ms)\");\nquit;\n" }, { "path": "anc/code/1.1.8/1.1.8e_descent.gp", "size_bytes": 6213, "sha256": "1620397c0b5b91f9c52fb835d3e1564b037b102687950f867da32a08f5de84e4", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.8e 2-descent for C: -u^3+u+z^4+2z+1 = 0 (u=-y, z=x), K = Q[m]/(f), S = {primes over 2}.\n\\\\ (1) the 85 atomic elements: exact factorisation; the 19 classes have even valuation away from 2;\n\\\\ (2) independence of the 19 classes (quadratic residue characters), norm sign / v2 rows,\n\\\\ good primes 7, 11, 59, 83 (zero local image) -> 9-dimensional space;\n\\\\ (3) dyadic square-class coordinates (units mod p^(2e+3)), images of P0=(0,-1), P1=(1,-1) and the\n\\\\ point t=2 of the disk at infinity; final kernel.\n\\\\ Input: data/1.1.8e_selmer_elements.gp (EL = 85 atomic elements in the power basis of m,\n\\\\ GEN = the 19 classes as exponent lists over EL). Usage: gp -q 1.1.8e_descent.gp < /dev/null\ndefault(parisizemax, 3*10^9);\nf1=m^27 - 480*m^19 + 2688*m^18 + 17280*m^15 - 34560*m^11 - 141312*m^10 - 162816*m^9 + 165888*m^7 + 221184*m^6 - 94208*m^3 - 49152*m + 32768;\nnf=nfinit([f1, [2,3,5,7,11,13,41,431,659]]);\nread(\"data/1.1.8e_selmer_elements.gp\");\nt0=getabstime();\nAL = vector(#EL, j, Mod(Pol(Vecrev(EL[j]), m), f1));\nprint(\"atomic elements: \", #AL, \" all integral: \", #select(a->denominator(content(nfalgtobasis(nf,a)))!=1, AL)==0);\nFA = vector(#AL, j, idealfactor(nf, lift(AL[j])));\nPL = List(); for(j=1,#FA, for(i=1,#FA[j]~, my(pr=FA[j][i,1]); my(found=0); for(k=1,#PL, if(PL[k]==pr, found=1;break)); if(!found, listput(PL,pr))));\nprint(\"distinct primes in atomic divisors: \", #PL);\nvtab(j, pr) = { my(F=FA[j]); for(i=1,#F~, if(F[i,1]==pr, return(F[i,2]))); 0; }\nok=1;\nfor(g=1,#GEN, for(k=1,#PL, if(PL[k].p!=2, my(s=sum(i=1,#GEN[g], GEN[g][i][2]*vtab(GEN[g][i][1]+1, PL[k]))); if(s!=0, ok=0; print(\"gen \",g,\" nonzero valuation \",s,\" at p=\",PL[k].p)))));\nprint(\"all 19 classes have even valuation away from 2 (S-classes): \", ok);\nP2 = idealprimedec(nf,2); print(\"dyadic (e,f): \", vector(#P2,i,[P2[i].e,P2[i].f]));\nODD = vector(#GEN, g, select(x->x[2]%2!=0, GEN[g]));\nchr(j, pr, modpr) = { my(v = vtab(j, pr)); my(x = lift(AL[j]) * pr.p^(-v)); my(r = nfmodpr(nf, x, modpr)); if(r==0, error(\"zero residue\")); if(issquare(r), 0, 1); }\ngenchar(pr) = { my(modpr = nfmodprinit(nf, pr)); my(cj = vector(#AL)); my(need = Set(concat(vector(#ODD,g, vector(#ODD[g],i,ODD[g][i][1]+1)))));\n for(k=1,#need, cj[need[k]] = chr(need[k], pr, modpr));\n vector(#GEN, g, sum(i=1,#ODD[g], cj[ODD[g][i][1]+1]) % 2); }\nNS = vector(#AL, j, norm(AL[j]));\nrowsign = vector(#GEN, g, sum(i=1,#ODD[g], if(NS[ODD[g][i][1]+1]<0,1,0)) % 2);\nrowv2 = vector(#GEN, g, sum(i=1,#ODD[g], valuation(NS[ODD[g][i][1]+1],2)) % 2);\nprint(\"norm sign row: \", rowsign); print(\"norm v2 row: \", rowv2);\nCH = List();\nforprime(p=13, 400, if(p==431||p==659||p==41, next); my(P=idealprimedec(nf,p)); for(i=1,#P, if(P[i].f<=2, listput(CH, genchar(P[i])))));\nM = matrix(#CH, #GEN, i, j, CH[i][j]);\nprint(\"rank of the 19 classes via \", #CH, \" residue characters: \", matrank(M*Mod(1,2)));\nprint(\"dimension after norm conditions: \", #matker(matconcat([Mat(rowsign); Mat(rowv2)])*Mod(1,2)));\nGR = List();\n{foreach([7,11,59,83], p, my(P=idealprimedec(nf,p)); print(\"p=\",p,\" residue degrees \", vector(#P,i,P[i].f), \" e \", vector(#P,i,P[i].e)); for(i=1,#P, listput(GR, genchar(P[i])));\n print(\" dimension after p=\",p,\": \", #matker(matconcat([Mat(rowsign); Mat(rowv2); matrix(#GR, #GEN, i,j, GR[i][j])])*Mod(1,2))));}\nCond = matconcat([Mat(rowsign); Mat(rowv2); matrix(#GR, #GEN, i,j, GR[i][j])]);\nKgood = matker(Cond*Mod(1,2));\nprint(\"dimension after norm and good-prime conditions: \", #Kgood, \" time \", getabstime()-t0, \" ms\");\n\n\\\\ ---------------- dyadic part ----------------\nQ = -(mm*zz+x)^3 + (mm*zz+x) + zz^4 + 2*zz + 1;\nc3=polcoef(Q,3,zz); c2=polcoef(Q,2,zz); c1=polcoef(Q,1,zz); c0=polcoef(Q,0,zz);\np_=c3/2; q_=(c2-p_^2)/2;\nE1=numerator(2*p_*q_-c1); E2=numerator(q_^2-c0);\nE1K = subst(E1, mm, Mod(m,f1)); E2K = subst(E2, mm, Mod(m,f1));\ng = gcd(E1K, E2K); print(\"gcd degree in eta: \", poldegree(g,x));\net = -polcoef(g,0,x)/polcoef(g,1,x);\nlhs = -(Mod(m,f1)*y+et)^3 + (Mod(m,f1)*y+et) + y^4 + 2*y + 1;\nrhs = (y^2 - Mod(m,f1)^3/2*y - 3*Mod(m,f1)^2*et/2 - Mod(m,f1)^6/8)^2;\nprint(\"bitangent identity holds: \", lhs == rhs);\ni8 = if(P2[1].e==8,1,2); i1 = 3-i8;\npi8 = if(nfeltval(nf,lift(AL[1]),P2[i8])==1, AL[1], AL[2]); pi1 = if(pi8==AL[1], AL[2], AL[1]);\nprint(\"uniformizer check: \", [nfeltval(nf,lift(pi8),P2[i8]), nfeltval(nf,lift(pi8),P2[i1]), nfeltval(nf,lift(pi1),P2[i8]), nfeltval(nf,lift(pi1),P2[i1])]);\nbid8 = idealstar(nf, idealpow(nf, P2[i8], 2*8+3), 1);\nbid1 = idealstar(nf, idealpow(nf, P2[i1], 2*1+3), 1);\nev8 = select(k->bid8.cyc[k]%2==0, [1..#bid8.cyc]); ev1 = select(k->bid1.cyc[k]%2==0, [1..#bid1.cyc]);\nprint(\"unit square-class dims: \", #ev8, \" + \", #ev1, \"; with valuation parity: \", #ev8+1, \" + \", #ev1+1);\ncoords(x) = {\n my(a = nfeltval(nf, lift(x), P2[i8]), b = nfeltval(nf, lift(x), P2[i1]));\n my(u = x / (pi8^a * pi1^b));\n my(l8 = ideallog(nf, lift(u), bid8), l1 = ideallog(nf, lift(u), bid1));\n concat([[a%2], vector(#ev8,k, l8[ev8[k]]%2), [b%2], vector(#ev1,k, l1[ev1[k]]%2)]);\n}\nneed = Set(concat(vector(#ODD,g, vector(#ODD[g],i,ODD[g][i][1]+1))));\nAC = vector(#AL); for(k=1,#need, AC[need[k]] = coords(AL[need[k]]));\nGC = vector(#ODD, g, sum(i=1,#ODD[g], AC[ODD[g][i][1]+1]) % 2);\nDm = matrix(#GC[1], #GC, i, j, GC[j][i]);\nmK = Mod(m,f1);\nd1 = mK - et; \\\\ P0 = (u,z) = (0,-1): u - m z - eta\nd2 = 1 + mK - et; \\\\ P1 = (u,z) = (1,-1)\ntt=2; w = 0; for(it=1,200, w = (tt^4 + (1+2*tt)*w^3 + w^4) % 2^150);\nprint(\"infinity point t=2: v2(w)=\", valuation(w,2), \" residual v2 = \", valuation(tt^4 - w + (1+2*tt)*w^3 + w^4, 2));\nd3 = (1 - (1+2*tt)*w^2 - w^3)*(1 - mK*tt - et*w);\nprint(\"dyadic valuations of the three point values: \", [[nfeltval(nf,lift(d),P2[i8]),nfeltval(nf,lift(d),P2[i1])] | d<-[d1,d2,d3]]);\nLm = matconcat([coords(d1)~, coords(d2)~, coords(d3)~]);\nprint(\"rank of the three local point images: \", matrank(Lm*Mod(1,2)));\nKG = lift(Kgood);\nBig = matconcat([Dm*KG, Lm]) * Mod(1,2);\nKer = matker(Big);\nSel = lift(KG*Mod(1,2) * Ker[1..#KG[1,], ]);\nprint(\"Selmer (fake) dimension: \", matrank(Sel*Mod(1,2)));\nprint(\"kernel basis (1-based class support; span = ): \", vector(#Sel, j, select(i->Sel[i,j]%2, [1..#Sel[,1]])));\nprint(\"total time \", getabstime()-t0, \" ms\");\nquit;\n" }, { "path": "anc/code/1.1.8/1.1.8f_logs.gp", "size_bytes": 4767, "sha256": "5c4cfc7b333cfd8e9d02dca5ff11434df5a859ca6fbbaec8fa751bed3af105d0", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.8f Principal divisors div(h_i) = 16 P_i + E_i - 19 O (P0 = (0,-1), P1 = (1,-1) in (u,z)),\n\\\\ the residual points E_i in the disk of O (characteristic polynomials of t = z/u and w = 1/u),\n\\\\ 2-adic logarithms log G_i = -(1/16) Tr int_0^t omega via Newton sums, cross product -> annihilator.\n\\\\ Writes work/1.1.8f_annihilator.txt (used by 1.1.8g) and work/1.1.8f_logs.txt.\n\\\\ Usage: gp -q 1.1.8f_logs.gp < /dev/null\nsystem(\"mkdir -p work\");\n\\\\ C: F(u,z) = -u^3+u+z^4+2z+1 = 0\ndefault(parisizemax, 2*10^9);\nF = -u^3+u+z^4+2*z+1;\nNT = 300; \\\\ number of series terms\n\\\\ monomials z^a u^b, b<=2, 3a+4b<=19\nmons = List(); for(b=0,2, for(a=0,6, if(3*a+4*b<=19, listput(mons,[a,b])))); mons=Vec(mons);\nprint(\"#monomials = \", #mons);\n\\\\ local expansion at P=(u0,z0) with z = z0 + s\nlocalu(u0,z0,ord) = {\n my(U = u0 + O(s^ord));\n for(it=1,8, my(Fs = substvec(F,[u,z],[U, z0+s]), Fus = substvec(deriv(F,u),[u,z],[U,z0+s])); U = U - Fs/Fus);\n U;\n}\nfindh(u0,z0,ordv) = {\n my(U = localu(u0,z0,ordv+2), Mx = matrix(ordv, #mons));\n for(j=1,#mons, my(ser = (z0+s)^mons[j][1] * U^mons[j][2] + O(s^ordv));\n for(i=1,ordv, Mx[i,j] = polcoef(ser, i-1, s)));\n my(K = matker(Mx)); if(#K!=1, error(\"kernel dim \",#K));\n my(v = K[,1]); v = v/content(v);\n sum(j=1,#mons, v[j]*z^mons[j][1]*u^mons[j][2]);\n}\n\\\\ infinity branch: t^4 - w + (1+2t) w^3 + w^4 = 0\nW = O(t^(NT+8)); for(it=1,NT, W = t^4 + (1+2*t)*W^3 + W^4);\nchk = t^4 - W + (1+2*t)*W^3 + W^4; print(\"w-series residual valuation: \", valuation(chk,t));\n\\\\ differential vector via direct formula omega_j = (1,z,u) dz / F_u, z=t/w, u=1/w\nZs = t/W; Us = 1/W;\ndz = deriv(Zs, t);\nFu = substvec(deriv(F,u),[u,z],[Us,Zs]);\nom = [dz/Fu, Zs*dz/Fu, Us*dz/Fu];\nom2 = [W, t, 1]*(1 - t*deriv(W,t)/W)/(W^2-3);\nprint(\"closed form check: \", vector(3,j, valuation(om[j]-om2[j],t)));\n\\\\ 2-integrality of coefficients\nprint(\"min 2-val of differential coefficients (first NT): \", vecmin(vector(3,j, vecmin(vector(NT,n, my(c=polcoef(om[j],n-1,t)); if(c==0,99,valuation(c,2)))))));\ndoit(i, u0, z0) = {\n my(h = findh(u0,z0,16));\n print(\"h_\",i,\" = \", h);\n \\\\ check pole weights and order of vanishing exactly 16\n my(U = localu(u0,z0,20)); my(ser = substvec(h,[u,z],[U,z0+s])); print(\" order at P_\",i,\": \", valuation(ser,s));\n my(N = polresultant(h, F, u)); \\\\ polynomial in z\n my(fa = factor(N)); print(\" norm factorization (z): \", fa);\n my(cub = 0); for(k=1,#fa~, if(fa[k,1]!=z+1, cub = if(cub, cub*fa[k,1]^fa[k,2], fa[k,1]^fa[k,2])));\n print(\" residual: deg \", poldegree(cub), \" squarefree? \", issquarefree(cub), \" value at z=-1: \", subst(cub,z,-1));\n \\\\ residual algebra; assume irreducible cubic\n if(!polisirreducible(cub), print(\" residual cubic reducible!\"));\n my(cb = subst(cub,z,y)/pollead(cub));\n my(g = gcd(Mod(1,cb)*subst(subst(F,z,y),u,x), Mod(1,cb)*subst(subst(h,z,y),u,x)));\n print(\" gcd degree in u: \", poldegree(g,x));\n my(uval = -polcoef(g,0,x)/polcoef(g,1,x));\n my(tt = Mod(y,cb)/uval, ww = 1/uval);\n my(ct = charpoly(tt), cw = charpoly(ww));\n print(\" charpoly t: \", ct); print(\" charpoly w: \", cw);\n print(\" 2-vals coeffs t: \", vector(4,k, my(c=polcoef(ct,k-1)); if(c==0,\"inf\",valuation(c,2))), \" w: \", vector(4,k, my(c=polcoef(cw,k-1)); if(c==0,\"inf\",valuation(c,2))));\n \\\\ traces of t^k\n my(tr = vector(NT+1)); my(pw = Mod(1,cb)); for(k=1,NT+1, pw *= tt; tr[k] = trace(pw));\n my(L = vector(3)); for(j=1,3, L[j] = -1/16 * sum(n=0,NT-1, polcoef(om[j],n,t) * tr[n+1]/(n+1)));\n [L, h];\n}\nr0 = doit(0, 0, -1);\nr1 = doit(1, 1, -1);\nprec2 = 2^60;\nL0 = r0[1]; L1 = r1[1];\nprint(\"log G0 (2-adic, mod 2^40): \", vector(3,j, L0[j] + O(2^40)));\nprint(\"log G1 (2-adic, mod 2^40): \", vector(3,j, L1[j] + O(2^40)));\nprint(\"4 log G0 mod 2^12: \", vector(3,j, lift(4*L0[j]+O(2^12))), \" 4 log G1 mod 2^12: \", vector(3,j, lift(4*L1[j]+O(2^12))));\nprint(\"valuations log G0: \", vector(3,j,valuation(L0[j],2)), \" log G1: \", vector(3,j,valuation(L1[j],2)));\ncof = [L0[2]*L1[3]-L0[3]*L1[2], L0[3]*L1[1]-L0[1]*L1[3], L0[1]*L1[2]-L0[2]*L1[1]];\nvc = vecmin(vector(3,j,valuation(cof[j],2)));\nprint(\"cofactor valuations: \", vector(3,j,valuation(cof[j],2)), \" min \", vc);\na = cof/2^vc;\n\\\\ normalize to make a_2 == 9 mod 16 by a unit scaling\na2p = a[3] + O(2^50); print(\"annihilator raw mod 16: \", vector(3,j, (a[j]+O(2^4))));\nsc = 9/a2p; an = vector(3,j, a[j]*sc + O(2^40));\nprint(\"annihilator normalized so a2=9 mod 2^40: \", an);\nprint(\"annihilator mod 16: \", vector(3,j, lift(an[j]+O(2^4))), \" COFACTORVAL \", vc);\nprint(\"annihilator (integers mod 2^40): \", vector(3,j, lift(an[j])));\n\\\\ save truncated rationals for chart computation\nwrite(\"work/1.1.8f_annihilator.txt\", vector(3,j, lift(an[j])));\nwrite(\"work/1.1.8f_logs.txt\", [vector(3,j,lift(L0[j]*2^20+O(2^60))), vector(3,j,lift(L1[j]*2^20+O(2^60)))]);\nquit;\n" }, { "path": "anc/code/1.1.8/1.1.8g_charts.gp", "size_bytes": 2684, "sha256": "2e53aa223446d51847a70dd2d9a0283a3ae0cd517f6a2779a9383a34f3949de4", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.8g The two integral 2-adic charts: even chart z=-1+2t, u=4a; odd chart u=1+2t, z=-1+2b.\n\\\\ Valuations of the low coefficients of the primitives H_e, H_o of the annihilating differential.\n\\\\ Reads work/1.1.8f_annihilator.txt (run 1.1.8f_logs.gp first). Usage: gp -q 1.1.8g_charts.gp < /dev/null\ndefault(parisizemax, 2*10^9);\nan = read(\"work/1.1.8f_annihilator.txt\"); \\\\ integers approximating annihilator mod 2^40\nNT = 200;\n\\\\ even chart: z=-1+2t, u=4a, a-16a^3 = t-6t^2+8t^3-4t^4\nA = O(t^NT); for(it=1,NT, A = (t-6*t^2+8*t^3-4*t^4) + 16*A^3);\nprint(\"even chart eq residual val: \", valuation(A-16*A^3-(t-6*t^2+8*t^3-4*t^4), t));\n\\\\ omega = (a0 + a1 z + a2 u) dz / F_u, F_u = 1-3u^2 for source curve -u^3+u+z^4+2z+1\nZe = -1+2*t; Ue = 4*A;\nomE = (an[1] + an[2]*Ze + an[3]*Ue)*deriv(Ze,t)/(1-3*Ue^2);\nDe = omE/4;\nprint(\"De matches TeX formula: \", valuation(De - ((an[1]-an[2])/2 + an[2]*t + 2*an[3]*A)/(1-48*A^2), t));\nHe = intformal(De);\nprint(\"even chart: v2([t^n]H_e) n=1..12: \", vector(12,n, my(c=polcoef(He,n,t)); if(c==0,\"inf\",valuation(c,2))));\n\\\\ check all-orders bound numerically on computed range\nbad=0; for(n=2,NT-1, my(c=polcoef(He,n,t)); if(c!=0, my(v=valuation(c,2)); my(bd=ceil(2*(n-1)/3)-valuation(n,2)); if(v= ~30, limited by annihilator precision 40 and tail): \", valuation(val,2));\n\\\\ and tail bound at NT: ceil((NT-1)/3)-v2 >= ~ 60\n\\\\ Also H_e at random t: just sanity no zero mod 2 other than t=0 (Strassmann)\nprint(\"H_e mod 2 low poly: \", Pol(He+O(t^6))*Mod(1,2));\nprint(\"H_o mod 2 low poly: \", Pol(Ho+O(t^10))*Mod(1,2));\nquit;\n" }, { "path": "anc/code/1.1.8/data/1.1.8e_selmer_elements.gp", "size_bytes": 103133, "sha256": "c0bb962dbdbd09e02eef8429633ac8ac64148d3e5103908a3696ca4757dee3fb", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "EL=[[15558241334715797/3549896972308125,1022844275934478/709979394461625,-8535398185014221/1419958788923250,-150968110824887993/14199587889232500,-386590360747120337/14199587889232500,-43142048719488737/1577731987692500,-50732904274780031/28399175778465000,2345135617803665899/56798351556930000,5517628514538790457/113596703113860000,21531100255023439/709979394461625,876038595634540223/227193406227720000,-293980179331494703/227193406227720000,-278260139543350193/151462270818480000,-332961289916591509/113596703113860000,-163207717743001703/56798351556930000,-27658935373403509/50487423606160000,-80684546794712029/454386812455440000,-26036788176923167/56798351556930000,322707531876032731/3635094499643520000,1459461280312433/1211698166547840000,-6083894438914343/7270188999287040000,3065459616558763/7270188999287040000,-636477363541149/1615597555397120000,1223341635956131/14540377998574080000,-2797992748550771/14540377998574080000,-2856906573544103/29080755997148160000,-11013501373273529/58161511994296320000],[0,0,1/2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[7875815823271537/425987636676975,-168884798278757/85197527335395,-2096092851591397/340790109341580,-103451530950397253/1703950546707900,-125494682491361077/1703950546707900,-280752262857184111/3407901093415800,163804219033084523/6815802186831600,49801887597423994/425987636676975,57955477169030021/425987636676975,100020374123805179/1363160437366320,309455422658551733/27263208747326400,-35162051284945997/6815802186831600,-335916629046102359/54526417494652800,-392299490592408781/54526417494652800,-457744336542923729/54526417494652800,-20802574831331063/27263208747326400,-191707815410897261/218105669978611200,-27876420487239953/27263208747326400,5876992368681911/27263208747326400,-56174281268471/436211339957222400,-38703048729107/218105669978611200,-40034642448013/218105669978611200,-393295402262611/1744845359828889600,-239515738422487/872422679914444800,-1161653269212857/3489690719657779200,-1348405506967963/3489690719657779200,-1568134683705917/3489690719657779200],[-10519795764372917/3549896972308125,5318969866097059/1419958788923250,14251376202361981/1419958788923250,100496031249597341/4733195963077500,130315360408282991/7099793944616250,182463760083262001/28399175778465000,-1338426342858468043/56798351556930000,-143427052459998629/3549896972308125,-1334725475424996059/37865567704620000,-2455752456506837/157773198769250,-260479714690628303/227193406227720000,150634528814642111/75731135409240000,61151336850475933/25243711803080000,1070123603178850721/454386812455440000,822205620039674539/454386812455440000,270987696383385307/908773624910880000,482531526009824851/1817547249821760000,339315555924544459/1817547249821760000,-158909583172767241/3635094499643520000,11012885417689/151462270818480000,59058365492347/807798777698560000,48215576014511/605849083273920000,774921234847163/7270188999287040000,512652276459703/4846792666191360000,3775319142305237/29080755997148160000,590935647931643/4846792666191360000,331566398082359/3635094499643520000],[2445716780456576/3549896972308125,1123501663075573/1419958788923250,2003208873418489/2839917577846500,51602712022687753/7099793944616250,89808723989585083/28399175778465000,-5147772851883197/1183298990769375,-679156025828369821/56798351556930000,-193348100646260761/18932783852310000,-132921091024522673/37865567704620000,280372787354867/11359670311386000,-30241918048505041/227193406227720000,116479666759526951/227193406227720000,259246433857848109/227193406227720000,2450235245436159/25243711803080000,48257099575820197/302924541636960000,131454394903073129/908773624910880000,-18803529297554903/1817547249821760000,9387516116240549/908773624910880000,-959026807035353/403899388849280000,22432827541667/3635094499643520000,56748003374353/3635094499643520000,181574556233327/3635094499643520000,35325272263547/14540377998574080000,199255819981699/7270188999287040000,426764724202241/7270188999287040000,16070081205073/2423396333095680000,292318453214993/58161511994296320000],[-22058894955189607/709979394461625,1396980579797989/283991757784650,7841848144307/15777319876925,242666843340347383/2839917577846500,310214147568962597/2839917577846500,278068584719528357/1893278385231000,-161145134299105303/11359670311386000,-213533072776949741/1262185590154000,-1231338413410221173/5679835155693000,-559637958316440163/4543868124554400,-114985906858448861/5679835155693000,115649920041070381/15146227081848000,764739397275267749/90877362491088000,326235489723458147/30292454163696000,8900210531005751/631092795077000,46864565702134793/45438681245544000,486286972019927671/363509449964352000,321813961475704357/181754724982176000,-14768395565577777/40389938884928000,67572681913153/363509449964352000,5983978844947/22719340622772000,29662971137531/121169816654784000,105833333127669/323119511079424000,196819828006519/484679266619136000,2653377631957327/5816151199429632000,842013877614917/1454037799857408000,8864464707235949/11632302398859264000],[-7789084888512719/709979394461625,5105803604417/31554639753850,456344853711877/283991757784650,20143797661126534/709979394461625,241610648008467623/5679835155693000,139400889750500591/2839917577846500,-91568196090391651/11359670311386000,-227515042683999041/3786556770462000,-1625747577523770989/22719340622772000,-21978351502132967/567983515569300,-67358113073951449/11359670311386000,57880267653272203/22719340622772000,845557329376141/315546397538500,2874158883919474/709979394461625,86186500366835619/20194969442464000,29932889005326487/90877362491088000,189085956307746607/363509449964352000,2898316530172217/5679835155693000,-26636433830846879/242339633309568000,41605390930877/727018899928704000,34229378536409/363509449964352000,52190829429187/727018899928704000,310173472437557/2908075599714816000,390774818972813/2908075599714816000,213043646772821/1454037799857408000,26617553578097/121169816654784000,1332094405006679/5816151199429632000],[14269810066676888/709979394461625,-675514173679118/141995878892325,315191587114351/283991757784650,-54030550898613749/946639192615500,-378817647129457571/5679835155693000,-555403974657583889/5679835155693000,5798078184059471/946639192615500,206542087823425091/1893278385231000,366622897346345967/2524371180308000,127937048766458809/1514622708184800,54204566880982091/3786556770462000,-231189224816666737/45438681245544000,-521218886414939141/90877362491088000,-610814132028681769/90877362491088000,-198620236625348413/20194969442464000,-21265414132981033/30292454163696000,-12383375654674211/15146227081848000,-76355944170064471/60584908327392000,61973939562619783/242339633309568000,-31179990965143/242339633309568000,-61514282982743/363509449964352000,-125786997395999/727018899928704000,-80290815713933/363509449964352000,-790144149066301/2908075599714816000,-1801203044866043/5816151199429632000,-522603234677753/1454037799857408000,-6200275897222591/11632302398859264000],[1858209861895614/78886599384625,-1247268032388901/141995878892325,-4295594017217411/567983515569300,-119422798358158397/1419958788923250,-58057289703105063/631092795077000,-306916543477656539/2839917577846500,414502150120508729/11359670311386000,50718463365866847/315546397538500,266652535716660191/1419958788923250,19333329352961791/189327838523100,361600682543936567/22719340622772000,-111349830863828533/15146227081848000,-819993120559308557/90877362491088000,-216422119152910247/22719340622772000,-721668705347947403/60584908327392000,-50401585823266549/45438681245544000,-413070061798955003/363509449964352000,-177936067302282059/121169816654784000,18517655682901129/60584908327392000,-154572407762183/727018899928704000,-352902962395969/1454037799857408000,-35838057993233/121169816654784000,-236269069332607/727018899928704000,-1144563076583377/2908075599714816000,-1404305091878243/2908075599714816000,-328889095633811/646239022158848000,-617610019246711/969358533238272000],[31425143524149218/10649690916924375,-1129628573207143/2129938183384875,-7974211687903562/2129938183384875,-588167109125804167/42598763667697500,-854685881905168831/85197527335395000,-79128840600500488/10649690916924375,156205417227340859/21299381833848750,2909183140946432231/170395054670790000,3264419987969113879/170395054670790000,725635517572369637/68158021868316000,1126332364411341037/681580218683160000,-371871222896476391/340790109341580000,-343038408781944319/340790109341580000,-308681070419985071/340790109341580000,-3556103029839968387/2726320874732640000,-40036303892673191/340790109341580000,-140397435369625201/1363160437366320000,-855043255732420811/5452641749465280000,87554685270603841/2726320874732640000,-387093419078419/10905283498930560000,-440231275133317/21810566997861120000,-297523655018539/10905283498930560000,-1431234014990579/43621133995722240000,-2660193078518161/43621133995722240000,-4761680686546873/87242267991444480000,-4193356424558507/87242267991444480000,-1459400993881447/21810566997861120000],[2411302945421434/10649690916924375,-6758976311114084/2129938183384875,-9776129435263081/2129938183384875,-298318574355705821/42598763667697500,-63734575958964503/85197527335395000,114859423168522849/42598763667697500,1208454297169928861/170395054670790000,1252299342395741203/170395054670790000,2337740950024299829/340790109341580000,224994206587764181/68158021868316000,31637702504776391/42598763667697500,-440877828219982691/681580218683160000,-536297043068856019/681580218683160000,-144543912105482617/1363160437366320000,-1580209603981984681/2726320874732640000,-232398924307952339/2726320874732640000,15827906173132873/5452641749465280000,-391185327219574993/5452641749465280000,144932250573322157/10905283498930560000,-62111890505093/2726320874732640000,8876989084819/1363160437366320000,-29297837014277/681580218683160000,-421200086576077/43621133995722240000,-1703753457504293/43621133995722240000,-843788013246581/21810566997861120000,-254089651142933/43621133995722240000,-75624388701667/2726320874732640000],[-69545389576868413/3549896972308125,4628655815850851/1419958788923250,204416449100977/315546397538500,43058582929726479/788865993846250,113762573787171147/1577731987692500,296934771981756471/3155463975385000,-630374844234919777/56798351556930000,-6354214900209557921/56798351556930000,-3985717558204536857/28399175778465000,-592993362881824189/7573113540924000,-928893066984303139/75731135409240000,68333316667160107/14199587889232500,2471459378126996891/454386812455440000,416026491676443493/56798351556930000,2009973399307781473/227193406227720000,202852868058365291/302924541636960000,1662181831615108139/1817547249821760000,665108377612208567/605849083273920000,-34776553488358801/151462270818480000,166983127284493/1211698166547840000,309394542860693/1817547249821760000,288658822260637/1817547249821760000,1104794682409013/4846792666191360000,1859958726919463/7270188999287040000,8572443559752893/29080755997148160000,11423752504464187/29080755997148160000,13915425160973533/29080755997148160000],[-38681549371534916/10649690916924375,3833969467160566/2129938183384875,4891985858504413/4259876366769750,256391344953543227/21299381833848750,883676034178020697/85197527335395000,723461941650200123/85197527335395000,-1359530658862630039/170395054670790000,-801985193659178843/42598763667697500,-6436514482445907521/340790109341580000,-84941708506563493/8519752733539500,-487339561473186947/340790109341580000,618664560189317209/681580218683160000,407423760115083853/340790109341580000,1327629853016915183/1363160437366320000,3222260147896922969/2726320874732640000,208058299736664443/1363160437366320000,580310304696559423/5452641749465280000,194055417322242833/1363160437366320000,-324887580279197143/10905283498930560000,112514663570339/5452641749465280000,199830403645501/5452641749465280000,348291138878743/10905283498930560000,1685429852250473/43621133995722240000,2067828166620157/43621133995722240000,177841150655243/2726320874732640000,558755863836973/10905283498930560000,2708752879645253/43621133995722240000],[-30676005278714971/10649690916924375,-15144109733134283/4259876366769750,-55971696636528269/8519752733539500,92354835320787187/21299381833848750,136499039278762007/85197527335395000,1685969810861864413/85197527335395000,3113409483185226241/170395054670790000,1302570444434441693/170395054670790000,-1521348087220393613/170395054670790000,-386402973571364207/34079010934158000,-1375023381269695507/340790109341580000,13719120197750113/85197527335395000,-665863970501823703/1363160437366320000,-946016808200844977/1363160437366320000,4171216366145667589/2726320874732640000,-102276839665615667/1363160437366320000,-396616442981018287/5452641749465280000,1329234726591862567/5452641749465280000,-111361033218255977/2726320874732640000,-96056626297033/2726320874732640000,-526330138660951/21810566997861120000,-111906752140871/5452641749465280000,-1276010049220681/21810566997861120000,526400776881767/43621133995722240000,-1123476012052247/43621133995722240000,-2760518115606521/87242267991444480000,1854925461419159/21810566997861120000],[-35543629449914986/10649690916924375,-7797790985507989/2129938183384875,-25658029955550779/8519752733539500,221900528056549409/42598763667697500,1451992384239393137/85197527335395000,2230989948933017833/85197527335395000,113523995662081757/21299381833848750,-3033722444838006937/170395054670790000,-8981115721353988441/340790109341580000,-1083545268480047449/68158021868316000,-1968687627933280649/681580218683160000,259613410121929507/340790109341580000,522071293179910277/1363160437366320000,1966514548476937843/1363160437366320000,4596765953506130599/2726320874732640000,62419964205153553/1363160437366320000,280000739937785627/1363160437366320000,571335119400533861/2726320874732640000,-483491946650406503/10905283498930560000,-28029628718381/5452641749465280000,7863057424153/170395054670790000,-6635364219011/5452641749465280000,395415592063529/21810566997861120000,1604763367431797/43621133995722240000,2060820608779421/87242267991444480000,3517343064201107/43621133995722240000,4028342201791813/43621133995722240000],[-1775384570653306/141995878892325,-10057288913234/9466391926155,492243875764243/113596703113860,1162646009451153/31554639753850,7224450339709649/141995878892325,71077558429830983/1135967031138600,-2137279586833071/252437118030800,-86053908975297661/1135967031138600,-433059488313272831/4543868124554400,-48347548078040173/908773624910880,-9335605107124933/1135967031138600,32849816103100519/9087736249108800,30405999719332981/9087736249108800,649636129468777/126218559015400,108752196941613737/18175472498217600,14487586977576991/36350944996435200,47731834555327243/72701889992870400,13241270378113283/18175472498217600,-7452840469043831/48467926661913600,14093761241083/145403779985740800,35228687287459/290807559971481600,4439468607311/48467926661913600,14666352228503/96935853323827200,3508508389601/18175472498217600,212569660854211/1163230239885926400,161026403882107/581615119942963200,745478787300647/2326460479771852800],[-70146535788291856/10649690916924375,17857139248970287/4259876366769750,5620182726343741/8519752733539500,211575868146693266/10649690916924375,1731803778642192677/85197527335395000,2397482973528801193/85197527335395000,-1286500952420113049/170395054670790000,-6837313736336770477/170395054670790000,-2053319888348245817/42598763667697500,-451731844651442701/17039505467079000,-1367177338204732927/340790109341580000,574445261553869197/340790109341580000,3154807683428740367/1363160437366320000,3272366254116841153/1363160437366320000,8401554532608657679/2726320874732640000,98188545187882297/340790109341580000,1532429572178904743/5452641749465280000,2114875810298644087/5452641749465280000,-218267461384690847/2726320874732640000,327973982000599/5452641749465280000,1243342725189239/21810566997861120000,26746764467359/340790109341580000,2037130707987959/21810566997861120000,3940719538054037/43621133995722240000,5378686516667683/43621133995722240000,11042433544329469/87242267991444480000,7279399782543523/43621133995722240000],[-2152410224053534/425987636676975,191919672667877/85197527335395,478478524011757/340790109341580,8391679298489414/425987636676975,31307998786387669/1703950546707900,80653738175302387/3407901093415800,-75008342368522571/6815802186831600,-16631819232881863/425987636676975,-77835568486358273/1703950546707900,-34994722277115071/1363160437366320,-107283989276629121/27263208747326400,58384340264263691/27263208747326400,122838654033364643/54526417494652800,3820150681450001/1703950546707900,41845066933634567/13631604373663200,29485594304560199/109052834989305600,56640648781752227/218105669978611200,82939498069890373/218105669978611200,-4252192861451719/54526417494652800,14257473381031/218105669978611200,9049024867297/109052834989305600,33508277756537/436211339957222400,153812594813677/1744845359828889600,98437163974849/872422679914444800,421279624186679/3489690719657779200,206176651914923/1744845359828889600,70901511394663/436211339957222400],[170081061978693877/10649690916924375,-5349152028072752/2129938183384875,-10987267195836118/2129938183384875,-2165602056822559763/42598763667697500,-5084901593366155409/85197527335395000,-5719431589135692631/85197527335395000,3595599782684448383/170395054670790000,4294110269919524221/42598763667697500,39909392659290182437/340790109341580000,2107575050361986909/34079010934158000,3071004701817365659/340790109341580000,-724635631243377437/170395054670790000,-3630274092020622757/681580218683160000,-8689500733543205701/1363160437366320000,-19220345183472722593/2726320874732640000,-1783229631254542217/2726320874732640000,-4242345985487239481/5452641749465280000,-1163319395117447251/1363160437366320000,1978360789219960571/10905283498930560000,-1573087526333591/10905283498930560000,-88244554472359/681580218683160000,-962306651670823/5452641749465280000,-9423208565185081/43621133995722240000,-10031854815525029/43621133995722240000,-12404453299672711/43621133995722240000,-7419754045022287/21810566997861120000,-16497868172478991/43621133995722240000],[34602722706232378/2129938183384875,-5010103842002521/851975273353950,-18969170112801553/1703950546707900,-490499439472242107/8519752733539500,-1078763228676258701/17039505467079000,-1085525148064771909/17039505467079000,1175546044074361037/34079010934158000,996564750801522319/8519752733539500,549073891244372323/4259876366769750,224977615379682373/3407901093415800,599795611958583601/68158021868316000,-713190212480834747/136316043736632000,-1727094505422615221/272632087473264000,-1998235848870956089/272632087473264000,-4129975263541779277/545264174946528000,-209709956439457519/272632087473264000,-962941115305693409/1090528349893056000,-974616440238205081/1090528349893056000,210173390874080047/1090528349893056000,-105316562306981/545264174946528000,-717350938619057/4362113399572224000,-242410202339647/1090528349893056000,-585654625762921/2181056699786112000,-1232537174831653/4362113399572224000,-1468196555237177/4362113399572224000,-6779698826586547/17448453598288896000,-7011257666536373/17448453598288896000],[-7708098466190654/3549896972308125,272643171835018/236659798153875,-689290687971689/709979394461625,8558507545513771/2366597981538750,12114316382158307/1183298990769375,54714505784992351/2366597981538750,436243882909100509/56798351556930000,-16386872923561241/1183298990769375,-2734762409078584399/113596703113860000,-21332210464917721/1419958788923250,-692135450873678861/227193406227720000,13465958773447469/25243711803080000,8331792813288347/18932783852310000,156370702144510159/151462270818480000,258278399508627131/151462270818480000,44046013569710209/908773624910880000,262208864261902037/1817547249821760000,206550180981777029/908773624910880000,-165484429769199467/3635094499643520000,-54572974430743/3635094499643520000,142912157098201/7270188999287040000,71514853794617/3635094499643520000,117920321208181/7270188999287040000,49766950226701/1817547249821760000,74127723998041/3231195110794240000,1679978945146271/29080755997148160000,459829120676519/4846792666191360000],[-13794835655122658/2129938183384875,-532306463125907/425987636676975,2279593149844823/1703950546707900,56994174484481801/4259876366769750,421157249358011761/17039505467079000,588379494449551049/17039505467079000,2712333100693448/2129938183384875,-313428193750282859/8519752733539500,-3329793373782842123/68158021868316000,-367483050450657617/13631604373663200,-515514681432851797/136316043736632000,100560312140778671/68158021868316000,337551010424826331/272632087473264000,793075951093778429/272632087473264000,1572117857981445947/545264174946528000,79557317269520593/545264174946528000,104794358029257031/272632087473264000,189960333333591583/545264174946528000,-164618065234606759/2181056699786112000,41830085399807/1090528349893056000,977783418067/17039505467079000,71313309979009/2181056699786112000,395339242766137/4362113399572224000,676542664202641/8724226799144448000,1189003478284063/17448453598288896000,338398223608849/2181056699786112000,686177839629757/4362113399572224000],[-191361486484540409/10649690916924375,19560901722696743/4259876366769750,27276925582573837/4259876366769750,1368190239078989423/21299381833848750,1526482582819247707/21299381833848750,6810013330800894977/85197527335395000,-2465515649693758943/85197527335395000,-20550656481231326903/170395054670790000,-5946256183151559913/42598763667697500,-1288267797115118489/17039505467079000,-2028416449977157789/170395054670790000,3861851865764545591/681580218683160000,2286272281240221997/340790109341580000,9712960895057773667/1363160437366320000,752298037751530483/85197527335395000,559646696973233641/681580218683160000,2331810677402710151/2726320874732640000,736530902288006071/681580218683160000,-307513522172929979/1363160437366320000,1662638152431547/10905283498930560000,506275213843787/2726320874732640000,1184764378217741/5452641749465280000,5050941371990251/21810566997861120000,6613863305348309/21810566997861120000,7842944930752981/21810566997861120000,4169699295779377/10905283498930560000,2564131385444809/5452641749465280000],[-29752780969638859/3549896972308125,6637672235864893/1419958788923250,3779907954037229/473319596307750,25891966764692397/788865993846250,963849623775460103/28399175778465000,799382463856990327/28399175778465000,-1224592023467843561/56798351556930000,-3410129609141361803/56798351556930000,-386216031791484653/6310927950770000,-337649780714192503/11359670311386000,-765708003357525331/227193406227720000,86462308675755461/37865567704620000,509214974468365921/151462270818480000,1688442802867918517/454386812455440000,333419828732834959/100974847212320000,96922852793513941/227193406227720000,797370408096771277/1817547249821760000,688143852986903593/1817547249821760000,-51070897856526947/605849083273920000,171767323309261/1817547249821760000,490455239660221/7270188999287040000,363580462716707/3635094499643520000,115869503411089/807798777698560000,200758725062127/1615597555397120000,2629958031467437/14540377998574080000,631703152090799/3231195110794240000,10221563874188663/58161511994296320000],[35428169690700316/3549896972308125,-930285579424773/157773198769250,-35230875218509301/2839917577846500,-143612413711682326/3549896972308125,-189203284517934937/4733195963077500,-103293846245779897/3155463975385000,791571720937900007/28399175778465000,4191224980581493547/56798351556930000,4405222684610913773/56798351556930000,446626228455705347/11359670311386000,131383315890486291/25243711803080000,-5676424337734661/1577731987692500,-951656145016794481/227193406227720000,-1985378989227688883/454386812455440000,-2088964423303064597/454386812455440000,-154234303187831887/302924541636960000,-466510499987532499/908773624910880000,-486710810234793941/908773624910880000,209602665274694359/1817547249821760000,-399638373159253/3635094499643520000,-404770679860177/3635094499643520000,-62688480653821/454386812455440000,-401096280969133/2423396333095680000,-2819971803034207/14540377998574080000,-1628775011284169/7270188999287040000,-1678982896949971/7270188999287040000,-13986104043422437/58161511994296320000],[88804414873080244/10649690916924375,11238531814494587/4259876366769750,45082204323504641/8519752733539500,-347922584880252793/21299381833848750,-342560460743624206/10649690916924375,-4608731369892650107/85197527335395000,-213907205756063003/21299381833848750,7030236146143241473/170395054670790000,5334075222998152141/85197527335395000,636432862704418399/17039505467079000,4504515935275503671/681580218683160000,-1117743469408848881/681580218683160000,-505778155611148427/340790109341580000,-4190755204108474897/1363160437366320000,-5644166974597733423/1363160437366320000,-120467517671616431/681580218683160000,-1127989519959819841/2726320874732640000,-362592029587250561/681580218683160000,596621334808321831/5452641749465280000,-399051536822477/10905283498930560000,-156805137200317/2726320874732640000,-217285651279531/5452641749465280000,-1483586117156441/21810566997861120000,-1896897058986019/21810566997861120000,-1772925496350371/21810566997861120000,-1836823958191757/10905283498930560000,-39777511548543733/174484535982888960000],[-57101221760910653/10649690916924375,8540250435901228/2129938183384875,35522685510666683/8519752733539500,646164926949313057/42598763667697500,604171213753439363/42598763667697500,926077307148831209/85197527335395000,-908928476021264681/85197527335395000,-4404272911865953001/170395054670790000,-4233616543467224059/170395054670790000,-381609059510253301/34079010934158000,-658482183713258077/681580218683160000,103127955571189243/170395054670790000,1160285950397999723/681580218683160000,2066692851233767439/1363160437366320000,825101353977846263/681580218683160000,621145434735907663/2726320874732640000,455086785398505617/2726320874732640000,770168732103043931/5452641749465280000,-174005553697503497/5452641749465280000,18405653330657/340790109341580000,101199674739041/10905283498930560000,1088057226211463/21810566997861120000,1511807293427317/21810566997861120000,764509128078203/21810566997861120000,3969865788793079/43621133995722240000,854339333502259/10905283498930560000,11608313066044871/174484535982888960000],[-9583286736946421/10649690916924375,-6200574983147579/2129938183384875,-8499728059565161/2129938183384875,-462587272557305201/42598763667697500,-416212650586901093/85197527335395000,-11168751742626487/85197527335395000,2258828226828666941/170395054670790000,3191258561350674043/170395054670790000,1486002710177791831/85197527335395000,317056296581361593/34079010934158000,937332338975143811/681580218683160000,-1094117181980467421/681580218683160000,-1735523017103043053/1363160437366320000,-1125965498851369627/1363160437366320000,-3510598210988170111/2726320874732640000,-379913591870535509/2726320874732640000,-453096556059820187/5452641749465280000,-12561524426457397/85197527335395000,163351541296820371/5452641749465280000,-357275894773157/10905283498930560000,-1279814031022901/21810566997861120000,-1170950485393909/21810566997861120000,-901679879364131/21810566997861120000,-3694648523927333/43621133995722240000,-1460426615190761/21810566997861120000,-3739177381496221/87242267991444480000,-10903562205845203/174484535982888960000],[-14021525044451566/1183298990769375,84820154131472/78886599384625,-340108838187179/157773198769250,460184007975467287/14199587889232500,1388392822592875741/28399175778465000,924429786260663297/14199587889232500,-92692795593361573/14199587889232500,-4293975772098526891/56798351556930000,-1768862840040023773/18932783852310000,-1166300111425536457/22719340622772000,-1894853591310557357/227193406227720000,38595564088898739/12621855901540000,424876187014242659/113596703113860000,370226149133627879/75731135409240000,5275803737101448207/908773624910880000,3283525770785411/7099793944616250,31072876451904479/50487423606160000,435788754962574757/605849083273920000,-137268548032740601/908773624910880000,84175509151753/1211698166547840000,288714075495979/2423396333095680000,445272273058579/3635094499643520000,2013835860855019/14540377998574080000,777248920806707/4846792666191360000,5836239374085653/29080755997148160000,7699805846571527/29080755997148160000,2289060129239117/7270188999287040000],[-86220648381852227/3549896972308125,698346607721609/236659798153875,3264200519982418/709979394461625,27224901034379508/394432996923125,2519772455727498109/28399175778465000,3121425142375354681/28399175778465000,-52556948635944338/3549896972308125,-7563526718203861709/56798351556930000,-1046333482019211759/6310927950770000,-174868531722928889/1893278385231000,-3236423128021697593/227193406227720000,146442045926156197/25243711803080000,39695175783689687/6310927950770000,1998349488280100813/227193406227720000,9420865817274151243/908773624910880000,705834353260420817/908773624910880000,166821064213282513/151462270818480000,386995962725155909/302924541636960000,-81308437754133833/302924541636960000,17749171051063/113596703113860000,1436289228398263/7270188999287040000,591836037121571/3635094499643520000,3959187190032631/14540377998574080000,4497722509750229/14540377998574080000,10008330529977647/29080755997148160000,13702167749601173/29080755997148160000,508331274360151/908773624910880000],[-155742771578509519/3549896972308125,1573648863272507/157773198769250,6639714146939921/709979394461625,475094709615260234/3549896972308125,594935962364287556/3549896972308125,5836757384442542057/28399175778465000,-2510963339766738451/56798351556930000,-3868679340512746787/14199587889232500,-37257475559328312839/113596703113860000,-339232648615617733/1893278385231000,-2103157807982391007/75731135409240000,904020051970572577/75731135409240000,1586667982203368377/113596703113860000,3915961303384387861/227193406227720000,9291401034803418223/454386812455440000,1556968642472833999/908773624910880000,3862654960117916257/1817547249821760000,285322864196835143/113596703113860000,-1917447198748471487/3635094499643520000,1214535986559427/3635094499643520000,2948776288649261/7270188999287040000,533619847191379/1211698166547840000,3973907982697541/7270188999287040000,1543640196256223/2423396333095680000,21841513888022759/29080755997148160000,8963353634103427/9693585332382720000,31972425449407829/29080755997148160000],[-136319487090364562/10649690916924375,3419772734756887/2129938183384875,4447711464069083/2129938183384875,492179783263051507/10649690916924375,2509932174841898027/42598763667697500,3089804721183991843/42598763667697500,-590489221234766437/42598763667697500,-1973888807155251613/21299381833848750,-4796046387082331959/42598763667697500,-132016745370280594/2129938183384875,-1702723284585753277/170395054670790000,176743931662092793/42598763667697500,202208371228084037/42598763667697500,3949397483042621053/681580218683160000,1211469640071519563/170395054670790000,197645540890372919/340790109341580000,489682549785523067/681580218683160000,597142756299449203/681580218683160000,-124840082342206411/681580218683160000,286168250361049/2726320874732640000,379832244324641/2726320874732640000,408335118548569/2726320874732640000,1868185399388909/10905283498930560000,2413858341444631/10905283498930560000,2783799851100479/10905283498930560000,426449593191767/1363160437366320000,4163290690799399/10905283498930560000],[-53807649521689348/2129938183384875,7291123082697571/851975273353950,17002959229696153/1703950546707900,334856277430466881/4259876366769750,1559576496887175041/17039505467079000,1805323469981566669/17039505467079000,-1026158885919931517/34079010934158000,-321612110307833926/2129938183384875,-3030338198001398947/17039505467079000,-327910551693910483/3407901093415800,-975668159355947041/68158021868316000,893314979251440527/136316043736632000,2150233506881510561/272632087473264000,2585965671244418599/272632087473264000,5971362164532877807/545264174946528000,132974929869161627/136316043736632000,1259442218834271569/1090528349893056000,1459084080330045571/1090528349893056000,-153823389109209401/545264174946528000,429267112873709/2181056699786112000,932159418012287/4362113399572224000,514905680839529/2181056699786112000,1397811759225047/4362113399572224000,3066153566246921/8724226799144448000,3713300868466339/8724226799144448000,8822219736378127/17448453598288896000,10259437520283743/17448453598288896000],[-405357734698811302/10649690916924375,43295160883001629/4259876366769750,102805642004757097/8519752733539500,2658640953678437419/21299381833848750,12817746834119671259/85197527335395000,15206226792275817031/85197527335395000,-7492751314538723333/170395054670790000,-5190009910233590873/21299381833848750,-24743783764171658653/85197527335395000,-2695686721431797167/17039505467079000,-8283787365951241759/340790109341580000,7294477802850687323/681580218683160000,17221835413706241989/1363160437366320000,20828623322307335101/1363160437366320000,49240325063808702043/2726320874732640000,1060165731126553973/681580218683160000,10214671492455542381/5452641749465280000,12072562452045821479/5452641749465280000,-1268477274914872649/2726320874732640000,3291008565812741/10905283498930560000,7699455044658563/21810566997861120000,4207868878391921/10905283498930560000,10725429594903053/21810566997861120000,24986201197013129/43621133995722240000,29701703746733611/43621133995722240000,71403872646163723/87242267991444480000,84603513127813907/87242267991444480000],[-366301480526504384/10649690916924375,22878665584971443/4259876366769750,27829910755086637/4259876366769750,2162589617512973123/21299381833848750,10544648206410757153/85197527335395000,12876417908222093777/85197527335395000,-5389409607203426911/170395054670790000,-33809953167689196353/170395054670790000,-40965812118916517827/170395054670790000,-4487216129571746053/34079010934158000,-13911701203754819431/681580218683160000,2929853206661708933/340790109341580000,13978002506428878313/1363160437366320000,17075170674765768467/1363160437366320000,40959049207986802481/2726320874732640000,860414824108750291/681580218683160000,8396391217172064727/5452641749465280000,10096114368173629643/5452641749465280000,-2115547610233523441/5452641749465280000,1432318657737611/5452641749465280000,6003335426492071/21810566997861120000,3432260557750657/10905283498930560000,8724789972837151/21810566997861120000,20152660302457693/43621133995722240000,24082956994011887/43621133995722240000,58574809241443541/87242267991444480000,141098821282540463/174484535982888960000],[-8538275192660236/3549896972308125,731023191218311/709979394461625,1689667140994573/1419958788923250,18651764507060339/2366597981538750,163675775566333387/28399175778465000,8083308276454537/3155463975385000,-380546390433461069/56798351556930000,-77470292472437789/7099793944616250,-342921044201408897/37865567704620000,-2047151578233613/473319596307750,-31208289392209381/56798351556930000,114274742909930639/227193406227720000,91241286823650163/113596703113860000,217139791667780093/454386812455440000,483042045568342099/908773624910880000,47708413099818553/454386812455440000,83987086603075133/1817547249821760000,27862489468533743/454386812455440000,-47534394487984253/3635094499643520000,8487186119873/605849083273920000,38626906750771/1817547249821760000,78154327353853/3635094499643520000,304252250469683/14540377998574080000,126962931981349/4846792666191360000,9933564073307/227193406227720000,7571878152109/302924541636960000,396474634115563/14540377998574080000],[22183500767153347/3549896972308125,1223055303037103/709979394461625,6951518719042327/709979394461625,-15924300202844731/4733195963077500,-120639619648753387/14199587889232500,-884174613273853291/28399175778465000,-29829444176612767/1577731987692500,18277909018050664/3549896972308125,1304866650031261691/56798351556930000,394448592605464523/22719340622772000,3486687345307521/788865993846250,-5378296781915903/227193406227720000,-16667859554281201/113596703113860000,-1662087271868791/4733195963077500,-934951492604963599/454386812455440000,-16298355716607587/908773624910880000,-53247465306819133/908773624910880000,-557496471779640319/1817547249821760000,17189821298445313/302924541636960000,20608039159883/1211698166547840000,9468272013229/908773624910880000,-25405606372831/3635094499643520000,119510477032567/7270188999287040000,-6056537817349/2423396333095680000,-51682060008523/7270188999287040000,-55901531633369/2423396333095680000,-1719180937513751/14540377998574080000],[-40045880977614448/2129938183384875,4543537380755551/851975273353950,6919575807288809/851975273353950,519754491527691587/8519752733539500,1276120894195779041/17039505467079000,664087665923632697/8519752733539500,-1066898439636943967/34079010934158000,-4250692699032041041/34079010934158000,-2363375705526015697/17039505467079000,-975872962071418387/13631604373663200,-1316573659016522057/136316043736632000,683359496281085177/136316043736632000,1784512757490915161/272632087473264000,2170802347045776349/272632087473264000,4366918755763278607/545264174946528000,446565064345190783/545264174946528000,1056800971410780119/1090528349893056000,518615503652730773/545264174946528000,-224643995946549877/1090528349893056000,385117611015209/2181056699786112000,753036165978587/4362113399572224000,54418748457763/272632087473264000,601518000728911/2181056699786112000,2339537156708771/8724226799144448000,3075627853839589/8724226799144448000,7388224081594927/17448453598288896000,14985178722330661/34896907196577792000],[-42666231214664984/10649690916924375,22997718680680643/4259876366769750,30858018902337937/4259876366769750,443621452900690073/21299381833848750,349861165795173989/42598763667697500,124452658299389327/85197527335395000,-1631252548799820593/85197527335395000,-4648913893519317803/170395054670790000,-4442605523357247127/170395054670790000,-476926579383279253/34079010934158000,-312381845208949489/170395054670790000,1309030572163395391/681580218683160000,708077945469583597/340790109341580000,1551722601130200017/1363160437366320000,318864316994671391/170395054670790000,169517209218189691/681580218683160000,134230632089402413/1363160437366320000,9619591536180031/42598763667697500,-30754359509287777/681580218683160000,725470076015647/10905283498930560000,75684501707131/1363160437366320000,372361248881291/5452641749465280000,1584555279489301/21810566997861120000,2276081360114759/21810566997861120000,2424437186031031/21810566997861120000,2463321014566783/43621133995722240000,4103733947275697/43621133995722240000],[-133681509198020054/10649690916924375,-7722824239124546/2129938183384875,8897342707077697/4259876366769750,357867429408240619/10649690916924375,440371614652794896/10649690916924375,1030041026329279103/21299381833848750,-461650520344533233/85197527335395000,-4700127116147624059/85197527335395000,-6057871857619430981/85197527335395000,-695241291030036659/17039505467079000,-2365364463764422043/340790109341580000,472211246109944299/170395054670790000,880051036658948407/340790109341580000,2389227558750189151/681580218683160000,6374491272149154943/1363160437366320000,212557911976337371/681580218683160000,302295609964683389/681580218683160000,1581798723507695179/2726320874732640000,-163428009685368599/1363160437366320000,40162142997427/681580218683160000,876038435006213/10905283498930560000,627507578393317/10905283498930560000,490413520399789/5452641749465280000,3261487903246829/21810566997861120000,3112927909178161/21810566997861120000,4154160490421249/21810566997861120000,21797447924572639/87242267991444480000],[-3142493692379954/141995878892325,3393688923881/5679835155693,31527358493798/5679835155693,9727609676362474/141995878892325,46912166502827869/567983515569300,104946859197394307/1135967031138600,-2350030656712739/94663919261550,-146007557570427139/1135967031138600,-229200309250325153/1514622708184800,-37078969690331009/454386812455440,-118000359530523541/9087736249108800,12847162571834999/2271934062277200,41488806712187371/6058490832739200,142582328112258707/18175472498217600,170744340772992073/18175472498217600,15321808601791927/18175472498217600,2911779963182213/3029245416369600,9277710893333427/8077987776985600,-35072027978142757/145403779985740800,21488392858837/145403779985740800,16804029184237/96935853323827200,2583719842871/12116981665478400,137036529034837/581615119942963200,7376464972457/24233963330956800,214003312283777/581615119942963200,492338523558481/1163230239885926400,1169829872764343/2326460479771852800],[-4558532025366614/236659798153875,1661174850234809/283991757784650,5093601311285837/567983515569300,108053103211463549/1419958788923250,121654083556976641/1419958788923250,516699167656221151/5679835155693000,-26813214233027648/709979394461625,-1636798984556052289/11359670311386000,-923340688355411713/5679835155693000,-98389004214671407/1135967031138600,-67535335862300167/5048742360616000,100845829861736011/15146227081848000,181970385602546411/22719340622772000,85976553541200069/10097484721232000,915956484436438639/90877362491088000,14891436575330561/15146227081848000,185964725221624313/181754724982176000,6160692466752947/5048742360616000,-93387998844465383/363509449964352000,126019631071061/727018899928704000,40190623429931/181754724982176000,31467884953661/121169816654784000,133092344008871/484679266619136000,517235753786167/1454037799857408000,624151593870103/1454037799857408000,332424635525101/727018899928704000,6229852703802469/11632302398859264000],[208679748795611158/10649690916924375,-4447711464069083/2129938183384875,-13480275858990419/4259876366769750,-1260290932879411201/21299381833848750,-3089804721183991843/42598763667697500,-3665220239718992987/42598763667697500,377997759297591829/21299381833848750,4796046387082331959/42598763667697500,1443252481818587864/10649690916924375,2515685048071294361/34079010934158000,488210671611932117/42598763667697500,-202208371228084037/42598763667697500,-3949397483042621053/681580218683160000,-1211469640071519563/170395054670790000,-2857463953986472559/340790109341580000,-489682549785523067/681580218683160000,-597142756299449203/681580218683160000,-702658979509913477/681580218683160000,590784590215438871/2726320874732640000,-379832244324641/2726320874732640000,-408335118548569/2726320874732640000,-1868185399388909/10905283498930560000,-2413858341444631/10905283498930560000,-2783799851100479/10905283498930560000,-426449593191767/1363160437366320000,-4163290690799399/10905283498930560000,-2462794826940833/5452641749465280000],[-78532254099971572/10649690916924375,5399948950217522/2129938183384875,-23692926227408183/8519752733539500,121722513536250242/10649690916924375,539891972783653237/42598763667697500,1269750659519566733/42598763667697500,563024168872784981/85197527335395000,-3708797827070073199/170395054670790000,-3149930173580831683/85197527335395000,-822954250389055799/34079010934158000,-3089977260430563323/681580218683160000,758560911513694553/681580218683160000,367674724021366751/340790109341580000,929789407268665493/681580218683160000,3875767539173648549/1363160437366320000,44641479050581039/340790109341580000,451479936720084283/2726320874732640000,263715184388088143/681580218683160000,-410386409374826653/5452641749465280000,198714936703151/10905283498930560000,230861629331267/5452641749465280000,39128428905907/1363160437366320000,531212756828479/10905283498930560000,636048722916761/10905283498930560000,645022199531149/10905283498930560000,3147850753971539/43621133995722240000,27362309667208579/174484535982888960000],[-237182572732722709/10649690916924375,10998599900267234/2129938183384875,79703582716611349/8519752733539500,3239149789143938171/42598763667697500,7460513621209593053/85197527335395000,4129163484700168751/42598763667697500,-2666815913429578543/85197527335395000,-24050275640596111003/170395054670790000,-28038913996671167177/170395054670790000,-6085184274628026781/68158021868316000,-1192626211812013357/85197527335395000,2261848080929768833/340790109341580000,2537688781048724147/340790109341580000,5851801779391496471/681580218683160000,28117908607220361781/2726320874732640000,77287271087667277/85197527335395000,1430679896623332113/1363160437366320000,6835357747583715043/5452641749465280000,-1435738121661741991/5452641749465280000,1831682711139947/10905283498930560000,4587361064144621/21810566997861120000,2507273175424007/10905283498930560000,11553076930205527/43621133995722240000,15530134225973093/43621133995722240000,34985823621362849/87242267991444480000,40308838288497091/87242267991444480000,95760761135839363/174484535982888960000],[-38197463037518731/10649690916924375,17857139248970287/4259876366769750,27304380472097933/4259876366769750,211575868146693266/10649690916924375,1731803778642192677/85197527335395000,1247316354500968693/85197527335395000,-3011750880961861799/170395054670790000,-6837313736336770477/170395054670790000,-6519978697602007643/170395054670790000,-152383054998943163/8519752733539500,-1296646402624675229/681580218683160000,574445261553869197/340790109341580000,3154807683428740367/1363160437366320000,3272366254116841153/1363160437366320000,5526137985039076429/2726320874732640000,98188545187882297/340790109341580000,1532429572178904743/5452641749465280000,1220301773276996587/5452641749465280000,-276789559015516069/5452641749465280000,327973982000599/5452641749465280000,1243342725189239/21810566997861120000,26746764467359/340790109341580000,2037130707987959/21810566997861120000,3940719538054037/43621133995722240000,5378686516667683/43621133995722240000,11042433544329469/87242267991444480000,18467908213249717/174484535982888960000],[73863577300692746/10649690916924375,-11944944196093471/2129938183384875,-34607635875629531/8519752733539500,-1154818556126968849/42598763667697500,-1375880603672847341/42598763667697500,-2898642466112486363/85197527335395000,3171804435138046609/170395054670790000,5260250403337174741/85197527335395000,5533223576186573219/85197527335395000,1110026771035056157/34079010934158000,3005656638934949239/681580218683160000,-203420018006852813/85197527335395000,-4877711579516765347/1363160437366320000,-5029032147309841223/1363160437366320000,-2534558570711969141/681580218683160000,-76876614701734801/170395054670790000,-2374330505554964413/5452641749465280000,-1205843325216300121/2726320874732640000,130421608748726951/1363160437366320000,-761762743752943/10905283498930560000,-1059114001449137/10905283498930560000,-1374224544007333/10905283498930560000,-5909076893366963/43621133995722240000,-1363202778657673/10905283498930560000,-16589620093608781/87242267991444480000,-17093495712514079/87242267991444480000,-8702959584037643/43621133995722240000],[-852189410883297/78886599384625,1182044569413221/283991757784650,171793152697603/567983515569300,7755456250378243/315546397538500,185786084377346191/5679835155693000,285246440447866769/5679835155693000,-5325878435635939/3786556770462000,-151138447131235679/2839917577846500,-549176540721378871/7573113540924000,-65279083942490869/1514622708184800,-101179331351218919/15146227081848000,60087452425084601/22719340622772000,13126492638113021/5679835155693000,18538551497630643/5048742360616000,883150859651048107/181754724982176000,50956775983203583/181754724982176000,166962934958142919/363509449964352000,223525954664241721/363509449964352000,-91902514263396079/727018899928704000,52040789298059/727018899928704000,3377464801369/30292454163696000,2321217350719/45438681245544000,374539183950319/2908075599714816000,400496899510571/2908075599714816000,1301538862653/10097484721232000,563817434953151/2908075599714816000,3063271684091011/11632302398859264000],[-243748408736321/1183298990769375,526784177852296/236659798153875,-756556843004233/709979394461625,-8238760273071371/788865993846250,-73456402407434543/9466391926155000,1740261083257136/1183298990769375,655467391922882273/56798351556930000,738697011600461729/56798351556930000,12080489179781851/1577731987692500,25327243882614079/11359670311386000,120355451766317633/227193406227720000,-39909873381398147/56798351556930000,-531727562843928259/454386812455440000,-78328087721138453/227193406227720000,-366027033725412533/908773624910880000,-11070162727649371/75731135409240000,-47137438196260211/1817547249821760000,-67419082708889699/1817547249821760000,15144871089371063/1817547249821760000,-6589715419541/605849083273920000,-130033571773903/7270188999287040000,-82071027804413/1817547249821760000,-846690448013/201949694424640000,-555356940324599/14540377998574080000,-889743683835341/14540377998574080000,-199267682582621/9693585332382720000,-1016732921171959/58161511994296320000],[-35933490432274072/10649690916924375,5399948950217522/2129938183384875,12647825995221971/4259876366769750,121722513536250242/10649690916924375,539891972783653237/42598763667697500,694667350005650483/42598763667697500,-149800397699044697/42598763667697500,-3708797827070073199/170395054670790000,-4606559491370687741/170395054670790000,-529022781081943049/34079010934158000,-826134493322886349/340790109341580000,758560911513694553/681580218683160000,367674724021366751/340790109341580000,929789407268665493/681580218683160000,609514816347214481/340790109341580000,44641479050581039/340790109341580000,451479936720084283/2726320874732640000,303786859520764411/1363160437366320000,-62660261405240257/1363160437366320000,198714936703151/10905283498930560000,230861629331267/5452641749465280000,39128428905907/1363160437366320000,531212756828479/10905283498930560000,636048722916761/10905283498930560000,645022199531149/10905283498930560000,3147850753971539/43621133995722240000,4178154687571051/43621133995722240000],[184254740415049648/10649690916924375,3604995290006729/4259876366769750,1538164355305397/8519752733539500,-539547907381032053/10649690916924375,-5641120345867398641/85197527335395000,-7023598308979439569/85197527335395000,1516371309957990467/170395054670790000,16348200099102014791/170395054670790000,20487256929551509919/170395054670790000,2281287360285426941/34079010934158000,469895555291758127/42598763667697500,-1381326947277590551/340790109341580000,-6517121293848398411/1363160437366320000,-8313264699459550999/1363160437366320000,-20738730971896887757/2726320874732640000,-403773408326400077/681580218683160000,-4160032880059997969/5452641749465280000,-5162270708591445421/5452641749465280000,537772757695311251/2726320874732640000,-545518663465867/5452641749465280000,-2796011324040737/21810566997861120000,-1474869825827429/10905283498930560000,-3728800083310247/21810566997861120000,-9483825869236271/43621133995722240000,-11306358420065989/43621133995722240000,-28797253878842827/87242267991444480000,-35868556235830043/87242267991444480000],[73883616660226874/2129938183384875,-4191454064520173/851975273353950,-2417051168403757/851975273353950,-472342217525111153/4259876366769750,-280983135438377201/2129938183384875,-2738185775245566497/17039505467079000,647267678152777373/17039505467079000,915857434962818101/4259876366769750,4397114756341196711/17039505467079000,965769348117960283/6815802186831600,785680138344627679/34079010934158000,-660740433885791063/68158021868316000,-397954802984150171/34079010934158000,-3529210175921984087/272632087473264000,-2243075339551466879/136316043736632000,-195224553913891801/136316043736632000,-107418028518659317/68158021868316000,-69438228208921039/34079010934158000,230864495953753663/545264174946528000,-35453156635087/136316043736632000,-346904312443189/1090528349893056000,-415242268877651/1090528349893056000,-1732620153104011/4362113399572224000,-2262831108769649/4362113399572224000,-2727965842238041/4362113399572224000,-6088802871934213/8724226799144448000,-15399751377646759/17448453598288896000],[17344873238971013/709979394461625,-269691423681997/94663919261550,21554841244277/94663919261550,-226882290814029047/2839917577846500,-135610224464756999/1419958788923250,-18433612664251849/157773198769250,45761444117726617/1893278385231000,214348790510388337/1419958788923250,171796983485786447/946639192615500,451927302196840157/4543868124554400,191351729376872323/11359670311386000,-298123120041583237/45438681245544000,-63448180921725493/7573113540924000,-807987392055141719/90877362491088000,-1053914742766313621/90877362491088000,-187606240931416123/181754724982176000,-197026235896426157/181754724982176000,-524812699142545351/363509449964352000,9057564524407201/30292454163696000,-115584232703879/727018899928704000,-24693682593281/121169816654784000,-67952887179883/242339633309568000,-45886772033779/181754724982176000,-64046839189661/181754724982176000,-54147803701741/121169816654784000,-1404702393021581/2908075599714816000,-3625364309324033/5816151199429632000],[3732800948933254/3549896972308125,4231448858327917/1419958788923250,8914501710262103/1419958788923250,17432652039183349/14199587889232500,16545955833341554/3549896972308125,-7897020613519387/28399175778465000,-32295438661198624/3549896972308125,-214177916605352933/14199587889232500,-1286679730873656751/113596703113860000,-75502202775293789/22719340622772000,61212509667656087/75731135409240000,107119964360152879/227193406227720000,288257558998155097/454386812455440000,15687070149788343/12621855901540000,104790088300900907/454386812455440000,23901150612797897/302924541636960000,138252062566986019/908773624910880000,634828207014371/908773624910880000,-6632901062940911/1211698166547840000,21108038185553/605849083273920000,207541594749149/7270188999287040000,7591689758059/302924541636960000,312705313762571/4846792666191360000,173142184031471/7270188999287040000,488794224900703/14540377998574080000,1820149826275579/29080755997148160000,664688793749947/58161511994296320000],[10714316512783577/10649690916924375,1252573130167298/2129938183384875,4331110517192789/4259876366769750,-281222826562136563/42598763667697500,-112756201115993671/21299381833848750,-547545474691326731/85197527335395000,6377447897606113/10649690916924375,1059237962435819909/170395054670790000,342925465017142189/42598763667697500,313024163613155993/68158021868316000,436439933343603059/340790109341580000,-52216517459490637/170395054670790000,-41271247873371229/85197527335395000,-125266412461392463/681580218683160000,-837568653668374009/1363160437366320000,-154281406514548417/2726320874732640000,-61303446040214603/2726320874732640000,-440271134745939029/5452641749465280000,42248857046341699/2726320874732640000,-25486974760283/5452641749465280000,44650918410053/5452641749465280000,-234304492786621/10905283498930560000,212758130068847/21810566997861120000,-417019133622527/21810566997861120000,-533422715740843/21810566997861120000,-277984288701737/21810566997861120000,-352426894588679/10905283498930560000],[167221389522612116/3549896972308125,-10130425400156266/709979394461625,-4633172442564148/236659798153875,-775103395574445043/4733195963077500,-2738229630930345611/14199587889232500,-333588803638591311/1577731987692500,281838502628812154/3549896972308125,776000152004167303/2366597981538750,42305596698891326971/113596703113860000,124597855864021229/631092795077000,748531554785305341/25243711803080000,-558388468433139689/37865567704620000,-2669232819461689229/151462270818480000,-4556792224047997829/227193406227720000,-10330569715991230447/454386812455440000,-108931178296463477/50487423606160000,-46154053471562413/18932783852310000,-622642942651822279/227193406227720000,2112462136550292743/3635094499643520000,-23220194060227/56798351556930000,-3645787513233179/7270188999287040000,-4239342575038061/7270188999287040000,-3167618567688191/4846792666191360000,-11439446765139557/14540377998574080000,-3428147531710247/3635094499643520000,-31268363511906709/29080755997148160000,-7828894102381893/6462390221588480000],[216105407363171543/10649690916924375,-22102174922738261/4259876366769750,-17795261796588512/2129938183384875,-3096262531917323467/42598763667697500,-3817144265196938303/42598763667697500,-2178144155223694001/21299381833848750,3066492255988878461/85197527335395000,26642570884997232131/170395054670790000,30628119400414623229/170395054670790000,3263300114563825381/34079010934158000,2531913926960320303/170395054670790000,-5048103408850114207/681580218683160000,-1417474710647610647/170395054670790000,-6524500058291037067/681580218683160000,-7593827132779900703/681580218683160000,-680482116972637057/681580218683160000,-3201242736269458577/2726320874732640000,-7325635344998458961/5452641749465280000,386972668809861683/1363160437366320000,-257246373890393/1363160437366320000,-2814008625769871/10905283498930560000,-6573281722667903/21810566997861120000,-3273360618797201/10905283498930560000,-17174593186342561/43621133995722240000,-19267238471234849/43621133995722240000,-22493142277149841/43621133995722240000,-51633893285186863/87242267991444480000],[932728938273367/86582852983125,-196736227792109/34633141193250,-337410590577737/69266282386500,-4196088316939441/115443803977500,-3386138262822971/76962535985000,-4878000577144747/86582852983125,1125227710351373/86582852983125,110522683405369589/1385325647730000,7484826100963257/76962535985000,14588985570009739/277065129546000,915541334798911/115443803977500,-19979450685003383/5541302590920000,-712281248167921/173165705966250,-56924189912562571/11082605181840000,-14955917451293417/2462801151520000,-10890452578586257/22165210363680000,-1748967265403161/2770651295460000,-4131287031366623/5541302590920000,385359329677881/2462801151520000,-3299502812837/29553613818240000,-20100595472923/177321682909440000,-3383287775479/22165210363680000,-7055046887089/39404818424320000,-5737088348657/29553613818240000,-154225552364687/709286731637760000,-21564418683837/78809636848640000,-462743889149519/1418573463275520000],[-619366346275401/78886599384625,454376233284743/283991757784650,1031785357952381/141995878892325,94920450848867521/2839917577846500,265028268203312603/5679835155693000,285511809275089327/5679835155693000,-57972803930168437/3786556770462000,-426563044903167839/5679835155693000,-329159407244544209/3786556770462000,-103830442571421653/2271934062277200,-104190026115967027/15146227081848000,27046312551193211/7573113540924000,321770058614634263/90877362491088000,448413706498511767/90877362491088000,944982865282231381/181754724982176000,75527236480311889/181754724982176000,75923417259359509/121169816654784000,74141559883049281/121169816654784000,-47993486534107841/363509449964352000,27202849555261/363509449964352000,172337117419471/1454037799857408000,5092656495449/40389938884928000,208492595790301/1454037799857408000,184494305457131/969358533238272000,137101360931953/727018899928704000,1551426238036691/5816151199429632000,3201839967608413/11632302398859264000],[338174476964329346/10649690916924375,-23729184249971296/2129938183384875,-42578271446968303/4259876366769750,-4476106173169786249/42598763667697500,-10412306665145955757/85197527335395000,-12709751147462458163/85197527335395000,7176572128096600009/170395054670790000,36580429252381933307/170395054670790000,5430077085986282561/21299381833848750,4724069174885553457/34079010934158000,14511152436842529139/681580218683160000,-3343387699256916077/340790109341580000,-15620297340289748797/1363160437366320000,-18080033506718925023/1363160437366320000,-43724021660209260089/2726320874732640000,-475032842268849677/340790109341580000,-8782236168426090463/5452641749465280000,-2684621933318685173/1363160437366320000,2247149271347755079/5452641749465280000,-3059633554047493/10905283498930560000,-7250156387004049/21810566997861120000,-8455657582674641/21810566997861120000,-9799409234941819/21810566997861120000,-11424963825899321/21810566997861120000,-6674635852291157/10905283498930560000,-61804609271917229/87242267991444480000,-149899201637345147/174484535982888960000],[258710331996271903/10649690916924375,-29380291215934231/4259876366769750,-35636035466003879/4259876366769750,-3203232209878085807/42598763667697500,-8132926001411153351/85197527335395000,-2497176613989823021/21299381833848750,4828607525650778987/170395054670790000,6954888735320790469/42598763667697500,33231280729766261309/170395054670790000,3590735505062788001/34079010934158000,10767066959990229077/681580218683160000,-4976615961329196347/681580218683160000,-11172742083435653321/1363160437366320000,-7185996872371078907/681580218683160000,-32753424820690832677/2726320874732640000,-675242120428569947/681580218683160000,-7120754810061545609/5452641749465280000,-995938485319438007/681580218683160000,1685304583664559997/5452641749465280000,-1157006044712887/5452641749465280000,-5465939530009457/21810566997861120000,-6058119239404213/21810566997861120000,-3773312276660221/10905283498930560000,-4247072100998039/10905283498930560000,-9554597498731727/21810566997861120000,-49206426973178197/87242267991444480000,-112414371216174121/174484535982888960000],[-408042405096991799/10649690916924375,23297914861141249/2129938183384875,69845033623904257/4259876366769750,5469056816097331381/42598763667697500,3219270105635516677/21299381833848750,1882834674456799159/10649690916924375,-2276736604200394549/42598763667697500,-44164286492288036783/170395054670790000,-104042888866617642269/340790109341580000,-11213968513991808941/68158021868316000,-16921961372589724291/681580218683160000,8031802718521597951/681580218683160000,18577001391829232593/1363160437366320000,5522380956211738403/340790109341580000,25814291140287333733/1363160437366320000,282122071886836219/170395054670790000,5393327631649077611/2726320874732640000,12577449948935296223/5452641749465280000,-5297866627035271177/10905283498930560000,3789858032959417/10905283498930560000,8400452836850581/21810566997861120000,4951858682846827/10905283498930560000,23663977881100547/43621133995722240000,27554618273024773/43621133995722240000,15893486663116741/21810566997861120000,37775343645042313/43621133995722240000,176699288933003993/174484535982888960000],[-332392770424239212/10649690916924375,43562664399661049/4259876366769750,113027429199009407/8519752733539500,2147023319835263939/21299381833848750,10834886468116512979/85197527335395000,1628676489532530142/10649690916924375,-3414458145110935799/85197527335395000,-37022877211829458079/170395054670790000,-87755165903307057197/340790109341580000,-9435010098145521083/68158021868316000,-14012375743862679583/681580218683160000,3274284393021388769/340790109341580000,15045689522994586609/1363160437366320000,297605901637778579/21299381833848750,43007264442671749733/2726320874732640000,228507532857008797/170395054670790000,4698092837758964243/2726320874732640000,5224627101365671087/2726320874732640000,-4426633087338334651/10905283498930560000,3036311374771021/10905283498930560000,1808188198156807/5452641749465280000,504710320773497/1363160437366320000,5079718075050209/10905283498930560000,2792646706536353/5452641749465280000,51502087598531107/87242267991444480000,8139908472229711/10905283498930560000,73820122874544967/87242267991444480000],[-1644159573231536/394432996923125,1413484028131441/473319596307750,2708594078508466/709979394461625,127943557517628803/7099793944616250,181010996932199129/14199587889232500,70044876492545699/9466391926155000,-142726356358247341/9466391926155000,-1586515341329771333/56798351556930000,-191701632678204659/7099793944616250,-25792648239208193/1893278385231000,-6785274278987594/3549896972308125,344649653057020301/227193406227720000,74289479046172189/37865567704620000,604721976324177187/454386812455440000,97708811810513801/56798351556930000,54785205064162601/227193406227720000,41453386473401987/302924541636960000,11615678832379739/56798351556930000,-19277785829505719/454386812455440000,19183894481013/403899388849280000,21073828253191/454386812455440000,122698047040201/1817547249821760000,438190191070811/7270188999287040000,198460735828783/2423396333095680000,758448409517341/7270188999287040000,252700850081747/3635094499643520000,321657360030073/3635094499643520000],[-12539092754513134/1183298990769375,2749517779952329/1419958788923250,1295064378501649/946639192615500,55254801798033957/1577731987692500,143662453638629323/3549896972308125,1384465936241162581/28399175778465000,-367677784228710679/28399175778465000,-1253821984741725103/18932783852310000,-3035814443921658779/37865567704620000,-1029840746902591193/22719340622772000,-819022711017300709/113596703113860000,380257008888219299/113596703113860000,1581846973892969939/454386812455440000,228140726278629347/56798351556930000,1195445332995163267/227193406227720000,387625832647810367/908773624910880000,440976056493487403/908773624910880000,9258194187735143/14199587889232500,-163267437831907507/1211698166547840000,299742239007541/3635094499643520000,940625124102463/7270188999287040000,58306573944391/605849083273920000,1933657632008531/14540377998574080000,142102302104303/807798777698560000,2763959646055661/14540377998574080000,6235977397279373/29080755997148160000,907393963423723/3231195110794240000],[-19998256152683801/2129938183384875,7090677736858427/851975273353950,11044685864922611/1703950546707900,328699601295168019/8519752733539500,336513198764408621/8519752733539500,723250222514115653/17039505467079000,-56990788059701044/2129938183384875,-2712658734008567417/34079010934158000,-5985150558388471331/68158021868316000,-644055749511526709/13631604373663200,-449974238090147117/68158021868316000,281947111046178287/68158021868316000,1216152235873208857/272632087473264000,321970005921270047/68158021868316000,1511110792518427717/272632087473264000,294516951519461221/545264174946528000,37754912844008833/68158021868316000,362901903738230551/545264174946528000,-305560911452347123/2181056699786112000,276230808380383/2181056699786112000,707038325442319/4362113399572224000,320260910585473/2181056699786112000,1602789505223753/8724226799144448000,474825267267013/2181056699786112000,2092149696914693/8724226799144448000,4342504784964149/17448453598288896000,5094713459645791/17448453598288896000],[85979494263956813/10649690916924375,-12382694564607613/2129938183384875,-40157296429320293/8519752733539500,-1551987015249975097/42598763667697500,-1449577099729607723/42598763667697500,-377004722478654508/10649690916924375,3749762832094434127/170395054670790000,11223599940655197971/170395054670790000,770557389111912229/10649690916924375,2628946166340962117/68158021868316000,4216227375668344267/681580218683160000,-2244069282023557687/681580218683160000,-5615364941216027941/1363160437366320000,-149710551191397817/42598763667697500,-6379838516797870621/1363160437366320000,-170626125661559831/340790109341580000,-2189737046230858339/5452641749465280000,-1562345949766608313/2726320874732640000,322713877725598981/2726320874732640000,-61177852074019/681580218683160000,-566921622880843/5452641749465280000,-205778657437403/1363160437366320000,-5411975396614739/43621133995722240000,-1928392586888869/10905283498930560000,-19001691648705043/87242267991444480000,-8212618590778081/43621133995722240000,-2691262152855851/10905283498930560000],[36723754751298826/3549896972308125,-1249885083236051/709979394461625,-3645689538834631/473319596307750,-43974668765607937/1183298990769375,-573367669589890271/14199587889232500,-597169568194034489/14199587889232500,136520724170536913/7099793944616250,108140278145023697/1577731987692500,559060629731773991/7099793944616250,485286945161667767/11359670311386000,719389173721085167/113596703113860000,-16852597510918363/4733195963077500,-16859112515010167/4733195963077500,-957079634206445819/227193406227720000,-1126228872795052321/227193406227720000,-16110262604989229/37865567704620000,-155161198237624963/302924541636960000,-269789159692283413/454386812455440000,113818474521459737/908773624910880000,-93710134403177/908773624910880000,-102724713538193/908773624910880000,-98274483360137/908773624910880000,-511356899440957/3635094499643520000,-695496403183463/3635094499643520000,-699560447063567/3635094499643520000,-3270205615777937/14540377998574080000,-7590459403453691/29080755997148160000],[-106450116071935324/10649690916924375,15299554633177274/2129938183384875,1885672896994666/2129938183384875,640004753014766053/21299381833848750,2445784503057611633/85197527335395000,3102184210649407597/85197527335395000,-439814248913217449/42598763667697500,-2236365088570699177/42598763667697500,-10639058662881155147/170395054670790000,-1161929302197774083/34079010934158000,-3796340421346037891/681580218683160000,699720726842890963/340790109341580000,566424573681089971/170395054670790000,1962142735466803781/681580218683160000,11003137985400171691/2726320874732640000,1147662760325571029/2726320874732640000,888947355499821961/2726320874732640000,1406184104635310699/2726320874732640000,-143290081076851219/1363160437366320000,688695759571367/10905283498930560000,1217754608724431/21810566997861120000,1216958690677277/10905283498930560000,4734515908876747/43621133995722240000,4880500587118073/43621133995722240000,15404079252070739/87242267991444480000,13331783247322351/87242267991444480000,19120912496739959/87242267991444480000],[173958011917846732/10649690916924375,-13252137319589732/2129938183384875,-9048806525736251/4259876366769750,-452933228001238877/10649690916924375,-2265721301682791347/42598763667697500,-5927116947930349321/85197527335395000,1776719926029741053/170395054670790000,7405176831271946897/85197527335395000,18303495114576267971/170395054670790000,2000126713875460319/34079010934158000,1538146350614410847/170395054670790000,-2313654490175219393/681580218683160000,-6163048872938260499/1363160437366320000,-1899914815787613079/340790109341580000,-1133242420123547893/170395054670790000,-1531297601181962297/2726320874732640000,-3735662519411570171/5452641749465280000,-4516230890645706589/5452641749465280000,945294066426855493/5452641749465280000,-644191316563153/5452641749465280000,-1085096114916679/10905283498930560000,-1582264677403811/10905283498930560000,-8023093125529771/43621133995722240000,-2009080559341841/10905283498930560000,-21098522452419077/87242267991444480000,-6500521165907917/21810566997861120000,-63046381392742699/174484535982888960000],[-441092734886612/236659798153875,-22625782095359/141995878892325,1014074156294117/189327838523100,5421114110076571/709979394461625,34479454267699687/5679835155693000,-2691668635971863/631092795077000,-68418089906665597/5679835155693000,-47610569745555479/3786556770462000,-5005643977441538/709979394461625,-3494495207171267/2271934062277200,13173731580658213/22719340622772000,30168396163658039/45438681245544000,1408678867028149/1893278385231000,16974774587067667/22719340622772000,27333634451312549/181754724982176000,5572199730861227/60584908327392000,1253731605003367/15146227081848000,-1302489043581389/181754724982176000,-238588995618313/121169816654784000,12168694882969/363509449964352000,31204102152659/1454037799857408000,7092420679289/363509449964352000,35740610325161/969358533238272000,104753728166297/2908075599714816000,236341875768571/5816151199429632000,221271977239039/5816151199429632000,15985446892259/3877434132953088000],[-177650794616762476/10649690916924375,147730438723751/2129938183384875,13133037690706111/8519752733539500,2676512450319269969/42598763667697500,6018466039240380467/85197527335395000,7050716635033675303/85197527335395000,-3525459701326471529/170395054670790000,-18773908994439833767/170395054670790000,-22551943813128912503/170395054670790000,-4997299976501895109/68158021868316000,-4346751902736526717/340790109341580000,3598037890508344649/681580218683160000,8423755418697983957/1363160437366320000,134140645294811767/21299381833848750,23627693855390830759/2726320874732640000,2049231628570991021/2726320874732640000,4169119076550253853/5452641749465280000,2936758612781062601/2726320874732640000,-604264068872074037/2726320874732640000,1285320451585283/10905283498930560000,3400928412762269/21810566997861120000,2210517675660623/10905283498930560000,3739266642342389/21810566997861120000,12410391342776027/43621133995722240000,14412706730917093/43621133995722240000,29960459873489599/87242267991444480000,40309356328603091/87242267991444480000],[-197499967686660016/10649690916924375,-191656292706634/2129938183384875,14691593680985344/2129938183384875,3001779296923864229/42598763667697500,1633914463313968943/21299381833848750,3343670684588736899/42598763667697500,-5578002398526439439/170395054670790000,-10458192316494915161/85197527335395000,-23753298367714881623/170395054670790000,-5102134832717033119/68158021868316000,-2074572964513326761/170395054670790000,2025281916481607617/340790109341580000,9438004202958251237/1363160437366320000,2400871943523003277/340790109341580000,12018849186080259497/1363160437366320000,574995154114936559/681580218683160000,4620462454351465973/5452641749465280000,1458610638563670883/1363160437366320000,-1219264642546972159/5452641749465280000,1650381298074353/10905283498930560000,1934494972526077/10905283498930560000,2423290296039293/10905283498930560000,9086860749317023/43621133995722240000,6990848632635241/21810566997861120000,32370541598362751/87242267991444480000,2079971220754699/5452641749465280000,81338057767357837/174484535982888960000],[-16353062307428888/1183298990769375,1435429040201464/709979394461625,862120244405251/709979394461625,134901090058003204/3549896972308125,382270466632837697/7099793944616250,457903113309680123/7099793944616250,-697910947624642781/56798351556930000,-198442131447295937/2366597981538750,-630776628015984463/6310927950770000,-1211362193481359051/22719340622772000,-447027833819920519/56798351556930000,751938404803382461/227193406227720000,1871214089454620773/454386812455440000,840758557265699869/151462270818480000,2701651755469937813/454386812455440000,463365199959779669/908773624910880000,1263886899910019317/1817547249821760000,1309670620662349453/1817547249821760000,-93390944410418137/605849083273920000,103134364536803/908773624910880000,68412896867543/605849083273920000,235840452757111/1817547249821760000,2490961118803517/14540377998574080000,13413122730959/75731135409240000,6435096164245729/29080755997148160000,8671561683498761/29080755997148160000,6228832054300141/19387170664765440000],[61222922133953969/10649690916924375,-11840653188242363/4259876366769750,19332849769460791/8519752733539500,-181680477972791434/10649690916924375,-2118147428645039473/85197527335395000,-2903434203662323157/85197527335395000,593070269268924001/170395054670790000,6947945866806766673/170395054670790000,8371513214312647957/170395054670790000,890804778225353623/34079010934158000,1393799978569642973/340790109341580000,-436904455057701953/340790109341580000,-2996917147212604783/1363160437366320000,-3534809581959172697/1363160437366320000,-7989748427598577871/2726320874732640000,-95607748175031353/340790109341580000,-1741668000342530857/5452641749465280000,-1998673261576055063/5452641749465280000,210916738324574053/2726320874732640000,-224221519486451/5452641749465280000,-1043934454028311/21810566997861120000,-6620017558079/85197527335395000,-1767146001711091/21810566997861120000,-2960850062742613/43621133995722240000,-5080502601709667/43621133995722240000,-12180611917157831/87242267991444480000,-3517777077814351/21810566997861120000],[141258418901572381/10649690916924375,-6046004517421687/4259876366769750,2297046933896546/2129938183384875,-428460119463379916/10649690916924375,-4817474402268621977/85197527335395000,-3136333747792636259/42598763667697500,1152413129353243649/170395054670790000,14239505207889414277/170395054670790000,35603207210550739561/340790109341580000,993883545822498001/17039505467079000,3241399799861884477/340790109341580000,-1206309253805870497/340790109341580000,-84780338657762903/21299381833848750,-57908272579137701/10649690916924375,-17915751422136573529/2726320874732640000,-669929232913180513/1363160437366320000,-3751609746459508193/5452641749465280000,-1109564637944027503/1363160437366320000,1859662037846362463/10905283498930560000,-851737177597523/10905283498930560000,-706608953256491/5452641749465280000,-1245443330831813/10905283498930560000,-6529030303381243/43621133995722240000,-8150968287480587/43621133995722240000,-4714983678890879/21810566997861120000,-803062514781467/2726320874732640000,-15502027322481973/43621133995722240000],[-206619083150041592/10649690916924375,16850436128634667/2129938183384875,11748085771132853/2129938183384875,658165028994301837/10649690916924375,811537125341265383/10649690916924375,2018539190141303069/21299381833848750,-397381245412186421/21299381833848750,-20848562039610294539/170395054670790000,-25465857582016629301/170395054670790000,-2833662627399866389/34079010934158000,-1132917721903580891/85197527335395000,3862304149566704533/681580218683160000,2119041593490172411/340790109341580000,2608646064659036999/340790109341580000,3254095847889240691/340790109341580000,129260142525128077/170395054670790000,2574384658305843563/2726320874732640000,1608540321036304421/1363160437366320000,-335125975691558627/1363160437366320000,1415647915130311/10905283498930560000,1074475801373737/5452641749465280000,515049015564679/2726320874732640000,81017700982117/340790109341580000,820299377264599/2726320874732640000,457921947216733/1363160437366320000,17938910737552279/43621133995722240000,22350646428067211/43621133995722240000],[-6839277526996309/709979394461625,304705609009759/141995878892325,-28774064765007/31554639753850,8524808114045369/315546397538500,62822064922858751/1893278385231000,31123628134947569/709979394461625,-9216572170452559/2839917577846500,-61998498620919217/1262185590154000,-713750864336831977/11359670311386000,-161546235949213981/4543868124554400,-31267186004945959/5048742360616000,47357054742457283/22719340622772000,58703278478001197/22719340622772000,67787532009001373/22719340622772000,248844551303012227/60584908327392000,7261516429829683/22719340622772000,67149920545759001/181754724982176000,189105812365811993/363509449964352000,-3233674336431793/30292454163696000,3551887293833/80779877769856000,89952989225771/1454037799857408000,57693232380557/727018899928704000,26224932741453/323119511079424000,108774030775181/969358533238272000,807937132176199/5816151199429632000,943616179803491/5816151199429632000,1294080616410469/5816151199429632000],[-4819767683059276/10649690916924375,-2060893453036324/2129938183384875,58791930152774911/8519752733539500,109878713540239897/21299381833848750,139089543069762317/85197527335395000,-48807008427692959/10649690916924375,-1191707835406561229/170395054670790000,-64550459245474687/10649690916924375,-1509299050097145181/340790109341580000,-107716177752017809/68158021868316000,398605694584283491/681580218683160000,194646883970047987/340790109341580000,113385284099691091/681580218683160000,368527664619862619/681580218683160000,394156458129169459/2726320874732640000,33959263855023821/2726320874732640000,347702961143430503/5452641749465280000,-853972547883737/1363160437366320000,-22748842742058173/10905283498930560000,108599926132577/2726320874732640000,125295143216047/10905283498930560000,-33365148355477/10905283498930560000,1575192060830803/43621133995722240000,706212159424501/21810566997861120000,227235322515059/21810566997861120000,2232015788589049/87242267991444480000,755255554758157/174484535982888960000],[-57196604263590542/2129938183384875,7065645910795229/851975273353950,26356624008504947/1703950546707900,761878348042530973/8519752733539500,1618425683807805289/17039505467079000,1844221117952868701/17039505467079000,-1318566928006525243/34079010934158000,-2881963354643602957/17039505467079000,-13592838642112804277/68158021868316000,-1470557870603953673/13631604373663200,-2153051739968401603/136316043736632000,1082746482576428833/136316043736632000,615533873164819411/68158021868316000,2868551052858737771/272632087473264000,6802418175038601803/545264174946528000,149368225267591033/136316043736632000,1380505783725231601/1090528349893056000,415081955272907171/272632087473264000,-696695583021275641/2181056699786112000,559810856406211/2181056699786112000,531855652285799/2181056699786112000,79214544395177/272632087473264000,3343212853032701/8724226799144448000,935372344300771/2181056699786112000,4224223370490731/8724226799144448000,9724842973510583/17448453598288896000,23237296361348519/34896907196577792000],[-429528418605956576/10649690916924375,36460897178471851/2129938183384875,119895017674616711/8519752733539500,5881663639619545369/42598763667697500,3308830815911869573/21299381833848750,15670644174592615103/85197527335395000,-4984099961704418027/85197527335395000,-46228787788527160967/170395054670790000,-108653636977127075231/340790109341580000,-5905551913223681317/34079010934158000,-1140125056836910099/42598763667697500,4268127561881576837/340790109341580000,20137816400306321407/1363160437366320000,22417655020781812013/1363160437366320000,3429280754709531299/170395054670790000,4916756861910492121/2726320874732640000,2702506044671914507/1363160437366320000,13473290057138391527/5452641749465280000,-5629408256812877323/10905283498930560000,3787992580598083/10905283498930560000,9148592436161419/21810566997861120000,5342049185602423/10905283498930560000,24314185085073953/43621133995722240000,3648736449513419/5452641749465280000,8619036251661317/10905283498930560000,76650540039362999/87242267991444480000,46938606851121533/43621133995722240000],[413915626042136957/10649690916924375,-81182949972520139/4259876366769750,-40635453879629663/2129938183384875,-5888799182357377033/42598763667697500,-13401727102970287519/85197527335395000,-14901617074711024121/85197527335395000,5552371122578816789/85197527335395000,11603343457927796561/42598763667697500,106126480675059435917/340790109341580000,2820108038145788597/17039505467079000,4214136895024877197/170395054670790000,-8225537140264299793/681580218683160000,-20221657732900945699/1363160437366320000,-11316950364869326183/681580218683160000,-52025616673664663813/2726320874732640000,-2482562682899772761/1363160437366320000,-1365804691415344637/681580218683160000,-12620104378668128789/5452641749465280000,5332548802553565661/10905283498930560000,-3731066875547731/10905283498930560000,-4291065093945629/10905283498930560000,-2680119352322243/5452641749465280000,-12271565815353973/21810566997861120000,-28208752935418939/43621133995722240000,-69177672441958927/87242267991444480000,-38692070493973159/43621133995722240000,-177861731059870649/174484535982888960000],[-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];\nGEN=[[[0,1]],[[1,1]],[[2,-2701942893],[3,1342921525],[4,-434092729],[5,2508338529],[6,-1017591695],[7,6276788424],[8,1637870662],[9,-9022911491],[10,1108252405],[11,1462089983],[12,-1529425811],[13,67335828],[14,-1651549008],[15,-188355215],[16,1839904223],[17,5555004858],[18,-2172901061],[19,-2705655617],[20,845302403],[21,-1862314790],[22,4619661872],[23,-5442553708],[24,-1418538581],[25,-710668259],[26,2129206840],[27,2664230341],[28,-710668259],[29,-1953562082],[30,-1790020129],[31,-2011253453],[32,648752274],[33,3425186349],[34,-3998363662],[35,-297290554],[36,-1637870662],[37,6617187893],[38,-6893027312],[39,4597251305],[40,-2714518090],[41,-3037907179],[42,-1709455434],[43,-648752274],[44,588229990],[45,297290554],[46,-236768270],[47,-6268331779],[48,-3050774912],[49,1412904250],[50,1982083012],[51,-1154566310],[52,810479394],[53,1207568421],[54,-675126290],[55,6300189228],[56,-6617187893],[57,5135772287],[58,1862314790],[59,-264750901],[60,-974041474],[61,1238792375],[62,610640557],[63,-1862314790],[64,-588229990],[65,-1935626523],[66,1326868124],[67,-888273316],[68,2172158005],[69,473536540],[70,-5482378543],[71,3152521308],[72,-3333094143],[73,-1056654105],[74,2681894861],[75,1707853387],[76,679720117],[77,1709455434],[78,-9006363444],[79,6617187893],[80,2998463368],[81,-4333642389],[82,10142239282],[83,-4808696599]],[[2,-691496988],[3,343688311],[4,-111095544],[5,641948630],[6,-260428003],[7,1606392312],[8,419173415],[9,-2309196148],[10,283630421],[11,374186598],[12,-391419576],[13,17232978],[14,-422674058],[15,-48204965],[16,470879023],[17,1421669251],[18,-556101516],[19,-692447171],[20,216334723],[21,-476614466],[22,1182290817],[23,-1392890097],[24,-363040669],[25,-181878367],[26,544919036],[27,681845372],[28,-181878367],[29,-499967005],[30,-458112394],[31,-514731717],[32,166032467],[33,876593673],[34,-1023284555],[35,-76084333],[36,-419173415],[37,1693509330],[38,-1764103764],[39,1176555374],[40,-694715306],[41,-777478929],[42,-437493807],[43,-166032467],[44,150543251],[45,76084333],[46,-60595117],[47,-1604228038],[48,-780772113],[49,361598698],[50,507266248],[51,-295483346],[52,207422615],[53,309047955],[54,-172782259],[55,1612381182],[56,-1693509330],[57,1314376806],[58,476614466],[59,-67756595],[60,-249282377],[61,317038972],[62,156278694],[63,-476614466],[64,-150543251],[65,-495376832],[66,339579831],[67,-227332089],[68,555911349],[69,121190234],[70,-1403082300],[71,806811644],[72,-853024898],[73,-270425083],[74,686366179],[75,437083802],[76,173957939],[77,437493807],[78,-2304961076],[79,1693509330],[80,767384239],[81,-1109091043],[82,2595661046],[83,-1230669687]],[[2,-950095219],[3,472216983],[4,-152641800],[5,882017325],[6,-357819925],[7,2207132759],[8,575931153],[9,-3172763234],[10,389699322],[11,514120675],[12,-537798247],[13,23677572],[14,-580740926],[15,-66232114],[16,646973040],[17,1953329055],[18,-764066078],[19,-951400740],[20,297237138],[21,-654853359],[22,1624430579],[23,-1913787398],[24,-498806517],[25,-249895184],[26,748701701],[27,936834201],[28,-249895184],[29,-686939017],[30,-629432092],[31,-707225269],[32,228123413],[33,1204412271],[34,-1405960951],[35,-104537492],[36,-575931153],[37,2326828816],[38,-2423823358],[39,1616550260],[40,-954517087],[41,-1068231714],[42,-601102798],[43,-228123413],[44,206841715],[45,104537492],[46,-83255794],[47,-2204159115],[48,-1072756447],[49,496825294],[50,696967948],[51,-405984869],[52,284992181],[53,424622218],[54,-237397416],[55,2215361280],[56,-2326828816],[57,1805912593],[58,654853359],[59,-93095441],[60,-342506184],[61,435601625],[62,214722034],[63,-654853359],[64,-206841715],[65,-680632263],[66,466572060],[67,-312347175],[68,763804794],[69,166511588],[70,-1927791167],[71,1108533948],[72,-1172029512],[73,-371555600],[74,943045648],[75,600539464],[76,239012763],[77,601102798],[78,-3166944377],[79,2326828816],[80,1054361926],[81,-1523856380],[82,3566357038],[83,-1690901633]],[[2,-573305637],[3,284944764],[4,-92106983],[5,532226133],[6,-215915390],[7,1331826144],[8,347527879],[9,-1914506051],[10,235152028],[11,310230254],[12,-324517754],[13,14287500],[14,-350430188],[15,-39965725],[16,390395913],[17,1178676132],[18,-461052093],[19,-574093413],[20,179358578],[21,-395151049],[22,980212498],[23,-1154815940],[24,-300989398],[25,-150791536],[26,451780934],[27,565303685],[28,-150791536],[29,-414512149],[30,-379811370],[31,-426753262],[32,137654033],[33,726765412],[34,-848383743],[35,-63079923],[36,-347527879],[37,1404053036],[38,-1462581399],[39,975457362],[40,-575973876],[41,-644591458],[42,-362716932],[43,-137654033],[44,124812249],[45,63079923],[46,-50238139],[47,-1330031791],[48,-647321769],[49,299793890],[50,420563798],[51,-244979039],[52,171969736],[53,256225172],[54,-143250144],[55,1336791392],[56,-1404053036],[57,1089722217],[58,395151049],[59,-56175571],[60,-206674786],[61,262850357],[62,129567385],[63,-395151049],[64,-124812249],[65,-410706532],[66,281538510],[67,-188476263],[68,460894429],[69,100476278],[70,-1163266082],[71,668910599],[72,-707225036],[73,-224203760],[74,569051791],[75,362377005],[76,144224875],[77,362716932],[78,-1910994843],[79,1404053036],[80,636222163],[81,-919524101],[82,2152008085],[83,-1020322404]],[[2,-2281298406],[3,1133852511],[4,-366512206],[5,2117834800],[6,-859170753],[7,5299604022],[8,1382883309],[9,-7618204533],[10,935717202],[11,1234468559],[12,-1291321395],[13,56852836],[14,-1394432179],[15,-159031656],[16,1553463835],[17,4690189329],[18,-1834618984],[19,-2284433124],[20,713703843],[21,-1572385476],[22,3900462623],[23,-4595244825],[24,-1197697336],[25,-600029841],[26,1797727177],[27,2249457028],[28,-600029841],[29,-1649427187],[30,-1511345810],[31,-1698137037],[32,547753075],[33,2891945708],[34,-3375889501],[35,-251007698],[36,-1382883309],[37,5587009345],[38,-5819905468],[39,3881540982],[40,-2291915867],[41,-2564959022],[42,-1443323605],[43,-547753075],[44,496653035],[45,251007698],[46,-199907658],[47,-5292463928],[48,-2575823479],[49,1192940170],[50,1673507915],[51,-974820855],[52,684302157],[53,1019571479],[54,-570021125],[55,5319361739],[56,-5587009345],[57,4336223817],[58,1572385476],[59,-223533892],[60,-822400528],[61,1045934420],[62,515574676],[63,-1572385476],[64,-496653035],[65,-1634283875],[66,1120298340],[67,-749984948],[68,1833991608],[69,399815316],[70,-4628869642],[71,2661729772],[72,-2814190623],[73,-892151841],[74,2264371496],[75,1441970968],[76,573899775],[77,1443323605],[78,-7604232725],[79,5587009345],[80,2531655912],[81,-3658971289],[82,8563272881],[83,-4060068003]],[[2,-352725145],[3,175311696],[4,-56668637],[5,327451063],[6,-132841513],[7,819403369],[8,213815832],[9,-1177896016],[10,144676815],[11,190868542],[12,-199658898],[13,8790356],[14,-215601472],[15,-24588832],[16,240190304],[17,725178131],[18,-283661378],[19,-353209824],[20,110350003],[21,-243115891],[22,603073777],[23,-710498193],[24,-185183124],[25,-92774191],[26,277957315],[27,347801960],[28,-92774191],[29,-255027769],[30,-233678183],[31,-262559089],[32,84691368],[33,447140966],[34,-521966400],[35,-38809797],[36,-213815832],[37,863840817],[38,-899850276],[39,600148190],[40,-354366775],[41,-396583605],[42,-223160866],[43,-84691368],[44,76790486],[45,38809797],[46,-30908915],[47,-818299394],[48,-398263423],[49,184447591],[50,258751033],[51,-150722864],[52,105804036],[53,157642025],[54,-88134365],[55,822458224],[56,-863840817],[57,670449414],[58,243115891],[59,-34561906],[60,-127156248],[61,161718154],[62,79716073],[63,-243115891],[64,-76790486],[65,-252686372],[66,173216003],[67,-115959643],[68,283564377],[69,61817830],[70,-715697127],[71,411545904],[72,-435118789],[73,-137940913],[74,350107975],[75,222951727],[76,88734065],[77,223160866],[78,-1175735748],[79,863840817],[80,391434412],[81,-565735362],[82,1324018665],[83,-627751315]],[[2,-525998793],[3,261432284],[4,-84506690],[5,488309002],[6,-198098933],[7,1221929281],[8,318851295],[9,-1756528817],[10,215748241],[11,284631318],[12,-297739871],[13,13108553],[14,-321514118],[15,-36667916],[16,358182034],[17,1081416583],[18,-423007954],[19,-526721565],[20,164558637],[21,-362544795],[22,899329359],[23,-1059525235],[24,-276152980],[25,-138348833],[26,414501813],[27,518657129],[28,-138348833],[29,-380308296],[30,-348470883],[31,-391539322],[32,126295383],[33,666795694],[34,-778378576],[35,-57874825],[36,-318851295],[37,1288196302],[38,-1341895143],[39,894966598],[40,-528446861],[41,-591402400],[42,-332787010],[43,-126295383],[44,114513251],[45,57874825],[46,-46092693],[47,-1220282989],[48,-593907416],[49,275056121],[50,385860587],[51,-224764368],[52,157779494],[53,235082516],[54,-131429726],[55,1226484815],[56,-1288196302],[57,999802783],[58,362544795],[59,-51540191],[60,-189620825],[61,241161016],[62,118876012],[63,-362544795],[64,-114513251],[65,-376816704],[66,258307099],[67,-172923970],[68,422863301],[69,92185386],[70,-1067278107],[71,613714822],[72,-648867710],[73,-205703379],[74,522095957],[75,332475132],[76,132324025],[77,332787010],[78,-1753307337],[79,1288196302],[80,583723704],[81,-843648721],[82,1974433151],[83,-936129558]],[[2,-5710071245],[3,2838023559],[4,-917377053],[5,5300923178],[6,-2150497368],[7,13264865512],[8,3461345609],[9,-19068303622],[10,2342092501],[11,3089864701],[12,-3232166884],[13,142302183],[14,-3490252340],[15,-398054932],[16,3888307272],[17,11739505521],[18,-4592036308],[19,-5717917423],[20,1786394875],[21,-3935667983],[22,9762826036],[23,-11501860200],[24,-2997826632],[25,-1501869784],[26,4499696416],[27,5630372538],[28,-1501869784],[29,-4128502754],[30,-3782886192],[31,-4250423108],[32,1371021465],[33,7238516450],[34,-8449823804],[35,-628270215],[36,-3461345609],[37,13984238677],[38,-14567175772],[39,9715465325],[40,-5736646666],[41,-6420071453],[42,-3612627175],[43,-1371021465],[44,1243118484],[45,628270215],[46,-500367234],[47,-13246993909],[48,-6447265094],[49,2985919485],[50,4188776617],[51,-2439968627],[52,1712802700],[53,2551979073],[54,-1426758214],[55,13314318907],[56,-13984238677],[57,10853532742],[58,3935667983],[59,-559503499],[60,-2058461795],[61,2617965294],[62,1290479195],[63,-3935667983],[64,-1243118484],[65,-4090599169],[66,2804097576],[67,-1877206188],[68,4590465995],[69,1000734468],[70,-11586022841],[71,6662287835],[72,-7043896108],[73,-2233048757],[74,5667703330],[75,3609241535],[76,1436466443],[77,3612627175],[78,-19033332295],[79,13984238677],[80,6336714038],[81,-9158375204],[82,21433801962],[83,-10162316992]],[[2,2089182844],[3,-1038367102],[4,335647020],[5,-1939485041],[6,786817191],[7,-4853307126],[8,-1266426206],[9,6976650744],[10,-856917412],[11,-1130509943],[12,1182575017],[13,-52065074],[14,1277002510],[15,145639082],[16,-1422641592],[17,-4295213227],[18,1680119751],[19,2092053580],[20,-653600516],[21,1439969779],[22,-3571991976],[23,4208264305],[24,1096835346],[25,549499376],[26,-1646334722],[27,-2060022932],[28,549499376],[29,1510523556],[30,1384070458],[31,1555131390],[32,-501625006],[33,-2648405552],[34,3091594863],[35,229869524],[36,1266426206],[37,-5116509106],[38,5329792291],[39,-3554663789],[40,2098906176],[41,2348955481],[42,1321776628],[43,501625006],[44,-454828267],[45,-229869524],[46,183072785],[47,4846768318],[48,2358905003],[49,-1092478797],[50,-1532576366],[51,892728020],[52,-626674845],[53,-933710049],[54,522017792],[55,-4871400974],[56,5116509106],[57,-3971056304],[58,-1439969779],[59,204709373],[60,753143504],[61,-957852877],[62,-472156454],[63,1439969779],[64,454828267],[65,1496655513],[66,-1025954369],[67,686826275],[68,-1679545211],[69,-366145570],[70,4239057467],[71,-2437576842],[72,2577198476],[73,817020830],[74,-2073681405],[75,-1320537901],[76,-525569808],[77,-1321776628],[78,6963855542],[79,-5116509106],[80,-2318456931],[81,3350837413],[82,-7842131809],[83,3718156464]],[[2,981433845],[3,-487792928],[4,157676647],[5,-911110421],[6,369622515],[7,-2279934417],[8,-594928081],[9,3277415942],[10,-402553444],[11,-531078802],[12,555537372],[13,-24458570],[14,599896503],[15,68416761],[16,-668313264],[17,-2017759068],[18,789268584],[19,982782427],[20,-307041423],[21,676453514],[22,-1678011968],[23,1976913141],[24,515259511],[25,258137906],[26,-773397417],[27,-967735415],[28,258137906],[29,709597509],[30,650193734],[31,730552898],[32,-235648000],[33,-1244139472],[34,1452336180],[35,107985632],[36,594928081],[37,-2403578615],[38,2503772495],[39,-1669871718],[40,986001566],[41,1103467038],[42,620930007],[43,235648000],[44,-213664331],[45,-107985632],[46,86001963],[47,2276862688],[48,1108141019],[49,-513212938],[50,-719957242],[51,419376167],[52,-294392569],[53,-438628262],[54,245227903],[55,-2288434354],[56,2403578615],[57,-1865480115],[58,-676453514],[59,96166169],[60,353803654],[61,-449969823],[62,-221804581],[63,676453514],[64,213664331],[65,703082728],[66,-481961809],[67,322649860],[68,-788998682],[69,-172003926],[70,1991378820],[71,-1145098632],[72,1210688577],[73,383811259],[74,-974151745],[75,-620348091],[76,-246896531],[77,-620930007],[78,3271405153],[79,-2403578615],[80,-1089139759],[81,1574120357],[82,-3683992329],[83,1746675551]],[[2,-1459443681],[3,725373708],[4,-234473456],[5,1354869056],[6,-549648099],[7,3390382244],[8,884689308],[9,-4873689670],[10,598618118],[11,789742074],[12,-826113253],[13,36371179],[14,-892077613],[15,-101739318],[16,993816931],[17,3000513728],[18,-1173683846],[19,-1461449096],[20,456586720],[21,-1005921909],[22,2495291943],[23,-2939773685],[24,-766217959],[25,-383864627],[26,1150082586],[27,1439073397],[28,-383864627],[29,-1055208770],[30,-966872233],[31,-1086370533],[32,350420954],[33,1850100751],[34,-2159700191],[35,-160580308],[36,-884689308],[37,3574247656],[38,-3723241220],[39,2483186965],[40,-1466236124],[41,-1640913454],[42,-923355537],[43,-350420954],[44,317730084],[45,160580308],[46,-127889438],[47,-3385814417],[48,-1647863906],[49,763174598],[50,1070614235],[51,-623634390],[52,437777213],[53,652263269],[54,-364666774],[55,3403022090],[56,-3574247656],[57,2774066927],[58,1005921909],[59,-143004141],[60,-526124619],[61,669128760],[62,329835062],[63,-1005921909],[64,-317730084],[65,-1045520950],[66,716702525],[67,-479797290],[68,1173282489],[69,255778876],[70,-2961284911],[71,1702821812],[72,-1800357514],[73,-570747501],[74,1448614817],[75,922490198],[76,367148111],[77,923355537],[78,-4864751304],[79,3574247656],[80,1619608034],[81,-2340799659],[82,5478290111],[83,-2597398295]],[[2,2880800112],[3,-1431817264],[4,462827836],[5,-2674379956],[6,1084951972],[7,-6692285335],[8,-1746290789],[9,9620190162],[10,-1181614038],[11,-1558874171],[12,1630667346],[13,-71793175],[14,1760874585],[15,200823535],[16,-1961698120],[17,-5922722742],[18,2316737943],[19,2884758604],[20,-901257854],[21,1985592172],[22,-4925463997],[23,5802827799],[24,1512439850],[25,757711499],[26,-2270151349],[27,-2840591149],[28,757711499],[29,2082879650],[30,1908511908],[31,2144389945],[32,-691696937],[33,-3651919233],[34,4263038466],[35,316969934],[36,1746290789],[37,-7055217811],[38,7349316637],[39,-4901569945],[40,2894207734],[41,3239003818],[42,1822614171],[43,691696937],[44,-627168334],[45,-316969934],[46,252441331],[47,6683268895],[48,3252723339],[49,-1506432550],[50,-2113288544],[51,1230993729],[52,-864129710],[53,-1287504356],[54,719816802],[55,-6717235172],[56,7055217811],[57,-5475738743],[58,-1985592172],[59,282276293],[60,1038518911],[61,-1320795204],[62,-651062386],[63,1985592172],[64,627168334],[65,2063756833],[66,-1414701195],[67,947073261],[68,-2315945701],[69,-504882662],[70,5845288871],[71,-3361204916],[72,3553730913],[73,1126600148],[74,-2859424986],[75,-1820906075],[76,-724714722],[77,-1822614171],[78,9602546704],[79,-7055217811],[80,-3196948992],[81,4620511231],[82,-10813612729],[83,5127012024]],[[2,-1855043061],[3,921994784],[4,-298030246],[5,1722122253],[6,-698636679],[7,4309385234],[8,1124494752],[9,-6194760587],[10,760880601],[11,1003810956],[12,-1050040971],[13,46230015],[14,-1133885744],[15,-129316957],[16,1263202701],[17,3813838271],[18,-1491824658],[19,-1857592065],[20,580349928],[21,-1278588877],[22,3171670178],[23,-3736633930],[24,-973910351],[25,-487915649],[26,1461826000],[27,1829151170],[28,-487915649],[29,-1341235521],[30,-1228954332],[31,-1380844048],[32,445406677],[33,2351592323],[34,-2745112335],[35,-204107489],[36,-1124494752],[37,4543089536],[38,-4732469556],[39,3156284002],[40,-1863676674],[41,-2085702345],[42,-1173641918],[43,-445406677],[44,403854561],[45,204107489],[46,-162555373],[47,-4303579251],[48,-2094536802],[49,970042050],[50,1360816822],[51,-792677827],[52,556441878],[53,829066899],[54,-463513993],[55,4325451267],[56,-4543089536],[57,3526010399],[58,1278588877],[59,-181767101],[60,-668736887],[61,850503988],[62,419240737],[63,-1278588877],[64,-403854561],[65,-1328921702],[66,910973179],[67,-609851990],[68,1491314506],[69,325110746],[70,-3763976025],[71,2164391703],[72,-2288365595],[73,-725455328],[74,1841278905],[75,1172542018],[76,466667927],[77,1173641918],[78,-6183399381],[79,4543089536],[80,2058621845],[81,-2975300944],[82,6963245095],[83,-3301453661]],[[2,5295723213],[3,-2632084014],[4,850808115],[5,-4916264740],[6,1994447765],[7,-12302308185],[8,-3210175059],[9,17684623152],[10,-2172139908],[11,-2865650448],[12,2997626555],[13,-131976107],[14,3236984189],[15,369170305],[16,-3606154494],[17,-10887635063],[18,4258817838],[19,5303000037],[20,-1656766159],[21,3650078501],[22,-9054392186],[23,10667234338],[24,2780291068],[25,1392887469],[26,-4173178537],[27,-5221807797],[28,1392887469],[29,3828920328],[30,3508383233],[31,3941993602],[32,-1271534082],[33,-6713257674],[34,7836667206],[35,582680149],[36,3210175059],[37,-12969480450],[38,13510117051],[39,-9010468179],[40,5320370205],[41,5954202666],[42,3350478964],[43,1271534082],[44,-1152912307],[45,-582680149],[46,464058374],[47,12285733423],[48,5979423016],[49,-2769247957],[50,-3884820453],[51,2262913709],[52,-1588514158],[53,-2366796182],[54,1323226326],[55,-12348173022],[56,12969480450],[57,-10065952391],[58,-3650078501],[59,518903449],[60,1909090699],[61,-2427994148],[62,-1196836314],[63,3650078501],[64,1152912307],[65,3793767196],[66,-2600619850],[67,1740987802],[68,-4257361474],[69,-928116748],[70,10745289765],[71,-6178842753],[72,6532759843],[73,2071008860],[74,-5256429701],[75,-3347339002],[76,-1332230082],[77,-3350478964],[78,17652189496],[79,-12969480450],[80,-5876894033],[81,8493802982],[82,-19878470467],[83,9424894312]],[[2,2735200535],[3,-1359451261],[4,439435884],[5,-2539213136],[6,1030117015],[7,-6354048081],[8,-1658030864],[9,9133972593],[10,-1121893648],[11,-1480086539],[12,1548251189],[13,-68164650],[14,1671877574],[15,190673639],[16,-1862551213],[17,-5623380234],[18,2199646839],[19,2738958958],[20,-855707051],[21,1885237628],[22,-4676524310],[23,5509544946],[24,1435999072],[25,719415723],[26,-2155414795],[27,-2697023787],[28,719415723],[29,1977608064],[30,1812053107],[31,2036009546],[32,-656737628],[33,-3467346239],[34,4047578671],[35,300949840],[36,1658030864],[37,-6698637455],[38,6977872123],[39,-4653837895],[40,2747930516],[41,3075300133],[42,1730496759],[43,656737628],[44,-595470388],[45,-300949840],[46,239682600],[47,6345487345],[48,3088326253],[49,-1430295389],[50,-2006480052],[51,1168777622],[52,-820455413],[53,-1222432124],[54,683436276],[55,-6377736921],[56,6698637455],[57,-5198987417],[58,-1885237628],[59,268009664],[60,986030744],[61,-1254040408],[62,-618156803],[63,1885237628],[64,595470388],[65,1959451739],[66,-1343200262],[67,899206884],[68,-2198894637],[69,-479365200],[70,5549859977],[71,-3191325025],[72,3374120491],[73,1069660237],[74,-2714905736],[75,-1728874992],[76,-688086647],[77,-1730496759],[78,9117220861],[79,-6698637455],[80,-3035370817],[81,4386984273],[82,-10267077952],[83,4867885825]],[[2,-1058345726],[3,526019724],[4,-170033270],[5,982511277],[6,-398588668],[7,2458605701],[8,641550722],[9,-3534256714],[10,434100291],[11,572697776],[12,-599073088],[13,26375312],[14,-646908503],[15,-73778368],[16,720686871],[17,2175884495],[18,-851121079],[19,-1059799992],[20,331103294],[21,-729465047],[22,1809512484],[23,-2131837602],[24,-555638777],[25,-278367361],[26,834006138],[27,1043573793],[28,-278367361],[29,-765206432],[30,-701147371],[31,-787804029],[32,254114992],[33,1341638766],[34,-1566151195],[35,-116448126],[36,-641550722],[37,2591939506],[38,-2699985264],[39,1800734308],[40,-1063271405],[41,-1189942276],[42,-669590337],[43,-254114992],[44,230408532],[45,116448126],[46,-92741666],[47,-2455293251],[48,-1194982542],[49,553431820],[50,776378025],[51,-452241356],[52,317463188],[53,473002178],[54,-264445642],[55,2467771751],[56,-2591939506],[57,2011671920],[58,729465047],[59,-103702409],[60,-381530133],[61,485232542],[62,239186708],[63,-729465047],[64,-230408532],[65,-758181108],[66,519731640],[67,-347934914],[68,850830024],[69,185483332],[70,-2147436910],[71,1234836408],[72,-1305566430],[73,-413889339],[74,1050492951],[75,668962818],[76,266245035],[77,669590337],[78,-3527774878],[79,2591939506],[80,1174492214],[81,-1697479214],[82,3972695211],[83,-1883557016]],[[84,1]]];\n" }, { "path": "anc/code/1.1.9/1.1.9a_geometry_field.gp", "size_bytes": 4251, "sha256": "85cd974f01094b5251114f8c1d3771c7526879663d06476bf4efcdb6ac52a64f", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.9a Geometry of C and the bitangent field K.\n\\\\ Target F(x,y) = x^4+y^3+2x+y+1. Package coordinates u = y, z = x:\n\\\\ C: G(u,z) = u^3+u+z^4+2z+1 = 0, hyperflex O = [U:Z:W] = [1:0:0] (= [0:1:0] in (x,y)).\n\\\\ Checks: transport; smoothness at O and hyperflex; bad primes from the critical algebra\n\\\\ u^2 = -1/3, z^3 = -1/2 (critical value (4u+9z+6)/6) and node thickness; the bitangent slope\n\\\\ polynomial f (own elimination), irreducibility and the eta identity; maximal order of\n\\\\ K = Q[m]/(f) (nfcertify), signature, discriminant, primes over 2.\n\\\\ Usage: gp -q 1.1.8a_geometry_field.gp < /dev/null\ndefault(parisizemax, 2*10^9);\ntmp = e + z + u + X + W + Z; \\\\ variable priority: m lowest\nF = x^4+y^3+2*x+y+1;\nG = u^3+u+z^4+2*z+1;\nprint(\"transport F(z,u) == G(u,z): \", substvec(F,[x,y],[z,u]) == G);\n\\\\ ---- O = [1:0:0]: chart U = 1, coordinates (Z,W)\nGh = numerator(substvec(G,[u,z],[1/W,Z/W])*W^4);\nprint(\"chart at O: \", Gh, \"; d/dW at (0,0) = \", polcoef(polcoef(Gh,1,W),0,Z), \" (unit in every characteristic)\");\nprint(\"line W=0 meets C in: \", subst(Gh,W,0), \" (4-fold at O: hyperflex)\");\n\\\\ ---- critical algebra and bad primes\nGu = deriv(G,u); Gz = deriv(G,z);\nprint(\"G_u = \", Gu, \", G_z = \", Gz, \"; 12G - 4u G_u - 3z G_z = \", 12*G-4*u*Gu-3*z*Gz, \" => value at a critical point = (4u+9z+6)/6\");\n\\\\ critical field L = Q(sqrt(-3), 4^(1/3)), u = s/3, z = -c/2 with s^2 = -3, c^3 = 4\npc = polcompositum(X^2+3, X^3-4, 1)[1];\nL = nfinit(pc[1]); s = pc[2]; c = pc[3];\nuu = s/3; zz = -c/2;\nprint(\"critical point check: \", [subst(Gu,u,uu), substvec(Gz,[z],[zz])]);\nval = substvec(G,[u,z],[uu,zz]);\nnormc = norm(val);\nprint(\"critical value == (4u+9z+6)/6: \", val == (4*uu+9*zz+6)/6);\nprint(\"critical_value_norm = \", normc, \" = \", factor(numerator(normc)), \" / \", factor(denominator(normc)));\nhess = substvec(deriv(Gu,u)*deriv(Gz,z) - deriv(Gu,z)^2, [u,z], [uu,zz]);\nprint(\"norm of the Hessian at the critical point = \", factor(norm(hess)), \" (unit away from 2,3)\");\nfa = idealfactor(L, lift(val));\n{for(i=1,#fa~, my(pr=fa[i,1]); if(pr.p>3,\n print(\" bad p = \", pr.p, \": prime of L with residue degree \", pr.f, \", valuation of critical value \", fa[i,2],\n \" -> \", pr.f, \" geometric node(s) of thickness \", fa[i,2]);\n if(pr.f==1, print(\" node mod p: (u,z) = \", [lift(nfmodpr(L,uu,nfmodprinit(L,pr))), lift(nfmodpr(L,zz,nfmodprinit(L,pr)))]))));}\n\\\\ p = 2, 3 directly: affine F_p-singular points (and O is smooth by the chart above)\n{for(p=2,3, my(Lp=List()); for(a=0,p-1,for(b=0,p-1, if(substvec(G,[u,z],[a,b])%p==0 && substvec(Gu,[u,z],[a,b])%p==0 && substvec(Gz,[u,z],[a,b])%p==0, listput(Lp,[a,b]))));\n print(\"p = \", p, \": affine F_p-rational singular points \", Lp));}\nprint(\"p = 3: G_u = 3u^2+1 == 1 (mod 3), so C is smooth at 3\");\n\\\\ ---- bitangents u = m z + e: own elimination\nQ = (m*z+e)^3 + (m*z+e) + z^4 + 2*z + 1;\nq3=polcoef(Q,3,z); q2=polcoef(Q,2,z); q1=polcoef(Q,1,z); q0=polcoef(Q,0,z);\npp=q3/2; qq=(q2-pp^2)/2;\nR = polresultant(numerator(2*pp*qq-q1), numerator(qq^2-q0), e);\nfaR = factor(R);\nprint(\"Res_e factors (degree, multiplicity): \", vector(#faR~,i,[poldegree(faR[i,1]), faR[i,2]]));\nf = 0; for(i=1,#faR~, if(poldegree(faR[i,1])==27, f = faR[i,1]/pollead(faR[i,1])));\nf8 = m^27+480*m^19-2688*m^18+17280*m^15-34560*m^11-141312*m^10-162816*m^9-165888*m^7-221184*m^6-126976*m^3+49152*m-32768;\nprint(\"degree-27 factor == f: \", f == f8, \"; f irreducible: \", polisirreducible(f8), \"; real roots: \", polsturm(f8));\ne8 = Mod(11*m^13+112*m^5+224*m^4+192*m, f8)/Mod(8*(13*m^9-16*m+16), f8);\nmm = Mod(m, f8);\n{print(\"identity F(x, m x+eta) = (x^2 + m^3 x/2 + 3 m^2 eta/2 - m^6/8)^2: \",\n z^4 + (mm*z+e8)^3 + 2*z + (mm*z+e8) + 1 == (z^2 + mm^3/2*z + 3*mm^2*e8/2 - mm^6/8)^2);}\n\\\\ ---- the field\nprint(\"poldisc(f) (trial division to 1e7): \", factor(poldisc(f8), 10^7));\nt0 = getabstime();\nK = nfinit([f8, [2,3,7,12527563,252455508240151]]);\nprint(\"nfcertify (empty = maximal order certified): \", nfcertify(K));\nprint(\"signature \", K.sign, \"; disc \", K.disc, \" = \", factor(K.disc));\nprint(\"disc == 2^30 12527563^6: \", K.disc == 2^30*12527563^6, \"; isprime(12527563): \", isprime(12527563));\nP = idealprimedec(K,2); print(\"primes over 2 (e,f): \", vector(#P,i,[P[i].e,P[i].f]), \" (\", getabstime()-t0, \" ms)\");\nquit;\n" }, { "path": "anc/code/1.1.9/1.1.9e_global_rank.py", "size_bytes": 14460, "sha256": "2511b4ebb4dab2e40095e1e93791f9a36a0788a7170f03b7aa7a7fd90c69c158", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"1.1.9e Fresh exact rank upper bound for u^3+u+z^4+2z+1=0 (u = y, z = x of the target equation).\n\nPackage script verify_011197_global_rank.py (with orthogonal_frobenius_bounds.py inlined); only\npaths and the output were changed. The only class premise is ordinary Cl(K)[2]=0. No BNF is used.\nEvery local image used as a restriction is proved complete, and the quadratic local point is\ntransported by an exact norm error polynomial.\nInputs: data/1.1.9e_rank_input.json (17 classes, 161 atomic elements, 141 prime ideals),\n data/1.1.9e_field_input.json. Output: work/1.1.9e_global_rank.json.\nUsage (passagemath / Sage): python3 -I 1.1.9e_global_rank.py\n\"\"\"\nfrom sage.all__sagemath_schemes import *\nfrom pathlib import Path\nfrom collections import defaultdict\nimport argparse,json,time\n\n# --- orthogonal_frobenius_bounds.py (exhaustive finite O^-_6(F2) fake-image bounds) ---\ndef compute_bounds():\n def q(x):\n b=[(x>>i)&1 for i in range(6)]\n return b[0]*b[1]^b[2]*b[3]^b[4]^b[4]*b[5]^b[5]\n def pairing(x,y):return (((x&21)<<1 | (x&42)>>1)&y).bit_count()&1\n def apply(M,x):\n v=0\n for j in range(6):\n if x>>j&1:v^=M[j]\n return v\n def rank(rows):\n piv={}\n for x in rows:\n while x:\n j=x.bit_length()-1\n if j in piv:x^=piv[j]\n else:piv[j]=x;break\n return len(piv)\n singular=[x for x in range(1,64) if q(x)==0];assert len(singular)==27\n vectors=[x for x in range(1,64) if q(x)==1];assert len(vectors)==36\n maps=[tuple(x^(v if pairing(x,v) else 0) for x in range(64)) for v in vectors]\n assert all(q(T[x])==q(x) and T[T[x]]==x for T in maps for x in range(64))\n identity=(1,2,4,8,16,32);group=[identity];seen={identity}\n for M in group:\n for T in maps:\n A=tuple(T[v] for v in M)\n if A not in seen:seen.add(A);group.append(A)\n assert len(group)==2*2**6*(2**3+1)*(2**2-1)*(2**4-1)==51840\n index={v:i for i,v in enumerate(singular)};codes=[sum(pairing(1<>i&1):mask|=1<=depth;errors.append(error)\nrow=localchar(a);LR.append(row)\nwitnesses.append({'kind':'infinity','t':int(t),'w':str(w),'modulus':str(mod),\n 'residual_valuation':int(res.valuation(2)),'relative_squareclass_error_lower_bounds':errors,\n 'row':list(map(int,row))})\n\n# Degree-two unramified point. All its Hensel and norm errors are exact.\nZZt=PolynomialRing(Zmod(mod),'d');Lt=ZZt.quotient(ZZt.gen()**2+ZZt.gen()+1,'d')\ndd=Lt.gen();u=dd\nfor j in range(10):u=u-(u**3+u+dd**4+2*dd+1)/(1+3*u*u)\nassert u**3+u+dd**4+2*dd+1==0\nuc=[ZZ(c.lift()) for c in u.list()];uc += [ZZ(0)]*(2-len(uc));assert len(uc)==2\nassert uc[0]%2==0 and uc[1]%2==1\nQQt=PolynomialRing(QQ,'d');L=QQt.quotient(QQt.gen()**2+QQt.gen()+1,'d')\ndd=L.gen();ul=L(uc[0])+L(uc[1])*dd\nresl=ul**3+ul+dd**4+2*dd+1\nrv=min(ZZ(c).valuation(2) for c in resl.list() if c);assert rv>=80\nder=1+3*ul*ul;dc=list(der);dc += [QQ(0)]*(2-len(dc))\nassert ZZ(dc[0]*dc[0]-dc[0]*dc[1]+dc[1]*dc[1])%2\nc0=K(uc[0])-eta;c1=K(uc[1])-m;a=c0*c0-c0*c1+c1*c1\nerrors=[]\nfor r in local:\n P,e,depth=r['P'],r['e'],r['depth']\n # N(c0+d0+(c1+d1)d)-N(c0+c1d)\n # = (2c0-c1)d0+(2c1-c0)d1+d0^2-d0*d1+d1^2.\n error=min(int((2*c0-c1).valuation(P))+int(rv)*e,\n int((2*c1-c0).valuation(P))+int(rv)*e,\n 2*int(rv)*e)-int(a.valuation(P))\n assert error>=depth;errors.append(error)\nrow=localchar(a);LR.append(row)\nwitnesses.append({'kind':'unramified_quadratic','z_polynomial':[1,1,1],\n 'u_coefficients':list(map(str,uc)),'modulus':str(mod),'residual_valuation':int(rv),\n 'relative_squareclass_error_lower_bounds':errors,'row':list(map(int,row))})\nLI=matrix(GF(2),LR);assert LI.rank()==3\nconstraints+=list(LI.right_kernel().basis_matrix()*LG.transpose())\nker=matrix(GF(2),constraints).right_kernel();assert ker.dimension()==2\ncombined=LG\nfor M in GM:combined=combined.augment(M)\nassert combined.rank()==17\n\n# Independent global characters certify the subgroup required by the local proof.\n# The quadratic divisor D has z^2-2z+3=0 and u=z-2.\nassert (z-2)**3+(z-2)+z**4+2*z+1==(z*z-2*z+3)*(z*z+3*z-3)\nc0=-2-eta;c1=1-m\npointclasses=[eta-m,c0*c0+2*c0*c1+3*c1*c1];known=[]\nfor p,r in [(5,-1),(37,-21)]:\n Fp=GF(p);Rp=PolynomialRing(Fp,'X');fp0=Rp(f)\n assert fp0(Fp(r))==0 and fp0.derivative()(Fp(r))!=0\n row=[]\n for a in pointclasses:\n v=sum(Fp(c)*Fp(r)**j for j,c in enumerate(a.list()));assert v\n row.append(int(not v.is_square()))\n known.append({'p':p,'slope_root':r,'point_characters':row})\nassert [r['point_characters'] for r in known]==[[1,1],[1,0]]\nassert matrix(GF(2),[r['point_characters'] for r in known]).rank()==2\n\n# Exact critical-value geometry: one thickness-one node at the sole odd bad prime.\nQZ=PolynomialRing(QQ,'z');Z=QZ.gen()\ncritical_norm=(Z**3+QQ(1)/2).resultant(243*Z*Z+324*Z+124)/108**3\nassert critical_norm>0 and critical_norm.numerator()==12527563\nassert critical_norm.valuation(12527563)==1\nassert all(p in [2,3] for p in critical_norm.denominator().prime_divisors())\np=12527563;Fp=GF(p);FZ=PolynomialRing(Fp,'Z');Z=FZ.gen()\nnode=(243*Z*Z+324*Z+124).gcd(4*Z**3+2).monic();assert node.degree()==1\nzz=-node[0];uu=-(9*zz+6)/4\nassert uu**3+uu+zz**4+2*zz+1==0 and 3*uu*uu+1==0 and 4*zz**3+2==0\nassert 72*uu*zz*zz\n\nout={'status':'PASS','id':'L1024-011197','rank_upper_bound':2,\n 'known_subgroup_rank_lower_bound':2,\n 'rank_equals_two_and_known_subgroup_odd_index_require_ordinary_class_group_two_torsion_zero':True,\n 'rank_upper_bound_requires_ordinary_class_group_two_torsion_zero':True,\n 'class_group_proved_by_this_replay':False,'BNF_used_in_replay':False,\n 'field_polynomial_coefficients':d['field'],'degree':27,'signature':[3,12],\n 'field_discriminant':str(K.discriminant()),'fresh_maximal_order_certified':True,\n 'normalized_bitangent':'-(u-m*z-eta)','S_squareclass_basis_size':17,\n 'independent_character_rank':17,'compact_membership_atomic_elements':len(elements),\n 'compact_membership_prime_ideals':len(primes),'good_prime_audits':goodlogs,\n 'dyadic_orbit_degrees':[24,3],'rational_two_torsion_dimension':0,\n 'dyadic_character_dimension':int(LG.ncols()),\n 'dyadic_local_metadata':[{'e':r['e'],'f':r['f'],'depth':r['depth'],\n 'cyclic_orders':list(map(str,r['cyc'])),'dimension':len(r['inds'])+1} for r in local],\n 'full_dyadic_image_dimension':3,'dyadic_witnesses':witnesses,\n 'dyadic_generator_rows':[list(map(int,r)) for r in LG],\n 'pre_dyadic_dimension':int(preker.dimension()),\n 'final_global_rows':[list(map(int,r)) for r in ker.basis()],\n 'known_point_independence_characters':known,\n 'known_global_divisors':[{'kind':'rational','u':0,'z':-1},\n {'kind':'quadratic','z_polynomial':[3,-2,1],'u_polynomial':[-2,1]}],\n 'critical_value_norm':str(critical_norm),\n 'bad_fiber_geometry':[{'p':p,'singular_z_polynomial':list(map(int,node.list())),\n 'singular_u':int(uu),'singular_z':int(zz),'critical_value_valuation':1,\n 'ordinary_node_thickness':1,'hessian_determinant':int(72*uu*zz*zz)}],\n 'seconds':time.time()-start}\nop=Path(args.output);tmp=Path(str(op)+'.tmp');tmp.write_text(json.dumps(out,indent=2)+'\\n');tmp.replace(op)\nfor key in ['S_squareclass_basis_size','independent_character_rank','pre_dyadic_dimension','dyadic_local_metadata',\n 'full_dyadic_image_dimension','final_global_rows','known_point_independence_characters',\n 'rank_upper_bound','known_subgroup_rank_lower_bound','critical_value_norm','bad_fiber_geometry']:\n print(key, json.dumps(out[key]))\nfor w in witnesses: print('dyadic witness', w['kind'], 'error lower bounds', w.get('relative_squareclass_error_lower_bounds'))\nprint('FRESH_CLASS_CONDITIONAL_GLOBAL_RANK_PASS','seconds',time.time()-start,flush=True)\n" }, { "path": "anc/code/1.1.9/1.1.9f_logs.gp", "size_bytes": 4935, "sha256": "1976d48da6283305540abf10cf201ebbbb90e9e8f7bff713ee5497ccab431438", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.9f Principal divisors div(h0) = 16 P0 + E0 - 19 O and div(hD) = 8 D_eff + E_D - 19 O for\n\\\\ C: u^3+u+z^4+2z+1 = 0 (u = y, z = x), P0 = (0,-1), D_eff: z^2-2z+3 = 0, u = z-2.\n\\\\ Newton polygons of t = z/u and w = 1/u on E0, E_D; 2-adic logs log G0 = -(1/16) Tr, log D = -(1/8) Tr\n\\\\ (Newton sums); cross product -> primitive annihilator.\n\\\\ Writes work/1.1.9f_annihilator.txt and work/1.1.9f_logs.txt (used by 1.1.9g).\n\\\\ Usage: gp -q 1.1.9f_logs.gp < /dev/null\nsystem(\"mkdir -p work\");\ndefault(parisizemax, 2*10^9);\nF = u^3+u+z^4+2*z+1;\nNT = 300;\nmons = List(); for(b=0,2, for(a=0,6, if(3*a+4*b<=19, listput(mons,[a,b])))); mons=Vec(mons);\n\\\\ local expansion at a point (u0,z0) over a number field given via Mod\nlocalu(u0,z0,ord) = {\n my(U = u0 + O(s^ord));\n for(it=1,8, my(Fs = substvec(F,[u,z],[U, z0+s]), Fus = substvec(deriv(F,u),[u,z],[U,z0+s])); U = U - Fs/Fus);\n U;\n}\n\\\\ rational point P0=(0,-1), order 16\nfindh_rat(u0,z0,ordv) = {\n my(U = localu(u0,z0,ordv+2), Mx = matrix(ordv, #mons));\n for(j=1,#mons, my(ser = (z0+s)^mons[j][1] * U^mons[j][2] + O(s^ordv));\n for(i=1,ordv, Mx[i,j] = polcoef(ser, i-1, s)));\n my(K = matker(Mx)); if(#K!=1, error(\"kernel dim \",#K));\n my(v = K[,1]); v = v/content(v);\n sum(j=1,#mons, v[j]*z^mons[j][1]*u^mons[j][2]);\n}\n\\\\ quadratic point Q: z^2-2z+3=0, u=z-2 ; order 8 at Q (and conj). Conditions over Q(r): 8 conditions -> 16 rational\nfindh_quad(ordv) = {\n my(r = Mod(qq, qq^2-2*qq+3)); my(z0 = r, u0 = r-2);\n my(U = localu(u0,z0,ordv+2), Mx = matrix(2*ordv, #mons));\n for(j=1,#mons, my(ser = (z0+s)^mons[j][1] * U^mons[j][2] + O(s^ordv));\n for(i=1,ordv, my(c = lift(polcoef(ser, i-1, s))); Mx[2*i-1,j] = polcoef(c,0,qq); Mx[2*i,j] = polcoef(c,1,qq)));\n my(K = matker(Mx)); if(#K!=1, error(\"kernel dim \",#K));\n my(v = K[,1]); v = v/content(v);\n [sum(j=1,#mons, v[j]*z^mons[j][1]*u^mons[j][2]), U];\n}\n\\\\ infinity: t=z/u, w=1/u : multiply F by w^4: 1*... u^3 w^4 = w, u w^4 = w^3, z^4 w^4 = t^4, 2 z w^4 = 2 t w^3, w^4\n\\\\ => t^4 + w + (1+2t) w^3 + w^4 = 0\nW = O(t^(NT+8)); for(it=1,NT, W = -t^4 - (1+2*t)*W^3 - W^4);\nprint(\"w-series residual valuation: \", valuation(t^4 + W + (1+2*t)*W^3 + W^4, t), \" leading: \", polcoef(W,4,t));\nZs = t/W; Us = 1/W; dz = deriv(Zs,t); Fu = substvec(deriv(F,u),[u,z],[Us,Zs]);\nom = [dz/Fu, Zs*dz/Fu, Us*dz/Fu];\nom2 = [W, t, 1]*(1 - t*deriv(W,t)/W)/(W^2+3);\nprint(\"closed form check: \", vector(3,j, valuation(om[j]-om2[j],t)));\nprint(\"min 2-val of differential coefficients: \", vecmin(vector(3,j, vecmin(vector(NT,n, my(c=polcoef(om[j],n-1,t)); if(c==0,99,valuation(c,2)))))));\nlogs_of(h, mult, label, rootfac) = {\n my(N = polresultant(h, F, u)); my(fa = factor(N)); print(\" \",label,\" norm factorization degrees/mults: \", vector(#fa~,k,[poldegree(fa[k,1]),fa[k,2]]));\n my(cub = 0); for(k=1,#fa~, if(fa[k,1]!=rootfac, cub = if(cub, cub*fa[k,1]^fa[k,2], fa[k,1]^fa[k,2])));\n print(\" residual deg \", poldegree(cub), \" squarefree \", issquarefree(cub), \" irreducible \", polisirreducible(cub), \" gcd with support poly: \", gcd(cub, rootfac));\n my(cb = subst(cub,z,y)/pollead(cub));\n my(g = gcd(Mod(1,cb)*subst(subst(F,z,y),u,x), Mod(1,cb)*subst(subst(h,z,y),u,x)));\n if(poldegree(g,x)!=1, error(\"gcd deg\"));\n my(uval = -polcoef(g,0,x)/polcoef(g,1,x));\n my(tt = Mod(y,cb)/uval, ww = 1/uval);\n my(ct = charpoly(tt), cw = charpoly(ww));\n print(\" 2-vals charpoly t: \", vector(4,k, my(c=polcoef(ct,k-1)); if(c==0,\"inf\",valuation(c,2))), \" w: \", vector(4,k, my(c=polcoef(cw,k-1)); if(c==0,\"inf\",valuation(c,2))));\n my(tr = vector(NT+1)); my(pw = Mod(1,cb)); for(k=1,NT+1, pw *= tt; tr[k] = trace(pw));\n vector(3,j, -1/mult * sum(n=0,NT-1, polcoef(om[j],n,t) * tr[n+1]/(n+1)));\n}\nh0 = findh_rat(0,-1,16); print(\"h0 found; order check\");\nL0 = logs_of(h0, 16, \"E0\", z+1);\nhq = findh_quad(8); hD = hq[1];\n\\\\ verify order 8 at Q\nmy_r = Mod(qq, qq^2-2*qq+3); serq = substvec(hD,[u,z],[localu(my_r-2,my_r,12), my_r+s]); print(\"order of h_D at Q: \", valuation(serq,s));\nLD = logs_of(hD, 8, \"ED\", z^2-2*z+3);\nprint(\"4 log G0 mod 2^12: \", vector(3,j, lift(4*L0[j]+O(2^12))), \" 4 log D mod 2^12: \", vector(3,j, lift(4*LD[j]+O(2^12))));\nprint(\"val log G0: \", vector(3,j,valuation(L0[j],2)), \" val log D: \", vector(3,j,valuation(LD[j],2)));\ncof = [L0[2]*LD[3]-L0[3]*LD[2], L0[3]*LD[1]-L0[1]*LD[3], L0[1]*LD[2]-L0[2]*LD[1]];\nvc = vecmin(vector(3,j,valuation(cof[j],2)));\nprint(\"cofactor valuations: \", vector(3,j,valuation(cof[j],2)), \" min \", vc);\na = cof/2^vc; print(\"annihilator raw mod 16: \", vector(3,j, lift(a[j]+O(2^4))));\nsc = 9/(a[3]+O(2^60)); an = vector(3,j, a[j]*sc + O(2^50));\nprint(\"annihilator normalized a2=9 mod 16: \", vector(3,j, lift(an[j]+O(2^4))), \" COFACTORVAL \", vc);\nprint(\"annihilator (integers mod 2^50): \", vector(3,j, lift(an[j])));\nwrite(\"work/1.1.9f_annihilator.txt\", vector(3,j, lift(an[j])));\nwrite(\"work/1.1.9f_logs.txt\", [vector(3,j,lift(L0[j]*2^20+O(2^70))), vector(3,j,lift(LD[j]*2^20+O(2^70)))]);\nquit;\n" }, { "path": "anc/code/1.1.9/1.1.9g_chart.gp", "size_bytes": 2569, "sha256": "718b3453ee7d647d62472661e2c4f023c3ce64cc71efbd86f897daa8937e105c", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.1.9g The integral chart x = -1+2t, y = 4b (z = x, u = y), b + 16 b^3 = t - 6t^2 + 8t^3 - 4t^4;\n\\\\ valuations of the low coefficients of the primitive H of the annihilating differential (divided by 8),\n\\\\ [t^4]H = 36a0 - 42a1 - 14a2, the extra zero t_* (Newton) and its coordinates (c0, cD) in the basis\n\\\\ (log G0, log D). Reads work/1.1.9f_annihilator.txt and work/1.1.9f_logs.txt (run 1.1.9f first).\n\\\\ Usage: gp -q 1.1.9g_chart.gp < /dev/null\ndefault(parisizemax, 2*10^9);\nan = read(\"work/1.1.9f_annihilator.txt\");\nLL = read(\"work/1.1.9f_logs.txt\"); L0 = LL[1]/2^20; LD = LL[2]/2^20; \\\\ rationals approximating logs mod 2^50\nNT = 260;\nBs = O(t^NT); for(it=1,NT, Bs = (t-6*t^2+8*t^3-4*t^4) - 16*Bs^3);\nprint(\"chart eq residual val: \", valuation(Bs+16*Bs^3-(t-6*t^2+8*t^3-4*t^4), t));\nZ = -1+2*t; U = 4*Bs; Fu = 3*U^2+1;\nomv = vector(3,j, [1,Z,U][j]*deriv(Z,t)/Fu);\nomA = an[1]*omv[1]+an[2]*omv[2]+an[3]*omv[3];\nHp = omA/8;\nprint(\"matches TeX H': \", valuation(Hp - ((an[1]-an[2])/4 + (an[2]/2)*t + an[3]*Bs)/(1+48*Bs^2), t));\nH = intformal(Hp);\nprint(\"v2 [t^n]H, n=1..12: \", vector(12,n, my(c=polcoef(H,n,t)); if(c==0,\"inf\",valuation(c,2))));\nprint(\"[t^4]H vs 36a0-42a1-14a2: \", valuation(polcoef(H,4,t) - (36*an[1]-42*an[2]-14*an[3]),2));\nbad=0; for(n=3,NT-1, my(c=polcoef(H,n,t)); if(c!=0, my(v=valuation(c,2)); my(bd=ceil(2*(n-2)/3)-valuation(n,2)); if(vpoldegree(q)==1, factor(P)[,1]~));\n c+1;\n}\nJorder(s,p) = {\n my(N = vector(3,k, cnt(s,p,k)));\n my(sk = vector(3,k, p^k + 1 - N[k]));\n my(a1 = -sk[1], a2 = (sk[1]^2 - sk[2])/2, a3 = -(sk[1]^3 - 3*sk[1]*sk[2] + 2*sk[3])/6);\n my(L = 1 + a1*T + a2*T^2 + a3*T^3 + p*a2*T^4 + p^2*a1*T^5 + p^3*T^6);\n [N, subst(L,T,1), factor(subst(L,T,1)), L];\n}\nr = Jorder(1,23);\nprint(\"p = 23: #C(F_23^k), k=1,2,3: \", r[1]);\nprint(\"L-polynomial: \", r[4]);\nprint(\"#J(F_23) = \", r[2], \" = \", r[3]);\nquit;\n" }, { "path": "anc/code/1.1.9/1.1.9h_sieve23.py", "size_bytes": 2124, "sha256": "e1fdef53c2f9b060c626ea4f78c6d009ae3328e64f4e949a347b7aa1e3ccc3ef", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"1.1.9h (part 2) Mordell-Weil sieve at 23 for C: u^3+u+z^4+2z+1 = 0 (u = y, z = x).\n\nIn J(F_23) (#J = 14432 = 451*32; Hess model of Sage's function-field Jacobian, base divisor 3*O)\nform the target 451*(11*G0 + 10*D), G0 = [P0 - O], D = [D_eff - 2O], and compare it with\n451*[Q - O] for all 26 points Q of C(F_23). The equality test is repeated by Riemann-Roch:\nthe difference is principal iff its degree-0 representative has a nonzero Riemann-Roch space.\nUsage (passagemath / Sage): python3 -I 1.1.9h_sieve23.py\n\"\"\"\nfrom sage.all__sagemath_schemes import *\nfrom sage.all__sagemath_flint import *\nfrom sage.all__sagemath_pari import *\nk = GF(23)\nK = FunctionField(k, 'z'); z = K.gen()\nR = PolynomialRing(K, 'Y'); Y = R.gen()\nL = K.extension(Y**3 + Y + z**4 + 2*z + 1, 'u'); u = L.gen()\nprint(\"genus\", L.genus())\nOinf = L.places_infinite(); assert len(Oinf) == 1 and Oinf[0].degree() == 1\nO = Oinf[0]\naff = [p for p in L.places(1) if p != O]\nprint(\"#C(F_23) =\", len(aff) + 1)\nOL = L.maximal_order()\nP0 = OL.ideal(z + 1, u).place()\nDpl = OL.ideal(z**2 - 2*z + 3, u - z + 2).place()\nprint(\"P0 degree\", P0.degree(), \" D_eff degree\", Dpl.degree())\nJ = L.jacobian(model='hess', base_div=3*O.divisor())\nG = J.group()\ng0 = G.point(P0.divisor() - O.divisor())\ngD = G.point(Dpl.divisor() - 2*O.divisor())\nprint(\"14432*G0 = 0:\", (14432*g0).is_zero(), \" 14432*D = 0:\", (14432*gD).is_zero())\ndef ord2(x):\n y = 451*x; n = 0\n while not y.is_zero():\n y = 2*y; n += 1\n return 2**n\nprint(\"orders of 451*G0, 451*D:\", ord2(g0), ord2(gD))\ntarget = 451*(11*g0 + 10*gD)\nprint(\"target 451(11 G0 + 10 D) nonzero:\", not target.is_zero())\nmatches = [P for P in aff + [O] if 451*G.point(P.divisor() - O.divisor()) == target]\nprint(\"hess matches among\", len(aff) + 1, \"points:\", matches)\nnprinc = 0\nfor P in aff + [O]:\n Dy = (451*G.point(P.divisor() - O.divisor()) - target).divisor()\n assert Dy.degree() == 0\n if Dy.dimension() != 0:\n nprinc += 1\nprint(\"points with 451[Q-O] - target principal (RR check):\", nprinc, \"of\", len(aff) + 1)\nprint(\"RR sanity: dim L(rep of 14432*G0) =\", (14432*g0).divisor().dimension())\n" }, { "path": "anc/code/1.2.1/1.2.1a_cubic_field_K.gp", "size_bytes": 1805, "sha256": "5340c3f679a72d516e62a2a23aa7ffb43a255d835e6048074c548946cd5e6681", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1a -- K = Q(3^(1/3)), E_0 and E_2 over K. Reviewer P2 script c5k.gp.\n\\\\ Run from this folder: gp -q 1.2.1a_cubic_field_K.gp\n\\\\ [bundle] Denis Simon's ell.gp from ../common/simon_ell/, loaded with the reviewer's parameters:\nDEBUGLEVEL_ell=0; LIM1=2; LIM3=4; LIMTRIV=2; MAXPROB=20; LIMBIGPRIME=30;\n\\r ../common/simon_ell/ell.gp\n\\r ../common/simon_ell/qfsolve.gp\n\\r ../common/simon_ell/resultant3.gp\nK = bnfinit(y^3-3,1); print(\"K: disc \", factor(K.disc), \" h \", K.no, \" certify \", bnfcertify(K), \" fu \", K.fu);\nth = Mod(y, y^3-3); eps = 4+3*th+2*th^2;\nprint(\"bnfisunit(eps): \", bnfisunit(K, eps));\nE0 = [0,0,0,-36,0]; E2 = [0,0,0,lift(-36*eps^2),0];\nr0 = bnfellrank(K, E0); print(\"E0 over K: [r,s]=\", r0[1..2], \" pts \", r0[3]);\nr2 = bnfellrank(K, E2); print(\"E2 over K: [r,s]=\", r2[1..2]);\nnf=K.nf; print(\"torsion E0 \", elltors(ellinit(E0,nf))[1..2], \" E2 \", elltors(ellinit(E2,nf))[1..2]);\nA=[-3,9]; B=[lift(6*th-6*th^2), lift(36-36*th+12*th^2)];\ne0=ellinit(E0,nf); print(\"A,B on E0: \", ellisoncurve(e0,A), ellisoncurve(e0,B));\n\\\\ independence of A,B,T0,T1 mod 2\nT0=[0,0]; T1=[6,0];\nfor(m=1,15, R=[0]; if(bittest(m,0),R=elladd(e0,R,A)); if(bittest(m,1),R=elladd(e0,R,B)); if(bittest(m,2),R=elladd(e0,R,T0)); if(bittest(m,3),R=elladd(e0,R,T1)); if(ellisdivisible(e0,R,2), print(\"dependent \", m)));\nprint(\"A,B,T0,T1 independence mod 2 checked\");\n\\\\ is -/+eps^3/2 a square in K (torsion image test for C2)\nprint(\"eps^3/2 square? \", #nfroots(nf, x^2-lift(eps^3/2)), \" -eps^3/2 square? \", #nfroots(nf, x^2+lift(eps^3/2)));\n\\\\ [added for the bundle] unit box of the section: a+b*th+c*th^2, 0<=a<=4, 0<=b<=3, 0<=c<=2, of norm 1\nprint(\"norm-1 elements in the unit box: \", select(v->v[1]^3+3*v[2]^3+9*v[3]^3-9*v[1]*v[2]*v[3]==1, concat(concat(vector(5,a,vector(4,b,vector(3,c,[a-1,b-1,c-1])))))));\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1b_chabauty577.gp", "size_bytes": 1210, "sha256": "cd2e43e8876a99d1b1891e6b4dfc453e22d5109fc0b9c3998b409fec63fce198", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1b -- 577-adic logarithms of A, B, annihilator, pull-back coefficients. Reviewer P2 script c5c0log.gp.\n\\\\ Run from this folder: gp -q 1.2.1b_chabauty577.gp\np=577; N=8;\nformlog(E, t) = {my(L = ellformallog(E, 12, 'w)); subst(truncate(L), 'w, t);}\nplog(E, P) = {my(n=1, Q=P, t); while(!(#Q==2 && valuation(Q[1],p) < 0), n++; Q = elladd(E, Q, P); if(Q==[0], error(\"O\"))); t = -Q[1]/Q[2]; [n, formlog(E,t)/n];}\nrts = polrootspadic(x^3-3, p, N); print(\"roots mod p^3 \", apply(r->lift(r+O(p^3)), rts));\nE = ellinit([0,0,0,-36,0]*(1+O(p^N)));\nLA=vector(3); LB=vector(3);\n{for(i=1,3, th=rts[i]; A=[-3+O(p^N),9+O(p^N)]; B=[6*th-6*th^2, 36-36*th+12*th^2];\n r=plog(E,A); LA[i]=r[2]/p; r=plog(E,B); LB[i]=r[2]/p; print(\"i=\",i,\" nA,nB orders: \", plog(E,A)[1], \" \", plog(E,B)[1]));}\nprint(\"log A/p mod p^2: \", apply(z->lift(z+O(p^2)),LA));\nprint(\"log B/p mod p^2: \", apply(z->lift(z+O(p^2)),LB));\nc = [LA[2]*LB[3]-LA[3]*LB[2], LA[3]*LB[1]-LA[1]*LB[3], LA[1]*LB[2]-LA[2]*LB[1]];\ncm = apply(z->lift(z+O(p)), c); print(\"annihilator mod p: \", cm);\nth = apply(r->lift(r+O(p)), rts);\nprint(\"sum c_i theta_i = \", sum(i=1,3,cm[i]*th[i])%p, \" sum c_i(-theta_i^2/3) = \", lift(Mod(sum(i=1,3,-cm[i]*th[i]^2),p)/3));\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1b_sieve577.py", "size_bytes": 3677, "sha256": "61a8d6711bcc5243c99d0d3d1a77fb601a1c824bf0d6185a48c57dceb2bbe957", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.1b -- Mordell-Weil sieve at 577 on C_0. Reviewer P2 script c5c0.py (SymPy).\n# Run from this folder: python3 -I 1.2.1b_sieve577.py\n# Chapter 5, Appendix 5.A/5.D: C0 sieve at 577 (independent implementation)\nimport itertools, sympy\np=577\nroots=[t for t in range(p) if (t**3-3)%p==0]; print(\"roots\",roots)\na,b,c,T=sympy.symbols('a b c T')\nbeta=a+b*T+c*T**2\ndef redpoly(expr): # reduce polynomial in T modulo T^3-3\n pol=sympy.Poly(sympy.expand(expr),T)\n r=sympy.rem(pol, sympy.Poly(T**3-3,T))\n return [sympy.expand(r.as_expr().coeff(T,k)) for k in range(3)]\nb4=redpoly(beta**4) # Z0 + theta*Y0 + coef2*theta^2\ncoef2=sympy.lambdify((a,b,c),b4[2]); Z0f=sympy.lambdify((a,b,c),b4[0]); Y0f=sympy.lambdify((a,b,c),b4[1])\nNf=sympy.lambdify((a,b,c), a**3+3*b**3+9*c**3-9*a*b*c)\nprint(\"norm check:\", sympy.expand(sympy.resultant(T**3-3, beta, T) - (a**3+3*b**3+9*c**3-9*a*b*c)))\n# enumerate C0(F_p)\npts=[]\nfor bb in range(p):\n for cc in range(p):\n if coef2(1,bb,cc)%p==0: pts.append((1,bb,cc))\nfor cc in range(p):\n if coef2(0,1,cc)%p==0: pts.append((0,1,cc))\nif coef2(0,0,1)%p==0: pts.append((0,0,1))\nprint(\"#C0(F_577) =\",len(pts))\n# elliptic curve V^2 = U^3 - 36 U over F_p\nA4=-36%p\ndef add(P,Q):\n if P is None: return Q\n if Q is None: return P\n x1,y1=P; x2,y2=Q\n if x1==x2:\n if (y1+y2)%p==0: return None\n l=(3*x1*x1+A4)*pow(2*y1,-1,p)%p\n else: l=(y2-y1)*pow(x2-x1,-1,p)%p\n x3=(l*l-x1-x2)%p; return (x3,(-y1+l*(x1-x3))%p)\ndef mul(n,P):\n R=None\n for _ in range(n): R=add(R,P)\n return R\nsq={}\nfor y in range(p): sq.setdefault(y*y%p,[]).append(y)\nE=[None]+[(x,y) for x in range(p) for y in sq.get((x**3+A4*x)%p,[])]\nprint(\"#E(F_577)=\",len(E))\ndef order(P):\n n=1;Q=P\n while Q is not None: Q=add(Q,P); n+=1\n return n\n# find basis of Z/24 x Z/24\npts24=[P for P in E[1:] if order(P)==24]\nG1=pts24[0]\nsub1=set(); Q=None\nfor i in range(24): sub1.add(Q); Q=add(Q,G1)\ndef span(gs):\n S={None}; fr=[None]\n while fr:\n nf=[]\n for s in fr:\n for g in gs:\n t=add(s,g)\n if t not in S: S.add(t); nf.append(t)\n fr=nf\n return S\nG2=next(P for P in pts24 if len(span([G1,P]))==576)\ncoord={}\nP1=None\nfor i in range(24):\n P2_=P1\n for j in range(24):\n coord[P2_]=(i,j); P2_=add(P2_,G2)\n P1=add(P1,G1)\nassert len(coord)==576\n# global generators: A=(-3,9), B=(6t-6t^2, 36-36t+12t^2), T0=(0,0), T1=(6,0)\ndef ev(cs,th): return sum(ci*pow(th,k,p) for k,ci in enumerate(cs))%p\ngens=[]\nfor name,(xs,ys) in ((\"A\",([-3],[9])),(\"B\",([0,6,-6],[36,-36,12])),(\"T0\",([0],[0])),(\"T1\",([6],[0]))):\n gens.append(tuple(coord[(ev(xs,th),ev(ys,th))] for th in roots))\ndef addv(u,w): return tuple(((u[k][0]+w[k][0])%24,(u[k][1]+w[k][1])%24) for k in range(3))\nzero=((0,0),)*3\nH={zero}; fr=[zero]\nwhile fr:\n nf=[]\n for s in fr:\n for g in gens:\n t=addv(s,g)\n if t not in H: H.add(t); nf.append(t)\n fr=nf\nprint(\"|H| =\",len(H))\n# 3-saturation: [8]A,[8]B in product 3-torsion\ndef smul(k,u): return tuple(((k*x)%24,(k*y)%24) for x,y in u)\nprint(\"[8]A coords:\",smul(8,gens[0]),\"[8]B:\",smul(8,gens[1]))\n# map C0 points\nsurv=[]\nfor (aa,bb,cc) in pts:\n Nb=Nf(aa,bb,cc)%p; Z0=Z0f(aa,bb,cc)%p; Y0=Y0f(aa,bb,cc)%p\n img=[]\n for th in roots:\n be=(aa+bb*th+cc*th*th)%p\n if be==0: img.append(None); continue\n h=Nb*pow(be,-1,p)%p\n X=12*h*h*be*be%p; Y=36*((th*Y0-Z0)%p)*h%p; W=pow(be,6,p)\n U=X*pow(W,-1,p)%p; V=Y*pow(W,-1,p)%p\n assert (V*V-(U**3+A4*U))%p==0\n img.append((U,V))\n v=tuple(coord[P] for P in img)\n if v in H: surv.append((aa,bb,cc))\nprint(\"surviving points:\",surv)\n" }, { "path": "anc/code/1.2.1/1.2.1b_smooth577.py", "size_bytes": 1001, "sha256": "f4747314d5b09473554f96f441399e8703a2fcccb33d181a1ade588ee9778899", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.1b (added for the bundle; adapted from the original smooth127.py helper; self-contained).\n# C_0: theta^2-coefficient of (a+b*theta+c*theta^2)^4 = 0, theta^3 = 3.\n# (1) smoothness of C_0 mod 577: Groebner basis of (f, df/da, df/db, df/dc) in each affine chart is [1];\n# (2) the dependent-coordinate derivative df/dc at the two centres (1:0:0), (0:1:0) (values 4, 12).\nfrom sympy import symbols, groebner, diff, Poly, rem, expand\na, b, c, T = symbols('a b c T')\nf = expand(rem(Poly(expand((a + b*T + c*T**2)**4), T), Poly(T**3 - 3, T)).as_expr()).coeff(T, 2)\nprint('f =', f)\nres = []\nfor var in (a, b, c):\n eqs = [g.subs(var, 1) for g in (f, diff(f, a), diff(f, b), diff(f, c))]\n others = [v for v in (a, b, c) if v != var]\n res.append(list(groebner(eqs, *others, modulus=577, order='grevlex').exprs))\nprint('C0 Groebner bases mod 577 in charts a=1,b=1,c=1:', res)\nfc = diff(f, c)\nprint('df/dc at (1,0,0):', fc.subs({a: 1, b: 0, c: 0}), ' at (0,1,0):', fc.subs({a: 0, b: 1, c: 0}))\n" }, { "path": "anc/code/1.2.1/1.2.1c_mod8_forms.gp", "size_bytes": 1059, "sha256": "23611b473f2c6ed25dbace25c86ffa07c100810aac66e4151706ff483a1212e9", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1c -- the j=1 form mod 2 and (b even) mod 8; the last lines print data used in 1.2.1f\n\\\\ (theta and eps 2-adically, the two real values of W^2). Writers' helper chk1.gp.\n\\\\ Run from this folder: gp -q 1.2.1c_mod8_forms.gp\nth=Mod(x,x^3-3); eps=4+3*th+2*th^2;\nc1=polcoef(lift(eps*(a+b*x+c*x^2)^4),2,x);\nprint(\"j=1 coeff mod 2: \", Mod(1,2)*c1);\nprint(\"j=1 coeff with b=2b1 mod 8: \", Mod(1,8)*subst(c1,b,2*b1));\ncm=polcoef(lift((th^2-2)*(a+b*x+c*x^2)^4),2,x);\nprint(\"j=-1 coeff mod 2: \", Mod(1,2)*cm);\nprint(\"N(3th+th^2)=\",norm(3*th+th^2), \" N(th^2)=\",norm(th^2));\n\\\\ minkowski for K\nprint(\"Mink K: \", 4/Pi*6/27*sqrt(243));\n\\\\ epsilon residue at prime above 5 (theta=2)\nprint(\"eps mod 5 at th=2: \", (4+3*2+2*4)%5, \" issquare mod 5: \", issquare(Mod(18,5)));\n\\\\ F=K(kappa): theta mod 8 at linear dyadic place; eps mod 8\nr=polrootspadic(x^3-3,2,10); print(\"2-adic root theta: \", r, \" eps: \", 4+3*r[1]+2*r[1]^2);\n\\\\ W^2 real conjugates\ntr=3^(1/3); e=4+3*tr+2*tr^2; print(\"W^2 at kappa=+-sqrt(eps): \", 6+2*tr+2*tr*sqrt(e), \" \", 6+2*tr-2*tr*sqrt(e));\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1c_odd_algebra.gp", "size_bytes": 2411, "sha256": "b34b2a7d4c45276f95b716ceb6e96571e0b439cfe0a096418a9c0cedf441031d", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1c -- algebra of the odd cases (identities, f, mod-16 count). Reviewer P2 script c5a.gp (one line fixed, see README).\n\\\\ Run from this folder: gp -q 1.2.1c_odd_algebra.gp\n\\\\ Chapter 5, Appendix 5.A algebra\nPm(m,n) = -720*m^6+1944*m^5*n-1620*m^4*n^2-60*m^3*n^3+810*m^2*n^4-432*m*n^5+73*n^6;\nYm(m,n) = 84*m^4-216*m^3*n+216*m^2*n^2-100*m*n^3+18*n^4;\nZm(m,n) = -108*m^4+312*m^3*n-324*m^2*n^2+144*m*n^3-23*n^4;\nprint(\"Z^3+3Y^3 - P^2 = \", Zm(m,n)^3+3*Ym(m,n)^3 - Pm(m,n)^2);\nprint(\"P(2,7)=\",Pm(2,7),\" =895^2? \",Pm(2,7)==895^2,\" Y(2,7)=\",Ym(2,7),\" Z(2,7)=\",Zm(2,7));\nprint(\"check original: \", 895^4+3*(-6202)^3+4199^3);\nth = Mod(t, t^3-3);\nhA = 2*n*(3*m-2*n); hB = 2*m*(3*m-2*n); hC = 2*m^2-n^2;\nw = (th^2-2)*(-hA-hB*th-hC*th^2)^2;\nprint(\"(th^2-2)(...)^2 == Z+th*Y: \", lift(w) == Zm(m,n)+t*Ym(m,n));\n\\\\ conic: coefficient of th^2 in (th^2-2)(A+B th+C th^2)^2\ncc = polcoef(lift((th^2-2)*(A+B*th+C*th^2)^2), 2, t);\nprint(\"theta^2 coefficient: \", cc, \" vs A^2-4AC-2B^2+6BC: \", cc - (A^2-4*A*C-2*B^2+6*B*C));\nprint(\"conic at (hA,hB,hC): \", subst(subst(subst(A^2-4*A*C-2*B^2+6*B*C,A,hA),B,hB),C,hC));\n\\\\ [bundle fix] the original line used norm() on a t_POLMOD with free variables m,n, which PARI rejects;\n\\\\ the same norm is computed as a resultant (as in 1.2.1c_odd_norms.gp):\nprint(\"norm(hA+hB th+hC th^2) + P = \", polresultant(t^3-3, hA+hB*t+hC*t^2, t) + Pm(m,n));\nU = -720*m^3+1756*m^2*n-1332*m*n^2+303*n^3; V = -560*m^3+1188*m^2*n-876*m*n^2+237*n^3;\nprint(\"U*Y+V*Z - 3n^7 = \", U*Ym(m,n)+V*Zm(m,n)-3*n^7);\nf(q) = 16*q^6+72*q^5+180*q^4+300*q^3+270*q^2+108*q+9;\nprint(\"P(k+2l,2k+3l) vs l^6 f(k/l): \", Pm(k+2*l,2*k+3*l) - l^6*f(k/l));\nprint(\"q(m,n) inverse: m/n=2/7 -> q = \", (2*7-3*2)/(2*2-7), \" f(-8/3)=\", f(-8/3), \" issquare \", issquare(f(-8/3)), \" f(0)=\", f(0));\nprint(\"f irreducible: \", polisirreducible(f(x)), \" disc f: \", factor(poldisc(f(x))));\n\\\\ odd case j=1: eps*beta^4 theta^2-coefficient\neps = 4+3*th+2*th^2;\nc1 = polcoef(lift(eps*(a+b*th+c*th^2)^4),2,t);\ncnt=0; for(a0=0,15,for(b0=0,15,for(c0=0,15, if(a0%2==0&&b0%2==0&&c0%2==0,next); if(subst(subst(subst(c1,a,a0),b,b0),c,c0)%16==0, cnt++))));\nprint(\"j=1: primitive (a,b,c) mod 16 with coefficient = 0 mod 16: \", cnt);\nc0p = polcoef(lift((a+b*th+c*th^2)^4),2,t); c2p = polcoef(lift(eps^2*(a+b*th+c*th^2)^4),2,t); cm1 = polcoef(lift(eps^-1*(a+b*th+c*th^2)^4),2,t);\nprint(\"eps^-1 = th^2-2: \", eps^-1 == th^2-2, \" norm eps \", norm(eps));\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1c_odd_norms.gp", "size_bytes": 1105, "sha256": "1b1f0fa72036dc0e48fdadc9d0ff9e96fa111a2ec8ba965101b297c3250096e2", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1c -- N(h)=-P and the classification of the normalised norm mod 8; j=1 mod 8. Reviewer P2 script c5a2.gp.\n\\\\ Run from this folder: gp -q 1.2.1c_odd_norms.gp\nPm(m,n) = -720*m^6+1944*m^5*n-1620*m^4*n^2-60*m^3*n^3+810*m^2*n^4-432*m*n^5+73*n^6;\nhA(m,n) = 2*n*(3*m-2*n);\nhB(m,n) = 2*m*(3*m-2*n);\nhC(m,n) = 2*m^2-n^2;\nnrm(a,b,c) = polresultant(x^3-3, a+b*x+c*x^2);\nprint(\"N(h)+P = \", nrm(hA(m,n),hB(m,n),hC(m,n)) + Pm(m,n));\n\\\\ classify (m,n) coprime: gcd of forms and normalized norm mod 8\nS = Map();\n{for(m=-40,40, for(n=1,40, if(gcd(m,n)!=1, next);\n gg = gcd([hA(m,n),hB(m,n),hC(m,n)]); Nn = nrm(hA(m,n),hB(m,n),hC(m,n))/gg^3;\n key = [n%2, m%2, gg, Nn%8, (-Nn)%8];\n mapput(S, key, 1)))};\nprint(\"observed [n mod2, m mod2, gcd, N(h/g) mod 8, -N(h/g) mod 8]: \", Mat(S)[,1]);\n\\\\ j=1 mod 8 check (paper says mod 8 suffices)\nth = Mod(x, x^3-3); eps = 4+3*th+2*th^2;\nc1 = polcoef(lift(eps*(a+b*x+c*x^2)^4),2,x);\ncnt=0; for(a0=0,7,for(b0=0,7,for(c0=0,7, if(a0%2==0&&b0%2==0&&c0%2==0,next); if(subst(subst(subst(c1,a,a0),b,b0),c,c0)%8==0, cnt++))));\nprint(\"j=1 primitive solutions mod 8: \", cnt);\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1d_sextic_L.gp", "size_bytes": 2965, "sha256": "9ccb9b97e7c8018008de427fb55b2588177b2dc2c6ee99957f6677aa9757c87d", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1d -- sextic field L, primes over 2, unit square classes, 2-adic comparison. Reviewer P2 script c5b.gp\n\\\\ (variable-priority fix, see README). Run from this folder: gp -q 1.2.1d_sextic_L.gp\n\\\\ [bundle fix] the field variable is x, so the square-root polynomials below use a variable Xh of\n\\\\ higher priority than x (the original used 'X, which PARI 2.15 rejects in nfroots).\nXh = varhigher(\"X\");\nhp = x^6-9*x^4+27*x^2-3;\nprint(\"h irreducible \", polisirreducible(hp));\nB = bnfinit(hp,1); nf=B.nf;\nprint(\"L: disc \", factor(nf.disc), \" sign \", nf.sign, \" h \", B.no, \" certify \", bnfcertify(B));\nxi = Mod(x,hp); th = (3-xi^2)/2;\nprint(\"theta^3=3: \", th^3==3);\ndl = (3-3*th+th^2)*(1+xi)/2;\nr = (-3+th-th^2+(3+3*th+th^2)*xi)/4;\npi1 = -1+th-th^2+2*th*xi+dl; pi0 = th-1;\nf(q) = 16*q^6+72*q^5+180*q^4+300*q^3+270*q^2+108*q+9;\nprint(\"f(r)=\", f(r));\nRp(T) = (T^5-T^4-12*T^3+4*T^2+39*T-15)/16;\nPp(T) = (T^5-T^4-8*T^3+8*T^2+27*T-11)/8;\nprint(\"R(xi)==r \", Rp(xi)==r, \" Pi(xi)==pi1 \", Pp(xi)==pi1);\nprint(\"integral basis of nfinit: \", nf.zk);\nprint(\"norms pi0, pi1, delta integral? \", [norm(pi0), norm(pi1)], \" \", nfalgtobasis(nf,lift(dl)));\nP2 = idealprimedec(nf,2); print(\"primes over 2: \", [[pr.e,pr.f] | pr<-P2]);\nprint(\"val pi0: \", [idealval(nf,lift(pi0),pr)|pr<-P2], \" val pi1: \", [idealval(nf,lift(pi1),pr)|pr<-P2]);\nu1=th^2-2; u2=-1+th*xi+dl; u3=th-1-xi;\nprint(\"unit norms: \", [norm(u1),norm(u2),norm(u3)]);\n\\\\ independence of -1,u1,u2,u3 mod squares (all 15 nontrivial products non-square)\nU=[-1,u1,u2,u3]; ok=1; for(m=1,15, z=prod(i=1,4, if(bittest(m,i-1),U[i],1)); if(#nfroots(nf, Xh^2 - lift(z))>0, ok=0; print(\"dependent: \",m))); print(\"units independent mod squares: \", ok);\nprint(\"3/xi^6 == (th^2-2)(52+36th+25th^2)^2: \", 3/xi^6 == (th^2-2)*(52+36*th+25*th^2)^2);\nw2 = 2/(pi0*pi1^2); print(\"2/(pi0 pi1^2) is unit: \", abs(norm(w2))==1 && nfalgtobasis(nf,lift(w2))==round(nfalgtobasis(nf,lift(w2))));\n\\\\ express w2 in terms of -1,u1,u2,u3 mod squares\nfor(m=0,15, z=w2*prod(i=1,4, if(bittest(m,i-1),U[i],1)); if(#nfroots(nf,Xh^2-lift(z))>0, print(\"2/(pi0 pi1^2) ~ unit mask \", m)));\n\\\\ valuations of q-r and 4/(q-r) at primes over 2\nfor(q0=0,2, if(q0==1,next); print(\"q=\",q0,\" v(q-r) at P2: \", [idealval(nf,lift(q0-r),pr)|pr<-P2], \" v(4/(q-r)): \", [idealval(nf,lift(4/(q0-r)),pr)|pr<-P2], \" v(2): \", [idealval(nf,2,pr)|pr<-P2]));\n\\\\ local comparison\nislsq(z) = prod(k=1,#P2, nfislocalpower(nf, P2[k], lift(z), 2));\nG = vector(8, m, u2^bittest(m-1,0)*u3^bittest(m-1,1)*pi1^bittest(m-1,2));\n{for(q0=0,2, if(q0==1,next); for(gi=1,8, for(ci=1,8, cc=[1,-1,2,-2,5,-5,10,-10][ci];\n if(islsq((q0-r)*G[gi]*cc), print(\"q in \",q0,\"+4Z2: matches global candidate [u2,u3,pi1] bits \", [bittest(gi-1,0),bittest(gi-1,1),bittest(gi-1,2)], \" with scalar \", cc)))));}\n\\\\ local points q=0,2,-1/2 on v^2=f(q) over Q2\nprint(\"f(0),f(2),f(-1/2): \", [f(0), f(2), f(-1/2)], \" 2-adic squares: \", [issquare(f(0)+O(2^20)), issquare(f(2)+O(2^20)), issquare(f(-1/2)+O(2^20))]);\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1d_units_L.gp", "size_bytes": 575, "sha256": "fca98f247b0ed812601a441ca1c029ad4bae8e6162a90a591bc0a59ffee46cf9", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1d -- -1, th^2-2, u2, u3 independent mod squares; unit rank of L. Reviewer P2 script c5b2.gp.\n\\\\ Run from this folder: gp -q 1.2.1d_units_L.gp\nhp = y^6-9*y^4+27*y^2-3; nf = nfinit(hp);\nxi = Mod(y,hp); th = (3-xi^2)/2; dl = (3-3*th+th^2)*(1+xi)/2;\nu1=th^2-2; u2=-1+th*xi+dl; u3=th-1-xi; U=[-1,u1,u2,u3];\nok=1; for(m=1,15, z=prod(i=1,4, if(bittest(m,i-1),U[i],1)); if(#nfroots(nf, x^2 - lift(z))>0, ok=0; print(\"dependent: \",m))); print(\"units -1,th^2-2,u2,u3 independent mod squares: \", ok);\nB=bnfinit(hp,1); print(\"unit rank \", #B.fu, \" torsion \", B.tu[1]);\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1e_field_M_identities.gp", "size_bytes": 2620, "sha256": "e4f8f0a0e6ccad41995f4203a8f216106ffc53a3f086c7eba101067cc8f919bb", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1e -- disc M, signature, covering identities, Weierstrass and differential identities. Reviewer P2 script c5m1.gp.\n\\\\ Run from this folder: gp -q 1.2.1e_field_M_identities.gp\n\\r M_def.gp\nprint(\"R0^2 == 9+6th+4th^2: \", R0^2 == 9+6*TH+4*TH^2, \" R0^2 == th^2*eps: \", R0^2 == TH^2*(4+3*TH+2*TH^2));\nprint(\"nfdisc(M) = \", factor(nfM.disc), \" sign \", nfM.sign, \" index \", factor(nfM.index));\nprint(\"relative quartic for d: \", dd^4+(8*TH^2-12*TH)*dd^2+24*dd-36*TH^2-48*TH-72);\nprint(\"N_M(d) = \", norm(dd));\nE = ellinit([0,lift(2*dd),0,lift(2*dd^2),0], nfM);\nprint(\"c4 + 32 d^2 = \", Mod(E.c4,pM) + 32*dd^2, \" disc + 256 d^6 = \", Mod(E.disc,pM)+256*dd^6, \" j = \", E.j);\n\\\\ check that 1,th,th^2,d,..,th^2 d^3 is a basis of M (determinant)\nBm = matrix(12,12,i,j, my(k=(j-1)\\3, jj=(j-1)%3); polcoef(lift(TH^jj*dd^k), i-1));\nprint(\"det of D-basis matrix: \", matdet(Bm));\n\\\\ polynomial identity (5.9)\nxi1 = 'T; print(\"(5.9): \", (T^2-3+2*TH)*(T^2-W*T+R0)*(T^2+W*T+R0) - (T^6-9*T^4+27*T^2-3));\n\\\\ tower: r1+r2, r1 r2, D*\nRp(T) = (T^5-T^4-12*T^3+4*T^2+39*T-15)/16;\nPp(T) = (T^5-T^4-8*T^3+8*T^2+27*T-11)/8;\nquadpart(F) = {my(rem = F % (T^2 - W*T + R0)); [polcoef(rem,1,T), polcoef(rem,0,T)]};\nab = quadpart(Rp(T)); s1 = ab[1]*W + 2*ab[2]; p1 = ab[1]^2*R0 + ab[1]*ab[2]*W + ab[2]^2;\ncd = quadpart(Pp(T)); Dst = cd[1]^2*R0 + cd[1]*cd[2]*W + cd[2]^2;\nprint(\"r1 r2 - th^2 D*/4 = \", p1 - TH^2*Dst/4);\nfq = 16*q^6+72*q^5+180*q^4+300*q^3+270*q^2+108*q+9;\nden = q^2 - s1*q + p1;\ndv = divrem(fq, den); print(\"f divisible by (q-r1)(q-r2): \", dv[2]==0);\nQq = Dst*dv[1];\nprint(\"Q(0) - (2th^2)^2 = \", subst(Qq,q,0) - (2*TH^2)^2, \" deg Q = \", poldegree(Qq,q));\n\\\\ map (5.13)-(5.14)\na4 = polcoef(Qq,4,q); b3 = polcoef(Qq,3,q); c0 = polcoef(Qq,2,q); d1 = polcoef(Qq,1,q); e = 2*TH^2;\nX0 = (2*e*(V+e)+d1*q)/q^2;\nY0 = ((X0^2-4*e^2*a4)*q - (d1*X0+2*e^2*b3))/(2*e);\ncubic = X0^3 + c0*X0^2 + (b3*d1-4*a4*e^2)*X0 + b3^2*e^2 + a4*d1^2 - 4*a4*c0*e^2;\n\\\\ reduce Y0^2 - cubic modulo V^2 - Q(q): numerator polynomial in V\nnum = numerator(Y0^2 - cubic);\nredV(F) = {my(G = Pol(F, V), r=0); for(k=0,poldegree(G,V), r += polcoef(G,k,V)*if(k%2, V*Qq^((k-1)/2), Qq^(k/2))); r};\nprint(\"Weierstrass identity holds: \", redV(num) == 0);\ns0 = 12*TH; h0 = (2*dd*s0 - c0)/3;\nxE = (X0 - h0)/s0; yE = Y0/(s0*e);\nnum2 = numerator(yE^2 - (xE^3 + 2*dd*xE^2 + 2*dd^2*xE));\nprint(\"E identity holds: \", redV(num2) == 0);\n\\\\ differential: d xE/(2 yE) = -th^2 dq / V <=> dxE/dq * V = -2 th^2 yE (with dV/dq = Q'/(2V))\ndxE = deriv(xE,q) + deriv(xE,V)*deriv(Qq,q)/(2*V);\nnum3 = numerator(dxE*V + 2*TH^2*yE);\nprint(\"differential identity holds: \", redV(num3) == 0);\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1e_points_M.gp", "size_bytes": 2259, "sha256": "7d2f233b4fa2f2be68d8ee165f5dec1164b6d80cc8707ff8d7523f038f854140", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1e -- the points on E, E', the dual isogeny, the images of q = 0 and q = -8/3. Reviewer P2 script c5m2.gp.\n\\\\ Run from this folder: gp -q 1.2.1e_points_M.gp\n\\r M_def.gp\n\\r M_points.gp\nonE(P) = P[2]^2 == P[1]^3 + 2*dd*P[1]^2 + 2*dd^2*P[1];\nonEp(P) = P[2]^2 == P[1]^3 - 4*dd*P[1]^2 - 4*dd^2*P[1];\nR=mk(xR,yR); S=mk(xS,yS); U=mk(xU,yU); Vp=mk(xV,yV); P=mk(xP,yP); Q=mk(xQ,yQ); P1=mk(xP1,yP1); Q0=mk(xQ0,yQ0); Dp=mk(xDp,yDp);\nprint(\"on E: R \",onE(R),\" S \",onE(S),\" U \",onE(U),\" V \",onE(Vp),\" P \",onE(P),\" Q \",onE(Q),\" P1 \",onE(P1));\nprint(\"on E': Q0 \",onEp(Q0),\" D' \",onEp(Dp));\ndual(Pt) = {my(x0=Pt[1], y0=Pt[2]); [(x0 - 4*dd - 4*dd^2/x0)/4, y0*(1+4*dd^2/x0^2)/8]};\nprint(\"dual(Q0)==P \", dual(Q0)==P, \" dual(D')==Q \", dual(Dp)==Q);\nprint(\"dual(Q0) on E: \", onE(dual(Q0)));\n\\\\ q=0 branches and q=-8/3\nRp(T) = (T^5-T^4-12*T^3+4*T^2+39*T-15)/16;\nPp(T) = (T^5-T^4-8*T^3+8*T^2+27*T-11)/8;\nquadpart(F) = {my(rem = F % (T^2 - W*T + R0)); [polcoef(rem,1,T), polcoef(rem,0,T)]};\nab = quadpart(Rp(T)); s1 = ab[1]*W + 2*ab[2]; p1 = ab[1]^2*R0 + ab[1]*ab[2]*W + ab[2]^2;\ncd = quadpart(Pp(T)); Dst = cd[1]^2*R0 + cd[1]*cd[2]*W + cd[2]^2;\nfq = 16*q^6+72*q^5+180*q^4+300*q^3+270*q^2+108*q+9;\nQq = Dst*divrem(fq, q^2 - s1*q + p1)[1];\na4 = polcoef(Qq,4,q); b3 = polcoef(Qq,3,q); c0 = polcoef(Qq,2,q); d1 = polcoef(Qq,1,q); e = 2*TH^2;\ns0 = 12*TH; h0 = (2*dd*s0 - c0)/3;\nmapE(q0, V0) = {my(X0 = (2*e*(V0+e)+d1*q0)/q0^2, Y0 = ((X0^2-4*e^2*a4)*q0 - (d1*X0+2*e^2*b3))/(2*e)); [(X0-h0)/s0, Y0/(s0*e)]};\n\\\\ q -> 0 along V = -e branch: use series\nqs = varhigher(\"qs\");\n{Vser = -e*sqrt(subst(Qq, q, qs)/e^2 + O(qs^6));\n img = mapE(qs, Vser);\n print(\"q->0, V->-e limit == P: \", [polcoef(img[1],0,qs)==P[1], polcoef(img[2],0,qs)==P[2]], \" valuations \", [valuation(img[1],qs), valuation(img[2],qs)]);}\n\\\\ q = -8/3\nQv = subst(Qq, q, -8/3);\nrts = nfroots(nfM, x^2 - lift(Qv)); print(\"Q(-8/3) square in M: \", #rts);\n{for(i=1,#rts, img = mapE(-8/3, Mod(rts[i],pM)); print(\" image on E: \", onE(img), \" ==P1: \", img==P1, \" ==P-P1: \", img==ellsub(ellinit([0,lift(2*dd),0,lift(2*dd^2),0],nfM), lift(P), lift(P1))*Mod(1,pM)));}\nV1 = ((12*TH*P1[1] + h0)*(-8/3)^2 - d1*(-8/3))/(2*e) - e;\nprint(\"V1 formula image == P1: \", mapE(-8/3, V1) == P1, \" V1^2 == Q(-8/3): \", V1^2 == Qv);\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1f_classgroup_M.gp", "size_bytes": 334, "sha256": "a54836e59bfb7d203c92b0cbebb31fa2ec94ad61146e64d467288478f2293480", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1f -- h(M) = 1, unconditionally (bnfcertify). Reviewer P2 script c5cert.gp.\n\\\\ Run from this folder: gp -q 1.2.1f_classgroup_M.gp\npM = y^12 - 36*y^10 + 432*y^8 - 2352*y^6 + 5184*y^4 - 15552;\nB = bnfinit(pM,1); print(\"h=\",B.no);\nt0=getwalltime(); print(\"bnfcertify(M) = \", bnfcertify(B), \" time \", getwalltime()-t0);\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1g_independence.gp", "size_bytes": 878, "sha256": "1800f78a81601caff400808fa825f8f1d50fdefa2bf4117f83b4c067b8ec68b7", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1g -- independence of the Kummer classes of T,R,S,U,V and T',Q0,D'; torsion of E(M). Reviewer P2 script c5ind.gp.\n\\\\ Run from this folder: gp -q 1.2.1g_independence.gp\n\\r M_def.gp\n\\r M_points.gp\nnf = nfinit(pM);\nissq(z) = #nfroots(nf, x^2 - lift(z)) > 0;\nR=mk(xR,yR); S=mk(xS,yS); U=mk(xU,yU); Vp=mk(xV,yV); Q0=mk(xQ0,yQ0); Dp=mk(xDp,yDp);\ncl = [2*dd^2, R[1], S[1], U[1], Vp[1]];\nbad=0; for(m=1,31, z=prod(i=1,5, if(bittest(m,i-1), cl[i], 1)); if(issq(z), bad++; print(\"alpha_E dependent \", m))); print(\"alpha_E classes of T,R,S,U,V independent: \", bad==0);\nclp = [-4*dd^2, Q0[1], Dp[1]];\nbad=0; for(m=1,7, z=prod(i=1,3, if(bittest(m,i-1), clp[i], 1)); if(issq(z), bad++; print(\"alpha_E' dependent \", m))); print(\"alpha_E' classes of T',Q0,D' independent: \", bad==0);\nE = ellinit([0,lift(2*dd),0,lift(2*dd^2),0], nf);\nprint(\"torsion E(M): \", elltors(E)[1..2]);\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1g_selmer_M.gp", "size_bytes": 3443, "sha256": "083d56be3b38a1679f0180dd155a22e95b6df25b4da81d0379616c5f4494c7e7", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.1g -- 2-isogeny Selmer groups of E, E' over M (local images by random local points and Hilbert symbols,\n\\\\ fixed seed). Reviewer P2 script c5sel.gp plus added last lines (cumulative counts).\n\\\\ Run from this folder: gp -q 1.2.1g_selmer_M.gp (about 1 minute)\n\\r M_def.gp\nsetrand(2024);\nBM = bnfinit(pM, 1); nf = BM.nf;\nP2 = idealprimedec(nf,2); P3 = idealprimedec(nf,3);\nSp = concat(P2, P3);\nSU = bnfsunit(BM, Sp);\ngens = concat(concat([nfalgtobasis(nf, BM.tu[2])], apply(u->nfalgtobasis(nf,u), BM.fu)), apply(u->nfalgtobasis(nf,u), SU[1]));\nng = #gens;\ndd2 = nfalgtobasis(nf, lift(dd));\naE = nfeltmul(nf, 2, dd2); bE = nfeltmul(nf, 2, nfeltpow(nf, dd2, 2));\naEp = nfeltmul(nf, -4, dd2); bEp = nfeltmul(nf, -4, nfeltpow(nf, dd2, 2));\nrndel(B) = vector(12, i, random(2*B+1)-B)~;\nlocbasis(pr, dimv) = {my(Z = List(), n, G, idx);\n for(i=1,ng, listput(Z, gens[i])); for(k=1,12, listput(Z, rndel(3)));\n Z = Vec(Z); n=#Z;\n G = matrix(n,n,i,j, (1 - nfhilbert(nf, Z[i], Z[j], pr))/2);\n if(matrank(Mod(G,2)) != dimv, error(\"rank mismatch\"));\n idx = matindexrank(Mod(G,2))[1];\n vector(#idx, k, Z[idx[k]]);\n}\nkey(z, pr, B) = vector(#B, k, (1 - nfhilbert(nf, z, B[k], pr))/2);\nislsq(z, pr) = {my(D = denominator(content(z))); nfislocalpower(nf, pr, z*D^2, 2)};\nlocimg(a, b, pr, B, ntries, target) = {my(V = List([key(b, pr, B)]), x, f, cnt=0, sp, r=1, k);\n for(t=1, ntries,\n x = rndel(1 + random(4)); if(x == 0, next);\n k = random(13) - 5; x = nfeltmul(nf, x, nfeltpow(nf, pr.gen[2], k));\n f = nfeltmul(nf, x, nfeltadd(nf, nfeltadd(nf, nfeltpow(nf,x,2), nfeltmul(nf,a,x)), b));\n if(f == 0, next);\n if(islsq(f, pr), listput(V, key(x, pr, B)); cnt++;\n r = matrank(Mod(matconcat(Vec(V)~),2)); if(r >= target, break)));\n [matimage(Mod(matconcat(Vec(V)~),2)~), cnt];\n}\nres = vector(#Sp);\n{for(j=1,#Sp, my(pr = Sp[j], nv = pr.e*pr.f, dimv = if(pr.p==2, 2+nv, 2), B = locbasis(pr, dimv), IE, IEp, dE, dEp);\n \\\\ sample until the two dims add up to the exact total (nv+2 at 2, 2 at 3)\n IE = locimg(aE, bE, pr, B, 6000, if(pr.p==2, nv, 1)); IEp = locimg(aEp, bEp, pr, B, 6000, if(pr.p==2, nv, 1));\n dE = matrank(IE[1]); dEp = matrank(IEp[1]);\n print(\"p=\", pr.p, \" e,f=\", [pr.e,pr.f], \" dim loc grp \", dimv, \" dim alpha_v(E) \", dE, \" (\", IE[2], \" pts) dim alpha_v(E') \", dEp, \" (\", IEp[2], \" pts) sum \", dE+dEp, \" required \", if(pr.p==2, nv+2, 2));\n my(GK = Mod(matconcat(vector(ng, i, key(gens[i], pr, B)~)), 2));\n res[j] = [GK, IE[1], IEp[1]]);}\nr1 = nf.sign[1];\nsgnrow(z) = vector(r1, k, if(real(nfeltembed(nf, z)[k]) < 0, 1, 0));\nSG = Mod(matconcat(vector(ng, i, sgnrow(gens[i])~)), 2);\n{selmer(which) = my(rows = List(), Q, Fn, A);\n for(k=1,#res, Q = matker(res[k][1+which]~); Fn = Q~ * res[k][1]; for(i=1,matsize(Fn)[1], listput(rows, Fn[i,])));\n if(which==1, for(i=1,r1, listput(rows, SG[i,])));\n A = matconcat(Vec(rows)~);\n ng - matrank(A);}\nsE = selmer(1); sEp = selmer(2);\nprint(\"dim Sel(alpha_E) = \", sE, \" dim Sel(alpha_E') = \", sEp, \" => rank <= \", sE + sEp - 2);\n\n{cum(which) = my(rows = List(), Q, Fn, A, out=List());\n for(k=1,#res, Q = matker(res[k][1+which]~); Fn = Q~ * res[k][1]; for(i=1,matsize(Fn)[1], listput(rows, Fn[i,]));\n A = matconcat(Vec(rows)~); listput(out, 2^(ng - matrank(A))));\n if(which==1, for(i=1,r1, listput(rows, SG[i,])); A = matconcat(Vec(rows)~); listput(out, 2^(ng - matrank(A))));\n Vec(out);}\nprint(\"cumulative counts E: \", cum(1), \" E': \", cum(2));\nquit\n" }, { "path": "anc/code/1.2.1/1.2.1h_sieve661.py", "size_bytes": 4045, "sha256": "86e2d8bbfd372438a1fe78a2ce657ec2d85ced73bc312243596aaa8ee6f35bf5", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.1h, step 2 -- group orders, index of H, l-ranks, sieve over all sign patterns. Reads c5_661.txt,\n# writes c5_surv.json. Reviewer P2 script c5sieve.py. Run from this folder: python3 -I 1.2.1h_sieve661.py\nimport ast, itertools, time, sys\nimport cypari2\npari=cypari2.Pari()\np=661\nlines=open('c5_661.txt').read().strip().split('\\n')\nembs=[]\nfor i in range(0,len(lines),2):\n a=lines[i]; b=lines[i+1]\n assert a.startswith('EMB ') and b.startswith('IMG ')\n rest=a[4:]\n k=rest.index('] ')+1\n hdr=ast.literal_eval(rest[:k]); pts=ast.literal_eval(rest[k+1:])\n imgs=ast.literal_eval(b[4:])\n embs.append(dict(th=hdr[0],d=hdr[1],V1=hdr[2],pts=pts,imgs=imgs))\nprint(\"embeddings:\",[(e['th'],e['d']) for e in embs])\ndef mkgroup(d):\n a2=2*d%p; a4=2*d*d%p\n def add(P,Q):\n if P is None: return Q\n if Q is None: return P\n x1,y1=P; x2,y2=Q\n if x1==x2:\n if (y1+y2)%p==0: return None\n l=(3*x1*x1+2*a2*x1+a4)*pow(2*y1,-1,p)%p\n else: l=(y2-y1)*pow(x2-x1,-1,p)%p\n x3=(l*l-a2-x1-x2)%p; return (x3,(-y1+l*(x1-x3))%p)\n sq={}\n for yv in range(p): sq.setdefault(yv*yv%p,[]).append(yv)\n pts=[None]+[(x,yv) for x in range(p) for yv in sq.get((x**3+a2*x*x+a4*x)%p,[])]\n N=len(pts)\n def order(P):\n n=1;Q=P\n while Q is not None: Q=add(Q,P); n+=1\n return n\n best=max(pts[1:],key=order); n1=order(best)\n mult=[None];Q=best\n for i in range(1,n1): mult.append(Q); Q=add(Q,best)\n sub=set(mult)\n n2=N//n1\n assert n2 in (1,2)\n coord={}\n if n2==1:\n for i,M in enumerate(mult): coord[M]=(i,0)\n else:\n T=[P for P in pts if P is not None and P[1]==0 and P not in sub][0]\n for i,M in enumerate(mult): coord[M]=(i,0); coord[add(M,T)]=(i,1)\n assert len(coord)==N\n return dict(N=N,n1=n1,n2=n2,coord=coord,add=add)\nt0=time.time()\nG=[mkgroup(e['d']) for e in embs]\nprint(\"orders:\",[g['N'] for g in G],\" structures:\",[(g['n1'],g['n2']) for g in G])\nmods=[]\nfor g in G: mods+= [g['n1'],g['n2']]\ndef vec(tup):\n v=[]\n for g,P in zip(G,tup): v+=list(g['coord'][P])\n return v\ngens=[vec([tuple(e['pts'][j]) if j!=6 else (0,0) for e in embs]) for j in range(7)] # R,S,U,V,P,Q,T\nn=len(mods)\ncols=[list(c) for c in gens]+[[mods[k] if r==k else 0 for r in range(n)] for k in range(n)]\nA=pari.matrix(n,len(cols),[cols[j][i] for i in range(n) for j in range(len(cols))])\nHm=pari.mathnf(A)\nHl=[[int(Hm[i,j]) for j in range(n)] for i in range(n)]\nprodord=1\nfor g in G: prodord*=g['N']\ndetH=1\nfor i in range(n): detH*=Hl[i][i]\nprint(\"index [prod:H] =\",detH, pari.factor(detH))\ndef inH(v):\n v=list(v)\n for i in range(n-1,-1,-1):\n piv=Hl[i][i]\n if v[i]%piv: return False\n c=v[i]//piv\n if c:\n for r in range(i+1): v[r]-=c*Hl[r][i]\n return True\nassert all(inH(g) for g in gens)\n# sieve\nnres=0; npat=0; surv=[]\nfor qi in range(p+1):\n fibers=[]\n ok=True\n for e in embs:\n f=e['imgs'][qi]\n if not f: ok=False; break\n fibers.append([(Vv, None if P==\"O\" else tuple(P)) for Vv,P in f])\n if not ok: continue\n nres+=1\n for combo in itertools.product(*fibers):\n npat+=1\n if inH(vec([c[1] for c in combo])):\n surv.append((qi if qi

element\nfromD(v) = sum(k=0,3, sum(j=0,2, v[3*k+j+1]*TH^j)*dd^k);\n" }, { "path": "anc/code/1.2.1/M_points.gp", "size_bytes": 1442, "sha256": "a3a90e1bdbcaeb305ca56f9741f9c97f9eab18dc402cbd8a918248b441634f42", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Shared input for 1.2.1e-i (a reviewer m_pts.gp): the points R,S,U,V (= G1..G4 of the section), P, Q, P1 on E\n\\\\ and Q0, D' on E', in the basis D of M_def.gp. Read with \\r M_points.gp after M_def.gp.\n\\\\ points of Appendix 5.F, in basis D, as [denominator, 12-vector]\nxR=[6,[-192,78,42,0,300,-210,0,5,-3,-17,6,4]]; yR=[204,[-16548,2328,6540,-18162,31488,-13206,-258,478,-160,-1432,133,597]];\nxS=[816,[738,-288,-114,-198,-990,864,156,15,7,72,-31,-19]]; yS=[1632,[-1662,360,-138,1242,1926,-1692,876,487,-81,-22,111,-23]];\nxU=[102,[360,-138,534,-1746,654,312,-57,-81,88,-42,-40,38]]; yU=[102,[24,528,600,-198,234,-972,-354,-1192,1214,-455,-14,219]];\nxV=[6,[174,6,-24,72,-198,114,3,-2,3,11,-2,-3]]; yV=[102,[9852,4584,480,8226,-7524,2874,288,182,196,418,101,-141]];\nxP=[12,[72,48,36,-12,0,0,0,-3,2,0,0,0]]; yP=[204,[-5190,-3816,-2352,-864,423,330,-24,220,-141,2,-24,16]];\nxQ=[612,[432,-492,1212,-4380,1968,660,-99,15,-10,-30,-82,66]]; yQ=[1224,[6600,2808,-648,7362,-7050,1844,60,-278,-30,267,9,-210]];\nxP1=[9792,[6498,-4740,13530,-52206,20490,12384,60,-261,531,-192,-875,657]]; yP1=[39168,[39330,88020,23634,137970,33582,-47276,18444,-3133,3579,-4954,4419,-1263]];\nxQ0=[3,[0,0,0,0,0,0,0,-3,2,0,0,0]]; yQ0=[51,[12,-144,96,-864,270,228,-24,424,-294,2,-24,16]];\nxDp=[153,[-1044,-936,1644,-6228,4356,156,-156,36,-24,-123,-105,121]]; yDp=[51,[2196,780,-180,2028,-2304,788,-6,-98,-14,94,-6,-64]];\nmk(xv,yv) = [fromD(xv[2])/xv[1], fromD(yv[2])/yv[1]];\n" }, { "path": "anc/code/1.2.3/1.2.3a_E6_congruences.py", "size_bytes": 1096, "sha256": "39ca6124a0341b13e2f7c4f48f702f6577576f09d6165a8ea0e4ad0ce50dd4b6", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.3a (added for the bundle) -- the elementary 2-isogeny certificate for E_6: Y^2 = X^3 + 6X quoted in the\n# section: the quartics below have no solution with (U, V) not both even, modulo 16, 16, 16, 32 respectively, and\n# #E_6(F_p) = 4, 8, 10 for p = 5, 7, 13. Pure Python. Run from this folder: python3 -I 1.2.3a_E6_congruences.py\ndef nosol(f, m):\n sq = {w * w % m for w in range(m)}\n vals = {f(U, V) % m for U in range(m) for V in range(m) if U % 2 or V % 2}\n return sorted(vals), not (vals & sq)\nfor name, f, m in ((\"W^2 = 2U^4 + 3V^4\", lambda U, V: 2*U**4 + 3*V**4, 16),\n (\"W^2 = -U^4 + 24V^4\", lambda U, V: -U**4 + 24*V**4, 16),\n (\"W^2 = -2U^4 + 12V^4\", lambda U, V: -2*U**4 + 12*V**4, 16),\n (\"W^2 = 2U^4 - 12V^4\", lambda U, V: 2*U**4 - 12*V**4, 32)):\n vals, ok = nosol(f, m)\n print(f\"{name}: values mod {m} for (U,V) not both even {vals}; none is a square mod {m}: {ok}\")\nfor p in (5, 7, 13):\n n = 1 + sum(1 for X in range(p) for Y in range(p) if (Y*Y - X**3 - 6*X) % p == 0)\n print(f\"#E6(F_{p}) = {n}\")\n" }, { "path": "anc/code/1.2.3/1.2.3a_descent_E6.gp", "size_bytes": 693, "sha256": "0f365fa05f330442944ae110f95f0731b8515021bb1357756a387f4c93219890", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.3a -- (1+sqrt2)^(+-1)(a+b sqrt2)^3, F = f(t,1) g(t,1) and disc F; rank and torsion of E_6: Y^2 = X^3 + 6X.\n\\\\ First part of reviewer script script basic.gp. Run from this folder: gp -q 1.2.3a_descent_E6.gp\nf(A,B)=A^3+6*A^2*B+6*A*B^2+4*B^3;\ng(A,B)=A^3+3*A^2*B+6*A*B^2+2*B^3;\nF=f(t,1)*g(t,1); print(\"F=\",F);\nprint(\"disc F=\",factor(poldisc(F)));\n\\\\ check unit decomposition j=1, j=-1\ns=quadgen(8); \\\\ sqrt2\ncub=(a+b*s)^3;\nprint(\"j=1:\", (1+s)*cub);\nprint(\"j=-1:\", (s-1)*cub);\nprint(f(a,b), \" \", g(a,b)); print(f(-a,b), \" \", -g(-a,b));\n\\\\ E6 rank\nE6=ellinit([0,0,0,6,0]); print(\"E6 ellrank:\",ellrank(E6)); print(\"tors:\",elltors(E6)); print(\"analytic rank:\",ellanalyticrank(E6));\nquit\n" }, { "path": "anc/code/1.2.3/1.2.3b_cubic_field_K.gp", "size_bytes": 1856, "sha256": "2274ad3aa47c653830a1781fc70cbe35a9c5dab1693ea13d4f05ed351d074fad", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.3b -- K = Q(h), h^3+3h-2 = 0: disc, class number (certified), units, primes over 2 and 3, r_f, r_g,\n\\\\ discriminants, resultant, 2 = h rho^2/e, (1-h+h^2)^2 = -3 pi e. Second part of reviewer script basic.gp (+ unit box line).\n\\\\ Run from this folder: gp -q 1.2.3b_cubic_field_K.gp\n\\\\ [bundle] f, g as in 1.2.3a_descent_E6.gp\nf(A,B)=A^3+6*A^2*B+6*A*B^2+4*B^3;\ng(A,B)=A^3+3*A^2*B+6*A*B^2+2*B^3;\n\\\\ cubic field\nK=bnfinit(h^3+3*h-2,1); print(\"disc:\",K.disc,\" sign:\",K.sign,\" clgp:\",K.clgp,\" fu:\",K.fu, \" tu:\",K.tu);\nprint(\"certify:\",bnfcertify(K));\nprint(\"index:\",K.index, \" zk:\",K.zk);\ne=Mod(1-h-h^2,h^3+3*h-2); print(\"N(e)=\",norm(e),\" 1/e=\",lift(1/e));\nprint(\"fu vs e:\", bnfisunit(K, lift(e)));\ndec2=idealprimedec(K,2); dec3=idealprimedec(K,3); print(dec2); print(dec3);\nfor(i=1,#dec2,print(\"2-prime \",i,\" e=\",dec2[i].e,\" f=\",dec2[i].f, \" isprinc h:\", idealval(K,h,dec2[i]), \" rho:\", idealval(K,h-1,dec2[i])));\nprint(\"3: val pi:\", idealval(K,-3-h-h^2,dec3[1]), \" N(pi)=\", norm(Mod(-3-h-h^2,h^3+3*h-2)), \" N(h)=\",norm(Mod(h,h^3+3*h-2)),\" N(rho)=\",norm(Mod(h-1,h^3+3*h-2)));\n\\\\ roots\nmod=h^3+3*h-2; rf=Mod(-4-h-h^2,mod); rg=Mod(h-1,mod);\nprint(\"f(rf)=\",f(rf,1),\" g(rg)=\",g(rg,1), \" rf==2/(h-1):\", rf==2/rg);\nprint(\"disc f:\",poldisc(f(t,1)),\" disc g:\",poldisc(g(t,1)),\" res:\",polresultant(f(t,1),g(t,1)));\nprint(\"nfdisc f:\",nfdisc(f(t,1)),\" nfdisc g:\", nfdisc(g(t,1)), \" iso:\", nfisisom(f(t,1),mod)!=0, nfisisom(g(t,1),mod)!=0);\n\\\\ identities 1.6\nprint(\"2 = h rho^2/e ? \", Mod(h,mod)*rg^2/e == 2);\nprint(\"(1-h+h^2)^2 = -3 pi e ? \", Mod(1-h+h^2,mod)^2 == -3*Mod(-3-h-h^2,mod)*e);\n\\\\ [added for the bundle] unit box of the section: a+b*h+c*h^2 with 0<=a<=18, 0<=b<=3, 0<=c<=5 and norm 1\nS=List(); for(a=0,18, for(b=0,3, for(c=0,5, if(norm(Mod(a+b*h+c*h^2,h^3+3*h-2))==1, listput(S,[a,b,c]))))); print(\"norm-1 elements a+bh+ch^2 in the box: \",S);\nquit\n" }, { "path": "anc/code/1.2.3/1.2.3c_two_cover_2adic.py", "size_bytes": 6082, "sha256": "abc108bdc4e32f2104f02f158499dc2ccea3ebc27b36c798bbe2557414dbbd64", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.3c -- 2-adic two-cover descent for C_sigma: w^2 = sigma F(t). Hilbert-symbol labels of (t - r_f, t - r_g)\n# on a ball partition of P^1(Q_2), compared with the 16 global candidate pairs per sign. Reviewer P1 script lem11.py.\n# Run from this folder: python3 -I 1.2.3c_two_cover_2adic.py\n# Independent check of Lemma 1.1 (2-adic two-cover descent for C_sigma: w^2 = sigma*F(t)).\nimport cypari2, itertools, sys\npari = cypari2.Pari(); pari.allocatemem(300*10**6)\nP = pari\nP('K = nfinit(h^3+3*h-2)')\nP('rf = Mod(-4-h-h^2, h^3+3*h-2); rg = Mod(h-1, h^3+3*h-2)')\nP('dec = idealprimedec(K,2)')\nprint('primes over 2:', P('[ [pr.e, pr.f] | pr <- dec ]'))\n# local square-class labels via Hilbert symbols against a spanning set (rank check of Gram matrix)\ncands = ['-1','1-h-h^2','h','h-1','-3-h-h^2','3','5','1+2*h','1+4*h','1+2*h^2','1+4*h^2','1+h','1+h^2','2','7','1+2*h+2*h^2']\ndef hil(a,b,i):\n return 0 if int(P(f'nfhilbert(K,{a},{b},dec[{i}])'))==1 else 1\nimport numpy as np\ndef rank2(M):\n M=[row[:] for row in M]; r=0; ncol=len(M[0]) if M else 0\n for c in range(ncol):\n piv=None\n for i in range(r,len(M)):\n if M[i][c]: piv=i;break\n if piv is None: continue\n M[r],M[piv]=M[piv],M[r]\n for i in range(len(M)):\n if i!=r and M[i][c]: M[i]=[x^y for x,y in zip(M[i],M[r])]\n r+=1\n return r\nbasis={}\nfor i in (1,2):\n G=[[hil(a,b,i) for b in cands] for a in cands]\n rk=rank2(G)\n nloc = 2 + int(P(f'dec[{i}].e*dec[{i}].f'))\n print('prime',i,'Gram rank',rk,'expected dim',nloc)\n assert rk==nloc\n basis[i]=cands\ndef lab(x,i):\n return tuple(hil(x,b,i) for b in basis[i])\ndef labpair(xf,xg):\n return (lab(xf,1),lab(xf,2),lab(xg,1),lab(xg,2))\n# Q2 diagonal: c in {-1,2,5}\ndiag=[labpair(c,c) for c in ('-1','2','5')]\ndef xor(a,b): return tuple(tuple(x^y for x,y in zip(u,v)) for u,v in zip(a,b))\ndef canon(L):\n best=None\n for m in range(8):\n X=L\n for j in range(3):\n if m>>j&1: X=xor(X,diag[j])\n k=tuple(x for comp in X for x in comp)\n if best is None or k= 2*e+1, v\ndef process(a,n,depth=0):\n st=[]; vs=[]\n for r in ('rf','rg'):\n for i in (1,2):\n s,v=stable(a,n,r,i); st.append(s); vs.append(v)\n if all(st):\n nballs[0]+=1\n L=labpair(f'({a}-rf)',f'({a}-rg)')\n Fa=Fval(a)\n for sg in (1,-1):\n if issq_Q2(sg*Fa): images[sg].add(canon(L))\n return\n # root ball? exactly one unstable component, at degree-1 prime (i=1), and v>=n there\n uns=[k for k in range(4) if not st[k]]\n if len(uns)==1 and uns[0] in (0,2) and vs[uns[0]]>=n and n>=3:\n nballs[1]+=1\n r='rf' if uns[0]==0 else 'rg'\n # sample rational t in ball, find for each sigma one point; image is a single class per sigma\n found={1:None,-1:None}\n for j in range(1,4096):\n t=a+2**n*j\n Ft=Fval(t)\n for sg in (1,-1):\n if found[sg] is None and issq_Q2(sg*Ft):\n found[sg]=canon(labpair(f'({t}-rf)',f'({t}-rg)'))\n if found[1] is not None and found[-1] is not None: break\n for sg in (1,-1):\n assert found[sg] is not None\n images[sg].add(found[sg])\n print('root ball',a,n,'component',uns[0])\n return\n process(a,n+1,depth+1); process(a+2**n,n+1,depth+1)\nprocess(0,0)\nprint('affine balls: stable',nballs[0],'root',nballs[1])\n# infinity chart u in 2Z2: pair (1-u rf, 1-u rg); F class = class of u^6 F(1/u)\nFtil='(1+9*u+30*u^2+60*u^3+60*u^4+36*u^5+8*u^6)'\nnb=[0]\ndef stable_u(b,n,r,i):\n x=f'(1-{b}*{r})'; v1=val(x,i); vr=val(r,i); e=e_(i)\n return n*e+vr - v1 >= 2*e+1\ndef process_u(b,n):\n if all(stable_u(b,n,r,i) for r in ('rf','rg') for i in (1,2)):\n nb[0]+=1\n L=labpair(f'(1-{b}*rf)',f'(1-{b}*rg)')\n Fu=P(f'subst({Ftil},u,{b})')\n for sg in (1,-1):\n if issq_Q2(sg*Fu): images[sg].add(canon(L))\n return\n process_u(b,n+1); process_u(b+2**n,n+1)\nprocess_u(0,1)\nprint('infinity-chart balls',nb[0])\nfor sg in (1,-1): print('sigma',sg,'local image size (mod Q2 diag):',len(images[sg]))\n# Global candidates: masks over B=(-1,e,rho,h,pi)\nB=['(-1)','(1-h-h^2)','(h-1)','h','(-3-h-h^2)']\ndef elt(m): \n s='1'\n for j in range(5):\n if m>>j&1: s+='*'+B[j]\n return s\ndef normclass(m): # norm of elt(m) as rational\n return P(f'norm(Mod({elt(m)},h^3+3*h-2))')\ndef sqclassQ(r): # sign, and parity of v2, v3\n r=pari(r); return (1 if r<0 else 0, int(P(f'valuation({r},2)'))%2, int(P(f'valuation({r},3)'))%2)\nsurv={1:[],-1:[]}\nfor A in range(32):\n for Bm in range(32):\n n=pari(normclass(A))*pari(normclass(Bm))\n c=sqclassQ(n)\n for sg in (1,-1):\n want=(0 if sg==1 else 1,0,0)\n if c!=want: continue\n L=canon(labpair(elt(A),elt(Bm)))\n if L in images[sg]: surv[sg].append((A,Bm))\n# reduce survivors modulo global diagonal Q(S,2)=<-1,2,3> with masks 1,10,19\ndef gcanon(p):\n A,Bm=p; best=None\n for m in range(8):\n a,b=A,Bm\n for j,g in enumerate((1,10,19)):\n if m>>j&1: a^=g; b^=g\n if best is None or (a,b)0;\nmk(z)=for(m=0,31, if(nfsq(z/elt(m)), return(m))); -1;\nPt=[-8*y+4*y^2,-16+56*y]; Qt=[-6*y-3*y^2,-12+36*y+21*y^2];\nprint(\"T0: \", [mk(-48*d^2), mk(-12*d)]);\nprint(\"T1: \", [mk(12*d), mk(192*d^2)]);\nprint(\"P: \", [mk(Pt[1]), mk(Pt[1]-12*d)]);\nprint(\"Q: \", [mk(Qt[1]), mk(Qt[1]-12*d)]);\n\\\\ square roots in the table 1.D (y^2 = x(x-3d)(x+d) model: x/4)\nprint(\"R check P: \", lift(Mod(Pt[1]/4,md)/elt(24)), \" vs (2h)^2=\", lift(Mod((2*y)^2,md)));\nquit\n" }, { "path": "anc/code/1.2.3/1.2.3e_selmer.py", "size_bytes": 3256, "sha256": "e9741336e8c8f5a4abe0ca3370f3c02fc9e11714c1149e0695ae5f4d240612fe", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.3e -- 2-Selmer group of E: y^2 = x(x-12d)(x+4d) over K by local images (Hilbert-symbol labels, random\n# local points with seed 1) at the places over 2, 3 and the real place. Reviewer P1 script sel2E.py.\n# Run from this folder: python3 -I 1.2.3e_selmer.py\n# Independent 2-Selmer computation for E: y^2 = x(x-12d)(x+4d) over K=Q(h), h^3+3h-2=0\nimport cypari2, random\nP = cypari2.Pari(); P.allocatemem(300*10**6)\nP('K = nfinit(h^3+3*h-2); md=h^3+3*h-2; d = Mod(2-h+h^2,md)')\nP('pr1 = idealprimedec(K,2)[1]; pr2 = idealprimedec(K,2)[2]; pr3 = idealprimedec(K,3)[1]')\nP('rr = polrootsreal(md)[1]')\nplaces=['pr1','pr2','pr3']\ncands = ['-1','1-h-h^2','h','h-1','-3-h-h^2','3','5','1+2*h','1+4*h','1+2*h^2','1+4*h^2','1+h','1+h^2','2','7','1+2*h+2*h^2','1+3*h','1+3*h^2','-1+3*h']\ndef hil(a,b,pl): return 0 if int(P(f'nfhilbert(K,lift(Mod({a},md)),lift(Mod({b},md)),{pl})'))==1 else 1\ndef rank2(M):\n M=[row[:] for row in M]; r=0\n for c in range(len(M[0])):\n piv=next((i for i in range(r,len(M)) if M[i][c]),None)\n if piv is None: continue\n M[r],M[piv]=M[piv],M[r]\n for i in range(len(M)):\n if i!=r and M[i][c]: M[i]=[x^y for x,y in zip(M[i],M[r])]\n r+=1\n return r\ndims={'pr1':3,'pr2':4,'pr3':2}\nfor pl in places:\n G=[[hil(a,b,pl) for b in cands] for a in cands]\n print(pl,'Gram rank',rank2(G),'expected',dims[pl]); assert rank2(G)==dims[pl]\ndef lab(x,pl): return tuple(hil(x,b,pl) for b in cands)\ndef realsign(x): return 0 if float(P(f'subst(lift(Mod({x},md)),h,rr)'))>0 else 1\ndef kummer(x):\n # (x, x-12d) for generic x\n return (f'({x})', f'(({x})-12*d)')\ndef lablocal(pair,pl):\n if pl=='real': return (realsign(pair[0]),realsign(pair[1]))\n return lab(pair[0],pl)+lab(pair[1],pl)\ndef span(vecs):\n S={tuple([0]*len(vecs[0]))} if vecs else set()\n for v in vecs:\n S|={tuple(a^b for a,b in zip(s,v)) for s in S}\n return S\nT0=('(-3)','(-3*d)'); T1=('(3*d)','(3)')\nexpected={'pr1':8,'pr2':16,'pr3':4,'real':2}\nlocimg={}\nrandom.seed(1)\nfor pl in ['pr1','pr2','pr3','real']:\n gens=[lablocal(T0,pl),lablocal(T1,pl)]\n S=span(gens); tries=0\n while len(S)>j&1: s+='*'+B[j]\n return s\nsurv=[]\nfor A in range(32):\n for Bm in range(32):\n pair=(elt(A),elt(Bm))\n if all(lablocal(pair,pl) in locimg[pl] for pl in ['real','pr1','pr2','pr3']):\n surv.append((A,Bm))\nprint('Selmer survivors:',len(surv),surv)\n" }, { "path": "anc/code/1.2.3/1.2.3f_sieve29.py", "size_bytes": 3218, "sha256": "84b24c3346d488c61d1eaff2a99fbf91b21d3b068be7767ab2fdeafc2f90bc67", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.3f -- reductions at 13 and 29, the subgroup H at 29, 3-saturation, the character test and the infinity tuples.\n# Reviewer P1 script sieve29.py (pure Python). Run from this folder: python3 -I 1.2.3f_sieve29.py\n# Independent check of torsion bound, 3-saturation, the sieve at 29 and the character test (Ch.1, Sec 1.3.2)\nfrom itertools import product\ndef roots(p): return [x for x in range(p) if (x**3+3*x-2)%p==0]\ndef ev(c,hv,p): # c = (c0,c1,c2) poly in h\n return (c[0]+c[1]*hv+c[2]*hv*hv)%p\nclass Curve:\n def __init__(s,p,a2,a4): s.p=p; s.a2=a2%p; s.a4=a4%p\n def add(s,P,Q):\n p=s.p\n if P is None: return Q\n if Q is None: return P\n if P[0]==Q[0]:\n if (P[1]+Q[1])%p==0: return None\n lam=(3*P[0]*P[0]+2*s.a2*P[0]+s.a4)*pow(2*P[1],-1,p)%p\n else:\n lam=(Q[1]-P[1])*pow(Q[0]-P[0],-1,p)%p\n x3=(lam*lam-s.a2-P[0]-Q[0])%p\n y3=(-P[1]+lam*(P[0]-x3))%p\n return (x3,y3)\n def points(s):\n p=s.p; pts=[None]\n for x in range(p):\n r=(x**3+s.a2*x*x+s.a4*x)%p\n for y in range(p):\n if (y*y-r)%p==0: pts.append((x,y))\n return pts\n def mul(s,n,P):\n R=None\n for _ in range(n): R=s.add(R,P)\n return R\n def order(s,P):\n n=1; R=P\n while R is not None: R=s.add(R,P); n+=1\n return n\nd=(2,-1,1); Px=(0,-8,4); Py=(-16,56,0); Qx=(0,-6,-3); Qy=(-12,36,21)\ndef curve_at(p,hv):\n dv=ev(d,hv,p)\n return Curve(p,-8*dv,-48*dv*dv), dv\n# torsion bound\nfor p,hv in ((13,9),(29,6)):\n assert (hv**3+3*hv-2)%p==0\n E,dv=curve_at(p,hv); print('p',p,'h',hv,'#E',len(E.points()))\np=29; rts=roots(p); print('roots mod 29:',rts)\nEs=[]; Ps=[]; Qs=[]; T0s=[]; T1s=[]\nfor hv in rts:\n E,dv=curve_at(p,hv); pts=E.points()\n PP=(ev(Px,hv,p),ev(Py,hv,p)); QQ=(ev(Qx,hv,p),ev(Qy,hv,p))\n exps=1\n from math import lcm\n for X in pts: exps=lcm(exps,E.order(X) if X else 1)\n print('h',hv,'d',dv,'#E',len(pts),'exponent',exps,'ord P',E.order(PP),'ord Q',E.order(QQ),\n ' [exp/3]P',E.mul(exps//3,PP),' [exp/3]Q',E.mul(exps//3,QQ))\n Es.append(E); Ps.append(PP); Qs.append(QQ); T0s.append((0,0)); T1s.append((12*dv%p,0))\ndef addv(U,V): return tuple(Es[i].add(U[i],V[i]) for i in range(3))\ngens=[tuple(Ps),tuple(Qs),tuple(T0s),tuple(T1s)]\nH={(None,None,None)}\nsizes=[]\nfor g in gens:\n changed=True\n while changed:\n new={addv(h,g) for h in H}-H\n changed=bool(new); H|=new\n sizes.append(len(H))\ntot=1\nfor E in Es: tot*=len(E.points())\nprint('successive subgroup sizes',sizes,' product order',tot,' index',tot//len(H))\n# character test (1.7): rf=-4-h-h^2, rg=h-1\nrf=(-4,-1,-1); rg=(-1,1,0)\nrfs=[ev(rf,hv,p) for hv in rts]; rgs=[ev(rg,hv,p) for hv in rts]\nprint('rf residues',rfs,'rg residues',rgs)\ndef chi(a): return pow(a,(p-1)//2,p)\nok=[]\nfor t in range(p):\n vals=[(t-r)%p for r in rfs+rgs]\n chars={chi(v) for v in vals if v}\n if len(chars)<=1: ok.append(t)\nprint('t mod 29 passing character test:',ok)\n# infinity tuples\nQinf=[(ev(Qx,hv,p),ev(Qy,hv,p)) for hv in rts]\nfor choice in product((0,1),repeat=3):\n tup=tuple(Qinf[i] if choice[i] else None for i in range(3))\n print(choice, tup in H)\n" }, { "path": "anc/code/1.2.3/1.2.3g_logs29.gp", "size_bytes": 1105, "sha256": "bfb55b7d549703fbb49eb32ac10ab3ffb0039690e045bba331787e38a4ceff71", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.3g -- 29-adic logarithms of P, Q in the three embeddings and the annihilator c. Reviewer P1 script logs29.gp.\n\\\\ Run from this folder: gp -q 1.2.3g_logs29.gp\np=29; prec=12;\nrts=polrootspadic(h^3+3*h-2,p,prec);\nprint(\"roots mod 29^3: \", apply(r->lift(r)%p^3, rts));\nLv=vector(2,i,vector(3));\n{\nfor(i=1,3, hv=rts[i]; dv=2-hv+hv^2;\n E=ellinit([0,-8*dv,0,-48*dv^2,0]);\n Pt=[-8*hv+4*hv^2,-16+56*hv]; Qt=[-6*hv-3*hv^2,-12+36*hv+21*hv^2];\n r0=lift(hv)%p;\n fl=ellformallog(E,30,'T);\n for(j=1,2, G=if(j==1,Pt,Qt);\n N=0; for(n=1,100, R=ellmul(E,G,n); if(R==[0] || valuation(R[1],p)<0, N=n; break));\n R=ellmul(E,G,N); tau=-R[1]/R[2];\n lg=subst(truncate(fl),'T,tau)/N;\n Lv[j][i]=lg;\n print(\"h=\",r0,\" pt \",if(j==1,\"P\",\"Q\"),\" N=\",N,\" v(tau)=\",valuation(tau,p),\" log/29 mod 29^2 = \", lift(lg/p)%p^2)));\n}\nlp=vector(3,i,Lv[1][i]/p); lq=vector(3,i,Lv[2][i]/p);\nc=[lp[2]*lq[3]-lp[3]*lq[2], lp[3]*lq[1]-lp[1]*lq[3], lp[1]*lq[2]-lp[2]*lq[1]];\nprint(\"c mod 29: \", apply(z->lift(z)%p, c), \" sum mod 29: \", lift(c[1]+c[2]+c[3])%p);\nprint(\"c valuations: \", apply(z->valuation(z,p),c));\nquit\n" }, { "path": "anc/code/1.2.3/1.2.3g_table_check.gp", "size_bytes": 646, "sha256": "5be3c0664226730e1fd049ce733f5d5a0b12fa08fa1bedf8d7d9b8fb75e7afc8", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.3g -- checks the source's table of formal parameters tau([n]G) mod 29^3 against the logarithms.\n\\\\ Reviewer P1 script tab1F.gp. Run from this folder: gp -q 1.2.3g_table_check.gp\nM=29^3;\n{\nfor(i=1,3, hv=Mod([13172,14132,21474][i],M); dv=2-hv+hv^2; a2=-8*dv; a4=-48*dv^2;\n A=a4-a2^2/3; B=2*a2^3/27-a2*a4/3;\n print(\"h=\",lift(hv),\" (A,B)=\",[lift(A),lift(B)], \" h^3+3h-2 mod 29^3: \", lift(hv^3+3*hv-2)));\n}\n\\\\ check tau values against log table: tau/(n*29) mod 29^2\ntab=[[20677,18,647],[6119,12,368],[18908,18,410],[9338,18,672],[7540,12,302],[8584,18,764]];\nfor(k=1,6, t=tab[k]; print(t, \" -> \", lift(Mod(t[1]/29,29^2)/t[2]) ));\nquit\n" }, { "path": "anc/code/1.2.4/1.2.4a_congruences.py", "size_bytes": 1811, "sha256": "50a445683c260b768dfb736cc6ee729df321de00aef07c67599df1b5c363703c", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.4a (added for the bundle) -- the elementary congruences of the case j = 0 quoted in the section.\n# Pure Python. Run from this folder: python3 -I 1.2.4a_congruences.py\nsq = lambda m: {w * w % m for w in range(m)}\n# (1) a = 5u^2 (u odd), b arbitrary: F = a(a^4 + 20a^2b^2 + 20b^4) mod 16\nvals = sorted({(lambda a: a * (a**4 + 20*a*a*b*b + 20*b**4))(5*u*u) % 16 for u in range(1, 16, 2) for b in range(16)})\nprint(\"F mod 16 for a = 5u^2, u odd:\", vals, \" odd squares mod 16: [1, 9]\")\n# (2) u^4 = 5r^4 - 10r^2s^2 + 4s^4 with (r, s) not both even: values mod 16 vs fourth powers mod 16\nvals = sorted({(5*r**4 - 10*r*r*s*s + 4*s**4) % 16 for r in range(16) for s in range(16) if r % 2 or s % 2})\nprint(\"5r^4-10r^2s^2+4s^4 mod 16, (r,s) not both even:\", vals, \" fourth powers mod 16:\", sorted({w**4 % 16 for w in range(16)}))\n# (3) 2-isogeny descent quartics W^2 = d U^4 + A U^2V^2 + (B/d) V^4, with (U, V) primitive at the prime used\ndef check(name, f, m, l):\n S = sq(m)\n vals = sorted({f(U, V) % m for U in range(m) for V in range(m) if U % l or V % l})\n print(f\"{name}: values mod {m} for (U,V) not both divisible by {l}: {vals}; none is a square mod {m}: {not set(vals) & S}\")\ncheck(\"E : Y^2=X^3-10X^2+20X, d=2: W^2 = 2U^4-10U^2V^2+10V^4\", lambda U, V: 2*U**4 - 10*U*U*V*V + 10*V**4, 25, 5)\ncheck(\"E': Y^2=X^3+20X^2+20X, d=2: W^2 = 2U^4+20U^2V^2+10V^4\", lambda U, V: 2*U**4 + 20*U*U*V*V + 10*V**4, 25, 5)\ncheck(\"E': d=-2: W^2 = -2U^4+20U^2V^2-10V^4\", lambda U, V: -2*U**4 + 20*U*U*V*V - 10*V**4, 25, 5)\ncheck(\"E': d=-1: W^2 = -U^4+20U^2V^2-20V^4\", lambda U, V: -U**4 + 20*U*U*V*V - 20*V**4, 16, 2)\n# (4) reduction orders of Y^2 = X^3 - 10X^2 + 20X at 3 and 7\nfor p in (3, 7):\n print(f\"#E(F_{p}) =\", 1 + sum(1 for X in range(p) for Y in range(p) if (Y*Y - X**3 + 10*X*X - 20*X) % p == 0))\n" }, { "path": "anc/code/1.2.4/1.2.4a_descent_j0.gp", "size_bytes": 874, "sha256": "63f5b3928c7dc2af4e956a6f4d4d676790ee6c85fad77794682b7583b389458a", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.4a -- rank and torsion of Y^2 = X^3 - 10X^2 + 20X; (a+b sqrt2)^5 = F + G sqrt2 and the rational parts for j = 1, 2.\n\\\\ First lines of reviewer script script c4a.gp. Run from this folder: gp -q 1.2.4a_descent_j0.gp\n\\\\ Chapter 4 basic checks\nE = ellinit([0,-10,0,20,0]); print(\"Lemma 4.1 curve: conductor \", ellglobalred(E)[1], \" ellrank \", ellrank(E)[1..2], \" analytic rank \", ellanalyticrank(E)[1], \" torsion \", elltors(E)[1..2]);\n\\\\ forms\nFF(a,b) = a^5+20*a^3*b^2+20*a*b^4;\nGG(a,b) = 5*a^4*b+20*a^2*b^3+4*b^5;\nprint(\"(a+b sqrt2)^5 check: \", polcoef(lift(Mod('a+'b*'s,'s^2-2)^5),0,'s)==FF('a,'b), \" \", polcoef(lift(Mod('a+'b*'s,'s^2-2)^5),1,'s)==GG('a,'b));\nprint(\"j=1: \", polcoef(lift(Mod(1+'s,'s^2-2)*Mod('a+'b*'s,'s^2-2)^5),0,'s)==FF('a,'b)+2*GG('a,'b), \" j=2: \", polcoef(lift(Mod(1+'s,'s^2-2)^2*Mod('a+'b*'s,'s^2-2)^5),0,'s)==3*FF('a,'b)+4*GG('a,'b));\nquit\n" }, { "path": "anc/code/1.2.4/1.2.4b_quintic_field.gp", "size_bytes": 1975, "sha256": "0e796e0545892c185ddf75e4cba1d9eece9d9ec1e9010413e9704ff339a0883d", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.4b -- the quintic field L = Q(theta), g = T^5+5T^3+5T-2: discriminant, index, signature, h (certified), units,\n\\\\ minimal polynomials of eta, chi, the norm identities, primes over 2, 3, 5, congruences mod 5. Rest of reviewer script c4a.gp.\n\\\\ Run from this folder: gp -q 1.2.4b_quintic_field.gp\n\\\\ [bundle] F, G as in 1.2.4a_descent_j0.gp\nFF(a,b) = a^5+20*a^3*b^2+20*a*b^4;\nGG(a,b) = 5*a^4*b+20*a^2*b^3+4*b^5;\ng = x^5+5*x^3+5*x-2;\nK = bnfinit(g,1); nf = K.nf;\nprint(\"disc(g)=\",factor(poldisc(g)),\" disc(L)=\",factor(nf.disc),\" index=\",nf.index,\" sign=\",nf.sign,\" h=\",K.no,\" certify=\",bnfcertify(K));\nu1=Mod(1-x-x^3,g); u2=Mod(1-3*x+x^2-x^3,g); q=Mod(-1+2*x+2*x^2+x^3,g); l=Mod(1+x^2,g);\net=Mod(-x^4-x^3-5*x^2-4*x-6,g); chi=Mod(x^4+x^3+3*x^2+6*x-4,g); de=Mod(x^4+x^3+3*x^2+3*x-1,g);\nprint(\"norms u1,u2,q,l,de,chi: \", [norm(u1),norm(u2),norm(q),norm(l),norm(de),norm(chi)]);\nprint(\"bnfisunit u1,u2: \", bnfisunit(K,u1), bnfisunit(K,u2));\nprint(\"minpoly et: \", minpoly(et), \" disc \", factor(poldisc(minpoly(et))));\nprint(\"minpoly chi: \", minpoly(chi), \" disc \", factor(poldisc(minpoly(chi))));\nF1(a,b)=FF(a,b)+2*GG(a,b);\nF2(a,b)=3*FF(a,b)+4*GG(a,b);\nprint(\"N(a-et b)-F1 = \", norm(Mod('a-lift(et)*'b,g))-F1('a,'b), \" N(3a-chi b)-81F2 = \", norm(Mod(3*'a-lift(chi)*'b,g))-81*F2('a,'b));\nP3=idealprimedec(nf,3); print(\"primes over 3: \", [[p.e,p.f] | p<-P3]);\nprint(\"val de at P3: \", [idealval(nf,lift(de),p) | p<-P3], \" val chi at P3: \", [idealval(nf,lift(chi),p)|p<-P3]);\nP2=idealprimedec(nf,2); print(\"primes over 2: \", [[p.e,p.f] | p<-P2], \" val theta: \", [idealval(nf,x,p)|p<-P2], \" val q: \", [idealval(nf,lift(q),p)|p<-P2]);\nP5=idealprimedec(nf,5); print(\"primes over 5: \", [[p.e,p.f] | p<-P5], \" val l: \", [idealval(nf,lift(l),p)|p<-P5]);\nprint(\"F1(2,1)=\",F1(2,1),\" F2(3,1)=\",F2(3,1));\nprint(\"F1 mod 5 == (a-2b)^5: \", (F1('a,'b)-('a-2*'b)^5)%5==0, \" F2 mod 5 == 3(a-3b)^5: \", (F2('a,'b)-3*('a-3*'b)^5)%5==0);\nprint(\"g mod 3 factor: \", lift(factormod(g,3)));\nquit\n" }, { "path": "anc/code/1.2.4/1.2.4b_small_primes.gp", "size_bytes": 1260, "sha256": "f31df99135f2e3334dd78c03766e261bd2faaebc7c6fd25c8008e1356930d251", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.4b (added for the bundle) -- the prime ideals of norm < 29 of L = Q(theta), g = T^5+5T^3+5T-2, and the\n\\\\ generators listed in the section (by factoring g mod p); quadratic characters of u1, u2 at (7, theta-5), (17, theta-3).\n\\\\ Run from this folder: gp -q 1.2.4b_small_primes.gp\ng = x^5+5*x^3+5*x-2; nf = nfinit(g); T = Mod(x, g);\ngens = [T, -1+2*T+2*T^2+T^3, 3+T+2*T^2, 1+T^2, 3+T^2, -1+3*T+2*T^3, 1+T, -1+T+4*T^2+T^4, -1+2*T-T^2+T^3];\nprint(\"norms of the listed generators: \", apply(z->norm(z), gens));\n{forprime(p=2,28, my(F = factormod(g,p)); print(\"p=\",p,\" degrees of g mod p: \", apply(poldegree, lift(F[,1])~), \" exponents \", F[,2]~);\n foreach(idealprimedec(nf,p), pr, if(pr.p^pr.f < 29,\n my(k = [i | i<-[1..#gens], idealval(nf, lift(gens[i]), pr) == 1 && abs(norm(gens[i])) == pr.p^pr.f]);\n print(\" prime ideal of norm \", pr.p^pr.f, \" (e=\", pr.e, \") generated by listed element(s) \", apply(i->lift(gens[i]), k)))));}\nu1 = 1-T-T^3; u2 = 1-3*T+T^2-T^3;\nch(z, p, r) = (1 - kronecker(lift(subst(lift(z), x, Mod(r,p))), p))/2;\nprint(\"g(5) mod 7 = \", subst(g,x,5)%7, \" g(3) mod 17 = \", subst(g,x,3)%17);\nprint(\"character rows (u1,u2) at (7,theta-5): \", [ch(u1,7,5), ch(u2,7,5)], \" at (17,theta-3): \", [ch(u1,17,3), ch(u2,17,3)]);\nquit\n" }, { "path": "anc/code/1.2.4/1.2.4c_mod8.py", "size_bytes": 1550, "sha256": "89347ada6f67f9b932897a9742a9b31f31c1a6f514e5d8eac28d5567a3995223", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.4c -- squares of R = (Z/8)[T]/(g) and the residues of gamma_1 = a - eta b, gamma_2 = 3a - chi b (a odd)\n# compared with u1^i u2^k R^2 and delta u1^i u2^k R^2. Reviewer P2 script c4mod8.py (pure Python).\n# Run from this folder: python3 -I 1.2.4c_mod8.py\nimport itertools\nM=8\n# g = T^5 + 5T^3 + 5T - 2 ; T^5 = 2 - 5T - 5T^3\nred=[2,-5,0,-5,0]\ndef mul(a,b):\n c=[0]*9\n for i in range(5):\n if a[i]:\n for j in range(5): c[i+j]+=a[i]*b[j]\n for k in range(8,4,-1):\n t=c[k]\n if t:\n c[k]=0\n for i in range(5): c[k-5+i]+=t*red[i]\n return tuple(x%M for x in c[:5])\ndef P(l): l=list(l)+[0]*(5-len(l)); return tuple(x%M for x in l)\nallel=list(itertools.product(range(M),repeat=5))\nsq=set(mul(w,w) for w in allel)\nprint(\"squares:\",len(sq))\nu1=P([1,-1,0,-1]); u2=P([1,-3,1,-1]); de=P([-1,3,3,1,1])\net=P([-6,-4,-5,-1,-1]); chi=P([-4,6,3,1,1])\none=P([1])\nfor name,base,lin in ((\"g1\",one,lambda a,b: tuple(((a if i==0 else 0)-et[i]*b)%M for i in range(5))),\n (\"g2\",de, lambda a,b: tuple(((3*a if i==0 else 0)-chi[i]*b)%M for i in range(5)))):\n lhs=set(lin(a,b) for a in range(1,M,2) for b in range(M))\n res=[]\n for i,k in ((0,0),(1,0),(0,1),(1,1)):\n u=base\n if i: u=mul(u,u1)\n if k: u=mul(u,u2)\n rhs=set(mul(u,s) for s in sq)\n inter=lhs&rhs\n res.append(len(inter))\n if inter and name==\"g1\": print(\" (i,k)=\",(i,k),\" residues:\",sorted(inter))\n print(name,\" #lhs=\",len(lhs),\" intersections (1,u1,u2,u1u2):\",res)\n" }, { "path": "anc/code/1.2.4/1.2.4d_covering_map.gp", "size_bytes": 1736, "sha256": "a114fa8e9496cebf197ca5dd9193a80edf8585c196fd28c6b45a3eaceba17b04", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.4d -- q(t)(t - eta) = h1(t), the curve identity for (xi, zeta), dU/dt = V/v, and the branch v/t^2 -> -1\n\\\\ at infinity mapping to P. Reviewer P2 script c4map.gp. Run from this folder: gp -q 1.2.4d_covering_map.gp\nvv0=[v,t,s]; \\\\ fix variable priority: v > t > s > th\ng = th^5+5*th^3+5*th-2;\nT = Mod(th, g);\net = -T^4-T^3-5*T^2-4*T-6;\nA = 10+et; B = 20+10*et+et^2; C = 40+20*et+10*et^2+et^3; D = 20+40*et+20*et^2+10*et^3+et^4;\nqt = t^4+A*t^3+B*t^2+C*t+D;\nh1 = t^5+10*t^4+20*t^3+40*t^2+20*t+8;\nprint(\"q(t)*(t-eta) == h1(t): \", qt*(t-et) - h1 == 0);\nU = 2*v+2*t^2+A*t;\nV = 2*(U+B-A^2/4)*t+(A/2)*U+C;\nR = 2*T^3-4;\nxi = (U-R)/4; ze = V/8;\nexpr = ze^2 - (xi^3 - 5*T*xi^2 + 5*T^2*xi);\n\\\\ reduce modulo v^2 - q(t): substitute v^2 -> qt\nred(f) = {my(f2 = f, k); f2 = Pol(f2, v); my(res=0); for(k=0, poldegree(f2,v), res += polcoef(f2,k,v) * if(k%2==0, qt^(k\\2), v*qt^((k-1)\\2))); res};\nprint(\"curve identity (should be 0): \", red(expr) == 0);\n\\\\ differential: d xi / (2 ze) vs dt/v. With v^2=q: dv/dt = q'/(2v). dU/dt = 2 dv/dt + 4t + A\ndUdt = 2*deriv(qt,t)/(2*v) + 4*t + A; \\\\ involves 1/v\n\\\\ check dU/dt * v == V (i.e. dU/dt = V/v)\nlhs = red(deriv(qt,t) + (4*t+A)*v); \\\\ = v*dUdt\nprint(\"dU/dt = V/v identity: \", red(lhs - V) == 0);\n\\\\ branch at infinity with v/t^2 -> -1: expand v = -t^2*sqrt(q/t^4) as series in 1/t\nqs = subst(qt, t, 1/s)*s^4; \\\\ q(t)/t^4 as polynomial in s\nvv = -sqrt(qs + O(s^8))/s^2;\nUs = 2*vv + 2/s^2 + A/s; Vs = 2*(Us+B-A^2/4)/s + (A/2)*Us + C;\nxs = (Us-R)/4; zs = Vs/8;\nP = [(-5*T^4-25*T^2+10*T)/8, (35*T^4-5*T^3+195*T^2-20)/32];\nprint(\"xi at - branch -> \", polcoef(xs,0,s)-P[1] , \" zeta -> \", polcoef(zs,0,s)-P[2]);\nprint(\"valuations (leading) xs:\", valuation(xs,s), \" zs:\", valuation(zs,s));\nquit\n" }, { "path": "anc/code/1.2.4/1.2.4e_points.gp", "size_bytes": 1559, "sha256": "cf5f055a4ad42c3aea052a83a6faf8325a4648a5d76325f06d1fd80c05951c38", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.4e -- P, Q on E, S on E', phihat(S) = P + T0, no nonzero combination of P, Q, T0 in 2E(L), torsion;\n\\\\ plus (added) the three square classes quoted in the section. Reviewer P2 script c4pts.gp. Run: gp -q 1.2.4e_points.gp\ng = y^5+5*y^3+5*y-2; nf = nfinit(g); T = Mod(y,g);\nE = ellinit([0,-5*y,0,5*y^2,0], nf);\nEp = ellinit([0,10*y,0,5*y^2,0], nf);\nP = [(-5*T^4-25*T^2+10*T)/8, (35*T^4-5*T^3+195*T^2-20)/32];\nQ = [4*T+4*T^2+3*T^3+2*T^4, 12-24*T-7*T^2-21*T^3-3*T^4];\nS = [50+5*T+50*T^2+10*T^4, 380+100*T+320*T^2+20*T^3+60*T^4];\nprint(\"on curves: P \", ellisoncurve(E,lift(P)), \" Q \", ellisoncurve(E,lift(Q)), \" S on E' \", ellisoncurve(Ep,lift(S)));\nphihat(R) = {my(x=R[1], yy=R[2]); [(x + 10*T + 5*T^2/x)/4, yy*(5*T^2 - x^2)/(8*x^2)]};\nps = phihat(S); print(\"phihat(S) on E: \", ellisoncurve(E, lift(ps)), \" phihat(S) == P+T0: \", lift(ps) == elladd(E, lift(P), [0,0]));\n\\\\ independence of P,Q,T0 in E(L)/2E(L)\nT0=[0,0];\nfor(m=1,7, a=bittest(m,0); b=bittest(m,1); c=bittest(m,2); R = [0]; if(a, R=elladd(E,R,lift(P))); if(b, R=elladd(E,R,lift(Q))); if(c, R=elladd(E,R,T0)); print([a,b,c], \" divisible by 2? \", ellisdivisible(E, R, 2)));\nprint(\"torsion E: \", elltors(E)[1..2], \" E': \", elltors(Ep)[1..2]);\n\\\\ [added for the bundle] Kummer classes quoted in the section: 5 theta^2 / l, xi(Q)/(u1 u2 l) on E and xi(S)/(u1 u2 l) on E'\nu1=1-T-T^3; u2=1-3*T+T^2-T^3; l=1+T^2;\nissq(z) = #nfroots(nf, 'x^2 - lift(z)) > 0;\nprint(\"squares in L: 5th^2/l \", issq(5*T^2/l), \" xi(Q)/(u1u2l) \", issq(Q[1]/(u1*u2*l)), \" xi(S)/(u1u2l) \", issq(S[1]/(u1*u2*l)));\nquit\n" }, { "path": "anc/code/1.2.4/1.2.4e_rank_simon.gp", "size_bytes": 882, "sha256": "b968de5b2bd45d7be814c2fb8c82ab9e4b915b90a1e9637ba647da4457d5ebb0", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.4e -- Simon's 2-isogeny descent for E: zeta^2 = xi^3 - 5 theta xi^2 + 5 theta^2 xi over L (rank 2).\n\\\\ Reviewer P2 script c4rank.gp. Run from this folder: gp -q 1.2.4e_rank_simon.gp\n\\\\ [bundle] Denis Simon's ell.gp from ../common/simon_ell/, loaded with the reviewer's parameters:\nDEBUGLEVEL_ell=0; LIM1=2; LIM3=4; LIMTRIV=2; MAXPROB=20; LIMBIGPRIME=30;\n\\r ../common/simon_ell/ell.gp\n\\r ../common/simon_ell/qfsolve.gp\n\\r ../common/simon_ell/resultant3.gp\nDEBUGLEVEL_ell=1;\nK = bnfinit(y^5+5*y^3+5*y-2,1);\nif(bnfcertify(K)!=1, error(\"bnfcertify failed\")); print(\"bnfcertify(K) = 1 (class group and units of K proved, so the descent below is unconditional)\");\nE = [0,-5*y,0,5*y^2,0];\nt0=getwalltime();\nr = bnfell2descent_viaisog(K,E);\nprint(\"RESULT [rank_lower, Selmer-based bound + tors, pts] = \", r[1..2], \" time ms \", getwalltime()-t0);\nprint(\"points: \", r[3]);\nquit\n" }, { "path": "anc/code/1.2.4/1.2.4f_sieve751.py", "size_bytes": 4063, "sha256": "23e0d2ce691fc452dfe55f7abca556fcfe06af5538b9f904a9e9b122b309210c", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.4f -- sieve at 751: five reduced groups, coordinates of P, Q, T0, |H|, index, the 3-part matrix, and the\n# enumeration of all t in P^1(F_751) with all ordinate signs. Reviewer P2 script c4sieve.py (pure Python).\n# Run from this folder: python3 -I 1.2.4f_sieve751.py\nimport itertools, time\np=751\ndef roots_g(p): return [t for t in range(p) if (t**5+5*t**3+5*t-2)%p==0]\nR=roots_g(p); print(\"roots of g mod 751:\",R)\ninv=lambda a: pow(a%p,-1,p)\ndef add(P_,Q_,a2,a4):\n if P_ is None: return Q_\n if Q_ is None: return P_\n x1,y1=P_; x2,y2=Q_\n if x1==x2:\n if (y1+y2)%p==0: return None\n l=(3*x1*x1+2*a2*x1+a4)*inv(2*y1)%p\n else: l=(y2-y1)*inv(x2-x1)%p\n x3=(l*l-a2-x1-x2)%p; return (x3,(-y1+l*(x1-x3))%p)\ndef mulpt(n,P_,a2,a4):\n Rr=None; B=P_\n while n:\n if n&1: Rr=add(Rr,B,a2,a4)\n B=add(B,B,a2,a4); n>>=1\n return Rr\nsqrt_tab={}\nfor yv in range(p): sqrt_tab.setdefault(yv*yv%p,[]).append(yv)\ndef ev(poly,t): # poly coefficients low->high in theta\n return sum(c*pow(t,i,p) for i,c in enumerate(poly))%p\ndata=[]\nfor th in R:\n a2=(-5*th)%p; a4=(5*th*th)%p\n pts=[None]+[(x,yv) for x in range(p) for yv in sqrt_tab.get((x**3+a2*x*x+a4*x)%p,[])]\n N=len(pts)\n # find generator of order N/2 and a 2-torsion point outside\n def order(P_):\n n=1; Q_=P_\n while Q_ is not None: Q_=add(Q_,P_,a2,a4); n+=1\n return n\n G=None\n for P_ in pts[1:]:\n if order(P_)==N//2: G=P_; break\n mults=[None]; Q_=G\n for i in range(1,N//2): mults.append(Q_); Q_=add(Q_,G,a2,a4)\n sub=set(mults)\n tors2=[(x,0) for x in range(p) if (x**3+a2*x*x+a4*x)%p==0]\n Tx=[T for T in tors2 if T not in sub][0]\n coord={}\n for i,M_ in enumerate(mults):\n coord[M_]=(i,0); coord[add(M_,Tx,a2,a4)]=(i,1)\n assert len(coord)==N\n Pp=(ev([0,10,-25,0,-5],th)*inv(8)%p, ev([-20,0,195,-5,35],th)*inv(32)%p)\n Qp=(ev([0,4,4,3,2],th), ev([12,-24,-7,-21,-3],th))\n data.append(dict(th=th,a2=a2,a4=a4,N=N,coord=coord,P=Pp,Q=Qp,G=G,T=Tx))\n print(f\"theta={th} #E={N} gen={G} T={Tx} coordP={coord[Pp]} coordQ={coord[Qp]} T0={coord[(0,0)]}\")\n# H generated by P,Q,T0 in product of (Z/384 x Z/2)\nn=data[0]['N']//2\ndef vec(pts): return tuple(c for d,pt in zip(data,pts) for c in d['coord'][pt])\nvP=vec([d['P'] for d in data]); vQ=vec([d['Q'] for d in data]); vT=vec([(0,0)]*5)\ndef addv(u,w): return tuple(((u[i]+w[i])%(n if i%2==0 else 2)) for i in range(10))\ndef smul(k,u): return tuple(((k*u[i])%(n if i%2==0 else 2)) for i in range(10))\nH=set()\nfor i in range(n):\n Pi=smul(i,vP)\n for j in range(n):\n x=addv(Pi,smul(j,vQ)); H.add(x); H.add(addv(x,vT))\nprint(\"|H|=\",len(H),\" index=\",(2*n)**5//len(H))\n# 3-saturation: multiply by 128*? : images of 256*P etc in the 3-part\nfor nm,v in ((\"P\",vP),(\"Q\",vQ)):\n print(nm,\"3-part (coef of order-3 elt):\",[ (v[2*k]*256 % n)//128 for k in range(5)], \" raw mod 3:\",[ (v[2*k])%3 for k in range(5)])\n# quartic coefficients per embedding\ndef etaval(th): return (-th**4-th**3-5*th**2-4*th-6)%p\nt0=time.time()\nsquares_all=0; tested=0; surv=[]\nfor t in list(range(p))+['inf']:\n fib=[]\n for d in data:\n th=d['th']; e_=etaval(th); A=(10+e_)%p; B=(20+10*e_+e_*e_)%p; C=(40+20*e_+10*e_**2+e_**3)%p; D=(20+40*e_+20*e_**2+10*e_**3+e_**4)%p\n Rr=(2*th**3-4)%p\n if t=='inf':\n fib.append([None, d['P']])\n continue\n qv=(t**4+A*t**3+B*t*t+C*t+D)%p\n ys=sqrt_tab.get(qv,[])\n pts=[]\n for v in ys:\n U=(2*v+2*t*t+A*t)%p\n V=(2*(U+B-A*A*inv(4))*t+A*inv(2)*U+C)%p\n xi=(U-Rr)*inv(4)%p; ze=V*inv(8)%p\n assert (ze*ze-(xi**3+d['a2']*xi*xi+d['a4']*xi))%p==0\n pts.append((xi,ze))\n fib.append(pts)\n if all(len(f)>0 for f in fib):\n squares_all+=1\n for combo in itertools.product(*fib):\n tested+=1\n if vec(list(combo)) in H: surv.append((t,combo))\nprint(\"residues with points in all factors:\",squares_all,\" product points tested:\",tested,\" survivors:\",surv)\nprint(\"time\",time.time()-t0)\n" }, { "path": "anc/code/1.2.4/1.2.4g_logs751.gp", "size_bytes": 1738, "sha256": "fa6ec26de615785de9db5621cacd526a404f9b0408f1b4bfc22eb0e7121f1e7c", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.4g -- 751-adic logarithms of P, Q in the five embeddings and the annihilator c. Reviewer P2 script c4log.gp.\n\\\\ Run from this folder: gp -q 1.2.4g_logs751.gp\np = 751; N = 8;\nformlog(E, t) = {my(L = ellformallog(E, 12, 'w)); subst(truncate(L), 'w, t);}\nplog(E, P) = {my(n=1, Q=P, t);\n while(!(#Q==2 && valuation(Q[1],p) < 0), n++; Q = elladd(E, Q, P); if(Q==[0], error(\"hit O\")));\n t = -Q[1]/Q[2]; [n, formlog(E,t)/n];}\nrts = polrootspadic(x^5+5*x^3+5*x-2, p, N);\nprint(\"roots mod p^3: \", apply(r->lift(r+O(p^3)), rts));\nLP = vector(5); LQ = vector(5); nP=vector(5); nQ=vector(5);\n{for(i=1,5, th = rts[i]; E = ellinit([0,-5*th,0,5*th^2,0]);\n P = [(-5*th^4-25*th^2+10*th)/8, (35*th^4-5*th^3+195*th^2-20)/32];\n Q = [4*th+4*th^2+3*th^3+2*th^4, 12-24*th-7*th^2-21*th^3-3*th^4];\n if(!ellisoncurve(E,P) || !ellisoncurve(E,Q), error(\"off curve\"));\n r = plog(E,P); nP[i]=r[1]; LP[i] = r[2]/p;\n r = plog(E,Q); nQ[i]=r[1]; LQ[i] = r[2]/p;\n);}\nprint(\"orders P: \", nP, \" Q: \", nQ);\nprint(\"log P / p mod p^2: \", apply(z->lift(z+O(p^2)), LP));\nprint(\"log Q / p mod p^2: \", apply(z->lift(z+O(p^2)), LQ));\n\\\\ annihilator: cross product of first three coordinates\nc = vector(5); c[1] = LP[2]*LQ[3]-LP[3]*LQ[2]; c[2] = LP[3]*LQ[1]-LP[1]*LQ[3]; c[3] = LP[1]*LQ[2]-LP[2]*LQ[1];\ncm = apply(z->if(z==0,0,lift(z+O(p))), c);\nprint(\"c mod p: \", cm, \" sum c mod p: \", vecsum(cm)%p);\nprint(\"check c.logP, c.logQ (mod p^2 approx): \", lift(sum(i=1,3,c[i]*LP[i])+O(p^2)), \" \", lift(sum(i=1,3,c[i]*LQ[i])+O(p^2)));\n\\\\ independence of first three coords mod p: rank of 2x3\nprint(\"rank mod p of [LP;LQ] first 3 coords: \", matrank(Mod([lift(LP[1]+O(p)),lift(LP[2]+O(p)),lift(LP[3]+O(p)); lift(LQ[1]+O(p)),lift(LQ[2]+O(p)),lift(LQ[3]+O(p))], p)));\nquit\n" }, { "path": "anc/code/1.2.6/1.2.6a_identities.gp", "size_bytes": 1239, "sha256": "287f7b7a8ba788aab138187c397f565dd4d5422ffd28b19b5a9402f7e67251f1", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.6a -- disc g, minimal polynomials and discriminants of mu1 (et), mu2 (chi), the norm identities and the rational\n\\\\ parts for j = 1, 2. Reviewer P2 script c3a.gp (first line deleted, see README). Run from this folder: gp -q 1.2.6a_identities.gp\n\\\\ Chapter 3, Appendix 3.A checks\ng = x^5-5*x^3+5*x-4;\nprint(\"irreducible: \", polisirreducible(g), \" disc(g)=\", factor(poldisc(g)));\n\\\\ norm identities\net = Mod(x^4+2*x^3-5*x^2-8*x+1,g); chi = Mod(-x^4-x^3+3*x^2+2*x,g);\nFF(a,b) = a*(a^4+30*a^2*b^2+45*b^4);\nGG(a,b) = b*(5*a^4+30*a^2*b^2+9*b^4);\nF1(a,b) = 2*FF(a,b)+3*GG(a,b);\nF2(a,b)=7*FF(a,b)+12*GG(a,b);\nprint(\"minpoly et: \", minpoly(et), \" chi: \", minpoly(chi));\nprint(\"disc h1: \", factor(poldisc(minpoly(et))), \" disc h2: \", factor(poldisc(minpoly(chi))));\nprint(\"N(2a-et b) - 16F1: \", simplify(norm(Mod(2*'a - lift(et)*'b, g)) - 16*F1('a,'b)));\nprint(\"N(2a-chi(a+b)) - 8F2: \", simplify(norm(Mod(2*'a - lift(chi)*('a+'b), g)) - 8*F2('a,'b)));\n\\\\ check that (2+sqrt3)(a+b sqrt3)^5 gives 2F+3G etc\nprint(\"j=1 form: \", (2*FF('a,'b)+3*GG('a,'b)) == polcoef(lift(Mod(2+'s,'s^2-3)*Mod('a+'b*'s,'s^2-3)^5),0,'s));\nprint(\"j=2 form: \", (7*FF('a,'b)+12*GG('a,'b)) == polcoef(lift(Mod(2+'s,'s^2-3)^2*Mod('a+'b*'s,'s^2-3)^5),0,'s));\nquit\n" }, { "path": "anc/code/1.2.6/1.2.6a_mod8.py", "size_bytes": 1593, "sha256": "8a3a31bfd64d7370573e4ea92f76859ce05b7a83e6f92982fe0c5e1502e3d542", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.6a -- in R = (Z/8)[T]/(g): the distinct squares, the 16 left sides for a+b odd and the eight intersections for\n# each j. Reviewer P2 script c3a_mod8.py (pure Python). Run from this folder: python3 -I 1.2.6a_mod8.py\nimport itertools\nM=8\n# g = T^5 -5T^3 +5T -4 ; T^5 = 5T^3 -5T +4\nred5 = [4,-5,0,5,0] # T^5 = 4 -5T +0T^2 +5T^3 +0T^4\ndef mul(a,b,red=red5):\n c=[0]*9\n for i in range(5):\n if a[i]==0: continue\n for j in range(5):\n c[i+j]+=a[i]*b[j]\n for k in range(8,4,-1):\n if c[k]:\n t=c[k]; c[k]=0\n for i in range(5): c[k-5+i]+=t*red[i]\n return tuple(x%M for x in c[:5])\ndef P(coeffs): # list low->high\n l=list(coeffs)+[0]*(5-len(coeffs)); return tuple(x%M for x in l)\nallel=list(itertools.product(range(M),repeat=5))\nsq=set(mul(w,w) for w in allel)\nprint(\"distinct squares mod 8:\",len(sq))\ne1=P([1,-1,0,1]); e2=P([1,0,2,3,1]); vp=P([-2,1]); q=P([-1,1,1])\neta=P([1,-8,-5,2,1]); chi=P([0,2,3,-1,-1])\none=P([1])\nfor j in (1,2):\n lhs=set()\n for a in range(M):\n for b in range(M):\n if (a+b)%2==0: continue\n if j==1: g_=tuple((2*a*(i==0) - eta[i]*b)%M for i in range(5))\n else: g_=tuple((2*a*(i==0) - chi[i]*(a+b))%M for i in range(5))\n lhs.add(g_)\n out=[]\n for i,k,l in itertools.product((0,1),repeat=3):\n u=one\n if j==2: u=mul(u,vp)\n if i: u=mul(u,e1)\n if k: u=mul(u,e2)\n if l: u=mul(u,q)\n rhs=set(mul(u,s) for s in sq)\n out.append(len(lhs & rhs))\n print(\"j=\",j,\" #lhs=\",len(lhs),\" intersections:\",out)\n" }, { "path": "anc/code/1.2.6/1.2.6a_quintic_field.gp", "size_bytes": 923, "sha256": "4dc024b223dae36f80cddde29fe9a6c1da6663d054782996e64cdf839b1f26bd", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.6a -- L = Q(theta), g = T^5-5T^3+5T-4: disc, signature, h (certified), integral basis, units e1, e2, the\n\\\\ factorisation of 2, and the residues of e1, e2 at (7, theta-3), (13, theta-9). Writers' helper quint.gp. Run: gp -q 1.2.6a_quintic_field.gp\ng=x^5-5*x^3+5*x-4; K=bnfinit(g,1);\nprint(\"disc \",K.disc,\" sign \",K.sign,\" h \",K.no,\" zk \",K.zk);\nprint(\"certify \",bnfcertify(K));\nth=Mod(x,g); e1=1-th+th^3; e2=1+2*th^2+3*th^3+th^4;\nprint(\"N(e1),N(e2),N(th-2),N(q)=\",[norm(e1),norm(e2),norm(th-2),norm(th^2+th-1)]);\nprint(\"isunit e1,e2: \",bnfisunit(K,lift(e1)),bnfisunit(K,lift(e2)));\nprint(\"fact 2: \",idealfactor(K,2));\nprint(\"primes over 5 [e,f]: \",[[pr.e,pr.f] | pr<-idealprimedec(K,5)]); \\\\ [added for the bundle]\nprint(\"residues at (7,th-3): \",[lift(Mod(subst(lift(e1),x,3),7)),lift(Mod(subst(lift(e2),x,3),7))],\" at (13,th-9): \",[lift(Mod(subst(lift(e1),x,9),13)),lift(Mod(subst(lift(e2),x,9),13))]);\nquit\n" }, { "path": "anc/code/1.2.6/1.2.6b_congruences.py", "size_bytes": 2753, "sha256": "fad6109e1bc0542536ddd7d85e0ff7e0cd9a50dfccd1ef633119cc24ae136d9d", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.6b -- congruences and identities of the reduction to C and H: (a+b sqrt3)^5, the rational parts for\n# j = 1, 2, c^2 mod 16, the right-hand side of (3.1) mod 16 by parity class, (5r^4+9s^4) mod 3, N(alpha), the map to H\n# for sigma = +-1, f(-9) = 216^2, and the reconstruction of the two solutions. Section '1.2.6' of the helper\n# helper w8_checks.py (SymPy). Run from this folder: python3 -I 1.2.6b_congruences.py\nfrom sympy import symbols, sqrt, expand, simplify, Rational as R, together, factor\nfrom math import gcd\n\na, b, c, Y, Z, X, t, u, r, s, sg, q = symbols('a b c Y Z X t u r s sigma q')\n\nprint('== 1.2.6 (x^5+y^4=3z^2) ==')\nd = sqrt(5); tt = symbols('t') # [bundle] defined in the 1.2.7 part of the original helper, used below\nd3 = sqrt(3)\nex = expand((a + b*d3)**5)\nFm = ex.coeff(d3, 0); Gm = ex.coeff(d3, 1)\nprint('(a+b sqrt3)^5 =', factor(Fm), ' + sqrt3*', factor(Gm))\nfor j in (1, 2):\n exj = expand((2 + d3)**j*(a + b*d3)**5)\n print(' j=%d rational part = %s*F + %s*G ?' % (j, (7 if j == 2 else 2), (12 if j == 2 else 3)),\n simplify(exj.coeff(d3, 0) - ((7 if j == 2 else 2)*Fm + (12 if j == 2 else 3)*Gm)) == 0)\n# mod 16: c^2 = u^8+30u^4b^2+45b^4 with u even, b odd\nprint('u even, b odd: c^2 mod 16 =', sorted({(uu**8 + 30*uu**4*bb*bb + 45*bb**4) % 16 for uu in range(0, 32, 2) for bb in range(1, 32, 2)}), ' squares mod 16: [0,1,4,9]')\nQ31 = lambda rr, ss: rr**4 - 15*rr*rr*ss*ss + 45*ss**4\nfor name, cond in [('r,s odd', lambda rr, ss: rr % 2 and ss % 2), ('r=0 mod 4, s odd', lambda rr, ss: rr % 4 == 0 and ss % 2),\n ('r=2 mod 4, s odd', lambda rr, ss: rr % 4 == 2 and ss % 2), ('r odd, s=2 mod 4', lambda rr, ss: rr % 2 and ss % 4 == 2),\n ('r odd, 4|s', lambda rr, ss: rr % 2 and ss % 4 == 0)]:\n print(' (3.1) RHS mod 16, %-18s:' % name, sorted({Q31(rr, ss) % 16 for rr in range(64) for ss in range(64) if cond(rr, ss)}))\nprint(' (5r^4+9s^4) mod 3 (3!|rs):', sorted({(5*rr**4 + 9*ss**4) % 3 for rr in (1, 2) for ss in range(3)}))\nalpha3 = r**2 + (-15 + 3*d)/2*s**2\nprint('N(alpha) - (r^4-15r^2s^2+45s^4):', simplify(expand(alpha3*alpha3.subs(d, -d)) - Q31(r, s)))\nfor sgv in (1, -1):\n Xv = 9*sgv*tt**2; rB2 = sgv*(9*tt**4 + 5) + 30*tt**2; uB2 = 9*tt**4 - 5\n print(' sigma=%d: Y^2 - f(X) for (3.11):' % sgv, simplify(729*tt**2*rB2*uB2 - Xv*(Xv**2 + 30*Xv + 45)*(Xv**2 - 45)))\nprint('f(-9) =', (-9)*(81 - 270 + 45)*(81 - 45), '= 216^2 =', 216**2)\n# reconstruction (3.2)-(3.4)\nfor (uu, rr, ss) in [(1, 1, 0), (1, 2, 1)]:\n xx = 3*rr*rr*ss*ss - uu**4; yy = uu*(rr**4 - 45*ss**4); zz = rr*ss*(5*uu**8 + 30*uu**4*rr*rr*ss*ss + 9*rr**4*ss**4)\n print(' (u,r,s)=%s -> (x,y,z)=(%d,%d,%d), x^5+y^4-3z^2=%d' % ((uu, rr, ss), xx, yy, zz, xx**5 + yy**4 - 3*zz*zz))\n" }, { "path": "anc/code/1.2.6/1.2.6c_local_test.py", "size_bytes": 3118, "sha256": "54ede765a6e33577bcc2a1f31a8970de84fa3910be4f756012748e41827bd58c", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.6c -- pointwise local test for X = sigma q^2: classes of (X - rho, X - tau) over Q_2 and Q_3 (q sampled mod 2^10,\n# 2^6, 3^6 and the reciprocal balls), the 256 pairs allowed by the norm condition, survivors. Reviewer P2 script c3local.py.\n# Run from this folder: python3 -I 1.2.6c_local_test.py\n# Independent recomputation of the pointwise local square-class test (Section 3.3)\n# K = Q(e), e^2=e+1. Elements as (a,b) = a + b e with integer (or Fraction) coords.\nfrom fractions import Fraction as Fr\nfrom itertools import product\ndef mul(x,y):\n a,b=x; c,d=y\n return (a*c+b*d, a*d+b*c+b*d)\ndef vp(n,p):\n n=Fr(n)\n if n==0: return 10**9\n v=0; num,den=n.numerator,n.denominator\n while num%p==0: num//=p; v+=1\n while den%p==0: den//=p; v-=1\n return v\ndef val(x,p): # p inert in K (2,3)\n return min(vp(x[0],p),vp(x[1],p))\ndef modint(fr,m):\n fr=Fr(fr); return (fr.numerator*pow(fr.denominator,-1,m))%m\n# unit squares mod 8 in Z[e]/8\nU8=[(a,b) for a in range(8) for b in range(8) if (a*a+a*b-b*b)%2==1]\ndef mulm(x,y,m): \n z=mul(x,y); return (z[0]%m,z[1]%m)\nSQ8=set(mulm(u,u,8) for u in U8)\ndef cls2(x):\n v=val(x,2); u=(Fr(x[0])/2**v, Fr(x[1])/2**v)\n um=(modint(u[0],8),modint(u[1],8))\n coset=min(mulm(um,s,8) for s in SQ8)\n return (v%2,coset)\n# F9 squares\nU3=[(a,b) for a in range(3) for b in range(3) if (a,b)!=(0,0)]\nSQ3=set(mulm(u,u,3) for u in U3)\ndef cls3(x):\n v=val(x,3); u=(Fr(x[0])/3**v, Fr(x[1])/3**v)\n um=(modint(u[0],3),modint(u[1],3))\n return (v%2, um in SQ3)\nrho=(-21,12); tau=(-3,6); d=(-1,2) # d=2e-1\ndef sub(x,y): return (x[0]-y[0],x[1]-y[1])\ndef localimage(p,sigma,N):\n cls = cls2 if p==2 else cls3\n S=set()\n for q in range(N): # q in Z_p, sampled mod N=p^k\n X=(sigma*q*q,0)\n if q==0: continue\n S.add((cls(sub(X,rho)),cls(sub(X,tau))))\n for vv in range(0,N,p): # q=1/vv non-integral, square-equivalent factors sigma - r vv^2\n if vv==0: vv=N*p # representative of the ball p^k Z_p\n S.add((cls((sigma-rho[0]*vv*vv, -rho[1]*vv*vv)), cls((sigma-tau[0]*vv*vv, -tau[1]*vv*vv))))\n return S\ngens=[(-1,0),(0,1),(2,0),(3,0),d]\ndef prodmask(m):\n z=(1,0)\n for i in range(5):\n if m>>i&1: z=mul(z,gens[i])\n return z\ndef norm(x): return x[0]**2+x[0]*x[1]-x[1]**2\nfrom sympy import factorint\ndef issq_rat(n):\n n=Fr(n)\n if n<=0: return False\n import math\n a,b=n.numerator,n.denominator\n return math.isqrt(a)**2==a and math.isqrt(b)**2==b\nfor sigma in (1,-1):\n L2=localimage(2,sigma,2**10); L2b=localimage(2,sigma,2**6)\n L3=localimage(3,sigma,3**6)\n print(\"sigma\",sigma,\"local image sizes at 2:\",len(L2),\"(coarse\",len(L2b),\") at 3:\",len(L3))\n cand=[(m1,m2) for m1 in range(32) for m2 in range(32) if issq_rat(sigma*norm(prodmask(m1))*norm(prodmask(m2)))]\n c2=[(m1,m2) for (m1,m2) in cand if (cls2(prodmask(m1)),cls2(prodmask(m2))) in L2]\n c3=[(m1,m2) for (m1,m2) in c2 if (cls3(prodmask(m1)),cls3(prodmask(m2))) in L3]\n print(\" norm cond:\",len(cand),\" after 2:\",len(c2),\" after 3:\",len(c3), \" survivors:\",c3, [ (prodmask(a),prodmask(b)) for a,b in c3])\n" }, { "path": "anc/code/1.2.6/1.2.6d_kummer.gp", "size_bytes": 1268, "sha256": "6a078750a5729a748d3e2ac2d09005f8ba779f630c08b85c6caaa5e52ceb615b", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.6d -- independence of the Kummer images of P_i and the 2-torsion; delta(P1) ~ (2e,6), delta(T0) ~ (-e, 3 sqrt5).\n\\\\ Reviewer P2 script c3kum.gp. Run from this folder: gp -q 1.2.6d_kummer.gp\nK = nfinit(y^2-y-1); e = Mod(y, y^2-y-1);\nrho=-21+12*e; tau=-3+6*e;\nissqK(a) = #nfroots(K, x^2 - lift(a)) > 0;\ndelta(P, r1, r2) = if(P==[0], [1,1], if(P[1]==0, [r1*r2, -r1], if(P[1]==r1, [r1, r1*(r1-r2)], [P[1], P[1]-r1])));\nchk(name, r1, r2, P) = {\n my(T0=[0,0], T1=[r1,0], T2=[r2,0], dP=delta(P,r1,r2), dT0=delta(T0,r1,r2), dT1=delta(T1,r1,r2));\n for(a=0,1, for(b=0,1, for(c=0,1, if(a+b+c==0, next);\n my(v = [dP[1]^a*dT0[1]^b*dT1[1]^c, dP[2]^a*dT0[2]^b*dT1[2]^c]);\n if(issqK(v[1]) && issqK(v[2]), print(name, \" dependent combination \", [a,b,c])))));\n print(name, \": independence check done; delta(P)=\", dP);\n}\n\\\\ E1: roots r1=-2e rho, r2=2e tau\nchk(\"E1\", -2*e*rho, 2*e*tau, [18*e, 72]);\nchk(\"E2\", e*rho, e*tau, [1-2*e, 5-5*e]);\n\\\\ lifted classes: E1 lift has delta=(2e,6); check delta(P1)/(2e,6) is square pair\nd1 = delta([18*e,72], -2*e*rho, 2*e*tau); print(\"E1: delta(P1)*(2e,6) squares? \", [issqK(d1[1]*2*e), issqK(d1[2]*6)]);\nd2 = delta([0,0], e*rho, e*tau); print(\"E2: delta(T0)*(-e,3d) squares? \", [issqK(d2[1]*(-e)), issqK(d2[2]*3*(2*e-1))]);\nquit\n" }, { "path": "anc/code/1.2.6/1.2.6d_rank_simon.gp", "size_bytes": 1652, "sha256": "bc7918a94c21e33d872a927330bd23ca44b52b09bfef79ac84bd899c61c01f23", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.6d -- Simon's bnfellrank for E0, E1, E2 over K = Q(sqrt5) (e^2 = e+1), torsion, P1 on E1, P2 on E2.\n\\\\ Reviewer P2 script c3rank.gp (two comment lines fixed, see README). Run from this folder: gp -q 1.2.6d_rank_simon.gp\n\\\\ [bundle] Denis Simon's ell.gp from ../common/simon_ell/, loaded with the reviewer's parameters\n\\\\ (the original had a stray second line \" simon_hdr.gp\", deleted):\nDEBUGLEVEL_ell=0; LIM1=2; LIM3=4; LIMTRIV=2; MAXPROB=20; LIMBIGPRIME=30;\n\\r ../common/simon_ell/ell.gp\n\\r ../common/simon_ell/qfsolve.gp\n\\r ../common/simon_ell/resultant3.gp\nK = bnfinit(y^2-y-1,1);\nif(bnfcertify(K)!=1, error(\"bnfcertify failed\")); print(\"bnfcertify(K) = 1 (class group and units of K proved, so the descent below is unconditional)\");\ne = Mod(y,K.pol);\nrho = -21+12*e; tau = -3+6*e;\nprint(\"rho^2+30rho+45=\",rho^2+30*rho+45, \" tau^2-45=\",tau^2-45);\nE0 = [0, tau-rho, 0, -rho*tau, 0];\nE1 = [0, 2*e*rho-2*e*tau, 0, -4*e^2*rho*tau, 0];\nE2 = [0, -e*rho-e*tau, 0, e^2*rho*tau, 0];\nfor(i=1,3, E=[E0,E1,E2][i]; t0=getwalltime(); r=bnfellrank(K,E); print(\"E\",i-1,\": [r,s]=\",r[1..2],\" pts=\",r[3], \" ms=\",getwalltime()-t0));\n\\\\ torsion via PARI [bundle fix: this and the next comment had a single backslash, which gp reads as\n\\\\ the metacommands \\t and \\c and prints the list of types and of functions]\nnf=K.nf;\nfor(i=1,3, E=[E0,E1,E2][i]; Ei=ellinit(apply(z->lift(z),E),nf); print(\"E\",i-1,\" torsion: \",elltors(Ei)[1..2]));\n\\\\ check P1,P2 on curves\nE1i=ellinit(apply(z->lift(z),E1),nf); E2i=ellinit(apply(z->lift(z),E2),nf);\nP1=[18*y,72]; P2=[1-2*y,5-5*y];\nprint(\"P1 on E1: \", ellisoncurve(E1i,P1), \" P2 on E2: \", ellisoncurve(E2i,P2));\nquit\n" }, { "path": "anc/code/1.2.6/1.2.6d_reductions.gp", "size_bytes": 532, "sha256": "e3f9b8a5824d7ce5d269dcc6e05214def92edbb5f3d1652ed590b647cfa3daed", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.6d -- orders of E0, E1, E2 modulo the two primes above 11 and above 19 (e -> roots of e^2-e-1).\n\\\\ Writers' helper c3tors.gp. Run from this folder: gp -q 1.2.6d_reductions.gp\ncur(i,ev)={my(rho=-21+12*ev, tau=-3+6*ev, r1, r2);\n if(i==0, r1=rho; r2=-tau, if(i==1, r1=-2*ev*rho; r2=2*ev*tau, r1=ev*rho; r2=ev*tau));\n ellinit([0,-(r1+r2),0,r1*r2,0]);}\n{for(i=0,2, for(k=1,2, my(p=[11,19][k], rts=polrootsmod(x^2-x-1,p));\n print(\"E\",i,\" p=\",p,\" roots \",lift(rts~),\" orders \", vector(2,j, ellcard(cur(i,rts[j]))))));}\nquit\n" }, { "path": "anc/code/1.2.6/1.2.6e_coset_sieves.py", "size_bytes": 2809, "sha256": "af3228e2ab19cbaccbd8eba6aeabb0cb296ca7f91fe9e163d5b00cbc1d3ce1c6", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.6e -- coset sieves: E1 at 89 (coset P1 + 2H1) and E2 at 11 (coset T0 + 2H2), all X mod p and both ordinates.\n# Reviewer P2 script c3sieve.py (pure Python). Run from this folder: python3 -I 1.2.6e_coset_sieves.py\n# Independent sieve for E1 at 89 and E2 at 11 (Section 3.5)\ndef curve_coeffs(which, ev, p):\n rho=(-21+12*ev)%p; tau=(-3+6*ev)%p\n if which==1: # xi(xi+2e rho)(xi-2e tau)\n r1=(-2*ev*rho)%p; r2=(2*ev*tau)%p\n else: # xi(xi-e rho)(xi-e tau)\n r1=(ev*rho)%p; r2=(ev*tau)%p\n a2=(-(r1+r2))%p; a4=(r1*r2)%p\n return a2,a4,r1,r2\ndef add(P,Q,a2,a4,p):\n if P is None: return Q\n if Q is None: return P\n x1,y1=P; x2,y2=Q\n if x1==x2:\n if (y1+y2)%p==0: return None\n l=(3*x1*x1+2*a2*x1+a4)*pow(2*y1,-1,p)%p\n else:\n l=(y2-y1)*pow(x2-x1,-1,p)%p\n x3=(l*l-a2-x1-x2)%p; y3=(-y1+l*(x1-x3))%p\n return (x3,y3)\ndef neg(P,p): return None if P is None else (P[0],(-P[1])%p)\ndef points(a2,a4,p):\n pts=[None]\n for x in range(p):\n r=(x**3+a2*x*x+a4*x)%p\n for y in range(p):\n if y*y%p==r: pts.append((x,y))\n return pts\ndef gen_subgroup(gens, addf, zero):\n S={zero}; frontier=[zero]\n while frontier:\n nf=[]\n for s in frontier:\n for g in gens:\n t=addf(s,g)\n if t not in S: S.add(t); nf.append(t)\n frontier=nf\n return S\ndef run(which,p,evs,Pglob,lam,coset_base):\n data=[curve_coeffs(which,ev,p) for ev in evs]\n orders=[len(points(a2,a4,p)) for a2,a4,_,_ in data]\n def addprod(A,B): return tuple(add(A[i],B[i],data[i][0],data[i][1],p) for i in range(2))\n zero=(None,None)\n T0=((0,0),(0,0)); T1=((data[0][2],0),(data[1][2],0))\n Pr=tuple(((Pglob[0][0]+Pglob[0][1]*ev)%p, (Pglob[1][0]+Pglob[1][1]*ev)%p) for ev in evs)\n gens=[T0,T1]+([Pr] if Pglob else [])\n H=gen_subgroup(gens,addprod,zero)\n twoH=set(addprod(h,h) for h in H)\n base = Pr if coset_base=='P' else T0\n coset=set(addprod(base,h) for h in twoH)\n print(f\"E{which} p={p} orders={orders} |H|={len(H)} index={orders[0]*orders[1]//len(H)} |coset|={len(coset)} (O,O) in coset: {zero in coset}\")\n surv=[]\n for X in range(p):\n fibers=[]\n for i,ev in enumerate(evs):\n a2,a4,_,_=data[i]; xi=(lam(ev)*X)%p\n r=(xi**3+a2*xi*xi+a4*xi)%p\n ys=[y for y in range(p) if y*y%p==r]\n fibers.append([(xi,y) for y in ys])\n for A in fibers[0]:\n for B in fibers[1]:\n if (A,B) in coset: surv.append((X,A,B))\n print(\" survivors:\",surv)\n return data,Pr\n# E1 at 89: e -> 10, 80 ; P1=(18e,72); lambda=-2e\nrun(1,89,[10,80],((0,18),(72,0)),lambda ev:-2*ev,'P')\n# E2 at 11: e -> 4, 8 ; P2=(1-2e,5-5e); lambda=e ; coset T0+2H\nrun(2,11,[4,8],((1,-2),(5,-5)),lambda ev:ev,'T')\n" }, { "path": "anc/code/1.2.6/1.2.6f_constants.py", "size_bytes": 860, "sha256": "57a1501caa404518d6df6451eb57a2787ae513d8404b1d9c5883aa31cce3624e", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.6f -- the constant coefficients of the pulled-back differential at the centres and their dot products with\n# the annihilators c_1 (mod 89) and c_2 (mod 11). Last part of a helper script w8_checks.py (pure arithmetic).\n# Run from this folder: python3 -I 1.2.6f_constants.py\n# Chabauty constants\np = 89; inv144 = pow(144, -1, p)\nco = [(-2*ev*inv144) % p for ev in (10, 80)]\nprint('E1 at 89: lambda1/144 in the two embeddings =', co, '; c1.(.) =', (11*co[0] + 2*co[1]) % p, (-(11*co[0] + 2*co[1])) % p)\np = 11\nout = []\nfor W1 in (1, -1):\n for W2 in (1, -1):\n co = [(-ev*pow(Wv, -1, p)) % p for ev, Wv in ((4, W1), (8, W2))]\n out.append((10*co[0] + 4*co[1]) % p)\nprint('E2 at 11: c2.(-e/W) for W=(1,1),(1,-1),(-1,1),(-1,-1):', out)\nprint('c1 from (2490,2948):', (2948 % 89, (-2490) % 89), ' c2 from (117,76):', (76 % 11, (-117) % 11))\n" }, { "path": "anc/code/1.2.6/1.2.6f_logs.gp", "size_bytes": 1324, "sha256": "7b78b96c56663be8dea80b7060063d3cd8f29a3b43c336bc81f357ecf5c544d0", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.6f -- p-adic logarithms of P1 (89-adic) and P2 (11-adic) via ellformallog, precision p^8. Reviewer P2 script c3log.gp.\n\\\\ Run from this folder: gp -q 1.2.6f_logs.gp\n\\\\ p-adic elliptic logs and Chabauty derivatives for E1 (p=89) and E2 (p=11)\nN = 8;\nformlog(E, t) = {my(L = ellformallog(E, 12, 'w)); subst(truncate(L), 'w, t);}\nplog(E, P, p) = {my(n, Q, t);\n \\\\ order of P mod p: find n with [n]P in formal group\n n = 1; Q = P; while(!(type(Q)==\"t_VEC\" && #Q==2 && valuation(Q[1],p) < 0), n++; Q = elladd(E, Q, P); if(Q==[0], error(\"hit O\")));\n t = -Q[1]/Q[2];\n [n, formlog(E,t)/n];\n}\ndoit(which, p, Pc, lam) = {\n my(roots = polrootspadic(x^2-x-1, p, N), res=vector(2), ev, rho, tau, r1, r2, E, P);\n for(i=1,2, ev = roots[i]; rho=-21+12*ev; tau=-3+6*ev;\n if(which==1, r1=-2*ev*rho; r2=2*ev*tau, r1=ev*rho; r2=ev*tau);\n E = ellinit([0,-(r1+r2),0,r1*r2,0]);\n P = [Pc[1][1]+Pc[1][2]*ev, Pc[2][1]+Pc[2][2]*ev];\n if(!ellisoncurve(E,P), error(\"not on curve\"));\n my(nl = plog(E,P,p));\n res[i] = [ev + O(p^3), nl[1], nl[2]/p + O(p^2)];\n );\n res;\n}\nr1 = doit(1, 89, [[0,18],[72,0]], 0);\nprint(\"E1 at 89: [e mod p^3, n, log/p mod p^2] = \", apply(v->[lift(v[1]), v[2], lift(v[3])], r1));\nr2 = doit(2, 11, [[1,-2],[5,-5]], 0);\nprint(\"E2 at 11: \", apply(v->[lift(v[1]), v[2], lift(v[3])], r2));\nquit\n" }, { "path": "anc/code/1.2.7/1.2.7a_identities.py", "size_bytes": 1556, "sha256": "08a283f6bbfae951114667c4bf77fc98e5beda83a34c444d0f25368fee36f258", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.7a -- algebraic identities of the descent: (a+b sqrt(-3))^5, F mod 16 for a = -5u^2, N(alpha) = r^4+15r^2s^2+45s^4,\n# the map to H: Y^2 = f(X), and f(-1), f(-1/3). Section '1.2.7' of a helper script w8_checks.py (SymPy), without its\n# last loop (the #J(F_p) formula, now computed in 1.2.7c_point_counts.gp). Run from this folder: python3 -I 1.2.7a_identities.py\nfrom sympy import symbols, sqrt, expand, simplify, Rational as R, together, factor\nfrom math import gcd\n\na, b, c, Y, Z, X, t, u, r, s, sg, q = symbols('a b c Y Z X t u r s sigma q')\n\nprint('== 1.2.7 (x^5+y^4+3z^2) ==')\nd0 = sqrt(-3)\nex = expand((a + b*d0)**5)\nprint('(a+b sqrt(-3))^5 =', factor(ex.coeff(d0, 0)), ' + sqrt(-3)*', factor(ex.coeff(d0, 1)))\nF = a**4 - 30*a**2*b**2 + 45*b**4\ns16 = sorted({(F.subs({a: -5*uu*uu, b: bb})) % 16 for uu in range(32) for bb in range(32) if (5*uu*uu + bb) % 2 == 1})\nprint('F mod 16 when a=-5u^2, a+b odd:', s16, ' -5c^2 mod 16:', sorted({(-5*cc*cc) % 16 for cc in range(16)}))\nprint(' (a even forces u even, hence 4|a:', all((5*uu*uu) % 4 == 0 for uu in range(0, 64, 2)), ')')\nd = sqrt(5)\nalpha = r**2 + (15 + 3*d)/2*s**2\nprint('N(alpha) - (r^4+15r^2s^2+45s^4):', simplify(expand(alpha*alpha.subs(d, -d)) - (r**4 + 15*r**2*s**2 + 45*s**4)))\nBv = symbols('B'); tt = symbols('t')\nXv = 9*tt**2; rB2 = 9*tt**4 - 30*tt**2 + 5; uB2 = 9*tt**4 - 5\nprint('Y^2 - f(X) for (2.11):', simplify(729*tt**2*rB2*uB2 - Xv*(Xv**2 - 30*Xv + 45)*(Xv**2 - 45)))\nfX = lambda x: x*(x*x - 30*x + 45)*(x*x - 45)\nprint('f(-1) =', fX(-1), ' f(-1/3) =', fX(R(-1, 3)))\n" }, { "path": "anc/code/1.2.7/1.2.7a_mod16.py", "size_bytes": 1475, "sha256": "cd75ae915450aae6c47c09c2997af0cf41f92fb76d541bc9970c60d9f6fd0e3b", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.7a -- the congruences mod 16 of the descent (F for a = -5u^2, c^2 for u even, the negative case, and the\n# right-hand side of C by parity). Reviewer P1 script mod16.py (pure Python). Run from this folder: python3 -I 1.2.7a_mod16.py\n# Ch.2 congruence claims\nS=set()\nfor u in range(64):\n for b in range(64):\n a=-5*u*u\n if (a-b)%2==0: continue\n from math import gcd\n S.add((a**4-30*a*a*b*b+45*b**4)%16)\nprint('F mod16 with a=-5u^2, opposite parity:',sorted(S),' -5c^2 mod16:',sorted({(-5*c*c)%16 for c in range(16)}))\n# general opposite parity (no a=-5u^2 restriction)\nprint('F mod16 general opposite parity:',sorted({(a**4-30*a*a*b*b+45*b**4)%16 for a in range(32) for b in range(32) if (a-b)%2}))\n# u even case: a=u^2 even, b odd => c^2 = F mod 16\nprint('c^2=F, u even, b odd:',sorted({(u**8-30*u**4*b*b+45*b**4)%16 for u in range(0,32,2) for b in range(1,32,2)}),' squares:',sorted({c*c%16 for c in range(16)}))\n# negative case\nprint('neg case RHS mod16:',sorted({(-5*r**4+15*r*r*s*s-9*s**4)%16 for r in range(32) for s in range(32) if (r+s)%2==1}),' u^4 odd:',sorted({u**4%16 for u in range(1,32,2)}))\n# Lemma 2.1: u^4=r^4+15r^2s^2+45s^4 with (r,s) not both even\nfor (pr,ps) in ((1,1),(0,1),(1,0)):\n vals={(r**4+15*r*r*s*s+45*s**4)%16 for r in range(pr,64,2) for s in range(ps,64,2)}\n print('parity r,s',pr,ps,'RHS mod16',sorted(vals))\nprint('r odd, s=2 mod 4:',sorted({(r**4+15*r*r*s*s+45*s**4)%16 for r in range(1,64,2) for s in range(2,64,4)}))\n" }, { "path": "anc/code/1.2.7/1.2.7b_selmer_J.py", "size_bytes": 3548, "sha256": "14f0e6fb3196eb55bf5a211a536ee3f16c33099eb96a0fd06bf98203d0745526", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.2.7b -- 2-Selmer bound for J = Jac(H), H: Y^2 = X(X^2-30X+45)(X^2-45): Kummer classes in Q x K x K (K = Q(sqrt5)),\n# local images at 2, 3, 5 by Hilbert-symbol labels (asserting sizes 16, 4, 4; seed 2), and the 1024 global candidates.\n# Reviewer P1 script sel2J.py (cypari2). Run from this folder: python3 -I 1.2.7b_selmer_J.py\n# Independent 2-Selmer bound for J = Jac(H), H: Y^2 = X(X^2-30X+45)(X^2-45) (Chapter 2, Prop 2.1)\nimport cypari2, random\nfrom fractions import Fraction as Fr\nP = cypari2.Pari(); P.allocatemem(200*10**6)\nP('K = nfinit(y^2-5); md = y^2-5; th2 = Mod(15+6*y,md); th3 = Mod(3*y,md)')\nprint('th2 root:', P('th2^2-30*th2+45'), ' th3 root:', P('th3^2-45'))\nprint('disc f =', P('factor(poldisc(x*(x^2-30*x+45)*(x^2-45)))'))\nprint('K: h =', P('bnfinit(y^2-5).no'), ' fu =', P('bnfinit(y^2-5).fu'))\nfor p in (2,3,5): print('p',p,'dec in K:', P(f'[ [pr.e,pr.f] | pr <- idealprimedec(K,{p})]'))\nprs={2:'idealprimedec(K,2)[1]',3:'idealprimedec(K,3)[1]',5:'idealprimedec(K,5)[1]'}\ncandsQ=['-1','2','3','5','7','11','13']\ncandsK=['-1','(1+y)/2','2','3','y','1+2*y','(3+y)/2','7','(1+3*y)/2','1+4*y','(5+3*y)/2','11','13','(7+y)/2']\ndef hQ(a,b,p): return 0 if int(P(f'hilbert({a},{b},{p})'))==1 else 1\ndef hK(a,b,p): return 0 if int(P(f'nfhilbert(K,lift(Mod({a},md)),lift(Mod({b},md)),{prs[p]})'))==1 else 1\ndef rank2(M):\n M=[row[:] for row in M]; r=0\n for c in range(len(M[0])):\n piv=next((i for i in range(r,len(M)) if M[i][c]),None)\n if piv is None: continue\n M[r],M[piv]=M[piv],M[r]\n for i in range(len(M)):\n if i!=r and M[i][c]: M[i]=[x^y for x,y in zip(M[i],M[r])]\n r+=1\n return r\nfor p in (2,3,5):\n gQ=rank2([[hQ(a,b,p) for b in candsQ] for a in candsQ])\n gK=rank2([[hK(a,b,p) for b in candsK] for a in candsK])\n print('p',p,'Gram rank Q_p',gQ,' K_p',gK)\n assert gQ==(3 if p==2 else 2) and gK==(4 if p==2 else 2)\ndef lab(tr,p):\n return tuple(hQ(tr[0],b,p) for b in candsQ)+tuple(hK(tr[1],b,p) for b in candsK)+tuple(hK(tr[2],b,p) for b in candsK)\ndef span(vecs):\n S={tuple([0]*len(vecs[0]))}\n for v in vecs: S|={tuple(a^b for a,b in zip(s,v)) for s in S}\n return S\nv0=('(-2025)','(-th2)','(-th3)')\nv1=('45','(-th2*(th2^2-45))','(th3^2-30*th3+45)')\nfX=lambda X: X*(X*X-30*X+45)*(X*X-45)\ndef issqQp(r,p):\n r=Fr(r)\n if r==0: return False\n return int(P(f'issquare({r.numerator*r.denominator}+O({p}^30))'))==1\nexpected={2:16,3:4,5:4}\nloc={}\nrandom.seed(2)\nfor p in (2,3,5):\n gens=[lab(v0,p),lab(v1,p)]; S=span(gens)\n print('p',p,'torsion span size',len(S))\n tries=0\n xs=[Fr(-1),Fr(-1,3)]+[Fr(random.randint(-200,200),random.choice([1,2,3,4,5,8,9,16,25,27])) for _ in range(3000)]\n for X in xs:\n if len(S)>=expected[p]: break\n tries+=1\n fx=fX(X)\n if fx==0 or not issqQp(fx,p): continue\n tr=(f'({X})',f'({X}-th2)',f'({X}-th3)')\n v=lab(tr,p)\n if v not in S: gens.append(v); S=span(gens); print(' p',p,'new point X=',X)\n print('p',p,'local image size',len(S),'expected',expected[p]); assert len(S)==expected[p]\n loc[p]=S\nBk=['(-1)','((1+y)/2)','2','3','y']\ndef g(m):\n s='1'\n for j in range(5):\n if m>>j&1: s+='*'+Bk[j]\n return s\nsurv=[]\nfor a in range(32):\n for b in range(32):\n nq=P(f'norm(Mod({g(a)},md))*norm(Mod({g(b)},md))')\n # q = squarefree part of nq\n q=P(f'core({nq})')\n tr=(f'({q})',g(a),g(b))\n if all(lab(tr,p) in loc[p] for p in (2,3,5)): surv.append((a,b,int(q)))\nprint('Selmer survivors (a,b,q):',surv)\n" }, { "path": "anc/code/1.2.7/1.2.7c_point_counts.gp", "size_bytes": 1113, "sha256": "f095fa01a3b21f7ea7eabfaef0489844d73611564ce56aa9bd9fc8b893961519", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.2.7c -- #J(F_p) from hyperellcharpoly, #H(F_p) and (added) #H(F_{p^2}) by direct count, and the formula\n\\\\ #J(F_p) = (#H(F_p)^2 + #H(F_{p^2}))/2 - p. Reviewer P1 script jcount.gp plus added lines. Run: gp -q 1.2.7c_point_counts.gp\nf=x*(x^2-30*x+45)*(x^2-45);\nfor(i=1,6, p=prime(i+3); cp=hyperellcharpoly(Mod(1,p)*f); print(\"p=\",p,\" #J(F_p)=\",subst(cp,x,1), \" #H(F_p)=\", p+1-polcoeff(cp,3)*(-1)));\n\\\\ direct count\ncnt(p)=1+sum(X=0,p-1, 1+kronecker(lift(Mod(subst(f,x,X),p)),p));\nfor(i=1,3,p=[7,11,13][i]; print(\"direct #H(F_\",p,\")=\",cnt(p)));\n\\\\ [added for the bundle] direct count of #H(F_{p^2}) (one point at infinity, deg f = 5) and the formula\n\\\\ #J(F_p) = (#H(F_p)^2 + #H(F_{p^2}))/2 - p, compared with the characteristic polynomial\ncnt2(p)={my(a=ffgen(p^2,'a), n=1); for(i=0,p^2-1, my(X=subst(Pol(digits(i,p)),'x,a)*a^0, v=subst(f,x,X)); n += if(v==0, 1, if(issquare(v), 2, 0))); n};\n{foreach([7,11,13], p, my(h1=cnt(p), h2=cnt2(p), cp=hyperellcharpoly(Mod(1,p)*f));\n print(\"p=\",p,\" #H(F_p)=\",h1,\" #H(F_p^2)=\",h2,\" (h1^2+h2)/2-p=\",(h1^2+h2)/2-p,\" #J(F_p) from charpoly=\",subst(cp,x,1)));}\nquit\n" }, { "path": "anc/code/1.3.1/1.3.1a_field_F.gp", "size_bytes": 1330, "sha256": "071102a21a50195c4ad279f28867933f3b3ae64a7a263ca94636b9e537393177", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.3.1a -- F = Q(alpha), alpha^3+alpha+1 = 0: disc, signature, h (certified), fundamental unit, the factorisation of 31,\n\\\\ norms, the identity (y - alpha x) G(x,y) = y^3 + x^2 y + x^3, G(x, alpha x), (t - alpha) g(t). Reviewer P4 script a1.gp without\n\\\\ its last lines (they failed in PARI 2.15; 1.3.1a_powers.gp does those checks). Run from this folder: gp -q 1.3.1a_field_F.gp\ndefault(parisize,\"200M\");\nf = x^3+x+1;\nbnf = bnfinit(f,1);\nprint(\"disc \", nfdisc(f), \" sign \", bnf.sign, \" h \", bnf.no, \" cyc \", bnf.cyc);\nprint(\"bnfcertify \", bnfcertify(bnf));\nprint(\"fu \", bnf.fu, \" tu \", bnf.tu);\nu = Mod(x, f);\nprint(\"isunit alpha: \", bnfisunit(bnf, x));\nprint(\"norm alpha \", norm(u));\nprint(\"fact 31 \", idealfactor(bnf, 31));\nA = 3*x^2+1; print(\"N(A)=\", norm(Mod(A,f)), \" fact(A) \", idealfactor(bnf,A));\nprint(\"N(alpha-3)=\", norm(Mod(x-3,f)), \" N(3a^2+4)=\", norm(Mod(3*x^2+4,f)), \" N(3a^2+a+1)=\", norm(Mod(3*x^2+x+1,f)));\nprint(\"fact(3a^2+4) \", idealfactor(bnf, 3*x^2+4));\nprint(\"fact(3a^2+a+1) \", idealfactor(bnf, 3*x^2+x+1));\n\\\\ check G identity\nG(X,Y) = Y^2 + Mod(x,f)*X*Y + (Mod(x,f)^2+1)*X^2;\nprint(\"identity: \", lift((Y - Mod(x,f)*X)*G(X,Y)) - (Y^3+X^2*Y+X^3));\nprint(\"G(X, aX) = \", lift(G(X, Mod(x,f)*X)));\nnf = bnf.nf;\ng(t) = t^2 + Mod(x,f)*t + Mod(x,f)^2 + 1;\nprint(\"(t-a)g(t) = \", lift((t-Mod(x,f))*g(t)));\nquit\n" }, { "path": "anc/code/1.3.1/1.3.1a_powers.gp", "size_bytes": 916, "sha256": "7f110aac393856e20d431b4f02f5a869738da8a40ff09e2a081ddd10773d78cb", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.3.1a -- +-alpha^k (k = 0..3): squares and fourth powers, distinct mod fourth powers; g has no root in F;\n\\\\ +-(3a^2+4), +-(3a^2+a+1) not squares. Reviewer P4 script a1b.gp. Run from this folder: gp -q 1.3.1a_powers.gp\nf = y^3+y+1; nf = nfinit(f);\nisp(e,k) = #nfroots(nf, x^k - lift(e))>0;\nfor(k=0,3, for(s=-1,1, if(s==0,next); e = s*Mod(y,f)^k; print(\"s=\",s,\" k=\",k,\" square? \", isp(e,2), \" 4th? \", isp(e,4))));\nL=List(); for(k=0,3, for(s=-1,1, if(s==0,next); listput(L, s*Mod(y,f)^k)));\ncnt=0; for(i=1,8, for(j=i+1,8, r=L[i]/L[j]; if(isp(r,4), cnt++))); print(\"pairs equal mod 4th powers: \", cnt);\nprint(\"roots of g in F: \", nfroots(nf, x^2 + y*x + y^2+1));\nprint(\"-(3a^2+4) sq: \", isp(-(3*y^2+4),2), \" (3a^2+4) sq: \", isp(3*y^2+4,2));\nprint(\"-(3a^2+a+1) sq: \", isp(-(3*y^2+y+1),2), \" (3a^2+a+1) sq: \", isp(3*y^2+y+1,2));\nprint(\"a+1 = -a^3: unit; (a+1) 4th? \", isp(y+1,4), \" -(a+1) sq? \", isp(-(y+1),2));\n" }, { "path": "anc/code/1.3.1/1.3.1b_local_exclusion.py", "size_bytes": 1715, "sha256": "40f6423b4a65d85183a5b4dfe247ad8134699353c944aa6cd708c9d53147e6d9", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.1b -- residues (x, y) mod p^n with x*eps a fourth power, (x,y) not both 0 mod p, and y - alpha x in\n# delta * (fourth powers of O_F/p^n): none for (p,n,k) = (3,1,3), (3,2,3), (13,1,2); controls. Reviewer P4 script loc.py.\n# Run from this folder: python3 -I 1.3.1b_local_exclusion.py (any argument adds the case (13,2,2); slow)\nimport itertools, sys\ndef mul(u,v,m):\n # (u0+u1 a+u2 a^2)(v0+v1 a+v2 a^2), a^3=-a-1, a^4=-a^2-a\n c=[0]*5\n for i in range(3):\n for j in range(3):\n c[i+j]+=u[i]*v[j]\n # reduce a^4 = -a^2 - a ; a^3 = -a - 1\n c2=c[2]-c[4]; c1=c[1]-c[4]-c[3]; c0=c[0]-c[3]\n return (c0%m,c1%m,c2%m)\ndef pw(u,e,m):\n r=(1,0,0)\n for _ in range(e): r=mul(r,u,m)\n return r\ndef run(p,n,k):\n m=p**n\n elems=list(itertools.product(range(m),repeat=3))\n f4=set(pw(b,4,m) for b in elems)\n z4=set(pow(a,4,m) for a in range(m))\n res={}\n for s in (1,-1):\n delta=tuple((s*c)%m for c in pw((0,1,0),k,m))\n eps=s*(-1)**k\n dset=set(mul(delta,b,m) for b in f4)\n sols=[]\n for x in range(m):\n if (x*eps)%m not in z4: continue\n for yv in range(m):\n if x%p==0 and yv%p==0: continue\n el=(yv%m,(-x)%m,0)\n if el in dset: sols.append((x,yv))\n res[s]=sols\n return res\nfor (p,n,k) in [(3,1,3),(3,2,3),(13,1,2),(13,2,2) if len(sys.argv)>1 else (13,1,2)]:\n r=run(p,n,k)\n print(p,n,\"k=\",k,{s:len(v) for s,v in r.items()}, {s:v[:6] for s,v in r.items()})\n# controls: k=0,1 at p=3,13 should have solutions\nfor (p,n,k) in [(3,2,0),(3,2,1),(13,1,0),(13,1,1),(3,2,2),(13,1,3)]:\n r=run(p,n,k); print(\"control\",p,n,\"k=\",k,{s:len(v) for s,v in r.items()})\n" }, { "path": "anc/code/1.3.1/1.3.1c_conic_quartic.gp", "size_bytes": 1569, "sha256": "82403b69eed05b86d7015954a3777f1011741788e554df21a94c5946497c0799", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.3.1c -- the conic parametrisation of U^2 = -alpha g(t), Q(m) and Q(m0) = V0^2, the monic quartic in s after m = m0 + 1/s,\n\\\\ its Weierstrass model W^2 = X^3 + k1 X (a2 = a6 = 0, k1 = bd - 4e), and k1/(3a^2+a+1) = ((40a^2-4a+28)/31)^4.\n\\\\ Reviewer P4 script map1.gp (coefficient extraction fixed, see README). Run from this folder: gp -q 1.3.1c_conic_quartic.gp\nf = y^3+y+1; al = Mod(y,f);\ng(t) = t^2 + al*t + al^2 + 1;\n\\\\ conic U^2 = -al*g(t) through (0,1): t = -(al^2+2m)/(m^2+al), U=(-m^2-al^2*m+al)/(m^2+al)\ntm = -(al^2+2*m)/(m^2+al); Um = (-m^2-al^2*m+al)/(m^2+al);\nprint(\"conic check: \", simplify(Um^2 + al*g(tm)));\nQ = (-m^2 - al^2*m + al)*(m^2+al);\nm0 = -al^2/2; V0 = m0^2+al; print(\"Q(m0)-V0^2 = \", subst(Q,m,m0)-V0^2, \" t(m0)=\", subst(tm,m,m0));\nqs = subst(Q, m, m0+1/s)*s^4/V0^2; qs = simplify(qs);\nprint(\"monic quartic in s: \", qs);\n\\\\ [bundle fix] qs is a t_POLMOD in y whose coefficients contain s, so polcoeff(qs,k,s) returned wrong values\n\\\\ (the original printed b=c=d=0 and a garbled \"a4 - k1\"); take the coefficients of the lifted polynomial, as map2.gp does.\nqsl = lift(qs);\nb = Mod(polcoeff(qsl,3,s),f); c = Mod(polcoeff(qsl,2,s),f); d = Mod(polcoeff(qsl,1,s),f); e = Mod(polcoeff(qsl,0,s),f);\nprint(\"b=\",lift(b),\" c=\",lift(c),\" d=\",lift(d),\" e=\",lift(e));\na2 = c; a4 = b*d-4*e; a6 = d^2+b^2*e-4*c*e;\nprint(\"a2=\",a2,\" a4=\",lift(a4),\" a6=\",a6);\nk1 = (39936*al^2 - 205568*al + 169216)/29791;\nprint(\"a4 - k1 = \", a4-k1);\nprint(\"k1/(3a^2+a+1) = \", lift(k1/(3*al^2+al+1)), \" vs ((40a^2-4a+28)/31)^4 = \", lift(((40*al^2-4*al+28)/31)^4));\nquit\n" }, { "path": "anc/code/1.3.1/1.3.1c_identities.gp", "size_bytes": 2785, "sha256": "8836040118ed88d495a182e99030d6b13d0d9e2d43ec4f4c193c4fee627b97b2", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.3.1c (added for the bundle) -- the chain G1 <- quartic <-> E1 as exact identities, fast. Same formulas as a reviewer's\n\\\\ map1.gp / map2.gp / mapcheck.py; the polynomial variables are given higher priority than the field variable y, so that\n\\\\ coefficients are taken and reductions done in the right variable. Run from this folder: gp -q 1.3.1c_identities.gp\nt = varhigher(\"t\"); m = varhigher(\"m\"); s = varhigher(\"s\"); yq = varhigher(\"yq\"); X = varhigher(\"X\"); W = varhigher(\"W\");\nf = y^3+y+1; al = Mod(y,f);\ng(T) = T^2 + al*T + al^2 + 1;\nQ(M) = (-M^2 - al^2*M + al)*(M^2+al);\nm0 = -al^2/2; V0 = m0^2+al;\n\\\\ G1 -> conic: U = Y^2 on U^2 = -al g(t), parametrised by the line through (t,U) = (0,1); V = Y(m^2+al), V^2 = Q(m)\ntm = -(al^2+2*m)/(m^2+al); Um = (al-al^2*m-m^2)/(m^2+al);\nprint(\"conic: U(m)^2 + al g(t(m)) = \", Um^2 + al*g(tm), \" U(m)(m^2+al)^2 - Q(m) = \", Um*(m^2+al)^2 - Q(m));\nprint(\"Q(m0) - V0^2 = \", Q(m0)-V0^2, \" t(m0) = \", subst(tm,m,m0));\n\\\\ m = m0 + 1/s: monic quartic with zero s^2-coefficient\nqs = Q(m0+1/s)*s^4/V0^2;\nb = polcoef(qs,3,s); c = polcoef(qs,2,s); d = polcoef(qs,1,s); e = polcoef(qs,0,s);\nprint(\"quartic: type \", type(qs), \", degree \", poldegree(qs,s), \", leading coeff \", polcoef(qs,4,s), \", s^2-coeff \", c);\nprint(\"b = \", lift(b), \" d = \", lift(d), \" e = \", lift(e));\nA1 = b*d-4*e; a6 = d^2+b^2*e-4*c*e;\nk1 = (39936*al^2 - 205568*al + 169216)/29791;\nprint(\"Weierstrass model W^2 = X^3 + c X^2 + (bd-4e) X + (d^2+b^2e-4ce): c = \", c, \" bd-4e - k1 = \", A1-k1, \" a6 = \", a6);\nprint(\"k1/(3a^2+a+1) - ((40a^2-4a+28)/31)^4 = \", k1/(3*al^2+al+1) - ((40*al^2-4*al+28)/31)^4);\n\\\\ quartic (s, yq), yq^2 = qs -> E1 (X, W), and back\nredq(F) = {my(G = Pol(F, yq), r = 0); for(k=0, poldegree(G,yq), r += polcoef(G,k,yq)*if(k%2, yq*qs^((k-1)/2), qs^(k/2))); r};\ncub = X^3 + c*X^2 + A1*X + a6;\nredE(F) = {my(G = Pol(F, W), r = 0); for(k=0, poldegree(G,W), r += polcoef(G,k,W)*if(k%2, W*cub^((k-1)/2), cub^(k/2))); r};\nXs = 2*yq + 2*s^2 + b*s; Ws = (2*Xs + 2*c - b^2/2)*s + b*Xs/2 + d;\nprint(\"quartic -> E1 lands on E1: \", redq(Ws^2 - subst(cub, X, Xs)) == 0);\nsE = (W - b*X/2 - d)/(2*X + 2*c - b^2/2); yE = (X - 2*sE^2 - b*sE)/2;\nprint(\"E1 -> quartic lands on the quartic: \", redE(numerator(yE^2 - subst(qs, s, sE))) == 0);\nprint(\"quartic -> E1 -> quartic is the identity: \", [subst(subst(sE, X, Xs), W, Ws) == s, substvec(yE, [X, W], [Xs, Ws]) == yq]);\nprint(\"E1 -> quartic -> E1 is the identity: \", [subst(subst(Xs, yq, yE), s, sE) == X, substvec(subst(Ws, yq, yE), [s], [sE]) == W]);\n\\\\ quartic -> G1: m = m0 + 1/s, V = yq V0/s^2, Y = V/(m^2+al), t = -(al^2+2m)/(m^2+al)\nmm = m0 + 1/s; YY = yq*V0/s^2/(mm^2+al); tt = -(al^2+2*mm)/(mm^2+al);\nprint(\"quartic -> G1 lands on G1 (Y^4 + al g(t) = 0): \", redq(numerator(YY^4 + al*g(tt))) == 0);\nquit\n" }, { "path": "anc/code/1.3.1/1.3.1c_mapcheck.py", "size_bytes": 2047, "sha256": "7b6ca0d541df7bc0dbe4615194d56707fc32c0ac8795d03092c4dd37b2944696", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.1c -- 300 random points modulo a 13-digit prime q split in F: on E1, round trip G1 -> E1 -> G1, Y^4 = -alpha g(t).\n# Reviewer P4 script mapcheck.py (cypari2). Run from this folder: python3 -I 1.3.1c_mapcheck.py\nimport cypari2, random\nP = cypari2.Pari()\nP('f = y^3+y+1; al = Mod(y,f);')\nP('Q = (-m^2 - al^2*m + al)*(m^2+al); m0 = -al^2/2; V0 = m0^2+al;')\nP('qsl = lift(simplify(subst(Q, m, m0+1/s)*s^4/V0^2));')\nP('b = Mod(polcoeff(qsl,3,s),f); c = Mod(polcoeff(qsl,2,s),f); d = Mod(polcoeff(qsl,1,s),f); e = Mod(polcoeff(qsl,0,s),f); A1 = b*d-4*e;')\nq = int(P('my(p=nextprime(10^12)); while(#polrootsmod(x^3+x+1,p)==0, p=nextprime(p+1)); p'))\nr = int(P.lift(P(f'polrootsmod(x^3+x+1,{q})')[0]))\ndef red(name):\n return int(P.lift(P(f'my(zz=lift(Mod({name},f)), nu=numerator(zz), de=denominator(zz)); simplify(Mod(subst(nu,y,{r}),{q})/Mod(de,{q}))')))\nb,c,d,e,A1,m0,V0 = [red(n) for n in ('b','c','d','e','A1','m0','V0')]\na = r\ninv = lambda z: pow(z, q-2, q)\ndef sqrt_mod(z):\n z %= q\n if z == 0: return 0\n if pow(z,(q-1)//2,q) != 1: return None\n return int(P.lift(P(f'sqrt(Mod({z},{q}))')))\nok1 = ok2 = ok3 = 0; n = 0\nrandom.seed(1)\nwhile n < 300:\n s0 = random.randrange(1,q)\n rhs = (pow(s0,4,q) + b*pow(s0,3,q) + c*s0*s0 + d*s0 + e) % q\n yq = sqrt_mod(rhs)\n if yq is None: continue\n n += 1\n X = (2*yq + 2*s0*s0 + b*s0) % q\n W = ((2*X + 2*c - b*b*inv(2)) * s0 + b*X*inv(2) + d) % q\n if (W*W - (X**3 + c*X*X + A1*X)) % q == 0 and c == 0: ok1 += 1\n den = (2*X + 2*c - b*b*inv(2)) % q\n s1 = (W - b*X*inv(2) - d) * inv(den) % q\n y1 = (X - 2*s1*s1 - b*s1) * inv(2) % q\n if s1 == s0 and y1 == yq: ok2 += 1\n mm = (m0 + inv(s1)) % q\n V = y1*V0*inv(s1*s1) % q\n Y = V*inv((mm*mm + a) % q) % q\n t = -(a*a + 2*mm) * inv((mm*mm + a) % q) % q\n g = (t*t + a*t + a*a + 1) % q\n if (pow(Y,4,q) + a*g) % q == 0: ok3 += 1\n # also compare t with the closed form t = -2s/(V0 s^2 + 2 m0 s + 1)\nprint(\"q=\",q,\" points:\",n,\" on E:\",ok1,\" roundtrip:\",ok2,\" Y^4=-a g(t):\",ok3, \" a6 check c=\",c)\n" }, { "path": "anc/code/1.3.1/1.3.1c_point_R1.gp", "size_bytes": 2081, "sha256": "77cdce3c825636dc7a7ebd9994042122249d75ffd02e08f843080dcc6ed68c70", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.3.1c -- the point R1 on E1 (X = b^2/4, image of the points of G1 with t = 0), t1(R1), t1(-R1); P0 on E0.\n\\\\ Reviewer P4 script sieve47.gp (output file dropped; one comparison line added). Run from this folder: gp -q 1.3.1c_point_R1.gp\ndefault(parisize, 64000000);\nf = y^3+y+1; al = Mod(y,f);\n\\\\ E0\nA0 = 3*al^2+4;\n\\\\ E1 (my derivation)\nQ = (-m^2 - al^2*m + al)*(m^2+al); m0 = -al^2/2; V0 = m0^2+al;\nqsl = lift(simplify(subst(Q, m, m0+1/s)*s^4/V0^2));\nb = Mod(polcoeff(qsl,3,s),f); d = Mod(polcoeff(qsl,1,s),f); e = Mod(polcoeff(qsl,0,s),f);\nA1 = b*d-4*e;\nprint(\"A1 = \", lift(A1));\n\\\\ t on E1 as function of (X,W): N = W - b X/2 - d, D = 2X - b^2/2, t = -2 N D/(V0 N^2 + 2 m0 N D + D^2)\n\\\\ R1 = image of infinity- : X = b^2/4\nX1 = b^2/4; W1sq = X1^3 + A1*X1; \nnf = nfinit(f);\nr = nfroots(nf, x^2 - lift(W1sq)); print(\"R1 X=\", lift(X1), \" W=\", r);\nprint(\"paper R1 = \", [(264*y^2-324*y-212)/961, (23104*y^2+33848*y+49008)/29791]);\n\\\\ t on E0, E1 over a ring given a point [X,W] or [0] (= O)\nt0(P, a, A) = if(#P==1, [1,0], [A - 2*a*P[1] - P[1]^2, 4*P[1]]); \\\\ [num, den]\nt1(P, a, bb, dd, vv, mm) = { my(N, D); if(#P==1, return([0,1])); N = P[2] - bb*P[1]/2 - dd; D = 2*P[1] - bb^2/2; [-2*N*D, vv*N^2 + 2*mm*N*D + D^2]; }\n\\\\ global points\nE0 = ellinit([0,0,0,A0,0], nf); E1 = ellinit([0,0,0,A1,0], nf);\nP0 = [-al, 2]; print(\"P0 on E0: \", ellisoncurve(E0, P0));\nR1 = [X1, Mod(r[1],f)]; print(\"R1 on E1: \", ellisoncurve(E1, R1), \" t1(R1) num/den: \", lift(t1(R1, al, b, d, V0, m0)));\nR1b = [X1, -Mod(r[1],f)]; print(\" t1(-R1) num/den: \", lift(t1(R1b, al, b, d, V0, m0)));\n\\\\ [bundle] the original saved these data with writebin(\"pts.bin\", ...) for its sieve47b.gp; not needed here.\n\\\\ [added] compare with the section's R1. With these formulas for t1 (the source does not print b_P; P4 derived the map),\n\\\\ t1 = 0 holds at R1 = (X1, W) with the root W chosen above, and t1(-R1) = 0/0 (handled in 1.3.1e_minus_R1.py).\npR1 = [(264*y^2-324*y-212)/961, (23104*y^2+33848*y+49008)/29791];\nprint(\"R1 == paper's R1: \", lift(R1) == pR1, \" -R1 == paper's R1: \", lift(R1b) == pR1);\nquit\n" }, { "path": "anc/code/1.3.1/1.3.1d_index.py", "size_bytes": 2601, "sha256": "16e2bcb5c86b1767f58488087610180678b498200081b776327520589e6b6ed0", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.1d -- halving quartics for P, P+T (no root in F), #E(F_v) above 47 and 67, and for l = 3, 11, 17, 47, 67, 131\n# a degree-1 place v with l | N, N/l even, (N/l)P != O. Reviewer P4 script index.py (cypari2). Run: python3 -I 1.3.1d_index.py\nimport cypari2\nP = cypari2.Pari()\nP('f = y^3+y+1; al = Mod(y,f);')\nP('Q = (-m^2 - al^2*m + al)*(m^2+al); m0 = -al^2/2; V0 = m0^2+al;')\nP('qsl = lift(simplify(subst(Q, m, m0+1/s)*s^4/V0^2));')\nP('b = Mod(polcoeff(qsl,3,s),f); d = Mod(polcoeff(qsl,1,s),f); A1 = b*d-4*Mod(polcoeff(qsl,0,s),f); A0 = 3*al^2+4;')\nP('nf = nfinit(f); X1 = b^2/4; rr = nfroots(nf, x^2 - lift(X1^3 + A1*X1)); R1 = [X1, Mod(rr[1],f)]; P0 = [-al, 2];')\nfor name, A, G in ((\"E0\",\"A0\",\"P0\"),(\"E1\",\"A1\",\"R1\")):\n P(f'A={A}; G={G}; E = ellinit([0,0,0,lift(A),0], nf);')\n # halving: x(Q) roots of (x^2-A)^2 - 4 xP (x^3 + A x)\n for lab, pt in ((\"P\", \"G\"), (\"P+T\", \"elladd(E, G, [0,0])\")):\n P(f'Pt = {pt};')\n h = P('nfroots(nf, lift((x^2-A)^2 - 4*Pt[1]*(x^3+A*x)))')\n print(name, lab, \"halving quartic roots in F:\", h, \" x(Pt)=\", P('lift(Pt[1])'))\n # torsion via ellcard at places above 47 and 67\n for p in (47, 67):\n cards=[]\n for r in P(f'polrootsmod(x^3+x+1,{p})'):\n P(f'p={p}; r={r}; redq(z) = my(zz = lift(Mod(z,f)), nu = numerator(zz), de = denominator(zz)); simplify(Mod(subst(nu,y,lift(r)),p)/Mod(de,p));')\n cards.append(int(P('ellcard(ellinit([0,0,0,redq(A),0]))')))\n print(name, \"cards at\", p, cards)\n # index at odd l: find degree-1 place with l | N and (N/l) G != O, N/l even\n for l in (3, 11, 17, 47, 67, 131):\n found = None\n for p in P('primes([5,4000])'):\n p = int(p)\n if p == 31: continue\n for r in P(f'polrootsmod(x^3+x+1,{p})'):\n P(f'p={p}; r={r}; redq(z) = my(zz = lift(Mod(z,f)), nu = numerator(zz), de = denominator(zz)); simplify(Mod(subst(nu,y,lift(r)),p)/Mod(de,p));')\n if int(P('my(dd=denominator(content(lift(Mod(A,f))))); (dd%p)')) == 0: continue\n if int(P('my(dd=denominator(content(lift(G[1])))*denominator(content(lift(G[2])))); dd%p')) == 0: continue\n Ered = P('Er = ellinit([0,0,0,redq(A),0]); Er')\n N = int(P('ellcard(Er)'))\n if N % l == 0 and (N//l) % 2 == 0:\n nz = P(f'ellmul(Er, [redq(G[1]), redq(G[2])], {N//l}) != [0]')\n if int(nz):\n found = (p, int(P.lift(r)), N); break\n if found: break\n print(name, \"l=\",l,\" certificate place (p, r, N):\", found)\n" }, { "path": "anc/code/1.3.1/1.3.1d_index_place11.py", "size_bytes": 661, "sha256": "6bec66f1ab9e3fe5dce7f843d785c1fd35bd2fa0e4467731077d4afa72de8d2b", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.1d -- the place (11, alpha-2) for l = 3 on E0 by hand: #E = 12, [4]P != O. Reviewer P4 script idx2.py (cypari2).\n# Run from this folder: python3 -I 1.3.1d_index_place11.py\nimport cypari2\nP = cypari2.Pari()\nP('f = y^3+y+1; al = Mod(y,f); A0 = 3*al^2+4; A=A0; G=[-al,2];')\nP('p=11; r=Mod(2,11); redq(z) = my(zz = lift(Mod(z,f)), nu = numerator(zz), de = denominator(zz)); simplify(Mod(subst(nu,y,lift(r)),p)/Mod(de,p));')\nprint(P('polrootsmod(x^3+x+1,11)'))\nprint(P('Er = ellinit([0,0,0,redq(A),0]); [ellcard(Er), redq(G[1]), redq(G[2])]'))\nprint(P('ellmul(Er, [redq(G[1]), redq(G[2])], 4)'))\nprint(P('ellmul(Er, [redq(G[1]), redq(G[2])], 4) != [0]'))\n" }, { "path": "anc/code/1.3.1/1.3.1d_rank_simon.gp", "size_bytes": 492, "sha256": "1c9f6696de810d93c0adea0057b127ea027f2dd824756c898aa8c78b35cccfd9", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.3.1d -- Simon's 2-isogeny descent for E0: W^2 = X^3 + (3a^2+4)X and E1: W^2 = X^3 + (3a^2+a+1)X over F (rank 1).\n\\\\ Reviewer P4 script rk.gp. Run from this folder: gp -q 1.3.1d_rank_simon.gp\n\\r ../common/simon_ell/ell.gp\nDEBUGLEVEL_ell=1; LIM1=5; LIM3=50; LIMTRIV=3; MAXPROB=20; LIMBIGPRIME=30;\nbnf=bnfinit(y^3+y+1,1);\nprint(\"=== E0\"); r0=bnfell2descent_viaisog(bnf,[0,0,0,3*y^2+4,0]); print(r0);\nprint(\"=== E1\"); r1=bnfell2descent_viaisog(bnf,[0,0,0,3*y^2+y+1,0]); print(r1);\nquit\n" }, { "path": "anc/code/1.3.1/1.3.1e_minus_R1.py", "size_bytes": 1582, "sha256": "a837f9c1b0a12b4d5998e2967ae856a8a6b105f80a351992127730e41128beb3", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.1e -- t(-R1) by a second expression (where the formula of 1.3.1e_sieve47.py gives 0/0) and its reductions at\n# the three places above 47. Reviewer P4 script negR1.py (cypari2). Run from this folder: python3 -I 1.3.1e_minus_R1.py\nimport cypari2\nP = cypari2.Pari()\nP('f = y^3+y+1; al = Mod(y,f);')\nP('Q = (-m^2 - al^2*m + al)*(m^2+al); m0 = -al^2/2; V0 = m0^2+al;')\nP('qsl = lift(simplify(subst(Q, m, m0+1/s)*s^4/V0^2));')\nP('b = Mod(polcoeff(qsl,3,s),f); d = Mod(polcoeff(qsl,1,s),f); A1 = b*d-4*Mod(polcoeff(qsl,0,s),f);')\nP('nf = nfinit(f); X1 = b^2/4; rr = nfroots(nf, x^2 - lift(X1^3 + A1*X1)); R1 = [X1, Mod(rr[1],f)]; mR1 = [X1, -Mod(rr[1],f)];')\n# s = N/D; at mR1: N = W - bX/2 - d = 0 and D = 0. Use s = (N*Nbar)/(D*Nbar), N*Nbar = (bX/2+d)^2 - X^3 - A1 X\nP('NN = (b*x/2+d)^2 - x^3 - A1*x; print(\"NN(X1)=\", subst(lift(NN),x,lift(X1)));')\nP('q = lift(NN) \\\\ (x - lift(X1)); print(\"rem \", lift(NN) % (x-lift(X1)));')\nP('Nbar(Pt) = -Pt[2] - b*Pt[1]/2 - d;')\nP('s_mR1 = Mod(subst(q,x,lift(X1)),f)/(2*Nbar(mR1)); print(\"s(-R1) = \", lift(s_mR1));')\nP('t_mR1 = -2*s_mR1/(V0*s_mR1^2 + 2*m0*s_mR1 + 1); print(\"t(-R1) = \", lift(t_mR1));')\nP('p=47; redq(z, r) = my(zz = lift(Mod(z,f)), nu = numerator(zz), de = denominator(zz)); simplify(Mod(subst(nu,y,lift(r)),p)/Mod(de,p));')\nfor r in (25,34,35):\n P(f'r=Mod({r},47);')\n # reduce s via q(X)/(2 Nbar) at reduced point\n print(r, \"Nbar(-R1) mod v:\", P('redq(Nbar(mR1), r)'), \" q(X1) mod v:\", P('redq(Mod(subst(q,x,lift(X1)),f), r)'),\n \" s mod v:\", P('redq(s_mR1, r)'), \" t(-R1) mod v:\", P('redq(t_mR1, r)'))\n" }, { "path": "anc/code/1.3.1/1.3.1e_sieve47.py", "size_bytes": 3023, "sha256": "3719c03442ff02f92dedaa7e782622642432527af5123105da8b2ffffbefbce4", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.1e -- Mordell-Weil sieve at 47: at the three places above 47, t(nP + eT) for n mod 24, e in {0,1}; survivors;\n# count of reduced points where the chosen formula for t gives 0/0. Reviewer P4 script sieve47.py (cypari2). Run: python3 -I 1.3.1e_sieve47.py\nimport cypari2\npari = cypari2.Pari(); pari.allocatemem(64*10**6, silent=True) if hasattr(pari,'allocatemem') else None\nP = pari\nP('f = y^3+y+1; al = Mod(y,f);')\nP('A0 = 3*al^2+4;')\nP('Q = (-m^2 - al^2*m + al)*(m^2+al); m0 = -al^2/2; V0 = m0^2+al;')\nP('qsl = lift(simplify(subst(Q, m, m0+1/s)*s^4/V0^2));')\nP('b = Mod(polcoeff(qsl,3,s),f); d = Mod(polcoeff(qsl,1,s),f); e = Mod(polcoeff(qsl,0,s),f); A1 = b*d-4*e;')\nP('nf = nfinit(f); X1 = b^2/4; rr = nfroots(nf, x^2 - lift(X1^3 + A1*X1)); R1 = [X1, Mod(rr[1],f)]; P0 = [-al, 2];')\nP('E1g = ellinit([0,0,0,A1,0], nf); E0g = ellinit([0,0,0,A0,0], nf);')\nP('t1g(Pt) = my(N = Pt[2] - b*Pt[1]/2 - d, D = 2*Pt[1] - b^2/2); [-2*N*D, V0*N^2 + 2*m0*N*D + D^2];')\nprint(\"t1(R1) =\", P('t1g(R1)'))\np = 47\nP('p=47; redq(z, r) = my(zz = lift(Mod(z,f)), nu = numerator(zz), de = denominator(zz)); simplify(Mod(subst(nu,y,lift(r)),p)/Mod(de,p));')\nrts = P('polrootsmod(x^3+x+1, 47)')\nprint(\"roots\", rts)\ndef tval(num, den):\n if den != 0: return int(P.lift(num/den))\n if num != 0: return 'inf'\n return '0/0'\nresults = {}\nfor which in (0,1):\n sets = []\n for j in range(3):\n r = rts[j]\n P(f'r = Mod({int(P.lift(r))},p); a = r;')\n P(f'A = redq({\"A0\" if which==0 else \"A1\"}, r); E = ellinit([0,0,0,A,0]);')\n P('bb = redq(b,r); dd = redq(d,r); vv = redq(V0,r); mm = redq(m0,r);')\n if which == 0: P('Pg = [redq(P0[1],r), redq(P0[2],r)];')\n else: P('Pg = [redq(R1[1],r), redq(R1[2],r)];')\n N = int(P(\"ellcard(E)\")); ordP = int(P(\"ellorder(E,Pg)\"))\n def tbar(pt):\n if len(pt) == 1: return 'inf' if which == 0 else 0\n X, W = pt[0], pt[1]\n if which == 0:\n A = P('A'); a = P('a')\n return tval(A - 2*a*X - X**2, 4*X)\n bb, dd, vv, mm = P('bb'), P('dd'), P('vv'), P('mm')\n Nn = W - bb*X/2 - dd; D = 2*X - bb**2/2\n return tval(-2*Nn*D, vv*Nn**2 + 2*mm*Nn*D + D**2)\n # all points\n bad = 0; pts = P('my(L=List()); for(X=0,p-1, my(rh = Mod(X,p)^3 + A*X); if(issquare(rh), my(w=sqrt(rh)); listput(L,[Mod(X,p),w]); if(w!=0, listput(L,[Mod(X,p),-w])))); Vec(L)')\n tv_all = [tbar(pt) for pt in pts]\n bad = sum(1 for v in tv_all if v == '0/0')\n L = {}\n for n in range(24):\n for ee in (0,1):\n R = P(f'elladd(E, ellmul(E,Pg,{n}), {\"[0,0]\" if ee else \"[0]\"})')\n L[(n,ee)] = tbar(R)\n sets.append(L)\n print(f\"E{which} place alpha={int(P.lift(r))}: #E={N}, ord(P)={ordP}, #pts listed={len(pts)+1}, 0/0 count={bad}, A mod v={P('A')}\")\n surv = [k for k in sets[0] if sets[0][k] == sets[1][k] == sets[2][k]]\n print(f\"E{which} survivors (n,e,t):\", [(k[0],k[1],sets[0][k]) for k in surv])\n" }, { "path": "anc/code/1.3.1/1.3.1f_strassmann.py", "size_bytes": 3509, "sha256": "c84f1e4cfd29c89e1c359f9acbeba635fb47e912e74c993c9d70833ec6d40704", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.1f -- Strassmann data at 47: lambda_j = log z(sigma_j Q) for Q = 24P (24R1), and the valuations of the coefficients of\n# h(s) = f(sigma_1(R0) + [s]sigma_1 Q) - f(sigma_2(R0) + [s]sigma_2 Q), 47-adic precision 47^30. Reviewer P4 script strass.py (cypari2).\n# Run from this folder: python3 -I 1.3.1f_strassmann.py\nimport cypari2\nP = cypari2.Pari()\nP.allocatemem(200*10**6, silent=True)\nP('f = y^3+y+1; al = Mod(y,f);')\nP('Q = (-m^2 - al^2*m + al)*(m^2+al); m0 = -al^2/2; V0 = m0^2+al;')\nP('qsl = lift(simplify(subst(Q, m, m0+1/s)*s^4/V0^2));')\nP('b = Mod(polcoeff(qsl,3,s),f); d = Mod(polcoeff(qsl,1,s),f); A1 = b*d-4*Mod(polcoeff(qsl,0,s),f); A0 = 3*al^2+4;')\nP('nf = nfinit(f); X1 = b^2/4; rr = nfroots(nf, x^2 - lift(X1^3 + A1*X1)); R1 = [X1, Mod(rr[1],f)]; P0 = [-al, 2];')\nP('E0g = ellinit([0,0,0,lift(A0),0], nf); E1g = ellinit([0,0,0,lift(A1),0], nf);')\nP('Q0 = ellmul(E0g, P0, 24); Q1 = ellmul(E1g, R1, 24);')\nprint(\"sizes:\", P('[#Str(Q0), #Str(Q1)]'))\nP('pr = 47; prec = 30; rts = polrootsmod(x^3+x+1, pr);')\nP('emb(z, j) = my(aj = padicappr(x^3+x+1, lift(rts[j]) + O(pr^prec))[1], zz = lift(Mod(z,f))); subst(zz, y, aj);')\nP('KS = 12; KW = 45;')\n# series in variable 'u' (formal param), and 'S' (the s variable)\ncode = r'''\nstrassdata(which, j, R0type) = {\n my(DD, aj, A, E, Qg, zq, lg, lam, ex, zs, pt, X, W, ff, Xs, Ws, bb, dd, vv, mm, N, D, lam2);\n aj = padicappr(x^3+x+1, lift(rts[j]) + O(pr^prec))[1];\n A = if(which==0, emb(A0,j), emb(A1,j));\n E = ellinit([0,0,0,A,0]);\n Qg = if(which==0, Q0, Q1);\n zq = -emb(Qg[1],j)/emb(Qg[2],j);\n lg = ellformallog(E, KW, 'u);\n lam = subst(truncate(lg), 'u, zq);\n ex = ellformalexp(E, KS+2, 'u);\n zs = subst(truncate(ex), 'u, lam*'S) + O('S^(KS+1));\n pt = ellformalpoint(E, KS+4, 'u);\n Xs = subst(truncate(pt[1]*'u^2), 'u, zs)/zs^2;\n Ws = subst(truncate(pt[2]*'u^3), 'u, zs)/zs^3;\n if(R0type==1,\n if(which==0, Xs = A/Xs,\n \\\\ add R1 (embedded) to (Xs,Ws)\n my(x1 = emb(R1[1],j), y1 = emb(R1[2],j), lm, x3, y3);\n my(den = (Xs - x1)^2, dx);\n dx = ((A + 3*x1^2)*Xs - 2*y1*Ws + y1^2 - 2*x1^3)/den;\n lm = (Ws - y1)/(Xs - x1); y3 = -(lm*dx + y1);\n Xs = x1 + dx; Ws = y3; DD = 2*dx));\n if(which==0,\n ff = 4*Xs/(A - 2*aj*Xs - Xs^2),\n bb = emb(b,j); dd = emb(d,j); vv = emb(V0,j); mm = emb(m0,j);\n N = Ws - bb*Xs/2 - dd; D = if(R0type==1, DD, 2*Xs - bb^2/2);\n ff = -2*N*D/(vv*N^2 + 2*mm*N*D + D^2));\n [valuation(lam, pr), ff];\n}\n'''\nP(code)\nfor which in (0,1):\n for R0type in (0,1):\n d1 = P(f'strassdata({which},1,{R0type})'); d2 = P(f'strassdata({which},2,{R0type})'); d3 = P(f'strassdata({which},3,{R0type})')\n h = d1[1] - d2[1]\n coeffs = [P.polcoef(h, n, 'S') for n in range(0, 7)]\n vals = []\n for c in coeffs:\n try: vals.append(int(P.valuation(c, 47)) if c != 0 else 'inf/0')\n except Exception as ex: vals.append(str(c)[:30])\n print(f\"E{which} R0={'O' if R0type==0 else ('T' if which==0 else 'R1')}: v(lambda_j)=\", [int(d1[0]), int(d2[0]), int(d3[0])],\n \" h=f1-f2 coeff valuations a0..a6:\", vals, \" h-valuation-in-S:\", P.valuation(h,'S') if h!=0 else None)\n h13 = d1[1] - d3[1]\n print(\" (f1-f3) vals:\", [int(P.valuation(P.polcoef(h13,n,'S'),47)) if P.polcoef(h13,n,'S')!=0 else 'z' for n in range(0,5)])\n # padic precision of coefficients\n print(\" precision of a2:\", P.padicprec(coeffs[2],47) if coeffs[2]!=0 else None, \" a1:\", P.padicprec(coeffs[1],47) if coeffs[1]!=0 else None)\n" }, { "path": "anc/code/1.3.2/1.3.2a_check_exact.py", "size_bytes": 856, "sha256": "d9b6785f8f3cbbfd25220169699d81199557ba5fd844fc523a14427dab7643aa", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import sys, os; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom jac_e02 import *\nimport time\nt0=time.time()\nLq = NumberField(PolynomialRing(QQ,'z')([-3,0,1]),'s3'); s3 = Lq.gen()\nalpha = (-1+s3)/2\nM = Model(Lq, alpha)\nG = M.from_sextic([-1,2],[-1,2]) # a = x^2+2x-1, b = 2x-1\nT = M.T()\nprint(\"2T == 0:\", 2*T == M.JL(0), \" T != 0:\", T != M.JL(0))\ndef KQ(P):\n k = M.kummer(P)\n if k is None: return None\n kk=[Lq(c) for c in k]\n for c in kk: assert c in QQ or c.is_rational(), c\n return primitive([QQ(c) for c in kk])\nK2 = KQ(2*G); print(\"K(2G) =\", K2)\nprint(\"K(G) =\", KQ(G), \"K(T)=\",KQ(T))\n# Kummer quartic sanity\nfor n in [1,2,3,5,7]:\n k = KQ(n*G); print(n, \"quartic:\", kummer_quartic(k)==0, \"Phi:\", Phi(k)[0]==0 and Phi(k)[1]==0)\nk = KQ(G+T); print(\"G+T quartic\", kummer_quartic(k)==0)\nprint(\"time\",time.time()-t0)\n" }, { "path": "anc/code/1.3.2/1.3.2a_check_lifts.py", "size_bytes": 1912, "sha256": "a2df520444e2558fcb3816a64b4c9466f73bac2cd24893fbf1eeaf6c625522b5", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import sys, os; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom jac_e02 import *\nimport pickle, time\nt0=time.time()\nKn = pickle.load(open('Kn.pkl','rb'))\np=29\nS = PolynomialRing(QQ,'k1,k2,k3,k4')\nPhiS = Phi(list(S.gens()))\nZp3 = Integers(p**3)\ndef patch(k, i):\n return [QQ(c)/QQ(k[i]) for c in k]\ndef red(x, mod): \n x=QQ(x); assert x.denominator()%p!=0; return Integers(mod)(x.numerator())*Integers(mod)(x.denominator())**-1\nfor n0, claim1, claim2 in [(14,231,18211),(17,668,7860),(2,2,2),(29,897,26069)]:\n ks = [Kn[n0+31*m] for m in range(4)]\n # choose unit patch\n i = [j for j in range(4) if ks[0][j]%p!=0][0]\n A = [patch(k,i) for k in ks]\n # interpolate c(m)=c0+c1 m + c2 m^2 mod p^3 from m=0,1,2; check m=3\n c0 = [red(x,p**3) for x in A[0]]; y1=[red(x,p**3) for x in A[1]]; y2=[red(x,p**3) for x in A[2]]; y3=[red(x,p**3) for x in A[3]]\n # c0 + c1 + c2 = y1 ; c0 + 2c1 + 4c2 = y2 -> c2 = (y2 - 2 y1 + c0)/2 ; c1 = y1 - c0 - c2\n inv2 = Zp3(2)**-1\n c2 = [(y2[j]-2*y1[j]+c0[j])*inv2 for j in range(4)]\n c1 = [y1[j]-c0[j]-c2[j] for j in range(4)]\n ok3 = all(c0[j]+3*c1[j]+9*c2[j]==y3[j] for j in range(4))\n vc1 = [ZZ(c).valuation(p) if c!=0 else 99 for c in c1]; vc2=[ZZ(c).valuation(p) if c!=0 else 99 for c in c2]\n def Phim(m):\n pt = [c0[j]+c1[j]*m+c2[j]*m*m for j in range(4)]\n return [Zp3(PhiS[t](*[ZZ(x) for x in pt])) for t in range(2)]\n lev1 = [m for m in range(p) if all(ZZ(v)%p**2==0 for v in Phim(m))]\n lev2 = [m for m in range(p**2) if all(ZZ(v)%p**3==0 for v in Phim(m))]\n print(\"class %d: patch %d, m=3 consistency %s, val(c1)=%s val(c2)=%s\"%(n0,i,ok3,vc1,vc2))\n print(\" level1 m mod 29:\", lev1, \"-> n mod 899:\", [(n0+31*m)%899 for m in lev1], \" claim\", claim1%899)\n print(\" level2 m mod 841:\", lev2, \"-> n mod 26071:\", [(n0+31*m)%26071 for m in lev2], \" claim\", claim2)\nprint(\"time\",time.time()-t0)\n" }, { "path": "anc/code/1.3.2/1.3.2a_check_p113.py", "size_bytes": 1908, "sha256": "7a8210cb5b5cd5b0dc26bde8883989777d0400f8d72e8f141b97ad7d11ef29ee", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import sys, os; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom jac_e02 import *\nimport time\nt0=time.time()\ndef run(p, nmax_check=None, residues=None, modres=None):\n Fq = GF(p**2,'w'); \n al = PolynomialRing(Fq,'z')([-Fq(1)/2,1,1]).roots()[0][0]\n M = Model(Fq, al)\n G = M.from_sextic([-1,2],[-1,2]); T = M.T(); O = M.JL(0)\n # order of G\n cur = O; n=0; Ks=[]; edge=[]\n while True:\n k = M.kummer(cur)\n if k is None: edge.append(n); Ks.append(None)\n else:\n assert all(c in GF(p) for c in k), (n,k)\n Ks.append([GF(p)(c) for c in k])\n n+=1; cur = cur + G\n if cur == O: break\n return n, Ks, edge, M, G, T\np=113\no, Ks, edge, M, G, T = run(113)\nprint(\"ord(G mod 113) =\", o, \"factor\", factor(o), \"edge cases\", edge)\nS = PolynomialRing(GF(p),'k1,k2,k3,k4'); PhiS = Phi(list(S.gens()))\nbad=[]; unknown=[]\nfor n in range(o):\n if n % 841 in (291,550):\n if Ks[n] is None: unknown.append(n); continue\n if all(P(*Ks[n])==0 for P in PhiS): bad.append(n)\nprint(\"n mod 6728 with n mod 841 in {291,550} on Gamma mod 113:\", bad, \" unknown:\", unknown)\nallon = [n for n in range(o) if Ks[n] is not None and all(P(*Ks[n])==0 for P in PhiS)]\nprint(\"all n mod 6728 on Gamma mod 113 (e=0):\", allon, \" their residues mod 841:\", sorted(set(n%841 for n in allon)))\n# also cross-check p=5,29 with this finite-field implementation\nfor q in [5,29]:\n o2, Ks2, edge2, M2, G2, T2 = run(q)\n S2 = PolynomialRing(GF(q),'k1,k2,k3,k4'); P2 = Phi(list(S2.gens()))\n lst=[]\n cur = M2.JL(0)\n for e in [0,1]:\n for n in range(o2):\n Pt = n*G2 + e*T2\n k = M2.kummer(Pt)\n if k is None: lst.append((n,e,'?')); continue\n k=[GF(q)(c) for c in k]\n if all(P(*k)==0 for P in P2): lst.append((n,e))\n print(\"p=%d ord %d list\"%(q,o2), lst)\nprint(\"time\", time.time()-t0)\n" }, { "path": "anc/code/1.3.2/1.3.2a_check_sieve_local.py", "size_bytes": 2735, "sha256": "fa9a6d57049729d456ccafb5098d4094e51f3eeedde844cdf2066c95cf016c2e", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import sys, os; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom jac_e02 import *\nimport time\nt0=time.time()\nLq = NumberField(PolynomialRing(QQ,'z')([-3,0,1]),'s3'); s3 = Lq.gen()\nM = Model(Lq, (-1+s3)/2)\nG = M.from_sextic([-1,2],[-1,2]); T = M.T(); O = M.JL(0)\ndef KQ(P):\n k = M.kummer(P)\n if k is None: return None\n return primitive([QQ(c) for c in k])\nmult = {0:O}\ncur = O\nNMAX = 31*3+33\nfor n in range(1,NMAX+1):\n cur = cur + G; mult[n]=cur\nKn = {n: KQ(mult[n]) for n in mult}\nKnT = {n: KQ(mult[n]+T) for n in range(31)}\nprint(\"edge cases:\", [n for n in Kn if Kn[n] is None], [n for n in KnT if KnT[n] is None])\nprint(\"max digits K(nG) n=%d:\"%NMAX, max(len(str(abs(c))) for c in Kn[NMAX]))\ndef onGamma_mod(k,p):\n return all(ZZ(v) % p == 0 for v in Phi(k))\ndef is_origin_mod(k,p):\n return k[0]%p==0 and k[1]%p==0 and k[2]%p==0\nfor p in [5,29]:\n ordp = [n for n in range(1,32) if is_origin_mod(Kn[n],p)]\n print(\"p=%d: n in 1..31 with nG=0 mod p:\"%p, ordp)\n lst = [(n,0) for n in range(31) if onGamma_mod(Kn[n],p)] + [(n,1) for n in range(31) if onGamma_mod(KnT[n],p)]\n print(\" sieve list:\", lst)\n# 29-adic local data\np=29\ndef val(x): return QQ(x).valuation(p) if x!=0 else Infinity\nK31 = Kn[31]; print(\"val K(31G):\", [val(c) for c in K31])\nk4 = K31[3]; avec = [GF(p)(ZZ(c)//p**2)*GF(p)(k4)**-1 for c in K31[:3]]\nprint(\"avec:\", avec)\nS = PolynomialRing(QQ,'k1,k2,k3,k4'); k1,k2,k3,k4s = S.gens()\nL1=-336*k1*k2+540*k1*k3-135*k2**2+672*k3**2; L2=-192*k1*k2+388*k1*k3-97*k2**2+384*k3**2\nPhiS = Phi([k1,k2,k3,k4s])\n# check L_i are the k4^2 coefficients of Phi_i\nprint(\"L_i = coeff of k4^2:\", [PhiS[i].coefficient({k4s:2}) == [L1,L2][i] for i in range(2)], \" k4^4,k4^3 terms zero:\", [PhiS[i].coefficient({k4s:4})==0 and PhiS[i].coefficient({k4s:3})==0 for i in range(2)])\nprint(\"L(avec):\", [GF(p)(L(*[ZZ(c) for c in avec],1)) for L in (L1,L2)], \" L(9,10,6):\", [GF(p)(L(9,10,6,1)) for L in (L1,L2)])\n# translation at 2G\ndef patch1(k): return [QQ(c)/QQ(k[0]) for c in k]\nb = patch1(Kn[2]); bQ = patch1(Kn[33])\nbase2 = [GF(p)(c) for c in b]; dir2 = [GF(p)((bQ[i]-b[i])/p) for i in range(4)]\nprint(\"base2\", base2, \"dir2\", dir2, \"min val of diff\", [val(bQ[i]-b[i]) for i in range(4)])\nderivs = [sum(GF(p)(PhiS[i].derivative(S.gens()[j])(*[QQ(c) for c in b]))*dir2[j] for j in range(4)) for i in range(2)]\nprint(\"derivs\", derivs)\n# direct valuation checks of isolation claims\nfor m in [1,2,3,4]:\n k = Kn[31*m]; print(\"Phi val at %dG:\"%(31*m), [val(x) for x in Phi(k)])\nfor m in [1,2,3]:\n for n in [2+31*m, -2+31*m]:\n k = Kn[n]; print(\"Phi val at %dG:\"%n, [val(x) for x in Phi(k)])\nimport pickle; pickle.dump({n:Kn[n] for n in Kn}, open('Kn.pkl','wb'))\nprint(\"time\", time.time()-t0)\n" }, { "path": "anc/code/1.3.2/1.3.2a_extra.gp", "size_bytes": 1036, "sha256": "4ae134ff8598e062e7bef6ea6e52126b2582962290f8b02396c58e22651ba190", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.3.2 extra exact checks (PARI/GP)\nF = 1 + r*t + r*t^3 - r^4;\nV = [r*(t-r), 1, r^2+r*t+t^2, r, t];\nQ1(X)= -X[1]*X[2]-X[2]^2-X[1]*X[3]-X[4]^2;\nQ2(X)= -X[2]^2-X[1]*X[3]-X[4]*X[5];\nQ3(X)= X[1]*X[2]+2*X[2]^2+2*X[1]*X[3]+X[2]*X[3]-X[5]^2;\nprint(\"Q1(V)+F, Q2(V)+F, Q3(V)-2F: \", [Q1(V)+F, Q2(V)+F, Q3(V)-2*F]);\nh1=1/2; M1=[0,-h1,-h1;-h1,-1,0;-h1,0,0]; M2=[0,0,-h1;0,-1,0;-h1,0,0]; M3=[0,h1,1;h1,2,h1;1,h1,0];\nh = -4*matdet(M1-2*s*M2+s^2*M3); print(\"h = \", h); print(\"factor h: \", factor(h));\nprint(\"Delta-(rt+2) = \", (r^4-r*t^3+1)-(r*t+2), \" (= -F: \", (r^4-r*t^3+1)-(r*t+2)==-F, \")\");\nprint(\"F(1,t) = \", subst(F,r,1), \" F(-1,t) = \", subst(F,r,-1));\nprint(\"rt=-2 => -r^2*F = \", factor(-r^2*subst(F,t,-2/r)), \" real roots of r^6+r^2+8: \", polsturm(r^6+r^2+8));\nprint(\"partials: Fx Fy Fz = \", [deriv(X^4-Y^4+X^2*Y*Z+Y*Z^3,X), deriv(X^4-Y^4+X^2*Y*Z+Y*Z^3,Y), deriv(X^4-Y^4+X^2*Y*Z+Y*Z^3,Z)]);\nprint(\"F_y at x^2=-3z^2, y=6z: \", substpol(subst(-4*Y^3+X^2*Z+Z^3, Y, 6*Z), X^2, -3*Z^2));\nprint(\"K(2G) -> (1 : -4 : -13/8): \", [32,-128,-52]/32);\n" }, { "path": "anc/code/1.3.2/1.3.2a_sieve_certificate.m", "size_bytes": 9260, "sha256": "10a9c5465cdb0063c8c1828e85e5b283be476e4685606db2edab802fa79c5a29", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Mordell--Weil/Kummer sieve certificate for Table 6, equation 2.\nQ:=Rationals(); R:=PolynomialRing(Q);\nH:=HyperellipticCurve(6*x^6+22*x^5+15*x^4-14*x^3-7*x^2+6*x-1);\nassert IsNonsingular(H);\nJ:=Jacobian(H); K:=KummerSurface(J);\nA,mw,finite_index,proved,rank_upper:=MordellWeilGroupGenus2(J);\nassert finite_index and proved and rank_upper eq 1;\nassert Invariants(A) eq [2,0];\nTQ:=mw(A.1); GQ:=mw(A.2);\nassert TQ eq elt;\nassert GQ eq elt;\nassert Eltseq(K!(0*GQ)) eq [Q|0,0,0,1];\n\"full Mordell-Weil group\",A,\"finite index\",finite_index,\n \"proved\",proved,\"rank upper bound\",rank_upper;\n\nS:=PolynomialRing(Q,4);\nf1:=278*k1^4 + 2128*k1^3*k3 + 132*k1^3*k4 + 4976*k1^2*k2^2\n -15680*k1^2*k2*k3 -648*k1^2*k2*k4 +19668*k1^2*k3^2\n +1540*k1^2*k3*k4 +384*k1*k2^3 +4456*k1*k2^2*k3\n +1904*k1*k2^2*k4 -18208*k1*k2*k3^2 -5684*k1*k2*k3*k4\n -336*k1*k2*k4^2 +30240*k1*k3^3 +4068*k1*k3^2*k4\n +540*k1*k3*k4^2 -762*k2^4 +1184*k2^3*k3 +980*k2^3*k4\n +9044*k2^2*k3^2 -1008*k2^2*k3*k4 -135*k2^2*k4^2\n -18368*k2*k3^3 -5568*k2*k3^2*k4 +19954*k3^4\n +4584*k3^3*k4 +672*k3^2*k4^2;\nf2:=1112*k1^3*k2 -2120*k1^3*k3 -4*k1^3*k4 +1652*k1^2*k2^2\n -64*k1^2*k2*k3 -132*k1^2*k2*k4 -6712*k1^2*k3^2\n +324*k1^2*k3*k4 -1528*k1*k2^3 +13984*k1*k2^2*k3\n +1088*k1*k2^2*k4 -25496*k1*k2*k3^2 -3804*k1*k2*k3*k4\n -192*k1*k2*k4^2 +5048*k1*k3^3 +3516*k1*k3^2*k4\n +388*k1*k3*k4^2 -912*k2^4 +3536*k2^3*k3 +560*k2^3*k4\n +1832*k2^2*k3^2 -576*k2^2*k3*k4 -97*k2^2*k4^2\n -17168*k2*k3^3 -2308*k2*k3^2*k4 +8940*k3^4\n +3096*k3^3*k4 +384*k3^2*k4^2;\neqs:=[f1,f2];\n\nfunction FiniteSieve(p)\n F:=GF(p); Rp:=PolynomialRing(F);\n Hp:=HyperellipticCurve(6*z^6+22*z^5+15*z^4-14*z^3-7*z^2+6*z-1);\n assert IsNonsingular(Hp);\n Jp:=Jacobian(Hp); Kp:=KummerSurface(Jp);\n Tp:=elt;\n Gp:=elt;\n o:=Order(Gp); out:=[];\n for e in [0..1] do for n in [0..o-1] do\n c:=Eltseq(Kp!(n*Gp+e*Tp));\n if &and[Evaluate(f,c) eq 0:f in eqs] then Append(~out,); end if;\n end for; end for;\n return o,out;\nend function;\no5,a5:=FiniteSieve(5); o29,a29:=FiniteSieve(29);\nassert o5 eq 31 and a5 eq\n [<0,0>,<2,0>,<8,0>,<11,0>,<12,0>,<14,0>,<15,0>,<16,0>,\n <17,0>,<19,0>,<20,0>,<23,0>,<29,0>];\nassert o29 eq 31 and a29 eq [<0,0>,<2,0>,<14,0>,<17,0>,<29,0>];\n\"finite sieves p=5,p=29\",a5,a29;\n\n// Kummer pseudo-addition over Q_29. Magma's current BBMatrix convention is\n// B_ii(P,Q)=k_i(P+Q)k_i(P-Q), and the off-diagonal entries give the\n// corresponding symmetric bilinear products.\ndelta:=K`Delta; BB:=K`BBMatrix;\nfunction NormPad(P)\n v:=Minimum([Valuation(c):c in P|c ne 0]); pi:=UniformizingElement(Universe(P));\n return [c*pi^(-v):c in P];\nend function;\nfunction DoublePad(P)\n P:=NormPad(P); return NormPad([Evaluate(d,P):d in delta]);\nend function;\nfunction PseudoAddPad(P1,P2,P3)\n P1:=NormPad(P1); P2:=NormPad(P2); P3:=NormPad(P3);\n _,i:=Minimum([Valuation(c):c in P3]); both:=P1 cat P2;\n c:=Evaluate(BB[i,i],both);\n return NormPad([j eq i select P3[i]*c else\n P3[i]*Evaluate(BB[i,j],both)-P3[j]*c:j in [1..4]]);\nend function;\nfunction MultiplePad(n,P)\n if n eq 0 then return [Universe(P)|0,0,0,1]; end if;\n m:=Abs(n); Px:=[Universe(P)|0,0,0,1]; Py:=P; Pz:=P;\n while true do\n if IsOdd(m) then Px:=PseudoAddPad(Px,Pz,Py);\n else Py:=PseudoAddPad(Py,Pz,Px); end if;\n m div:=2;\n if m eq 0 then return NormPad(Px); end if;\n Pz:=DoublePad(Pz);\n end while;\nend function;\n\np:=29; Qp:=pAdicField(p,30); GP:=[Qp!c:c in Eltseq(K!GQ)];\nfirst:=[];\nfor n0 in [0,2,14,17,29] do for d in [0..28] do\n n:=n0+31*d; c:=MultiplePad(n,GP);\n if &and[Valuation(Evaluate(f,c)) ge 2:f in eqs] then Append(~first,n); end if;\nend for; end for;\nassert first eq [31*d:d in [0..28]] cat [2,231,668,897];\nsecond:=[];\nfor n0 in [2,231,668,897] do for d in [0..28] do\n n:=n0+31*29*d; c:=MultiplePad(n,GP);\n if &and[Valuation(Evaluate(f,c)) ge 3:f in eqs] then Append(~second,n); end if;\nend for; end for;\nassert second eq [2,18211,7860,26069];\n\"29-adic necessary residues\",first,second;\nassert (18211 mod 841) eq 550 and (7860 mod 841) eq 291;\n\n// Reduction at 113 eliminates the two non-rational 29-adic branches.\nF113:=GF(113); R113:=PolynomialRing(F113);\nH113:=HyperellipticCurve(6*z^6+22*z^5+15*z^4-14*z^3-7*z^2+6*z-1);\nassert IsNonsingular(H113);\nJ113:=Jacobian(H113); K113:=KummerSurface(J113);\nG113:=elt;\nassert Order(G113) eq 6728 and 6728 eq 8*841;\nbad:={Integers()|}; cur:=0*G113;\nfor n in [0..6727] do\n c:=Eltseq(K113!cur);\n if n mod 841 in {291,550} and &and[Evaluate(f,c) eq 0:f in eqs] then\n Include(~bad,n mod 841);\n end if;\n cur+:=G113;\nend for;\nassert IsEmpty(bad);\n\"p=113 eliminates residues 291 and 550 mod 841\",true;\n\n// Formal-local isolation of the three remaining disks n=0,+2,-2.\nQ31:=MultiplePad(31,GP);\nassert [Valuation(c):c in Q31] eq [2,2,2,0];\navec:=[GF(p)!(Q31[i]/p^2):i in [1..3]];\nassert avec eq [GF(p)|9,10,6];\nL1:=-336*k1*k2+540*k1*k3-135*k2^2+672*k3^2;\nL2:=-192*k1*k2+388*k1*k3-97*k2^2+384*k3^2;\nlead:=[Evaluate(L,avec cat [GF(p)!1]):L in [L1,L2]];\nassert lead eq [GF(p)|13,24];\n\nfunction Patch(P,i) return [c/P[i]:c in P]; end function;\nK2:=Patch(MultiplePad(2,GP),1); K2Q:=Patch(MultiplePad(33,GP),1);\nbase2:=[GF(p)!c:c in K2];\ndir2:=[GF(p)!((K2Q[i]-K2[i])/p):i in [1..4]];\nassert base2 eq [GF(p)|1,25,2,27] and dir2 eq [GF(p)|0,17,9,15];\nderivs:=[&+[Evaluate(Derivative(f,j),base2)*dir2[j]:j in [1..4]]:f in eqs];\nassert derivs eq [GF(p)|23,9];\n\"formal local data at 0 and +/-2\",avec,lead,base2,dir2,derivs;\n\n// The two nonzero surviving MW classes really occur and are opposite.\nc2:=Eltseq(K!(2*GQ)); assert &and[Evaluate(f,c2) eq 0:f in eqs];\nhalf:=Q!1/2;\nm1:=Matrix(Q,5,5,[\n 0,-half,-half,0,0, -half,-1,0,0,0, -half,0,0,0,0,\n 0,0,0,-1,0, 0,0,0,0,0]);\nm2:=Matrix(Q,5,5,[\n 0,0,-half,0,0, 0,-1,0,0,0, -half,0,0,0,0,\n 0,0,0,0,-half, 0,0,0,-half,0]);\nm3:=Matrix(Q,5,5,[\n 0,half,1,0,0, half,2,half,0,0, 1,half,0,0,0,\n 0,0,0,0,0, 0,0,0,0,-1]);\nnetpol:=-4*Determinant(Submatrix(m1,1,1,3,3)\n -2*x*Submatrix(m2,1,1,3,3)+x^2*Submatrix(m3,1,1,3,3));\nassert netpol eq 6*x^6+22*x^5+15*x^4-14*x^3-7*x^2+6*x-1;\nfunction TangentXpol(v)\n M:=Matrix([v*m1,v*m2,v*m3]); ker:=Kernel(Transpose(M));\n w:=ExtendBasis([ker!v],ker)[2];\n return InnerProduct(w*m1,w)-2*x*InnerProduct(w*m2,w)\n +x^2*InnerProduct(w*m3,w);\nend function;\nvp:=Vector(Q,[-1,1,1,1,0]); vm:=Vector(Q,[1,-1,-1,1,0]);\nxp:=TangentXpol(vp); xm:=TangentXpol(vm);\nassert xp/LeadingCoefficient(xp) eq x^2+4*x-Q!13/8;\nassert xm/LeadingCoefficient(xm) eq x^2+4*x-Q!13/8;\nassert Seqset(Setseq(RationalPoints(J,xp,2))) eq Seqset([2*GQ,-2*GQ]);\nassert Seqset(Setseq(RationalPoints(J,xm,2))) eq Seqset([2*GQ,-2*GQ]);\n\"only possible MW classes are 0 and +/-2G; +/-2 come from (+/-1:1:0)\",true;\n\n// Exact generic verification that the two hard-coded quartics contain the\n// RR tangent image; this removes any reliance on numerical interpolation.\nQrF:=FunctionField(Q); RtF:=PolynomialRing(QrF);\nKF:=ext;\nmatsF:=[ChangeRing(m,KF):m in [m1,m2,m3]];\nVg:=Vector(KF,[rr*(tt-rr),1,rr^2+rr*tt+tt^2,rr,tt]);\nassert [InnerProduct(Vg*m,Vg):m in matsF] eq [KF|0,0,0];\nTang:=Matrix([Vg*m:m in matsF]); kerg:=Kernel(Transpose(Tang));\nassert Dimension(kerg) eq 2;\nwg:=ExtendBasis([kerg!Vg],kerg)[2];\nqg:=[InnerProduct(wg*m,wg):m in matsF];\nsg:=2*qg[2]/qg[3]; pg:=qg[1]/qg[3];\nKFz:=PolynomialRing(KF);\nF1z:=Evaluate(f1,[KF!1,sg,pg,zz]);\nF2z:=Evaluate(f2,[KF!1,sg,pg,zz]);\ncommon:=GCD(F1z,F2z); common/:=LeadingCoefficient(common);\nassert Degree(common) eq 1;\nkfour:=-Coefficient(common,0);\nassert Evaluate(F1z,kfour) eq 0 and Evaluate(F2z,kfour) eq 0;\nassert Evaluate(DefiningPolynomial(K),[KF!1,sg,pg,kfour]) eq 0;\n\"function-field substitution in image and Kummer equations\",true;\n\n// Complete audit of the identity fiber on the all-nonzero affine chart.\nR2:=PolynomialRing(Q,2,\"lex\"); Frac2:=FieldOfFractions(R2);\nmats2:=[ChangeRing(m,Frac2):m in [m1,m2,m3]];\nV0:=Vector(Frac2,[r0*(t0-r0),1,r0^2+r0*t0+t0^2,r0,t0]);\nden0:=r0^4-r0*t0^3+1;\nTan0:=Matrix([V0*m:m in mats2]);\nassert Determinant(Submatrix(Tan0,1,1,3,3)) eq den0/4;\nn1:=2*r0^4*t0-3*r0^2*t0^3+r0^2*t0+r0*t0^4-r0*t0^2+4*r0-2*t0;\nn3:=2*r0^4*t0+4*r0^3*t0^2+3*r0^2*t0^3-r0^2*t0+r0*t0^4\n -r0*t0^2-4*r0-t0^5-t0^3-2*t0;\nw0:=Vector(Frac2,[-n1/(2*den0),(4*r0^3-t0^3-t0)/(2*den0),\n -n3/(2*den0),1,0]);\nassert [InnerProduct(V0*m,w0):m in mats2] eq [Frac2|0,0,0];\nq0:=[InnerProduct(w0*m,w0):m in mats2];\ncurve0:=1+r0*t0+r0*t0^3-r0^4;\nassert (den0-(r0*t0+2)) in ideal;\ndiscnum:=R2!Numerator(q0[2]^2-q0[1]*q0[3]);\nres:=Resultant(curve0,discnum,2);\nA8:=27*r0^8+16*r0^6-19*r0^4-6*r0^2-1;\nB8:=28*r0^8+16*r0^6-18*r0^4+2*r0^2-1;\nC24:=19683*r0^24+170586*r0^22+691092*r0^20+1280610*r0^18\n -211167*r0^16-1753308*r0^14-137560*r0^12+554628*r0^10\n -58419*r0^8+70754*r0^6-2028*r0^4+1530*r0^2-1;\nexpected:=r0^4*(r0-1)^4*(r0+1)^4*(r0^2+1)^4*A8*B8*C24;\nassert res eq expected/64;\nfac:=Factorization(res);\nassert [:tup in fac] eq\n [<1,4>,<1,4>,<1,4>,<2,4>,<8,1>,<8,1>,<24,1>];\nassert &and[IsIrreducible(tup[1]):tup in fac|Degree(tup[1]) gt 1];\nassert Evaluate(curve0,[1,t0]) eq t0*(t0^2+1);\nassert Evaluate(curve0,[-1,t0]) eq -t0*(t0^2+1);\n\"all tangent/base-point exceptions and the identity fiber are excluded\",true;\n" }, { "path": "anc/code/1.3.2/1.3.2b_check_generic.py", "size_bytes": 2693, "sha256": "88697fceb5a989409805a922f48fb85e92f25c3c4a41951d64e71ddcab39eecf", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import sys, os; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom jac_e02 import *\nimport random\nrandom.seed(1)\nset_random_seed(1) # added for reproducibility: Sage random elements use their own generator\np = 10007\nFp = GF(p); F2 = GF(p**2,'w')\nR = PolynomialRing(Fp,'r,t'); r,t = R.gens()\nFt = 1+r*t+r*t**3-r**4\nh=Fp(1)/2\nm1 = matrix(Fp,5,5,[0,-h,-h,0,0, -h,-1,0,0,0, -h,0,0,0,0, 0,0,0,-1,0, 0,0,0,0,0])\nm2 = matrix(Fp,5,5,[0,0,-h,0,0, 0,-1,0,0,0, -h,0,0,0,0, 0,0,0,0,-h, 0,0,0,-h,0])\nm3 = matrix(Fp,5,5,[0,h,1,0,0, h,2,h,0,0, 1,h,0,0,0, 0,0,0,0,0, 0,0,0,0,-1])\nPs = PolynomialRing(F2,'s'); s = Ps.gen()\nf = sum(F2(c)*s**i for i,c in enumerate(fcoef))\nS4 = PolynomialRing(F2,'k1,k2,k3,k4'); PhiS = Phi(list(S4.gens()))\nstats = {'irr_ok':0,'irr_bad':0,'split_ok':0,'split_bad':0,'phi_irr_ok':0,'phi_irr_bad':0,'phi_split_onegood':0,'phi_split_none':0}\nPt = PolynomialRing(Fp,'T'); T = Pt.gen()\ncnt=0\nwhile cnt < 400:\n rv = Fp.random_element()\n if rv == 0: continue\n for tv,_ in (rv*T**3 + rv*T + 1 - rv**4).roots():\n if tv == 0 or rv*tv+2 == 0: continue\n cnt+=1\n V = vector(Fp,[rv*(tv-rv),1,rv**2+rv*tv+tv**2,rv,tv])\n den = rv**4-rv*tv**3+1\n n1 = 2*rv**4*tv-3*rv**2*tv**3+rv**2*tv+rv*tv**4-rv*tv**2+4*rv-2*tv\n n3 = 2*rv**4*tv+4*rv**3*tv**2+3*rv**2*tv**3-rv**2*tv+rv*tv**4-rv*tv**2-4*rv-tv**5-tv**3-2*tv\n w = vector(Fp,[-n1/(2*den),(4*rv**3-tv**3-tv)/(2*den),-n3/(2*den),1,0])\n assert all(V*m*w==0 for m in (m1,m2,m3)) and all(V*m*V==0 for m in (m1,m2,m3))\n q1,q2,q3 = [w*m*w for m in (m1,m2,m3)]\n a = F2(q1) - 2*s*F2(q2) + s**2*F2(q3)\n if q3 == 0 or a.discriminant()==0: continue\n roots = [x for x,e in a.roots()]\n irreducible_over_Fp = Pt(list(map(lambda c: Fp(c), a.list()))).is_irreducible()\n s1,s2 = roots\n y1sq, y2sq = f(s1), f(s2)\n k2 = s1+s2; k3 = s1*s2\n def k4(y1y2): return (F0(k2,k3) - 2*y1y2)/(s1-s2)**2\n if irreducible_over_Fp:\n ok = y1sq.is_square()\n stats['irr_ok' if ok else 'irr_bad'] += 1\n if ok:\n y1 = y1sq.sqrt(); y2 = y1.frobenius() # conjugate\n k = [1,k2,k3,k4(y1*y2)]\n stats['phi_irr_ok' if all(P(*k)==0 for P in PhiS) else 'phi_irr_bad'] += 1\n else:\n ok = Fp(y1sq).is_square() and Fp(y2sq).is_square()\n stats['split_ok' if ok else 'split_bad'] += 1\n if ok:\n y1 = y1sq.sqrt(); y2 = y2sq.sqrt()\n good = [all(P(*[1,k2,k3,k4(sg*y1*y2)])==0 for P in PhiS) for sg in (1,-1)]\n stats['phi_split_onegood' if any(good) else 'phi_split_none'] += 1\nprint(stats)\n" }, { "path": "anc/code/1.3.2/1.3.2b_symbolic_map.m", "size_bytes": 2907, "sha256": "5668e36884a2a174524d57b3fd1b90529e7a044a11d9bff549d5735b67acb193", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Exact symbolic verification of the Table 6.2 cover-to-Kummer map.\nQ:=Rationals(); A2:=AffineSpace(Q,2);\nCaff:=Curve(A2,1+rr*tt+rr*tt^3-rr^4);\nK:=FunctionField(Caff);\n\nhalf:=Q!1/2;\nm1:=Matrix(Q,5,5,[\n 0,-half,-half,0,0, -half,-1,0,0,0, -half,0,0,0,0,\n 0,0,0,-1,0, 0,0,0,0,0]);\nm2:=Matrix(Q,5,5,[\n 0,0,-half,0,0, 0,-1,0,0,0, -half,0,0,0,0,\n 0,0,0,0,-half, 0,0,0,-half,0]);\nm3:=Matrix(Q,5,5,[\n 0,half,1,0,0, half,2,half,0,0, 1,half,0,0,0,\n 0,0,0,0,0, 0,0,0,0,-1]);\nmats:=[ChangeRing(m,K):m in [m1,m2,m3]];\nV:=Vector(K,[r*(t-r),1,r^2+r*t+t^2,r,t]);\nassert [InnerProduct(V*m,V):m in mats] eq [K|0,0,0];\nTan:=Matrix([V*m:m in mats]); ker:=Kernel(Transpose(Tan));\nassert Dimension(ker) eq 2;\nw:=ExtendBasis([ker!V],ker)[2];\nqs:=[InnerProduct(w*m,w):m in mats];\nassert qs[3] ne 0;\nKx:=PolynomialRing(K);\ngeneric_tangent_quadratic:=Kx!(qs[1]-2*xgen*qs[2]+xgen^2*qs[3]);\nassert Degree(generic_tangent_quadratic) eq 2 and IsIrreducible(generic_tangent_quadratic);\nsumroots:=2*qs[2]/qs[3]; prodroots:=qs[1]/qs[3];\n\nS:=PolynomialRing(Q,4);\nf1:=278*k1^4 + 2128*k1^3*k3 + 132*k1^3*k4 + 4976*k1^2*k2^2\n -15680*k1^2*k2*k3 -648*k1^2*k2*k4 +19668*k1^2*k3^2\n +1540*k1^2*k3*k4 +384*k1*k2^3 +4456*k1*k2^2*k3\n +1904*k1*k2^2*k4 -18208*k1*k2*k3^2 -5684*k1*k2*k3*k4\n -336*k1*k2*k4^2 +30240*k1*k3^3 +4068*k1*k3^2*k4\n +540*k1*k3*k4^2 -762*k2^4 +1184*k2^3*k3 +980*k2^3*k4\n +9044*k2^2*k3^2 -1008*k2^2*k3*k4 -135*k2^2*k4^2\n -18368*k2*k3^3 -5568*k2*k3^2*k4 +19954*k3^4\n +4584*k3^3*k4 +672*k3^2*k4^2;\nf2:=1112*k1^3*k2 -2120*k1^3*k3 -4*k1^3*k4 +1652*k1^2*k2^2\n -64*k1^2*k2*k3 -132*k1^2*k2*k4 -6712*k1^2*k3^2\n +324*k1^2*k3*k4 -1528*k1*k2^3 +13984*k1*k2^2*k3\n +1088*k1*k2^2*k4 -25496*k1*k2*k3^2 -3804*k1*k2*k3*k4\n -192*k1*k2*k4^2 +5048*k1*k3^3 +3516*k1*k3^2*k4\n +388*k1*k3*k4^2 -912*k2^4 +3536*k2^3*k3 +560*k2^3*k4\n +1832*k2^2*k3^2 -576*k2^2*k3*k4 -97*k2^2*k4^2\n -17168*k2*k3^3 -2308*k2*k3^2*k4 +8940*k3^4\n +3096*k3^3*k4 +384*k3^2*k4^2;\n\nKz:=PolynomialRing(K);\nF1z:=Evaluate(f1,[K!1,sumroots,prodroots,z]);\nF2z:=Evaluate(f2,[K!1,sumroots,prodroots,z]);\ncommon:=GCD(F1z,F2z); common/:=LeadingCoefficient(common);\n\"common Kummer coordinate factor degree\",Degree(common);\nassert Degree(common) eq 1;\nkfour:=-Coefficient(common,0);\nassert Evaluate(F1z,kfour) eq 0 and Evaluate(F2z,kfour) eq 0;\n\nR0:=PolynomialRing(Q);\nH:=HyperellipticCurve(6*x^6+22*x^5+15*x^4-14*x^3-7*x^2+6*x-1);\nJ:=Jacobian(H); Kum:=KummerSurface(J);\nkumEq:=DefiningPolynomial(Kum);\nassert Evaluate(kumEq,[K!1,sumroots,prodroots,kfour]) eq 0;\nJgen:=BaseChange(J,K);\nJPgen:=RationalPoints(Jgen,generic_tangent_quadratic,2);\nassert #JPgen eq 2;\nKJgen:=KummerSurface(Jgen);\nKPgen:=KJgen!JPgen[1];\nassert KPgen eq KJgen!JPgen[2];\nassert KPgen eq KJgen![K!1,sumroots,prodroots,kfour];\n\"symbolic substitution in both image quartics and Kummer quartic\",true;\n\"k4 numerator degree data\",Degree(Numerator(kfour)),Degree(Denominator(kfour));\n" }, { "path": "anc/code/1.3.2/1.3.2c_check_fibers.py", "size_bytes": 3980, "sha256": "43f591ab280c7ce098648b0abf0394ac4d3e2ac361ea3c0ab4ad90e9e923c00c", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "from sage.all__sagemath_schemes import *\nimport time\nt0=time.time()\n# (i) smoothness of plane quartic and X=0 points\nP3 = PolynomialRing(QQ,'X,Y,Z'); X,Y,Z = P3.gens()\nFh = X**4 - Y**4 + X**2*Y*Z + Y*Z**3\nI = P3.ideal([Fh]+[Fh.derivative(v) for v in (X,Y,Z)])\nprint(\"singular locus ideal radical:\", I.radical(), \"dim\", I.dimension())\nprint(\"X=0 restriction:\", Fh.subs(X=0).factor())\n# (ii) fibers\nR = PolynomialRing(QQ,'r,t',order='lex'); r,t = R.gens()\nK = R.fraction_field()\nh = QQ(1)/2\nm1 = matrix(QQ,5,5,[0,-h,-h,0,0, -h,-1,0,0,0, -h,0,0,0,0, 0,0,0,-1,0, 0,0,0,0,0])\nm2 = matrix(QQ,5,5,[0,0,-h,0,0, 0,-1,0,0,0, -h,0,0,0,0, 0,0,0,0,-h, 0,0,0,-h,0])\nm3 = matrix(QQ,5,5,[0,h,1,0,0, h,2,h,0,0, 1,h,0,0,0, 0,0,0,0,0, 0,0,0,0,-1])\nF = 1+r*t+r*t**3-r**4\n# check quadrics vs (3)\nx1,x2,x3,u,v = PolynomialRing(QQ,'x1,x2,x3,u,v').gens()\nvec = vector([x1,x2,x3,u,v])\nQ1 = -x1*x2-x2**2-x1*x3-u**2; Q2=-x2**2-x1*x3-u*v; Q3=x1*x2+2*x2**2+2*x1*x3+x2*x3-v**2\nprint(\"matrices match (3):\", [vec*m*vec for m in (m1,m2,m3)] == [Q1,Q2,Q3])\nV = vector(K,[r*(t-r),1,r**2+r*t+t**2,r,t])\nprint(\"V on quadrics mod F:\", [R(numerator(V*m.change_ring(K)*V)).reduce(R.ideal(F))==0 if False else (R(numerator(V*m.change_ring(K)*V)) in R.ideal(F)) for m in (m1,m2,m3)])\nden = r**4-r*t**3+1\nn1 = 2*r**4*t-3*r**2*t**3+r**2*t+r*t**4-r*t**2+4*r-2*t\nn3 = 2*r**4*t+4*r**3*t**2+3*r**2*t**3-r**2*t+r*t**4-r*t**2-4*r-t**5-t**3-2*t\nw = vector(K,[-n1/(2*den),(4*r**3-t**3-t)/(2*den),-n3/(2*den),1,0])\nmK = [m.change_ring(K) for m in (m1,m2,m3)]\nprint(\"V^T M w == 0 identically:\", [V*m*w for m in mK])\nTan = matrix(K,[V*m for m in mK])\nprint(\"minor == den/4:\", Tan[:, :3].det() == den/4)\nprint(\"den-(rt+2) in (F):\", (den-(r*t+2)) in R.ideal(F))\nprint(\"r^6+r^2+8 real roots:\", PolynomialRing(QQ,'z')([8,0,1,0,0,0,1]).real_roots() if hasattr(PolynomialRing(QQ,'z')([8,0,1,0,0,0,1]),'real_roots') else PolynomialRing(QQ,'z')([8,0,1,0,0,0,1]).roots(RR))\nq = [w*m*w for m in mK]\nfor i,qq in enumerate(q):\n print(\"q%d denominator factor:\"%(i+1), qq.denominator().factor())\ne1 = (2*q[1]+4*q[2]).numerator(); e2 = (8*q[0]+13*q[2]).numerator()\nGB = R.ideal([F,e1,e2]).groebner_basis()\nprint(\"nonzero-fiber GB:\", GB)\ndisc = q[1]**2-q[0]*q[2]\nprint(\"disc denominator:\", disc.denominator().factor())\ndn = disc.numerator()\nres = F.polynomial(t).resultant(dn.polynomial(t)) if False else None\nS = PolynomialRing(QQ,'rr'); rr=S.gen()\nRt = PolynomialRing(S,'tt'); tt=Rt.gen()\nFp = Rt(F.subs(r=rr,t=tt)) if False else None\n# use Singular-backed resultant in R\nresv = F.resultant(dn, t)\nfac = resv.factor()\nprint(\"resultant factorization:\", [(f.degree(r), e) for f,e in fac], \"unit\", fac.unit())\nfor f_,e in fac:\n if f_.degree(r)<=2: print(\" small factor\", f_, e)\n uf = f_.univariate_polynomial()\n print(\" factor deg\", f_.degree(r), \"irreducible:\", uf.is_irreducible(), \"rational roots:\", uf.roots(QQ))\nZr=PolynomialRing(QQ,'r'); zr=Zr.gen()\nA8=27*zr**8+16*zr**6-19*zr**4-6*zr**2-1; B8=28*zr**8+16*zr**6-18*zr**4+2*zr**2-1\nC24=19683*zr**24+170586*zr**22+691092*zr**20+1280610*zr**18-211167*zr**16-1753308*zr**14-137560*zr**12+554628*zr**10-58419*zr**8+70754*zr**6-2028*zr**4+1530*zr**2-1\nexp_=zr**4*(zr-1)**4*(zr+1)**4*(zr**2+1)**4*A8*B8*C24\nur=resv.univariate_polynomial()\nprint(\"resultant / expected is constant:\", (ur/exp_.change_ring(QQ)) , )\n# simultaneous vanishing check\nIq = R.ideal([F,q[1].numerator(),q[2].numerator()])\nprint(\"(r^2-1)^2(r^2+1)^2 in I:\", ((r-1)**2*(r+1)**2*(r**2+1)**2) in Iq, \" t-r^7+r^3 in I:\", (t-r**7+r**3) in Iq)\n# tangent quadratic at (+-1:1:0): r=+-1,t=0 -> generic formula valid? den\nfor rv in (1,-1):\n qq = [R(qi.numerator())(rv,0)/R(qi.denominator())(rv,0) for qi in q]\n wv=[(R(c.numerator())(rv,0)/R(c.denominator())(rv,0)) for c in w]; Vv=[(R(c.numerator())(rv,0)/R(c.denominator())(rv,0)) for c in V]\n print(\"r=%d,t=0: explicit w(16) degenerates (w=V):\"%rv, wv==Vv, \" q=\", qq, \"(boundary points need another complement; Magma script uses one)\")\nprint(\"time\", time.time()-t0)\n" }, { "path": "anc/code/1.3.2/1.3.2c_zero_fiber.m", "size_bytes": 2837, "sha256": "6061f25b4a75237cb52abb0866cb62203115b655bf32b064c4570ca08003ac54", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Exact zero-fiber elimination for Table 6.2 in the affine chart X != 0.\nQ:=Rationals(); R:=PolynomialRing(Q,2,\"lex\"); K:=FieldOfFractions(R);\nhalf:=Q!1/2;\nm1:=Matrix(Q,5,5,[\n 0,-half,-half,0,0, -half,-1,0,0,0, -half,0,0,0,0,\n 0,0,0,-1,0, 0,0,0,0,0]);\nm2:=Matrix(Q,5,5,[\n 0,0,-half,0,0, 0,-1,0,0,0, -half,0,0,0,0,\n 0,0,0,0,-half, 0,0,0,-half,0]);\nm3:=Matrix(Q,5,5,[\n 0,half,1,0,0, half,2,half,0,0, 1,half,0,0,0,\n 0,0,0,0,0, 0,0,0,0,-1]);\nmats:=[ChangeRing(m,K):m in [m1,m2,m3]];\nV:=Vector(K,[r*(t-r),1,r^2+r*t+t^2,r,t]);\nTan:=Matrix([V*m:m in mats]);\nden:=r^4-r*t^3+1;\nassert Determinant(Submatrix(Tan,1,1,3,3)) eq den/4;\nn1:=2*r^4*t-3*r^2*t^3+r^2*t+r*t^4-r*t^2+4*r-2*t;\nn3:=2*r^4*t+4*r^3*t^2+3*r^2*t^3-r^2*t+r*t^4-r*t^2\n -4*r-t^5-t^3-2*t;\nw:=Vector(K,[-n1/(2*den),(4*r^3-t^3-t)/(2*den),-n3/(2*den),1,0]);\nassert [InnerProduct(V*m,w):m in mats] eq [K|0,0,0];\nq1:=InnerProduct(w*mats[1],w);\nq2:=InnerProduct(w*mats[2],w); q3:=InnerProduct(w*mats[3],w);\nnum2:=R!Numerator(q2); num3:=R!Numerator(q3);\nF:=1+r*t+r*t^3-r^4;\nI:=ideal;\ng:=(r-1)^2*(r+1)^2*(r^2+1)^2;\nh:=t-r^7+r^3;\nassert g in I and h in I;\n// This is an independent check of the simultaneous-vanishing/base-locus\n// subcase. It is not, by itself, the full Kummer-origin fiber: the origin\n// is the base point of projection to the first three Kummer coordinates.\n\"q2=q3 simultaneous-vanishing elimination polynomials\",Factorization(g),h;\n// On F=0, den=rt+2. If den=0 then r^6+r^2+8=0, impossible over Q.\nassert (den-(r*t+2)) in ideal;\n\"denominator identity modulo curve\",true;\n\n// The full origin-fiber implication is the following. If the associated\n// degree-two divisor is zero in the Jacobian, it is a member of the unique\n// hyperelliptic g^1_2 (including the fiber at infinity), so the homogeneous\n// binary x-polynomial has discriminant zero. Eliminate that entire locus.\ndiscnum:=R!Numerator(q2^2-q1*q3);\nres:=Resultant(F,discnum,2);\nfac:=Factorization(res);\nA8:=27*r^8+16*r^6-19*r^4-6*r^2-1;\nB8:=28*r^8+16*r^6-18*r^4+2*r^2-1;\nC24:=19683*r^24+170586*r^22+691092*r^20+1280610*r^18\n -211167*r^16-1753308*r^14-137560*r^12+554628*r^10\n -58419*r^8+70754*r^6-2028*r^4+1530*r^2-1;\nexpected:=r^4*(r-1)^4*(r+1)^4*(r^2+1)^4*A8*B8*C24;\nassert res eq expected/64;\n\"resultant scalar relative to displayed factorization\",Q!1/64;\n\"discriminant resultant factor degrees/exponents\",\n [: tup in fac];\nassert [: tup in fac] eq\n [<1,4>,<1,4>,<1,4>,<2,4>,<8,1>,<8,1>,<24,1>];\nlinear:=[tup[1]:tup in fac|Degree(tup[1]) eq 1];\nassert Seqset(linear) eq Seqset([r,r-1,r+1]);\nassert IsIrreducible(r^2+1);\nassert &and[IsIrreducible(tup[1]):tup in fac|Degree(tup[1]) gt 1];\nassert Evaluate(F,[1,t]) eq t*(t^2+1);\nassert Evaluate(F,[-1,t]) eq -t*(t^2+1);\n\"no rational discriminant-zero point with r*t nonzero\",true;\n" }, { "path": "anc/code/1.3.2/1.3.2d_deficiency.m", "size_bytes": 996, "sha256": "3103e515ce97976cf9152b3c3074c3a5e5e7ec94e53db4934190a0729d12ec9c", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Code 1.3.2d (part 2): deficient places and 2-Selmer size for\n// H: eta^2 = 6s^6+22s^5+15s^4-14s^3-7s^2+6s-1.\n// One-curve copy (entry \"E02\") of the independent check m1b_deficiency.m (Claude, 14 Oct 2026).\n// IsDeficient(H, p): H has no Q_p-rational divisor of degree g-1 = 1; p = 0 is the infinite place.\nSetColumns(0);\nbmk := map Integers() | O :-> MinkowskiBound(O)>;\nSetClassGroupBoundMaps(bmk, bmk);\nQ := Rationals(); P := PolynomialRing(Q);\nfor d in [<\"E02\", 6*x^6+22*x^5+15*x^4-14*x^3-7*x^2+6*x-1>] do\n H := HyperellipticCurve(d[2]); J := Jacobian(H);\n bp := BadPrimes(H);\n def := [ : p in bp] cat [<0, IsDeficient(H, 0)>];\n print d[1], \"bad primes\", bp, \"deficient (0 = infinity)\", def;\n print \" #deficient places\", #[t : t in def | t[2]];\n S, mS := TwoSelmerGroup(J);\n print \" #TwoSelmerGroup\", #S, \" J[2](Q) size\", #TwoTorsionSubgroup(J);\n pts := Points(H : Bound := 1000);\n print \" small points on H\", pts;\nend for;\n" }, { "path": "anc/code/1.3.2/1.3.2d_mordell_weil.m", "size_bytes": 1605, "sha256": "f3a6800d61bc8d71c32ad0ff3e3332e0fb54d4023ec8eda7a55a0bef7fd1066e", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Code 1.3.2d (part 1): Mordell-Weil group of J = Jac(H),\n// H: eta^2 = 6s^6+22s^5+15s^4-14s^3-7s^2+6s-1, and the position of the claimed T, G in it.\n// One-curve copy (entry \"E02\") of the independent check m1_jacobians.m (Claude, 14 Oct 2026).\n// All class-group computations are forced to the Minkowski bound (no GRH).\nSetColumns(0);\nbmk := map Integers() | O :-> MinkowskiBound(O)>;\nSetClassGroupBoundMaps(bmk, bmk);\nQ := Rationals(); P := PolynomialRing(Q);\n\ndata := [\n <\"E02\", 6*x^6+22*x^5+15*x^4-14*x^3-7*x^2+6*x-1>\n];\nfor d in data do\n name := d[1]; f := d[2];\n H := HyperellipticCurve(f); J := Jacobian(H);\n lo, hi := RankBounds(J);\n S2 := TwoSelmerGroup(J);\n T := TorsionSubgroup(J);\n MW, mw, fi, pr, ru := MordellWeilGroupGenus2(J);\n print \"==\", name, \"factors\", [ : g in Factorization(f)];\n print \" rank bounds\", lo, hi, \" #Sel2\", #S2, \" torsion\", Invariants(T);\n print \" MW\", Invariants(MW), \" finite_index\", fi, \" proved\", pr, \" rank_upper\", ru;\n for i in [1..Ngens(MW)] do\n g := mw(MW.i);\n print \" gen\", i, \"order\", Order(MW.i), g;\n if Order(MW.i) eq 0 then print \" height\", Height(g); end if;\n end for;\nend for;\n\n// Claimed generators from the proof, located inside the certified group.\nprocedure Locate(name, f, pts)\n H := HyperellipticCurve(f); J := Jacobian(H);\n MW, mw := MordellWeilGroupGenus2(J);\n for pt in pts do\n D := elt;\n print name, \"claimed point\", D, \"=\", D @@ mw;\n end for;\nend procedure;\nLocate(\"E02\", data[1][2], [, ]);\n" }, { "path": "anc/code/1.3.2/1.3.2e_nonzero_fiber.m", "size_bytes": 2008, "sha256": "06fced67c83679e02da2584395806968056589d1b1a8fda8d038134fc1e20761", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Exact fiber of the RR/Bruin map over K(2G)=K(-2G) for Table 6.2.\nQ:=Rationals(); R:=PolynomialRing(Q,2,\"lex\"); K:=FieldOfFractions(R);\nQx:=PolynomialRing(Q);\nH:=HyperellipticCurve(6*s^6+22*s^5+15*s^4-14*s^3-7*s^2+6*s-1);\nJ:=Jacobian(H); Kum:=KummerSurface(J);\nGJ:=elt;\nassert Eltseq(Kum!(2*GJ)) eq [Q|32,-128,-52,-441];\nhalf:=Q!1/2;\nm1:=Matrix(Q,5,5,[\n 0,-half,-half,0,0, -half,-1,0,0,0, -half,0,0,0,0,\n 0,0,0,-1,0, 0,0,0,0,0]);\nm2:=Matrix(Q,5,5,[\n 0,0,-half,0,0, 0,-1,0,0,0, -half,0,0,0,0,\n 0,0,0,0,-half, 0,0,0,-half,0]);\nm3:=Matrix(Q,5,5,[\n 0,half,1,0,0, half,2,half,0,0, 1,half,0,0,0,\n 0,0,0,0,0, 0,0,0,0,-1]);\nmats:=[ChangeRing(m,K):m in [m1,m2,m3]];\nV:=Vector(K,[r*(t-r),1,r^2+r*t+t^2,r,t]);\nden:=r^4-r*t^3+1;\nn1:=2*r^4*t-3*r^2*t^3+r^2*t+r*t^4-r*t^2+4*r-2*t;\nn3:=2*r^4*t+4*r^3*t^2+3*r^2*t^3-r^2*t+r*t^4-r*t^2\n -4*r-t^5-t^3-2*t;\nw:=Vector(K,[-n1/(2*den),(4*r^3-t^3-t)/(2*den),-n3/(2*den),1,0]);\ncurveIdeal:=ideal;\nassert &and[R!Numerator(InnerProduct(V*m,V)) in curveIdeal:m in mats];\nassert &and[R!Numerator(InnerProduct(V*m,w)) in curveIdeal:m in mats];\nq:=[InnerProduct(w*m,w):m in mats];\n// The first three Kummer coordinates are proportional to\n// (q3,2*q2,q1). K(2G)=(32:-128:-52:-441), so its normalized\n// root sum and product are -4 and -13/8.\ne1:=R!Numerator(2*q[2]+4*q[3]);\ne2:=R!Numerator(8*q[1]+13*q[3]);\nF:=1+r*t+r*t^3-r^4;\nI:=ideal;\nG:=GroebnerBasis(I);\n\"fiber Groebner basis\",G;\nassert G eq [r^4-r*t-1,r^2*t^2-t^2,t^3];\nassert den-(r*t+2) in ideal;\n// Every actual preimage of K(2G), whose first Kummer coordinate is nonzero,\n// satisfies e1=e2=0. The displayed basis forces t=0, and then r^4=1;\n// over Q this gives r=+-1. The explicit tangent complement is only needed\n// on the all-nonzero chart; the two boundary points were evaluated with an\n// independent complement in t6_2_sieve_certificate.m.\nfor rv in [Q|-1,1] do\n assert Evaluate(den,[rv,0]) ne 0;\nend for;\n\"fiber points\",[:rv in [Q|-1,1]];\n" }, { "path": "anc/code/1.3.2/jac_e02.py", "size_bytes": 4317, "sha256": "917e8f98537b76abb0d4286f9f09fdb505fcc343c9b88ae90ae71b5d34fd09d4", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent genus-2 arithmetic for H: y^2 = f(x) (sextic) via a quintic model over a field\n# containing a root alpha of x^2+x-1/2 (the 2-torsion point T). Kummer coordinates are\n# Cassels-Flynn (k1,k2,k3,k4) = (1, x1+x2, x1x2, beta0) in the SEXTIC model.\nfrom sage.all__sagemath_schemes import *\n\nfcoef = [-1,6,-7,-14,15,22,6] # f0..f6\n\ndef F0(k2,k3):\n f0,f1,f2,f3,f4,f5,f6 = fcoef\n return 2*f0 + f1*k2 + 2*f2*k3 + f3*k3*k2 + 2*f4*k3**2 + f5*k3**2*k2 + 2*f6*k3**3\n\nclass Model:\n def __init__(self, L, alpha):\n self.L = L; self.alpha = alpha\n RL = PolynomialRing(L,'X'); X = RL.gen(); self.RL = RL; self.X = X\n Rx = PolynomialRing(L,'xx'); xx = Rx.gen()\n f = sum(L(c)*xx**i for i,c in enumerate(fcoef))\n self.f = f\n # F5(X) = X^6 f(alpha + 1/X)\n F5 = sum(L(c)*(alpha*X+1)**i*X**(6-i) for i,c in enumerate(fcoef))\n assert F5.degree() == 5\n self.F5 = F5\n self.H = HyperellipticCurve(F5)\n self.J = self.H.jacobian()\n self.JL = self.J(L)\n def from_sextic(self, a, b):\n # a = [a0,a1] monic x^2+a1 x+a0 ; b = [b0,b1] : y = b1 x + b0\n L=self.L; X=self.X; al=self.alpha\n a0,a1 = L(a[0]),L(a[1]); b0,b1 = L(b[0]),L(b[1])\n aal = al**2 + a1*al + a0\n assert aal != 0\n u = (X**2*((al+1/X)**2) + a1*X**2*(al+1/X) + a0*X**2)\n u = self.RL(u.numerator()) if hasattr(u,'numerator') else u\n u = ((al*X+1)**2 + a1*X*(al*X+1) + a0*X**2)/aal\n v = (b1*(al*X+1)*X**2 + b0*X**3) % u\n return self.JL([u, v])\n def T(self):\n L=self.L; al=self.alpha; alp = -1-al\n u = self.X - 1/(alp-al)\n return self.JL([u, self.RL(0)])\n def kummer(self, P):\n L=self.L; al=self.alpha\n u, v = P[0], P[1]\n u = u.monic() if u.degree()>0 else u\n if u.degree() == 0:\n return [L(0),L(0),L(0),L(1)]\n if u.degree() == 1:\n X1 = -u[0]\n if X1 == 0: return None\n x1 = al + 1/X1; x2 = al\n k2 = x1+x2; k3 = x1*x2\n k4 = F0(k2,k3)/(x1-x2)**2 # y2 = 0\n return [L(1),k2,k3,k4]\n u0,u1 = u[0],u[1]; v0 = v[0]; v1 = v[1]\n if u0 == 0 or u1**2-4*u0 == 0: return None\n k2 = 2*al - u1/u0\n k3 = al**2 - al*u1/u0 + 1/u0\n y1y2 = (v1**2*u0 - v1*v0*u1 + v0**2)/u0**3\n dx2 = (u1**2-4*u0)/u0**2\n k4 = (F0(k2,k3) - 2*y1y2)/dx2\n return [L(1),k2,k3,k4]\n\ndef kummer_quartic(k, fco=fcoef):\n X0,X1,X2,X3 = k\n a12,a10,a8,a6,a4,a2,a0 = fco\n return ((-4*a8*a12 + a10**2)*X0**4 -4*a6*a12*X0**3*X1 -2*a6*a10*X0**3*X2 -4*a12*X0**3*X3\n -4*a4*a12*X0**2*X1**2 + (4*a2*a12 - 4*a4*a10)*X0**2*X1*X2 -2*a10*X0**2*X1*X3\n + (-4*a0*a12 + 2*a2*a10 - 4*a4*a8 + a6**2)*X0**2*X2**2 -4*a8*X0**2*X2*X3\n -4*a2*a12*X0*X1**3 + (8*a0*a12 - 4*a2*a10)*X0*X1**2*X2 + (4*a0*a10 - 4*a2*a8)*X0*X1*X2**2\n -2*a6*X0*X1*X2*X3 -2*a2*a6*X0*X2**3 -4*a4*X0*X2**2*X3 -4*X0*X2*X3**2 -4*a0*a12*X1**4\n -4*a0*a10*X1**3*X2 -4*a0*a8*X1**2*X2**2 + X1**2*X3**2 -4*a0*a6*X1*X2**3 -2*a2*X1*X2**2*X3\n + (-4*a0*a4 + a2**2)*X2**4 -4*a0*X2**3*X3)\n\ndef Phi(k):\n k1,k2,k3,k4 = k\n f1=(278*k1**4 + 2128*k1**3*k3 + 132*k1**3*k4 + 4976*k1**2*k2**2\n -15680*k1**2*k2*k3 -648*k1**2*k2*k4 +19668*k1**2*k3**2\n +1540*k1**2*k3*k4 +384*k1*k2**3 +4456*k1*k2**2*k3\n +1904*k1*k2**2*k4 -18208*k1*k2*k3**2 -5684*k1*k2*k3*k4\n -336*k1*k2*k4**2 +30240*k1*k3**3 +4068*k1*k3**2*k4\n +540*k1*k3*k4**2 -762*k2**4 +1184*k2**3*k3 +980*k2**3*k4\n +9044*k2**2*k3**2 -1008*k2**2*k3*k4 -135*k2**2*k4**2\n -18368*k2*k3**3 -5568*k2*k3**2*k4 +19954*k3**4\n +4584*k3**3*k4 +672*k3**2*k4**2)\n f2=(1112*k1**3*k2 -2120*k1**3*k3 -4*k1**3*k4 +1652*k1**2*k2**2\n -64*k1**2*k2*k3 -132*k1**2*k2*k4 -6712*k1**2*k3**2\n +324*k1**2*k3*k4 -1528*k1*k2**3 +13984*k1*k2**2*k3\n +1088*k1*k2**2*k4 -25496*k1*k2*k3**2 -3804*k1*k2*k3*k4\n -192*k1*k2*k4**2 +5048*k1*k3**3 +3516*k1*k3**2*k4\n +388*k1*k3*k4**2 -912*k2**4 +3536*k2**3*k3 +560*k2**3*k4\n +1832*k2**2*k3**2 -576*k2**2*k3*k4 -97*k2**2*k4**2\n -17168*k2*k3**3 -2308*k2*k3**2*k4 +8940*k3**4\n +3096*k3**3*k4 +384*k3**2*k4**2)\n return [f1,f2]\n\ndef primitive(k):\n # k in Q^4 -> primitive integer vector\n k = [QQ(c) for c in k]\n d = lcm([c.denominator() for c in k])\n k = [ZZ(c*d) for c in k]\n g = gcd(k)\n return [c//g for c in k]\n" }, { "path": "anc/code/1.3.3/1.3.3a_certificate.m", "size_bytes": 2409, "sha256": "1eaf02fed83058def1a91ae9c16a01b22278db750c91a1ea2e121c4e6af6cc26", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Assert-based exact certificate for Table 6, equation 4:\n// X^4 + X^2 Y^2 + Y^3 Z - Y Z^3 = 0.\n//\n// Run in a fresh Magma V2.29-8 process. This file does not invoke\n// SetClassGroupBounds(\"GRH\"); Magma's fresh-session default is the\n// unconditional class-group proof mode.\n\nQ := Rationals();\nP2 := ProjectiveSpace(Q,2);\nC := Curve(P2, X^4 + X^2*Y^2 + Y^3*Z - Y*Z^3);\nassert IsNonsingular(C);\nassert Genus(C) eq 3;\n\n// Ritzenthaler--Romagny, Theorem 1.1, after renaming their involution\n// coordinate y as X and their base coordinates x,z as Y,Z.\nA := Matrix(Q,3,3,[0,1,0, -1,0,0, 1,0,-1]);\nAi := A^-1;\nexpectedAi := Matrix(Q,3,3,[0,-1,0, 1,0,0, 0,-1,-1]);\nassert Ai eq expectedAi;\nassert A*Ai eq IdentityMatrix(Q,3);\n\nR := PolynomialRing(Q);\na := Ai[1,1] + 2*Ai[2,1]*s + Ai[3,1]*s^2;\nb := Ai[1,2] + 2*Ai[2,2]*s + Ai[3,2]*s^2;\nc := Ai[1,3] + 2*Ai[2,3]*s + Ai[3,3]*s^2;\nassert a eq 2*s;\nassert b eq -(s^2+1);\nassert c eq -s^2;\n\nFprym := b*(b^2-a*c);\nexpectedFprym := -(s^2+1)*(s^4+2*s^3+2*s^2+1);\nassert Fprym eq expectedFprym;\nassert GCD(Fprym, Derivative(Fprym)) eq 1;\n\nH := HyperellipticCurve(Fprym);\nJH := Jacobian(H);\nassert Genus(H) eq 2;\nrankLower, rankUpper := RankBounds(JH);\nassert rankLower eq 0 and rankUpper eq 0;\nTJH, mapTJH := TorsionSubgroup(JH);\nassert #TJH eq 2;\n\n// Good-reduction torsion bounds and independent Frobenius checks.\nfor p in [3,5] do\n F := GF(p);\n PP2 := ProjectiveSpace(F,2);\n Cp := Curve(PP2, x^4 + x^2*y^2 + y^3*z - y*z^3);\n assert IsNonsingular(Cp);\n\n Rp := PolynomialRing(F);\n Hp := HyperellipticCurve(-(t^2+1)*(t^4+2*t^3+2*t^2+1));\n Ep := EllipticCurve([F|0,0,0,-16,16]);\n\n inv := ClassGroupAbelianInvariants(Cp);\n expectedInv := p eq 3 select [2,14,0] else [2,176,0];\n assert inv eq expectedInv;\n\n LC := LPolynomial(Cp);\n LE := LPolynomial(Ep);\n LH := LPolynomial(Hp);\n assert LC eq LE*LH;\n\n ZT := PolynomialRing(Integers());\n LEz := ZT!LE;\n LHz := ZT!LH;\n LCz := ZT!LC;\n if p eq 3 then\n assert LEz eq 1 + 3*T + 3*T^2;\n assert LHz eq 1 - 3*T + 6*T^2 - 9*T^3 + 9*T^4;\n assert LCz eq 1 + 27*T^6;\n else\n assert LEz eq 1 + 2*T + 5*T^2;\n assert LHz eq 1 + 2*T + 6*T^2 + 10*T^3 + 25*T^4;\n assert LCz eq 1 + 4*T + 15*T^2 + 32*T^3\n + 75*T^4 + 100*T^5 + 125*T^6;\n end if;\nend for;\n\n\"CERTIFIED: all exact assertions passed\";\n" }, { "path": "anc/code/1.3.3/1.3.3a_extra.gp", "size_bytes": 972, "sha256": "4244f7b3f8cd464ba459fd92d490832f73f4725bbf3a0fd769de2fb84f38540c", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ 1.3.3 extra exact checks (PARI/GP)\nA=[0,1,0;-1,0,0;1,0,-1]; Ai=A^-1; print(\"A^-1 = \", Ai);\na=Ai[1,1]+2*Ai[2,1]*s+Ai[3,1]*s^2; b=Ai[1,2]+2*Ai[2,2]*s+Ai[3,2]*s^2; c=Ai[1,3]+2*Ai[2,3]*s+Ai[3,3]*s^2;\nprint(\"a,b,c = \", [a,b,c]); print(\"b(b^2-ac) = \", b*(b^2-a*c), \" == -(s^2+1)(s^4+2s^3+2s^2+1): \", b*(b^2-a*c)==-(s^2+1)*(s^4+2*s^3+2*s^2+1));\n\\\\ quotient E: with X=x^2, (2X+y^2)^2 = y^4-4y^3z+4yz^3 (z=1)\nprint(\"(2X+y^2)^2-(y^4-4y^3+4y) - 4*(X^2+y^2*X+y^3-y) = \", (2*X+y^2)^2-(y^4-4*y^3+4*y)-4*(X^2+y^2*X+y^3-y));\nE=ellinit(ellfromeqn(W^2-(y^4-4*y^3+4*y))); E37=ellinit([0,0,0,-16,16]);\nprint(\"E: conductor \", ellglobalred(E)[1], \" j \", E.j, \" ; Y^2=X^3-16X+16: conductor \", ellglobalred(E37)[1], \" j \", E37.j, \" same minimal model: \", ellminimalmodel(E)[1..5]==ellminimalmodel(E37)[1..5], \" \", ellminimalmodel(E)[1..5]);\nL3=1+27*T^6; L5=1+4*T+15*T^2+32*T^3+75*T^4+100*T^5+125*T^6;\nprint(\"L3(1), L5(1) = \", subst(L3,T,1), \", \", subst(L5,T,1), \" gcd = \", gcd(28,352));\n" }, { "path": "anc/code/1.3.3/1.3.3b_check_counts.gp", "size_bytes": 1514, "sha256": "9db1b274e60f8eee8dbb5f7945439b34cbf7ee2e0b7c7693dd143eac00924430", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.3.3b cross-check: one-curve copy (entry \"E04\") of our PARI script prym_counts.gp.\n\\\\ Independent of Magma: check #C(F_q) - (q+1) = [#Q(F_q) - (q+1)] + [#H(F_q) - (q+1)]\n\\\\ for q = p, p^2, p^3, which is equivalent to L_p(C) = L_p(C/iota) L_p(H) (genus 3 = 1 + 2).\n\\\\ C: X^4 + a(Y,Z) X^2 + b(Y,Z) = 0, quotient Q: w^2 = a^2 - 4b, Prym model H: y^2 = h(s).\n\ncntX(A,B)={my(d=A^2-4*B,c=0,s,u); if(d==0, u=-A/2; return(if(u==0,1,if(issquare(u),2,0)))); if(!issquare(d),return(0)); s=sqrt(d); for(e=0,1, u=(-A+(-1)^e*s)/2; c+=if(u==0,1,if(issquare(u),2,0))); c}\nchi(x)=if(x==0,0,if(issquare(x),1,-1));\n\\\\ all elements of F_q via a primitive root\nelts(g,q)={my(v=vector(q),t=g^0); v[1]=0*g; for(i=2,q, v[i]=t; t*=g); v}\ncntHyp(f,E,g)={my(n=0,d=poldegree(f),lc=pollead(f)); for(i=1,#E, n+=1+chi(subst(f,'x,E[i]))); if(d%2==1, n+=1, n+=1+chi(lc*g^0)); n}\ncntC(a,b,E,g)={my(n=0,A,B); for(i=1,#E, A=g^0*subst(subst(a,'y,E[i]),'z,g^0); B=g^0*subst(subst(b,'y,E[i]),'z,g^0); n+=cntX(A,B)); A=g^0*subst(subst(a,'y,g^0),'z,0); B=g^0*subst(subst(b,'y,g^0),'z,0); n+=cntX(A,B); n}\ncheck(name,a,b,h,plist)={my(gq=subst(subst(a^2-4*b,'y,'x),'z,1),res=[]);\n for(j=1,#plist, my(p=plist[j],ok=1);\n for(k=1,3, my(g=ffprimroot(ffgen(p^k)), q=p^k, E=elts(g,q), nC, nQ, nH);\n nC=cntC(a,b,E,g); nQ=cntHyp(gq,E,g); nH=cntHyp(h,E,g);\n if(nC-(q+1)!=(nQ-(q+1))+(nH-(q+1)), ok=0));\n res=concat(res,[[p,ok]]));\n print(name,\" \",res);}\ncheck(\"E04\", y^2, y^3*z-y*z^3, -(x^2+1)*(x^4+2*x^3+2*x^2+1), [3,5,7,11,13,17,19,23]);\n" }, { "path": "anc/code/1.3.3/1.3.3b_prym_lpoly.m", "size_bytes": 1662, "sha256": "d348005142d0522b5763a340b8a199efe440a43362b1c57d7f60ef43a799a3bf", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Code 1.3.3b: Prym identification for x^4+x^2y^2+y^3z-yz^3=0 by L-polynomials at all good primes 3..79.\n// One-curve copy (entry \"E04\") of the independent check m2_prym_lpoly.m (Claude, 14 Oct 2026).\n// For C: X^4 + q(Y,Z) X^2 + r(Y,Z) = 0 the quotient by X -> -X is the genus-1\n// curve W^2 = q^2 - 4r, built here from the equation alone. If J_C is\n// isogenous over Q to Jac(C/iota) x J_H then L_p(C) = L_p(C/iota) L_p(H) at\n// every prime of good reduction. A wrong quadratic twist of H would break\n// this at about half the primes.\nSetColumns(0);\nQ := Rationals(); A := PolynomialRing(Q,3); P := PolynomialRing(Q);\ndata := [\n <\"E04\", Y^2, Y^3*Z-Y*Z^3, -(s^2+1)*(s^4+2*s^3+2*s^2+1)>\n];\nfor d in data do\n name := d[1]; q := d[2]; r := d[3]; h := d[4];\n F := X^4 + q*X^2 + r;\n g := Evaluate(q^2 - 4*r, [s, 1, 0]); // quotient genus-1 curve W^2 = g(s)\n good := []; bad := []; skipped := [];\n for p in [p : p in PrimesInInterval(3, 79)] do\n k := GF(p); P2 := ProjectiveSpace(k,2);\n Cp := Curve(P2, Evaluate(F, [y, z, x]));\n kp := PolynomialRing(k);\n gp := kp ! g; hp := kp ! h;\n if not IsNonsingular(Cp) or Discriminant(gp) eq 0 or Discriminant(hp) eq 0\n or Degree(gp) lt 3 or Degree(hp) lt 5 then\n Append(~skipped, p); continue;\n end if;\n Ep := HyperellipticCurve(gp); Hp := HyperellipticCurve(hp);\n if LPolynomial(Cp) eq LPolynomial(Ep)*LPolynomial(Hp) then\n Append(~good, p);\n else\n Append(~bad, p);\n end if;\n end for;\n print name, \"quotient W^2 =\", g;\n print \" L(C)=L(C/iota)L(H) holds at\", good;\n print \" FAILS at\", bad, \" skipped (bad reduction)\", skipped;\nend for;\n" }, { "path": "anc/code/1.3.3/1.3.3c_mordell_weil.m", "size_bytes": 1125, "sha256": "064739e134bbacc3fcc0b461fe36a545b081c40c40bda2f3ddd97db75e482734", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Code 1.3.3c: Mordell-Weil group of J_H, H: eta^2 = -(s^2+1)(s^4+2s^3+2s^2+1).\n// One-curve copy (entry \"E04\") of the independent check m1_jacobians.m (Claude, 14 Oct 2026).\n// All class-group computations are forced to the Minkowski bound (no GRH).\nSetColumns(0);\nbmk := map Integers() | O :-> MinkowskiBound(O)>;\nSetClassGroupBoundMaps(bmk, bmk);\nQ := Rationals(); P := PolynomialRing(Q);\n\ndata := [\n <\"E04\", -(x^2+1)*(x^4+2*x^3+2*x^2+1)>\n];\nfor d in data do\n name := d[1]; f := d[2];\n H := HyperellipticCurve(f); J := Jacobian(H);\n lo, hi := RankBounds(J);\n S2 := TwoSelmerGroup(J);\n T := TorsionSubgroup(J);\n MW, mw, fi, pr, ru := MordellWeilGroupGenus2(J);\n print \"==\", name, \"factors\", [ : g in Factorization(f)];\n print \" rank bounds\", lo, hi, \" #Sel2\", #S2, \" torsion\", Invariants(T);\n print \" MW\", Invariants(MW), \" finite_index\", fi, \" proved\", pr, \" rank_upper\", ru;\n for i in [1..Ngens(MW)] do\n g := mw(MW.i);\n print \" gen\", i, \"order\", Order(MW.i), g;\n if Order(MW.i) eq 0 then print \" height\", Height(g); end if;\n end for;\nend for;\n" }, { "path": "anc/code/1.3.4/1.3.4a_certificate.m", "size_bytes": 2525, "sha256": "b4b12075410587d0d8a868bf456982d292d19df5a66699fb041d353514cea921", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Exact certificate for Table 6, equation 5:\n// X^4 + Y^4 + X^2 Y Z - Y Z^3 = 0.\nQ := Rationals();\nP2 := ProjectiveSpace(Q,2);\nC := Curve(P2,X^4+Y^4+X^2*Y*Z-Y*Z^3);\nassert IsNonsingular(C);\nassert Genus(C) eq 3;\n\"C_Q nonsingular\", IsNonsingular(C), \"genus\", Genus(C);\n\n// The elliptic quotient on Y != 0. Put u=X/Y and t=Z/Y.\n// The quotient map is (u,t) |-> (4t,4(2u^2+t)) on\n// E: v^2=w^3+w^2-64.\nS := PolynomialRing(Q,2);\nFC := u^4+1+u^2*t-t^3;\nw := 4*t;\nv := 4*(2*u^2+t);\nassert v^2-(w^3+w^2-64) eq 64*FC;\n\n// Ritzenthaler--Romagny Theorem 1.1. In their form\n// X^4-h(Y,Z)X^2+f(Y,Z)g(Y,Z)=0, take\n// f=Y(Y-Z), h=-YZ, g=Y^2+YZ+Z^2. The rows of A are\n// the coefficients on Y^2,YZ,Z^2; the RR polynomials below use the\n// columns of A^-1.\nA := Matrix(Q,3,3,[1,-1,0, 0,-1,0, 1,1,1]);\nAi := A^-1;\nassert A*Ai eq IdentityMatrix(Q,3);\nR := PolynomialRing(Q);\na := Ai[1,1]+2*Ai[2,1]*s+Ai[3,1]*s^2;\nb := Ai[1,2]+2*Ai[2,2]*s+Ai[3,2]*s^2;\nc := Ai[1,3]+2*Ai[2,3]*s+Ai[3,3]*s^2;\nFprym := b*(b^2-a*c);\nassert a eq 1-s^2;\nassert b eq 2*s^2-2*s-1;\nassert c eq s^2;\nassert Fprym eq 10*s^6-26*s^5+9*s^4+18*s^3-5*s^2-6*s-1;\nH := HyperellipticCurve(Fprym);\nJH := Jacobian(H);\nassert Genus(H) eq 2;\nlo,hi := RankBounds(JH);\nassert lo eq 0 and hi eq 0;\nTJH,mpTJH := TorsionSubgroup(JH);\nassert Invariants(TJH) eq [2];\nMW,mwmap,finite_index,proved,rank_upper := MordellWeilGroupGenus2(JH);\nassert finite_index and proved and rank_upper eq 0;\nassert Invariants(MW) eq [2];\n\"A\", A;\n\"A inverse\", Ai;\n\"a,b,c\", a,b,c;\n\"Prym genus-2 polynomial\", Fprym;\n\"H genus\", Genus(H), \"JH rank bounds\", lo,hi,\n \"JH torsion invariants\", Invariants(TJH),\n \"certified Mordell-Weil\",MW,finite_index,proved,rank_upper;\n\n// Good-reduction checks. The trailing zero in a class-group invariant\n// denotes the degree Z summand; preceding entries are Pic^0(F_p).\nps := [5,7,11];\nexpected := [[110,0],[2,140,0],[17,68,0]];\nfor i in [1..#ps] do\n p := ps[i];\n F := GF(p);\n PP2 := ProjectiveSpace(F,2);\n Cp := Curve(PP2,x^4+y^4+x^2*y*z-y*z^3);\n assert IsNonsingular(Cp);\n Rp := PolynomialRing(F);\n Hp := HyperellipticCurve(10*q^6-26*q^5+9*q^4+18*q^3-5*q^2-6*q-1);\n Ep := EllipticCurve([F|0,1,0,0,-64]);\n inv := ClassGroupAbelianInvariants(Cp);\n assert inv eq expected[i];\n assert LPolynomial(Cp) eq LPolynomial(Ep)*LPolynomial(Hp);\n \"p\",p,\"C nonsingular\",IsNonsingular(Cp),\n \"class invariants\",inv,\n \"L(C)=L(E)L(H)\",true,\n LPolynomial(Cp),LPolynomial(Ep),LPolynomial(Hp);\nend for;\n" }, { "path": "anc/code/1.3.4/1.3.4a_check_counts.gp", "size_bytes": 1709, "sha256": "b43d23d76aa05d3adb6f37eedba8b5a78b4e864c755bfe8b8398fefd1c95e9cc", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.3.4a cross-check: one-curve copy (entry \"E05\", with the wrong-twist control) of our PARI script prym_counts.gp.\n\\\\ Independent of Magma: check #C(F_q) - (q+1) = [#Q(F_q) - (q+1)] + [#H(F_q) - (q+1)]\n\\\\ for q = p, p^2, p^3, which is equivalent to L_p(C) = L_p(C/iota) L_p(H) (genus 3 = 1 + 2).\n\\\\ C: X^4 + a(Y,Z) X^2 + b(Y,Z) = 0, quotient Q: w^2 = a^2 - 4b, Prym model H: y^2 = h(s).\n\ncntX(A,B)={my(d=A^2-4*B,c=0,s,u); if(d==0, u=-A/2; return(if(u==0,1,if(issquare(u),2,0)))); if(!issquare(d),return(0)); s=sqrt(d); for(e=0,1, u=(-A+(-1)^e*s)/2; c+=if(u==0,1,if(issquare(u),2,0))); c}\nchi(x)=if(x==0,0,if(issquare(x),1,-1));\n\\\\ all elements of F_q via a primitive root\nelts(g,q)={my(v=vector(q),t=g^0); v[1]=0*g; for(i=2,q, v[i]=t; t*=g); v}\ncntHyp(f,E,g)={my(n=0,d=poldegree(f),lc=pollead(f)); for(i=1,#E, n+=1+chi(subst(f,'x,E[i]))); if(d%2==1, n+=1, n+=1+chi(lc*g^0)); n}\ncntC(a,b,E,g)={my(n=0,A,B); for(i=1,#E, A=g^0*subst(subst(a,'y,E[i]),'z,g^0); B=g^0*subst(subst(b,'y,E[i]),'z,g^0); n+=cntX(A,B)); A=g^0*subst(subst(a,'y,g^0),'z,0); B=g^0*subst(subst(b,'y,g^0),'z,0); n+=cntX(A,B); n}\ncheck(name,a,b,h,plist)={my(gq=subst(subst(a^2-4*b,'y,'x),'z,1),res=[]);\n for(j=1,#plist, my(p=plist[j],ok=1);\n for(k=1,3, my(g=ffprimroot(ffgen(p^k)), q=p^k, E=elts(g,q), nC, nQ, nH);\n nC=cntC(a,b,E,g); nQ=cntHyp(gq,E,g); nH=cntHyp(h,E,g);\n if(nC-(q+1)!=(nQ-(q+1))+(nH-(q+1)), ok=0));\n res=concat(res,[[p,ok]]));\n print(name,\" \",res);}\nplist=[5,7,11,13,17,19,23];\ncheck(\"E05\", y*z, y^4-y*z^3, 10*x^6-26*x^5+9*x^4+18*x^3-5*x^2-6*x-1, plist);\n\\\\ negative control: a wrong twist of E05's H must fail\ncheck(\"E05-twist(-1)\", y*z, y^4-y*z^3, -(10*x^6-26*x^5+9*x^4+18*x^3-5*x^2-6*x-1), plist);\n" }, { "path": "anc/code/1.3.4/1.3.4a_check_rr.py", "size_bytes": 1173, "sha256": "8c95b66022778ef32a31a072a07898d4ec36627a87bc5d08726b5adddec021ff", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.4a cross-check (SymPy, no Magma): the Ritzenthaler-Romagny data of\n# x^4 + y^4 + x^2yz - yz^3 = 0 and smoothness of the quartic mod 5, 7, 11.\n# Taken from a helper script chk2.py (the parts for this equation); the smoothness loop is run at the\n# three primes used by the certificate 1.3.4a_certificate.m.\nfrom sympy import symbols, Matrix, expand, factor, diff, groebner\ns, X, Y, Z = symbols('s X Y Z')\n# E05 RR\nA = Matrix([[1, -1, 0], [0, -1, 0], [1, 1, 1]]); Ai = A.inv(); print(\"E05 Ai\", Ai)\naa = Ai[0, 0] + 2*Ai[1, 0]*s + Ai[2, 0]*s**2\nbb = Ai[0, 1] + 2*Ai[1, 1]*s + Ai[2, 1]*s**2\ncc = Ai[0, 2] + 2*Ai[1, 2]*s + Ai[2, 2]*s**2\nprint(\" a,b,c=\", aa, bb, cc, \" f_H=\", expand(bb*(bb**2 - aa*cc)), factor(expand(bb*(bb**2 - aa*cc))))\n# smoothness: Groebner basis of F and its partials mod p in each affine chart is [1]\nG = X**4 + Y**4 + X**2*Y*Z - Y*Z**3\nfor p in [5, 7, 11]:\n ok = True\n for ch in [X, Y, Z]:\n eqs = [e.subs(ch, 1) for e in (G, diff(G, X), diff(G, Y), diff(G, Z))]\n gb = groebner(eqs, *[w for w in (X, Y, Z) if w != ch], modulus=p, order='grevlex')\n ok = ok and (list(gb.exprs) == [1])\n print(\"E05 smooth mod\", p, ok)\n" }, { "path": "anc/code/1.3.4/1.3.4b_check_q2.gp", "size_bytes": 190, "sha256": "d181dcdfb6ef914ee6643e9ea84f6595a432c4d28163e5ea09dd3aef9efc42e4", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "f=10*s^6-26*s^5+9*s^4+18*s^3-5*s^2-6*s-1; print(\"f mod 8 on Z_2: \",Set(vector(8,a,subst(f,s,a-1)%8))); print(\"s^-6 f mod 4 near infinity: \",Set(vector(64,a,subst(polrecip(f),s,2*(a-1))%4)))\n" }, { "path": "anc/code/1.3.4/1.3.4b_deficiency.m", "size_bytes": 987, "sha256": "353b28c371a2cac17d6172804c012a55d5ee98b1a7aa67b638c307b86d44291b", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Code 1.3.4b: deficient places and 2-Selmer size for\n// H: eta^2 = 10s^6-26s^5+9s^4+18s^3-5s^2-6s-1.\n// One-curve copy (entry \"E05\") of the independent check m1b_deficiency.m (Claude, 14 Oct 2026).\n// IsDeficient(H, p): H has no Q_p-rational divisor of degree g-1 = 1; p = 0 is the infinite place.\nSetColumns(0);\nbmk := map Integers() | O :-> MinkowskiBound(O)>;\nSetClassGroupBoundMaps(bmk, bmk);\nQ := Rationals(); P := PolynomialRing(Q);\nfor d in [<\"E05\", 10*x^6-26*x^5+9*x^4+18*x^3-5*x^2-6*x-1>] do\n H := HyperellipticCurve(d[2]); J := Jacobian(H);\n bp := BadPrimes(H);\n def := [ : p in bp] cat [<0, IsDeficient(H, 0)>];\n print d[1], \"bad primes\", bp, \"deficient (0 = infinity)\", def;\n print \" #deficient places\", #[t : t in def | t[2]];\n S, mS := TwoSelmerGroup(J);\n print \" #TwoSelmerGroup\", #S, \" J[2](Q) size\", #TwoTorsionSubgroup(J);\n pts := Points(H : Bound := 1000);\n print \" small points on H\", pts;\nend for;\n" }, { "path": "anc/code/1.3.5/1.3.5a_check_smooth.py", "size_bytes": 811, "sha256": "6e351f84db21054d259dc88b4ef7d4dcaf8fd065c0fa8223b243afe5559b25e4", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.5a cross-check (SymPy, no Magma): x^4 - x^2y^2 + y^3z + yz^3 = 0 is smooth mod p for the primes\n# of 1.3.5a_reductions.m. Taken from a helper script chk2.py (smoothness part, this equation only); the\n# loop is run at the six primes of the Magma script instead of 3, 5, 47.\nfrom sympy import symbols, diff, groebner\nX, Y, Z = symbols('X Y Z')\nG = X**4 - X**2*Y**2 + Y**3*Z + Y*Z**3\nfor p in [3, 5, 11, 17, 19, 53]:\n ok = True\n for ch in [X, Y, Z]:\n # Groebner basis of F and its partial derivatives mod p in the affine chart ch = 1 is [1]\n eqs = [e.subs(ch, 1) for e in (G, diff(G, X), diff(G, Y), diff(G, Z))]\n gb = groebner(eqs, *[w for w in (X, Y, Z) if w != ch], modulus=p, order='grevlex')\n ok = ok and (list(gb.exprs) == [1])\n print(\"E07 smooth mod\", p, ok)\n" }, { "path": "anc/code/1.3.5/1.3.5a_reductions.m", "size_bytes": 371, "sha256": "d4e354ad04d0aeddae3aeb9d7dee1d2730d1eb87fab50d6b234d62b0c2680c83", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "ps:=[3,5,11,17,19,53];\nexpected:=[[40,0],[6,72,0],[3,468,0],[4,1316,0],[6240,0],\n [2,87570,0]];\nfor i in [1..#ps] do\n p:=ps[i];\n k:=GF(p); P2:=ProjectiveSpace(k,2);\n C:=Curve(P2,X^4-X^2*Y^2+Y^3*Z+Y*Z^3);\n assert IsNonsingular(C);\n inv:=ClassGroupAbelianInvariants(C);\n assert inv eq expected[i];\n \"p\",p,\"smooth\",true,\"invariants\",inv;\nend for;\n\n\n\n\n" }, { "path": "anc/code/1.3.5/1.3.5b_check_determinant.py", "size_bytes": 701, "sha256": "4a5fdd29a50adbf0c2b7aa4ab0643001991af630f2b2a759396e722b3ed0fd59", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "from sympy import symbols, Matrix, hessian, groebner, expand, Poly\nfrom itertools import combinations\na,b,c,u,v,r,t,s=symbols('a b c u v r t s')\nX=[a,b,c,u,v]\nq1=b**2+a*c; q2=a*b; q3=-b**2-a*c+b*c\nQ=[q1-u**2, q2-u*v, q3-v**2]\nM=[hessian(q,X)/2 for q in Q]\npt=Matrix([t,r**2,1+t**2,r,r*t])\nN=Matrix.vstack(*[(pt.T*m) for m in M])\nminors=[expand(N[:,list(cs)].det()) for cs in combinations(range(5),3)]\nrel=r**4-r**2+t+t**3\nG=groebner([rel]+minors,r,t,order='lex')\nprint(\"GB(curve, 3x3 minors of tangent matrix):\",G.exprs)\n# determinant curve\nx=symbols('x')\nfrom sympy import Symbol\nabc=[a,b,c]\nMs=[hessian(q,abc)/2 for q in (q1,q2,q3)]\nF=expand(-4*(Ms[0]-2*x*Ms[1]+x**2*Ms[2]).det())\nprint(\"Fpol =\",F)\n" }, { "path": "anc/code/1.3.5/1.3.5b_check_mordell_weil.m", "size_bytes": 1578, "sha256": "f594b2ef6b5800686ce00b706a8459c24bafdc0e833dae2e9b1ef9ed31cb4211", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Code 1.3.5b cross-check: Mordell-Weil group of J_H, H: y^2 = -s^6-2s^5+3s^4+2s^3-3s^2+1,\n// and the position of the claimed T, G in it.\n// One-curve copy (entry \"E07\") of the independent check m1_jacobians.m (Claude, 14 Oct 2026).\n// All class-group computations are forced to the Minkowski bound (no GRH).\nSetColumns(0);\nbmk := map Integers() | O :-> MinkowskiBound(O)>;\nSetClassGroupBoundMaps(bmk, bmk);\nQ := Rationals(); P := PolynomialRing(Q);\n\ndata := [\n <\"E07\", -x^6-2*x^5+3*x^4+2*x^3-3*x^2+1>\n];\nfor d in data do\n name := d[1]; f := d[2];\n H := HyperellipticCurve(f); J := Jacobian(H);\n lo, hi := RankBounds(J);\n S2 := TwoSelmerGroup(J);\n T := TorsionSubgroup(J);\n MW, mw, fi, pr, ru := MordellWeilGroupGenus2(J);\n print \"==\", name, \"factors\", [ : g in Factorization(f)];\n print \" rank bounds\", lo, hi, \" #Sel2\", #S2, \" torsion\", Invariants(T);\n print \" MW\", Invariants(MW), \" finite_index\", fi, \" proved\", pr, \" rank_upper\", ru;\n for i in [1..Ngens(MW)] do\n g := mw(MW.i);\n print \" gen\", i, \"order\", Order(MW.i), g;\n if Order(MW.i) eq 0 then print \" height\", Height(g); end if;\n end for;\nend for;\n\n// Claimed generators from the proofs, located inside the certified groups.\nprocedure Locate(name, f, pts)\n H := HyperellipticCurve(f); J := Jacobian(H);\n MW, mw := MordellWeilGroupGenus2(J);\n for pt in pts do\n D := elt;\n print name, \"claimed point\", D, \"=\", D @@ mw;\n end for;\nend procedure;\nLocate(\"E07\", data[1][2], [, ]);\n" }, { "path": "anc/code/1.3.5/1.3.5b_check_prym_lpoly.m", "size_bytes": 1677, "sha256": "64b5a68b24a1861e1570cdea0cedd89b266d32bbdda0664fee0c4e23b2866ca1", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Code 1.3.5b cross-check: Prym identification for x^4-x^2y^2+y^3z+yz^3=0 by L-polynomials at all good primes 3..79.\n// One-curve copy (entry \"E07\") of the independent check m2_prym_lpoly.m (Claude, 14 Oct 2026).\n// For C: X^4 + q(Y,Z) X^2 + r(Y,Z) = 0 the quotient by X -> -X is the genus-1\n// curve W^2 = q^2 - 4r, built here from the equation alone. If J_C is\n// isogenous over Q to Jac(C/iota) x J_H then L_p(C) = L_p(C/iota) L_p(H) at\n// every prime of good reduction. A wrong quadratic twist of H would break\n// this at about half the primes.\nSetColumns(0);\nQ := Rationals(); A := PolynomialRing(Q,3); P := PolynomialRing(Q);\ndata := [\n <\"E07\", -Y^2, Y^3*Z+Y*Z^3, -s^6-2*s^5+3*s^4+2*s^3-3*s^2+1>\n];\nfor d in data do\n name := d[1]; q := d[2]; r := d[3]; h := d[4];\n F := X^4 + q*X^2 + r;\n g := Evaluate(q^2 - 4*r, [s, 1, 0]); // quotient genus-1 curve W^2 = g(s)\n good := []; bad := []; skipped := [];\n for p in [p : p in PrimesInInterval(3, 79)] do\n k := GF(p); P2 := ProjectiveSpace(k,2);\n Cp := Curve(P2, Evaluate(F, [y, z, x]));\n kp := PolynomialRing(k);\n gp := kp ! g; hp := kp ! h;\n if not IsNonsingular(Cp) or Discriminant(gp) eq 0 or Discriminant(hp) eq 0\n or Degree(gp) lt 3 or Degree(hp) lt 5 then\n Append(~skipped, p); continue;\n end if;\n Ep := HyperellipticCurve(gp); Hp := HyperellipticCurve(hp);\n if LPolynomial(Cp) eq LPolynomial(Ep)*LPolynomial(Hp) then\n Append(~good, p);\n else\n Append(~bad, p);\n end if;\n end for;\n print name, \"quotient W^2 =\", g;\n print \" L(C)=L(C/iota)L(H) holds at\", good;\n print \" FAILS at\", bad, \" skipped (bad reduction)\", skipped;\nend for;\n" }, { "path": "anc/code/1.3.5/1.3.5b_check_tangent.py", "size_bytes": 1096, "sha256": "17b7f65d1f4e69ba59e982155bbbb5936fa36f4b7347135a6bdcb9e07b5f03fc", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "from sympy import symbols, Matrix, expand, rem, Poly, hessian, Rational, factor\na,b,c,u,v,r,t,s=symbols('a b c u v r t s')\nX=[a,b,c,u,v]\nq1=b**2+a*c; q2=a*b; q3=-b**2-a*c+b*c\nQ=[q1-u**2, q2-u*v, q3-v**2]\nM=[hessian(q,X)/2 for q in Q] # q(x)= x^T M x\nR=r**2\npt=Matrix([t,R,1+t**2,r,r*t])\nrel=r**4-r**2+t+t**3\ndef red(e): return rem(expand(e), rel, t)\nprint(\"point on quadrics mod rel:\", [red((pt.T*m*pt)[0]) for m in M])\nN=Matrix.vstack(*[(pt.T*m) for m in M]) # 3x5\nA0=-4*R**3*t+13*R**2*t-12*R*t**2-R*t+4*R+3*t**2-1\nB=2*(3*R**2*t**2+7*R**2+3*R*t**2-5*R+4*t)\nA2=-R**4+4*R**3*t-2*R**3-R**2+12*R*t**2-4*R*t-4*R-4*t**2\nfor j in (0,2):\n cols=[i for i in range(5) if i!=j]\n Np=N[:,cols]\n w=[0]*5\n for k,ci in enumerate(cols):\n sub=Np[:, [x for x in range(4) if x!=k]]\n w[ci]=(-1)**k*sub.det()\n w=Matrix(w)\n assert all(expand(x)==0 for x in N*w)\n cc=[expand((w.T*m*w)[0]) for m in M]\n e1=red(cc[2]*B+2*cc[1]*A2); e2=red(cc[2]*A0-cc[0]*A2)\n print(\"w with w_%d=0:\"%j, \"c3*B+2*c2*A2 = %s ; c3*A0-c1*A2 = %s ; c3 mod rel nonzero: %s\"%(e1,e2, red(cc[2])!=0))\n" }, { "path": "anc/code/1.3.5/1.3.5b_core_certificate.m", "size_bytes": 4102, "sha256": "8e2bc4bd8f02f62a99418191e51f2e1a7ac461af77570d2297ac331a8b708102", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "// Deterministic core certificate for v9 Table 6(7).\n// It avoids interpolation: the two image quartics are fixed below and are\n// verified at the exact generic point of the plane quartic.\nQ:=Rationals();\nP2:=ProjectiveSpace(Q,2);\nA:=Matrix(Q,3,3,[0,1,0, 1,0,0, 1,0,1]);\nAi:=A^-1;\nassert A*Ai eq IdentityMatrix(Q,3);\nbasevec:=Matrix(3,1,[a*b,b^2+a*c,b*c]);\nqvec:=Ai*basevec;\nq1:=qvec[1,1]; q2:=qvec[2,1]; q3:=qvec[3,1];\nassert q1 eq b^2+a*c;\nassert q2 eq a*b;\nassert q3 eq -b^2-a*c+b*c;\n\nP4:=ProjectiveSpace(Q,4);\nM1:=Evaluate(q1,[P4.1,P4.2,P4.3])-P4.4^2;\nM2:=Evaluate(q2,[P4.1,P4.2,P4.3])-P4.4*P4.5;\nM3:=Evaluate(q3,[P4.1,P4.2,P4.3])-P4.5^2;\nm1:=SymmetricMatrix(M1);\nm2:=SymmetricMatrix(M2);\nm3:=SymmetricMatrix(M3);\nD:=Scheme(P4,[M1,M2,M3]);\n\nRq:=PolynomialRing(Q);\nFpol:=-4*Determinant(SymmetricMatrix(q1)-2*x*SymmetricMatrix(q2)\n +x^2*SymmetricMatrix(q3));\nassert Fpol eq -x^6-2*x^5+3*x^4+2*x^3-3*x^2+1;\nH:=HyperellipticCurve(Fpol);\nassert IsNonsingular(H) and Genus(H) eq 2;\nJ:=Jacobian(H);\nMW,mwmap,finite_index,proved,rank_upper:=MordellWeilGroupGenus2(J);\nassert finite_index and proved and rank_upper eq 1;\nassert Invariants(MW) eq [2,0];\nT:=mwmap(MW.1); G:=mwmap(MW.2);\nassert T eq elt;\nassert G eq elt;\nKJ:=KummerSurface(J);\nassert KJ!(4*G) eq KJ![32,16,-12,73];\n\n// The known non-fixed point (X:Y:Z)=(1:1:0) lifts to this cover point.\nP:=D![0,1,1,1,0];\nvP:=Vector(Eltseq(P));\nTanP:=Matrix([vP*m1,vP*m2,vP*m3]);\nkerP:=Kernel(Transpose(TanP));\nwP:=ExtendBasis([kerP!vP],kerP)[2];\nxpolP:=InnerProduct(wP*m1,wP)-2*x*InnerProduct(wP*m2,wP)\n +x^2*InnerProduct(wP*m3,wP);\nJP:=RationalPoints(J,xpolP,2);\nassert Seqset([jj@@mwmap:jj in Setseq(JP)]) eq Seqset([-4*MW.2,4*MW.2]);\n\n// Generic point on r^4-r^2+t+t^3=0 and its canonical cover point.\nA2:=AffineSpace(Q,2);\nCaff:=Curve(A2,rr^4-rr^2+tt+tt^3);\nK:=FunctionField(Caff);\nDK:=BaseChange(D,K);\nPg:=DK![t,r^2,1+t^2,r,r*t];\nassert Pg in DK;\nmats:=[Matrix(5,5,ChangeUniverse(Eltseq(mm),K)):mm in [m1,m2,m3]];\nvg:=Vector(Eltseq(Pg));\nassert [InnerProduct(vg*mm,vg):mm in mats] eq [K|0,0,0];\nTang:=Matrix([vg*mm:mm in mats]);\nker:=Kernel(Transpose(Tang));\nassert Dimension(ker) eq 2;\nwg:=ExtendBasis([ker!vg],ker)[2];\nKx:=PolynomialRing(K);\nxpol:=InnerProduct(wg*mats[1],wg)-2*s*InnerProduct(wg*mats[2],wg)\n +s^2*InnerProduct(wg*mats[3],wg);\nassert Degree(xpol) eq 2 and IsIrreducible(xpol);\nRR:=r^2;\nA0:=-4*RR^3*t+13*RR^2*t-12*RR*t^2-RR*t+4*RR+3*t^2-1;\nB:=2*(3*RR^2*t^2+7*RR^2+3*RR*t^2-5*RR+4*t);\nA2c:=-RR^4+4*RR^3*t-2*RR^3-RR^2+12*RR*t^2-4*RR*t-4*RR-4*t^2;\nUexpected:=A2c*s^2+B*s+A0;\nassert xpol*Coefficient(Uexpected,2) eq\n Uexpected*Coefficient(xpol,2);\nJK:=BaseChange(J,K);\nJPs:=RationalPoints(JK,xpol,2);\nassert #JPs eq 2;\nKJK:=KummerSurface(JK);\nassert KJK!JPs[1] eq KJK!JPs[2];\nKP:=KJK!JPs[1];\nKPc:=Eltseq(KP);\nassert A2c ne 0 and KPc[1] ne 0;\nassert KPc[2]*A2c+KPc[1]*B eq 0;\nassert KPc[3]*A2c-KPc[1]*A0 eq 0;\n\nP3:=ProjectiveSpace(Q,3);\nF1:=3040*X1^4-256*X1^3*X3-992*X1^3*X4-5152*X1^2*X2^2-\n4096*X1^2*X2*X3-2048*X1^2*X2*X4+10832*X1^2*X3^2+\n3232*X1^2*X3*X4+2592*X1*X2^3-1672*X1*X2^2*X3+\n1024*X1*X2^2*X4-7552*X1*X2*X3^2-928*X1*X2*X3*X4+\n512*X1*X2*X4^2+2816*X1*X3^3-2464*X1*X3^2*X4-\n992*X1*X3*X4^2+1055*X2^4+288*X2^3*X3-16*X2^3*X4-\n1648*X2^2*X3^2+768*X2^2*X3*X4+248*X2^2*X4^2+\n4224*X2*X3^3+3040*X2*X3^2*X4+512*X2*X3*X4^2+\n4544*X3^4+1248*X3^3*X4;\nF2:=6080*X1^3*X2-768*X1^3*X3+64*X1^3*X4-6336*X1^2*X2^2-\n6208*X1^2*X2*X3-6144*X1^2*X2*X4-944*X1^2*X3^2+\n576*X1^2*X3*X4+1696*X1*X2^3+1064*X1*X2^2*X3+\n3072*X1*X2^2*X4-4416*X1*X2*X3^2+256*X1*X2*X3*X4+\n1536*X1*X2*X4^2+2368*X1*X3^3+1728*X1*X3^2*X4+\n64*X1*X3*X4^2+125*X2^4+864*X2^3*X3-48*X2^3*X4+\n4176*X2^2*X3^2+2304*X2^2*X3*X4-16*X2^2*X4^2+\n6592*X2*X3^3+6080*X2*X3^2*X4+1536*X2*X3*X4^2+\n1472*X3^4+704*X3^3*X4;\nassert Evaluate(F1,Eltseq(KP)) eq 0;\nassert Evaluate(F2,Eltseq(KP)) eq 0;\nassert Evaluate(DefiningPolynomial(KummerSurface(JK)),Eltseq(KP)) eq 0;\n\n\"CERTIFIED T6(7) CORE\",finite_index,proved,rank_upper,\n \"known classes\",[jj@@mwmap:jj in Setseq(JP)],\n \"generic image identities\",true;\n\n\n\n\n" }, { "path": "anc/code/1.3.5/1.3.5c_check_sieve.py", "size_bytes": 1615, "sha256": "e46af7c511a701f832b59ce84ef2b00e0122767a1f5dbb6828d4cd263caa66b8", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import sys, os; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom g2_e07 import *\nfrom fractions import Fraction\nimport time\ndef KumInt(D): return primitive(kummer(D))\n# 1) sieve at 3 via reduction of rational Kummer points\nprint(\"sieve mod 3 (reduce K(eT+nG) over Q):\")\nfor e in (0,1):\n surv=[]\n for n in range(0,5):\n D=add(mul(e,Tpt),mul(n,Gpt))\n k=KumInt(D)\n if evalF(F1,k)%3==0 and evalF(F2,k)%3==0: surv.append(n)\n print(\" e\",e,\"surv\",surv)\n# check that residues mod 3 of K(eT+nG) depend only on n mod 5 (sanity: n and n+5)\nfor e in (0,1):\n for n in range(5):\n k1=KumInt(add(mul(e,Tpt),mul(n,Gpt))); k2=KumInt(add(mul(e,Tpt),mul(n+5,Gpt)))\n # projective equality mod 3\n import itertools\n ok = any(all((c*a-b)%3==0 for a,b in zip(k1,k2)) for c in (1,2))\n assert ok,(e,n)\nprint(\" periodicity mod 5 of reductions OK\")\n# 2) identity chart Mahler data\nS=mul(5,Gpt)\ndef u(D,chart):\n k=kummer(D); k=[Fraction(int(x.p),int(x.q)) for x in k]\n return [k[i]/k[chart] for i in range(4)]\ndef Phi(D,chart):\n return evalF(F1,u(D,chart))\nvals=[Phi(mul(m,S),3) for m in range(7)]\ndef mahler(vals):\n out=[];cur=vals[:]\n while cur:\n out.append(cur[0]); cur=[cur[i+1]-cur[i] for i in range(len(cur)-1)]\n return out\nmh=mahler(vals)\nprint(\"ID Mahler (v,res):\",[(v3(a),res3(a)) for a in mh])\n# 3) B=4G chart k1=1\nB=mul(4,Gpt)\nvalsB=[Phi(add(B,mul(m,S)),0) for m in range(8)]\nmB=mahler(valsB)\nprint(\"B Mahler (v,res):\",[(v3(a),res3(a)) for a in mB])\nprint(\"v3 h(r), r=2,5,8:\",[v3(Phi(add(B,mul(r,S)),0)) for r in (2,5,8)])\n" }, { "path": "anc/code/1.3.5/1.3.5c_kummer_sieve.m", "size_bytes": 1701, "sha256": "9913a3b40d43cb4776e120715128c464d4aa9b798516a2e176be6f2e225cc02f", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "Q:=Rationals();\nRq:=PolynomialRing(Q);\nfq:=-x^6-2*x^5+3*x^4+2*x^3-3*x^2+1;\n\nP3:=ProjectiveSpace(Q,3);\nS:=CoordinateRing(P3);\nF1:=3040*X1^4-256*X1^3*X3-992*X1^3*X4-5152*X1^2*X2^2-\n4096*X1^2*X2*X3-2048*X1^2*X2*X4+10832*X1^2*X3^2+\n3232*X1^2*X3*X4+2592*X1*X2^3-1672*X1*X2^2*X3+\n1024*X1*X2^2*X4-7552*X1*X2*X3^2-928*X1*X2*X3*X4+\n512*X1*X2*X4^2+2816*X1*X3^3-2464*X1*X3^2*X4-\n992*X1*X3*X4^2+1055*X2^4+288*X2^3*X3-16*X2^3*X4-\n1648*X2^2*X3^2+768*X2^2*X3*X4+248*X2^2*X4^2+\n4224*X2*X3^3+3040*X2*X3^2*X4+512*X2*X3*X4^2+\n4544*X3^4+1248*X3^3*X4;\nF2:=6080*X1^3*X2-768*X1^3*X3+64*X1^3*X4-6336*X1^2*X2^2-\n6208*X1^2*X2*X3-6144*X1^2*X2*X4-944*X1^2*X3^2+\n576*X1^2*X3*X4+1696*X1*X2^3+1064*X1*X2^2*X3+\n3072*X1*X2^2*X4-4416*X1*X2*X3^2+256*X1*X2*X3*X4+\n1536*X1*X2*X4^2+2368*X1*X3^3+1728*X1*X3^2*X4+\n64*X1*X3*X4^2+125*X2^4+864*X2^3*X3-48*X2^3*X4+\n4176*X2^2*X3^2+2304*X2^2*X3*X4-16*X2^2*X4^2+\n6592*X2*X3^3+6080*X2*X3^2*X4+1536*X2*X3*X4^2+\n1472*X3^4+704*X3^3*X4;\n\nfor p in [3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97] do\n k:=GF(p); R:=PolynomialRing(k);\n f:=R!fq;\n if p eq 3 then assert Discriminant(f) ne 0; end if;\n if Discriminant(f) eq 0 then continue; end if;\n H:=HyperellipticCurve(f); J:=Jacobian(H); K:=KummerSurface(J);\n G:=J![t^2+t,-t-1];\n T:=J![t^2-1,0];\n m:=Order(G);\n surv:=[];\n for e in [0..1] do\n A:=e*T;\n ee:=[];\n for n in [0..m-1] do\n KP:=K!A;\n vals:=[Evaluate(ChangeRing(ff,k),Eltseq(KP)):ff in [F1,F2]];\n if vals eq [0,0] then Append(~ee,n); end if;\n A+:=G;\n end for;\n Append(~surv,ee);\n end for;\n if p eq 3 then\n assert m eq 5;\n assert surv eq [[0,1,4],[]];\n end if;\n \"p\",p,\"ordG\",m,\"surv\",surv;\nend for;\n\n\n\n\n" }, { "path": "anc/code/1.3.5/1.3.5d_check_valuations.py", "size_bytes": 1447, "sha256": "0a2e6fc6a13a266d248fbb7fc530903321b59be544b532c5e23a99324b55edf2", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import sys, os; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom g2_e07 import *\n# the original imported checks1.py (here 1.3.5c_check_sieve.py); importing it also prints its output\nimport importlib.util\n_spec = importlib.util.spec_from_file_location(\"checks1\", os.path.join(os.path.dirname(os.path.abspath(__file__)), \"1.3.5c_check_sieve.py\"))\n_checks1 = importlib.util.module_from_spec(_spec); _spec.loader.exec_module(_checks1)\nu, Phi, S, B = _checks1.u, _checks1.Phi, _checks1.S, _checks1.B\nimport time\nt0=time.time()\nprint(\"identity disc: m=3^e*a : v(u1),v(u2),v(u3) [claim >=4+2e, =3+2e, =2+2e], v(Phi) [claim 5+4e]\")\nfor e in (0,1,2,3):\n for a in ((1,2,4,5,7,8) if e<3 else (1,2)):\n m=3**e*a\n D=mul(m,S)\n uu=u(D,3)\n vs=[v3(x) for x in uu[:3]]\n vp=v3(evalF(F1,uu))\n flag = (vs[0]>=4+2*e and vs[1]==3+2*e and vs[2]==2+2*e and vp==5+4*e)\n print(f\" e={e} a={a} m={m}: v(u)={vs} res={[res3(x) for x in uu[:3]]} vPhi={vp} {'OK' if flag else ('(e=0, not claimed)' if e==0 else 'MISMATCH')}\")\nprint(\"time\",time.time()-t0)\nprint(\"4G disc: m=3^e*a : v(h(m)) [claim 2+e], residue of h/(9m) [claim 2]\")\nfrom fractions import Fraction\nfor e in (1,2,3):\n for a in ((1,2,4,5,-1,-2) if e<3 else (1,-1)):\n m=3**e*a\n h=Phi(add(B,mul(m,S)),0)\n q=h/(9*m)\n print(f\" e={e} a={a}: v(h)={v3(h)} res(h/9m)={res3(q)} v(h/9m)={v3(q)}\")\nprint(\"time\",time.time()-t0)\n" }, { "path": "anc/code/1.3.5/1.3.5d_mahler.m", "size_bytes": 4173, "sha256": "a862046cd568170480af45edd53a576a9a2026d7fe0dd92ee3187f9812d59b85", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "Q:=Rationals(); Rq:=PolynomialRing(Q);\nH:=HyperellipticCurve(-x^6-2*x^5+3*x^4+2*x^3-3*x^2+1);\nJ:=Jacobian(H);\nG:=J![x^2+x,-x-1];\nK:=KummerSurface(J);\nP3:=ProjectiveSpace(Q,3);\nF:=3040*X1^4-256*X1^3*X3-992*X1^3*X4-5152*X1^2*X2^2-\n4096*X1^2*X2*X3-2048*X1^2*X2*X4+10832*X1^2*X3^2+\n3232*X1^2*X3*X4+2592*X1*X2^3-1672*X1*X2^2*X3+\n1024*X1*X2^2*X4-7552*X1*X2*X3^2-928*X1*X2*X3*X4+\n512*X1*X2*X4^2+2816*X1*X3^3-2464*X1*X3^2*X4-\n992*X1*X3*X4^2+1055*X2^4+288*X2^3*X3-16*X2^3*X4-\n1648*X2^2*X3^2+768*X2^2*X3*X4+248*X2^2*X4^2+\n4224*X2*X3^3+3040*X2*X3^2*X4+512*X2*X3*X4^2+\n4544*X3^4+1248*X3^3*X4;\nFsecond:=6080*X1^3*X2-768*X1^3*X3+64*X1^3*X4-6336*X1^2*X2^2-\n6208*X1^2*X2*X3-6144*X1^2*X2*X4-944*X1^2*X3^2+\n576*X1^2*X3*X4+1696*X1*X2^3+1064*X1*X2^2*X3+\n3072*X1*X2^2*X4-4416*X1*X2*X3^2+256*X1*X2*X3*X4+\n1536*X1*X2*X4^2+2368*X1*X3^3+1728*X1*X3^2*X4+\n64*X1*X3*X4^2+125*X2^4+864*X2^3*X3-48*X2^3*X4+\n4176*X2^2*X3^2+2304*X2^2*X3*X4-16*X2^2*X4^2+\n6592*X2*X3^3+6080*X2*X3^2*X4+1536*X2*X3*X4^2+\n1472*X3^4+704*X3^3*X4;\n\nL3:=PolynomialRing(Q,3);\nFaff:=Evaluate(F,[u1,u2,u3,1]);\nassert HomogeneousComponent(Faff,0) eq 0;\nassert HomogeneousComponent(Faff,1) eq 0;\nassert HomogeneousComponent(Faff,2) eq\n 512*u1*u2-992*u1*u3+248*u2^2+512*u2*u3;\n\nfunction AffineValue(A,chart)\n cc:=Eltseq(K!A);\n aa:=[Q!cc[i]/cc[chart]:i in [1..4]];\n return Evaluate(F,aa);\nend function;\n\nfunction AffineValue2(A,chart)\n cc:=Eltseq(K!A);\n aa:=[Q!cc[i]/cc[chart]:i in [1..4]];\n return Evaluate(Fsecond,aa);\nend function;\n\nfunction MahlerCoefficients(vals)\n cur:=vals; ans:=[];\n while #cur gt 0 do\n Append(~ans,cur[1]);\n cur:=[cur[i+1]-cur[i]:i in [1..#cur-1]];\n end while;\n return ans;\nend function;\n\nfunction VRes(a,p)\n if a eq 0 then return <100,GF(p)!0>; end if;\n v:=Valuation(a,p);\n return ;\nend function;\n\nR0:=5*G;\nvals0:=[AffineValue(m*R0,4):m in [0..6]];\nmah0:=MahlerCoefficients(vals0);\nred0:=[a eq 0 select GF(3)!0 else GF(3)!(a/3^5):a in mah0];\nassert red0 eq [GF(3)|0,1,2,0,0,0,0];\n\"IDENTITY VALUES\",[VRes(a,3):a in vals0];\n\"IDENTITY MAHLER\",[VRes(a,3):a in mah0];\n\"IDENTITY REDUCED AT 3^5\",red0;\nfor jj in [1] do\n Sj:=3^jj*R0;\n valsj:=[AffineValue(m*Sj,4):m in [0..6]];\n mahj:=MahlerCoefficients(valsj);\n basev:=5+4*jj;\n \"DEEP ID\",jj,\"VALUES\",[VRes(a,3):a in valsj];\n \"DEEP ID\",jj,\"MAHLER\",[VRes(a,3):a in mahj];\n \"DEEP ID\",jj,\"REDUCED\",[a eq 0 select GF(3)!0 else GF(3)!(a/3^basev):a in mahj];\nend for;\n\nfor jj in [0..1] do\n cc:=Eltseq(K!(3^jj*R0));\n aa:=[Q!cc[i]/cc[4]:i in [1..4]];\n \"ID COORD\",jj,[VRes(a,3):a in aa];\n if jj eq 0 then\n assert [VRes(a,3):a in aa] eq\n [<4,GF(3)!2>,<3,GF(3)!2>,<2,GF(3)!1>,<0,GF(3)!1>];\n else\n assert [VRes(a,3):a in aa] eq\n [<6,GF(3)!1>,<5,GF(3)!1>,<4,GF(3)!1>,<0,GF(3)!1>];\n end if;\nend for;\n\nB:=4*G;\nvalsB:=[AffineValue(B+m*R0,1):m in [0..4]];\nmahB:=MahlerCoefficients(valsB);\nassert mahB[1] eq 0;\nassert Valuation(mahB[2],3) eq 2 and GF(3)!(mahB[2]/3^2) eq 2;\nassert Valuation(mahB[3],3) eq 2 and GF(3)!(mahB[3]/3^2) eq 2;\nassert Valuation(mahB[4],3) eq 3 and GF(3)!(mahB[4]/3^3) eq 1;\n\"B VALUES\",[VRes(a,3):a in valsB];\n\"B MAHLER\",[VRes(a,3):a in mahB];\n\"B REDUCED AT 3^2\",[a eq 0 select GF(3)!0 else GF(3)!(a/3^2):a in mahB];\nvalsB2:=[AffineValue2(B+m*R0,1):m in [0..6]];\nmahB2:=MahlerCoefficients(valsB2);\n\"B2 VALUES\",[VRes(a,3):a in valsB2];\n\"B2 MAHLER\",[VRes(a,3):a in mahB2];\n\n// The global Kummer point K(4G)=K(-4G) satisfies both relations.\n\"GLOBAL KUMMER ZERO\",AffineValue(B,1),AffineValue(-B,1);\nassert AffineValue(B,1) eq 0 and AffineValue(-B,1) eq 0;\nassert &and[Valuation(AffineValue(B+mm*R0,1),3) eq 3:mm in [2,5,8]];\n\n// Mod-9 representatives of the apparent second mod-3 branch are all\n// nonzero modulo 9 after division by 3^2. The full mod-27 table also\n// certifies the residues used in the 1-Lipschitz argument.\nhensel27:=[];\nall27:=[];\nfor mm in [0..26] do\n hv:=AffineValue(B+mm*R0,1);\n Append(~all27,);\n if hv eq 0 or Valuation(hv,3) ge 5 then\n Append(~hensel27,);\n end if;\nend for;\n\"B ALL MOD27\",all27;\n\"B HENSEL MOD27\",hensel27;\nassert hensel27 eq [<0,100>];\n\n\n\n\n" }, { "path": "anc/code/1.3.5/1.3.5e_check_fiber.py", "size_bytes": 562, "sha256": "398d40114182c00ef06dab906621cf3ade60885ea75a183947b8f78906f81e07", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "from sympy import symbols, groebner, resultant, factor_list, Poly, expand, Matrix, simplify, together, factor, rem, cancel, gcd, QQ\nR,t,r,s=symbols('R t r s')\ncurve=R**2-R+t+t**3\nA0=-4*R**3*t+13*R**2*t-12*R*t**2-R*t+4*R+3*t**2-1\nB=2*(3*R**2*t**2+7*R**2+3*R*t**2-5*R+4*t)\nA2=-R**4+4*R**3*t-2*R**3-R**2+12*R*t**2-4*R*t-4*R-4*t**2\nG=groebner([curve,2*B+A2,8*A0+3*A2],R,t,order='lex')\nprint(\"GB fiber K(4G):\",G.exprs)\nG0=groebner([curve,A2,B],R,t,order='lex')\nprint(\"GB A2=B=0:\",G0.exprs)\nres=resultant(curve,A2,R)\nprint(\"Res_R(curve,A2) factors:\",factor_list(res))\n" }, { "path": "anc/code/1.3.5/1.3.5e_fiber.m", "size_bytes": 1906, "sha256": "04b8e210137a9897e29caabd0c19737dad9be0ddf4abb8aafd2293fc5e180226", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "Q:=Rationals();\nRq:=PolynomialRing(Q);\nH:=HyperellipticCurve(-s^6-2*s^5+3*s^4+2*s^3-3*s^2+1);\nJ:=Jacobian(H);\nG:=elt;\nKJ:=KummerSurface(J);\nassert KJ!(4*G) eq KJ![32,16,-12,73];\n\nP:=PolynomialRing(Q,2,\"lex\");\ncurve:=R^2-R+t+t^3;\nA0:=-4*R^3*t+13*R^2*t-12*R*t^2-R*t+4*R+3*t^2-1;\nB:=2*(3*R^2*t^2+7*R^2+3*R*t^2-5*R+4*t);\nA2:=-R^4+4*R^3*t-2*R^3-R^2+12*R*t^2-4*R*t-4*R-4*t^2;\n\n// Certify that division by A2 in the nonidentity fiber loses no rational\n// point. The sole rational point of curve=A2=0 is (R,t)=(0,0), which is\n// in the separately enumerated fixed boundary.\nQt:=PolynomialRing(Q);\nQtR:=PolynomialRing(Qt);\ncurve_nested:=rho^2-rho+tau+tau^3;\nA2_nested:=-rho^4+4*rho^3*tau-2*rho^3-rho^2+12*rho*tau^2\n -4*rho*tau-4*rho-4*tau^2;\nqdeg:=tau^11+16*tau^10-16*tau^9-44*tau^8+70*tau^7+12*tau^6\n +168*tau^5-116*tau^4+57*tau^3-156*tau^2+40*tau+32;\nassert Resultant(curve_nested,A2_nested) eq tau*qdeg;\nassert IsIrreducible(qdeg);\nassert GCD(rho^2-rho,-rho^4-2*rho^3-rho^2-4*rho) eq rho;\n\nI:=ideal;\nGB:=GroebnerBasis(I);\n\"GROEBNER BASIS\",GB;\nassert I eq ideal;\n\n// K(4G)=(32:16:-12:73), so its monic Mumford polynomial is\n// s^2-(1/2)s-3/8. At R=1,t=0 the tangent polynomial has exactly\n// these first three Kummer coordinates.\n\"SPECIALIZED COEFFICIENTS\",Evaluate(A2,[1,0]),Evaluate(B,[1,0]),Evaluate(A0,[1,0]);\nassert Evaluate(2*B+A2,[1,0]) eq 0;\nassert Evaluate(8*A0+3*A2,[1,0]) eq 0;\n\n// Redundant check of the degree-zero tangent-polynomial subcase A2=B=0.\n// This is not asserted to compute the complete fiber over the Kummer origin;\n// the proof excludes that fiber instead by the full-Jacobian torsion argument.\nI0:=ideal;\n\"DEGREE-ZERO TANGENT SUBCASE GROEBNER BASIS\",GroebnerBasis(I0);\nassert I0 eq ideal;\nassert Evaluate(A0,[0,0]) eq -1;\n\n\"CONSTANT DIVISOR LIFTS\",RationalPoints(J,Rq!-1,2);\n\n\n\n\n" }, { "path": "anc/code/1.3.5/g2_e07.py", "size_bytes": 6063, "sha256": "67dd091feaae9a56d436fa9cc7f54d26f846a5f1e606018243ed62dcaa30f4c9", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent genus-2 Jacobian arithmetic for H: v^2 = f(s),\n# f = -s^6-2s^5+3s^4+2s^3-3s^2+1, via the quintic model s = 1+1/w,\n# eta = v*w^3, eta^2 = g(w) = w^6 f(1+1/w) (deg 5). Cantor's algorithm.\n# Kummer coordinates are Cassels-Flynn coordinates of the SEXTIC model,\n# computed homogeneously from (x:z) = (w+1 : w), y = eta.\nfrom flint import fmpq_poly as P, fmpq\nfrom fractions import Fraction\nimport math\n\n\nfco = [1, 0, -3, 2, 3, -2, -1] # f0..f6\nf = P(fco)\n# g(w) = sum f_i (w+1)^i w^(6-i)\ng = P([0])\nfor i, c in enumerate(fco):\n g += c * P([1, 1])**i * P([0, 1])**(6 - i)\nassert g.degree() == 5\n\nZERO = (P([1]), P([0]))\n\ndef monic(a):\n return a / a.leading_coefficient()\n\ndef compose(D1, D2):\n a1, b1 = D1; a2, b2 = D2\n d0, e1, e2 = a1.xgcd(a2) # d0 = e1 a1 + e2 a2\n d, c1, c2 = d0.xgcd(b1 + b2) # d = c1 d0 + c2 (b1+b2)\n s1 = c1 * e1; s2 = c1 * e2; s3 = c2\n a = (a1 * a2) // (d * d)\n b = ((s1 * a1 * b2 + s2 * a2 * b1 + s3 * (b1 * b2 + g)) // d) % a\n return (a, b)\n\ndef reduce_(D):\n a, b = D\n while a.degree() > 2:\n a = monic((g - b * b) // a)\n b = (-b) % a\n a = monic(a)\n b = b % a\n return (a, b)\n\ndef add(D1, D2):\n return reduce_(compose(D1, D2))\n\ndef neg(D):\n a, b = D\n return (a, (-b) % a)\n\ndef mul(n, D):\n if n < 0:\n return mul(-n, neg(D))\n R = ZERO; Q = D\n while n:\n if n & 1:\n R = add(R, Q)\n Q = add(Q, Q)\n n >>= 1\n return R\n\ndef F0(k1, k2, k3):\n f0, f1, f2, f3, f4, f5, f6 = [fmpq(c) for c in fco]\n return (2*f0*k1**3 + f1*k1**2*k2 + 2*f2*k1**2*k3 + f3*k1*k2*k3\n + 2*f4*k1*k3**2 + f5*k3**2*k2 + 2*f6*k3**3)\n\ndef kummer(D):\n a, b = D\n if a.degree() == 0:\n return [fmpq(0), fmpq(0), fmpq(0), fmpq(1)]\n if a.degree() == 1:\n w1 = -a[0]\n eta1 = b[0]\n k1 = w1; k2 = 2*w1 + 1; k3 = w1 + 1\n k4 = F0(k1, k2, k3) # y2 = 0, (x1 z2 - x2 z1)^2 = 1\n return [k1, k2, k3, k4]\n a0, a1 = a[0], a[1]\n b0, b1 = b[0], b[1]\n k1 = a0; k2 = 2*a0 - a1; k3 = a0 - a1 + 1\n yy = b1*b1*a0 - b0*b1*a1 + b0*b0\n den = a1*a1 - 4*a0\n if den != 0:\n k4 = (F0(k1, k2, k3) - 2*yy) / den\n return [k1, k2, k3, k4]\n # double point: K2 = 0, Kummer quartic is linear in k4\n kk = [Fraction(int(x.p), int(x.q)) for x in (k1, k2, k3)]\n c0 = kummer_eq(kk + [Fraction(0)])\n c1 = kummer_eq(kk + [Fraction(1)]) - c0\n assert c1 != 0\n k4 = -c0 / c1\n return [k1, k2, k3, fmpq(k4.numerator, k4.denominator)]\n\ndef primitive(v):\n v = [Fraction(int(x.p), int(x.q)) for x in v]\n L = 1\n for x in v:\n L = L * x.denominator // math.gcd(L, x.denominator)\n w = [int(x * L) for x in v]\n G = 0\n for x in w:\n G = math.gcd(G, x)\n return [x // G for x in w]\n\ndef kummer_eq(k):\n # Cassels-Flynn Kummer quartic K2 k4^2 + K1 k4 + K0 (used only as sanity check)\n k1, k2, k3, k4 = [Fraction(x) for x in k]\n f0, f1, f2, f3, f4, f5, f6 = [Fraction(c) for c in fco]\n K2 = k2**2 - 4*k1*k3\n K1 = -4*k1**3*f0 - 2*k1**2*k2*f1 - 4*k1**2*k3*f2 - 2*k1*k2*k3*f3 - 4*k1*k3**2*f4 - 2*k2*k3**2*f5 - 4*k3**3*f6\n K0 = (-4*k1**4*f0*f2 + k1**4*f1**2 - 4*k1**3*k2*f0*f3 - 2*k1**3*k3*f1*f3\n - 4*k1**2*k2**2*f0*f4 + 4*k1**2*k2*k3*f0*f5 - 4*k1**2*k2*k3*f1*f4\n - 4*k1**2*k3**2*f0*f6 + 2*k1**2*k3**2*f1*f5 - 4*k1**2*k3**2*f2*f4\n + k1**2*k3**2*f3**2 - 4*k1*k2**3*f0*f5 + 8*k1*k2**2*k3*f0*f6\n - 4*k1*k2**2*k3*f1*f5 + 4*k1*k2*k3**2*f1*f6 - 4*k1*k2*k3**2*f2*f5\n - 2*k1*k3**3*f3*f5 - 4*k2**4*f0*f6 - 4*k2**3*k3*f1*f6\n - 4*k2**2*k3**2*f2*f6 - 4*k2*k3**3*f3*f6 - 4*k3**4*f4*f6 + k3**4*f5**2)\n return K2*k4**2 + K1*k4 + K0\n\ndef on_curve(w, eta):\n return eta*eta == g(w)\n\n# G = [(s=0,v=-1) + (s=-1,v=0)] -> w = 1/(s-1): w=-1 (eta = v w^3 = 1), w=-1/2 (eta=0)\nassert on_curve(fmpq(-1), fmpq(1)) and on_curve(fmpq(-1, 2), fmpq(0))\naG = P([fmpq(1, 2), fmpq(3, 2), 1]) # (w+1)(w+1/2)\n# b linear through (-1,1), (-1/2,0): b = -2w - 1\nbG = P([-1, -2])\nGpt = (aG, bG)\nassert (g - bG*bG) % aG == 0\n# T = [(s=-1,0) + (s=1,0)] = [(w=-1/2,0) - inf]\nTpt = (P([fmpq(1, 2), 1]), P([0]))\nassert (g - Tpt[1]**2) % Tpt[0] == 0\n\nF1co = \"\"\"3040*X1^4-256*X1^3*X3-992*X1^3*X4-5152*X1^2*X2^2-\n4096*X1^2*X2*X3-2048*X1^2*X2*X4+10832*X1^2*X3^2+\n3232*X1^2*X3*X4+2592*X1*X2^3-1672*X1*X2^2*X3+\n1024*X1*X2^2*X4-7552*X1*X2*X3^2-928*X1*X2*X3*X4+\n512*X1*X2*X4^2+2816*X1*X3^3-2464*X1*X3^2*X4-\n992*X1*X3*X4^2+1055*X2^4+288*X2^3*X3-16*X2^3*X4-\n1648*X2^2*X3^2+768*X2^2*X3*X4+248*X2^2*X4^2+\n4224*X2*X3^3+3040*X2*X3^2*X4+512*X2*X3*X4^2+\n4544*X3^4+1248*X3^3*X4\"\"\"\nF2co = \"\"\"6080*X1^3*X2-768*X1^3*X3+64*X1^3*X4-6336*X1^2*X2^2-\n6208*X1^2*X2*X3-6144*X1^2*X2*X4-944*X1^2*X3^2+\n576*X1^2*X3*X4+1696*X1*X2^3+1064*X1*X2^2*X3+\n3072*X1*X2^2*X4-4416*X1*X2*X3^2+256*X1*X2*X3*X4+\n1536*X1*X2*X4^2+2368*X1*X3^3+1728*X1*X3^2*X4+\n64*X1*X3*X4^2+125*X2^4+864*X2^3*X3-48*X2^3*X4+\n4176*X2^2*X3^2+2304*X2^2*X3*X4-16*X2^2*X4^2+\n6592*X2*X3^3+6080*X2*X3^2*X4+1536*X2*X3*X4^2+\n1472*X3^4+704*X3^3*X4\"\"\"\n\ndef parse(sstr):\n import re\n sstr = sstr.replace(\"\\n\", \"\").replace(\" \", \"\")\n terms = re.findall(r'[+-]?[^+-]+', sstr)\n out = []\n for t in terms:\n parts = t.split('*')\n c = int(parts[0])\n e = [0, 0, 0, 0]\n for q in parts[1:]:\n if '^' in q:\n v, k = q.split('^'); e[int(v[1]) - 1] += int(k)\n else:\n e[int(q[1]) - 1] += 1\n out.append((c, e))\n return out\n\nF1 = parse(F1co); F2 = parse(F2co)\n\ndef evalF(F, k):\n tot = 0\n for c, e in F:\n term = c\n for i in range(4):\n term *= k[i]**e[i]\n tot += term\n return tot\n\ndef v3(x):\n x = Fraction(x)\n if x == 0:\n return 100\n n, d = x.numerator, x.denominator\n v = 0\n while n % 3 == 0:\n n //= 3; v += 1\n while d % 3 == 0:\n d //= 3; v -= 1\n return v\n\ndef res3(x):\n x = Fraction(x)\n if x == 0:\n return 0\n v = v3(x)\n y = x / Fraction(3)**v\n return (y.numerator * pow(y.denominator, -1, 3)) % 3\n" }, { "path": "anc/code/1.3.6/1.3.6a_check_lpolys.gp", "size_bytes": 974, "sha256": "1fe908b60759ffd09481655968ddddb9161c7ae797548338b2c381e08de8527b", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "f = 2*x^5+6*x^4-4*x^3-10*x^2+12*x-4;\ncountC2(p,k) = {\n my(g = ffgen(p^k,'a), q = p^k, r, N = 0, els, c, d, s, cntX);\n r = ffprimroot(g);\n els = vector(q); els[1] = 0*g; for(i=1,q-1, els[i+1] = r^i);\n cntX = ((u) -> if(u==0, 1, if(issquare(u), 2, 0)));\n for(i=1,q, my(z=els[i]); c = z + z^4; d = 1 - 4*c; if(d==0, N += cntX(-g^0/2), if(issquare(d), s = sqrt(d); N += cntX((-1+s)/2) + cntX((-1-s)/2))));\n for(i=1,q, if(els[i]^4 == -1, N++));\n N\n};\nLpoly3(p) = {\n my(N1=countC2(p,1), N2=countC2(p,2), N3=countC2(p,3), S1, S2, S3, e1, e2, e3);\n S1 = p+1-N1; S2 = p^2+1-N2; S3 = p^3+1-N3;\n e1 = S1; e2 = (e1*S1 - S2)/2; e3 = (e2*S1 - e1*S2 + S3)/3;\n [1, -e1, e2, -e3, p*e2, -p^2*e1, p^3]\n};\n{\nfor(i=1,5, my(p=[5,7,11,13,47][i], L, JC, PH, JH, E, NE);\n L=Lpoly3(p); JC = vecsum(L);\n PH = hyperellcharpoly(Mod(1,p)*f); JH = subst(PH,'x,1);\n E = ellinit([0,0,0,16,-64],p); NE = p+1-ellap(E);\n print(\"p=\",p,\" #J_C(F_p)=\",JC,\" = \",factor(JC),\" ; #E*#J_H=\",NE*JH);\n);\n}\n" }, { "path": "anc/code/1.3.6/1.3.6a_check_model.py", "size_bytes": 1469, "sha256": "b2cb9424ece8c3c12f05320acfc453d3334f6b87cd3ee91dc7f3a55f9c2fc62d", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Code 1.3.6a cross-check (SymPy, no Magma) for x^4 + x^2y^2 + y^3z + z^4 = 0:\n# the genus-2 model H = -16 det(N1 - 2s N2 + s^2 N3), the image of C in the cover D, and the\n# Ritzenthaler-Romagny model. Taken from a helper script chk2.py (the parts for this equation).\nfrom sympy import symbols, hessian, expand, factor, cancel, Matrix\na, b, c, u, v, s, X, Y, Z = symbols('a b c u v s X Y Z')\n\ndef mat3(q):\n return hessian(q, [a, b, c]) / 2\n\ndef H_of(qs, const):\n N = [mat3(q) for q in qs]\n return expand(const * (N[0] - 2*s*N[1] + s**2*N[2]).det())\n\n# quadrics of the script 1.3.6a_kummer_image.m\nq = [-(b**2 + a*c), (a*b - b**2 - a*c - b*c)/2, (a*b + b**2 + a*c + b*c)/2]\nprint(\"E09 H:\", H_of(q, -16), \" factored:\", factor(H_of(q, -16)))\n# the point of D over (X:Y:Z): (a,b,c,u,v) = (Z(Y+Z), X^2, Y^2-YZ+Z^2, XY, XZ); q_i - (u^2, uv, v^2) is a\n# multiple of the quartic F9\nF9 = X**4 + X**2*Y**2 + Y**3*Z + Z**4\npt = {a: Z*(Y + Z), b: X**2, c: Y**2 - Y*Z + Z**2, u: X*Y, v: X*Z}\nfor qq, rhs in zip(q, [u**2, u*v, v**2]):\n e = expand((qq - rhs).subs(pt)); print(\" E09 on D:\", factor(e), \" ratio to F:\", cancel(e / F9))\n# Ritzenthaler-Romagny model\nA = Matrix([[0, 1, 1], [-1, 0, 0], [1, -1, 1]]); Ai = A.inv(); print(\"E09 Ai\", Ai, \"det\", A.det())\naa = Ai[0, 0] + 2*Ai[1, 0]*s + Ai[2, 0]*s**2\nbb = Ai[0, 1] + 2*Ai[1, 1]*s + Ai[2, 1]*s**2\ncc = Ai[0, 2] + 2*Ai[1, 2]*s + Ai[2, 2]*s**2\nprint(\" a,b,c=\", aa, bb, cc, \" RR f=\", factor(expand(bb*(bb**2 - aa*cc))))\n" }, { "path": "anc/code/1.3.6/1.3.6a_check_padic47.py", "size_bytes": 1551, "sha256": "02455fc5133ff8b10f26a9efd1d2c8887c431614d85b997e1e122c1ab49dd778", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import time\nimport sys, os; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom jac_e09 import *\nfrom math import gcd\nfrom functools import reduce\nR = Ring(None)\nT = (R.P([-2, 2, 1]), R.P([0]))\nG = (flint.fmpq_poly([flint.fmpq(5,2), 1]), flint.fmpq_poly([flint.fmpq(-9,4)]))\nfor D in (T, G):\n assert (R.f - D[1]*D[1]) % D[0] == 0\ndef prim(k):\n dens = [int(c.q) for c in k]; L = 1\n for d in dens: L = L*d//gcd(L,d)\n ints = [int((c*L).p) for c in k]\n g = reduce(gcd, [abs(x) for x in ints if x != 0])\n return [x//g for x in ints]\ndef v(x, p=47):\n if x == 0: return 10**9\n n = 0\n while x % p == 0: x //= p; n += 1\n return n\np = 47\nRR_ = jmul(R, 28, G)\ndef report(m, D):\n k = prim(kummer(R, D))\n assert KUM(k) == 0\n vals = [v(c) for c in k]\n e = min(vals[:3])\n k4 = k[3] % p\n dirn = [((c // p**e) * pow(k4, -1, p)) % p for c in k[:3]]\n ph1, ph2 = PHI1(k), PHI2(k)\n print(\"m=%d coord vals %s normalized dir %s v(PHI1)=%d v(PHI2)=%d approx_digits=%d\" % (m, vals, dirn, v(ph1), v(ph2), max(abs(c).bit_length() for c in k)//3))\n return k\nt0 = time.time()\nk1 = report(1, RR_)\n# scaling check: direction of mR should be m^2*(24,7,1)\nfor m in range(2, 6):\n report(m, jmul(R, m, RR_))\nprint(\"expected m^2*(24,7,1):\", [[(m*m*c) % p for c in (24,7,1)] for m in range(1,6)])\n# quadratic forms at (24,7,1)\nQ1 = lambda r1,r2,r3: 48*r1**2-4*r1*r3+r2**2+24*r2*r3\nQ2 = lambda r1,r2,r3: -48*r1**2+240*r1*r3-60*r2**2-24*r2*r3\nprint(\"Q1,Q2 at (24,7,1) mod 47:\", Q1(24,7,1) % p, Q2(24,7,1) % p)\n" }, { "path": "anc/code/1.3.6/1.3.6a_check_sieve47.py", "size_bytes": 1453, "sha256": "e396cc2ed1a93f1fffdcd8f516203aa87bf157f5609228b93aa065cc92f1183b", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "import sys, os; sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom jac_e09 import *\nfrom fractions import Fraction as Fr\np = 47\nR = Ring(p)\ninv2 = pow(2, -1, p)\nT = (R.P([-2, 2, 1]), R.P([0]))\nG = (R.P([5 * inv2, 1]), R.P([-9 * pow(4, -1, p)]))\n# checks: b^2 = f mod a\nfor D in (T, G):\n assert (R.f - D[1] * D[1]) % D[0] == 0\ndef order(D, bound=3000):\n Z = jzero(R); X = D\n for n in range(1, bound):\n if X == Z: return n\n X = jadd(R, X, D)\n return None\noT, oG = order(T), order(G)\nprint(\"order T mod 47:\", oT, \" order G mod 47:\", oG)\n# Kummer normalisation check on several points\nfor n in range(1, 10):\n k = kummer(R, jmul(R, n, G))\n assert KUM(k) == 0, n\n k = kummer(R, jadd(R, T, jmul(R, n, G)))\n assert KUM(k) == 0, n\nprint(\"Kummer points lie on Magma's printed Kummer quartic: ok\")\n# is T in mod 47?\nmults = [jmul(R, n, G) for n in range(oG)]\nprint(\"T in mod 47:\", T in mults)\nallowed = []\nfor e in (0, 1):\n for n in range(oG):\n D = jadd(R, jmul(R, e, T), mults[n])\n k = kummer(R, D)\n if PHI1(k) == 0 and PHI2(k) == 0:\n allowed.append((e, n))\nprint(\"allowed (e,n):\", allowed)\n# which (e,n) satisfy only one equation\nprint(\"PHI1 only:\", [(e,n) for e in (0,1) for n in range(oG) if PHI1(kummer(R, jadd(R, jmul(R,e,T), mults[n])))==0])\nprint(\"PHI2 only:\", [(e,n) for e in (0,1) for n in range(oG) if PHI2(kummer(R, jadd(R, jmul(R,e,T), mults[n])))==0])\n" }, { "path": "anc/code/1.3.6/1.3.6a_check_smooth.py", "size_bytes": 458, "sha256": "a62e2166efc0cb1c54521333de8fb01007b796e18a6f4211b4cd53d286526fff", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "from sympy import symbols, groebner, diff\nX, Y, Z = symbols('X Y Z')\nF = X**4 + X**2*Y**2 + Y**3*Z + Z**4\nfor p in [5, 7, 11, 13, 47]:\n res = []\n for chart in [(X, 1), (Y, 1), (Z, 1)]:\n eqs = [e.subs(*chart) for e in (F, diff(F, X), diff(F, Y), diff(F, Z))]\n gb = groebner(eqs, *[v for v in (X, Y, Z) if v != chart[0]], modulus=p, order='grevlex')\n res.append(list(gb.exprs) == [1])\n print(p, \"smooth in all charts:\", all(res))\n" }, { "path": "anc/code/1.3.6/1.3.6a_kummer_image.m", "size_bytes": 7563, "sha256": "e1ca1bb3f2204413839640add8cbebd2a18b10454527b89f7b9114f25037d8fa", "mode": 420, "language": "Magma", "encoding": "utf-8", "text": "SetAutoColumns(false); SetColumns(140);\nQ:=Rationals();\nP2:=ProjectiveSpace(Q,2);\nq1:=-(B^2+A*C);\nq2:=(A*B-B^2-A*C-B*C)/2;\nq3:=(A*B+B^2+A*C+B*C)/2;\nCbase:=Curve(P2,q1*q3-q2^2);\n\nP4:=ProjectiveSpace(Q,4);\nM1:=Evaluate(q1,[X1,X2,X3])-U^2;\nM2:=Evaluate(q2,[X1,X2,X3])-U*V;\nM3:=Evaluate(q3,[X1,X2,X3])-V^2;\nm1:=SymmetricMatrix(M1); m2:=SymmetricMatrix(M2); m3:=SymmetricMatrix(M3);\nD:=Scheme(P4,[M1,M2,M3]);\npi:=mapCbase|[X1,X2,X3]>;\n\nR:=PolynomialRing(Q);\nFbru:=4*(-4*Determinant(SymmetricMatrix(q1)-2*s*SymmetricMatrix(q2)+s^2*SymmetricMatrix(q3)));\nH:=HyperellipticCurve(Fbru); J:=Jacobian(H);\nassert Fbru eq 2*s^5+6*s^4-4*s^3-10*s^2+12*s-4;\nassert IsNonsingular(H) and Genus(H) eq 2;\nlo,hi:=RankBounds(J);\nassert lo eq 1 and hi eq 1;\n\"H polynomial\",Fbru,\"rank\",RankBounds(J),\"torsion\",TorsionSubgroup(J);\n\nfunction xpolmap(P0,P1)\n v:=Vector(Eltseq(P0));\n K:=BaseRing(v); z:=PolynomialRing(K).1;\n m1K:=Matrix(5,5,ChangeUniverse(Eltseq(m1),K));\n m2K:=Matrix(5,5,ChangeUniverse(Eltseq(m2),K));\n m3K:=Matrix(5,5,ChangeUniverse(Eltseq(m3),K));\n if P0 eq P1 then\n M:=Matrix([v*m1K,v*m2K,v*m3K]);\n Ker:=Kernel(Transpose(M));\n w:=ExtendBasis([Ker!v],Ker)[2];\n xp:=InnerProduct(w*m1K,w)-2*z*InnerProduct(w*m2K,w)+z^2*InnerProduct(w*m3K,w);\n else\n w:=Vector(Eltseq(P1));\n xp:=InnerProduct(v*m1K,w)-2*z*InnerProduct(v*m2K,w)+z^2*InnerProduct(v*m3K,w);\n end if;\n return xp;\nend function;\n\nfunction PadLocal(L,n)\n return L cat [0:i in [#L+1..n]];\nend function;\n\nfunction ComputeKummerImage()\n KJ:=KummerSurface(J); P3raw:=Proj(Parent(DefiningPolynomial(KJ)));\n Km:=Scheme(P3raw,DefiningPolynomial(KJ));\n P3:=Ambient(Km); k1:=Km.1; k2:=Km.2; k3:=Km.3; k4:=Km.4;\n mons:=[[i,j,k,l]: i in [j..4], j in [k..4], k in [l..4], l in [1..4]];\n MM:=[];\n for tt in [[1,b,c]:b,c in [-5..5]] do\n rel:=tt[1]*X1+tt[2]*X2+tt[3]*X3;\n Qbar:=AlgebraicClosure();\n pts:=RationalPoints(Scheme(D,[rel]),Qbar);\n if #pts eq 0 then continue; end if;\n gn:=MinimalPolynomial(pts[1][1]);\n if Degree(gn) ne 8 then continue; end if;\n Fld:=NumberField(gn);\n ptsF:=RationalPoints(Scheme(D,[rel]),Fld);\n if #ptsF eq 0 then continue; end if;\n PP:=D(Fld)!ptsF[1];\n xp:=xpolmap(PP,PP);\n if Degree(xp) ne 2 or Discriminant(xp) eq 0 then continue; end if;\n Jf:=BaseChange(J,BaseRing(xp));\n jpts:=RationalPoints(Jf,xp,2);\n if #jpts eq 0 then continue; end if;\n Kf:=KummerSurface(Jf); kp:=Kf!jpts[1];\n qds:=[ &*[kp[i]:i in mn]: mn in mons];\n LL:=[[PadLocal(Eltseq(qds[i]),8)[j]:i in [1..#mons]]:j in [1..8]];\n LL:=[l:l in LL|l ne [0:i in [1..#mons]]];\n MM cat:=LL;\n \"interpolation rows\",#MM;\n if #MM gt #mons+4 then break; end if;\n end for;\n \"matrix dimensions\",Nrows(Matrix(MM)),Ncols(Matrix(MM));\n bs:=Basis(Kernel(Transpose(Matrix(MM))));\n \"kernel dimension\",#bs;\n topol:=mapParent(k1)| vv:->&+[&*[P3.i:i in mons[j]]*vv[j]:j in [1..#mons]]>;\n eqs:=[];\n for vv in [bs[1],bs[2]] do\n ff:=topol(vv); ff*:=LCM([Denominator(c):c in Coefficients(ff)]);\n ff/:=GCD([Numerator(c):c in Coefficients(ff)]);\n Append(~eqs,ff);\n end for;\n return Scheme(P3,eqs);\nend function;\n\nCkm:=ComputeKummerImage();\nassert #DefiningEquations(Ckm) eq 2;\n\"Kummer image equations\",DefiningEquations(Ckm);\nKJfinal:=KummerSurface(J); P3final:=Proj(Parent(DefiningPolynomial(KJfinal)));\n\"Kummer equation\",DefiningPolynomial(KJfinal);\n\n// Symbolic verification on the generic point of the original plane quartic.\nP2o:=ProjectiveSpace(Q,2);\nCorig:=Curve(P2o,Xo^4+Xo^2*Yo^2+Yo^3*Zo+Zo^4);\nKF:=FunctionField(Corig);\nxf:=KF!(Xo/Yo); zf:=KF!(Zo/Yo);\nDF:=BaseChange(D,KF);\nPgen:=DF![zf*(1+zf)/xf,xf,(1-zf+zf^2)/xf,1,zf];\nxpg:=xpolmap(Pgen,Pgen);\nassert Degree(xpg) eq 2 and IsIrreducible(xpg);\nJF:=BaseChange(J,KF);\njg:=RationalPoints(JF,xpg,2);\n\"GENERIC xpol degree\",Degree(xpg),\"number of J lifts\",#jg;\nassert #jg eq 2;\nkg:=KummerSurface(JF)!jg[1];\nassert kg eq KummerSurface(JF)!jg[2];\ngeneric_identities :=\n [Evaluate(ff,Eltseq(kg)) eq 0:ff in DefiningEquations(Ckm)];\nassert &and generic_identities;\n\"GENERIC KUMMER IMAGE IDENTITIES\",generic_identities;\n\n// Mordell--Weil sieve on the full certified group J(Q)=+.\nMW,mwmap,finite_index,proved,rank_upper:=MordellWeilGroupGenus2(J);\nassert finite_index and proved and rank_upper eq 1;\nassert Invariants(MW) eq [2,0];\n\"MW certification\",MW,finite_index,proved,rank_upper;\nTq:=mwmap(MW.1); Gq:=mwmap(MW.2);\nassert Tq eq elt;\nassert Gq eq elt;\nsplitx:=s^2-6*s+4;\nsplitJ:=RationalPoints(J,splitx,2);\nassert Seqset(Setseq(splitJ)) eq Seqset([Tq+Gq,Tq-Gq]);\n\"T,G\",Tq,Gq;\neqQ:=DefiningEquations(Ckm);\nR3:=PolynomialRing(Q,3);\naffQ:=[Evaluate(ff,[r1,r2,r3,1]):ff in eqQ];\nassert &and[HomogeneousComponent(ff,d) eq 0:ff in affQ,d in [0,1]];\nlocalQ:=[HomogeneousComponent(ff,2):ff in affQ];\nassert localQ eq [\n 48*r1^2-4*r1*r3+r2^2+24*r2*r3,\n -48*r1^2+240*r1*r3-60*r2^2-24*r2*r3\n];\nassert [Integers(47)!Evaluate(qq,[24,7,1]):qq in localQ] eq [39,8];\n\"LOCAL QUADRATIC FORMS\",localQ,\n \"at MW tangent mod47\",[Integers(47)!Evaluate(qq,[24,7,1]):qq in localQ];\nfor jj in [1..5] do\n kkq:=KJfinal!(jj*28*Gq); cc:=Eltseq(kkq);\n ll:=LCM([Denominator(c):c in cc]); ci:=[Integers()!(ll*c):c in cc];\n gg:=GCD(ci); ci:=[c div gg:c in ci];\n vals:=[Evaluate(ff,ci):ff in eqQ];\n rawdir:=[Integers(47)!(ci[i] div 47^2):i in [1..3]];\n k4res:=Integers(47)!ci[4];\n normdir:=[a/k4res:a in rawdir];\n if jj eq 1 then\n assert [Valuation(c,47):c in ci] eq [2,2,2,0];\n assert normdir eq [Integers(47)|24,7,1];\n end if;\n leadres:=[];\n for vv in vals do\n qq:=vv/47^4;\n Append(~leadres,(Integers(47)!Numerator(qq))/(Integers(47)!Denominator(qq)));\n end for;\n \"P47 LIFT\",jj,\"coordinate valuations\",[Valuation(c,47):c in ci],\n \"equation valuations\",[Valuation(v,47):v in vals],\n \"tangent direction raw\",rawdir,k4res,\"normalized\",normdir,\n \"leading equation residues\",leadres;\nend for;\nfor p in [47] do\n Fp:=GF(p); Rp:=PolynomialRing(Fp);\n Hp:=HyperellipticCurve(Rp![Fp!c:c in Coefficients(Fbru)]);\n Jp:=Jacobian(Hp);\n Tp:=elt;\n Gp:=elt;\n ord:=Order(Gp); Kp:=KummerSurface(Jp);\n assert Order(Tp) eq 2 and ord eq 28;\n P3p:=ProjectiveSpace(Fp,3);\n eqp:=[CoordinateRing(P3p)!ff:ff in eqQ];\n allowed:=[];\n for ee in [0,1] do\n for nn in [0..ord-1] do\n jp:=ee*Tp+nn*Gp;\n kk:=Kp!jp; crd:=Eltseq(kk);\n if &and[Evaluate(ff,crd) eq 0:ff in eqp] then\n Append(~allowed,);\n end if;\n end for;\n end for;\n assert allowed eq [<0,0>];\n \"SIEVE\",p,\"ordT\",Order(Tp),\"ordG\",ord,\"allowed\",allowed;\nend for;\n\n// Independent good-reduction, full-Jacobian torsion and L-factor checks.\nps := [5,7,11,13,47];\nexpected := [[198,0],[2,198,0],[2,2,320,0],[12,288,0],\n [2,2,8,2520,0]];\nfor i in [1..#ps] do\n p := ps[i];\n Fp:=GF(p);\n PP2p:=ProjectiveSpace(Fp,2);\n Cp:=Curve(PP2p,xxp^4+xxp^2*yyp^2+yyp^3*zzp+zzp^4);\n Rpp:=PolynomialRing(Fp);\n Hp:=HyperellipticCurve(2*(sp^2+2*sp-2)*(sp^3+sp^2-2*sp+1));\n Ep:=EllipticCurve([Fp|0,0,0,16,-64]);\n inv:=ClassGroupAbelianInvariants(Cp);\n assert IsNonsingular(Cp) and IsNonsingular(Hp);\n assert inv eq expected[i];\n assert LPolynomial(Cp) eq LPolynomial(Ep)*LPolynomial(Hp);\n \"REDUCTION CERT\",p,\"smooth C,H\",IsNonsingular(Cp),IsNonsingular(Hp),\n \"class invariants\",inv,\n \"L factor\",LPolynomial(Cp) eq LPolynomial(Ep)*LPolynomial(Hp);\nend for;\n\n\n\n\n" }, { "path": "anc/code/1.3.6/jac_e09.py", "size_bytes": 4510, "sha256": "a6bff777eba4b489e722a2764ee428f6456a7fff84d386d6069512e72076d751", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Independent Jacobian arithmetic (Cantor) and Flynn Kummer map for H: y^2 = f(x), deg f = 5\nimport flint\nfrom fractions import Fraction\n\nFCOEF = [-4, 12, -10, -4, 6, 2] # f0..f5 : 2x^5+6x^4-4x^3-10x^2+12x-4\n\nclass Ring:\n def __init__(self, p=None):\n self.p = p\n if p is None:\n self.P = lambda c: flint.fmpq_poly(c)\n self.S = lambda c: flint.fmpq(c) if not isinstance(c, Fraction) else flint.fmpq(c.numerator, c.denominator)\n else:\n self.P = lambda c: flint.nmod_poly([int(x) % p for x in c], p)\n self.S = lambda c: flint.nmod(int(c) % p, p)\n self.f = self.P(FCOEF)\n def monic(self, a):\n return a / a.leading_coefficient() if self.p is None else a * (a.leading_coefficient() ** -1)\n def divexact(self, a, b):\n q, r = divmod(a, b); assert r == 0; return q\n def xgcd(self, a, b):\n g, s, t = a.xgcd(b)\n assert s * a + t * b == g\n return g, s, t\n\ndef jadd(R, D1, D2):\n a1, b1 = D1; a2, b2 = D2\n f = R.f\n d0, e1, e2 = R.xgcd(a1, a2)\n d, c1, c2 = R.xgcd(d0, b1 + b2)\n # normalise d monic\n lc = d.leading_coefficient()\n inv = (1 / lc) if R.p is None else lc ** -1\n d, c1, c2 = d * inv, c1 * inv, c2 * inv\n s1, s2, s3 = c1 * e1, c1 * e2, c2\n a = R.divexact(a1 * a2, d * d)\n b = R.divexact(s1 * a1 * b2 + s2 * a2 * b1 + s3 * (b1 * b2 + f), d) % a\n while a.degree() > 2:\n a = R.divexact(f - b * b, a)\n a = R.monic(a)\n b = (-b) % a\n a = R.monic(a)\n b = b % a\n return (a, b)\n\ndef jneg(R, D):\n a, b = D\n return (a, (-b) % a)\n\ndef jzero(R):\n return (R.P([1]), R.P([0]))\n\ndef jmul(R, n, D):\n if n < 0: return jmul(R, -n, jneg(R, D))\n res = jzero(R); base = D\n while n:\n if n & 1: res = jadd(R, res, base)\n base = jadd(R, base, base); n >>= 1\n return res\n\ndef coeff(poly, i):\n c = poly.coeffs()\n return c[i] if i < len(c) else 0 * c[0] if len(c) else 0\n\ndef kummer(R, D):\n a, b = D\n f = [R.S(c) for c in FCOEF] + [R.S(0)]\n one = R.S(1); zero = R.S(0)\n if a.degree() == 0:\n return [zero, zero, zero, one]\n if a.degree() == 1:\n x = -coeff(a, 0)\n return [zero, one, x, f[5] * x * x]\n a0, a1 = coeff(a, 0), coeff(a, 1)\n b0, b1 = coeff(b, 0), coeff(b, 1)\n s, pr = -a1, a0\n disc = s * s - 4 * pr\n F0 = 2*f[0] + f[1]*s + 2*f[2]*pr + f[3]*pr*s + 2*f[4]*pr*pr + f[5]*pr*pr*s + 2*f[6]*pr**3\n y1y2 = b1*b1*pr + b1*b0*s + b0*b0\n if disc != 0:\n return [one, s, pr, (F0 - 2*y1y2) / disc]\n # double root: solve Kummer equation (linear in k4 when K2=0)\n K = kummer_eq_coeffs_in_k4(R, one, s, pr)\n assert K[2] == 0 and K[1] != 0\n return [one, s, pr, -K[0] / K[1]]\n\n# Magma's printed Kummer equation (from the log), used only to check normalisation\ndef KUM(k):\n x1, x2, x3, x4 = k\n return (-16*x1**4 - 64*x1**3*x2 + 96*x1**3*x3 + 16*x1**3*x4 + 96*x1**2*x2**2 - 320*x1**2*x2*x3 - 24*x1**2*x2*x4\n + 304*x1**2*x3**2 + 40*x1**2*x3*x4 + 32*x1*x2**3 - 96*x1*x2**2*x3 + 80*x1*x2*x3**2 + 8*x1*x2*x3*x4\n + 16*x1*x3**3 - 24*x1*x3**2*x4 - 4*x1*x3*x4**2 + x2**2*x4**2 - 4*x2*x3**2*x4 + 4*x3**4)\n\ndef kummer_eq_coeffs_in_k4(R, x1, x2, x3):\n # K = K2 x4^2 + K1 x4 + K0\n K0 = KUM([x1, x2, x3, 0 * x1])\n Kp = KUM([x1, x2, x3, x1 / x1])\n Km = KUM([x1, x2, x3, -(x1 / x1)])\n K2 = (Kp + Km) / 2 - K0\n K1 = (Kp - Km) / 2\n return [K0, K1, K2]\n\ndef PHI1(k):\n x1, x2, x3, x4 = k\n return (944*x1**4 + 3360*x1**3*x3 - 368*x1**3*x4 + 1680*x1**2*x2**2 - 3680*x1**2*x2*x3 - 696*x1**2*x2*x4 + 5520*x1**2*x3**2 - 120*x1**2*x3*x4 +\n 48*x1**2*x4**2 + 192*x1*x2**3 - 608*x1*x2**2*x3 + 160*x1*x2**2*x4 + 1256*x1*x2*x3**2 - 520*x1*x2*x3*x4 + 328*x1*x3**3 - 440*x1*x3**2*x4 -\n 4*x1*x3*x4**2 - 144*x2**4 + 288*x2**3*x3 + 96*x2**3*x4 - 136*x2**2*x3**2 - 160*x2**2*x3*x4 + x2**2*x4**2 + 56*x2*x3**3 - 52*x2*x3**2*x4 +\n 24*x2*x3*x4**2 + 67*x3**4 - 12*x3**3*x4)\n\ndef PHI2(k):\n x1, x2, x3, x4 = k\n return (3776*x1**3*x2 - 9024*x1**3*x3 - 576*x1**3*x4 - 7344*x1**2*x2**2 + 22560*x1**2*x2*x3 + 2112*x1**2*x2*x4 - 23456*x1**2*x3**2 - 2240*x1**2*x3*x4 -\n 48*x1**2*x4**2 - 2080*x1*x2**3 + 6272*x1*x2**2*x3 - 160*x1*x2**2*x4 - 5976*x1*x2*x3**2 + 48*x1*x2*x3*x4 - 1272*x1*x3**3 + 1856*x1*x3**2*x4 +\n 240*x1*x3*x4**2 + 144*x2**4 - 288*x2**3*x3 - 96*x2**3*x4 + 136*x2**2*x3**2 + 160*x2**2*x3*x4 - 60*x2**2*x4**2 - 56*x2*x3**3 + 288*x2*x3**2*x4 -\n 24*x2*x3*x4**2 - 303*x3**4 + 12*x3**3*x4)\n" }, { "path": "anc/code/1.3.7/run_all.sh", "size_bytes": 1415, "sha256": "91a516723a330fd9e2e9b5520c3921252ef66e8213bdd8a95c30b79d958d290f", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/bash\n# Re-run every step and compare with expected/ (s05a, 13 min, only with --full).\nPY=${PY:-python3}\ncd \"$(dirname \"$0\")\"\nmkdir -p out\nrun() { name=$1; shift; echo \"== $name\"; \"$@\" 2>/dev/null | grep -v Warning > out/$name.out; grep -c PASS out/$name.out | sed 's/^/ PASS lines: /'; grep FAIL out/$name.out; }\n[ \"$1\" = \"--full\" ] && { bash run_s05a.sh out/witnesses; WIT=out/witnesses/wit_*.jsonl.gz; } || WIT=data/witnesses/wit_*.jsonl.gz\nrun s01_curve $PY s01_curve.py\nrun s02_field $PY s02_field.py\nrun s03_global_kernel $PY s03_global_kernel.py\nrun s04_sunits $PY s04_sunits.py\nrun s05b_check_classgroup $PY s05b_check_classgroup.py $WIT\nif command -v gp >/dev/null; then\n echo \"== s05c_check_witnesses (GP $(echo 'print(version())' | gp -q))\"\n python3 wit2gp.py out/wit.gp $WIT\n echo 'WIT=\"out/wit.gp\"; read(\"s05c_check_witnesses.gp\")' | gp -q -s 400000000 -D parisizemax=2000000000 2>/dev/null > out/s05c_check_witnesses.out\n grep ALL out/s05c_check_witnesses.out; rm -f out/wit.gp\nfi\nrun s06_local2 $PY s06_local2.py\nrun s08_selmer $PY s08_selmer.py\nrun s09_chabauty3 $PY s09_chabauty.py 3\necho \"== differences from expected/ (timings in s05b may differ):\"\nfor f in out/*.out; do b=$(basename $f); [ \"$b\" = s05c_check_witnesses.out ] && b=s05c_check_witnesses_gp2154.out; diff -q <(grep -v \" s)\\| s$\\| s\\]$\" $f) <(grep -v \" s)\\| s$\\| s\\]$\" expected/$b) >/dev/null || echo \" DIFF: $b\"; done\n" }, { "path": "anc/code/1.3.7/run_s05a.sh", "size_bytes": 586, "sha256": "fd827a534f8e737c4812095ceaa33379bfda9046b51219175d023580ede56755", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/bash\n# Resumable driver for s05a (one worker). Chunks of rational primes; a finished chunk has a .done marker.\nPY=${PY:-python3}\nHERE=$(cd \"$(dirname \"$0\")\" && pwd)\nOUT=${1:-$HERE/../work/cg}\nmkdir -p \"$OUT\"\nfor r in \"2 50000\" \"50000 100000\" \"100000 150000\" \"150000 200000\" \"200000 250000\" \"250000 300000\" \"300000 350000\" \"350000 400000\" \"400000 442414\"; do\n set -- $r\n f=\"$OUT/wit_$1_$2.jsonl.gz\"\n if [ -f \"$f.done\" ]; then echo \"skip $1 $2\"; continue; fi\n $PY \"$HERE/s05a_principal_witnesses.py\" $1 $2 \"$f\" 2>/dev/null > \"$f.log\" && touch \"$f.done\"\n tail -1 \"$f.log\"\ndone\n" }, { "path": "anc/code/1.3.7/s01_curve.py", "size_bytes": 9298, "sha256": "c65e3acef0c40966a82fdaab09eaa1bf93103e4911e577f697e1020dd4d231e7", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# s01: the curve. Bad primes of the plane model, the nodes at 2, 11, 41269 and regularity,\n# rational points with a zero coordinate, line sections, point counts and #J(F_p), torsion.\nfrom t62lib import pari, log, check, FPOL\nimport itertools, math\n\nF = FPOL\nFx, Fy, Fz = [pari.deriv(F, v) for v in ('x', 'y', 'z')]\ncheck(pari('x') * Fx + pari('y') * Fy + pari('z') * Fz - 4 * F == 0, \"Euler identity x F_x + y F_y + z F_z = 4F\")\n\n# ---------------------------------------------------------------- bad primes\n# In each affine chart, a singular point (over any field) is a common zero of f, f_u, f_v.\n# Res_v(.,.) lies in the ideal generated by the two polynomials (over Z), so for a singular point\n# (u0,v0) over F_p-bar each resultant vanishes at u0 mod p, and each integer Res_u(R_i,R_j) is 0 mod p.\ndef chart(F, keep):\n \"\"\"dehomogenise: set the variable not in keep to 1; return (f, u, v).\"\"\"\n third = [v for v in 'xyz' if v not in keep][0]\n return pari.subst(F, third, 1), keep[0], keep[1]\n\ndef chart_integer(F, keep):\n f, u, v = chart(F, keep)\n fu, fv = pari.deriv(f, u), pari.deriv(f, v)\n R = [pari.polresultant(a, b, v) for (a, b) in ((f, fu), (f, fv), (fu, fv))]\n N = 0\n for i, j in ((0, 1), (0, 2), (1, 2)):\n r = pari.polresultant(R[i], R[j], u)\n N = math.gcd(N, int(r))\n return N\n\nNs = {}\nfor keep in (('x', 'y'), ('x', 'z'), ('y', 'z')):\n N = chart_integer(F, keep)\n Ns[keep] = N\n log(\"chart\", keep, \"gcd of eliminants =\", pari.factor(N))\n check(N != 0, \"eliminant nonzero in chart %s\" % (keep,))\ncand = sorted(set(int(p) for N in Ns.values() for p in pari.factor(N)[0]))\nlog(\"candidate bad primes:\", cand)\n\ndef singular_points_mod_p(p):\n \"\"\"Singular points of C mod p over F_p-bar. Returns (F_p-rational singular points, number of\n singular points defined only over proper extensions of F_p).\"\"\"\n pts, ext = set(), set()\n for keep in (('x', 'y'), ('x', 'z'), ('y', 'z')):\n f, u, v = chart(F, keep)\n third = [c for c in 'xyz' if c not in keep][0]\n fu, fv = pari.deriv(f, u), pari.deriv(f, v)\n Rs = [pari.polresultant(a, b, v) for (a, b) in ((f, fu), (f, fv), (fu, fv))]\n g = pari.Mod(1, p) * Rs[0]\n for r in Rs[1:]:\n g = pari.gcd(g, pari.Mod(1, p) * r)\n if pari.poldegree(g) <= 0:\n continue\n # all roots u0 of g over F_{p^d}, d = lcm of the degrees of its factors\n fa = pari.factormod(pari.lift(g), p)\n d = 1\n for k in range(len(fa[0])):\n d = d * int(pari.poldegree(fa[0][k])) // math.gcd(d, int(pari.poldegree(fa[0][k])))\n one = pari.ffgen(pari.ffinit(p, max(d, 1) * 2, 'X'), 'X') ** 0 # work in F_{p^(2d)}\n for u0 in pari.polrootsmod(pari.lift(g) * one):\n G = None\n for q in (f, fu, fv):\n q0 = pari.subst(q, u, u0) * one\n G = q0 if G is None else pari.gcd(G, q0)\n if pari.poldegree(G) <= 0:\n continue\n fG = pari.factor(G)[0]\n for j in range(len(fG)):\n if pari.poldegree(fG[j]) > 1: # roots of G outside F_{p^(2d)}: singular points over an extension\n ext.add((str(u0), str(fG[j])))\n for v0 in pari.polrootsmod(G):\n P = {keep[0]: u0, keep[1]: v0, third: one}\n vec = [P['x'], P['y'], P['z']]\n i = next(i for i in range(3) if vec[i] != 0)\n vec = [c / vec[i] for c in vec]\n if all(c ** p == c for c in vec): # F_p-rational point\n pts.add(tuple(int(pari('(c)->polcoeff(c.pol,0)')(c)) % p for c in vec))\n else:\n ext.add(tuple(str(c) for c in vec))\n return sorted(pts), len(ext)\n\nbad = []\nfor p in cand:\n pts, ext = singular_points_mod_p(p)\n log(\"p =\", p, \": singular points over F_p:\", pts, \" (singular points over proper extensions found:\", ext, \")\")\n if pts or ext:\n bad.append(p)\ncheck(bad == [2, 11, 41269], \"bad primes of the plane model are exactly 2, 11, 41269\")\n\n# ---------------------------------------------------------------- nodes and regularity\ndef local_analysis(p, P0):\n \"\"\"Taylor expansion of F at an integral lift of P0 in an affine chart; returns the\n p-valuation of F(lift), the quadratic part mod p and its discriminant.\"\"\"\n i = next(i for i in range(3) if P0[i] % p) # chart where coordinate i = 1\n names = ['x', 'y', 'z']\n rest = [j for j in range(3) if j != i]\n inv = pow(P0[i], -1, p)\n lift = [c * inv % p for c in P0]\n sub = F\n sub = pari.subst(sub, names[i], 1)\n # translate: names[rest] -> lift + U, V\n U, V = pari('X'), pari('Y')\n sub = pari.subst(sub, names[rest[0]], lift[rest[0]] + U)\n sub = pari.subst(sub, names[rest[1]], lift[rest[1]] + V)\n c00 = int(pari.subst(pari.subst(sub, 'X', 0), 'Y', 0))\n c10 = pari.polcoeff(pari.subst(sub, 'Y', 0), 1, 'X')\n c01 = pari.polcoeff(pari.subst(sub, 'X', 0), 1, 'Y')\n a = pari.polcoeff(pari.subst(sub, 'Y', 0), 2, 'X')\n c = pari.polcoeff(pari.subst(sub, 'X', 0), 2, 'Y')\n b = pari.polcoeff(pari.polcoeff(sub, 1, 'X'), 1, 'Y')\n return dict(lift=lift, vF=int(pari.valuation(c00, p)) if c00 else 99,\n lin=(int(c10) % p, int(c01) % p), quad=(int(a) % p, int(b) % p, int(c) % p))\n\nfor p in bad:\n pts, ext = singular_points_mod_p(p)\n check(len(pts) == 1 and ext == 0, \"p=%d: exactly one singular point over F_p-bar, and it is F_p-rational: %s\" % (p, pts))\n d = local_analysis(p, pts[0])\n a, b, c = d['quad']\n if p == 2:\n node = (b % 2 == 1) # char 2: a u^2 + b u v + c v^2 is a product of two distinct lines iff b != 0\n split = node and (a * c % 2 == 0) # x^2+xy+y^2 is irreducible over F_2\n kind = \"split\" if split else \"non-split\"\n else:\n disc = (b * b - 4 * a * c) % p\n node = disc != 0\n kind = \"split\" if pari.kronecker(disc, p) == 1 else \"non-split\"\n check(d['lin'] == (0, 0) and node, \"p=%d: the singular point %s is an ordinary double point (%s); quadratic part %s\"\n % (p, pts[0], kind, d['quad']))\n log(\" p=%d: v_p(F(lift)) = %d at the lift %s\" % (p, d['vF'], d['lift']))\n if p != 2:\n check(d['vF'] == 1, \"p=%d: v_p(F(lift of node)) = 1, so the plane model is regular at the node\" % p)\n\n# a plane quartic with a single node is geometrically irreducible (a reducible quartic has >= 3 singular points)\nlog(\" (each special fibre has a single singular point, an ordinary double point; two components of a reducible plane quartic meet with total intersection number at least 3, so each special fibre above is irreducible)\")\n\n# ---------------------------------------------------------------- rational points with a zero coordinate\nfor v, expect in (('x', 'y*z^2*(y-z)'), ('y', 'x^3*z'), ('z', 'x*y^3')):\n check(pari.subst(F, v, 0) == pari(expect), \"F|_{%s=0} = %s\" % (v, expect))\nlog(\" => points with xyz=0: P1=(1:0:0), P2=(0:1:0), P3=(0:0:1), P4=(0:1:1)\")\n\n# line sections: intersection multiplicities via the binary forms\ncheck(pari.subst(F, 'z', 0) == pari('x*y^3'), \"div(z) = 3 P1 + P2 (F(x,y,0) = x y^3)\")\ncheck(pari.subst(F, 'y', 0) == pari('x^3*z'), \"div(y) = P1 + 3 P3 (F(x,0,z) = x^3 z)\")\ncheck(pari.subst(F, 'x', 0) == pari('y*z^2*(y-z)'), \"div(x) = 2 P2 + P3 + P4 (F(0,y,z) = y z^2 (y-z))\")\nlog(\" => [P2-P1] = 3G and [P4-P1] = -4G for G = [P3-P1] (div(z/y) = 2P1+P2-3P3, div(x/y) = 2P2+P4-P1-2P3)\")\n\n# ---------------------------------------------------------------- point counts and #J(F_p)\ndef count_points(p, k):\n \"\"\"#C(F_{p^k}) for the projective curve, by brute force over F_{p^k}.\"\"\"\n T = pari.ffinit(p, k, 'X')\n r = pari.ffprimroot(pari.ffgen(T, 'X'))\n one = r ** 0\n els = [0 * one] + [r ** i for i in range(p ** k - 1)]\n q = p ** k\n N = 0\n f1 = pari.subst(F, 'z', 1) # affine part z = 1\n for x0 in els:\n h = pari.subst(f1, 'x', x0) * one # polynomial in y over F_q\n if h == 0:\n N += q\n elif pari.poldegree(h, 'y') > 0:\n N += len(pari.polrootsmod(h)) # distinct roots in F_q (h is squarefree or not: count distinct)\n N += 2 # z = 0: F = x y^3 -> (1:0:0), (0:1:0)\n return N\n\ndef Lpoly_and_J(p):\n Ns = [count_points(p, k) for k in (1, 2, 3)]\n s = [p ** k + 1 - Ns[k - 1] for k in (1, 2, 3)] # power sums of Frobenius eigenvalues\n a1 = -s[0]\n a2 = (s[0] ** 2 - s[1]) // 2\n a3 = -(s[0] ** 3 - 3 * s[0] * s[1] + 2 * s[2]) // 6\n assert (s[0] ** 2 - s[1]) % 2 == 0 and (s[0] ** 3 - 3 * s[0] * s[1] + 2 * s[2]) % 6 == 0\n L = [1, a1, a2, a3, p * a2, p * p * a1, p ** 3]\n J = sum(L)\n return Ns, L, J\n\nres = {}\nfor p in (3, 5, 7, 17):\n Ns, L, J = Lpoly_and_J(p)\n res[p] = J\n log(\"p=%d: (N1,N2,N3) = %s, L(T) coefficients %s, #J(F_p) = L(1) = %d = %s\" % (p, tuple(Ns), L, J, pari.factor(J)))\ncheck([res[p] for p in (3, 5, 7, 17)] == [31, 141, 531, 10238], \"#J(F_p) = 31, 141, 531, 10238 for p = 3, 5, 7, 17\")\ncheck(math.gcd(res[5], res[17]) == 1, \"gcd(#J(F_5), #J(F_17)) = 1, so J(Q)_tors = 0 (torsion injects at good odd p)\")\ncheck(count_points(3, 1) == 4, \"#C(F_3) = 4\")\ncheck(count_points(5, 1) == 6, \"#C(F_5) = 6\")\nlog(\"s01 done\")\n" }, { "path": "anc/code/1.3.7/s02_field.py", "size_bytes": 6113, "sha256": "00db26b2411c44079854faa5765860578ceee2db1dcc0d2af5727184297ed846", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# s02: the 28 bitangents and the field K.\n# - the bitangent polynomial B(m) recomputed by elimination, = the paper's B;\n# - the paper's (a, n) in K = Q(w), g(w) = 0, give a bitangent y = a x + n z, and B(a) = 0;\n# - maximal order certified (nfcertify), d_K, signature, primes above 2, 11, 41269;\n# - Frobenius cycle types -> elements of order 5, 7, 9 in the Galois group of B;\n# - -n is a square in K; K has no quadratic subfield.\nfrom t62lib import pari, log, check, FPOL, load_field, load_elt\nimport math, time\n\nB_paper = pari('m^28 - 208*m^26 - 1024*m^25 + 9344*m^24 - 33792*m^22 - 83636*m^21 + 32256*m^20 + 131816*m^19'\n ' - 44352*m^17 - 23872*m^15 + 87462*m^14 + 28512*m^12 + 5968*m^10 - 3828*m^7 - 504*m^5 + 1')\n\n# ---------------------------------------------------------------- elimination\n# y = m x + n z (variable 's' plays the role of the intercept n here)\nQ = pari.substpol(FPOL, 'y', pari('m*x + s*z'))\nQ = pari.subst(Q, 'z', 1) # binary quartic in x (z = 1)\nc = [pari.polcoeff(Q, k, 'x') for k in range(5)] # c[k] = coefficient of x^k z^(4-k)\nlog(\"Q(x,1) coefficients c4..c0:\", [str(c[k]) for k in (4, 3, 2, 1, 0)])\nc4, c3, c2, c1, c0 = c[4], c[3], c[2], c[1], c[0]\n# Q = c4 (x^2 + u x + v)^2 <=> u = c3/(2 c4), v = (4 c2 c4 - c3^2)/(8 c4^2) and\ne1 = 8 * c1 * c4 ** 2 - c3 * (4 * c2 * c4 - c3 ** 2) # = 0\ne2 = 64 * c0 * c4 ** 3 - (4 * c2 * c4 - c3 ** 2) ** 2 # = 0\nR = pari.polresultant(e1, e2, 's')\nfa = pari.factor(R)\nlog(\"Res_n(e1,e2) factors (degree in m, multiplicity):\",\n [(int(pari.poldegree(fa[0][i], 'm')), int(fa[1][i])) for i in range(len(fa[0]))])\nbig = [fa[0][i] for i in range(len(fa[0])) if pari.poldegree(fa[0][i], 'm') == 28]\ncheck(len(big) == 1 and big[0] / pari.pollead(big[0]) == B_paper, \"the degree-28 factor of the eliminant is the paper's B(m)\")\nothers = [fa[0][i] for i in range(len(fa[0])) if pari.poldegree(fa[0][i], 'm') != 28]\ncheck(all(pari.poldegree(h, 'm') <= 1 and pari.polcoeff(h, 0, 'm') == 0 for h in others),\n \"the other factors are powers of m (m = 0: y = n z meets C at P1 with odd multiplicity, not a bitangent)\")\ncheck(pari.polisirreducible(B_paper), \"B is irreducible over Q\")\ncheck(pari.poldegree(pari.gcd(B_paper, pari.deriv(B_paper, 'm'))) == 0, \"B is squarefree (28 distinct slopes)\")\n\n# ---------------------------------------------------------------- the field\nt0 = time.time()\ng, nf = load_field()\nlog(\"g(w) =\", g)\ncheck(pari.nfcertify(nf) == [], \"nfcertify(nf) = []: the maximal order is proved (unconditional)\")\nD = int(nf[2]); sig = nf[1]\ncheck(D == 2 ** 42 * 11 ** 6 * 41269 ** 6, \"d_K = 2^42 * 11^6 * 41269^6 (%s)\" % pari.factor(D))\ncheck([int(sig[0]), int(sig[1])] == [4, 12], \"signature (r1, r2) = (4, 12)\")\na = pari.Mod(load_elt(\"a.txt\"), g)\nn = pari.Mod(load_elt(\"n.txt\"), g)\ncheck(pari.subst(B_paper, 'm', a) == 0, \"B(a) = 0 in K, so K = Q(a)\")\n# bitangent condition in K: F(x, a x + n z, z) = c (x^2 + u x z + v z^2)^2\nQa = pari.subst(pari.subst(c4, 'm', a), 's', n), pari.subst(pari.subst(c3, 'm', a), 's', n), \\\n pari.subst(pari.subst(c2, 'm', a), 's', n), pari.subst(pari.subst(c1, 'm', a), 's', n), \\\n pari.subst(pari.subst(c0, 'm', a), 's', n)\nk4, k3, k2, k1, k0 = Qa\nu = k3 / (2 * k4); v = (k2 / k4 - u ** 2) / 2\ncheck(k1 == 2 * k4 * u * v and k0 == k4 * v ** 2,\n \"F(x, a x + n z, z) = a^3 (x^2 + u x z + v z^2)^2 in K[x,z]: y = a x + n z is a bitangent\")\ncheck(k4 == a ** 3, \"leading coefficient c4 = a^3\")\nlog(\" => the 28 conjugates of (a, n) give 28 distinct bitangents (distinct slopes): all bitangents of C\")\n# -n is a square, a is a unit, n's norm\ncheck(len(pari.nfroots(nf, pari('X^2') + pari.lift(n))) == 2, \"-n is a square in K\")\ncheck(abs(int(pari.nfeltnorm(nf, pari.lift(a)))) == 1 and pari.nfeltval(nf, pari.lift(a), pari.idealprimedec(nf, 2)[0]) == 0\n and all(x.denominator() == 1 for x in pari.nfalgtobasis(nf, pari.lift(a))), \"a is a unit of O_K\")\nlog(\" N(a) =\", pari.nfeltnorm(nf, pari.lift(a)), \" N(n) =\", pari.nfeltnorm(nf, pari.lift(n)))\n\n# primes above 2, 11, 41269\nS = []\nfor p in (2, 11, 41269):\n dec = pari.idealprimedec(nf, p)\n ef = [(int(P[2]), int(P[3])) for P in dec]\n log(\" primes above %d: (e,f) =\" % p, ef, \" local degrees\", [e * f for e, f in ef])\n S += [(p, P) for P in dec]\ncheck(len(S) == 13, \"#S = 13 primes of K above 2, 11, 41269\")\nef11 = sorted(int(P[2]) for P in pari.idealprimedec(nf, 11))\nef41 = sorted(int(P[2]) for P in pari.idealprimedec(nf, 41269))\ncheck(ef11 == [1, 1, 1, 1, 2] and ef41 == [1, 1, 2, 2], \"ramification indices [1,1,1,1,2] above 11 and [2,2,1,1] above 41269\")\nloc2 = sorted(int(P[2]) * int(P[3]) for P in pari.idealprimedec(nf, 2))\ncheck(loc2 == [4, 6, 6, 12], \"local degrees above 2 (= orbit sizes of a decomposition group at 2 on the bitangents) are 4, 6, 6, 12\")\n\n# ---------------------------------------------------------------- Frobenius elements\ndiscB = pari.poldisc(B_paper)\nfound = {}\nfor p in pari.primes(400):\n p = int(p)\n if discB % p == 0:\n continue\n fm = pari.factormod(B_paper, p)\n degs = sorted(int(pari.poldegree(fm[0][i])) * 1 for i in range(len(fm[0])) for _ in range(int(fm[1][i])))\n if sum(degs) != 28 or any(int(fm[1][i]) != 1 for i in range(len(fm[0]))):\n continue\n order = 1\n for d in degs:\n order = order * d // math.gcd(order, d)\n for q in (5, 7, 9):\n if order % q == 0 and q not in found:\n found[q] = (p, degs, order)\nfor q in (5, 7, 9):\n log(\" order divisible by %d: Frob_%d has cycle type %s (order %d)\" % (q, found[q][0], found[q][1], found[q][2]))\ncheck(set(found) == {5, 7, 9}, \"the Galois group of B contains elements of order 5, 7 and 9\")\nlog(\" => (Gal(B) <= Sp_6(F_2), and no maximal subgroup of Sp_6(F_2) has elements of orders 5, 7, 9) Gal(B) = Sp_6(F_2)\")\n\n# ---------------------------------------------------------------- subfields\nt1 = time.time()\nsub2 = pari.nfsubfields(nf, 2)\ncheck(len(sub2) == 0, \"K has no quadratic subfield (nfsubfields(K,2) = []) [%.1f s]\" % (time.time() - t1))\nlog(\"s02 done [%.1f s]\" % (time.time() - t0))\n" }, { "path": "anc/code/1.3.7/s03_global_kernel.py", "size_bytes": 4793, "sha256": "8aa3d8c93d220e79d0de28939f92da46196f3f05297856ffedfef95f1501b2f3", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# s03: group theory of the 28 bitangents (no number theory).\n# Model: V = J[2] = F_2^6 with the standard symplectic form; the 28 bitangents <-> the 28 odd quadratic\n# forms q on V polarising to < , >; the Weil-pairing embedding V -> M = F_2^Theta / F_2*1 is\n# T -> (q(T))_q. Galois acts through G = Sp_6(F_2) (generated by its 63 transvections).\n# (1) V -> M is injective, and the 63 nonzero T have pairwise distinct \"Steiner supports\" {q : q(T)=0}\n# of size 12 (the complement has size 16);\n# (2) (M/V)^G = 0, so ker(H^1(Q, J[2]) -> H^1(Q, M)) = 0 (the global kernel);\n# (3) J[2]^G = 0; (4) || = 1451520 = |Sp_6(F_2)|, acting faithfully on the 28 forms.\nimport itertools, sys\nfrom sympy.combinatorics import Permutation, PermutationGroup\n\ndef log(*a): print(*a, flush=True)\ndef check(c, msg):\n if not c: log(\"FAIL:\", msg); sys.exit(1)\n log(\"PASS:\", msg)\n\nvecs = [tuple(v) for v in itertools.product((0, 1), repeat=6)]\ndef ip(x, y): # symplectic form\n return (x[0]*y[3] + x[3]*y[0] + x[1]*y[4] + x[4]*y[1] + x[2]*y[5] + x[5]*y[2]) % 2\ndef q0(x):\n return (x[0]*x[3] + x[1]*x[4] + x[2]*x[5]) % 2\ndef qc(c): # quadratic refinements: q_c(x) = q0(x) + ; Arf(q_c) = q0(c)\n return lambda x: (q0(x) + ip(c, x)) % 2\nodd = [c for c in vecs if q0(c) == 1]\ncheck(len(odd) == 28, \"28 odd quadratic forms (Arf invariant 1)\")\nnz = [v for v in vecs if any(v)]\nemb = {T: tuple(qc(c)(T) for c in odd) for T in vecs}\nsizes = sorted(set(sum(1 for b in emb[T] if b == 0) for T in nz))\nsupports = {T: frozenset(i for i, b in enumerate(emb[T]) if b == 0) for T in nz}\ncheck(sizes == [12], \"for every T != 0, #{q odd : q(T) = 0} = 12 (and 16 forms have q(T) = 1)\")\ncheck(len(set(supports.values())) == 63, \"the 63 Steiner supports are pairwise distinct (so V -> M is injective)\")\n\n# transvections and their action on the odd forms: (s.q)(x) = q(s^-1 x); transvections are involutions\ndef transv(v):\n return lambda x: tuple((x[i] + ip(x, v) * v[i]) % 2 for i in range(6))\ndef act_on_forms(s):\n perm = []\n for c in odd:\n # (q_c o s)(x) = q_{c'}(x) for a unique c'; find it by evaluating on all x\n vals = tuple(qc(c)(s(x)) for x in vecs)\n cp = next(d for d in odd if tuple(qc(d)(x) for x in vecs) == vals)\n perm.append(odd.index(cp))\n return perm\ngens = [act_on_forms(transv(v)) for v in nz]\nGp = PermutationGroup([Permutation(g) for g in gens])\norder = Gp.order()\ncheck(order == 1451520, \"the transvections generate a group of order %d = |Sp_6(F_2)| acting on the 28 odd forms\" % order)\ncheck(Gp.is_transitive() and Gp.is_primitive(), \"the action on the 28 bitangents is transitive and primitive\")\n\n# (M/V)^G via F_2 linear algebra on F_2^28: W = {m : (g-1)m in U for all generators g}, U = <1> + V\ndef rank(rows):\n rows = [int(''.join(map(str, r)), 2) for r in rows]\n basis = []\n for r in rows:\n for b in basis:\n r = min(r, r ^ b)\n if r:\n basis.append(r)\n return len(basis)\nN = 28\none = tuple([1] * N)\nU = [one] + [emb[e] for e in [tuple(1 if i == j else 0 for i in range(6)) for j in range(6)]]\ncheck(rank(U) == 7, \"U = <1> + V has dimension 7 in F_2^28\")\n# Solve for W: m in W iff for each generator g, (g m + m) lies in U.\n# Linear system over F_2 in unknowns m (28) and coefficients of U (7 per generator).\nimport numpy as np\nrows = []\nG_list = gens\nncols = N + 7 * len(G_list)\nfor k, g in enumerate(G_list):\n # (g m)_i = m_{g^-1(i)}; g is an involution here so g^-1 = g\n for i in range(N):\n r = [0] * ncols\n r[i] ^= 1\n r[g[i]] ^= 1\n for j in range(7):\n if U[j][i]:\n r[N + 7 * k + j] ^= 1\n rows.append(r)\nA = np.array(rows, dtype=np.uint8)\n# nullspace dimension over F_2, then project to the m-coordinates\ndef nullspace_f2(A):\n A = A.copy() % 2\n m, n = A.shape\n piv = []\n r = 0\n for c in range(n):\n p = next((i for i in range(r, m) if A[i, c]), None)\n if p is None: continue\n A[[r, p]] = A[[p, r]]\n for i in range(m):\n if i != r and A[i, c]: A[i] ^= A[r]\n piv.append(c); r += 1\n if r == m: break\n free = [c for c in range(n) if c not in piv]\n basis = []\n for f in free:\n v = np.zeros(n, dtype=np.uint8); v[f] = 1\n for i, c in enumerate(piv):\n if A[i, f]: v[c] = 1\n basis.append(v)\n return basis\nns = nullspace_f2(A)\nWproj = [tuple(int(b) for b in v[:N]) for v in ns]\ndimW = rank(Wproj)\nlog(\" dim W = dim{m in F_2^28 : g m - m in <1>+V for all 63 transvections g} =\", dimW)\ncheck(dimW == 7, \"(M/V)^G = W/U = 0: the global kernel is 0, so delta is injective on J(Q)/2J(Q)\")\n# J[2]^G\nfixed = [T for T in nz if all(transv(v)(T) == T for v in nz)]\ncheck(fixed == [], \"J[2]^G = 0\")\nlog(\"s03 done\")\n" }, { "path": "anc/code/1.3.7/s04_sunits.py", "size_bytes": 3985, "sha256": "bb960b30a11766bb27d851c7129f440749dfb4e0be4f3fc9005b78ef0d348b1b", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# s04: the 29 printed generators -1, u_1..u_15, pi_1..pi_13 (paper, App. C.2).\n# - u_i are units (integral, norm +-1); pi_j are S-units (integral, ideal factorisation supported on S);\n# - printed norms agree;\n# - the 29 elements are independent in K^x/K^x2 (quadratic characters at degree-1 primes);\n# - hence (Dirichlet: rank O_{K,S}^x = r1+r2-1+#S = 28, torsion {+-1}) they form an F_2-basis of\n# O_{K,S}^x / squares, which is K(2,S) once Cl(K)[2] = 0 (s05).\n# Output: data/ks2_basis.json (the basis as PARI strings) for later scripts.\nimport json, os\nfrom t62lib import pari, log, check, load_field, DATA\n\ng, nf = load_field()\nd = json.load(open(os.path.join(DATA, \"paper_C2.json\")))\nnames = [b[0].replace('π', 'pi') for b in d['basis']]\nelts = [pari(b[1].replace(' ', '')) for b in d['basis']]\nnorms_printed = [int(b[2]) for b in d['basis']]\nS = [P for p in (2, 11, 41269) for P in pari.idealprimedec(nf, p)]\nSidx = {(int(P[0]), str(P)): i for i, P in enumerate(S)}\n\nfor nm, x, Np in zip(names, elts, norms_printed):\n xb = pari.nfalgtobasis(nf, x)\n integral = all(pari.denominator(c) == 1 for c in xb)\n N = int(pari.nfeltnorm(nf, x))\n if nm == '-1':\n check(integral and N == 1, \"-1: norm 1\")\n continue\n if nm.startswith('u_'):\n check(integral and abs(N) == 1 and N == Np, \"%s is a unit, norm %d (printed %d)\" % (nm, N, Np))\n else:\n fa = pari.idealfactor(nf, x)\n primes = [fa[0][i] for i in range(len(fa[0]))]\n exps = [int(fa[1][i]) for i in range(len(fa[0]))]\n inS = all(int(P[0]) in (2, 11, 41269) for P in primes)\n desc = \", \".join(\"P(%d;e=%d,f=%d)^%d\" % (int(P[0]), int(P[2]), int(P[3]), e) for P, e in zip(primes, exps))\n check(integral and inS and N == Np, \"%s is an S-unit: (%s) = %s; norm %d (printed %d)\" % (nm, nm, desc, N, Np))\n\n# the 13 ideals (pi_j) are pairwise distinct, hence they are the 13 primes of S\ngens = [pari.idealhnf(nf, x) for nm, x in zip(names, elts) if nm.startswith('pi_')]\ncheck(len(set(str(h) for h in gens)) == 13 and len(S) == 13, \"the ideals (pi_1),...,(pi_13) are pairwise distinct: they are the 13 primes of S\")\n\n# ---------------------------------------------------------------- independence mod squares\n# characters at degree-1 primes (q, w - r): x -> Legendre(x(r) mod q), for q not dividing the\n# denominators of the 29 elements, not in {2, 11, 41269}, q not dividing disc(g)\nden = 1\nfor x in elts:\n den = pari.lcm(den, pari.denominator(pari.content(x)))\ndiscg = pari.poldisc(g)\nrows = []\nchars_used = []\nfor q in pari.primes([3, 4000]):\n q = int(q)\n if q in (11, 41269) or den % q == 0 or discg % q == 0:\n continue\n for r in pari.polrootsmod(g, q):\n r = int(pari.lift(r))\n row = []\n ok = True\n for x in elts:\n xv = pari.subst(x, 'w', pari.Mod(r, q))\n if xv == 0:\n ok = False; break\n row.append(0 if pari.kronecker(int(pari.lift(xv)), q) == 1 else 1)\n if ok:\n rows.append(row); chars_used.append((q, r))\nlog(\" %d degree-1 characters computed\" % len(rows))\ndef rank_f2(rows, ncols):\n M = [int(''.join(map(str, r)), 2) for r in rows]\n basis = []\n for v in M:\n for b in basis:\n v = min(v, v ^ b)\n if v: basis.append(v)\n return len(basis)\nrk = rank_f2(rows, len(elts))\ncheck(rk == 29, \"the 29 elements are independent in K^x/K^x2 (character matrix of rank %d)\" % rk)\nlog(\" => they form an F_2-basis of O_{K,S}^x/O_{K,S}^x2 (dimension 1 + 15 + 13 = 29)\")\n\n# smallest set of characters with full rank (to record a compact certificate)\nsel = []\ncur = []\nfor i, row in enumerate(rows):\n if rank_f2(cur + [row], 29) > len(cur):\n cur.append(row); sel.append(chars_used[i])\n if len(cur) == 29: break\nlog(\" 29 characters suffice:\", sel)\njson.dump({\"names\": names, \"elements\": [str(x) for x in elts], \"characters\": sel},\n open(os.path.join(DATA, \"ks2_basis.json\"), \"w\"))\nlog(\"s04 done\")\n" }, { "path": "anc/code/1.3.7/s05a_principal_witnesses.py", "size_bytes": 2576, "sha256": "060f9692e2ed7539356a7b50d0bbb2abfed8130e9ecd84d90dd8e093889bd6b6", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# s05a: for every prime ideal P of K with N(P) < e^13 (i.e. N(P) <= 442413), find a generator g of P.\n# bnfinit (GRH) is used ONLY to propose g; acceptance is exact and done again by s05b:\n# g in O_K, v_P(g) >= 1 and |N(g)| = N(P) ==> (g) = P.\n# Usage: s05a_principal_witnesses.py LO HI OUTFILE (rational primes LO <= p < HI); resumable by chunks.\n# Storage: each generator is written as its integer coordinates on the FIXED basis data/zk.txt (the integral\n# basis that PARI 2.17.4's nfinit returns for g; other PARI versions return other bases, so the coordinates\n# are converted to data/zk.txt here and decoded through data/zk.txt by the checker).\nimport sys, gzip, json, time\nimport os\nfrom t62lib import pari, log, load_field, DATA\n\nLO, HI, OUT = int(sys.argv[1]), int(sys.argv[2]), sys.argv[3]\nBOUND = 442413 # floor(e^13); e^13 = 442413.39...\ng, nf = load_field()\nZK = pari(open(os.path.join(DATA, \"zk.txt\")).read().strip())\nMZK = pari.matrix(28, 28, [pari.polcoeff(ZK[j], i, 'w') for i in range(28) for j in range(28)])\nMZKinv = pari.matsolve(MZK, pari.matid(28))\ndef coords_on_zk(x):\n v = pari.Col([pari.polcoeff(pari.lift(pari.Mod(x, g)), i, 'w') for i in range(28)])\n c = MZKinv * v\n assert all(ci.type() == 't_INT' for ci in c)\n return c\nt0 = time.time()\nbnf = pari.bnfinit(nf, 1) # proposer only\nlog(\"bnfinit (proposer) done in %.1f s; class group proposed:\" % (time.time() - t0), pari.member_cyc(bnf) if hasattr(pari, 'member_cyc') else bnf[7][0][1])\nn_id = 0\nt1 = time.time()\nwith gzip.open(OUT, \"wt\") as fo:\n for p in pari.primes([LO, HI - 1]):\n p = int(p)\n for P in pari.idealprimedec(nf, p):\n f = int(P[3])\n q = p ** f\n if q > BOUND:\n continue\n r = pari.bnfisprincipal(bnf, P, 1)\n gen = r[1]\n if gen.type() == 't_MAT':\n gen = pari.nffactorback(nf, gen)\n gen = pari.nfbasistoalg(nf, pari.nfalgtobasis(nf, gen)) # as an element of K\n # quick self-test (the real check is s05b)\n assert all(int(c) == 0 for c in r[0])\n assert abs(int(pari.nfeltnorm(nf, gen))) == q and int(pari.nfeltval(nf, gen, P)) == 1\n fo.write(json.dumps([p, f, [str(c) for c in coords_on_zk(gen)]]) + \"\\n\")\n n_id += 1\n if p % 20000 < 2 and p > 2:\n log(\" p ~ %d: %d ideals, %.0f s\" % (p, n_id, time.time() - t1))\nlog(\"RANGE %d %d: %d prime ideals of norm <= %d with proposed generators, %.1f s\" % (LO, HI, n_id, BOUND, time.time() - t1))\n" }, { "path": "anc/code/1.3.7/s05b_check_classgroup.py", "size_bytes": 5384, "sha256": "fb4ad14e50011c2e07e4f154a347559c608c0af5a8e8572bcb832f2211de9db0", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# s05b: GRH-free proof that h_K is odd (Cl(K)[2] = 0) for the degree-28 field K.\n# (1) a(q): number of prime ideals of norm q, for all q <= 442413 = floor(e^13), counted by\n# Dedekind-Kummer (factorisation of g mod p, p not dividing the index [O_K:Z[w]]) and, for the\n# few p dividing the index, by idealprimedec; cross-checked against idealprimedec for all p.\n# (2) exact check of the witness files of s05a (integer coordinates on the fixed basis data/zk.txt, decoded\n# through that file, so the check does not depend on the integral basis of the running PARI version):\n# every witness g is in O_K (integral coordinates on the running nf's own certified basis),\n# |N(g)| = N(P) and\n# v_P(g) >= 1 for a prime P of that norm, so (g) = P; the witnesses match the prime ideals of norm\n# <= 442413 one-to-one. Hence k(q) = a(q) for all q < e^13.\n# (3) B_0(13) for the triangle window f(x) = (1-|x|/13)_+ in ball arithmetic (python-flint arb):\n# B_0 = gamma + log(4 pi) + r1/n - log|d_K|/n - pi^2/(4T) - 2 (r1/n) log 2 / T\n# + (4/n) sum_{P, m : N(P)^m < e^T} log N(P) / (N(P)^m + 1) * (1 - m log N(P) / T)\n# which is <= B^-(f) of Theorem B (the dropped exponential terms are >= 0). B_0 > 0 => Cl(K)[2] = 0.\n# Usage: s05b_check_classgroup.py WITNESS_FILES...\nimport sys, gzip, json, time, glob\nimport flint\nfrom flint import arb, nmod_poly\nfrom t62lib import pari, log, check, load_field, DATA\nimport os, hashlib\n\nBOUND = 442413\nT = 13\ng, nf = load_field()\nn = 28\nr1 = int(nf[1][0])\nD = abs(int(nf[2]))\nindex = int(nf[3])\nlog(\"index [O_K : Z[w]] =\", pari.factor(index) if index > 1 else 1)\ncoeffs = [int(c) for c in pari.Vecrev(g)]\nzks = open(os.path.join(DATA, \"zk.txt\")).read()\nlog(\"data/zk.txt SHA-256\", hashlib.sha256(zks.encode()).hexdigest())\nZK = pari(zks.strip())\n\n# ---------------------------------------------------------------- (1) prime ideal counts\nt0 = time.time()\ncounts = {} # q -> a(q)\nby_p = {} # p -> sorted list of f with p^f <= BOUND (Dedekind-Kummer or idealprimedec)\nfor p in pari.primes([2, BOUND]):\n p = int(p)\n if index % p == 0 or p < 30:\n fs = [int(P[3]) for P in pari.idealprimedec(nf, p)]\n else:\n fac = nmod_poly(coeffs, p).factor()[1]\n if any(e > 1 for _, e in fac): # p | disc(g): use idealprimedec\n fs = [int(P[3]) for P in pari.idealprimedec(nf, p)]\n else:\n fs = [h.degree() for h, e in fac]\n fs = sorted(f for f in fs if p ** f <= BOUND)\n if fs:\n by_p[p] = fs\n for f in fs:\n counts[p ** f] = counts.get(p ** f, 0) + 1\nnP = sum(counts.values())\nlog(\"prime ideals of norm <= %d: %d (%.1f s)\" % (BOUND, nP, time.time() - t0))\n\n# ---------------------------------------------------------------- (2) witnesses\nfiles = sorted(sys.argv[1:])\nt0 = time.time()\nwit = {}\nfor fn in files:\n with gzip.open(fn, \"rt\") as fi:\n for line in fi:\n p, f, gen = json.loads(line)\n wit.setdefault(p, []).append((f, gen))\ncheck(sorted(wit) == sorted(by_p), \"witnesses are given for exactly the rational primes below primes of norm <= %d\" % BOUND)\nnok = 0\nfor p in sorted(by_p):\n dec = [P for P in pari.idealprimedec(nf, p) if p ** int(P[3]) <= BOUND]\n check_fs = sorted(int(P[3]) for P in dec)\n if check_fs != by_p[p]:\n log(\"FAIL: count mismatch at p =\", p, check_fs, by_p[p]); sys.exit(1)\n used = [False] * len(dec)\n if len(wit[p]) != len(dec):\n log(\"FAIL: number of witnesses at p =\", p); sys.exit(1)\n for f, gen in wit[p]:\n x = sum(int(c) * ZK[i] for i, c in enumerate(gen)) # decode through data/zk.txt: an element of K\n if not all(c.type() == 't_INT' for c in pari.nfalgtobasis(nf, x)):\n log(\"FAIL: non-integral witness at p =\", p); sys.exit(1)\n q = p ** f\n if abs(int(pari.nfeltnorm(nf, x))) != q:\n log(\"FAIL: norm of witness at p =\", p); sys.exit(1)\n hit = [i for i, P in enumerate(dec) if int(P[3]) == f and not used[i] and int(pari.nfeltval(nf, x, P)) >= 1]\n if len(hit) != 1:\n log(\"FAIL: witness does not match a unique unused prime at p =\", p); sys.exit(1)\n used[hit[0]] = True\n nok += 1\n if not all(used):\n log(\"FAIL: a prime above p =\", p, \"has no witness\"); sys.exit(1)\ncheck(nok == nP, \"all %d prime ideals of norm < e^13 are principal (exact check of %d generators, %.0f s)\" % (nP, nok, time.time() - t0))\n\n# ---------------------------------------------------------------- (3) B_0 in ball arithmetic\nflint.ctx.prec = 256\nTa = arb(T)\nalpha = arb(r1) / n\nlogD = arb(D).log()\nB = arb.const_euler() + (4 * arb.pi()).log() + alpha - logD / n - arb.pi() ** 2 / (4 * Ta) - 2 * alpha * arb(2).log() / Ta\nS = arb(0)\nterms = 0\nfor q, a in counts.items():\n lq = arb(q).log()\n m = 1\n while q ** m <= BOUND: # q^m < e^13 <=> q^m <= 442413 (integers)\n S += a * lq / (arb(q) ** m + 1) * (1 - m * lq / Ta)\n terms += 1\n m += 1\nB0 = B + 4 * S / n\nlog(\"prime-power terms: %d distinct pairs (N(P), m); %d pairs (P, m)\" % (terms, sum(a * sum(1 for m in range(1, 40) if q ** m <= BOUND) for q, a in counts.items())))\nlog(\"archimedean+discriminant part:\", B.str(20))\nlog(\"B_0(13) =\", B0.str(30))\ncheck(B0 > 0, \"B_0(13) > 0 (rigorous ball arithmetic), hence Cl(K)[2] = 0 by Theorem B; h_K is odd\")\n" }, { "path": "anc/code/1.3.7/s05c_check_witnesses.gp", "size_bytes": 2366, "sha256": "77df56cfe0f3d2f31c54fec2ff030c77d33ed8314789ce13333331fd87376a10", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ s05c: the exact principality check of s05b, written in GP, for PARI/GP 2.15.x and later.\n\\\\ Usage (from code/): python3 wit2gp.py /tmp/wit.gp data/witnesses/wit_*.jsonl.gz\n\\\\ echo 'WIT=\"/tmp/wit.gp\"; read(\"s05c_check_witnesses.gp\")' | gp -q -s 400000000 -D parisizemax=2000000000\n\\\\ The witnesses are integer coordinates on the fixed basis data/zk.txt and are decoded through it, so the\n\\\\ check does not depend on the integral basis that this PARI version's nfinit returns.\n\\\\ (set the stack on the command line: gp -s 400000000 -D parisizemax=2000000000)\nif(type(WIT) != \"t_STR\", WIT = \"/tmp/wit.gp\");\nBOUND = 442413; \\\\ floor(e^13)\ng = read(\"data/g.txt\"); zk = read(\"data/zk.txt\");\nnf = nfinit([g, factor(poldisc(g))[,1]~]);\nif(nfcertify(nf) != [], error(\"maximal order not certified\"));\nprint(\"PARI \", version(), \"; nf.zk == data/zk.txt: \", nf.zk == zk, \"; d_K = \", factor(nf.disc), \"; signature \", nf.sign);\nW = read(WIT);\nprint(\"witnesses read: \", #W);\n{\n my(t0 = getabstime(), k = 1, nP = 0, ok = 0, S = 0., terms = 0);\n forprime(p = 2, BOUND,\n my(dec = select(P -> p^P.f <= BOUND, idealprimedec(nf, p)), used = vector(#dec));\n if(#dec == 0, next);\n nP += #dec;\n for(j = 1, #dec,\n if(k > #W || W[k][1] != p, error(Str(\"missing witness at p = \", p)));\n my(f = W[k][2], x = sum(i = 1, 28, W[k][3][i] * zk[i]), hit = 0);\n if(denominator(nfalgtobasis(nf, x)) != 1, error(Str(\"non-integral witness at p = \", p)));\n if(abs(nfeltnorm(nf, x)) != p^f, error(Str(\"wrong norm at p = \", p)));\n for(i = 1, #dec, if(!used[i] && dec[i].f == f && nfeltval(nf, x, dec[i]) >= 1, if(hit, error(\"not unique\")); hit = i));\n if(!hit, error(Str(\"no matching prime at p = \", p)));\n used[hit] = 1; ok++; k++);\n for(i = 1, #dec, my(q = p^dec[i].f, m = 1);\n while(q^m <= BOUND, S += log(q) / (q^m + 1) * (1 - m * log(q) / 13); terms++; m++)));\n if(k != #W + 1, error(\"unused witnesses\"));\n print(\"ALL \", nP, \" prime ideals of norm <= \", BOUND, \" matched one-to-one to exact generators (\", ok, \" checked, \",\n round((getabstime() - t0) / 1000), \" s)\");\n my(n = 28, a = 4/28., D = abs(nf.disc));\n print(\"B_0(13) (floating point, cross-check of the ball-arithmetic value) = \",\n Euler + log(4*Pi) + a - log(D)/n - Pi^2/52 - 2*a*log(2)/13 + 4*S/n, \" [\", terms, \" pairs (P, m)]\");\n}\nquit;\n" }, { "path": "anc/code/1.3.7/s06_local2.py", "size_bytes": 6066, "sha256": "405ac4b1da8128766f239f651ed296f69436eb1543d4e057cbe7ddfe1e068f4b", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# s06: the local image at 2.\n# - an explicit isomorphism loc_2 : (K (x) Q_2)^x / squares -> F_2^36 (36 = sum over P|2 of 2 + e f),\n# via valuations and discrete logarithms in (O_K / P^(2e+1))^x (u in O_P^x is a square iff it is a\n# square mod P^(2e+1));\n# - classes delta_2([Q - P1]) = l(Q) a (mod squares and Q_2^x) for points Q = (x0 : y0 : 1) in C(Q_2),\n# y0 obtained by Hensel's lemma with a proved precision; every class is used only when the precision\n# provably determines it;\n# - they span a space W_2 of dimension 4 modulo the image of Q_2^x; dim J(Q_2)/2J(Q_2) <= 3 + 1 = 4\n# (s03 + local degrees 4,6,6,12 from s02), so W_2 is the full local image;\n# - the paper's four points give the same W_2.\n# Output: data/local2.json (the 36-bit vectors of a basis of W_2 and of -1, 2, 5).\nimport json, os\nfrom t62lib import pari, log, check, load_field, load_elt, DATA\n\ng, nf = load_field()\na = load_elt(\"a.txt\"); n = load_elt(\"n.txt\")\nPR = pari.idealprimedec(nf, 2)\nLOC = []\nfor P in PR:\n e, f = int(P[2]), int(P[3])\n pi = P[1]\n assert int(pari.nfeltval(nf, pi, P)) == 1\n bid = pari.idealstar(nf, pari.idealpow(nf, P, 2 * e + 1), 1)\n cyc = [int(c) for c in pari('(b)->b.cyc')(bid)]\n even = [i for i, c in enumerate(cyc) if c % 2 == 0]\n check(len(even) == 1 + e * f, \"P|2 with (e,f)=(%d,%d): (O/P^%d)^x / squares has dimension 1 + ef = %d\" % (e, f, 2 * e + 1, 1 + e * f))\n LOC.append((P, e, f, pi, bid, even))\nDIM = sum(1 + len(L[5]) for L in LOC)\ncheck(DIM == 36, \"dim (K (x) Q_2)^x / squares = 36\")\n\ndef loc2(x):\n \"\"\"F_2-vector of x in K^x (exact element) in prod_P K_P^x / K_P^x2.\"\"\"\n vec = []\n for P, e, f, pi, bid, even in LOC:\n v = int(pari.nfeltval(nf, x, P))\n u = pari.nfeltmul(nf, x, pari.nfeltpow(nf, pi, -v))\n lg = pari.ideallog(nf, u, bid)\n vec.append(v % 2)\n vec += [int(lg[i]) % 2 for i in even]\n return vec\n\ndef loc2_approx(x, prec_ok):\n \"\"\"same, but x is only known up to an error of P-adic valuation >= prec_ok(P); returns None if the\n precision does not determine the class (need error valuation >= v_P(x) + 2e + 1).\"\"\"\n vec = []\n for k, (P, e, f, pi, bid, even) in enumerate(LOC):\n v = int(pari.nfeltval(nf, x, P))\n if prec_ok[k] < v + 2 * e + 1:\n return None\n return loc2(x)\n\n# F_2 linear algebra helpers\ndef to_int(v): return int(''.join(map(str, v)), 2)\ndef reduce(vint, basis):\n for b in basis:\n vint = min(vint, vint ^ b)\n return vint\ndef span_add(basis, vint):\n r = reduce(vint, basis)\n if r:\n basis.append(r); basis.sort(reverse=True)\n return True\n return False\n\nQ2gens = {c: loc2(pari(c)) for c in (-1, 2, 5)}\nQbasis = []\nfor c in (-1, 2, 5):\n span_add(Qbasis, to_int(Q2gens[c]))\ncheck(len(Qbasis) == 3, \"Q_2^x/Q_2^x2 = <-1,2,5> injects into (K (x) Q_2)^x/squares (dimension 3)\")\n\n# ---------------------------------------------------------------- points of C(Q_2)\nfxy = pari.subst(pari('x^3*z + y^3*x + y^2*z^2 - z^3*y'), 'z', 1)\nNPREC = 80\ndef zp_roots(x0):\n \"\"\"roots y0 in Z_2 of h(Y) = f(x0, Y), with a proved precision: returns list of (Y, N) with\n v_2(y0 - Y) >= N, by Hensel: if v(h(Y)) > 2 v(h'(Y)) there is a unique root y0 with\n v(y0 - Y) >= v(h(Y)) - v(h'(Y)).\"\"\"\n h = pari.subst(pari.subst(fxy, 'x', x0), 'y', 'Y')\n if h == 0 or pari.poldegree(h, 'Y') <= 0:\n return []\n out = []\n for r in pari.polrootspadic(h, 2, NPREC):\n if pari.valuation(r, 2) < 0:\n continue\n Y = int(pari.truncate(r)) # an integer approximation\n hv = pari.subst(h, 'Y', Y); dv = pari.subst(pari.deriv(h, 'Y'), 'Y', Y)\n if hv == 0:\n out.append((Y, 10**6)); continue\n if dv == 0: continue\n vh, vd = int(pari.valuation(hv, 2)), int(pari.valuation(dv, 2))\n if vh > 2 * vd:\n out.append((Y, vh - vd))\n return out\n\nW = [] # basis (ints) of the span of the point classes together with Q_2^x\nW += Qbasis[:]\nW.sort(reverse=True)\nused = []\nnpts = 0\nfor x0 in list(range(-40, 41)):\n for Y, N in zp_roots(x0):\n npts += 1\n val = (pari(Y) - a * x0 - n) * a # l(Q) * a for Q = (x0 : Y : 1), approximately\n val = pari.Mod(val, g).lift()\n prec_ok = [N * e for (P, e, f, pi, bid, even) in LOC] # error = (y0 - Y) * a, a a unit\n vec = loc2_approx(val, prec_ok)\n if vec is None:\n continue\n if span_add(W, to_int(vec)):\n used.append((x0, Y % 2 ** N, N))\ndimW2 = len(W) - 3\nlog(\" %d points of C(Q_2) with x0 in [-40,40] examined\" % npts)\nfor u in used:\n log(\" point (x0, y0 mod 2^%d) = (%d, %d) adds a new class\" % (u[2], u[0], u[1]))\ncheck(dimW2 == 4, \"the classes l(Q) a of these points span a space W_2 of dimension 4 modulo Q_2^x\")\nlog(\" dim J(Q_2)/2J(Q_2) = dim J(Q_2)[2] + g = dim J(Q_2)[2] + 3 <= 4 (orbits 4,6,6,12; s03)\")\nlog(\" => W_2 is exactly the image of J(Q_2)/2J(Q_2)\")\n\n# the paper's points\nd = json.load(open(os.path.join(DATA, \"paper_C2.json\")))\nWp = Qbasis[:]\nfor xs, ys in d['points2']:\n x0, Y = int(xs), int(ys)\n h = pari.subst(pari.subst(fxy, 'x', x0), 'y', 'Y')\n hv = pari.subst(h, 'Y', Y); dv = pari.subst(pari.deriv(h, 'Y'), 'Y', Y)\n vh, vd = int(pari.valuation(hv, 2)), int(pari.valuation(dv, 2))\n assert vh > 2 * vd\n N = vh - vd\n val = pari.Mod((pari(Y) - a * x0 - n) * a, g).lift()\n vec = loc2_approx(val, [N * e for (P, e, f, pi, bid, even) in LOC])\n check(vec is not None, \"paper point (%d, %d mod 2^60): a 2-adic point, precision 2^%d suffices\" % (x0, Y, N))\n span_add(Wp, to_int(vec))\nsame = len(Wp) == 7 and all(reduce(b, sorted(W, reverse=True)) == 0 for b in Wp)\ncheck(same, \"the paper's four points span the same W_2 (dimension 4 mod Q_2^x)\")\n\njson.dump({\"W2_plus_Q2\": [format(b, '036b') for b in sorted(W, reverse=True)],\n \"Q2\": {str(c): ''.join(map(str, Q2gens[c])) for c in Q2gens},\n \"points_used\": used}, open(os.path.join(DATA, \"local2.json\"), \"w\"), indent=0)\nlog(\"s06 done\")\n" }, { "path": "anc/code/1.3.7/s08_selmer.py", "size_bytes": 10001, "sha256": "4024fede0709e954541de3f71657b1530e4aa51b63559d6948f1e4dd7e8f13a6", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# s08: the fake 2-Selmer group.\n# K(2,S) has the F_2-basis b_1..b_29 = -1, u_1..u_15, pi_1..pi_13 (s04; uses Cl(K)[2] = 0 from s05).\n# Conditions on kappa in K(2,S) (all linear):\n# (N) N_{K/Q}(kappa) in Q^x2;\n# (11), (41269) (v_P(kappa) mod 2)_{P|p} lies in {0, (e_P mod 2)_{P|p}} [Lemma 2.1, c_p = 1];\n# (2) loc_2(kappa) in W_2 + loc_2(Q_2^x) [s06];\n# (oo) kappa has the same sign at the 4 real embeddings [s07].\n# Q(2,S) = <-1, 2, 11, 41269> lies in the solution space V and has dimension 4 there (no quadratic\n# subfield). Result: dim V = 5, Sel_fake = V / Q(2,S) has dimension 1 and is spanned by [a] = delta(G).\n# The conditions (2) and (11) alone already give dim V = 5; (N), (41269) and (oo) are not needed.\nimport json, os\nimport flint\nfrom flint import arb\nfrom t62lib import pari, log, check, load_field, load_elt, DATA\n\ng, nf = load_field()\na = load_elt(\"a.txt\"); n = load_elt(\"n.txt\")\nB = json.load(open(os.path.join(DATA, \"ks2_basis.json\")))\nnames = B[\"names\"]\nelts = [pari(e) for e in B[\"elements\"]]\nchars = B[\"characters\"]\nL2 = json.load(open(os.path.join(DATA, \"local2.json\")))\nNB = len(elts)\n\n# ---------------------------------------------------------------- F_2 helpers (vectors as lists)\ndef rref(rows, ncols):\n rows = [r[:] for r in rows]\n piv = []; r = 0\n for c in range(ncols):\n p = next((i for i in range(r, len(rows)) if rows[i][c]), None)\n if p is None: continue\n rows[r], rows[p] = rows[p], rows[r]\n for i in range(len(rows)):\n if i != r and rows[i][c]:\n rows[i] = [(x + y) % 2 for x, y in zip(rows[i], rows[r])]\n piv.append(c); r += 1\n return rows[:r], piv\ndef rank(rows, ncols): return len(rref(rows, ncols)[0]) if rows else 0\ndef solve(A_rows, b):\n \"\"\"solve x A = b over F_2, A given by rows (each row = image of a basis vector); returns x or None\"\"\"\n m = len(A_rows); ncols = len(b)\n aug = [A_rows[i] + [1 if j == i else 0 for j in range(m)] for i in range(m)]\n # find combination: row-reduce [A | I] and express b\n R, piv = rref(aug, ncols + m)\n vec = b[:] + [0] * m\n for row, c in zip(R, piv):\n if c >= ncols: break\n if vec[c]:\n vec = [(x + y) % 2 for x, y in zip(vec, row)]\n if any(vec[:ncols]): return None\n return vec[ncols:]\ndef nullspace(cols_rows, nvars):\n \"\"\"rows = linear functionals (each a list of length nvars); returns basis of common kernel\"\"\"\n if not cols_rows: return [[1 if i == j else 0 for i in range(nvars)] for j in range(nvars)]\n R, piv = rref(cols_rows, nvars)\n free = [c for c in range(nvars) if c not in piv]\n basis = []\n for f in free:\n v = [0] * nvars; v[f] = 1\n for row, c in zip(R, piv):\n if row[f]: v[c] = 1\n basis.append(v)\n return basis\n\n# ---------------------------------------------------------------- coordinates via characters\ndef charvec(x):\n out = []\n for q, r in chars:\n xv = pari.subst(x, 'w', pari.Mod(r, q))\n assert xv != 0\n out.append(0 if pari.kronecker(int(pari.lift(xv)), q) == 1 else 1)\n return out\nCH = [charvec(x) for x in elts]\ncheck(rank(CH, len(chars)) == NB, \"the 29 recorded characters separate K(2,S) (29 x 29 matrix of full rank)\")\ndef coords(x):\n c = solve(CH, charvec(x))\n assert c is not None\n return c\n\n# ---------------------------------------------------------------- the linear conditions\nconds = [] # list of (name, list of functionals as length-29 vectors)\n# (N) norm\ndef normvec(x):\n N = pari.nfeltnorm(nf, x)\n v = [1 if N < 0 else 0] + [int(pari.valuation(N, p)) % 2 for p in (2, 11, 41269)]\n rest = abs(N) / (2 ** int(pari.valuation(N, 2)) * 11 ** int(pari.valuation(N, 11)) * 41269 ** int(pari.valuation(N, 41269)))\n assert rest == 1\n return v\nNV = [normvec(x) for x in elts]\nconds.append((\"norm\", [[NV[i][k] for i in range(NB)] for k in range(4)]))\n# (11), (41269)\nfor p in (11, 41269):\n dec = pari.idealprimedec(nf, p)\n e = [int(P[2]) % 2 for P in dec]\n V = [[int(pari.nfeltval(nf, x, P)) % 2 for P in dec] for x in elts]\n # condition: v in span{e}: choose functionals annihilating e: for coordinates with e_j = 0: v_j = 0;\n # for pairs of coordinates with e_j = e_k = 1: v_j + v_k = 0\n funcs = []\n ones = [j for j in range(len(dec)) if e[j] == 1]\n for j in range(len(dec)):\n if e[j] == 0:\n funcs.append([V[i][j] for i in range(NB)])\n for j in ones[1:]:\n funcs.append([(V[i][j] + V[i][ones[0]]) % 2 for i in range(NB)])\n conds.append((\"p=%d (e mod 2 = %s)\" % (p, e), funcs))\n# (2): loc_2(kappa) in W2 + Q2 ; use a complement: functionals vanishing on W2+Q2\nimport importlib.util, sys\nspec = importlib.util.spec_from_file_location(\"s06\", os.path.join(os.path.dirname(__file__), \"s06_local2.py\"))\n# recompute loc_2 here (same code as s06, without its point search): import the function definitions only\nsrc = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), \"s06_local2.py\")).read()\nsrc = src[:src.index(\"# F_2 linear algebra helpers\")]\nns = {}\nimport io, contextlib\nwith contextlib.redirect_stdout(io.StringIO()):\n exec(compile(src, \"s06_local2_defs\", \"exec\"), ns)\nloc2 = ns[\"loc2\"]\nW2Q2 = [[int(ch) for ch in s] for s in L2[\"W2_plus_Q2\"]]\ncheck(rank(W2Q2, 36) == 7, \"W_2 + loc_2(Q_2^x) has dimension 7 in F_2^36\")\nLV = [loc2(x) for x in elts]\nperp = nullspace(W2Q2, 36) # functionals phi on F_2^36 with phi(W2+Q2) = 0 (dim 29)\ncheck(len(perp) == 29, \"codimension of W_2 + Q_2 is 29\")\nconds.append((\"p=2\", [[sum(phi[k] * LV[i][k] for k in range(36)) % 2 for i in range(NB)] for phi in perp]))\n# (oo): signs at the 4 real embeddings.\n# The real roots of g are isolated rigorously: exact real-root counts (PARI polsturm, Uspensky/Descartes, and\n# sympy's Sturm sequences, both exact for integer polynomials and rational endpoints) show that g has exactly\n# 4 real roots and exactly one in each of 4 pairwise disjoint intervals [lo_i, hi_i] with rational endpoints\n# (width 2*10^-100, centred at rational approximations of the numerical roots). The sign of an element at\n# the i-th real place is then evaluated in ball arithmetic on a ball containing [lo_i, hi_i]; it is accepted\n# only if the resulting ball does not contain 0.\nimport sympy\nflint.ctx.prec = 400\npari.default(\"realprecision\", 120)\ncheck(int(pari.polsturm(g)) == 4, \"g has 4 real roots (r1 = 4)\")\ngsym = sympy.Poly([int(c) for c in pari.Vec(g)], sympy.Symbol('w'))\ncheck(gsym.count_roots() == 4, \"Sturm: g has exactly 4 real roots (sympy count_roots, exact)\")\nRAD = pari(\"1/10^100\")\nISO = [] # [(lo, hi)] as exact PARI fractions\nfor r in pari.polrootsreal(g, precision=512): # numerical roots to about 150 digits (only used to place the intervals)\n c = pari.round(r * 10**110) / pari(\"10^110\")\n ISO.append((c - RAD, c + RAD))\ncheck(all(ISO[i][1] < ISO[i + 1][0] for i in range(len(ISO) - 1)), \"the 4 isolating intervals [lo_i, hi_i] (rational endpoints, width 2e-100) are pairwise disjoint\")\ncheck(all(int(pari.polsturm(g, [lo, hi])) == 1 for lo, hi in ISO),\n \"exact count (PARI polsturm, rational endpoints): exactly one real root of g in each interval\")\ncheck(all(gsym.count_roots(sympy.Rational(str(lo)), sympy.Rational(str(hi))) == 1 for lo, hi in ISO),\n \"exact count (Sturm sequence, sympy): exactly one real root of g in each interval\")\ndef fq(x): return flint.fmpq(int(pari.numerator(x)), int(pari.denominator(x)))\nBALLS = [arb(fq(lo)).union(arb(fq(hi))) for lo, hi in ISO] # each ball contains [lo, hi]\ncheck(all(b.contains(arb(fq(lo))) and b.contains(arb(fq(hi))) and b.rad() < arb(\"1e-99\") for b, (lo, hi) in zip(BALLS, ISO)),\n \"ball arithmetic: each real root is contained in an arb ball of radius < 1e-99\")\ndef sign_at(x, ra):\n p = x\n cfs = pari.Vecrev(p) if p.type() == 't_POL' else [p]\n acc = arb(0)\n for cf in reversed(list(cfs)):\n acc = acc * ra + arb(flint.fmpq(int(pari.numerator(cf)), int(pari.denominator(cf))))\n assert acc > 0 or acc < 0, \"sign undecided\"\n return 0 if acc > 0 else 1\nSG = [[sign_at(x, b) for b in BALLS] for x in elts]\ncheck(len(SG) == NB, \"signs of the %d basis elements at the 4 real places decided rigorously (no ball contains 0)\" % NB)\nconds.append((\"real\", [[(SG[i][0] + SG[i][j]) % 2 for i in range(NB)] for j in (1, 2, 3)]))\n\n# ---------------------------------------------------------------- the Selmer space\nallf = [f for _, fs in conds for f in fs]\nV = nullspace(allf, NB)\nlog(\" dim of {kappa in K(2,S) satisfying all conditions} =\", len(V))\nQc = [coords(pari(c)) for c in (-1, 2, 11, 41269)]\ncheck(rank(Qc, NB) == 4, \"Q(2,S) = <-1,2,11,41269> has dimension 4 in K(2,S)\")\ncheck(all(all(sum(f[i] * q[i] for i in range(NB)) % 2 == 0 for f in allf) for q in Qc), \"Q(2,S) satisfies all conditions\")\ndimSel = len(V) - 4\ncheck(dimSel == 1, \"dim Sel_fake = dim V - dim Q(2,S) = %d\" % dimSel)\nac = coords(a)\ncheck(all(sum(f[i] * ac[i] for i in range(NB)) % 2 == 0 for f in allf), \"[a] = delta(G) satisfies all conditions\")\ncheck(rank(Qc + [ac], NB) == 5, \"[a] is not in Q(2,S): delta(G) != 0, and Sel_fake = <[a]>\")\nlog(\" => rank J(Q) <= 1; G = [P3 - P1] has infinite order (J(Q) torsion-free, G != 0), so rank J(Q) = 1\")\n# consistency checks of delta on the known points\ncheck(len(pari.nfroots(nf, pari('X^2') - pari.lift(pari.Mod((1 - n) * a, g)))) == 2,\n \"(1 - n) a is a square, so delta([P4 - P1]) = [-(1-n) a] = 0, consistent with [P4-P1] = -4G\")\n# which conditions are needed?\nfor skip in range(len(conds)):\n fs = [f for k, (_, ff) in enumerate(conds) if k != skip for f in ff]\n log(\" without condition %-28s: dim Sel would be %d\" % (conds[skip][0], len(nullspace(fs, NB)) - 4))\nfs = [f for (name, ff) in conds if name == \"p=2\" or name.startswith(\"p=11 \") for f in ff]\nlog(\" with the conditions p=2 and p=11 only : dim Sel would be %d\" % (len(nullspace(fs, NB)) - 4))\nlog(\"s08 done\")\n" }, { "path": "anc/code/1.3.7/s09_chabauty.py", "size_bytes": 14913, "sha256": "f4c3b4596c4d1569cb4c99cbc29e23b7b56ecdbb1ee737d193d2f7e3ee79e37f", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# s09: Chabauty-Coleman at p (default p = 3; p = 5 is the control run of s10).\n# 1. local parameters at P1..P4 with integral expansions; the holomorphic differentials\n# omega_h = h * Omega (h = x, y, z), Omega = (x dy - y dx)/F_z = (y dz - z dy)/F_x = (z dx - x dz)/F_y;\n# 2. Riemann-Roch by linear algebra: the effective divisor E of degree 3 with\n# E ~ P1 + P2 + P3 + M G (M = #J(F_p), G = [P3 - P1]), E = div(Gf) - (base) for a form Gf;\n# 3. E reduces to P1 + P2 + P3 mod p (h^0 = 1); its three points are Q_p-rational, one in each disc;\n# 4. log(M G) = sum of three tiny integrals; checked against log(2 M G) computed independently;\n# 5. annihilating differentials and Strassmann bounds in every residue disc of C(F_p) containing a\n# known point; (p = 3) in the disc of P3 the second zero U* of eta_1 is not a zero of eta_2.\nimport sys, math\nfrom t62lib import pari, log, check, FPOL\n\np = int(sys.argv[1]) if len(sys.argv) > 1 else 3\nNT = 140 if p == 3 else 200 # number of series terms (>= the orders used in Riemann-Roch)\nPREC = 60 # p-adic working precision for algebraic points\nF = FPOL\nFx, Fy, Fz = [pari.deriv(F, v) for v in ('x', 'y', 'z')]\ntt = pari('t')\nO = pari('O(t^%d)' % NT)\n\ndef implicit(eq, var, c0):\n \"\"\"power series var(t) = c0 + ... solving eq(t, var) = 0 by Newton iteration (integral when the\n var-derivative of eq at the point is a unit)\"\"\"\n v = pari(c0) + O\n d = pari.deriv(eq, var)\n for _ in range(12):\n v = v - pari.subst(eq, var, v) / pari.subst(d, var, v)\n assert pari.valuation(pari.subst(eq, var, v), 't') >= NT\n return v\n\n# local charts: name -> (homogeneous coordinates as series in t, w_Omega(t), point)\nLOC = {}\nz1 = implicit(pari.substvec(F, ['x', 'y'], [1, tt]), 'z', 0) # P1 = (1:0:0), t = y/x\nLOC['P1'] = ([pari(1) + O, tt + O, z1], 1 / pari.substvec(Fz, ['x', 'y', 'z'], [1, tt, z1]))\nx2 = implicit(pari.substvec(F, ['y', 'z'], [1, tt]), 'x', 0) # P2 = (0:1:0), t = z/y\nLOC['P2'] = ([x2, pari(1) + O, tt + O], 1 / pari.substvec(Fx, ['x', 'y', 'z'], [x2, 1, tt]))\ny3 = implicit(pari.substvec(F, ['x', 'z'], [tt, 1]), 'y', 0) # P3 = (0:0:1), t = x/z\nLOC['P3'] = ([tt + O, y3, pari(1) + O], 1 / pari.substvec(Fy, ['x', 'y', 'z'], [tt, y3, 1]))\ny4 = implicit(pari.substvec(F, ['x', 'z'], [tt, 1]), 'y', 1) # P4 = (0:1:1), t = x/z\nLOC['P4'] = ([tt + O, y4, pari(1) + O], 1 / pari.substvec(Fy, ['x', 'y', 'z'], [tt, y4, 1]))\nPTS = {'P1': (1, 0, 0), 'P2': (0, 1, 0), 'P3': (0, 0, 1), 'P4': (0, 1, 1)}\nfor k, (xyz, wO) in LOC.items():\n integral = all(pari.denominator(c) == 1 for s in xyz + [wO] for c in pari.Vec(pari.truncate(s)))\n check(integral, \"%s: coordinates and Omega have integral expansions (the relevant partial derivative is 1 or -1 there)\" % k)\n\ndef omega(k, h):\n \"\"\"expansion w(t) of omega_h = h*Omega at the point k\"\"\"\n xyz, wO = LOC[k]\n return pari.substvec(h, ['x', 'y', 'z'], xyz) * wO\nH = [pari('x'), pari('y'), pari('z')]\nW = {k: [omega(k, h) for h in H] for k in LOC}\n\n# ---------------------------------------------------------------- p-adic point counts and discs\ncnt = [(xx, yy, zz) for xx in range(p) for yy in range(p) for zz in range(p) if (xx, yy, zz) != (0, 0, 0)\n and int(pari.substvec(F, ['x', 'y', 'z'], [xx, yy, zz])) % p == 0]\nproj = set()\nfor v in cnt:\n i = next(i for i in range(3) if v[i] % p)\n inv = pow(v[i], -1, p)\n proj.add(tuple(c * inv % p for c in v))\nlog(\"C(F_%d) = %s\" % (p, sorted(proj)))\n\n# ---------------------------------------------------------------- Riemann-Roch: E ~ P1+P2+P3 + M*G\ndef std_monomials(deg):\n \"\"\"monomials x^i y^j z^k of degree deg not divisible by x*y^3 = the leading monomial of F for the\n lex order y > x > z; they form a basis of the degree-deg part of Q[x,y,z]/(F) (4 deg - 2 of them)\"\"\"\n return [(i, j, deg - i - j) for i in range(deg + 1) for j in range(deg + 1 - i) if not (i >= 1 and j >= 3)]\n\ndef order_conditions(deg, conds):\n \"\"\"linear conditions on forms of degree deg (standard monomials): ord_{Pk} >= m for (k, m) in conds\"\"\"\n mons = std_monomials(deg)\n assert len(mons) == 4 * deg - 2\n rows = []\n for k, m in conds:\n xyz, _ = LOC[k]\n pw = [[pari(1) + O] for _ in range(3)]\n for c in range(3):\n for e in range(deg):\n pw[c].append(pw[c][-1] * xyz[c])\n exps = [pari.truncate(pw[0][i] * pw[1][j] * pw[2][kk]) for (i, j, kk) in mons]\n for e in range(m):\n rows.append([pari.polcoeff(s_, e, 't') for s_ in exps])\n return mons, pari.matrix(len(rows), len(mons), [c for r in rows for c in r])\n\ndef effective_divisor(deg, conds, removed):\n \"\"\"the unique (mod F) form Gf of degree deg with the vanishing conditions; returns Gf, the cubic in x\n (chart z = 1) whose roots are the x-coordinates of the remaining 3 points, and y = V(x) mod cubic.\"\"\"\n assert max(m for _, m in conds) < NT\n mons, A = order_conditions(deg, conds)\n K = pari.matker(A)\n check(int(pari.matsize(K)[1]) == 1,\n \" degree-%d forms with %s: a 1-dimensional space modulo F (so h^0 = 1)\" % (deg, conds))\n col = pari('(A,j)->A[,j]')(K, 1)\n Gf = sum(col[r] * pari('x^%d*y^%d*z^%d' % mons[r]) for r in range(len(mons)))\n Gf = Gf / pari.content(Gf)\n # remaining intersection points in the chart z = 1\n f1 = pari.subst(F, 'z', 1); g1 = pari.subst(Gf, 'z', 1)\n R = pari.polresultant(f1, g1, 'y')\n for xpow in range(removed):\n R = R / pari('x')\n fa = pari.factor(R)\n cub = [fa[0][i] for i in range(len(fa[0])) if pari.poldegree(fa[0][i]) == 3]\n check(len(cub) == 1 and int(pari.poldegree(R)) == 3, \" the remaining intersection is cut out by an irreducible cubic in x\")\n cub = cub[0]\n cub = cub / pari.content(cub)\n # y as a function of x mod cub: gcd over Q[x]/cub of f1 and g1 in y (use variable w for the root)\n fw = pari.Mod(1, pari.subst(cub, 'x', 'w')) * pari.subst(f1, 'x', 'w')\n gw = pari.Mod(1, pari.subst(cub, 'x', 'w')) * pari.subst(g1, 'x', 'w')\n Gg = pari.gcd(fw, gw)\n check(int(pari.poldegree(Gg, 'y')) == 1, \" y is a rational function of x on the three points\")\n V = pari.lift(-pari.polcoeff(Gg, 0, 'y') / pari.polcoeff(Gg, 1, 'y'))\n V = pari.subst(V, 'w', 'x')\n check(pari.Mod(pari.subst(f1, 'y', V), cub) == 0, \" F(x, V(x), 1) = 0 mod cubic\")\n return Gf, cub, V\n\n# E for M*G with M = #J(F_p): E ~ P1+P2+P3+M(P3-P1) = P2 + (M+1) P3 - (M-1) P1\nJp = {3: 31, 5: 141}[p]\ndef divisor_for_multiple(M):\n # H = y^a z, div H = (a+3) P1 + 3a P3 + P2, with 3a >= M+1; condition div(Gf) >= (a+3+M-1) P1 + (3a-M-1) P3\n a = -(-(M + 1) // 3)\n deg = a + 1\n conds = [('P1', a + 3 + M - 1)]\n if 3 * a - M - 1 > 0:\n conds.append(('P3', 3 * a - M - 1))\n return effective_divisor(deg, conds, removed=3 * a - M - 1)\n\nGf31, cub, V = divisor_for_multiple(Jp)\nlog(\"E for %dG: x-cubic %s ; y = %s\" % (Jp, cub, V))\n\n# ---------------------------------------------------------------- p-adic points of E and their discs\ndef padic_roots(pol):\n out = []\n for r in pari.polrootspadic(pol, p, PREC):\n r0 = pari.truncate(r) if pari.valuation(r, p) >= 0 else r\n out.append(r)\n return out\nrts = pari.polrootspadic(cub, p, PREC)\ncheck(len(rts) == 3, \"the cubic has 3 roots in Q_%d (the points of E are Q_%d-rational)\" % (p, p))\ndef which_disc(xr, yr):\n \"\"\"reduce (x : y : 1) mod p and return the disc label and the local parameter value\"\"\"\n vx, vy = int(pari.valuation(xr, p)), int(pari.valuation(yr, p))\n m = min(vx, vy, 0)\n X, Y, Z = xr * p ** (-m), yr * p ** (-m), pari(p) ** (-m)\n red = tuple(int(pari.lift(pari.Mod(pari.truncate(c), p))) if pari.valuation(c, p) >= 0 else None for c in (X, Y, Z))\n i = next(i for i in range(3) if red[i] % p)\n inv = pow(red[i], -1, p)\n red = tuple(c * inv % p for c in red)\n lab = [k for k, P in PTS.items() if P == red]\n if not lab: return None, red, None\n k = lab[0]\n tpar = {'P1': Y / X, 'P2': Z / Y, 'P3': X / Z, 'P4': X / Z}[k]\n return k, red, tpar\nEpts = []\nfor xr in rts:\n yr = pari.subst(V, 'x', xr)\n k, red, tpar = which_disc(xr, yr)\n log(\" E point: x = %s..., reduces to %s, disc %s, v(t) = %s\" % (str(pari.truncate(xr))[:20], red, k, pari.valuation(tpar, p) if tpar is not None else None))\n Epts.append((k, tpar))\ncheck(sorted(k for k, _ in Epts) == ['P1', 'P2', 'P3'], \"E reduces to P1 + P2 + P3 (one point in each of these discs)\")\n\ndef tiny(k, wser, tau):\n \"\"\"int_{P_k}^{tau} w(t) dt (series truncated at NT terms; returns value and a guaranteed precision)\"\"\"\n ser = pari.truncate(wser)\n total = pari(0)\n for e in range(NT):\n c = pari.polcoeff(ser, e, 't')\n if c != 0:\n total += c * tau ** (e + 1) / (e + 1)\n vt = int(pari.valuation(tau, p))\n # tail: terms e >= NT have valuation >= (e+1) vt - log_p(e+1) (coefficients integral)\n tail = min((e + 1) * vt - int(math.log(e + 1, p)) for e in range(NT, NT + 400))\n return total, tail\n\ndef logs_of(Elist):\n Ls = []\n for h in range(3):\n tot = pari(0); prec = 10 ** 9\n for k, tau in Elist:\n val, tail = tiny(k, W[k][h], tau)\n tot += val\n prec = min(prec, tail)\n prec = min(prec, int(pari.padicprec(tot, p))) # absolute p-adic precision tracked by PARI\n Ls.append((tot, prec))\n return Ls\nL = logs_of(Epts)\nfor nm, (v, pr) in zip(('L_x', 'L_y', 'L_z'), L):\n log(\" %s = log(%dG) . omega = %s (mod %d^%d), valuation %d\" % (nm, Jp, pari.lift(pari.Mod(pari.truncate(v), p ** min(pr, 25))), p, min(pr, 25), int(pari.valuation(v, p))))\ncheck(any(pari.valuation(v, p) < pr for v, pr in L), \"log(%dG) != 0 (so G has infinite order, again)\" % Jp)\n\n# independent check (p = 3 only): log(2 M G) via a separate Riemann-Roch computation equals 2 log(M G)\nif p == 3:\n Gf62, cub2, V2 = divisor_for_multiple(2 * Jp)\n rts2 = pari.polrootspadic(cub2, p, PREC)\n E2 = []\n for xr in rts2:\n k, red, tpar = which_disc(xr, pari.subst(V2, 'x', xr))\n E2.append((k, tpar))\n check(sorted(k for k, _ in E2) == ['P1', 'P2', 'P3'], \"E' for %dG also reduces to P1 + P2 + P3\" % (2 * Jp))\n L2 = logs_of(E2)\n okdbl = all(pari.valuation(L2[h][0] - 2 * L[h][0], p) >= min(L2[h][1], L[h][1]) - 1 for h in range(3))\n check(okdbl, \"log(%dG) = 2 log(%dG) to the working precision (independent Riemann-Roch + integration check)\" % (2 * Jp, Jp))\n\n# ---------------------------------------------------------------- annihilating differentials\nLx, Ly, Lz = [pari.truncate(v) for v, _ in L]\nLprec = min(pr for _, pr in L)\nvals = [int(pari.valuation(c, p)) for c in (Lx, Ly, Lz)]\nlog(\" valuations of (L_x, L_y, L_z):\", vals, \"; known mod %d^%d\" % (p, Lprec))\n\ndef strassmann(wser, label):\n \"\"\"integral of w(t)dt from the centre, t = p s; returns (bound N, list of first valuations, minval)\"\"\"\n ser = pari.truncate(wser)\n cs = []\n for j in range(1, NT + 1):\n c = pari.polcoeff(ser, j - 1, 't') * pari(p) ** j / j\n cs.append(c)\n vs = [int(pari.valuation(c, p)) if c != 0 else 10 ** 6 for c in cs]\n mn = min(vs)\n Nb = max(j + 1 for j, v in enumerate(vs) if v == mn)\n # coefficient errors from the precision of the L's: valuation >= Lprec + j - v_p(j); tail: j - log_p j\n assert mn < Lprec, \"precision\"\n assert all(j - math.log(j, p) > mn for j in range(NT + 1, NT + 2000)), \"tail\"\n return Nb, vs[:10], mn\n\nif p == 3:\n eta1 = lambda k: Lz * W[k][0] - Lx * W[k][2]\n eta2 = lambda k: Lz * W[k][1] - Ly * W[k][2]\nelse:\n # p = 5: L_z has the largest valuation; use L_x as the pivot\n eta1 = lambda k: Lx * W[k][1] - Ly * W[k][0]\n eta2 = lambda k: Lx * W[k][2] - Lz * W[k][0]\n# sanity: the etas kill log(M G)\nfor e_, nm in ((eta1, 'eta1'), (eta2, 'eta2')):\n tot = sum(tiny(k, e_(k), tau)[0] for k, tau in Epts)\n check(pari.valuation(tot, p) >= Lprec - 2, \"%s annihilates log(%dG) (valuation of the integral >= %d)\" % (nm, Jp, Lprec - 2))\n\nresults = {}\nfor k in ('P1', 'P2', 'P3', 'P4'):\n combos = [('eta1', eta1(k)), ('eta2', eta2(k))] + [('eta1+%d*eta2' % c, eta1(k) + c * eta2(k)) for c in range(1, p)] \\\n + [('eta2+%d*eta1' % (c * p), eta2(k) + c * p * eta1(k)) for c in range(1, p)]\n best = None\n out = []\n for nm, ws in combos:\n Nb, vs, mn = strassmann(ws, nm)\n out.append((nm, Nb, vs))\n if best is None or Nb < best[1]:\n best = (nm, Nb)\n results[k] = best\n log(\" disc %s: Strassmann bounds %s\" % (k, [(nm, Nb) for nm, Nb, _ in out]))\n log(\" first valuations: %s\" % ([(nm, vs[:8]) for nm, Nb, vs in out[:2]]))\nfor k in ('P1', 'P2', 'P4'):\n check(results[k][1] == 1, \"disc of %s: %s has Strassmann bound 1, so %s is the only rational point there\" % (k, results[k][0], k))\n\nif p == 3:\n # disc of P3: eta1 has bound 2; find its second zero U* and show eta2 does not vanish there\n k = 'P3'\n I1 = pari.truncate(eta1(k)); I2 = pari.truncate(eta2(k))\n def Iser(wpoly): # integral as a polynomial in s (t = 3 s), truncated\n return sum(pari.polcoeff(wpoly, j - 1, 't') * pari(3) ** j / j * pari('s') ** j for j in range(1, NT + 1))\n S1, S2 = Iser(I1), Iser(I2)\n Nb, vs, mn = strassmann(eta1(k), 'eta1')\n check(Nb == 2, \"disc of P3: eta1 has Strassmann bound 2 (zeros: s = 0 and at most one more)\")\n J1 = S1 / pari('s') # J1(s) = I1(s)/s, Strassmann bound 1\n # Newton in Z_3\n s0 = pari('O(3^%d)' % 40) + 0\n s0 = pari.Mod(0, 1)\n sv = pari(0)\n for _ in range(80):\n num = pari.subst(J1, 's', sv); den = pari.subst(pari.deriv(J1, 's'), 's', sv)\n sv = sv - num / den\n sv = pari.lift(pari.Mod(pari.numerator(sv) * pari.Mod(pari.denominator(sv), 3 ** 40) ** -1, 3 ** 40)) if pari.denominator(sv) % 3 else sv\n jv, jd = pari.subst(J1, 's', sv), pari.subst(pari.deriv(J1, 's'), 's', sv)\n vj, vd = int(pari.valuation(jv, 3)), int(pari.valuation(jd, 3))\n check(vj > 2 * vd, \"Hensel: J1(s0) has valuation %d > 2 v(J1'(s0)) = %d, so U* = s0 + O(3^%d) is a zero of eta1\" % (vj, 2 * vd, vj - vd))\n prec_U = min(vj - vd, Lprec - 3)\n val2 = pari.subst(S2, 's', sv)\n v2 = int(pari.valuation(val2, 3))\n log(\" U* = %d (mod 3^25), t = 3U*; int eta2 at U* = %d (mod 3^25)\" % (int(pari.lift(pari.Mod(sv, 3 ** 25))), int(pari.lift(pari.Mod(val2, 3 ** 25)))))\n check(v2 < prec_U, \"int_{P3}^{U*} eta2 has valuation %d < precision %d: U* is not a common zero\" % (v2, prec_U))\n check(int(pari.valuation(sv, 3)) == 0, \"U* is not s = 0 (it is a 3-adic point different from P3)\")\n log(\" => the disc of P3 contains no rational point other than P3\")\n check(sorted(proj) == sorted(PTS.values()), \"C(F_3) = {P1, P2, P3, P4}: every residue disc is covered\")\n log(\"CONCLUSION: C(Q) = {P1, P2, P3, P4}\")\nlog(\"s09 done (p = %d)\" % p)\n" }, { "path": "anc/code/1.3.7/t62lib.py", "size_bytes": 1288, "sha256": "7f1b8c9fcdc34c07309912e35c5ba6a201d2f2c9fe6a9cd3f6cf83a9b165684f", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Shared helpers for the T6-2 verification scripts.\n# Curve C: F = x^3 z + y^3 x + y^2 z^2 - z^3 y = 0 in P^2 over Q.\n# Everything is exact (PARI/GP via cypari2) unless a script says otherwise.\nimport os, sys, json, time\nimport cypari2, warnings\nwarnings.simplefilter(\"ignore\", DeprecationWarning)\n\nHERE = os.path.dirname(os.path.abspath(__file__))\nDATA = os.path.join(HERE, \"data\")\n\npari = cypari2.Pari()\npari.allocatemem(1500 * 10**6, silent=True)\npari.default(\"parisizemax\", 3 * 10**9)\n\n# fix variable priorities once: x > y > z > m > t > s > X > Y > w\npari(\"[x,y,z,m,t,s,X,Y,w]\")\nFPOL = pari('x^3*z + y^3*x + y^2*z^2 - z^3*y')\n\ndef log(*a):\n print(*a, flush=True)\n\ndef check(cond, msg):\n if not cond:\n log(\"FAIL:\", msg)\n raise SystemExit(1)\n log(\"PASS:\", msg)\n\ndef load_field():\n \"\"\"K = Q(w), g(w) = the paper's reduced polynomial; maximal order certified (nfcertify).\"\"\"\n g = pari(open(os.path.join(DATA, \"g.txt\")).read().strip())\n g = pari.subst(g, pari.variable(g), pari('w'))\n fa = pari.factor(pari.poldisc(g))\n nf = pari.nfinit([g, [int(p) for p in fa[0]]])\n return g, nf\n\ndef load_elt(name):\n \"\"\"Elements stored as PARI strings in the variable w (data/*.txt or json).\"\"\"\n return pari(open(os.path.join(DATA, name)).read().strip())\n" }, { "path": "anc/code/1.3.7/wit2gp.py", "size_bytes": 651, "sha256": "d1349d968ee23702f994adcfd0fc4d3cba63c21b42f77beea0aabbdd27d0c5dd", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "# Convert the witness files (JSON lines [p, f, [28 coordinates on data/zk.txt]]) into one GP-readable file\n# for s05c_check_witnesses.gp. Pure Python, no PARI. Usage: wit2gp.py OUT.gp WITNESS_FILES...\nimport sys, gzip, json\nfiles = sorted(sys.argv[2:], key=lambda fn: int(fn.split('wit_')[-1].split('_')[0]))\nwith open(sys.argv[1], 'w') as fo:\n fo.write('[')\n first = True\n for fn in files:\n with gzip.open(fn, 'rt') as fi:\n for line in fi:\n p, f, c = json.loads(line)\n fo.write(('' if first else ',') + '[%d,%d,[%s]]' % (p, f, ','.join(c)))\n first = False\n fo.write(']\\n')\n" }, { "path": "anc/code/1.3.8/chabauty/chabauty3.py", "size_bytes": 13233, "sha256": "9c19827d25196be3b2c68307aa0040227a4ba057c3e1f534c87a4d2da2624651", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Chabauty-Coleman at p = 3 for C: G = x^4 - y^3 z + x y z^2 + x z^3 = 0 (rank J(Q) = 1, generator G1 = [P1 - oo]).\n\nDifferentials w_L = L * Omega, Omega = dx / G_y(x,y,1), L in (z, x, y) (a Z_3-basis on the smooth model).\nChart y = 1 at oo = (0:1:0): h(X,Z) = G(X,1,Z) = X^4 - Z + X Z^2 + X Z^3, Z = X^4 + X Z^2 + X Z^3 in Z[[X]],\nw_L = L(X,1,Z) dX / (1 - 2XZ - 3XZ^2) (= -L dX/h_Z, the same Omega).\n(1) For m = 1, 2: f in L((9m+5) oo) with ord_{P1} f >= 9m whose reduction mod 3 has pole order exactly 9m,\n so div f = 9m P1 + E - (9m+5) oo with E of degree 5 reducing to 5 oo; then [E - 5 oo] = -9m G1 and\n log(-9m G1) = sum_{Q in E} int_oo^Q w_L, from the power sums of X = x/y over E (exact polynomial of E).\n(2) The direction of log G1 mod 3; annihilating differentials; for each R in C(F_3) = {oo, P0, P1} an\n annihilating w with w(R) a unit, so (Strassmann) R is the only rational point in its residue disc.\n\"\"\"\nfrom fractions import Fraction as Fr\nimport itertools, math\nimport cypari2\nP = cypari2.Pari(); P.allocatemem(10**9, silent=True)\np = 3\nPREC = 40 # work modulo 3^PREC (after exact rational computations)\nMOD = p ** PREC\n\ndef v3(a):\n a = Fr(a)\n if a == 0: return 10**9\n n, d, v = a.numerator, a.denominator, 0\n while n % 3 == 0: n //= 3; v += 1\n while d % 3 == 0: d //= 3; v -= 1\n return v\n\ndef to_mod(a, M=MOD):\n a = Fr(a); assert v3(a) >= 0\n return a.numerator * pow(a.denominator, -1, M) % M\n\n# ---------------------------------------------------------------- power series helpers (exact rationals / ints)\ndef ps_mul(a, b, K):\n c = [0] * K\n for i, ai in enumerate(a[:K]):\n if ai:\n for j, bj in enumerate(b[:K - i]):\n c[i + j] += ai * bj\n return c\n\ndef ps_inv(a, K): # a[0] = +-1\n assert a[0] in (1, -1)\n b = [0] * K; b[0] = a[0]\n for n in range(1, K):\n s = sum(a[i] * b[n - i] for i in range(1, min(n, len(a) - 1) + 1))\n b[n] = -a[0] * s\n return b\n\nK = 160\n# Z(X) at oo: Z = X^4 + X Z^2 + X Z^3\nZs = [0] * K\nfor it in range(K):\n Z2 = ps_mul(Zs, Zs, K); Z3 = ps_mul(Z2, Zs, K)\n new = [0] * K; new[4] = 1\n for i in range(K - 1):\n new[i + 1] += Z2[i] + Z3[i]\n if new == Zs: break\n Zs = new\nassert all(isinstance(c, int) for c in Zs)\nden = [1] + [0] * (K - 1)\nXZ = [0] + Zs[:K - 1]\nXZ2 = [0] + ps_mul(Zs, Zs, K)[:K - 1]\nfor i in range(K): den[i] -= 2 * XZ[i] + 3 * XZ2[i]\nu = ps_inv(den, K) # 1/(1 - 2XZ - 3XZ^2) in Z[[X]]\nw = {'z': ps_mul(Zs, u, K), 'x': [0] + u[:K - 1], 'y': u} # w_L = (series) dX\nprint('w_z = %s ...' % w['z'][:8], ' w_x = %s ...' % w['x'][:8], ' w_y = %s ...' % w['y'][:8])\n\n# ---------------------------------------------------------------- L(N oo) and conditions at P1\n# monomials x^i y^j, j <= 2, pole order 3i + 4j at oo\ndef monomials(Npole):\n return [(i, j) for j in range(3) for i in range(Npole // 3 + 1) if 3 * i + 4 * j <= Npole]\n\n# y(s) at P1 = (-1, 0), s = x + 1: G = x^4 - y^3 + x y + x = 0, G_y = x - 3y^2 = -1 at P1\nKs = 40\nys = [0] * Ks\nxs = [-1, 1] + [0] * (Ks - 2)\nx4 = ps_mul(ps_mul(xs, xs, Ks), ps_mul(xs, xs, Ks), Ks)\nfor it in range(Ks):\n # y = (x^4 + x - y^3) / (-x) ... rewrite G = 0 as x*y = y^3 - x^4 - x -> y = (y^3 - x^4 - x)/x\n y3 = ps_mul(ps_mul(ys, ys, Ks), ys, Ks)\n num = [y3[i] - x4[i] - xs[i] for i in range(Ks)]\n new = ps_mul(num, ps_inv(xs, Ks), Ks)\n if new == ys: break\n ys = new\nassert ys[0] == 0 and all(isinstance(c, int) for c in ys)\nchk = [x4[i] - ps_mul(ps_mul(ys, ys, Ks), ys, Ks)[i] + ps_mul(xs, ys, Ks)[i] + xs[i] for i in range(Ks)]\nassert not any(chk[:Ks - 1])\nprint('y(s) at P1, s = x+1:', ys[:8], '...')\n\ndef expand_at_P1(i, j, order):\n a = [1] + [0] * (Ks - 1)\n for _ in range(i): a = ps_mul(a, xs, Ks)\n for _ in range(j): a = ps_mul(a, ys, Ks)\n return a[:order]\n\ndef find_f(m):\n Npole = 9 * m + 5\n mons = monomials(Npole)\n assert len(mons) == Npole - 2 # dim L(N oo) = N - g + 1 = N - 2 (N >= 5)\n ordP1 = 9 * m\n A = P.matrix(ordP1, len(mons), [expand_at_P1(i, j, ordP1)[r] for r in range(ordP1) for (i, j) in mons])\n ker = P.matker(A)\n dimV = int(P.matsize(ker)[1])\n # saturated integral basis of V (kernel lattice), then reduce mod 3\n Lat = P.matrixqz(ker, -2) if dimV > 0 else ker # Z-basis of (Q-span) intersect Z^n\n vecs = [[int(Lat[r, c]) for r in range(len(mons))] for c in range(dimV)]\n poles = [3 * i + 4 * j for (i, j) in mons]\n # search a combination whose reduction mod 3 has pole order exactly 9m\n best = None\n for comb in itertools.product(range(3), repeat=dimV):\n if not any(comb): continue\n v = [sum(c * vec[r] for c, vec in zip(comb, vecs)) for r in range(len(mons))]\n red = [c % 3 for c in v]\n if not any(red): continue\n top = max(poles[r] for r in range(len(mons)) if red[r])\n if top == 9 * m:\n best = v; break\n assert best is not None\n g = math.gcd(*best); best = [c // g for c in best]\n top_rational = max(poles[r] for r in range(len(mons)) if best[r])\n ordexact = next(r for r, c in enumerate(sum((Fr(best[t]) * Fr(expand_at_P1(i, j, Ks)[r]) for t, (i, j) in enumerate(mons)), Fr(0)) for r in range(Ks)) if c != 0)\n print('m=%d: dim V = %d (expected 3); f has pole order %d at oo, ord_P1 f = %d; f mod 3 has pole order %d'\n % (m, dimV, top_rational, ordexact, 9 * m))\n assert dimV == 3 and top_rational > 9 * m and ordexact == 9 * m\n return mons, best, top_rational - 9 * m\n\ndef log_divisor(mons, f, m, edeg):\n # f~(X,Z) = Z^4 f(X/Z, 1/Z) (all monomials have i+j <= degree d)\n d = max(i + j for (i, j) in mons)\n ft = P('0')\n for (i, j), c in zip(mons, f):\n if c: ft += c * P('X')**i * P('Z')**(d - i - j)\n h = P('X^4 - Z + X*Z^2 + X*Z^3')\n Rz = P.polresultant(h, ft, 'Z')\n fa = P.factor(Rz)\n # E: the factors (other than X) whose roots have positive 3-adic valuation; total degree must be 5\n Epoly = P(1); info = []\n for k in range(len(fa[0])):\n q, e = fa[0][k], int(fa[1][k])\n if P.poldegree(q) == 1 and P.polcoef(q, 0) == 0:\n info.append(('X', e)); continue\n vals = [Fr(int(P.numerator(v)), int(P.denominator(v))) for v in P.newtonpoly(q, 3)]\n info.append((int(P.poldegree(q)), e, [str(v) for v in vals]))\n if all(v > 0 for v in vals):\n Epoly *= q ** e\n print(' Res_Z(h, f~) factors (degree, multiplicity, Newton slopes at 3):', info)\n # the Z = z/y coordinates of the points of E must be small too (E lies in the disc of oo, not of P0)\n RX = P.polresultant(h, ft, 'X')\n faZ = P.factor(RX)\n infoZ = []\n for k2 in range(len(faZ[0])):\n q2 = faZ[0][k2]\n if P.poldegree(q2) == 1 and P.polcoef(q2, 0) == 0:\n infoZ.append(('Z', int(faZ[1][k2]))); continue\n sl = [Fr(int(P.numerator(v)), int(P.denominator(v))) for v in P.newtonpoly(q2, 3)]\n infoZ.append((int(P.poldegree(q2)), int(faZ[1][k2]), [str(v) for v in sl]))\n print(' Res_X(h, f~) factors (degree, multiplicity, Newton slopes at 3):', infoZ)\n assert any(t[0] == edeg and all(Fr(v) >= 1 for v in t[2]) for t in infoZ if t[0] != 'Z')\n print(' f =', ' + '.join('%d*x^%d*y^%d' % (c, i, j) for (i, j), c in zip(mons, f) if c))\n assert int(P.poldegree(Epoly)) == edeg, (P.poldegree(Epoly), edeg)\n # each root of E is a common zero near oo: check E(X) divides psi(X) = f~(X, Z(X)) / X^2 in Q_3[[X]] (mod X^30)\n print(' E(X) =', Epoly)\n Epoly = Epoly / P.pollead(Epoly)\n ec = [Fr(int(P.numerator(P.polcoef(Epoly, k))), int(P.denominator(P.polcoef(Epoly, k)))) for k in range(edeg + 1)]\n # power sums p_k of the roots of E (Newton's identities), E = X^d + c_{d-1} X^{d-1} + ... + c_0\n e = [(-1) ** i * ec[edeg - i] for i in range(1, edeg + 1)] # elementary symmetric e_1..e_d\n pk = [Fr(edeg)]\n for kk in range(1, K + 2):\n s = Fr(0)\n for i in range(1, min(kk, edeg) + 1):\n if kk - i > 0:\n s += (-1) ** (i - 1) * e[i - 1] * pk[kk - i]\n if kk <= edeg: s += (-1) ** (kk - 1) * kk * e[kk - 1]\n pk.append(s)\n # check Newton sums numerically against PARI polsym\n ps_par = P.polsym(Epoly, 12)\n assert all(Fr(int(P.numerator(ps_par[k])), int(P.denominator(ps_par[k]))) == pk[k] for k in range(13))\n slopes = [Fr(int(P.numerator(v)), int(P.denominator(v))) for v in P.newtonpoly(P.subst(Epoly, 'X', 'X'), 3)]\n mu = min(slopes)\n assert mu > 0\n out = {}\n for L in 'zxy':\n s = Fr(0)\n for k in range(K - 1):\n if w[L][k]:\n s += w[L][k] * pk[k + 1] / (k + 1)\n out[L] = s\n # tail bound: terms with k >= K-1 have valuation >= (k+1) mu - log_3(k+1)\n tail = min((k + 1) * mu - math.log(k + 1, 3) for k in range(K - 1, 50 * K))\n return out, float(tail), slopes\n\nres = {}\nfor m in (1, 2):\n mons, f, edeg = find_f(m)\n print(' E has degree %d: [E - %d oo] = -%d G1' % (edeg, edeg, 9 * m))\n lg, tail, slopes = log_divisor(mons, f, m, edeg)\n prec = int(math.floor(tail))\n print(' Newton slopes of E at 3:', [str(s) for s in slopes], ' truncation error valuation >= %.1f' % tail)\n vals = {L: v3(lg[L]) for L in 'zxy'}\n vmin = min(vals.values())\n assert vmin < prec - 6\n M = 3 ** (prec - vmin)\n prim = {L: to_mod(lg[L] / Fr(3) ** vmin, M) for L in 'zxy'}\n unit = prim['x']\n norm = {L: prim[L] * pow(unit, -1, M) % M for L in 'zxy'}\n print(' log(-%dG1): valuations (z,x,y) = (%d,%d,%d); primitive vector / x-coordinate mod 3^6 = (%d, %d, %d)'\n % (9 * m, vals['z'], vals['x'], vals['y'], norm['z'] % 729, norm['x'] % 729, norm['y'] % 729))\n res[m] = (lg, vmin, norm, prec)\n# consistency: log(-18G1) = 2 log(-9G1)\nlg1, lg2 = res[1][0], res[2][0]\nprec = min(res[1][3], res[2][3])\nfor L in 'zxy':\n assert v3(lg2[L] - 2 * lg1[L]) >= prec - 1, L\nprint('check: log(-18 G1) = 2 log(-9 G1) to precision 3^%d' % (prec - 1))\nlam = res[1][2]\nlam_bar = tuple(lam[L] % 3 for L in 'zxy')\nprint('direction of log G1 mod 3 in the basis (w_z, w_x, w_y):', lam_bar)\nassert lam_bar == (0, 1, 0)\n\n# ---------------------------------------------------------------- residue discs\n# value of the reduction of w_L at R is proportional to L(R) (Omega has no zeros or poles on the smooth model)\npts = {'oo': (0, 0, 1), 'P0': (1, 0, 0), 'P1': (1, 2, 0)} # (z, x, y)(R) mod 3\nfor name, vR in pts.items():\n # annihilating differentials mod 3: c . lam_bar = 0, i.e. c_x = 0; pick c with c . v(R) != 0\n c = next(c for c in itertools.product(range(3), repeat=3) if c[1] == 0 and sum(a * b for a, b in zip(c, vR)) % 3)\n print('disc of %s: (z,x,y)(R) = %s mod 3; annihilating w = %d w_z + (3*) w_x + %d w_y has w(R) = %d != 0 mod 3'\n % (name, vR, c[0], c[2], sum(a * b for a, b in zip(c, vR)) % 3))\n# explicit expansions with good uniformizers, to confirm integrality and the unit leading coefficient\n# exact annihilating w: c = (c_z, c_x, c_y) with c . lam = 0, lam = primitive log vector mod 3^k\nM6 = 3 ** 10\nlamv = [lam[L] % M6 for L in 'zxy']\ndef annih(cz, cy):\n cx = (-(cz * lamv[0] + cy * lamv[2]) * pow(lamv[1], -1, M6)) % M6\n return (cz, cx, cy)\n# at oo: uniformizer X, w_L series above\nfor name, (cz, cy) in (('oo', (0, 1)), ('P0', (1, 0)), ('P1', (1, 0))):\n cz_, cx_, cy_ = annih(cz, cy)\n if name == 'oo':\n ser = [(cz_ * w['z'][k] + cx_ * w['x'][k] + cy_ * w['y'][k]) % M6 for k in range(12)]\n elif name == 'P0':\n # uniformizer y: x = y^3 / (1 + y + x^3) in Z[[y]]; w_L = -L dy / G_x, G_x = 4x^3 + y + 1\n Kt = 20; xx = [0] * Kt\n for it in range(Kt):\n x3 = ps_mul(ps_mul(xx, xx, Kt), xx, Kt)\n d = [1, 1] + [0] * (Kt - 2)\n d = [d[i] + x3[i] for i in range(Kt)]\n new = ps_mul([0, 0, 0, 1] + [0] * (Kt - 4), ps_inv(d, Kt), Kt)\n if new == xx: break\n xx = new\n x3 = ps_mul(ps_mul(xx, xx, Kt), xx, Kt)\n Gx = [4 * x3[i] + (1 if i == 0 else 0) + (1 if i == 1 else 0) for i in range(Kt)]\n iG = ps_inv(Gx, Kt)\n yv = [0, 1] + [0] * (Kt - 2)\n Lser = [(cz_ * (1 if i == 0 else 0) + cx_ * xx[i] + cy_ * yv[i]) for i in range(Kt)]\n ser = [(-c) % M6 for c in ps_mul(Lser, iG, Kt)][:12]\n else:\n # uniformizer s = x + 1: w_L = L ds / G_y, G_y = x - 3y^2 = -1 + s - 3y^2\n Kt = 20\n Gy = [xs[i] - 3 * ps_mul(ys, ys, Ks)[i] for i in range(Kt)]\n iG = ps_inv(Gy, Kt)\n Lser = [cz_ * (1 if i == 0 else 0) + cx_ * xs[i] + cy_ * ys[i] for i in range(Kt)]\n ser = [c % M6 for c in ps_mul(Lser, iG, Kt)][:12]\n a0 = ser[0]\n print(' %s: annihilating w = (%s) . (w_z,w_x,w_y) mod 3^10 = (a0 + a1 t + ...) dt with a0 = %d (unit: %s); first coefficients %s'\n % (name, (cz_, cx_, cy_), a0, a0 % 3 != 0, ser[:6]))\n assert a0 % 3 != 0\n# Strassmann: for t = 3s, (1/3) int = a0 s + sum_{k>=1} a_k 3^k s^{k+1}/(k+1) and v(3^k/(k+1)) >= 1 for k >= 1\nassert all(k - max(e for e in range(12) if (k + 1) % 3 ** e == 0) >= 1 for k in range(1, 10**5))\nprint('Strassmann: each residue disc contains exactly one rational point; C(Q) = {oo, P0, P1}')\n" }, { "path": "anc/code/1.3.8/classgroup/bound.py", "size_bytes": 7630, "sha256": "3441d1176097d86f91cb74316492aab6ec486204a31eb34dc9a91fff3746560f", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Explicit-formula bound B^-(f) for Cl(K)[2] = 0 (Theorem B of the proof), rigorous ball arithmetic.\n\n bound.py PARAMS.json COUNTDIR SMALL.json [--optimize]\n\nPARAMS: {\"support\": R, \"principal_bound\": C, \"window_heights\": [h_1..h_N]}. T = log R; the window v is the\nstep function with heights h_i on N equal cells of [0, T]; f = (v * v~)/||v||^2 has rational knots\nf_k = sum_i h_i h_{i+k} / sum h_i^2 at x = k T/N and is linear in between.\n B^-(f) = C_inf - int_0^inf (1 - f) W + (4/n) sum_{q^m < R} c_m(q) log q / (q^m + 1) f(m log q),\n C_inf = gamma + log 4 pi + r1/n - log|d_K|/n, W(x) = 1/sinh x + (r1/n)/(2 cosh^2(x/2)),\n c_m(q) = a(q) for m even or q <= C (all prime ideals of norm <= C are principal), -a(q) otherwise.\nCounts a(q): prime ideals over p <= sqrt(R) and over p | disc(B) from SMALL.json (PARI idealprimedec in the\ncertified maximal order); for the other p < R only degree-one primes have norm < R and a(p) = number of roots\nof B mod p, from the byte files of nroots.c (one byte per prime, primes in increasing order).\nArithmetic: python-flint arb; prime powers are placed in their cell by exact integer comparisons\nq^(mN) vs R^k, so no rounding enters the piecewise-linear evaluation.\n--optimize: print the top eigenvector of the Toeplitz form (the best step window for these data) instead.\n\"\"\"\nimport sys, os, json, glob, math, time, hashlib\nfrom fractions import Fraction\nimport numpy as np\nfrom flint import arb, ctx\n\nprm = json.load(open(sys.argv[1])); cdir = sys.argv[2]; small = {int(k): v for k, v in json.load(open(sys.argv[3])).items()}\nOPT = '--optimize' in sys.argv\nR = int(prm['support']); C = int(prm['principal_bound'])\nn, r1 = 27, 3\nDK = 2**34 * 11**6 * 652081**6\nBADP = [2, 11, 41, 198839, 652081]\n\n# ------------------------------------------------------------------ primes < R and root counts\ndef primes_segment(lo, hi):\n \"\"\"primes in [lo, hi] (numpy, segmented)\"\"\"\n base = np.ones(int(hi**0.5) + 2, dtype=bool); base[:2] = False\n for i in range(2, int(len(base)**0.5) + 1):\n if base[i]: base[i*i::i] = False\n bp = np.nonzero(base)[0]\n seg = np.ones(hi - lo + 1, dtype=bool)\n if lo < 2: seg[:2 - lo] = False\n for p in bp:\n if p * p > hi: break\n st = max(p * p, (lo + p - 1) // p * p)\n seg[st - lo::p] = False\n return np.nonzero(seg)[0] + lo\n\nfiles = []\nfor fn in glob.glob(os.path.join(cdir, 'r_*_*.bin')):\n lo, hi = (int(v) for v in os.path.basename(fn)[2:-4].split('_'))\n assert os.path.exists(fn + '.done')\n files.append((lo, hi, fn))\nfiles.sort()\nassert files[0][0] == 2 and files[-1][1] == R - 1 and all(files[i][1] + 1 == files[i+1][0] for i in range(len(files) - 1)), files\nSQ = math.isqrt(R - 1) # p <= SQ <=> p^2 < R\nassert max(p for p in small if p not in BADP) >= SQ\nQ1, A1 = [], [] # degree-one counts of large primes\nsha = hashlib.sha256()\nfor lo, hi, fn in files:\n ps = primes_segment(lo, hi)\n rb = np.fromfile(fn, dtype=np.uint8)\n assert len(rb) == len(ps), fn\n sha.update(rb.tobytes())\n # consistency with PARI for small primes\n for p, r in zip(ps[ps <= SQ].tolist(), rb[ps <= SQ].tolist()):\n if p not in BADP:\n assert r == small[p].count(1), (p, r, small[p])\n bad = np.isin(ps, BADP)\n assert np.all((rb == 255) == bad)\n sel = (ps > SQ) & (~bad) & (rb > 0)\n Q1.append(ps[sel].astype(np.int64)); A1.append(rb[sel].astype(np.int64))\nQ1 = np.concatenate(Q1); A1 = np.concatenate(A1)\n# small primes and bad primes: all prime ideals of norm < R\nterms_small = {}\nfor p, fl in small.items():\n if p <= SQ or p in BADP:\n for f in fl:\n q = p ** f\n if q < R:\n terms_small[q] = terms_small.get(q, 0) + 1\nprint('support R =', R, ' T = log R; principal bound C =', C)\nprint('prime ideals of norm < R: %d (degree-one ideals over p > sqrt(R): %d; over small/bad p: %d)'\n % (int(A1.sum()) + sum(terms_small.values()), int(A1.sum()), sum(terms_small.values())))\nprint('sha256 of the root-count bytes:', sha.hexdigest())\nn_principal = sum(a for q, a in terms_small.items() if q <= C) + int(A1[Q1 <= C].sum())\nprint('prime ideals of norm <= C (all proved principal by check_witnesses.py):', n_principal)\n\n# ------------------------------------------------------------------ window\nh = [int(v) for v in prm['window_heights']]; N = len(h)\nctx.prec = 128\nT = arb(R).log(); delta = T / N\nSh = sum(v * v for v in h)\nfk = [Fraction(sum(h[i] * h[i + k] for i in range(N - k)), Sh) for k in range(N)] + [Fraction(0), Fraction(0)]\nassert fk[0] == 1\n# cell thresholds: q in cell j <=> t_j <= q < t_{j+1}, t_j = min{Q : Q^N >= R^j}\ndef iroot_ceil(j, N):\n \"\"\"min{Q integer : Q^N >= R^j} (exact; start from a floating-point guess and correct)\"\"\"\n X = R ** j\n r = max(1, int(math.exp(j * math.log(R) / N)) - 2)\n while r > 1 and r ** N >= X: r -= 1\n while r ** N < X: r += 1\n assert r ** N >= X and (r - 1) ** N < X\n return r\nthr = [iroot_ceil(j, N) for j in range(N + 1)]\nassert thr[0] == 1 and thr[N] == R\n\n# ------------------------------------------------------------------ prime sums per cell\nS0 = [arb(0) for _ in range(N)]; S1 = [arb(0) for _ in range(N)]\ndef add(Q, logq_mult, c, w): # Q = q^m (integer), contribution c * w, w = log q/(q^m+1), x = m log q\n j = int(np.searchsorted(thr, Q, side='right')) - 1\n assert thr[j] <= Q < thr[j + 1]\n S0[j] += c * w\n S1[j] += c * w * logq_mult\nt0 = time.time()\nfor q, a in sorted(terms_small.items()):\n lq = arb(q).log()\n m = 1\n while q ** m < R:\n c = a if (m % 2 == 0 or q <= C) else -a\n add(q ** m, m * lq, c, lq / (q ** m + 1))\n m += 1\nthr_np = np.array(thr, dtype=np.int64)\ncells = np.searchsorted(thr_np, Q1, side='right') - 1 # exact integer comparisons\nassert np.all(thr_np[cells] <= Q1) and np.all(Q1 < thr_np[cells + 1])\nassert bool(np.all(Q1 > SQ))\nsgn = np.where(Q1 <= C, 1, -1) * A1\nfor j in range(N):\n sel = cells == j\n s0 = arb(0); s1 = arb(0)\n for p, c in zip(Q1[sel].tolist(), sgn[sel].tolist()):\n lq = arb(p).log()\n w = c * lq / (p + 1)\n s0 += w; s1 += w * lq\n S0[j] += s0; S1[j] += s1\nprint('prime sums done in %.0fs' % (time.time() - t0), flush=True)\nfa = [arb(x.numerator) / x.denominator for x in fk]\nprime = arb(0)\nfor j in range(N):\n slope = (fa[j + 1] - fa[j]) / delta\n prime += fa[j] * S0[j] + slope * (S1[j] - j * delta * S0[j])\nprime = 4 * prime / n\n\n# ------------------------------------------------------------------ archimedean part\nalpha = arb(r1) / n\nCinf = arb.const_euler() + (4 * arb.pi()).log() + alpha - arb(DK).log() / n\ndef A(a): # C_inf - int_0^inf (1 - (1 - x/a)_+) W(x) dx (closed form)\n z = (-a).exp()\n return (Cinf - arb.pi() ** 2 / (4 * a) - 2 * alpha * arb(2).log() / a\n + 2 / a * (z.polylog(2) - (z * z).polylog(2) / 4) + 2 * alpha / a * z.log1p())\nwk = [None] + [k * (fk[k - 1] - 2 * fk[k] + fk[k + 1]) for k in range(1, N + 1)]\nassert sum(wk[1:]) == 1\nfor j in range(N + 1): # the triangle expansion reproduces every knot\n assert sum(wk[k] * max(Fraction(0), 1 - Fraction(j, k)) for k in range(1, N + 1)) == fk[j]\narch = arb(0)\nfor k in range(1, N + 1):\n if wk[k] != 0:\n arch += arb(wk[k].numerator) / wk[k].denominator * A(k * delta)\nB = arch + prime\nprint('C_inf =', Cinf.str(20))\nprint('archimedean part C_inf - int(1-f)W =', arch.str(25))\nprint('prime part =', prime.str(25))\nprint('B^-(f) =', B.str(30))\nprint('B^-(f) > 0 RIGOROUSLY:', bool(B > 0))\n" }, { "path": "anc/code/1.3.8/classgroup/bound_data.py", "size_bytes": 1144, "sha256": "aeca9ba95c1d5df823f62cbe53ec0e188763353b7300092a469eb9c2909d7b0d", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Loader for the root-count byte files of nroots.c (shared by optimize_window.py).\"\"\"\nimport os, glob\nimport numpy as np\n\ndef primes_segment(lo, hi):\n base = np.ones(int(hi**0.5) + 2, dtype=bool); base[:2] = False\n for i in range(2, int(len(base)**0.5) + 1):\n if base[i]: base[i*i::i] = False\n bp = np.nonzero(base)[0]\n seg = np.ones(hi - lo + 1, dtype=bool)\n if lo < 2: seg[:2 - lo] = False\n for p in bp:\n if p * p > hi: break\n st = max(p * p, (lo + p - 1) // p * p)\n seg[st - lo::p] = False\n return np.nonzero(seg)[0] + lo\n\ndef load_large(cdir, R, SQ, BADP):\n files = []\n for fn in glob.glob(os.path.join(cdir, 'r_*_*.bin')):\n lo, hi = (int(v) for v in os.path.basename(fn)[2:-4].split('_'))\n files.append((lo, hi, fn))\n files.sort()\n assert files[0][0] == 2 and files[-1][1] == R - 1\n for lo, hi, fn in files:\n ps = primes_segment(lo, hi)\n rb = np.fromfile(fn, dtype=np.uint8)\n assert len(rb) == len(ps)\n sel = (ps > SQ) & (~np.isin(ps, BADP)) & (rb > 0) & (rb != 255)\n yield ps[sel].astype(np.int64), rb[sel].astype(np.int64)\n" }, { "path": "anc/code/1.3.8/classgroup/check_witnesses.py", "size_bytes": 4864, "sha256": "2abf97ee59682531465a52afef50cda59a389032c1faf6779f26b85aec7f3a6c", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Exact check that every prime ideal of K of norm <= C is principal, from the proposed generators.\n\n check_witnesses.py C WITNESS_DIR ROOTCOUNT_FILE\nFor every prime ideal p of norm <= C (enumerated here independently: PARI idealprimedec in the certified\nmaximal order for p <= sqrt(C) and p | disc(B); roots of B mod p with FLINT otherwise, cross-checked\nagainst the byte file of nroots.c) we require a record g = (num[0] + num[1] theta + ... + num[26] theta^26)/den (a polynomial in the field\ngenerator, so the witness files do not depend on any integral basis or PARI version) with\n * g in O_K: integer coordinates on the integral basis certified (nfcertify) by the PARI running this check,\n * g in p (degree-one p = (p, theta - r), p not dividing den: num(r) = 0 mod p; otherwise PARI nfeltval >= 1),\n * |N_{K/Q}(g)| = N(p), with N(g) = Res(B, num)/den^27 computed with FLINT (not PARI).\nThen (g) is contained in p and has the same norm, so (g) = p. Each record is used exactly once.\nNo GRH: PARI's bnf is not used here at all.\n\"\"\"\nimport glob, gzip, json, os, sys, time\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nimport kfield\nimport numpy as np\nfrom flint import nmod_poly, fmpz_poly\n\nC = int(sys.argv[1]); wdir = sys.argv[2]; rootfile = sys.argv[3]\nP = kfield.pari()\nnf = kfield.make_nf()\nBpoly = fmpz_poly(kfield.B_COEFFS)\nbad = set(kfield.DISC_B_PRIMES)\n\n\ndef as_alg(d):\n num, den = d['num'], d['den']\n assert len(num) == 27 and all(isinstance(v, int) for v in num) and isinstance(den, int) and den > 0\n return P.Polrev(num, 'x') / den\n\n\ndef integral(d):\n co = P.nfalgtobasis(nf, as_alg(d))\n return all(P.denominator(v) == 1 for v in co)\n\n\ndef norm_of(d):\n res = int(Bpoly.resultant(fmpz_poly(d['num'])))\n D27 = d['den'] ** 27\n assert res % D27 == 0\n return res // D27\n\n\ndef in_deg1(d, p, r):\n assert d['den'] % p != 0\n v = 0\n for co in reversed(d['num']):\n v = (v * r + co) % p\n return v == 0\n\n\n# primes p <= C in increasing order, and the root-count bytes of nroots.c for them\ndef primes_upto(N):\n s = np.ones(N + 1, dtype=bool); s[:2] = False\n for i in range(2, int(N ** 0.5) + 1):\n if s[i]: s[i * i::i] = False\n return np.nonzero(s)[0]\nps = primes_upto(C)\nrb = np.fromfile(rootfile, dtype=np.uint8)[:len(ps)]\nassert len(rb) == len(ps)\n\nrecs = {}\nfiles = sorted(glob.glob(os.path.join(wdir, 'w_*.jsonl.gz')), key=lambda s: int(os.path.basename(s).split('_')[1]))\ncover = []\nfor fn in files:\n lo, hi = (int(v) for v in os.path.basename(fn)[2:-9].split('_'))\n cover.append((lo, hi))\n with gzip.open(fn, 'rt') as fh:\n for line in fh:\n d = json.loads(line)\n recs.setdefault(d['p'], []).append(d)\ncover.sort()\nassert cover[0][0] == 2 and cover[-1][1] == C and all(cover[i][1] + 1 == cover[i + 1][0] for i in range(len(cover) - 1)), 'blocks do not tile [2, C]'\nt0 = time.time()\nnid = 0; bydeg = {}; nrec = sum(len(v) for v in recs.values())\nfor idx, p in enumerate(ps.tolist()):\n R = recs.get(p, [])\n if p in bad or p * p <= C:\n prs = [pr for pr in P.idealprimedec(nf, p) if p ** int(pr[3]) <= C]\n if p not in bad:\n assert int(rb[idx]) == sum(1 for pr in P.idealprimedec(nf, p) if int(pr[3]) == 1)\n used = [False] * len(R)\n for pr in prs:\n q = p ** int(pr[3])\n ok = False\n for j, d in enumerate(R):\n if used[j] or d['f'] != int(pr[3]):\n continue\n if integral(d) and int(P.nfeltval(nf, as_alg(d), pr)) >= 1 and abs(norm_of(d)) == q:\n used[j] = ok = True\n break\n assert ok, ('no valid generator', p, int(pr[3]))\n nid += 1; bydeg[int(pr[3])] = bydeg.get(int(pr[3]), 0) + 1\n assert all(used), ('unused record', p)\n else:\n roots = sorted(int(r) for r, m in nmod_poly(kfield.B_COEFFS, p).roots())\n assert len(roots) == int(rb[idx]), ('root count mismatch with nroots', p)\n assert sorted(d['r'] for d in R) == roots, ('records do not match the roots', p)\n for d in R:\n assert d['f'] == 1\n assert integral(d), ('generator not integral', p, d['r'])\n assert in_deg1(d, p, d['r']), ('generator not in the ideal', p, d['r'])\n assert abs(norm_of(d)) == p, ('wrong norm', p, d['r'])\n nid += 1; bydeg[1] = bydeg.get(1, 0) + 1\n if idx % 10000 == 0:\n print('checked up to p =', p, 'ideals', nid, '%.0fs' % (time.time() - t0), flush=True)\nassert nid == nrec, ('records not all used', nid, nrec)\nprint('PARI %s: ALL %d PRIME IDEALS OF NORM <= %d ARE PRINCIPAL (generators checked exactly); by degree %s; %.0fs'\n % ('.'.join(str(v) for v in P.version()), nid, C, json.dumps(dict(sorted(bydeg.items()))), time.time() - t0), flush=True)\n" }, { "path": "anc/code/1.3.8/classgroup/crosscheck_counts.py", "size_bytes": 1544, "sha256": "be921cf50a3346ec7cc4dcbeb6ce7606b5a775da7f268b2e5b801d039d3069a5", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Independent spot check of the root counts of nroots.c: for every prime in a few windows of [2, R) and a\nrandom sample of further primes, deg gcd(x^p - x, B mod p) is recomputed with FLINT (python-flint nmod_poly)\nand the number of roots with PARI polrootsmod (a third implementation) for a subsample.\n crosscheck_counts.py COUNTDIR\n\"\"\"\nimport sys, os, random, glob\nimport numpy as np\nfrom flint import nmod_poly\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nfrom bound_data import primes_segment\nimport kfield\nP = kfield.pari()\nBp = P(kfield.B_STR)\nfiles = sorted((int(os.path.basename(f)[2:-4].split('_')[0]), int(os.path.basename(f)[2:-4].split('_')[1]), f)\n for f in glob.glob(os.path.join(sys.argv[1], 'r_*_*.bin')))\nrandom.seed(2026)\nnchk = npari = 0\nfor lo, hi, fn in files:\n ps = primes_segment(lo, hi); rb = np.fromfile(fn, dtype=np.uint8)\n assert len(ps) == len(rb)\n idx = list(range(0, min(len(ps), 20000))) + list(range(len(ps) - 20000, len(ps))) + random.sample(range(len(ps)), 20000)\n for i in idx:\n p = int(ps[i]); r = int(rb[i])\n if r == 255:\n assert p in kfield.DISC_B_PRIMES; continue\n f = nmod_poly(kfield.B_COEFFS, p); x = nmod_poly([0, 1], p)\n assert f.gcd(pow(x, p, f) - x).degree() == r, p\n nchk += 1\n if i % 50 == 0:\n assert len(P.polrootsmod(Bp, p)) == r, p; npari += 1\nprint('root counts of nroots.c confirmed for %d primes with FLINT (%d also with PARI polrootsmod)' % (nchk, npari))\n" }, { "path": "anc/code/1.3.8/classgroup/gen_witnesses.py", "size_bytes": 2935, "sha256": "162e85cdbc05fb910e5dd274de78e4094cfac876b56426faca21377dadddbb90", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Propose generators for all prime ideals of K of norm <= C (bnfinit/bnfisprincipal are only PROPOSERS;\nevery generator is re-checked exactly, without PARI's bnf, by check_witnesses.py).\n\n gen_witnesses.py C OUTDIR [--block 50000]\nResumable: rational primes are processed in blocks [lo, hi]; block files OUTDIR/w_lo_hi.jsonl.gz are\nwritten atomically and skipped when present. Record: {\"p\",\"f\",\"r\",\"g\"} with r = root of B mod p for\ndegree-one primes (p not dividing disc(B)); the proposed generator is stored independently of any\nintegral basis, as a polynomial in theta: g = (num[0] + num[1] theta + ... + num[26] theta^26) / den.\n\"\"\"\nimport argparse, gzip, json, os, sys, time\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nimport kfield\nfrom flint import nmod_poly\n\nap = argparse.ArgumentParser()\nap.add_argument('C', type=int); ap.add_argument('outdir'); ap.add_argument('--block', type=int, default=50000)\na = ap.parse_args()\nos.makedirs(a.outdir, exist_ok=True)\nP = kfield.pari()\nnf = kfield.make_nf()\nP.setrand(1)\nt0 = time.time()\nbnf = P.bnfinit(nf, 1)\nprint('bnfinit (proposer only) %.1fs cyc %s' % (time.time() - t0, P('(b)->b.cyc')(bnf)), flush=True)\nbad = set(kfield.DISC_B_PRIMES)\nx = P('x')\n\n\ndef gen(ideal):\n res = P.bnfisprincipal(bnf, ideal, 1)\n assert all(int(c) == 0 for c in res[0]), 'not principal according to bnf?'\n g = P.lift(P('Mod(1, %s)' % kfield.B_STR) * P.nfbasistoalg(nf, res[1])) # polynomial in x = theta\n den = int(P.denominator(P.content(g))) if g.type() == 't_POL' else int(P.denominator(g))\n num = [int(P.polcoef(g * den, j)) for j in range(27)]\n assert any(num)\n return num, den\n\n\nC = a.C\nt0 = time.time(); total = 0\nfor lo in range(2, C + 1, a.block):\n hi = min(lo + a.block - 1, C)\n fn = os.path.join(a.outdir, 'w_%d_%d.jsonl.gz' % (lo, hi))\n if os.path.exists(fn):\n continue\n recs = []\n for pp in P.primes([lo, hi]):\n p = int(pp)\n if p in bad or p * p <= C:\n for pr in P.idealprimedec(nf, p):\n f = int(pr[3])\n if p ** f <= C:\n num, den = gen(pr)\n recs.append(dict(p=p, f=f, r=None, num=num, den=den))\n else:\n fl = nmod_poly(kfield.B_COEFFS, p)\n roots = sorted(int(r) for r, m in fl.roots())\n for r in roots:\n ideal = P.idealhnf(nf, p, P('x') - r)\n assert int(P.idealnorm(nf, ideal)) == p\n num, den = gen(ideal)\n recs.append(dict(p=p, f=1, r=r, num=num, den=den))\n tmp = fn + '.tmp'\n with gzip.open(tmp, 'wt') as fh:\n for rec in recs:\n fh.write(json.dumps(rec, separators=(',', ':')) + '\\n')\n os.replace(tmp, fn)\n total += len(recs)\n print('BLOCK %d %d ideals %d total_this_run %d elapsed %.0fs' % (lo, hi, len(recs), total, time.time() - t0), flush=True)\nprint('DONE', flush=True)\n" }, { "path": "anc/code/1.3.8/classgroup/kfield.py", "size_bytes": 1839, "sha256": "48f5a59c9e8def9ce2db5358956484a208b863b6206d4bc353f482e13516bc1f", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"The bitangent field K = Q(theta), B(theta) = 0, of T6-3, with its unconditionally certified maximal order.\n\nShared by gen_witnesses.py and check_witnesses.py. PARI is used for nfinit/nfcertify (maximal order)\nand idealprimedec (prime ideals over the few primes p <= sqrt(C) or p | disc(B)).\n\"\"\"\nimport cypari2\n\nB_STR = ('x^27 - 48*x^22 + 1344*x^18 + 144*x^17 - 3264*x^13 + 832*x^12 - 40704*x^9 - 4608*x^8'\n ' - 2560*x^7 - 39936*x^4 - 15360*x^3 - 1024*x^2 + 4096')\n# ascending integer coefficients of B\nB_COEFFS = [4096, 0, -1024, -15360, -39936, 0, 0, -2560, -4608, -40704, 0, 0, 832, -3264, 0, 0, 0,\n 144, 1344, 0, 0, 0, -48, 0, 0, 0, 0, 1]\nDISC_B_PRIMES = [2, 11, 41, 198839, 652081, 17743299257028546229859]\nDK = 2**34 * 11**6 * 652081**6\n\n_P = None\n\n\ndef pari():\n global _P\n if _P is None:\n _P = cypari2.Pari()\n _P.allocatemem(10**9, 4 * 10**9, silent=True)\n _P.default('factor_proven', 1)\n return _P\n\n\ndef make_nf():\n P = pari()\n B = P(B_STR)\n assert [int(P.polcoef(B, j)) for j in range(28)] == B_COEFFS\n assert P.polisirreducible(B)\n fa = P.factor(P.poldisc(B))\n assert [int(p) for p in fa[0]] == DISC_B_PRIMES and all(P.isprime(p) for p in fa[0])\n nf = P.nfinit([B, DISC_B_PRIMES])\n assert len(P.nfcertify(nf)) == 0 # maximal order proved\n assert int(nf[2]) == DK and [int(s) for s in nf[1]] == [3, 12]\n return nf\n\n\ndef basis_rows(nf):\n \"\"\"den, rows: den*omega_i = sum_j rows[i][j] theta^j (integers), omega_i = nf.zk[i].\"\"\"\n P = pari()\n zk = list(P('(nf)->nf.zk')(nf))\n raw = [[P.polcoef(z, j) for j in range(27)] for z in zk]\n import math\n den = math.lcm(*(int(c.denominator()) for row in raw for c in row))\n rows = [[int(c * den) for c in row] for row in raw]\n return den, rows, [str(z) for z in zk]\n" }, { "path": "anc/code/1.3.8/classgroup/nroots.c", "size_bytes": 5956, "sha256": "f66ba2c0245941722817924fdb407fbcbab47f3e1940fb030d9e99880ff629cd", "mode": 420, "language": "C", "encoding": "utf-8", "text": "/* nroots.c -- number of roots of the bitangent polynomial B mod p for all primes p in [lo, hi].\n *\n * nroots LO HI OUT writes OUT: one byte per prime p in [LO,HI] (increasing order), the number of\n * roots of B mod p (= number of prime ideals of K of norm p when p does not\n * divide disc(B)); bytes 255 mark primes dividing disc(B) (handled with PARI).\n * prints: count of primes, sum of roots, and a checksum.\n * Method: r(p) = deg gcd(B mod p, x^p - x mod (B, p)), x^p by square-and-multiply with\n * exact 128-bit lazy accumulation; all arithmetic is exact integer arithmetic (requires p < 2^32).\n * B = x^27 - 48x^22 + 1344x^18 + 144x^17 - 3264x^13 + 832x^12 - 40704x^9 - 4608x^8 - 2560x^7\n * - 39936x^4 - 15360x^3 - 1024x^2 + 4096 (the slope polynomial of Section 5.2 of the paper)\n * disc(B) = 2^318 11^6 41^2 198839^2 652081^6 17743299257028546229859^2.\n */\n#include \n#include \n#include \n#include \n#include \ntypedef unsigned __int128 u128;\ntypedef uint64_t u64;\n#define D 27\nstatic const long BC[D+1] = { /* ascending coefficients */\n 4096, 0, -1024, -15360, -39936, 0, 0, -2560, -4608, -40704, 0, 0, 832, -3264, 0, 0, 0, 144, 1344, 0, 0, 0, -48, 0, 0, 0, 0, 1};\nstatic u64 P, NF[D]; /* NF[i] = -B_i mod p */\nstatic u64 R64; /* 2^64 mod p */\nstatic inline u64 mod128(u128 c) { /* c < 2^127 */\n u64 hi = (u64)(c >> 64), lo = (u64)c;\n u64 r = lo % P;\n if (hi) { u128 t = (u128)(hi % P) * R64 + r; r = (u64)(t % P); }\n return r;\n}\nstatic void sqr_mod(u64 *a) { /* a <- a^2 mod (B, p), deg a <= 26 */\n u128 c[2*D-1];\n memset(c, 0, sizeof c);\n for (int i = 0; i < D; i++) { if (!a[i]) continue;\n for (int j = i+1; j < D; j++) c[i+j] += (u128)a[i]*a[j]; }\n for (int k = 0; k < 2*D-1; k++) c[k] <<= 1;\n for (int i = 0; i < D; i++) c[2*i] += (u128)a[i]*a[i];\n for (int k = 2*D-2; k >= D; k--) {\n u64 t = mod128(c[k]);\n if (!t) continue;\n for (int i = 0; i < D; i++) c[k-D+i] += (u128)t*NF[i];\n }\n for (int i = 0; i < D; i++) a[i] = mod128(c[i]);\n}\nstatic void mulx_mod(u64 *a) { /* a <- x*a mod (B, p) */\n u64 t = a[D-1];\n for (int i = D-1; i > 0; i--) a[i] = (u64)(((u128)t*NF[i] + a[i-1]) % P);\n a[0] = (u64)(((u128)t*NF[0]) % P);\n}\nstatic u64 inv(u64 a) { /* a^-1 mod P, a != 0 */\n long long t = 0, nt = 1; u64 r = P, nr = a;\n while (nr) { u64 q = r / nr; long long tmp = t - (long long)q*nt; t = nt; nt = tmp; u64 tr = r - q*nr; r = nr; nr = tr; }\n if (t < 0) t += P; return (u64)t;\n}\nstatic int gcd_deg(u64 *g, int dg) { /* deg gcd(B mod p, g), g of degree <= dg < 27 */\n u64 A[D+1], Bv[D+1]; int da = D, db = dg;\n for (int i = 0; i < D; i++) A[i] = (P - NF[i]) % P; A[D] = 1;\n for (int i = 0; i <= D; i++) Bv[i] = i <= dg ? g[i] : 0;\n while (db >= 0 && Bv[db] == 0) db--;\n u64 *a = A, *b = Bv;\n while (db >= 0) { /* a <- a mod b */\n u64 il = inv(b[db]);\n while (da >= db) {\n u64 q = (u64)(((u128)a[da]*il) % P);\n if (q) for (int i = 0; i <= db; i++) a[da-db+i] = (a[da-db+i] + (u128)(P - q)*b[i]) % P;\n da--; while (da >= 0 && a[da] == 0) da--;\n }\n u64 *t = a; a = b; b = t; int td = da; da = db; db = td;\n }\n return da; /* degree of last nonzero remainder */\n}\nstatic int nroots(u64 p) {\n P = p; R64 = (u64)(((u128)1 << 64) % p);\n for (int i = 0; i < D; i++) { long c = BC[i] % (long)p; if (c < 0) c += p; NF[i] = c ? p - c : 0; }\n u64 a[D]; memset(a, 0, sizeof a); a[1] = 1; /* a = x */\n int top = 63 - __builtin_clzll(p);\n for (int b = top-1; b >= 0; b--) { sqr_mod(a); if ((p >> b) & 1) mulx_mod(a); }\n a[1] = (a[1] + p - 1) % p; /* x^p - x */\n int dg = D-1; while (dg >= 0 && a[dg] == 0) dg--;\n if (dg < 0) return D; /* x^p = x mod B: B splits completely */\n return gcd_deg(a, dg);\n}\nstatic int bad(u64 p) { return p == 2 || p == 11 || p == 41 || p == 198839 || p == 652081; }\nint main(int argc, char **argv) {\n if (argc < 4) { fprintf(stderr, \"usage: nroots LO HI OUT\\n\"); return 1; }\n u64 lo = strtoull(argv[1], 0, 10), hi = strtoull(argv[2], 0, 10);\n if (hi >= (1ULL << 32) || lo < 2 || lo > hi) { fprintf(stderr, \"range\\n\"); return 1; }\n FILE *out = fopen(argv[3], \"wb\"); if (!out) return 1;\n u64 sq = (u64)sqrt((double)hi) + 2;\n char *small = calloc(sq + 1, 1); /* small primes for segmented sieve */\n for (u64 i = 2; i <= sq; i++) if (!small[i]) for (u64 j = i*i; j <= sq; j += i) small[j] = 1;\n u64 *sp = malloc(sizeof(u64) * (sq + 1)); int nsp = 0;\n for (u64 i = 2; i <= sq; i++) if (!small[i]) sp[nsp++] = i;\n const u64 SEG = 1 << 22; char *seg = malloc(SEG);\n unsigned char *buf = malloc(SEG);\n u64 nprimes = 0, sumr = 0, hash = 1469598103934665603ULL; /* FNV-1a over (p, r) */\n for (u64 s = lo; s <= hi; s += SEG) {\n u64 e = s + SEG - 1; if (e > hi) e = hi;\n memset(seg, 0, e - s + 1);\n for (int k = 0; k < nsp; k++) { u64 q = sp[k]; if (q*q > e) break;\n u64 st = (s + q - 1) / q * q; if (st < q*q) st = q*q;\n for (u64 j = st; j <= e; j += q) seg[j - s] = 1; }\n size_t nb = 0;\n for (u64 n = s; n <= e; n++) { if (n < 2 || seg[n - s]) continue;\n int r = bad(n) ? 255 : nroots(n);\n buf[nb++] = (unsigned char)r; nprimes++; if (r != 255) sumr += r;\n for (int t = 0; t < 8; t++) { hash ^= (n >> (8*t)) & 255; hash *= 1099511628211ULL; }\n hash ^= (u64)r; hash *= 1099511628211ULL; }\n fwrite(buf, 1, nb, out); fflush(out);\n fprintf(stderr, \"SEG %llu %llu primes %llu sumroots %llu\\n\", (unsigned long long)s, (unsigned long long)e,\n (unsigned long long)nprimes, (unsigned long long)sumr);\n }\n fclose(out);\n printf(\"RANGE %llu %llu PRIMES %llu SUMROOTS %llu FNV %016llx\\n\", (unsigned long long)lo, (unsigned long long)hi,\n (unsigned long long)nprimes, (unsigned long long)sumr, (unsigned long long)hash);\n return 0;\n}\n" }, { "path": "anc/code/1.3.8/classgroup/run_counts.sh", "size_bytes": 531, "sha256": "8937999770fa36cb1f17ca2918205e698c909d234d29400af923efbdbe2abec1", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/bash\n# Resumable root counting for all primes p < R = 5*10^8 in chunks (one worker).\ncd \"$(dirname \"$0\")\"\nOUT=../work/counts # i.e. code/1.3.8/work/counts\nmkdir -p $OUT\nfor lo in 2 100000001 200000001 300000001 400000001; do\n if [ $lo = 2 ]; then hi=100000000; else hi=$((lo + 99999999)); fi\n [ $hi -gt 499999999 ] && hi=499999999\n f=$OUT/r_${lo}_${hi}.bin\n if [ -f $f.done ]; then continue; fi\n ./nroots $lo $hi $f > $OUT/r_${lo}_${hi}.out 2> $OUT/r_${lo}_${hi}.log && touch $f.done\ndone\necho ALLDONE > $OUT/ALLDONE\n" }, { "path": "anc/code/1.3.8/classgroup/run_witnesses.sh", "size_bytes": 189, "sha256": "7bf35ad617e346267ef9b3b3329e63cbce0c8deb2e8abcb77f56b0ccf1c50147", "mode": 420, "language": "shell", "encoding": "utf-8", "text": "#!/bin/bash\n# Resumable generator proposals for all prime ideals of norm <= C = 10^6 (one worker).\ncd \"$(dirname \"$0\")\"\n${PY:-python3} gen_witnesses.py 1000000 data/witnesses --block 50000\n" }, { "path": "anc/code/1.3.8/classgroup/smallprimes.py", "size_bytes": 1137, "sha256": "a508c389a00298421a98db77d202bb47b0775b7ee9a8c11583806b76995529f1", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"All prime ideals of K over the primes p <= X0 and over the primes dividing disc(B), from PARI's\nidealprimedec in the certified maximal order (nfcertify = []). Output: JSON {p: [f_1, f_2, ...]}.\n python3 smallprimes.py X0 OUT.json\n\"\"\"\nimport json, sys, cypari2\nP = cypari2.Pari(); P.allocatemem(10**9, silent=True)\nP.default('factor_proven', 1)\nB = P('x^27 - 48*x^22 + 1344*x^18 + 144*x^17 - 3264*x^13 + 832*x^12 - 40704*x^9 - 4608*x^8 - 2560*x^7 - 39936*x^4 - 15360*x^3 - 1024*x^2 + 4096')\nfa = P.factor(P.poldisc(B))\nbad = [int(p) for p in fa[0]]\nassert bad == [2, 11, 41, 198839, 652081, 17743299257028546229859], bad\nnf = P.nfinit([B, bad])\nassert len(P.nfcertify(nf)) == 0\nX0 = int(sys.argv[1])\nout = {}\nps = sorted(set(int(p) for p in P.primes([2, X0])) | set(bad[:-1]))\nfor p in ps:\n out[p] = sorted(int(pr[3]) for pr in P.idealprimedec(nf, p))\n assert sum(int(pr[2]) * int(pr[3]) for pr in P.idealprimedec(nf, p)) == 27\njson.dump(out, open(sys.argv[2], 'w'))\nprint('primes', len(out), 'prime ideals', sum(len(v) for v in out.values()),\n 'of degree 1', sum(v.count(1) for v in out.values()))\n" }, { "path": "anc/code/1.3.8/curve/count_points.c", "size_bytes": 3044, "sha256": "7919a8b645ca7eaeeedb412a21d98482bd3214e3de8a641eeb4eb957f15d6d48", "mode": 420, "language": "C", "encoding": "utf-8", "text": "/* count_points.c -- #C(F_{p^k}) for C: x^4 - y^3 z + x y z^2 + x z^3 = 0, by brute force.\n * F_q = F_p[t]/(m(t)) with m monic irreducible of degree k (found by search; k <= 3 so\n * irreducible <=> no root in F_p). Affine points (z = 1) are counted over all (x, y) in F_q^2;\n * the only point with z = 0 is (0:1:0). usage: count_points p k\n */\n#include \n#include \nstatic int p, k, q, m[4];\nstatic int *MUL; /* not used for large q */\nstatic int add(int a, int b) { int r = 0, pw = 1; for (int i = 0; i < k; i++) { r += ((a % p + b % p) % p) * pw; a /= p; b /= p; pw *= p; } return r; }\nstatic int mul(int a, int b) {\n int A[3] = {0}, Bv[3] = {0}, c[5] = {0};\n for (int i = 0; i < k; i++) { A[i] = a % p; a /= p; Bv[i] = b % p; b /= p; }\n for (int i = 0; i < k; i++) for (int j = 0; j < k; j++) c[i+j] = (c[i+j] + A[i]*Bv[j]) % p;\n for (int d = 2*k-2; d >= k; d--) { int t = c[d]; c[d] = 0; for (int i = 0; i < k; i++) c[d-k+i] = ((c[d-k+i] - t*m[i]) % p + p) % p; }\n int r = 0, pw = 1; for (int i = 0; i < k; i++) { r += c[i]*pw; pw *= p; } return r;\n}\nint main(int argc, char **argv) {\n p = atoi(argv[1]); k = atoi(argv[2]); q = 1; for (int i = 0; i < k; i++) q *= p;\n if (k > 1) { /* find monic irreducible m of degree k: no roots (k <= 3) */\n for (int c = 0; ; c++) { int cc = c; for (int i = 0; i < k; i++) { m[i] = cc % p; cc /= p; }\n int ok = 1; for (int x = 0; x < p && ok; x++) { long v = 1; for (int i = k-1; i >= 0; i--) v = (v*x + m[i]) % p; /* x^k + ... */\n long val = 1; for (int i = 0; i < k; i++) val = val * x % p; long s = 0, pw = 1; for (int i = 0; i < k; i++) { s = (s + m[i]*pw) % p; pw = pw*x % p; }\n if ((val + s) % p == 0) ok = 0; (void)v; }\n if (ok) break; }\n }\n /* exp/log tables w.r.t. a generator of F_q^* */\n int *lg = malloc(sizeof(int)*q), *ex = malloc(sizeof(int)*2*q);\n for (int g = 2; g < q || q == 2; g++) {\n int x = 1, n = 0; do { x = mul(x, g); n++; } while (x != 1 && n < q);\n if (n == q - 1) { x = 1; for (int i = 0; i < 2*(q-1); i++) { ex[i] = x; if (i < q-1) lg[x] = i; x = mul(x, g); } break; }\n }\n /* addition and negation tables by digits */\n int *neg = malloc(sizeof(int)*q); for (int a = 0; a < q; a++) { int r = 0, pw = 1, aa = a; for (int i = 0; i < k; i++) { r += ((p - aa % p) % p)*pw; aa /= p; pw *= p; } neg[a] = r; }\n #define MULT(a,b) (((a)==0||(b)==0)?0:ex[lg[a]+lg[b]])\n int *ADD = malloc(sizeof(int)*(size_t)q*q > 0 && q <= 30000 ? sizeof(int) : 1);\n (void)ADD;\n long N = 1; /* (0:1:0) */\n /* for each x: c(x) = x^4 + x; count y with y^3 - x y = c(x) <=> x^4 - y^3 + x y + x = 0 */\n int *val = malloc(sizeof(int)*q); int *cnt = calloc(q, sizeof(int));\n int *y3 = malloc(sizeof(int)*q); for (int y = 0; y < q; y++) y3[y] = MULT(y, MULT(y, y));\n for (int x = 0; x < q; x++) {\n int x2 = MULT(x, x), cx = add(MULT(x2, x2), x);\n long c = 0;\n for (int y = 0; y < q; y++) { int v = add(y3[y], neg[MULT(x, y)]); if (v == cx) c++; }\n N += c;\n }\n printf(\"p %d k %d q %d N %ld\\n\", p, k, q, N);\n return 0;\n}\n" }, { "path": "anc/code/1.3.8/curve/curve.py", "size_bytes": 4627, "sha256": "c59436e19a0cc15b078be997f73963242bed1c6ef0ae17a97b5e80160e0f0fec", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"T6-3, Section 1 checks: the curve C: G = x^4 - y^3 z + x y z^2 + x z^3 = 0.\n (a) points with a zero coordinate; (b) singular points over F_p-bar for all odd p (exact elimination);\n (c) the nodes at 11 and 652081: ordinary, and the plane model is regular there; (d) #C(F_{p^k}),\n L-polynomials and #J(F_p) for p = 3, 5, 7, 17, 29 (brute-force counts by count_points.c);\n (e) torsion: J(Q)[2] = 0 and #J(Q)_tors | 3; (f) C(F_3).\n\"\"\"\nimport subprocess, os, math\nfrom fractions import Fraction as Fr\nfrom sympy import symbols, expand, factorint, Poly, resultant, groebner, S\nx, y, z = symbols('x y z')\nG = x**4 - y**3*z + x*y*z**2 + x*z**3\nF = G.subs(z, 1) # affine chart z = 1\nFx, Fy, Fz = (expand(G.diff(v)) for v in (x, y, z))\nprint('(a) x=0:', expand(G.subs(x, 0)), '| y=0:', Poly(G.subs(y, 0), x).factor_list(), '| z=0:', expand(G.subs(z, 0)))\n# (b) singular points. z = 0 forces x = 0, i.e. (0:1:0), where dG/dz = -1: smooth for every p.\nassert expand(G.subs({x: 0, y: 1}).diff(z) if False else Fz.subs({x: 0, y: 1, z: 0})) == -1\n# affine (odd p: Euler's relation 4G = xGx + yGy + zGz makes F = Fx = Fy = 0 sufficient)\nfx, fy = expand(F.diff(x)), expand(F.diff(y))\nprint(' F_x =', fx, ' F_y =', fy)\n# p = 3: F_y = -3y^2 + x = x mod 3 ... done separately below by brute force over F_3-bar? use Groebner over GF(3)\nfor p in (3, 5):\n gb = groebner([F, fx, fy], x, y, modulus=p)\n print(' Groebner basis of (F, F_x, F_y) over F_%d:' % p, list(gb))\n assert list(gb) == [1]\n# p not in {2,3,5}: from F_y = 0, x = 3y^2; then (eliminating)\nY = symbols('Y')\ne1 = expand(fx.subs(x, 3*y**2)) # -108 y^6 - y - 1\ne2 = expand(F.subs(x, 3*y**2)) # -y^2 (81 y^6 + 2 y + 3)\nprint(' after x = 3y^2:', e1, '|', Poly(e2, y).factor_list())\nlin = expand(4*expand(-e2/y**2) - 3*(-e1))\nprint(' 4*(81y^6+2y+3) - 3*(108y^6+y+1) =', lin)\nval = Fr(108) * Fr(-9, 5)**6 + Fr(-9, 5) + 1\nprint(' 108y^6+y+1 at y=-9/5 =', val, '=', factorint(val.numerator), '/', factorint(val.denominator))\nassert val == Fr(57383128, 15625) and factorint(57383128) == {2: 3, 11: 1, 652081: 1}\n# (c) the node at p = 11, 652081\nfor p in (11, 652081):\n y0 = (-9 * pow(5, -1, p)) % p\n x0 = (3 * y0 * y0) % p\n vals = [int(expand(e).subs({x: x0, y: y0})) % p for e in (F, fx, fy)]\n H = (int((-12 * x0 * x0) % p) * int((6 * y0) % p) - 1) % p # F_xx F_yy - F_xy^2\n Fl = int(F.subs({x: x0, y: y0})) # integer lift\n print('(c) p=%d: singular point (x,y)=(%d,%d) mod p; F,Fx,Fy mod p = %s; Hessian det mod p = %d (nonzero: ordinary node);'\n ' F(lift) mod p^2 = %d (nonzero: plane model regular at the node)' % (p, x0, y0, vals, H, Fl % (p * p)))\n assert vals == [0, 0, 0] and H != 0 and Fl % (p * p) != 0\n# (d) point counts and L-polynomials\nhere = os.path.dirname(os.path.abspath(__file__))\ndef N(p, k):\n out = subprocess.run([os.path.join(here, 'count_points'), str(p), str(k)], capture_output=True, text=True).stdout\n return int(out.split()[-1])\norders = {}\nfor p in (3, 5, 7, 17, 29):\n Ns = [N(p, k) for k in (1, 2, 3)]\n s = [p**k + 1 - Ns[k - 1] for k in (1, 2, 3)] # power sums of Frobenius eigenvalues\n e1 = Fr(s[0]); e2 = (e1 * s[0] - s[1]) / 2; e3 = (e2 * s[0] - e1 * s[1] + s[2]) / 3\n a = [1, -e1, e2, -e3, p * e2, -p * p * e1, p**3]\n assert all(Fr(c).denominator == 1 for c in a)\n a = [int(c) for c in a]\n orders[p] = sum(a)\n print('(d) p=%2d N=%s L=%s #J(F_p)=%d = %s' % (p, Ns, a, orders[p], factorint(orders[p])))\ng = 0\nfor p in (5, 7, 17, 29): g = math.gcd(g, orders[p])\nprint('(e) #J(F_17) odd:', orders[17] % 2 == 1, '; gcd(#J(F_p), p=5,7,17,29) =', g)\nassert orders[17] % 2 == 1 and g == 3\n# (f) C(F_3)\npts = ['(0:1:0)'] + ['(%d:%d:1)' % (a_, b_) for a_ in range(3) for b_ in range(3) if (a_**4 - b_**3 + a_ * b_ + a_) % 3 == 0]\nprint('(f) C(F_3) =', pts)\nassert pts == ['(0:1:0)', '(0:0:1)', '(2:0:1)']\n# (g) C(R) is connected: disc_y(y^3 - x y - (x^4 + x)) = x^2 (4x - 27 (x^3+1)^2) <= 0 for all real x\nfrom sympy import discriminant, sturm, real_roots\ndsc = expand(discriminant(y**3 - x*y - (x**4 + x), y))\nassert expand(dsc - x**2 * (4*x - 27*(x**3 + 1)**2)) == 0\nq = Poly(4*x - 27*(x**3 + 1)**2, x)\nnreal = len(real_roots(q))\nprint('(g) disc_y =', dsc, '= x^2 (4x - 27(x^3+1)^2); real roots of the second factor:', nreal, '; value at 0:', q.eval(0))\nassert nreal == 0 and q.eval(0) < 0\nprint(' so for every real x the cubic in y has exactly one real root (a triple root 0 at x = 0): C(R) is connected')\nprint('ALL CURVE CHECKS PASSED')\n" }, { "path": "anc/code/1.3.8/descent/bitangents.gp", "size_bytes": 2182, "sha256": "5cb13def2f7eba6f23349872a92b2c37083f580b841ef5d8a1ca67624f08aa4f", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ T6-3: the 27 bitangents y = m x + k (z = 1) other than the hyperflex line z = 0.\n\\\\ G(x, m x + k, 1) = x^4 - (m x + k)^3 + x (m x + k) + x must equal (x^2 + u x + v)^2.\ndefault(parisize, 10^9);\nG(X,Y) = X^4 - Y^3 + X*Y + X;\n\\\\ generic slope m, intercept k: compare coefficients\nP = G('x, 'm*'x + 'k) ;\nc3 = polcoef(P,3,'x); c2 = polcoef(P,2,'x); c1 = polcoef(P,1,'x); c0 = polcoef(P,0,'x);\nu = c3/2; v = (c2 - u^2)/2;\nE1 = c1 - 2*u*v; E2 = c0 - v^2; \\\\ both must vanish\nR = polresultant(numerator(E1), numerator(E2), 'k);\nfa = factor(R); print(\"Res_k = \", fa);\nB = 'm^27 - 48*'m^22 + 1344*'m^18 + 144*'m^17 - 3264*'m^13 + 832*'m^12 - 40704*'m^9 - 4608*'m^8 - 2560*'m^7 - 39936*'m^4 - 15360*'m^3 - 1024*'m^2 + 4096;\nprint(\"B is a factor of Res_k: \", polresultant(B, R) == 0 && R % B == 0);\nprint(\"B irreducible: \", polisirreducible(B), \" squarefree: \", poldisc(B) != 0);\n\\\\ intercept k(theta) over K = Q[m]/B: gcd of E1, E2 as polynomials in k over K\nBt = subst(B, 'm, 't);\nE1t = subst(subst(numerator(E1), 'm, Mod('t, Bt)), 'k, 'y);\nE2t = subst(subst(numerator(E2), 'm, Mod('t, Bt)), 'k, 'y);\ng = gcd(E1t, E2t); print(\"deg gcd_k(E1,E2) over K = \", poldegree(g, 'y));\nkt = -polcoef(g,0,'y)/polcoef(g,1,'y); \\\\ k(theta) as Mod(.., B(t))\n\\\\ identity check in K[x]\nut = -Mod('t,Bt)^3/2; vt = (Mod('t,Bt) - 3*Mod('t,Bt)^2*kt - ut^2)/2;\nD = G('x, Mod('t,Bt)*'x + kt) - ('x^2 + ut*'x + vt)^2;\nprint(\"G(x, theta x + k(theta), 1) == (x^2+ux+v)^2 in K[x]: \", D == 0);\n\\\\ compare with the printed k(theta) of the paper (Appendix C.3), if supplied\nkpaper = read(\"k_paper.gp\");\nprint(\"k(theta) equals the paper's k(theta): \", kt == Mod(subst(kpaper, 'th, 't), Bt));\nprint(\"N(theta - k(theta)) = \", factor(norm(Mod('t,Bt) - kt)), \" N(-k(theta)) = \", factor(norm(-kt)));\nprint(\"issquare(N(theta-k)) \", issquare(norm(Mod('t,Bt) - kt)), \" issquare(N(-k)) \", issquare(norm(-kt)));\n\\\\ factorization of B over Q_2 and Frobenius cycle types\nprint(\"B over Q_2: degrees \", vecsort(apply(poldegree, factorpadic(Bt, 2, 200)[,1]~)));\nprint(\"B mod 3 degrees: \", vecsort(apply(poldegree, factormod(Bt, 3)[,1]~)), \" mod 113: \", vecsort(apply(poldegree, factormod(Bt, 113)[,1]~)));\nquit\n" }, { "path": "anc/code/1.3.8/descent/k_paper.gp", "size_bytes": 1851, "sha256": "d31969850054412a7894dfdf94167bdbae5494e261ced1df3f9be3bd41a085d9", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "-26951359201926579672372588105/592488264170292278295577730011136*th^26+8496081214743764150516921265/148122066042573069573894432502784*th^25-287622866848681413172661175/4628814563830408424184201015712*th^24+9678270027056704046146431225/148122066042573069573894432502784*th^23-1424240468696092889568906009/74061033021286534786947216251392*th^22+326427420042341244461302951725/148122066042573069573894432502784*th^21-102644777665974249342300051135/37030516510643267393473608125696*th^20+111197727131378584438626415575/37030516510643267393473608125696*th^19-116916731084799077369395389525/37030516510643267393473608125696*th^18-2229797248384386454343310155283/37030516510643267393473608125696*th^17+1287837684042312263232190002525/18515258255321633696736804062848*th^16-688316285422128063574436196645/9257629127660816848368402031424*th^15+360534722354806850939892351075/4628814563830408424184201015712*th^14-142494617551666198916076749505/9257629127660816848368402031424*th^13+1602701086983721272243848449629/9257629127660816848368402031424*th^12-2285101296890972479023166783215/9257629127660816848368402031424*th^11+159024433683809388367830737415/578601820478801053023025126964*th^10-671031131909504864680106410475/2314407281915204212092100507856*th^9+4539632299441199237072451067137/2314407281915204212092100507856*th^8-5137141619207878594271810122347/2314407281915204212092100507856*th^7+5704159238507976471075415935645/2314407281915204212092100507856*th^6-377573675196125230104209516655/144650455119700263255756281741*th^5+387162578608641222322582522631/578601820478801053023025126964*th^4+534051179908519027818666862863/578601820478801053023025126964*th^3-484670070054796829975946732141/578601820478801053023025126964*th^2+120601232696157484782966583425/144650455119700263255756281741*th-126446621433258556895339352500/144650455119700263255756281741\n" }, { "path": "anc/code/1.3.8/descent/paper_sunits.py", "size_bytes": 2192, "sha256": "121a272eadb9af575f972685fedf16c8d51b26b2d63214b66f4cda0e3c8b358a", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Cross-check of the paper's printed basis of K(2,S) (Appendix C.3): exact norms as printed, S-units,\nindependent mod squares, and the printed Selmer generator u1 u2 u3 u4 == theta - k(theta) mod squares.\"\"\"\nimport sys, os, json\nfrom fractions import Fraction\nfrom flint import fmpz_poly, nmod_poly\nsys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'classgroup'))\nimport kfield\nP = kfield.pari(); nf = kfield.make_nf()\nhere = os.path.dirname(os.path.abspath(__file__))\nels = json.load(open(os.path.join(here, 'paper_sunits.json')))\nBf = fmpz_poly(kfield.B_COEFFS)\ndef norm(a):\n a = P.lift(P('Mod(1,%s)' % kfield.B_STR) * a)\n if a.type() != 't_POL': return Fraction(int(a)) ** 27\n d = int(P.denominator(P.content(a)))\n return Fraction(int(Bf.resultant(fmpz_poly([int(P.polcoef(a * d, j)) for j in range(int(P.poldegree(a)) + 1)]))), d ** 27)\ngens = []\nfor e in els:\n a = P(e['expr'].replace('th', 'x'))\n N = norm(a)\n assert N == Fraction(e['norm']), (e['name'], N, e['norm'])\n c = P.nfalgtobasis(nf, a)\n assert all(P.denominator(x) == 1 for x in c), e['name'] # integral\n gens.append(a)\nprint('printed norms confirmed exactly; all 19 elements integral, norms +-1, +-2, +-4 -> S-units')\nk = P(open(os.path.join(here, 'k_paper.gp')).read().strip().replace('th', 'x'))\nd1 = P.lift(P('Mod(x - (%s), %s)' % (k, kfield.B_STR)))\ncpr = []\np = 3\nwhile len(cpr) < 450:\n p = int(P.nextprime(p + 1))\n if p in kfield.DISC_B_PRIMES: continue\n for r, m in nmod_poly(kfield.B_COEFFS, p).roots(): cpr.append((p, int(r)))\ndef ev(a, p, r):\n return int(P.lift(P.Mod(P.subst(a, 'x', r), p))) if a.type() == 't_POL' else int(a) % p\ncpr = [(p, r) for p, r in cpr if ev(d1, p, r) % p]\nchi = lambda a: [0 if pow(ev(a, p, r), (p - 1) // 2, p) == 1 else 1 for p, r in cpr]\nM = [chi(g) for g in gens]\nassert int(P.matrank(P.Mod(1, 2) * P.matrix(19, len(cpr), [x for r in M for x in r]))) == 19\nprod = [sum(M[i][j] for i in (1, 2, 3, 4)) % 2 for j in range(len(cpr))]\nprint('19 printed elements independent mod squares (rank 19); u1u2u3u4 == theta - k(theta) mod squares:', prod == chi(d1))\nassert prod == chi(d1)\n" }, { "path": "anc/code/1.3.8/descent/selmer.py", "size_bytes": 12816, "sha256": "93697606d93dd6888beb164b8334f767b75212abc25a594263243dde0e62aff5", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"T6-3 fake 2-Selmer group: dim Sel_fake = 1 (given Cl(K)[2] = 0, certified separately).\n\n 1. S-units: proposed by bnfinit/bnfsunit (GRH-dependent PROPOSERS only); accepted after exact checks:\n each u has 2^m u integral and |N(u)| a power of 2 (so (u) is supported above 2); the 19 elements\n -1, 14 units, 4 S-units are independent in K^x/K^x2 (quadratic characters at degree-1 primes, rank 19),\n hence a basis of O_{K,S}^x / squares (dimension r1+r2-1+#S+1 = 19).\n 2. Real signs at the 3 real places (FLINT arb, cross-checked with PARI nfeltsign).\n 3. Square classes in K_v (v | 2) via ideallog in (O_K/q)^x for a power q of each prime above 2 (as in the proof)\n (rank of the pairing matrix = 2 + [K_v:Q_2] proves spanning, by nondegeneracy).\n 4. Local image at 2 from points of C(Q_2): dimension 4 = upper bound 3 + dim J(Q_2)[2] <= 4.\n 5. Sel_fake = {a in K(2,S): a >> 0, N(a) in Q^x2, res_2(a) in W_2}: dimension 1, spanned by theta - k(theta).\n\"\"\"\nimport sys, os, json, random, time\nimport cypari2\nfrom flint import fmpz_poly, arb, acb, ctx\nsys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'classgroup'))\nimport kfield\nP = kfield.pari()\nnf = kfield.make_nf()\nth = P('Mod(x, %s)' % kfield.B_STR)\nkpaper = P(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'k_paper.gp')).read().strip())\nk = P.subst(P.lift(kpaper) if False else kpaper, 'th', 'x')\nk = P('Mod(%s, %s)' % (k, kfield.B_STR))\n# k(theta) solves the bitangent equations (checked in bitangents.gp); recheck the identity here\nG = lambda X, Y: X**4 - Y**3 + X*Y + X\nu_ = -th**3 / 2; v_ = (th - 3 * th**2 * k - u_**2) / 2\nX = P('xx')\nassert G(X, th * X + k) - (X**2 + u_ * X + v_)**2 == 0\nprint('bitangent identity re-checked')\n\n# ---------------------------------------------------------------- 1. S-units\nP.setrand(1)\nbnf = P.bnfinit(nf, 1)\nS = P.idealprimedec(nf, 2)\nprint('primes above 2 (e,f):', [(int(pr[2]), int(pr[3])) for pr in S])\nsu = P.bnfsunit(bnf, S)\nfu = list(P('(b)->b.fu')(bnf))\nsus = list(su[0])\ngens = [P(-1)] + [P.lift(P.nfbasistoalg(nf, P.nfalgtobasis(nf, u))) for u in fu] + \\\n [P.lift(P.nfbasistoalg(nf, P.nfalgtobasis(nf, u))) for u in sus]\nnames = ['-1'] + ['u%d' % (i + 1) for i in range(len(fu))] + ['pi%d' % (i + 1) for i in range(len(sus))]\nassert len(gens) == 19, len(gens)\nBf = fmpz_poly(kfield.B_COEFFS)\n\n\ndef exact_norm(a):\n \"\"\"N_{K/Q}(a) for a in Q[x]/(B) (a polynomial of degree < 27 or a rational), via FLINT resultant.\"\"\"\n from fractions import Fraction\n a = P.lift(P('Mod(1, %s)' % kfield.B_STR) * a)\n if a.type() != 't_POL':\n return Fraction(int(P.numerator(a)), int(P.denominator(a))) ** 27\n d = int(P.denominator(P.content(a)))\n co = [int(P.polcoef(a * d, j)) for j in range(int(P.poldegree(a)) + 1)]\n return Fraction(int(Bf.resultant(fmpz_poly(co))), d ** 27)\n\n\nfor nm, g in zip(names, gens):\n c = P.nfalgtobasis(nf, g)\n m = 0\n while not all(P.denominator(ci * 2**m) == 1 for ci in c):\n m += 1\n N = exact_norm(g)\n num, den = abs(N.numerator), N.denominator\n pow2 = lambda t: t & (t - 1) == 0\n assert pow2(num) and pow2(den), (nm, N)\n if nm.startswith('u') or nm == '-1':\n assert m == 0 and abs(N) == 1, (nm, m, N)\nprint('19 S-units checked exactly: units integral of norm +-1; S-units with norm +-2^k (after scaling by 2^m)')\n\n# quadratic characters at degree-one primes l = (p, theta - r), p not dividing 2*disc(B)\ndef evalmod(a, r, p):\n a = P.lift(P('Mod(1,%s)' % kfield.B_STR) * a) if a.type() == 't_POL' or True else a\n return int(P.lift(P.Mod(P.subst(a, 'x', r), p))) if a.type() == 't_POL' else int(P.lift(P.Mod(a, p)))\n\n\ndef charvec(a, primes):\n out = []\n for p, r in primes:\n val = evalmod(a, r, p)\n assert val % p != 0\n out.append(0 if pow(val, (p - 1) // 2, p) == 1 else 1)\n return out\n\n\nfrom flint import nmod_poly\nbad = set(kfield.DISC_B_PRIMES)\ncprimes = []\np = 3\nwhile len(cprimes) < 400:\n p = int(P.nextprime(p + 1))\n if p in bad: continue\n for r, mlt in nmod_poly(kfield.B_COEFFS, p).roots():\n cprimes.append((p, int(r)))\ncprimes = cprimes[:400]\nM = P.matrix(19, 400, [x for g in gens for x in charvec(g, cprimes)])\nrk = int(P.matrank(P.Mod(1, 2) * M))\nprint('rank of the 19 x 400 quadratic-character matrix over F_2:', rk, '(primes q <= %d)' % cprimes[-1][0])\nassert rk == 19\n\n# ---------------------------------------------------------------- 2. real signs\nctx.prec = 300\n# rigorous isolating balls of all 27 roots; a ball meeting the real axis contains a real root (the\n# conjugate root lies in the conjugate ball, and the balls are disjoint); polsturm gives 3 real roots\nallr = [z for z, mlt in Bf.complex_roots()]\nassert len(allr) == 27 and int(P.polsturm(P(kfield.B_STR))) == 3\nreals = sorted([z.real for z in allr if z.imag.contains(0)], key=lambda t: float(t.mid()))\nassert len(reals) == 3\n\n\ndef signs(a):\n out = []\n a = P.lift(P('Mod(1,%s)' % kfield.B_STR) * a)\n co = [P.polcoef(a, j) for j in range(27)]\n for t in reals:\n s = arb(0)\n for c in reversed(co):\n s = s * t + arb(int(P.numerator(c))) / int(P.denominator(c))\n assert not s.contains(0)\n out.append(0 if s > 0 else 1)\n return out\n\n\nSG = [signs(g) for g in gens]\nfor g, sv in zip(gens, SG):\n ps = [0 if int(x) == 1 else 1 for x in P.nfeltsign(nf, g)]\n assert ps == sv\nprint('real signs (arb, = PARI nfeltsign) computed')\n\n# ---------------------------------------------------------------- 3. square-class coordinates at v | 2\n# K_v^x/K_v^x2 = x U_v/U_v^2 and U_v/U_v^2 = (O/p^(2e+1))^x / squares (a unit = 1 mod 4 pi is a square).\n# Coordinates: (v(a) mod 2, ideallog(a pi^-v(a)) mod 2 on the even cyclic factors). Cross-checked below\n# against PARI's nfislocalpower on random products.\nlocs = []\nfor pr in S:\n e_, f_ = int(pr[2]), int(pr[3])\n bid = P.idealstar(nf, P.idealpow(nf, pr, 2 * e_ + 1), 1)\n cyc = [int(c) for c in P('(b)->b.cyc')(bid)]\n even = [i for i, c in enumerate(cyc) if c % 2 == 0]\n assert len(even) == 1 + e_ * f_, (cyc, e_, f_)\n pi = P.lift(P.nfbasistoalg(nf, pr[1])) # pr = (2, pi): v_pr(pi) = 1 (checked)\n if int(P.nfeltval(nf, pi, pr)) != 1:\n pi = P.lift(P.nfbasistoalg(nf, P.idealtwoelt(nf, pr)[1] if False else pr[1])) + 2\n assert int(P.nfeltval(nf, pi, pr)) == 1\n locs.append((pr, bid, even, pi))\n print('v | 2 with (e,f)=(%d,%d): (O/p^%d)^x has %d even cyclic factors = 1+[K_v:Q_2]' % (e_, f_, 2 * e_ + 1, len(even)))\n\n\ndef loc2(a):\n out = []\n for pr, bid, even, pi in locs:\n w = int(P.nfeltval(nf, a, pr))\n u = P.lift(P('Mod(1,%s)' % kfield.B_STR) * a * pi ** (-w))\n lg = P.ideallog(nf, u, bid)\n out += [w % 2] + [int(lg[i]) % 2 for i in even]\n return out\n\n\nassert sum(1 + len(ev) for _, _, ev, _ in locs) == 35\n# cross-check against nfislocalpower on random products of the generators\nrandom.seed(5)\nfor trial in range(12):\n sel = [random.randint(0, 1) for _ in range(19)]\n a = P(1)\n for s_, g in zip(sel, gens):\n if s_: a = P.lift(P('Mod(1,%s)' % kfield.B_STR) * a * g)\n vec = loc2(a)\n off = 0\n for pr, bid, even, pi in locs:\n part = vec[off: off + 1 + len(even)]; off += 1 + len(even)\n assert (not any(part)) == bool(int(P.nfislocalpower(nf, pr, a, 2))), 'coordinate check failed'\nprint('square-class coordinates agree with nfislocalpower on 12 random products x 4 primes')\n\n# ---------------------------------------------------------------- 4. local image at 2 from points of C(Q_2)\nPREC = 80\npts = []\nfor x0 in list(range(-40, 41)):\n for yr in P.polrootspadic(P('yy^3 - (%d)*yy - (%d)' % (x0, x0**4 + x0)), 2, PREC):\n Y = int(P.truncate(P.lift(yr))) if yr.type() == 't_PADIC' else None\n if Y is None:\n continue\n pts.append((x0, Y))\nprint('points of C(Q_2) with integer x in [-40,40] found:', len(pts))\nW = []\nused = []\nfor x0, Y in pts:\n a = P.lift(Y - th * x0 - k)\n if a == 0: continue\n # precision: Y = y mod 2^PREC; need v_v(Y - y) - v_v(a) >= 2 e_v + 1 at each v | 2\n ok = all(PREC * int(pr[2]) - int(P.nfeltval(nf, a, pr)) >= 2 * int(pr[2]) + 1 for pr in S)\n assert ok\n vec = loc2(a)\n trial = W + [vec]\n if int(P.matrank(P.Mod(1, 2) * P.matrix(len(trial), 35, [x for r in trial for x in r]))) == len(trial):\n W.append(vec); used.append((x0, Y % 2**60))\n if len(W) == 4:\n break\nprint('local image W_2 spanned by delta_2(P - oo) at P = (x, y mod 2^60):', used, ' dim', len(W))\nassert len(W) == 4\n# consistency: every sampled point (and the four points used in the paper) has its class in W_2\nallpts = pts + [(x0, int(P.truncate(P.lift(yr)))) for x0 in (-24, -23, -21, -19)\n for yr in P.polrootspadic(P('yy^3 - (%d)*yy - (%d)' % (x0, x0**4 + x0)), 2, PREC)]\nrows_all = W + [loc2(P.lift(Y - th * x0 - k)) for x0, Y in allpts]\nassert int(P.matrank(P.Mod(1, 2) * P.matrix(len(rows_all), 35, [x for r in rows_all for x in r]))) == 4\nprint('all %d sampled points of C(Q_2) (incl. the paper\\'s x = -24,-23,-21,-19) have classes in W_2' % len(allpts))\n\n# ---------------------------------------------------------------- 5. the fake Selmer group\nL2 = [loc2(g) for g in gens]\n# unknowns s (19) and t (4): sum s_i L2(g_i) + sum t_j W_j = 0 ; sum s_i SG(g_i) = 0 ; norm square\nfrom fractions import Fraction\ndef v2norm_parity(g):\n N = exact_norm(g)\n e = (N.numerator & -N.numerator).bit_length() - 1 if N.numerator % 2 == 0 else 0\n e -= (N.denominator.bit_length() - 1)\n return e % 2, (0 if N > 0 else 1)\nNP = [v2norm_parity(g) for g in gens]\nrows = []\nfor j in range(35):\n rows.append([L2[i][j] for i in range(19)] + [W[t][j] for t in range(4)])\nfor j in range(3):\n rows.append([SG[i][j] for i in range(19)] + [0] * 4)\nrows.append([NP[i][0] for i in range(19)] + [0] * 4)\nrows.append([NP[i][1] for i in range(19)] + [0] * 4)\nA = P.Mod(1, 2) * P.matrix(len(rows), 23, [x for r in rows for x in r])\nK = P.matker(A)\nsols = set()\nncol = int(P.matsize(K)[1])\nimport itertools\nbasis = [[int(P.lift(K[i, j])) for i in range(23)] for j in range(ncol)]\nfor comb in itertools.product((0, 1), repeat=ncol):\n v = tuple(sum(c * b[i] for c, b in zip(comb, basis)) % 2 for i in range(19))\n sols.add(v)\ndimsel = len(sols).bit_length() - 1\nprint('dim Sel_fake =', dimsel, ' elements:', [[names[i] for i in range(19) if s[i]] for s in sols if any(s)])\nassert len(sols) == 2\n# without the norm condition\nsols2 = set()\nK2 = P.matker(P.Mod(1, 2) * P.matrix(len(rows) - 2, 23, [x for r in rows[:-2] for x in r]))\nb2 = [[int(P.lift(K2[i, j])) for i in range(23)] for j in range(int(P.matsize(K2)[1]))]\nfor comb in itertools.product((0, 1), repeat=len(b2)):\n sols2.add(tuple(sum(c * b[i] for c, b in zip(comb, b2)) % 2 for i in range(19)))\nprint('dim without the norm condition:', len(sols2).bit_length() - 1)\n# with the condition at 2 only (no sign and no norm condition)\nsols3 = set()\nK3 = P.matker(P.Mod(1, 2) * P.matrix(35, 23, [x for r in rows[:35] for x in r]))\nb3 = [[int(P.lift(K3[i, j])) for i in range(23)] for j in range(int(P.matsize(K3)[1]))]\nfor comb in itertools.product((0, 1), repeat=len(b3)):\n sols3.add(tuple(sum(c * b[i] for c, b in zip(comb, b3)) % 2 for i in range(19)))\nprint('dim with the condition at 2 only (no sign, no norm condition):', len(sols3).bit_length() - 1,\n ' elements:', [[names[i] for i in range(19) if s[i]] for s in sols3 if any(s)])\n# identify theta - k(theta) = delta(G_1) in K(2,S) and check it is the nonzero Selmer element\nd1 = P.lift(th - k)\nfa = P.idealfactor(nf, d1)\nodd_outside = [(int(fa[0][i][0]), int(fa[1][i])) for i in range(len(fa[0])) if int(fa[0][i][0]) != 2 and int(fa[1][i]) % 2]\nprint('theta - k(theta): primes outside S with odd valuation:', odd_outside)\nassert not odd_outside\ncpr1 = [(p_, r_) for p_, r_ in cprimes if evalmod(d1, r_, p_) % p_ != 0]\ncv = charvec(d1, cpr1)\nMg = [charvec(g, cpr1) for g in gens]\nassert int(P.matrank(P.Mod(1, 2) * P.matrix(19, len(cpr1), [x for r in Mg for x in r]))) == 19\nxs = P.matsolvemod(P.matrix(len(cpr1), 19, [Mg[i][j] for j in range(len(cpr1)) for i in range(19)]), 2, P.Col(cv))\nxs = [int(v) % 2 for v in xs]\nassert [sum(xs[i] * Mg[i][j] for i in range(19)) % 2 for j in range(len(cpr1))] == cv\nprint('theta - k(theta) == product of', [names[i] for i in range(19) if xs[i]], 'mod squares (characters agree at %d primes)' % len(cpr1))\nassert tuple(xs) in sols and any(xs)\nprint('signs of theta - k(theta):', signs(d1), ' local class in W_2:',\n int(P.matrank(P.Mod(1, 2) * P.matrix(5, 35, [x for r in W + [loc2(d1)] for x in r]))) == 4)\nmk = P.lift(-k)\nprint('delta(T) = -k(theta) is a square in K:', len(P.nfroots(nf, P.varhigher('w')**2 - mk)) > 0)\nprint('SELMER CHECKS PASSED: rank J(Q) <= 1')\n" }, { "path": "anc/code/1.3.8/descent/theta.py", "size_bytes": 2496, "sha256": "9e09f3735570198151d441f30927fd676188a866a32a85d839baa69c050a3617", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"J[2] as a submodule of the permutation module on the 27 bitangents other than the hyperflex line.\n\nModel: V = F_2^6 with the Weil pairing e, the odd theta characteristic theta_0 = 2*infinity (hyperflex) and its\nquadratic form q(w) = h^0(theta_0 + w) + h^0(theta_0) mod 2 (Riemann-Mumford), which has Arf invariant 1.\nAll Arf-1 forms on F_2^6 are equivalent, so we may take q = a1 b... (below). The other 27 bitangents are\ntheta_0 + w for the 27 nonzero w with q(w) = 0, and J[2] -> F_2^27, eps -> (e(eps, w))_w.\nChecks: 27 such w; the map is injective; nonzero image vectors have weights 12 (36 of them) and 16 (27);\nthe all-ones vector is not in the image; and with Galois orbits of sizes 2,5,10,10 (B over Q_2) the\ninvariant subspace has dimension <= 1.\n\"\"\"\nfrom itertools import product, combinations\ndef q(a): return (a[0]*a[1] + a[2]*a[3] + a[4]*a[4] + a[4]*a[5] + a[5]*a[5]) % 2\ndef e(a, b): return (q([(x + y) % 2 for x, y in zip(a, b)]) + q(a) + q(b)) % 2\nV = list(product((0, 1), repeat=6))\nzeros = [w for w in V if q(w) == 0]\nZ = [w for w in zeros if any(w)]\nprint('zeros of q:', len(zeros), '(Arf invariant 1 <=> 28); nonzero singular vectors:', len(Z))\nassert len(zeros) == 28 and len(Z) == 27\n# e is the symplectic polar form\nassert all(e(a, a) == 0 for a in V)\nimg = {v: tuple(e(v, w) for w in Z) for v in V}\nassert len(set(img.values())) == 64, 'not injective'\nwts = {}\nfor v in V:\n if any(v): wts[sum(img[v])] = wts.get(sum(img[v]), 0) + 1\nprint('weights of nonzero image vectors:', dict(sorted(wts.items())))\nassert wts == {12: 36, 16: 27}\nassert tuple([1] * 27) not in set(img.values())\n# the sum of the 27 vectors w is 0 (equivalently, the all-ones vector is orthogonal to... )\ns = [sum(w[i] for w in Z) % 2 for i in range(6)]\nprint('sum of the 27 singular vectors:', s)\nassert s == [0] * 6\n# J(Q_2)[2]: invariant vectors are constant on orbits of sizes 2,5,10,10 -> weight in subset sums\nsizes = [2, 5, 10, 10]\nsums = sorted(set(sum(c) for r in range(5) for c in combinations(sizes, r)))\nprint('possible weights of orbit unions:', sums, '; intersection with {12,16}:', [w for w in sums if w in (12, 16)])\nunions12 = [c for r in range(5) for c in combinations(range(4), r) if sum(sizes[i] for i in c) == 12]\nprint('unions of weight 12:', [[sizes[i] for i in c] for c in unions12],\n '-> their sum has weight', sum(sizes[i] for i in set(unions12[0]) ^ set(unions12[1])), 'not in {12,16}: dim J(Q_2)[2] <= 1')\nprint('THETA MODEL CHECKS PASSED')\n" }, { "path": "anc/code/1.3.8/field/field.gp", "size_bytes": 1076, "sha256": "10101dc9b124bcecc3f0f2c0c346486bd2df68088046f052839a94b7bf3cb632", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ T6-3: bitangent polynomial, field K, maximal order (unconditional), primes above 2\ndefault(parisize, 2*10^9); default(factor_proven, 1);\nB = m^27 - 48*m^22 + 1344*m^18 + 144*m^17 - 3264*m^13 + 832*m^12 - 40704*m^9 - 4608*m^8 - 2560*m^7 - 39936*m^4 - 15360*m^3 - 1024*m^2 + 4096;\nB = subst(B, m, x);\nprint(\"irreducible: \", polisirreducible(B));\ndB = poldisc(B); fa = factor(dB); print(\"isprime(big) \", apply(isprime, fa[,1]~)); print(\"disc(B) = \", fa);\nt0 = getabstime();\nnf = nfinit([B, fa[,1]~]);\nprint(\"nfcertify: \", nfcertify(nf), \" (\", (getabstime()-t0)/1000., \" s)\");\nprint(\"d_K = \", factor(nf.disc), \" sign = \", nf.sign, \" index = \", factor(nf.index));\nprint(\"primes above 2 (e,f): \", apply(P->[P.e,P.f], idealprimedec(nf,2)));\nprint(\"primes above 11: \", apply(P->[P.e,P.f], idealprimedec(nf,11)));\nprint(\"primes above 652081: \", apply(P->[P.e,P.f], idealprimedec(nf,652081)));\nprint(\"log rd = \", log(abs(nf.disc))/27., \" rd = \", abs(nf.disc)^(1/27.));\nt0 = getabstime(); R = polredbest(B, 1); print(\"polredbest (\", (getabstime()-t0)/1000., \" s): \", R[1]);\nquit\n" }, { "path": "anc/code/1.4.1/1.4.1a_fields.py", "size_bytes": 4636, "sha256": "4debcf7e28a6305a96ddc571cbdd2d45b060e499fa0dca48abdce62a1fecd9fb", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.1a: the fields K = Q(s), s^2 = -23, and L = K(a), h(a) = a^3 - a + 1 = 0, and the\nautomorphism tau of Lemma lem:1.4.1-field. Standard library only.\n\nChecks:\n (1) h has no rational root (so it is irreducible over Q and over K), disc h = -23;\n (2) tau(a) = -(23a + s(6a^2+9a-4))/46 is a root of h in L, tau(a) != a, tau^2(a) := P_s(P_s(a))\n equals P_{-s}(a) (= tau(a) with s replaced by -s), tau^3(a) = a, a + tau(a) + tau^2(a) = 0;\n (3) splitting data: Legendre symbol (-23/p) and the roots of h mod p for the primes used;\n (4) at 23: h = (T-20)(T-13)^2 mod 23 and the value 3 = (20-13)^2 mod 23 is a unit;\n (5) at 3: in F_27 = F_3[T]/(h), P_2(T) = T^3 and P_{-2}(T) = P_1(T) = T^9 (Frobenius at w+ and w-);\n (6) the p-adic square roots of -23 modulo the moduli used in codes 1.4.1c-e;\n (7) (consistency only) for all p < 2000 with (-23/p) = 1, h mod p has 0 or 3 roots, and for\n (-23/p) = -1 exactly one root.\n\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parent))\nfrom common141 import L, A, S, ONE, ZERO, TAU_A, TAU2_A, subst_as, tau_poly, legendre\n\n\ndef h(x):\n return x * x * x - x + 1\n\n\ndef main():\n # (1)\n assert h(1) != 0 and h(-1) != 0\n disc = -4 * (-1) ** 3 - 27 * 1 ** 2\n assert disc == -23\n print('h = T^3 - T + 1: no rational root (+-1), disc h =', disc)\n\n # (2)\n assert h(TAU_A).iszero() and TAU_A != A\n assert TAU2_A == TAU_A.conj_s()\n tau3 = subst_as(TAU_A, TAU2_A, S)\n assert tau3 == A\n assert (A + TAU_A + TAU2_A).iszero()\n assert h(TAU2_A).iszero()\n print('tau(a) =', TAU_A)\n print('tau^2(a) =', TAU2_A, ' (= tau(a) with s -> -s)')\n print('PASS: tau(a) is a root of h, tau(a) != a, tau^2(a) = P_{-s}(a), tau^3(a) = a')\n\n # (3)\n for p in (2, 3, 7, 23, 29, 31, 59, 337, 9013):\n roots = [r for r in range(p) if h(r) % p == 0]\n if p == 2:\n lg = 1 if (-23) % 8 == 1 else -1 # -23 = 1 mod 8: 2 splits in K\n else:\n lg = legendre(-23, p)\n kind = {1: 'split', -1: 'inert', 0: 'ramified'}[lg]\n print('p = %4d: %-8s in K; roots of h mod p: %s' % (p, kind, roots))\n assert [r for r in range(2) if h(r) % 2 == 0] == [] and (-23) % 8 == 1\n for p in (3, 29, 31):\n assert legendre(-23, p) == 1 and all(h(r) % p for r in range(p))\n assert legendre(-23, 59) == 1 and [r for r in range(59) if h(r) % 59 == 0] == [17, 46, 55]\n for p in (7, 337, 9013):\n assert legendre(-23, p) == -1\n\n # (4)\n for T in range(23):\n assert h(T) % 23 == ((T - 20) * (T - 13) ** 2) % 23\n assert (20 - 13) ** 2 % 23 == 3\n print('mod 23: h = (T-20)(T-13)^2, and (20-13)^2 = 3 is a unit')\n\n # (5) F_27 = F_3[T]/(h): elements as lists of length 3\n def mul(u, v):\n r = [0] * 5\n for i in range(3):\n for j in range(3):\n r[i + j] += u[i] * v[j]\n r[2] += r[4]; r[1] -= r[4]; r[1] += r[3]; r[0] -= r[3]\n return [c % 3 for c in r[:3]]\n\n def pw(u, n):\n r = [1, 0, 0]\n for _ in range(n):\n r = mul(r, u)\n return r\n T = [0, 1, 0]\n inv46 = pow(46, -1, 3)\n for sig, name, expect in ((2, 'w+', pw(T, 3)), (1, 'w-', pw(T, 9))):\n img = [(4 * sig * inv46) % 3, (-(23 + 9 * sig) * inv46) % 3, (-6 * sig * inv46) % 3]\n assert img == expect\n print('at %s (s = %d mod 3): tau(T) = %s = T^%d in F_27' % (name, sig, img, 3 if sig == 2 else 9))\n print('PASS: Frob(w+) = tau, Frob(w-) = tau^2')\n\n # (6)\n def roots_mod(n, lift):\n rs = sorted({s % n for s in range(n * lift) if (s * s + 23) % (n * lift) == 0})\n return rs\n print('roots of s^2 = -23 that lift: mod 27', roots_mod(27, 3), ' mod 81', roots_mod(81, 3),\n ' mod 32', roots_mod(32, 4), ' mod 64', roots_mod(64, 4), ' mod 31', roots_mod(31, 31),\n ' mod 59', roots_mod(59, 59))\n assert roots_mod(27, 3) == [2, 25] and roots_mod(32, 4) == [13, 19] and roots_mod(31, 31) == [15, 16]\n\n # (7)\n def primes(n):\n sv = [True] * n\n sv[0] = sv[1] = False\n for i in range(2, n):\n if sv[i]:\n for j in range(i * i, n, i):\n sv[j] = False\n return [i for i in range(n) if sv[i]]\n for p in primes(2000):\n if p in (2, 23):\n continue\n k = len([r for r in range(p) if h(r) % p == 0])\n assert (k in (0, 3)) if legendre(-23, p) == 1 else (k == 1)\n print('consistency: for 3 <= p < 2000, p != 23, h mod p has 0 or 3 roots if (-23/p) = 1, one root if -1')\n print('PASS 1.4.1a')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.4.1/1.4.1b_curve.py", "size_bytes": 8784, "sha256": "b7656c97b0e7832d399129243bc654e9869960b20783530dae7964873f9c8482", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.1b: the twisted cubic C on S_L and the divisor of G (Lemma lem:1.4.1-curve).\nStandard library only. Input: data/cubic_a_quadrics.json (the coefficient tables of the three\nquadrics q0, q1, q2 printed in Appendix A of the source; read here as data and checked).\n\nChecks:\n (1) every monomial of q0 and q1 is divisible by x or y; on the plane (x, y) = (lam w, mu w),\n q_k = w * (A_k w + B_k z + C_k t) (k = 0, 1); (W, Z, T) = cross product of (A_0, B_0, C_0) and\n (A_1, B_1, C_1) has degrees (2, 3, 3); phi(lam:mu) = (lam W : mu W : Z : T);\n (2) phi^* q_k = 0 (k = 0, 1, 2), phi^* F = 0, phi^* G = 0 (identities in L[lam, mu]);\n (3) the four binary cubics lam W, mu W, Z, T are linearly independent (4x4 determinant != 0);\n (4) for j = 1, 2 and k = 0, 1, 2 the binary form q_k(tau^j phi) is not 0, so tau^j C is not\n contained in the quadric q_k = 0, while C is: C, tau C, tau^2 C are pairwise distinct;\n (5) C meets the line x = y = 0 exactly in P0 = (0:0:a:1) and P1 = (0:0:tau(a):1):\n Res(W, Z - a T) = Res(W, Z - tau(a) T) = 0, Res(W, Z - tau^2(a) T) != 0, Res(W, T) != 0;\n the values of q0, q1, q2 at P0, P1, P2 (P2 = (0:0:tau^2(a):1); q2(P2) as in the source);\n (6) the coefficient of x^3 is 1 in F and 0 in G; the coefficient of x y^2 in G is 288;\n (7) cross-checks of statements of the source that the proof does not use: the grevlex leading\n monomials x^2, xy, y^2 of q0, q1, q2 - c q1; the reductions of q0, q1, q2 at the prime above 59\n with a = 17, s = 6; phi mod that prime is again a twisted cubic on the reduced quadrics.\n\"\"\"\nimport json\nimport sys\nfrom fractions import Fraction as Fr\nfrom pathlib import Path\nHERE = Path(__file__).resolve().parent\nsys.path.insert(0, str(HERE))\nfrom common141 import (L, A, S, ZERO, ONE, TAU_A, TAU2_A, tau_j, padd, psub, pmul, pmapc, peval,\n psubst, F_L, G_L, G_INT, F_INT)\n\nMON = {'x^2': (2, 0, 0, 0), 'xy': (1, 1, 0, 0), 'xz': (1, 0, 1, 0), 'xt': (1, 0, 0, 1),\n 'y^2': (0, 2, 0, 0), 'yz': (0, 1, 1, 0), 'yt': (0, 1, 0, 1), 'z^2': (0, 0, 2, 0),\n 'zt': (0, 0, 1, 1), 't^2': (0, 0, 0, 2)}\n\n\ndef load_quadrics():\n data = json.loads((HERE / 'data' / 'cubic_a_quadrics.json').read_text())\n qs = []\n for row in data:\n d = row['denominator']\n qs.append({MON[k]: L(tuple(Fr(c, d) for c in cs)) for k, cs in row['coefficients'].items()})\n return qs\n\n\ndef bin_coeffs(p, d):\n return [p.get((d - j, j), ZERO) for j in range(d + 1)]\n\n\ndef det(m):\n n = len(m)\n if n == 1:\n return m[0][0]\n r = ZERO\n for j in range(n):\n if m[0][j].iszero():\n continue\n term = m[0][j] * det([row[:j] + row[j + 1:] for row in m[1:]])\n r = r + term if j % 2 == 0 else r - term\n return r\n\n\ndef resultant(f, g):\n \"\"\"resultant of binary forms given by coefficient lists (lam^d ... mu^d), Sylvester determinant\"\"\"\n m, n = len(f) - 1, len(g) - 1\n rows = [[ZERO] * i + f + [ZERO] * (n - 1 - i) for i in range(n)]\n rows += [[ZERO] * i + g + [ZERO] * (m - 1 - i) for i in range(m)]\n return det(rows)\n\n\ndef main():\n q = load_quadrics()\n # (1)\n for k in (0, 1):\n assert all(m[0] + m[1] >= 1 for m in q[k])\n parts = []\n for k in (0, 1):\n cw, cz, ct = {}, {}, {}\n for (ex, ey, ez, et), c in q[k].items():\n tgt = {(1, 0, 0): cw, (0, 1, 0): cz, (0, 0, 1): ct}[(ex + ey - 1, ez, et)]\n tgt[(ex, ey)] = tgt.get((ex, ey), ZERO) + c\n parts.append((cw, cz, ct))\n (a0, b0, c0), (a1, b1, c1) = parts\n W = psub(pmul(b0, c1), pmul(c0, b1))\n Z = psub(pmul(c0, a1), pmul(a0, c1))\n T = psub(pmul(a0, b1), pmul(b0, a1))\n assert {sum(m) for m in W} == {2} and {sum(m) for m in Z} == {3} and {sum(m) for m in T} == {3}\n X = pmul({(1, 0): ONE}, W)\n Y = pmul({(0, 1): ONE}, W)\n phi = [X, Y, Z, T]\n print('W =', ' ; '.join('[%s] %s' % (m, c) for m, c in sorted(W.items(), reverse=True)))\n print('Z =', ' ; '.join('[%s] %s' % (m, c) for m, c in sorted(Z.items(), reverse=True)))\n print('T =', ' ; '.join('[%s] %s' % (m, c) for m, c in sorted(T.items(), reverse=True)))\n\n # (2)\n for k in range(3):\n assert psubst(q[k], phi, 2) == {}\n assert psubst(F_L, phi, 2) == {} and psubst(G_L, phi, 2) == {}\n print('PASS: phi^*q0 = phi^*q1 = phi^*q2 = 0, phi^*F = 0, phi^*G = 0')\n\n # (3)\n d = det([bin_coeffs(c, 3) for c in phi])\n assert not d.iszero()\n print('PASS: det of the coefficients of lam W, mu W, Z, T is nonzero:', d)\n\n # (4)\n for j in (1, 2):\n phij = [pmapc(c, lambda e, j=j: tau_j(e, j)) for c in phi]\n for k in range(3):\n assert psubst(q[k], phij, 2) != {}\n print('PASS: q_k(tau^j phi) != 0 for j = 1, 2 and k = 0, 1, 2; C, tau C, tau^2 C pairwise distinct')\n\n # (5)\n w2 = bin_coeffs(W, 2)\n zc, tc = bin_coeffs(Z, 3), bin_coeffs(T, 3)\n res = []\n for r in (A, TAU_A, TAU2_A):\n res.append(resultant(w2, [u - r * v for u, v in zip(zc, tc)]).iszero())\n assert res == [True, True, False]\n assert not resultant(w2, tc).iszero()\n print('PASS: C meets x = y = 0 exactly in P0 = (0:0:a:1) and P1 = (0:0:tau(a):1)')\n vals = []\n for r in (A, TAU_A, TAU2_A):\n vals.append([peval(qk, (ZERO, ZERO, r, ONE), ZERO) for qk in q])\n assert all(v.iszero() for v in vals[0] + vals[1]) and vals[2][0].iszero() and vals[2][1].iszero()\n expect = A + 3 + S * (-6 * A * A + 4 - 9 * A) / 23\n assert vals[2][2] == expect and not expect.iszero()\n print('source cross-check: q_k(P0) = q_k(P1) = 0; q0(P2) = q1(P2) = 0, q2(P2) =', vals[2][2])\n\n # (6)\n assert F_INT[(3, 0, 0, 0)] == 1 and (3, 0, 0, 0) not in G_INT and G_INT[(1, 2, 0, 0)] == (288, 0)\n print('PASS: coefficient of x^3: 1 in F, 0 in G; coefficient of x y^2 in G: 288')\n\n # (7) cross-checks\n def grevlex_key(m): # larger key = larger monomial, degree 2 in (x,y,z,t)\n return (sum(m), tuple(-e for e in reversed(m)))\n lm = [max(qk, key=grevlex_key) for qk in q]\n c = q[2][(1, 1, 0, 0)] / q[1][(1, 1, 0, 0)]\n q2p = psub(q[2], pmapc(q[1], lambda e: e * c))\n lm[2] = max(q2p, key=grevlex_key)\n assert lm == [(2, 0, 0, 0), (1, 1, 0, 0), (0, 2, 0, 0)]\n print('source cross-check: grevlex leading monomials of q0, q1, q2 - c q1:', lm)\n p, ar, sr = 59, 17, 6\n assert (ar ** 3 - ar + 1) % p == 0 and (sr * sr + 23) % p == 0\n\n def red(e):\n tot = 0\n for cc, b in zip(e.c, (1, ar, ar * ar, sr, sr * ar, sr * ar * ar)):\n assert cc.denominator % p\n tot += cc.numerator * pow(cc.denominator, -1, p) * b\n return tot % p\n shown = [\n {(2, 0, 0, 0): 1, (1, 1, 0, 0): 47, (1, 0, 1, 0): 28, (1, 0, 0, 1): 5, (0, 2, 0, 0): 11, (0, 1, 1, 0): 14},\n {(1, 1, 0, 0): 21, (1, 0, 1, 0): 3, (1, 0, 0, 1): 13, (0, 2, 0, 0): 2, (0, 1, 1, 0): 27, (0, 1, 0, 1): 1},\n {(1, 1, 0, 0): 43, (1, 0, 1, 0): 57, (1, 0, 0, 1): 35, (0, 2, 0, 0): 7, (0, 1, 1, 0): 15,\n (0, 0, 2, 0): 13, (0, 0, 1, 1): 8, (0, 0, 0, 2): 1}]\n qbar = [{m: red(e) for m, e in qk.items() if red(e)} for qk in q]\n assert qbar == shown\n phibar = [{m: red(e) for m, e in cc.items() if red(e)} for cc in phi]\n\n def pmul_p(u, v):\n r = {}\n for m1, c1 in u.items():\n for m2, c2 in v.items():\n m = tuple(x + y for x, y in zip(m1, m2))\n r[m] = (r.get(m, 0) + c1 * c2) % p\n return {m: cc for m, cc in r.items() if cc}\n\n def subst_p(poly):\n tot = {}\n for m, cc in poly.items():\n t = {(0, 0): cc}\n for img, e in zip(phibar, m):\n for _ in range(e):\n t = pmul_p(t, img)\n for mm, v in t.items():\n tot[mm] = (tot.get(mm, 0) + v) % p\n return {m: v for m, v in tot.items() if v}\n assert all(subst_p(qb) == {} for qb in qbar)\n mat = [[cc.get((3 - j, j), 0) for j in range(4)] for cc in phibar]\n\n def det_p(m):\n m = [r[:] for r in m]\n n, dd = len(m), 1\n for i in range(n):\n piv = next((r for r in range(i, n) if m[r][i] % p), None)\n if piv is None:\n return 0\n if piv != i:\n m[i], m[piv] = m[piv], m[i]\n dd = -dd\n dd = dd * m[i][i] % p\n inv = pow(m[i][i], -1, p)\n for r in range(i + 1, n):\n f = m[r][i] * inv % p\n m[r] = [(x - f * y) % p for x, y in zip(m[r], m[i])]\n return dd % p\n assert det_p(mat) != 0\n print('source cross-check: q0, q1, q2 at (a, s) = (17, 6) mod 59 are the displayed quadrics;'\n ' phi mod 59 is a twisted cubic on them (det = %d mod 59)' % det_p(mat))\n print('PASS 1.4.1b')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.4.1/1.4.1c_bad_primes.py", "size_bytes": 6410, "sha256": "ad184380d7a40607f7cfe10a2a5e58f80775d08ee43f554280252a8504b415e9", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.1c: reduction of S modulo primes (Lemma lem:1.4.1-bad). Standard library only.\n\nChecks:\n (1) Macaulay matrices of the four partial derivatives of F in degree 5 (56 x 56): the column of a\n monomial m is the coefficient vector of (m / x_i^2) * dF/dx_i, i the first variable in the given\n order with x_i^2 | m. Determinants (Bareiss) for the orders (x,y,z,t) and (x,y,t,z), their\n factorizations and their gcd 2^6 3^17 23 31 59^2 9013^2;\n (2) the F_p-rank of the degree-5 map (g, g_1..g_4) -> g F + sum g_i dF/dx_i (g of degree 2, g_i of\n degree 3) for p = 2, 3, 23, 29, 31, 59, 9013: 56 (= all quintics) for p = 3, 29; 55 for\n p = 23, 31, 59, 9013; 50 for p = 2;\n (3) explicit singular points: modulo 23, 31, 59, 9013 an F_p-point where F and all partials vanish\n (for 31: P31 = (1:23:28:12)); modulo 2 the three points (1 : r^3 + r : r^5 : r) over F_8,\n r^3 + r^2 + 1 = 0;\n (4) G(P31) at s = 15 and s = 16 (the two square roots of -23 modulo 31) is 6 and 16 modulo 31;\n (5) (consistency) P31 is the only F_31-point of P^3 where F and its partials vanish.\n\"\"\"\nimport itertools\nimport math\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parent))\nfrom common141 import F_INT, F_val, F_grad, G_val, pdiff, factorint, fmt_factor\n\nPARTS = [pdiff(F_INT, i) for i in range(4)]\n\n\ndef monomials(d):\n return sorted((m for m in itertools.product(range(d + 1), repeat=4) if sum(m) == d), reverse=True)\n\n\ndef macaulay_det(order):\n mons = monomials(5)\n idx = {m: k for k, m in enumerate(mons)}\n cols = []\n for m in mons:\n i = next(i for i in order if m[i] >= 2)\n mult = list(m)\n mult[i] -= 2\n col = [0] * len(mons)\n for e, c in PARTS[i].items():\n col[idx[tuple(a + b for a, b in zip(mult, e))]] += c\n cols.append(col)\n mat = [[cols[j][i] for j in range(len(mons))] for i in range(len(mons))]\n # fraction-free Gaussian elimination (Bareiss)\n n, sign, prev = len(mat), 1, 1\n for k in range(n - 1):\n if mat[k][k] == 0:\n sw = next((r for r in range(k + 1, n) if mat[r][k]), None)\n if sw is None:\n return 0\n mat[k], mat[sw] = mat[sw], mat[k]\n sign = -sign\n for i in range(k + 1, n):\n for j in range(k + 1, n):\n mat[i][j] = (mat[i][j] * mat[k][k] - mat[i][k] * mat[k][j]) // prev\n prev = mat[k][k]\n return sign * mat[n - 1][n - 1]\n\n\ndef rank_mod(rows, p):\n rows = [[v % p for v in r] for r in rows]\n rk = 0\n for c in range(len(rows[0])):\n piv = next((i for i in range(rk, len(rows)) if rows[i][c]), None)\n if piv is None:\n continue\n rows[rk], rows[piv] = rows[piv], rows[rk]\n inv = pow(rows[rk][c], -1, p)\n rows[rk] = [v * inv % p for v in rows[rk]]\n for i in range(len(rows)):\n if i != rk and rows[i][c]:\n f = rows[i][c]\n rows[i] = [(u - f * v) % p for u, v in zip(rows[i], rows[rk])]\n rk += 1\n return rk\n\n\ndef degree5_rows():\n mons = monomials(5)\n idx = {m: k for k, m in enumerate(mons)}\n rows = []\n for g, dg in [(F_INT, 3)] + [(q, 2) for q in PARTS]:\n for m in monomials(5 - dg):\n r = [0] * len(mons)\n for e, c in g.items():\n r[idx[tuple(a + b for a, b in zip(m, e))]] += c\n rows.append(r)\n return rows, len(mons)\n\n\n# arithmetic in F_8 = F_2[r]/(r^3 + r^2 + 1), elements as 3-bit integers (bit i = coefficient of r^i)\ndef f8_mul(u, v):\n r = 0\n for i in range(3):\n if (v >> i) & 1:\n r ^= u << i\n for i in (4, 3):\n if (r >> i) & 1:\n r ^= 0b1101 << (i - 3)\n return r\n\n\ndef f8_pow(u, n):\n r = 1\n for _ in range(n):\n r = f8_mul(r, u)\n return r\n\n\ndef f8_eval(poly, pt):\n tot = 0\n for m, c in poly.items():\n if c % 2 == 0:\n continue\n t = 1\n for v, e in zip(pt, m):\n t = f8_mul(t, f8_pow(v, e))\n tot ^= t\n return tot\n\n\ndef main():\n d1 = macaulay_det((0, 1, 2, 3))\n d2 = macaulay_det((0, 1, 3, 2))\n g = math.gcd(d1, d2)\n print('det M1 (order x,y,z,t) = %d = %s%s' % (d1, '-' if d1 < 0 else '', fmt_factor(factorint(d1))))\n print('det M2 (order x,y,t,z) = %d = %s%s' % (d2, '-' if d2 < 0 else '', fmt_factor(factorint(d2))))\n print('gcd = %s' % fmt_factor(factorint(g)))\n assert factorint(d1) == {2: 6, 3: 17, 7: 1, 23: 1, 29: 1, 31: 1, 59: 2, 337: 1, 9013: 2}\n assert factorint(d2) == {2: 6, 3: 19, 23: 1, 31: 1, 59: 3, 73: 1, 9013: 2}\n assert factorint(g) == {2: 6, 3: 17, 23: 1, 31: 1, 59: 2, 9013: 2}\n\n rows, n5 = degree5_rows()\n ranks = {p: rank_mod(rows, p) for p in (2, 3, 23, 29, 31, 59, 9013)}\n print('degree-5 map (F, partials): %d x %d; ranks mod p:' % (len(rows), n5), ranks)\n assert ranks == {2: 50, 3: 56, 23: 55, 29: 56, 31: 55, 59: 55, 9013: 55}\n\n sing = {23: (1, 18, 3, 10), 31: (1, 23, 28, 12), 59: (1, 47, 12, 14), 9013: (1, 7636, 7996, 3944)}\n for p, pt in sing.items():\n assert F_val(*pt) % p == 0 and all(c % p == 0 for c in F_grad(*pt))\n print('singular F_p-points (F and all partials vanish):', sing)\n grads = [pdiff(F_INT, i) for i in range(4)]\n roots = [r for r in range(8) if f8_mul(f8_mul(r, r), r) ^ f8_mul(r, r) ^ 1 == 0]\n assert len(roots) == 3\n for r in roots:\n pt = (1, f8_pow(r, 3) ^ r, f8_pow(r, 5), r)\n assert f8_eval(F_INT, pt) == 0 and all(f8_eval(gr, pt) == 0 for gr in grads)\n print('mod 2: F and all partials vanish at (1 : r^3 + r : r^5 : r) for the 3 roots r of r^3+r^2+1 in F_8')\n\n v15, v16 = G_val((1, 23, 28, 12), 15) % 31, G_val((1, 23, 28, 12), 16) % 31\n assert ((15 * 15 + 23) % 31, (16 * 16 + 23) % 31) == (0, 0) and (v15, v16) == (6, 16)\n print('G(P31) mod 31 at s = 15, 16:', v15, v16)\n\n p = 31\n found = []\n for pt in itertools.product(range(p), repeat=4):\n first = next((c for c in pt if c), None)\n if first != 1:\n continue # one representative per projective point\n if F_val(*pt) % p == 0 and all(c % p == 0 for c in F_grad(*pt)):\n found.append(pt)\n assert found == [(1, 23, 28, 12)]\n print('consistency: singular F_31-points of S mod 31:', found)\n print('PASS 1.4.1c')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.4.1/1.4.1f_local_points.py", "size_bytes": 2069, "sha256": "768df0eabdbd31cd49f4eaca2cc7c5dc4dd09b33f10146c9e2553254d0fb14e6", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.1f: S has points over R and over every Q_p (Remark rem:1.4.1-adelic). Standard library.\n\nChecks:\n (1) at p = 2, 23, 31, 59, 9013 (the primes of bad reduction) the points of the source are zeros of\n F mod p at which some partial derivative is nonzero mod p (so they lift to Z_p by Hensel);\n (2) at p = 3 (good reduction, code 1.4.1c): S mod 3 has 7 points, and (1:0:0:1) is one of them\n with a nonzero partial derivative mod 3;\n (3) a real point: F(1,0,0,t) = t^3 + t^2 + 1 changes sign on [-2, -1];\n (4) (cross-check of the source) the 3-adic points with x = 0 exist: F(0,1,z,0) = z^3 + z + 1 has the\n simple root z = 1 mod 3.\nAt the other primes the reduction is a smooth cubic surface (code 1.4.1c), which has an F_p-point by\nthe Chevalley-Warning theorem; it lifts by Hensel's lemma.\n\"\"\"\nimport itertools\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parent))\nfrom common141 import F_val, F_grad\n\n\ndef main():\n pts = {2: (1, 0, 1, 1), 23: (1, 0, 0, 6), 31: (1, 0, 0, 20), 59: (1, 0, 1, 10), 9013: (1, 0, 0, 8363)}\n for p, pt in pts.items():\n assert F_val(*pt) % p == 0 and any(c % p for c in F_grad(*pt))\n print('p = %4d: %s, F = 0, gradient mod p = %s' % (p, pt, tuple(c % p for c in F_grad(*pt))))\n proj3 = [pt for pt in itertools.product(range(3), repeat=4)\n if next((c for c in pt if c), None) == 1 and F_val(*pt) % 3 == 0]\n assert len(proj3) == 7 and (1, 0, 0, 1) in proj3 and any(c % 3 for c in F_grad(1, 0, 0, 1))\n print('p = 3: %d points of S mod 3: %s; (1,0,0,1) has gradient %s mod 3'\n % (len(proj3), proj3, tuple(c % 3 for c in F_grad(1, 0, 0, 1))))\n assert F_val(1, 0, 0, -2) < 0 < F_val(1, 0, 0, -1)\n print('real point: F(1,0,0,-2) = %d < 0 < F(1,0,0,-1) = %d' % (F_val(1, 0, 0, -2), F_val(1, 0, 0, -1)))\n assert F_val(0, 1, 1, 0) % 3 == 0 and (3 * 1 + 1) % 3 != 0\n print('x = 0: F(0,1,z,0) = z^3 + z + 1, z = 1 is a simple root mod 3')\n print('PASS 1.4.1f')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.4.1/common141.py", "size_bytes": 7729, "sha256": "8588e3e1f2de93fb820e9c24a78b9bb510eb7e2b810bf75d289bca2b99feac15", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Shared helpers for the codes of Section 1.4.1 (standard library only).\n\n* class L: exact arithmetic in L = Q(a, s), a^3 = a - 1, s^2 = -23. An element is a 6-tuple of\n Fractions (c0, c1, c2, c3, c4, c5) = c0 + c1 a + c2 a^2 + s (c3 + c4 a + c5 a^2).\n* polynomials in several variables: dicts {exponent tuple: coefficient}.\n* the cubic forms F = F_A and G = G0 + s G1 of the section.\n\"\"\"\nfrom fractions import Fraction as Fr\n\n# ---------------------------------------------------------------- the field L\n\n\ndef _mul_a(p, q):\n \"\"\"product in Q[a]/(a^3 - a + 1) of coefficient lists of length 3\"\"\"\n r = [Fr(0)] * 5\n for i in range(3):\n if p[i]:\n for j in range(3):\n r[i + j] += p[i] * q[j]\n r[2] += r[4] # a^4 = a^2 - a\n r[1] -= r[4]\n r[1] += r[3] # a^3 = a - 1\n r[0] -= r[3]\n return r[:3]\n\n\nclass L:\n __slots__ = ('c',)\n\n def __init__(self, c=(0, 0, 0, 0, 0, 0)):\n self.c = tuple(Fr(x) for x in c)\n\n @staticmethod\n def rat(x):\n return L((x, 0, 0, 0, 0, 0))\n\n def __add__(self, o):\n o = _as_l(o)\n return L(tuple(x + y for x, y in zip(self.c, o.c)))\n __radd__ = __add__\n\n def __neg__(self):\n return L(tuple(-x for x in self.c))\n\n def __sub__(self, o):\n return self + (-_as_l(o))\n\n def __rsub__(self, o):\n return _as_l(o) - self\n\n def __mul__(self, o):\n o = _as_l(o)\n a1, b1, a2, b2 = list(self.c[:3]), list(self.c[3:]), list(o.c[:3]), list(o.c[3:])\n p, q, r, t = _mul_a(a1, a2), _mul_a(b1, b2), _mul_a(a1, b2), _mul_a(b1, a2)\n return L(tuple(p[i] - 23 * q[i] for i in range(3)) + tuple(r[i] + t[i] for i in range(3)))\n __rmul__ = __mul__\n\n def __eq__(self, o):\n return self.c == _as_l(o).c\n\n def __hash__(self):\n return hash(self.c)\n\n def iszero(self):\n return not any(self.c)\n\n def conj_s(self):\n \"\"\"the automorphism s -> -s, a -> a of L\"\"\"\n return L(self.c[:3] + tuple(-x for x in self.c[3:]))\n\n def __pow__(self, n):\n r, b = L.rat(1), self\n while n:\n if n & 1:\n r = r * b\n b = b * b\n n >>= 1\n return r\n\n def inv(self):\n \"\"\"inverse by solving a 6x6 linear system over Q\"\"\"\n cols = []\n for k in range(6):\n e = [0] * 6\n e[k] = 1\n cols.append((self * L(e)).c)\n m = [[cols[j][i] for j in range(6)] + [Fr(int(i == 0))] for i in range(6)]\n for i in range(6):\n piv = next(r for r in range(i, 6) if m[r][i] != 0)\n m[i], m[piv] = m[piv], m[i]\n pv = m[i][i]\n m[i] = [x / pv for x in m[i]]\n for r in range(6):\n if r != i and m[r][i] != 0:\n f = m[r][i]\n m[r] = [x - f * y for x, y in zip(m[r], m[i])]\n return L(tuple(m[i][6] for i in range(6)))\n\n def __truediv__(self, o):\n return self * _as_l(o).inv()\n\n def __repr__(self):\n names = ('', 'a', 'a^2', 's', 's*a', 's*a^2')\n terms = ['(%s)%s' % (c, ('*' + n) if n else '') for c, n in zip(self.c, names) if c]\n return ' + '.join(terms) if terms else '0'\n\n\ndef _as_l(o):\n return o if isinstance(o, L) else L.rat(o)\n\n\nZERO, ONE = L.rat(0), L.rat(1)\nA = L((0, 1, 0, 0, 0, 0))\nS = L((0, 0, 0, 1, 0, 0))\n\n\ndef subst_as(e, a_img, s_img):\n \"\"\"image of e under the Q-algebra homomorphism a -> a_img, s -> s_img\"\"\"\n c = e.c\n a2 = a_img * a_img\n return (c[0] + c[1] * a_img + c[2] * a2) + s_img * (c[3] + c[4] * a_img + c[5] * a2)\n\n\ndef tau_poly(a_img, s_img):\n \"\"\"P_s(a) = -(23 a + s (6 a^2 + 9 a - 4)) / 46, the image tau(a), as a function of (a, s)\"\"\"\n return -(23 * a_img + s_img * (6 * a_img * a_img + 9 * a_img - 4)) / 46\n\n\nTAU_A = tau_poly(A, S) # tau(a)\nTAU2_A = subst_as(TAU_A, TAU_A, S) # tau^2(a) = P_s(P_s(a))\n\n\ndef tau_j(e, j):\n \"\"\"tau^j(e) for e in L (tau fixes s)\"\"\"\n return subst_as(e, [A, TAU_A, TAU2_A][j % 3], S)\n\n# ---------------------------------------------------------------- polynomials\n\n\ndef _iszero(c):\n return c.iszero() if isinstance(c, L) else c == 0\n\n\ndef padd(p, q):\n r = dict(p)\n for m, c in q.items():\n r[m] = r[m] + c if m in r else c\n if _iszero(r[m]):\n del r[m]\n return r\n\n\ndef pneg(p):\n return {m: -c for m, c in p.items()}\n\n\ndef psub(p, q):\n return padd(p, pneg(q))\n\n\ndef pmul(p, q):\n r = {}\n for m1, c1 in p.items():\n for m2, c2 in q.items():\n m = tuple(x + y for x, y in zip(m1, m2))\n v = c1 * c2\n r[m] = r[m] + v if m in r else v\n return {m: c for m, c in r.items() if not _iszero(c)}\n\n\ndef pmapc(p, f):\n r = {m: f(c) for m, c in p.items()}\n return {m: c for m, c in r.items() if not _iszero(c)}\n\n\ndef peval(p, vals, zero=0):\n r = zero\n for m, c in p.items():\n t = c\n for v, e in zip(vals, m):\n for _ in range(e):\n t = t * v\n r = r + t\n return r\n\n\ndef psubst(p, images, nv):\n \"\"\"substitute polynomials in nv variables (dicts) for the variables of p\"\"\"\n r = {}\n for m, c in p.items():\n t = {tuple([0] * nv): c}\n for img, e in zip(images, m):\n for _ in range(e):\n t = pmul(t, img)\n r = padd(r, t)\n return r\n\n\ndef pdiff(p, i):\n r = {}\n for m, c in p.items():\n if m[i]:\n mm = list(m)\n mm[i] -= 1\n mm = tuple(mm)\n r[mm] = r.get(mm, 0) + c * m[i]\n return {m: c for m, c in r.items() if not _iszero(c)}\n\n# ---------------------------------------------------------------- the surface\n\n\n# exponents (x, y, z, t)\nF_INT = {(3, 0, 0, 0): 1, (2, 1, 0, 0): 2, (0, 3, 0, 0): 1, (0, 2, 1, 0): 1, (1, 0, 2, 0): 1,\n (0, 0, 3, 0): 1, (1, 0, 0, 2): 1, (0, 1, 0, 2): -1, (0, 0, 1, 2): -1, (0, 1, 1, 1): 1,\n (0, 0, 0, 3): 1}\n\n# G = sum (b + c s) * monomial ; entries monomial: (b, c)\nG_INT = {(2, 1, 0, 0): (102, -18), (2, 0, 1, 0): (-281, -13), (2, 0, 0, 1): (-119, -19),\n (1, 2, 0, 0): (288, 0), (1, 1, 1, 0): (124, -4), (1, 1, 0, 1): (-416, 32),\n (1, 0, 2, 0): (59, -89), (1, 0, 0, 2): (59, -89), (0, 3, 0, 0): (75, -9),\n (0, 2, 1, 0): (107, -41), (0, 2, 0, 1): (112, -16), (0, 1, 1, 1): (59, -89),\n (0, 1, 0, 2): (-59, 89), (0, 0, 3, 0): (59, -89), (0, 0, 1, 2): (-59, 89),\n (0, 0, 0, 3): (59, -89)}\n\nF_L = {m: L.rat(c) for m, c in F_INT.items()}\nG_L = {m: L((b, 0, 0, c, 0, 0)) for m, (b, c) in G_INT.items()}\n\n\ndef F_val(x, y, z, t):\n return (x**3 + 2 * x**2 * y + y**3 + y**2 * z + x * z**2 + z**3 + t**2 * x - t**2 * y\n - t**2 * z + t * y * z + t**3)\n\n\ndef F_grad(x, y, z, t):\n return (3 * x * x + 4 * x * y + z * z + t * t,\n 2 * x * x + 3 * y * y + 2 * y * z - t * t + t * z,\n y * y + 2 * x * z + 3 * z * z - t * t + t * y,\n 2 * t * x - 2 * t * y - 2 * t * z + y * z + 3 * t * t)\n\n\ndef G_val(pt, s):\n \"\"\"G(pt) with s replaced by the integer s (exact integer)\"\"\"\n r = 0\n for m, (b, c) in G_INT.items():\n v = b + c * s\n for xi, e in zip(pt, m):\n v *= xi ** e\n r += v\n return r\n\n\ndef factorint(n):\n n = abs(n)\n f, p = {}, 2\n while p * p <= n:\n while n % p == 0:\n f[p] = f.get(p, 0) + 1\n n //= p\n p += 1 if p == 2 else 2\n if n > 1:\n f[n] = f.get(n, 0) + 1\n return f\n\n\ndef fmt_factor(f):\n return ' * '.join('%d^%d' % (p, e) if e > 1 else str(p) for p, e in sorted(f.items()))\n\n\ndef legendre(a, p):\n a %= p\n if a == 0:\n return 0\n return 1 if pow(a, (p - 1) // 2, p) == 1 else -1\n" }, { "path": "anc/code/1.4.1/local_residues.c", "size_bytes": 4237, "sha256": "09f7f4b1799e98b201c8aeaaa3387588ee804fede33d9fdafbb2b916df02bd8d", "mode": 420, "language": "C", "encoding": "utf-8", "text": "/* Codes 1.4.1d (p = 2) and 1.4.1e (p = 3): exhaustive residue check of v_p(G) on S.\n *\n * Usage: ./local_residues p k (modulus N = p^k; used with (p,k) = (2,5), (2,6), (3,3), (3,4))\n *\n * Visits every quadruple (x,y,z,t) mod N that is primitive (not all coordinates divisible by p) and\n * satisfies F = 0 mod N, and evaluates G = G0 + s*G1 mod N at both p-adic square roots s of -23\n * (taken mod N; they are the residues mod N of the roots of s^2 + 23 modulo 4N for p = 2 and\n * modulo pN for p = 3). Prints the number of such quadruples and the histogram of the pair\n * (v_p of G at the first root, v_p of G at the second root); v = k means \"0 mod N\".\n * The roots are listed with their residue mod 3 (p = 3) or mod 8 (p = 2).\n * Exit status 1 unless exactly one pair occurs and both of its entries are < k (then the two\n * valuations are determined by the residues mod N, for every p-adic point of S).\n * C library only.\n */\n#include \n#include \n#include \n\ntypedef int64_t i64;\n\nstatic i64 md(i64 a, i64 n) { a %= n; return a < 0 ? a + n : a; }\n\nstatic i64 F(i64 x, i64 y, i64 z, i64 t) {\n return x*x*x + 2*x*x*y + y*y*y + y*y*z + x*z*z + z*z*z + t*t*x - t*t*y - t*t*z + t*y*z + t*t*t;\n}\n\nstatic void G(i64 x, i64 y, i64 z, i64 t, i64 *g0, i64 *g1) {\n *g0 = 102*x*x*y - 281*x*x*z - 119*x*x*t + 288*x*y*y + 124*x*y*z - 416*x*y*t + 59*x*z*z\n + 59*x*t*t + 75*y*y*y + 107*y*y*z + 112*y*y*t + 59*y*z*t - 59*y*t*t + 59*z*z*z\n - 59*z*t*t + 59*t*t*t;\n *g1 = -18*x*x*y - 13*x*x*z - 19*x*x*t - 4*x*y*z + 32*x*y*t - 89*x*z*z - 89*x*t*t\n - 9*y*y*y - 41*y*y*z - 16*y*y*t - 89*y*z*t + 89*y*t*t - 89*z*z*z + 89*z*t*t\n - 89*t*t*t;\n}\n\nstatic int val(i64 a, i64 p, int k) {\n int v = 0;\n if (a == 0) return k;\n while (a % p == 0) { a /= p; v++; }\n return v;\n}\n\nint main(int argc, char **argv) {\n if (argc != 3) { fprintf(stderr, \"usage: %s p k\\n\", argv[0]); return 2; }\n i64 p = atoll(argv[1]);\n int k = atoi(argv[2]);\n if ((p != 2 && p != 3) || k < 1 || k > 7) { fprintf(stderr, \"p must be 2 or 3, 1 <= k <= 7\\n\"); return 2; }\n i64 N = 1;\n for (int i = 0; i < k; i++) N *= p;\n i64 M = (p == 2) ? 4 * N : p * N;\n i64 r[4]; int nr = 0;\n for (i64 s = 0; s < M; s++)\n if (md(s * s + 23, M) == 0) {\n i64 sr = s % N; int dup = 0;\n for (int j = 0; j < nr; j++) if (r[j] == sr) dup = 1;\n if (!dup) { if (nr == 2) { printf(\"more than two roots\\n\"); return 1; } r[nr++] = sr; }\n }\n if (nr != 2) { printf(\"expected two roots, found %d\\n\", nr); return 1; }\n if (r[0] > r[1]) { i64 tmp = r[0]; r[0] = r[1]; r[1] = tmp; }\n long long hist[8][8] = {{0}};\n long long count = 0;\n for (i64 x = 0; x < N; x++)\n for (i64 y = 0; y < N; y++)\n for (i64 z = 0; z < N; z++)\n for (i64 t = 0; t < N; t++) {\n if (x % p == 0 && y % p == 0 && z % p == 0 && t % p == 0) continue;\n if (md(F(x, y, z, t), N) != 0) continue;\n count++;\n i64 g0, g1;\n G(x, y, z, t, &g0, &g1);\n g0 = md(g0, N); g1 = md(g1, N);\n hist[val(md(g0 + r[0] * g1, N), p, k)][val(md(g0 + r[1] * g1, N), p, k)]++;\n }\n i64 lab = (p == 2) ? 8 : 3;\n printf(\"p = %lld, N = %lld: square roots of -23 mod N: s = %lld (= %lld mod %lld), s = %lld (= %lld mod %lld)\\n\",\n (long long)p, (long long)N, (long long)r[0], (long long)(r[0] % lab), (long long)lab,\n (long long)r[1], (long long)(r[1] % lab), (long long)lab);\n printf(\"primitive solutions of F = 0 mod N: %lld\\n\", count);\n int pairs = 0, ok = 1;\n for (int i = 0; i < 8; i++)\n for (int j = 0; j < 8; j++)\n if (hist[i][j]) {\n pairs++;\n if (i >= k || j >= k) ok = 0;\n printf(\" (v_p G at s = %lld, v_p G at s = %lld) = (%d, %d): %lld quadruples\\n\",\n (long long)r[0], (long long)r[1], i, j, hist[i][j]);\n }\n if (pairs != 1 || !ok) { printf(\"FAIL: valuations not constant or not determined\\n\"); return 1; }\n printf(\"PASS: one valuation pair, determined modulo N\\n\");\n return 0;\n}\n" }, { "path": "anc/code/1.4.1/run_all.py", "size_bytes": 3025, "sha256": "8903d8e53798665d8ef749503973504c31b8953031eb9c627570bf730444e4db", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the checks of Section 1.4.1 and compare with expected/.txt.\n\nUsage: python3 run_all.py # every code id, compare with expected/\n python3 run_all.py 1.4.1c # only the listed id(s)\n python3 run_all.py --write # regenerate expected/.txt\nPython scripts run in a fresh `python3 -I` process; local_residues.c is compiled with the C compiler\n`cc` (or $CC) into a temporary directory. Do not use python -O (the checks are asserts).\n\"\"\"\nimport os\nimport subprocess\nimport sys\nimport tempfile\nfrom pathlib import Path\n\nHERE = Path(__file__).resolve().parent\nSTEPS = [\n ('1.4.1a', [['py', '1.4.1a_fields.py']]),\n ('1.4.1b', [['py', '1.4.1b_curve.py']]),\n ('1.4.1c', [['py', '1.4.1c_bad_primes.py']]),\n ('1.4.1d', [['c', '2', '5'], ['c', '2', '6']]),\n ('1.4.1e', [['c', '3', '3'], ['c', '3', '4']]),\n ('1.4.1f', [['py', '1.4.1f_local_points.py']]),\n]\n\n\ndef main():\n if not __debug__:\n raise SystemExit('Run without -O: the checks are assert statements.')\n args = sys.argv[1:]\n write = '--write' in args\n want = [a for a in args if a != '--write']\n known = [cid for cid, _ in STEPS]\n bad = [w for w in want if w not in known]\n if bad:\n raise SystemExit('unknown code id(s): %s; known: %s' % (bad, known))\n failures = []\n with tempfile.TemporaryDirectory() as tmp:\n exe = Path(tmp) / 'local_residues'\n cc = os.environ.get('CC', 'cc')\n subprocess.run([cc, '-O2', '-o', str(exe), str(HERE / 'local_residues.c')], check=True)\n for cid, jobs in STEPS:\n if want and cid not in want:\n continue\n out = []\n for job in jobs:\n if job[0] == 'py':\n cmd = [sys.executable, '-I', '-B', str(HERE / job[1])]\n label = 'python3 -I -B ' + job[1]\n else:\n cmd = [str(exe)] + job[1:]\n label = './local_residues ' + ' '.join(job[1:])\n r = subprocess.run(cmd, cwd=HERE, capture_output=True, text=True)\n out.append('### ' + label + '\\n' + r.stdout)\n if r.returncode:\n sys.stdout.write(''.join(out) + r.stderr)\n raise SystemExit('FAIL %s (%s)' % (cid, label))\n text = ''.join(out)\n sys.stdout.write('=== %s ===\\n%s' % (cid, text))\n exp = HERE / 'expected' / ('%s.txt' % cid)\n if write:\n exp.write_text(text)\n print('--> wrote', exp.relative_to(HERE))\n elif exp.exists():\n same = exp.read_text() == text\n print('--> %s: %s' % (exp.relative_to(HERE), 'identical' if same else 'DIFFERENT'))\n if not same:\n failures.append(cid)\n if failures:\n raise SystemExit('output differs from expected/ for: %s' % failures)\n print('PASS: all requested checks of Section 1.4.1')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.4.10/1.4.10a_elementary.py", "size_bytes": 2177, "sha256": "26a6812c2c8d61b0b5bc84c3941324be4b4abbe12d2aea0d6d28191a4e4cfb45", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.10a (Section 1.4.10, 4x^5 + 4y^5 + 11z^5 = 0): size H, the reduction z = 2w to\nx^5 + y^5 + 88w^5 = 0, hypotheses of Lemma lem:1.4:terms, the levels of Lemma lem:1.4:level, the points\nmodulo 3 and T_3 (Lemma lem:1.4.10-three), and (for the remark of the section) the sets modulo 25.\nWritten for the paper.\nRun: python3 -I 1.4.10a_elementary.py (< 1 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import grechuk_H, report_levels, projective_points, report_traces, fifth_powers_mod, \\\n fifth_power_witness, factor, frey_trace_count\n\nco = (4, 4, 11)\nH = grechuk_H(co)\nprint('4x^5 + 4y^5 + 11z^5 = 0: H = %d' % H)\nassert H == 608\nfor (a, b, nm) in ((4, 11, 'x = 0'), (4, 11, 'y = 0')):\n p = fifth_power_witness(a, b)\n print(' %s: -%d/%d is not a fifth power (v_%d)' % (nm, a, b, p))\nprint(' z = 0: x^5 = -y^5, so y = -x')\nassert all((11 * pow(z, 5, 4)) % 4 for z in (1, 3)) and (11 * 2 ** 5) % 4 == 0\nassert 11 * 2 ** 5 // 4 == 88 and factor(88) == {2: 3, 11: 1}\nprint('mod 4: 11z^5 = 0, so z = 2w and x^5 + y^5 + 88w^5 = 0 (88 = 2^3*11)')\nreport_levels(1, 1, 88, [22, 88], 'xyw')\n# modulo 3\npts = projective_points(1, 1, 88, 3)\nprint('projective points of x^5 + y^5 + 88w^5 = 0 over F_3: %s' % pts)\nassert sorted(pts) == [(0, 1, 2), (1, 0, 2), (1, 1, 1), (1, 2, 0)]\nfor s in (1, 2): # x = y = w = s mod 3, normalized pair u' = -x^5, v' = -88w^5\n u, v = (-s ** 5) % 3, (-88 * s ** 5) % 3\n assert (u, v) == ((-s) % 3, (-s) % 3)\n a3 = frey_trace_count(u, v, 3)\n print(' x = y = w = %d mod 3: reduced Frey curve Y^2 = X(X - %d)(X + %d) = X^3 - X, a_3 = %d' % (s, u, v, a3))\n assert a3 == 0\nreport_traces(1, 1, 88, {3: [0, 1, 4]})\n# remark: modulo 25\nS = sorted(t for t in fifth_powers_mod(25) if t)\nSS = sorted({(a + b) % 25 for a in S for b in S})\nm88 = sorted({(-88 * t) % 25 for t in S})\nprint('nonzero fifth powers mod 25 S = %s; S + S = %s; -88 S = %s' % (S, SS, m88))\nassert S == [1, 7, 18, 24] and not set(m88) & set(S) and not set(m88) & set(SS)\nprint(' -88 S is disjoint from S and from S + S')\nprint('PASS 1.4.10a')\n" }, { "path": "anc/code/1.4.10/1.4.10b_newforms.gp", "size_bytes": 1911, "sha256": "a623e243fe083194a904fd210e3c093e06419e75fbbccdfc6f58b37c177ff979", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.4.10b (Section 1.4.10, 4x^5 + 4y^5 + 11z^5 = 0, z = 2w). Written for the paper. PARI/GP 2.15+.\n\\\\ (1) The Frey curve of Lemma lem:1.4.10-frey at 2: (u, v, w') = (-x^5, -88w^5, -y^5) with x = 1 mod 4;\n\\\\ for x = 1, 5, ..., 61 and w = 1..64: f_2 = 3, v_2(Delta_min) = 10 (w odd) and f_2 = 1,\n\\\\ v_2(Delta_min) = 10 v_2(w) - 2 (w even), as in Lemma lem:1.4:frey.\n\\\\ (2) S_2(Gamma_0(22))^new = 0; S_2(Gamma_0(88))^new: dimension, Galois orbits, the minimal polynomials of\n\\\\ a_3, their values at 0, 1, 4 modulo 5, and the sieve of fqsieve.gp with T_3 = {0, 1, 4}.\n\\\\ Run: gp -q 1.4.10b_newforms.gp (< 1 s)\ndefault(parisizemax, 1000000000);\nread(\"../common/frey_quintic/fqsieve.gp\");\n{\n my(n = 0, M, B, P);\n forstep (x = 1, 61, 4, for (w = 1, 64, my(e = valuation(w, 2));\n fq_check2(-x^5, -88*w^5, if (e, 1, 3), if (e, 10*e - 2, 10)); n++));\n print(\"(1) Frey curve at 2: f_2 = 3, v_2(Delta_min) = 10 (w odd); f_2 = 1, v_2(Delta_min) = 10 v_2(w) - 2\",\n \" (w even): \", n, \" residue classes\");\n if (mfdim([22, 2], 0) != 0, error(\"level 22\"));\n print(\"(2) level 22: dim S_2^new = 0\");\n M = mfinit([88, 2], 0); B = mfeigenbasis(M);\n if ([mfdim(M), #B] != [3, 2], error(\"level 88\"));\n P = vector(#B, i, minpoly(mfcoef(B[i], 3)));\n if (P != [x + 3, x^2 - x - 4], error(\"minimal polynomials\"));\n print(\" level 88: dim S_2^new = 3, orbits of dimensions \", vector(#B, i, poldegree(mffields(M)[i])),\n \"; minimal polynomials of a_3: \", P);\n print(\" values at T = 0, 1, 4 modulo 5: \", vector(#P, i, vector(3, k, subst(P[i], x, [0,1,4][k]) % 5)));\n for (i = 1, #P, for (k = 1, 3, if (subst(P[i], x, [0,1,4][k]) % 5 == 0, error(\"root mod 5\"))));\n S = fq_sieve(88, [3], [[0,1,4]]); if (#fq_print(88, [3], [[0,1,4]], S), error(\"survivor at 88\"));\n print(\"PASS 1.4.10b: no newform of level 22; no newform of level 88 has a_3 in {0, 1, 4} modulo a prime above 5\");\n}\nquit\n" }, { "path": "anc/code/1.4.10/run_all.py", "size_bytes": 793, "sha256": "cdcbd1e37b3fb85dfe02e7721c43c4f3ff805debdd084e9f749e95d894440408", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the codes of Section 1.4.10 (4x^5 + 4y^5 + 11z^5 = 0) and compare with expected/.\n\nUsage: python3 run_all.py # all codes of this folder\n python3 run_all.py ... # only the listed code ids\n python3 run_all.py --update # rewrite expected/ from this run\nRequires Python 3 (standard library) and PARI/GP (gp on the PATH, or $GP); see README.md.\n\"\"\"\nimport sys\nfrom pathlib import Path\nHERE = Path(__file__).resolve().parent\nsys.path.insert(0, str(HERE.parent / 'common' / 'frey_quintic'))\nfrom runner import run_steps, table_consistency\n\nSTEPS = [\n ('1.4.10a', 'py', '1.4.10a_elementary.py'),\n ('1.4.10b', 'gp', '1.4.10b_newforms.gp'),\n]\nCHECKS = []\n\nif __name__ == '__main__':\n run_steps(HERE, STEPS, sys.argv[1:], CHECKS)\n" }, { "path": "anc/code/1.4.2/1.4.2a_fields.py", "size_bytes": 3226, "sha256": "394246877450692290f55e936a445a00bbd1840eb63800cc8a0e701f399d0728", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.2a (Section 1.4.2, Lemma lem:1.4.2-field): the fields K = Q(sqrt(-23)) and L = K(q), h(q) = q^3 - q + 1.\n\nWritten for this bundle (not the source's verifiers). Python 3 with SymPy (discriminant, resultant).\nChecks:\n * h has no rational root (so it is irreducible over Q), disc(h) = -23 (squarefree, so Z[q] is the ring of\n integers of Q(q));\n * h mod 23 = (q-13)^2 (q-20) (a simple root 20); h has no root modulo 2 and modulo 3;\n * 2 and 3 split in K (-23 = 1 mod 8 and mod 3); the 2-adic root s2 = 1 (mod 4) of s^2 = -23 is 45 mod 256,\n the 3-adic root s3 = 1 (mod 3) is 25 mod 81 and 187 mod 243;\n * N(3q^2 - 1) = Res(h, h') = 23 (the denominator 4(3q^2-1) of the plane-section identity);\n * confirmation of the case distinction of the lemma for all primes p < 3000: if p is inert in K, h has exactly\n one root mod p, and it is simple; if p splits, h has 0 or 3 roots mod p;\n * the reduced forms of discriminant -23 are (1,1,6), (2,1,3), (2,-1,3) (class number 3; used only in a remark).\n\"\"\"\nimport os\nimport sys\nfrom pathlib import Path\nos.environ.setdefault('SYMPY_GROUND_TYPES', 'python')\nsys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'common' / 'cyclic_cubic'))\nimport sympy as sp\nfrom restree import primes_upto, roots_mod_p, sqrt_2adic, sqrt_padic, legendre\n\nq = sp.symbols('q')\nh = q**3 - q + 1\nH = [1, 0, -1, 1]\nD = -23\n\nassert all(h.subs(q, r) != 0 for r in (1, -1))\ndisc = sp.discriminant(h, q)\nassert disc == -23 and sp.factorint(23) == {23: 1}\nprint('h = q^3 - q + 1: no rational root; disc(h) =', disc, '(squarefree)')\n\nr23 = roots_mod_p(H, 23)\nassert r23 == [13, 20]\nassert all(c % 23 == 0 for c in sp.Poly(sp.expand((q - 13)**2 * (q - 20) - h), q).all_coeffs())\nhp = lambda r: 3 * r * r - 1\nassert hp(13) % 23 == 0 and hp(20) % 23 != 0\nprint('h mod 23 = (q-13)^2 (q-20); simple root 20')\nassert roots_mod_p(H, 2) == [] and roots_mod_p(H, 3) == []\nprint('h has no root mod 2 and mod 3 (irreducible there)')\n\nassert D % 8 == 1 and D % 3 == 1\ns2 = sqrt_2adic(D, 20)\nassert s2 % 256 == 45\ns3 = sqrt_padic(D, 3, 10, 1)\nassert s3 % 81 == 25 and s3 % 243 == 187\nprint('2 and 3 split in K; s2 = %d mod 2^20 (= 45 mod 256), s3 = %d mod 3^10 (= 25 mod 81, 187 mod 243)' % (s2, s3))\n\nres = sp.resultant(h, 3 * q**2 - 1, q)\nassert res == 23\nprint('Res(h, 3q^2-1) = N(3q^2-1) =', res)\n\nstats = {}\nfor p in primes_upto(3000):\n if p in (2, 23):\n continue\n r = roots_mod_p(H, p)\n assert all(hp(a) % p for a in r) # p does not divide disc, so the roots are simple\n kind = 'inert' if legendre(D, p) == -1 else 'split'\n if kind == 'inert':\n assert len(r) == 1\n else:\n assert len(r) in (0, 3)\n stats[(kind, len(r))] = stats.get((kind, len(r)), 0) + 1\nprint('primes 3 <= p < 3000, p != 23: (behaviour in K, number of roots of h) ->', sorted(stats.items()))\n\nforms = []\nfor a in range(1, 4):\n for b in range(-a + 1, a + 1):\n if (b * b - D) % (4 * a) == 0:\n c = (b * b - D) // (4 * a)\n if c >= a and not (b < 0 and (a == c)):\n forms.append((a, b, c))\nassert sorted(forms) == [(1, 1, 6), (2, -1, 3), (2, 1, 3)]\nprint('reduced forms of discriminant -23:', sorted(forms))\nprint('PASS 1.4.2a')\n" }, { "path": "anc/code/1.4.2/1.4.2b_plane.py", "size_bytes": 3023, "sha256": "7058f8647c50c62066bd1f20b355556b55dfce5180849e707ea95fa364d2a738", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.2b (Section 1.4.2, Lemmas lem:1.4.2-plane and lem:1.4.2-nonzero): the plane section l_+ = 0.\n\nWritten for this bundle (not the source's verifiers). Python 3 with SymPy.\nL = K(q), K = Q(s), s^2 = -23, h(q) = q^3 - q + 1; tau(q) = (-q + s/h'(q))/2 (disc h = -23 = D*1^2).\nChecks, as polynomial identities over the ring Q[q,s]/(h(q), s^2+23):\n * tau(q) = -q/2 + s(-6q^2 - 9q + 4)/46 is a root of h and tau has order 3;\n * p = -((s-1)q^2 + 8)/(4(3q^2-1)) and F(x, (1-s)x/4, z, t) = -prod_{i=0}^{2} (t - tau^i(p) x - tau^i(q) z);\n * the same identity again through a resultant, without tau: 64*23*F(x,(1-s)x/4,z,t) = -Res_q(h, N),\n N = 4(3q^2-1)(t - qz) + ((s-1)q^2 + 8)x;\n * det [(-tau^i(p), -tau^i(q), 1)]_{i=0,1,2} = (s-1)/2, of norm 6;\n * 4(3q^2-1) p = (1-s)q^2 - 8 (integral);\n * F(0,0,z,t) = -(z^3 - z^2 t + t^3) and r^3 - r^2 + 1 has no rational root;\n * H = sum |coefficient| * 2^3 = 96.\n\"\"\"\nimport os\nimport sys\nfrom pathlib import Path\nos.environ.setdefault('SYMPY_GROUND_TYPES', 'python')\nsys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'common' / 'cyclic_cubic'))\nimport sympy as sp\nfrom cubicfield import CubicOverQuadratic, u, s\n\nx, y, z, t, r = sp.symbols('x y z t r')\nF = 2*x**3 + x**2*y + x*y**2 + y**3 + y**2*z - 2*x*z**2 - z**3 + t**2*y + t*z**2 - t**3\nh = u**3 - u + 1 # u plays the role of q\nL = CubicOverQuadratic(h, -23, 1)\nq = u\nprint('tau(q) =', L.tau_u)\nassert L.tau_u == L.red(-q/2 + s*(-6*q**2 - 9*q + 4)/46)\n\ninv = L.inverse(3*q**2 - 1)\np = L.red(-((s - 1)*q**2 + 8) * inv / 4)\nprint('p =', p)\nP = L.orbit(p)\nQo = L.orbit(q)\nprod = sp.Integer(1)\nfor i in range(3):\n prod = L.red(sp.expand(prod * (t - P[i]*x - Qo[i]*z)))\nlhs = L.red(F.subs(y, (1 - s)*x/4))\nassert L.red(lhs + prod) == 0\nprint('F(x,(1-s)x/4,z,t) = -prod_i (t - tau^i(p) x - tau^i(q) z): verified')\n\nN = 4*(3*q**2 - 1)*(t - q*z) + ((s - 1)*q**2 + 8)*x\nR = sp.resultant(h, N, u)\nassert sp.expand(sp.rem(sp.Poly(sp.expand(64*23*F.subs(y, (1 - s)*x/4) + R), s), sp.Poly(s**2 + 23, s)).as_expr()) == 0\nprint('resultant form of the identity: verified')\n\nM = sp.Matrix([[-P[i], -Qo[i], 1] for i in range(3)])\nd = L.red(M.det())\nassert d == L.red((s - 1)/2)\nnd = L.norm_K_Q(d)\nassert nd == 6\nprint('det =', d, ' N(det) =', nd)\n\nnum = L.red(4*(3*q**2 - 1)*p)\nassert num == L.red((1 - s)*q**2 - 8)\nprint('4(3q^2-1)p =', num, '(integral)')\n\n# conjugate plane, for completeness: s -> -s\nlhs2 = L.red(F.subs(y, (1 + s)*x/4))\nprod2 = sp.Integer(1)\npc = L.conj(p)\nfor i in range(3):\n prod2 = L.red(sp.expand(prod2 * (t - L.orbit(pc)[i]*x - Qo[i]*z)))\nassert L.red(lhs2 + prod2) == 0\nprint('conjugate identity (s -> -s): verified')\n\nF00 = sp.expand(F.subs({x: 0, y: 0}))\nassert sp.expand(F00 + (z**3 - z**2*t + t**3)) == 0\nc = r**3 - r**2 + 1\nassert all(c.subs(r, v) != 0 for v in (1, -1))\nprint('F(0,0,z,t) =', F00, '; r^3 - r^2 + 1 has no rational root')\nHval = sum(abs(c) * 2**3 for c in sp.Poly(F, x, y, z, t).coeffs())\nassert Hval == 96\nprint('H =', Hval)\nprint('PASS 1.4.2b')\n" }, { "path": "anc/code/1.4.2/1.4.2c_residues.py", "size_bytes": 5182, "sha256": "11fc947473798ef848c056fa3a6f0844c18f26c9e0e5e7388a13565e9d9f1913", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.2c (Section 1.4.2, Lemmas lem:1.4.2-two and lem:1.4.2-three): all primitive 2-adic and 3-adic points.\n\nWritten for this bundle (not the source's verifiers). Pure Python (standard library).\nl_+ = (-1+s)x + 4y, l_- = (-1-s)x + 4y, with s = s2 = 45 (mod 256) in Z_2 and s = s3 = 187 (mod 243) in Z_3\n(the roots of s^2 = -23 that are 1 mod 4, resp. 1 mod 3; see code 1.4.2a).\n * complete residue trees (normalized primitive points, see restree.py) modulo 2^8 and 3^5; the pair\n (v(l_+), v(l_-)) is determined (smaller than the precision) on every class, and the pairs are\n (2,1), (5,1), (2,4) at 2 and (0,0), (3,0) at 3, each according to the residue class mod p;\n * the precision at which every pair is first determined (2^6 and 3^4);\n * the facts used in the proofs by hand: the points mod 2 and mod 3; mod 16, y = 13x if x,y,z,t are odd, and\n x = 6y if x is even and y,z,t are odd (all primitive solutions mod 16); at the point (1,0,0,-1) mod 3, every\n solution mod 3^4 with x = 1 has y = 3Y with Y = 7 or 16 (mod 27), and the three reduction steps of the text;\n * a direct enumeration of ALL primitive solutions mod 2^6 and mod 3^4 (no normalization, no tree) is done by\n the C program ../common/cyclic_cubic/brute_residues.c (case B), run by run_all.py.\n\"\"\"\nimport sys\nfrom itertools import product\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'common' / 'cyclic_cubic'))\nfrom restree import tree, level1, val_mod\n\n\ndef F(x, y, z, t):\n return 2*x**3 + x*x*y + x*y*y + y**3 + y*y*z - 2*x*z*z - z**3 + t*t*y + t*z*z - t**3\n\n\ndef lp(P, s0):\n x, y, z, t = P\n return (-1 + s0)*x + 4*y\n\n\ndef lm(P, s0):\n x, y, z, t = P\n return (-1 - s0)*x + 4*y\n\n\ndef pairs(p, k, s0):\n sol, m, sizes = tree(F, p, k)\n assert (s0*s0 + 23) % m == 0\n dist = {}\n by_res = {}\n undetermined = 0\n for (i, P) in sol:\n a, b = val_mod(lp(P, s0), p, m), val_mod(lm(P, s0), p, m)\n if a is None or b is None:\n undetermined += 1\n dist[(a, b)] = dist.get((a, b), 0) + 1\n by_res.setdefault(tuple(c % p for c in P), set()).add((a, b))\n return sizes, dist, by_res, undetermined\n\n\nassert [P for _, P in level1(F, 2)] == [(1, 0, 0, 0), (1, 1, 1, 1), (0, 1, 1, 1)]\nsizes, dist, by_res, und = pairs(2, 8, 45)\nprint('p=2, mod 2^8: level sizes', sizes, ' pairs', sorted(dist.items()))\nassert und == 0 and set(dist) == {(2, 1), (5, 1), (2, 4)}\nassert by_res == {(1, 0, 0, 0): {(2, 1)}, (1, 1, 1, 1): {(5, 1)}, (0, 1, 1, 1): {(2, 4)}}\nassert all((a - b) % 3 == 1 for a, b in dist)\nprint(' by residue mod 2:', {k: sorted(v) for k, v in by_res.items()}, ' v(l_+) - v(l_-) = 1 mod 3 on all classes')\nfirst = [k for k in range(1, 9) if pairs(2, k, 45)[3] == 0][0]\nassert first == 6\nprint(' every pair determined from 2^%d on' % first)\n\nassert [P for _, P in level1(F, 3)] == [(1, 0, 0, 2), (1, 1, 1, 0), (1, 1, 2, 0), (0, 1, 0, 2)]\nsizes, dist, by_res, und = pairs(3, 5, 187)\nprint('p=3, mod 3^5: level sizes', sizes, ' pairs', sorted(dist.items()))\nassert und == 0 and set(dist) == {(0, 0), (3, 0)}\nassert by_res[(1, 0, 0, 2)] == {(3, 0)} and all(v == {(0, 0)} for k, v in by_res.items() if k != (1, 0, 0, 2))\nassert all((a - b) % 3 == 0 for a, b in dist)\nprint(' by residue mod 3:', {k: sorted(v) for k, v in by_res.items()}, ' v(l_+) - v(l_-) = 0 mod 3 on all classes')\nfirst = [k for k in range(1, 6) if pairs(3, k, 187)[3] == 0][0]\nassert first == 4\nprint(' every pair determined from 3^%d on' % first)\n\n# facts for the proofs by hand\nodd = set()\nxeven = set()\nfor P in product(range(16), repeat=4):\n if all(c % 2 == 0 for c in P) or F(*P) % 16:\n continue\n x, y, z, t = P\n if all(c % 2 for c in P):\n odd.add((y - 13*x) % 16)\n if x % 2 == 0 and y % 2 and z % 2 and t % 2:\n xeven.add((x - 6*y) % 16)\nassert odd == {0} and xeven == {0}\nprint('mod 16: x,y,z,t odd => y = 13x; x even, y,z,t odd => x = 6y')\nsol, m, _ = tree(F, 3, 4)\nYs = sorted({(P[1] // 3) % 27 for (i, P) in sol if tuple(c % 3 for c in P) == (1, 0, 0, 2)})\nassert Ys == [7, 16]\nprint('at (1,0,0,-1) mod 3, x = 1: y = 3Y with Y mod 27 in', Ys)\n# the reduction steps of the proof by hand at (1,0,0,-1): F(1,3Y,3Z,-1+3T)/3 modulo 3, 9, 27\nG = lambda Y, Z, T: F(1, 3*Y, 3*Z, -1 + 3*T)\nassert all(G(Y, Z, T) % 3 == 0 for Y in range(27) for Z in range(27) for T in range(27))\nassert {Y % 3 for Y in range(3) for Z in range(3) for T in range(3) if (G(Y, Z, T)//3) % 3 == 0} == {1}\nassert all(((G(1 + 3*Y1, Z, T)//3) - 6*(1 + Y1)) % 9 == 0 for Y1 in range(3) for Z in range(9) for T in range(9))\nassert all(((G(7 + 9*Y2, Z, T)//3) - 9*(2*Y2 + 1 + 2*T*T + T*Z*Z - Z*Z)) % 27 == 0\n for Y2 in range(3) for Z in range(9) for T in range(9))\nassert {(2*T*T + T*Z*Z + 2*Z*Z) % 3 for T in range(3) for Z in range(3)} == {0, 2}\nprint('hand reduction at (1,0,0,-1): F/3 = 1+2Y (mod 3), = 6(1+Y1) (mod 9) for Y = 1+3Y1,')\nprint(' = 9(2Y2+1+2T^2+TZ^2-Z^2) (mod 27) for Y = 7+9Y2; 2T^2+TZ^2+2Z^2 mod 3 in {0,2}')\nassert ((45 - 1) // 4) % 64 == 11 and ((45 + 1) // 2) % 128 == 23 and 187 % 81 == 25\nprint('(s2-1)/4 = 11 mod 64, (s2+1)/2 = 23 mod 128, s3 = 25 mod 81')\nprint('PASS 1.4.2c')\n" }, { "path": "anc/code/1.4.2/1.4.2d_split_primes.py", "size_bytes": 1597, "sha256": "519ffa3cb87decaa0272508a54992fa8ec10792c53b8b2a1d30a2f327ef1a858", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.2d (Section 1.4.2, after Lemma lem:1.4.2-good; a confirmation, not used in the proof).\n\nWritten for this bundle. Pure Python (standard library).\nFor every prime 5 <= p < 500 that splits in K = Q(sqrt(-23)) and modulo which h = q^3 - q + 1 has no root, and\nfor both square roots s0 of -23 modulo p, the plane cubic F(x, (1-s0)x/4, z, t) has no zero in P^2(F_p). This\nis the reduction modulo w of the statement of Lemma lem:1.4.2-good (no point of S over Z_p with l_+ = 0 mod w),\nwhich the lemma proves for all such p by the determinant argument.\n\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'common' / 'cyclic_cubic'))\nfrom restree import primes_upto, roots_mod_p, legendre\n\n\ndef F(x, y, z, t):\n return 2*x**3 + x*x*y + x*y*y + y**3 + y*y*z - 2*x*z*z - z**3 + t*t*y + t*z*z - t**3\n\n\ndef plane_zeros(p, s0):\n c = (1 - s0) * pow(4, -1, p) % p\n pts = [(1, b, d) for b in range(p) for d in range(p)] + [(0, 1, d) for d in range(p)] + [(0, 0, 1)]\n return [(X, Z, T) for (X, Z, T) in pts if F(X, c * X % p, Z, T) % p == 0]\n\n\ntested = []\nfor p in primes_upto(500):\n if p < 5 or legendre(-23, p) != 1 or roots_mod_p([1, 0, -1, 1], p):\n continue\n s0 = next(a for a in range(p) if (a * a + 23) % p == 0)\n for sg in (s0, p - s0):\n assert plane_zeros(p, sg) == [], (p, sg)\n tested.append(p)\nprint('split primes with h irreducible, 5 <= p < 500:', len(tested), 'primes, from', tested[0], 'to', tested[-1])\nprint('no zero of the plane section mod p for either root of s^2 = -23')\nprint('PASS 1.4.2d')\n" }, { "path": "anc/code/1.4.2/run_all.py", "size_bytes": 2209, "sha256": "8d35851193ef03a198a58215f40eababa87dbcdf0e94cc3d22e7e0a9371830c3", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the checks of Section 1.4.2 (2x^3+x^2y+xy^2+y^3+y^2z-2xz^2-z^3+t^2y+tz^2-t^3 = 0).\n\nUsage: python3 run_all.py # every code id, in order\n python3 run_all.py 1.4.2c # only the listed id(s)\nEach Python script runs in a fresh `python3 -I -B` process; the C program ../common/cyclic_cubic/brute_residues.c\nis compiled into a temporary directory with $CC (default: cc) and run with the argument B.\nDo not use python -O (the checks are asserts). Written for this bundle.\n\"\"\"\nimport os\nimport subprocess\nimport sys\nimport tempfile\nfrom pathlib import Path\n\nHERE = Path(__file__).resolve().parent\nCOMMON = HERE.parent / 'common' / 'cyclic_cubic'\nSTEPS = [\n ('1.4.2a', [('py', '1.4.2a_fields.py')]),\n ('1.4.2b', [('py', '1.4.2b_plane.py')]),\n ('1.4.2c', [('py', '1.4.2c_residues.py'), ('c', 'brute_residues.c', 'B')]),\n ('1.4.2d', [('py', '1.4.2d_split_primes.py')]),\n]\n\n\ndef run_c(src, arg, tmp):\n exe = Path(tmp) / src.replace('.c', '')\n cc = os.environ.get('CC', 'cc')\n subprocess.run([cc, '-O2', '-std=c99', '-o', str(exe), str(COMMON / src)], check=True)\n print('=== C: %s %s ===' % (src, arg), flush=True)\n return subprocess.run([str(exe), arg]).returncode\n\n\ndef main():\n if not __debug__:\n raise SystemExit('Run without -O: the checks are assert statements.')\n want = sys.argv[1:]\n known = [cid for cid, _ in STEPS]\n bad = [w for w in want if w not in known]\n if bad:\n raise SystemExit('unknown code id(s): %s; known: %s' % (bad, known))\n with tempfile.TemporaryDirectory() as tmp:\n for cid, items in STEPS:\n if want and cid not in want:\n continue\n for item in items:\n if item[0] == 'py':\n print('=== %s: %s ===' % (cid, item[1]), flush=True)\n rc = subprocess.run([sys.executable, '-I', '-B', str(HERE / item[1])], cwd=HERE).returncode\n else:\n rc = run_c(item[1], item[2], tmp)\n if rc:\n raise SystemExit('FAIL %s (%s)' % (cid, item[1]))\n print('PASS: all requested checks of section 1.4.2')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.4.3/1.4.3a_fields.py", "size_bytes": 3528, "sha256": "1598436ab2a4c9fe331fc724d65121d64df6afd4f8b4de58a8240f11c5990979", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.3a (Section 1.4.3, Lemma lem:1.4.3-field): K = Q(sqrt(-11)) and L = K(u), g(u) = u^3 - 4u - 4.\n\nWritten for this bundle (not the source's verifiers). Python 3 with SymPy (discriminants, resultants, remainders).\nChecks:\n * g has no rational root (irreducible over Q), disc(g) = -176 = -2^4*11; h_C(v) = v^3 - v^2 - v - 1 has\n disc -44 = -2^2*11, u = v^2 - 1 and v = u^2/2 - 1 are inverse maps between the roots (so Q(u) = Q(v)), and\n h_C(v+1) = v^3 + 2v^2 - 2 is Eisenstein at 2 (so Z[v] is the ring of integers and the field discriminant is\n -44; used only in a remark);\n * q = u/2 satisfies 2q^3 - 2q - 1 = 0;\n * g mod 11 = (u-4)^2 (u-3) (a simple root 3); g has no root modulo 3;\n * 3 splits in K (-11 = 1 mod 3), the root s3 = 1 (mod 3) of s^2 = -11 is 31 mod 81; 2 is inert in K\n (-11 = 5 mod 8), and with w = (1+s)/2 (w^2 - w + 3 = 0) we have 2 + s = 1 + 2w, 2 - s = 3 - 2w;\n * N(3u^2 - 4) = Res(g, g') = 176;\n * confirmation of the case distinction for all primes 3 <= p < 3000, p != 11: if p is inert in K, g has exactly\n one root mod p, and it is simple; if p splits, g has 0 or 3 roots mod p.\n\"\"\"\nimport os\nimport sys\nfrom pathlib import Path\nos.environ.setdefault('SYMPY_GROUND_TYPES', 'python')\nsys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'common' / 'cyclic_cubic'))\nimport sympy as sp\nfrom restree import primes_upto, roots_mod_p, sqrt_padic, legendre\n\nu, v, qq, w = sp.symbols('u v q w')\ng = u**3 - 4*u - 4\nG = [1, 0, -4, -4]\nhC = v**3 - v**2 - v - 1\nD = -11\n\nassert all(g.subs(u, r) != 0 for r in (1, -1, 2, -2, 4, -4))\ndg = sp.discriminant(g, u)\ndh = sp.discriminant(hC, v)\nassert dg == -176 and dh == -44\nprint('g = u^3 - 4u - 4: no rational root; disc(g) =', dg, '= -2^4*11; disc(h_C) =', dh)\nassert sp.rem(sp.expand(g.subs(u, v**2 - 1)), hC, v) == 0\nassert sp.rem(sp.expand(hC.subs(v, u**2/2 - 1)), g, u) == 0\nassert sp.rem(sp.expand((v**2 - 1)**2/2 - 1 - v), hC, v) == 0\nprint('u = v^2 - 1, v = u^2/2 - 1: inverse maps between the roots of h_C and g')\ne = sp.Poly(sp.expand(hC.subs(v, v + 1)), v)\nassert e.as_expr() == v**3 + 2*v**2 - 2\nprint('h_C(v+1) =', e.as_expr(), '(Eisenstein at 2)')\nassert sp.expand(2*(u/2)**3 - 2*(u/2) - 1 - g/4) == 0\nprint('q = u/2: 2q^3 - 2q - 1 = g(u)/4')\n\nassert roots_mod_p(G, 11) == [3, 4]\nassert all(c % 11 == 0 for c in sp.Poly(sp.expand((u - 4)**2*(u - 3) - g), u).all_coeffs())\ngp = lambda r: 3*r*r - 4\nassert gp(4) % 11 == 0 and gp(3) % 11 != 0\nprint('g mod 11 = (u-4)^2 (u-3); simple root 3')\nassert roots_mod_p(G, 3) == []\nprint('g has no root mod 3')\nassert D % 3 == 1 and D % 8 == 5\ns3 = sqrt_padic(D, 3, 8, 1)\nassert s3 % 81 == 31\nprint('3 splits in K, s3 = %d mod 3^8 (= 31 mod 81); 2 is inert in K' % s3)\nww = (1 + sp.sqrt(-11))/2\nassert sp.expand(ww**2 - ww + 3) == 0\nassert sp.expand(2 + sp.sqrt(-11) - (1 + 2*ww)) == 0 and sp.expand(2 - sp.sqrt(-11) - (3 - 2*ww)) == 0\nprint('w = (1+s)/2: w^2 - w + 3 = 0, 2+s = 1+2w, 2-s = 3-2w')\nres = sp.resultant(g, 3*u**2 - 4, u)\nassert res == 176\nprint('Res(g, 3u^2-4) = N(3u^2-4) =', res)\n\nstats = {}\nfor p in primes_upto(3000):\n if p in (2, 11):\n continue\n r = roots_mod_p(G, p)\n assert all(gp(a) % p for a in r)\n kind = 'inert' if legendre(D, p) == -1 else 'split'\n if kind == 'inert':\n assert len(r) == 1\n else:\n assert len(r) in (0, 3)\n stats[(kind, len(r))] = stats.get((kind, len(r)), 0) + 1\nprint('primes 3 <= p < 3000, p != 11: (behaviour in K, number of roots of g) ->', sorted(stats.items()))\nprint('PASS 1.4.3a')\n" }, { "path": "anc/code/1.4.3/1.4.3b_plane.py", "size_bytes": 3134, "sha256": "110eb8ee560cc2c38a2dfa26302a32aff5a82efa1926ad48020cddd568117f1b", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.3b (Section 1.4.3, Lemmas lem:1.4.3-plane and lem:1.4.3-nonzero): the plane section l_+ = 0.\n\nWritten for this bundle (not the source's verifiers). Python 3 with SymPy.\nL = K(u), K = Q(s), s^2 = -11, g(u) = u^3 - 4u - 4, q = u/2; disc(g) = -176 = -11*4^2, so\ntau(u) = (-u + 4s/g'(u))/2. Checks, over the ring Q[u,s]/(g(u), s^2+11):\n * tau(u) = -u/2 + s(-6u^2 + 9u + 16)/22 is a root of g and tau has order 3;\n * p = (s + 2 - 6q^2)/(6(3q^2-1)) and F(x, y, z, -(2+s)y/3) = 2 prod_{i=0}^{2} (x - tau^i(p) y - tau^i(q) z);\n * the same identity through a resultant, without tau;\n * det [(1, -tau^i(p), -tau^i(q))]_{i=0,1,2} = 2;\n * 3q^2 - 1 = (3u^2 - 4)/4, so the denominators of p and q are 6(3u^2-4)/4 and 2;\n * F(x,0,z,0) = 2x^3 - 2xz^2 - z^3 and r^3 + 2r^2 - 2 has no rational root;\n * H = sum |coefficient| * 2^3 = 96.\n\"\"\"\nimport os\nimport sys\nfrom pathlib import Path\nos.environ.setdefault('SYMPY_GROUND_TYPES', 'python')\nsys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'common' / 'cyclic_cubic'))\nimport sympy as sp\nfrom cubicfield import CubicOverQuadratic, u, s\n\nx, y, z, t, r = sp.symbols('x y z t r')\nF = 2*x**3 + 2*x**2*y + 2*y**3 + y**2*z - 2*x*z**2 - z**3 + t*z**2 - t**3\ng = u**3 - 4*u - 4\nL = CubicOverQuadratic(g, -11, 4)\nprint('tau(u) =', L.tau_u)\nassert L.tau_u == L.red(-u/2 + s*(-6*u**2 + 9*u + 16)/22)\n\nq = u/2\ninv = L.inverse(3*u**2 - 4) # 1/(3q^2-1) = 4/(3u^2-4)\np = L.red((s + 2 - 6*q**2) * 4 * inv / 6)\nprint('p =', p)\nP = L.orbit(p)\nQo = L.orbit(q)\nprod = sp.Integer(1)\nfor i in range(3):\n prod = L.red(sp.expand(prod * (x - P[i]*y - Qo[i]*z)))\nlhs = L.red(F.subs(t, -(2 + s)*y/3))\nassert L.red(lhs - 2*prod) == 0\nprint('F(x,y,z,-(2+s)y/3) = 2 prod_i (x - tau^i(p) y - tau^i(q) z): verified')\n\n# resultant form: prod over roots theta of g of (x - p(theta) y - (theta/2) z), p = (s+2-3u^2/2)/(6(3u^2-4)/4)\nNm = 6*(3*u**2 - 4)*(x - u*z/2) - 4*(s + 2 - sp.Rational(3, 2)*u**2)*y\nR = sp.resultant(g, Nm, u) # = prod_theta Nm(theta)\nden = 6**3 * sp.resultant(g, 3*u**2 - 4, u)\nassert sp.expand(sp.rem(sp.Poly(sp.expand(den*F.subs(t, -(2 + s)*y/3) - 2*R), s), sp.Poly(s**2 + 11, s)).as_expr()) == 0\nprint('resultant form of the identity: verified (denominator 6^3*176)')\n\nM = sp.Matrix([[1, -P[i], -Qo[i]] for i in range(3)])\nd = L.red(M.det())\nassert d == 2\nprint('det =', d)\nassert sp.expand(3*q**2 - 1 - (3*u**2 - 4)/4) == 0\nprint('3q^2 - 1 = (3u^2 - 4)/4, N(3u^2 - 4) = 176')\n\nlhs2 = L.red(F.subs(t, -(2 - s)*y/3))\npc = L.conj(p)\nPc = L.orbit(pc)\nprod2 = sp.Integer(1)\nfor i in range(3):\n prod2 = L.red(sp.expand(prod2 * (x - Pc[i]*y - Qo[i]*z)))\nassert L.red(lhs2 - 2*prod2) == 0\nprint('conjugate identity (s -> -s): verified')\n\nF0 = sp.expand(F.subs({y: 0, t: 0}))\nassert F0 == 2*x**3 - 2*x*z**2 - z**3\nc = r**3 + 2*r**2 - 2\nassert all(c.subs(r, a) != 0 for a in (1, -1, 2, -2))\nassert sp.expand(F0.subs({x: 1, z: r}) + c) == 0\nprint('F(x,0,z,0) =', F0, '; with r = z/x it is -(r^3 + 2r^2 - 2), no rational root')\nHval = sum(abs(c) * 2**3 for c in sp.Poly(F, x, y, z, t).coeffs())\nassert Hval == 96\nprint('H =', Hval)\nprint('PASS 1.4.3b')\n" }, { "path": "anc/code/1.4.3/1.4.3c_residues.py", "size_bytes": 5241, "sha256": "fa22a75a48e9d94dcf147df7fa7096341525f8e01a60b6f16503620e16c825b9", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.3c (Section 1.4.3, Lemmas lem:1.4.3-three and lem:1.4.3-two): all primitive 3-adic and 2-adic points.\n\nWritten for this bundle (not the source's verifiers). Pure Python (standard library).\nl_+ = (2+s)y + 3t, l_- = (2-s)y + 3t, s = s3 = 31 (mod 81) in Z_3 (code 1.4.3a).\n * complete residue tree (normalized primitive points, see restree.py) modulo 3^4: the pair (v(l_+), v(l_-))\n is determined on every class and is (1,0) or (1,3); it is determined from 3^4 on;\n * facts for the proof by hand: the points mod 3 are (1,0,0,-1), (1,1,0,0), (1,-1,0,1), (0,1,0,-1); at the\n point (-1,0,0,1) (scaled so that t = 1), every solution mod 3^4 with t = 1 has y = 3Y, Y = 5 or 23 (mod 27);\n * at 2: every primitive solution modulo 8 (all 8^4 tuples) has y odd and t even; the seven points mod 2;\n the congruences of the proof by hand (for y,z,t odd, F = 2(x^3+x^2y+y-x) mod 8; F = 2 mod 4 in the class\n (1,0,0,0)); for y odd and t even, l_+ = l_- = y + t = 1 modulo 2 O_K (2+s = 1+2w, 2-s = 3-2w, code 1.4.3a);\n * a direct enumeration of ALL primitive solutions mod 3^4 and mod 8 (no normalization, no tree) is done by the\n C program ../common/cyclic_cubic/brute_residues.c (case C), run by run_all.py.\n\"\"\"\nimport sys\nfrom itertools import product\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'common' / 'cyclic_cubic'))\nfrom restree import tree, level1, val_mod\n\n\ndef F(x, y, z, t):\n return 2*x**3 + 2*x*x*y + 2*y**3 + y*y*z - 2*x*z*z - z**3 + t*z*z - t**3\n\n\ndef pairs(k, s0=31):\n sol, m, sizes = tree(F, 3, k)\n assert (s0*s0 + 11) % m == 0\n dist, by_res, und = {}, {}, 0\n for (i, P) in sol:\n x, y, z, t = P\n a, b = val_mod((2 + s0)*y + 3*t, 3, m), val_mod((2 - s0)*y + 3*t, 3, m)\n if a is None or b is None:\n und += 1\n dist[(a, b)] = dist.get((a, b), 0) + 1\n by_res.setdefault(tuple(c % 3 for c in P), set()).add((a, b))\n return sol, sizes, dist, by_res, und\n\n\nassert [P for _, P in level1(F, 3)] == [(1, 0, 0, 2), (1, 1, 0, 0), (1, 2, 0, 1), (0, 1, 0, 2)]\nsol, sizes, dist, by_res, und = pairs(4)\nprint('p=3, mod 3^4: level sizes', sizes, ' pairs', sorted(dist.items()))\nassert und == 0 and set(dist) == {(1, 0), (1, 3)}\nassert by_res[(1, 0, 0, 2)] == {(1, 3)} and all(v == {(1, 0)} for k, v in by_res.items() if k != (1, 0, 0, 2))\nassert all((a - b) % 3 == 1 for a, b in dist)\nprint(' by residue mod 3:', {k: sorted(v) for k, v in by_res.items()}, ' v(l_+) - v(l_-) = 1 mod 3 on all classes')\nfirst = [k for k in range(1, 5) if pairs(k)[4] == 0][0]\nassert first == 4\nprint(' every pair determined from 3^%d on' % first)\n\n# hand proof: scale the class of (1,0,0,-1) so that t = 1, i.e. (x,y,z,t) = (-1+3X, 3Y, 3Z, 1)\nYs = set()\nfor (i, P) in sol:\n if tuple(c % 3 for c in P) != (1, 0, 0, 2):\n continue\n x, y, z, t = P\n lam = pow(t, -1, 81) # t is a unit; multiply the point by 1/t\n yy = (y * lam) % 81\n assert (x * lam) % 3 == 2 and (z * lam) % 3 == 0 and yy % 3 == 0\n Ys.add((yy // 3) % 27)\nassert sorted(Ys) == [5, 23]\nassert all(val_mod(1 - 29*Y, 3, 27) == 2 and val_mod(33*Y + 1, 3, 27) == 0 for Y in Ys)\nprint('class of (-1,0,0,1), t = 1: y = 3Y with Y mod 27 in', sorted(Ys), '; v(1-29Y) = 2, v(33Y+1) = 0')\n# the reduction steps of the proof by hand: G = F(-1+3X, 3Y, 3Z, 1)/3\nG = lambda X, Y, Z: F(-1 + 3*X, 3*Y, 3*Z, 1)\nassert all(G(X, Y, Z) % 3 == 0 for X in range(9) for Y in range(9) for Z in range(9))\nassert {Y % 9 for X in range(9) for Y in range(9) for Z in range(9) if (G(X, Y, Z)//3) % 9 == 0} == {5}\nfor X in range(3):\n for Z in range(3):\n allowed = {Y2 for Y2 in range(3) if all((G(X + 3*a, 5 + 9*Y2, Z + 3*b)//3) % 27 == 0\n for a in range(3) for b in range(3))}\n assert allowed == {(Z*Z*(X + 1) - X*X - X - 1) % 3}\nassert {(Z*Z*(X + 1) - X*X - X - 1) % 3 for X in range(3) for Z in range(3)} == {0, 2}\nprint('hand reduction at (-1,0,0,1): Y = 5 mod 9; Y = 5+9Y2 with Y2 = Z^2(X+1)-X^2-X-1 in {0,2} mod 3')\n\n# p = 2\nassert [P for _, P in level1(F, 2)] == [(1, 0, 0, 0), (1, 1, 0, 0), (1, 1, 1, 0), (1, 1, 1, 1),\n (0, 1, 0, 0), (0, 1, 1, 0), (0, 1, 1, 1)]\npat = set()\nn = 0\nfor P in product(range(8), repeat=4):\n if all(c % 2 == 0 for c in P) or F(*P) % 8:\n continue\n n += 1\n pat.add((P[1] % 2, P[3] % 2))\nassert pat == {(1, 0)}\nprint('mod 8: %d primitive solutions, all with y odd and t even' % n)\nfor Pm in [(1, 0, 0, 0)]:\n assert all(F(*[a + 2*b for a, b in zip(Pm, e)]) % 4 for e in product(range(2), repeat=4))\nassert all((F(x, y, z, t) - 2*(x**3 + x*x*y + y - x)) % 8 == 0\n for x in range(8) for y in range(1, 8, 2) for z in range(1, 8, 2) for t in range(1, 8, 2))\nassert all(F(x, y, z, t) % 4 == 2 for x in range(1, 4, 2) for y in range(0, 4, 2) for z in range(0, 4, 2) for t in range(0, 4, 2))\nprint('mod 4: no solution in the class (1,0,0,0) mod 2 (F = 2 mod 4 there); mod 8: none with y,z,t odd')\nprint(' (for y,z,t odd, F = 2(x^3 + x^2 y + y - x) mod 8)')\nassert all(F(x, y, z, t) % 8 for x in range(8) for y in range(1, 8, 2) for z in range(1, 8, 2) for t in range(1, 8, 2))\nprint('PASS 1.4.3c')\n" }, { "path": "anc/code/1.4.3/1.4.3d_split_primes.py", "size_bytes": 1556, "sha256": "d9c4b243c8f9ffac9c39336324cc31e03325dd89551d54932d48387e241c5528", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.3d (Section 1.4.3, after Lemma lem:1.4.3-good; a confirmation, not used in the proof).\n\nWritten for this bundle. Pure Python (standard library).\nFor every prime 5 <= p < 500 that splits in K = Q(sqrt(-11)) and modulo which g = u^3 - 4u - 4 has no root, and\nfor both square roots s0 of -11 modulo p, the plane cubic F(x, y, z, -(2+s0)y/3) has no zero in P^2(F_p) (the\nreduction of the statement of Lemma lem:1.4.3-good). The source's own check at 5, 31, 59 is contained in this.\n\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'common' / 'cyclic_cubic'))\nfrom restree import primes_upto, roots_mod_p, legendre\n\n\ndef F(x, y, z, t):\n return 2*x**3 + 2*x*x*y + 2*y**3 + y*y*z - 2*x*z*z - z**3 + t*z*z - t**3\n\n\ndef plane_zeros(p, s0):\n c = (-(2 + s0) * pow(3, -1, p)) % p\n pts = [(1, b, d) for b in range(p) for d in range(p)] + [(0, 1, d) for d in range(p)] + [(0, 0, 1)]\n return [(X, Y, Z) for (X, Y, Z) in pts if F(X, Y, Z, c * Y % p) % p == 0]\n\n\ntested = []\nfor p in primes_upto(500):\n if p < 5 or legendre(-11, p) != 1 or roots_mod_p([1, 0, -4, -4], p):\n continue\n s0 = next(a for a in range(p) if (a * a + 11) % p == 0)\n for sg in (s0, p - s0):\n assert plane_zeros(p, sg) == [], (p, sg)\n tested.append(p)\nassert {5, 31, 59} <= set(tested)\nprint('split primes with g irreducible, 5 <= p < 500:', len(tested), 'primes, from', tested[0], 'to', tested[-1])\nprint('no zero of the plane section mod p for either root of s^2 = -11')\nprint('PASS 1.4.3d')\n" }, { "path": "anc/code/1.4.3/run_all.py", "size_bytes": 2201, "sha256": "e062407a3631f2eb1426942fecc40fc42c14ab6e8b06cf94f399d47d4b77fc39", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the checks of Section 1.4.3 (2x^3+2x^2y+2y^3+y^2z-2xz^2-z^3+tz^2-t^3 = 0).\n\nUsage: python3 run_all.py # every code id, in order\n python3 run_all.py 1.4.3c # only the listed id(s)\nEach Python script runs in a fresh `python3 -I -B` process; the C program ../common/cyclic_cubic/brute_residues.c\nis compiled into a temporary directory with $CC (default: cc) and run with the argument C.\nDo not use python -O (the checks are asserts). Written for this bundle.\n\"\"\"\nimport os\nimport subprocess\nimport sys\nimport tempfile\nfrom pathlib import Path\n\nHERE = Path(__file__).resolve().parent\nCOMMON = HERE.parent / 'common' / 'cyclic_cubic'\nSTEPS = [\n ('1.4.3a', [('py', '1.4.3a_fields.py')]),\n ('1.4.3b', [('py', '1.4.3b_plane.py')]),\n ('1.4.3c', [('py', '1.4.3c_residues.py'), ('c', 'brute_residues.c', 'C')]),\n ('1.4.3d', [('py', '1.4.3d_split_primes.py')]),\n]\n\n\ndef run_c(src, arg, tmp):\n exe = Path(tmp) / src.replace('.c', '')\n cc = os.environ.get('CC', 'cc')\n subprocess.run([cc, '-O2', '-std=c99', '-o', str(exe), str(COMMON / src)], check=True)\n print('=== C: %s %s ===' % (src, arg), flush=True)\n return subprocess.run([str(exe), arg]).returncode\n\n\ndef main():\n if not __debug__:\n raise SystemExit('Run without -O: the checks are assert statements.')\n want = sys.argv[1:]\n known = [cid for cid, _ in STEPS]\n bad = [w for w in want if w not in known]\n if bad:\n raise SystemExit('unknown code id(s): %s; known: %s' % (bad, known))\n with tempfile.TemporaryDirectory() as tmp:\n for cid, items in STEPS:\n if want and cid not in want:\n continue\n for item in items:\n if item[0] == 'py':\n print('=== %s: %s ===' % (cid, item[1]), flush=True)\n rc = subprocess.run([sys.executable, '-I', '-B', str(HERE / item[1])], cwd=HERE).returncode\n else:\n rc = run_c(item[1], item[2], tmp)\n if rc:\n raise SystemExit('FAIL %s (%s)' % (cid, item[1]))\n print('PASS: all requested checks of section 1.4.3')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.4.4/1.4.4a_identities.py", "size_bytes": 1966, "sha256": "06367f1be093840c9d409e5135fd1bb19a1cbf8e93cb8f5d0e3f167184ed1001", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.4a (Section 1.4.4, Lemma lem:1.4.4-id): the identities for 8x^4 + 7y^4 + 2z^4 - t^4 = 0.\n\nWritten for this bundle (not the source's verifiers). Python 3 with SymPy (polynomial expansion only).\nWith Q = 8x^4 + 7y^4 + 2z^4 - t^4, f = 7y^2 + 2z^2 - 3t^2, g = 7y^2 + 2z^2 + 3t^2, A_pm = 2x^2 pm 2xz + z^2:\n -f g - 72x^4 - 14(y^2 - z^2)^2 = -9 Q,\n 72x^4 + 14(y^2 - z^2)^2 = 2 N(6x^2 + (y^2 - z^2) sqrt(-7)),\n t^4 - 7y^4 - 2 A_+ A_- = -Q, A_+ A_- = 4x^4 + z^4, t^4 - 7y^4 = N(t^2 + y^2 sqrt 7),\n A_+ = x^2 + (x+z)^2, A_+ - A_- = 4xz, A_+ + A_- = 4x^2 + 2z^2, g - f = 6t^2,\n f = 9y^2 (mod t, mod y^2 - z^2) [i.e. f - 9y^2 = 2(z^2 - y^2) - 3t^2],\nand H = 2^4 (8 + 7 + 2 + 1) = 288.\n\"\"\"\nimport os\nos.environ.setdefault('SYMPY_GROUND_TYPES', 'python')\nimport sympy as sp\n\nx, y, z, t = sp.symbols('x y z t')\nr7, rm7 = sp.sqrt(7), sp.sqrt(-7)\nQ = 8*x**4 + 7*y**4 + 2*z**4 - t**4\nf = 7*y**2 + 2*z**2 - 3*t**2\ng = 7*y**2 + 2*z**2 + 3*t**2\nAp = 2*x**2 + 2*x*z + z**2\nAm = 2*x**2 - 2*x*z + z**2\nE = sp.expand\nchecks = [\n ('-fg - 72x^4 - 14(y^2-z^2)^2 = -9Q', E(-f*g - 72*x**4 - 14*(y**2 - z**2)**2 + 9*Q)),\n ('72x^4 + 14(y^2-z^2)^2 = 2N(6x^2+(y^2-z^2)sqrt(-7))',\n E(72*x**4 + 14*(y**2 - z**2)**2 - 2*(6*x**2 + (y**2 - z**2)*rm7)*(6*x**2 - (y**2 - z**2)*rm7))),\n ('t^4 - 7y^4 - 2A+A- = -Q', E(t**4 - 7*y**4 - 2*Ap*Am + Q)),\n ('A+A- = 4x^4 + z^4', E(Ap*Am - 4*x**4 - z**4)),\n ('t^4 - 7y^4 = N(t^2 + y^2 sqrt7)', E(t**4 - 7*y**4 - (t**2 + y**2*r7)*(t**2 - y**2*r7))),\n ('A+ = x^2 + (x+z)^2', E(Ap - x**2 - (x + z)**2)),\n ('A+ - A- = 4xz', E(Ap - Am - 4*x*z)),\n ('A+ + A- = 4x^2 + 2z^2', E(Ap + Am - 4*x**2 - 2*z**2)),\n ('g - f = 6t^2', E(g - f - 6*t**2)),\n ('f - 9y^2 = 2(z^2-y^2) - 3t^2', E(f - 9*y**2 - 2*(z**2 - y**2) + 3*t**2)),\n]\nfor name, val in checks:\n assert val == 0, name\n print('identity', name, ': ok')\nH = sum(abs(c) * 2**4 for c in (8, 7, 2, -1))\nassert H == 288\nprint('H =', H)\nprint('PASS 1.4.4a')\n" }, { "path": "anc/code/1.4.4/1.4.4b_residues.py", "size_bytes": 3108, "sha256": "a8dc91769c1b7b210a9ae034225dd566a48f632ef2b1d5603a08fd1f212c13a9", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.4b (Section 1.4.4, Lemmas lem:1.4.4-three, lem:1.4.4-two, lem:1.4.4-seven): exhaustive residue checks.\n\nWritten for this bundle (not the source's verifiers). Pure Python (standard library).\nQ = 8x^4 + 7y^4 + 2z^4 - t^4, f = 7y^2 + 2z^2 - 3t^2, A_+ = 2x^2 + 2xz + z^2.\n * mod 16: every solution with x, y, z, t not all even has x, y, z, t odd (all 16^4 tuples);\n * for odd x, z: A_+ = 1 or 5 (mod 8); for odd y, z, t: f = 6 (mod 8);\n * mod 3: the solutions with f = 0 (mod 3) are exactly those with x = t = 0 and y, z units (all 3^4 tuples);\n * mod 81: if w is a 3-adic unit with 7 + 2w^4 = 0 (mod 81), then w^2 = 1 (mod 3) and v_3(7 + 2w^2) = 2;\n * mod 7: x^4 + 2z^4 = t^4 with (x,z,t) != 0: the table of the text (r = x/z, s = t/z), A_+ and f are units\n with the same quadratic character (all 7^3 tuples);\n * the values (2/7) = 1, (-1/7) = -1, (-7/3) = -1, (7/3) = 1, and -7 = 1 (mod 8).\n\"\"\"\nfrom itertools import product\n\n\ndef Q(x, y, z, t):\n return 8*x**4 + 7*y**4 + 2*z**4 - t**4\n\n\ndef leg(a, p):\n a %= p\n return 0 if a == 0 else (1 if pow(a, (p - 1)//2, p) == 1 else -1)\n\n\npats = set()\nfor P in product(range(16), repeat=4):\n if all(c % 2 == 0 for c in P) or Q(*P) % 16:\n continue\n pats.add(tuple(c % 2 for c in P))\nassert pats == {(1, 1, 1, 1)}\nprint('mod 16: primitive solutions have parity pattern', sorted(pats))\nAvals = {(2*a*a + 2*a*c + c*c) % 8 for a in range(1, 8, 2) for c in range(1, 8, 2)}\nfvals = {(7*b*b + 2*c*c - 3*d*d) % 8 for b in range(1, 8, 2) for c in range(1, 8, 2) for d in range(1, 8, 2)}\nassert Avals == {1, 5} and fvals == {6}\nprint('x, z odd: A_+ mod 8 in', sorted(Avals), '; y, z, t odd: f mod 8 in', sorted(fvals))\n\nzero3 = sorted(P for P in product(range(3), repeat=4)\n if P != (0, 0, 0, 0) and Q(*P) % 3 == 0 and (7*P[1]**2 + 2*P[2]**2 - 3*P[3]**2) % 3 == 0)\nassert zero3 == [(0, 1, 1, 0), (0, 1, 2, 0), (0, 2, 1, 0), (0, 2, 2, 0)]\nprint('mod 3: Q = f = 0 only at', zero3)\nvals81 = set()\nfor w in range(81):\n if w % 3 and (7 + 2*w**4) % 81 == 0:\n e, v = (7 + 2*w*w) % 81, 0\n assert e != 0\n while e % 3 == 0:\n e //= 3\n v += 1\n vals81.add((w*w % 3, v))\nassert vals81 == {(1, 2)}\nprint('mod 81: units w with 7 + 2w^4 = 0 have w^2 = 1 mod 3 and v_3(7 + 2w^2) = 2')\n\nrows = set()\nfor a, c, d in product(range(7), repeat=3):\n if (a, c, d) == (0, 0, 0) or (a**4 + 2*c**4 - d**4) % 7:\n continue\n A = (2*a*a + 2*a*c + c*c) % 7\n f7 = (2*c*c - 3*d*d) % 7\n assert A and f7 and leg(A, 7) == leg(f7, 7)\n if c:\n ic = pow(c, -1, 7)\n rows.add(((a*ic) % 7, (d*ic) % 7, (A*ic*ic) % 7, (f7*ic*ic) % 7))\n else:\n assert leg(A, 7) == leg(f7, 7) == 1\nassert rows == {(0, 2, 1, 4), (0, 5, 1, 4), (2, 3, 6, 3), (2, 4, 6, 3), (5, 3, 5, 3), (5, 4, 5, 3)}\nprint('mod 7 (z != 0): (r, s, A_+/z^2, f/z^2) in', sorted(rows), '; for z = 0 both are squares')\nassert leg(2, 7) == 1 and leg(-1, 7) == -1 and leg(-7, 3) == -1 and leg(7, 3) == 1 and (-7) % 8 == 1\nprint('(2/7) = 1, (-1/7) = -1, (-7/3) = -1, (7/3) = 1, -7 = 1 mod 8')\nprint('PASS 1.4.4b')\n" }, { "path": "anc/code/1.4.4/1.4.4c_symbols.py", "size_bytes": 3192, "sha256": "7b3a1bc4c52a1716764148f62e69907c34fe586d11cc8e72f11f487d2cc3647e", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Code 1.4.4c (Section 1.4.4, Step 6; an independent check of Lemmas lem:1.4.4-three, -two, -seven).\n\nWritten for this bundle. Pure Python (standard library).\nFor p = 2, 3, 7 the program builds the complete residue tree of normalized primitive points of\nQ = 8x^4 + 7y^4 + 2z^4 - t^4 = 0 over Z_p (see ../common/cyclic_cubic/restree.py) to the precision 2^5, 3^4, 7^2,\nand on every class evaluates the Hilbert symbols (-7, f)_p and (7, A_+)_p by the formulas of Serre\n(A Course in Arithmetic, Ch. III, Theorem 1) from the valuation and the unit residue of f and A_+; it checks that\nthese data are determined on every class (except v_3(A_+), which is not needed since 7 is a square in Q_3) and\nthat both symbols are 1 (p = 2, 3), that v_3(f) is 0 or 2, and that the product of the two symbols is 1\n(p = 7). This repeats, for all p-adic points, the conclusions c_2 = c_3 = c_7 = 1 of the text.\n\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'common' / 'cyclic_cubic'))\nfrom restree import tree, legendre\n\n\ndef Q(x, y, z, t):\n return 8*x**4 + 7*y**4 + 2*z**4 - t**4\n\n\ndef split(a, p, m):\n \"\"\"(valuation, unit part mod m/p^v) of a modulo m, or None if a = 0 mod m.\"\"\"\n a %= m\n if a == 0:\n return None\n v = 0\n while a % p == 0:\n a //= p\n m //= p\n v += 1\n return v, a % m, m\n\n\ndef hilbert(a, b, p):\n \"\"\"(a, b)_p for a = (alpha, u, mu), b = (beta, v, nu) given as valuation and unit residue mod mu, nu.\"\"\"\n (al, uu, mu), (be, vv, nu) = a, b\n if p != 2:\n assert mu % p == 0 and nu % p == 0\n sign = (-1) ** (al * be * ((p - 1) // 2))\n return sign * legendre(uu, p) ** be * legendre(vv, p) ** al\n assert mu % 8 == 0 and nu % 8 == 0, 'unit part not known modulo 8'\n eps = lambda w: ((w % 8) - 1) // 2 % 2\n om = lambda w: (((w % 8) ** 2 - 1) // 8) % 2\n return (-1) ** (eps(uu) * eps(vv) + al * om(vv) + be * om(uu))\n\n\ndef run(p, k):\n sol, m, sizes = tree(Q, p, k)\n seen = {}\n for (i, P) in sol:\n x, y, z, t = P\n f = split(7*y*y + 2*z*z - 3*t*t, p, m)\n A = split(2*x*x + 2*x*z + z*z, p, m)\n assert f is not None\n m7 = split(-7, p, p**10)\n p7 = split(7, p, p**10)\n h1 = hilbert(m7, f, p)\n if A is None:\n # only at p = 3, where 7 is a unit and a square mod 3, so (7, b)_3 = (7/3)^{v_3(b)} = 1 for every b\n assert p == 3 and legendre(7, 3) == 1\n h2, vA = 1, '>=%d' % k\n else:\n h2, vA = hilbert(p7, A, p), A[0]\n key = (f[0], vA, h1, h2)\n seen[key] = seen.get(key, 0) + 1\n return sizes, seen\n\n\nfor p, k in ((2, 5), (3, 4), (7, 2)):\n sizes, seen = run(p, k)\n print('p=%d, mod %d^%d: level sizes %s' % (p, p, k, sizes))\n print(' (v_p(f), v_p(A_+), (-7,f)_p, (7,A_+)_p): classes', sorted(seen.items(), key=str))\n if p in (2, 3):\n assert all(h1 == 1 and h2 == 1 for (_, _, h1, h2) in seen)\n else:\n assert all(h1 * h2 == 1 for (_, _, h1, h2) in seen)\n assert {(a, b) for (a, b, _, _) in seen} == {(0, 0)}\n if p == 3:\n assert {a for (a, _, _, _) in seen} == {0, 2}\nprint('PASS 1.4.4c')\n" }, { "path": "anc/code/1.4.4/run_all.py", "size_bytes": 2140, "sha256": "c4f3b0a11dfea80cd024ee011b69a6904e0965785d4cfa0bb59bee21a2cf412c", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the checks of Section 1.4.4 (8x^4 + 7y^4 + 2z^4 - t^4 = 0).\n\nUsage: python3 run_all.py # every code id, in order\n python3 run_all.py 1.4.4c # only the listed id(s)\nEach Python script runs in a fresh `python3 -I -B` process; the C program ../common/cyclic_cubic/brute_residues.c\nis compiled into a temporary directory with $CC (default: cc) and run with the argument Q.\nDo not use python -O (the checks are asserts). Written for this bundle.\n\"\"\"\nimport os\nimport subprocess\nimport sys\nimport tempfile\nfrom pathlib import Path\n\nHERE = Path(__file__).resolve().parent\nCOMMON = HERE.parent / 'common' / 'cyclic_cubic'\nSTEPS = [\n ('1.4.4a', [('py', '1.4.4a_identities.py')]),\n ('1.4.4b', [('py', '1.4.4b_residues.py')]),\n ('1.4.4c', [('py', '1.4.4c_symbols.py'), ('c', 'brute_residues.c', 'Q')]),\n]\n\n\ndef run_c(src, arg, tmp):\n exe = Path(tmp) / src.replace('.c', '')\n cc = os.environ.get('CC', 'cc')\n subprocess.run([cc, '-O2', '-std=c99', '-o', str(exe), str(COMMON / src)], check=True)\n print('=== C: %s %s ===' % (src, arg), flush=True)\n return subprocess.run([str(exe), arg]).returncode\n\n\ndef main():\n if not __debug__:\n raise SystemExit('Run without -O: the checks are assert statements.')\n want = sys.argv[1:]\n known = [cid for cid, _ in STEPS]\n bad = [w for w in want if w not in known]\n if bad:\n raise SystemExit('unknown code id(s): %s; known: %s' % (bad, known))\n with tempfile.TemporaryDirectory() as tmp:\n for cid, items in STEPS:\n if want and cid not in want:\n continue\n for item in items:\n if item[0] == 'py':\n print('=== %s: %s ===' % (cid, item[1]), flush=True)\n rc = subprocess.run([sys.executable, '-I', '-B', str(HERE / item[1])], cwd=HERE).returncode\n else:\n rc = run_c(item[1], item[2], tmp)\n if rc:\n raise SystemExit('FAIL %s (%s)' % (cid, item[1]))\n print('PASS: all requested checks of section 1.4.4')\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/1.4.5/1.4.5a_elementary.py", "size_bytes": 639, "sha256": "b3aa9be8142be3ecc4ea458295c45956974f87e04e97584e5576db8e18a30107", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.5a (Section 1.4.5, 14x^5 + 5y^5 + 3z^5 = 0): size H, zero coordinates, hypotheses of\nLemma lem:1.4:terms, the even term, and the levels of Lemma lem:1.4:level. Written for the paper.\nRun: python3 -I 1.4.5a_elementary.py (< 1 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import grechuk_H, zero_coordinate_report, report_levels\n\nco = (14, 5, 3)\nH = grechuk_H(co)\nprint('14x^5 + 5y^5 + 3z^5 = 0: H = %d' % H)\nassert H == 704\nzero_coordinate_report(co)\nreport_levels(14, 5, 3, [210, 3360])\nprint('PASS 1.4.5a')\n" }, { "path": "anc/code/1.4.5/1.4.5b_traces.py", "size_bytes": 803, "sha256": "3a8d5fd100f6c42c8c3dfa7d9bab5e4777adad1cfdbd40408a2752da313a834e", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.5b (Section 1.4.5): the trace sets T_q of Lemma lem:1.4:sieve for 14x^5 + 5y^5 + 3z^5 = 0,\nby two implementations (character sums for (u, v) = (14a^5, 5b^5); point counting for all twelve signed\norderings of the three terms and all scalings). Written for the paper.\nRun: python3 -I 1.4.5b_traces.py (about 25 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import report_traces\n\nF5x = [1, 2, 3, 4]\nTABLE = {11: [0, 2, 3], 13: F5x, 17: F5x, 31: [0, 1, 4], 41: F5x, 61: F5x, 71: [2, 3], 101: F5x,\n 131: [0, 2, 3], 151: F5x, 181: F5x, 191: F5x}\nprint('T_q for 14x^5 + 5y^5 + 3z^5 = 0:')\nreport_traces(14, 5, 3, TABLE)\nprint('PASS 1.4.5b: the twelve sets of the table')\n" }, { "path": "anc/code/1.4.5/1.4.5c_sieve.gp", "size_bytes": 1997, "sha256": "10a52a54aecac173edd3413a5de34eda743021521e27a28af207bdbc6c599e41", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.4.5c (Section 1.4.5, 14x^5 + 5y^5 + 3z^5 = 0). Written for the paper. PARI/GP 2.15 or later.\n\\\\ (1) The Frey curve of Lemma lem:1.4.5-frey at 2: (u, v, w) = eps (3z^5, 14x^5, 5y^5), eps = +-1 with\n\\\\ u = -1 mod 4; for all odd z mod 2^6 and all x = 1..64 (v_2(x) = 0..6), elllocalred gives f_2 and\n\\\\ v_2(Delta_min) as in Lemma lem:1.4:frey (f_2 = 5, 6 if x is odd; f_2 = 1, 10 v_2(x) - 6 if x is even).\n\\\\ (2) The newform sieve of Lemma lem:1.4.5-sieve at the levels 210 and 3360 with the sets T_q of code 1.4.5b.\n\\\\ Run: gp -q 1.4.5c_sieve.gp (about 10 s, 0.3 GB)\ndefault(parisizemax, 1500000000);\nread(\"../common/frey_quintic/fqsieve.gp\");\n{\n my(n = 0);\n forstep (z = 1, 63, 2, for (x = 1, 64,\n my(eps = if ((3*z^5) % 4 == 3, 1, -1), u = eps*3*z^5, v = eps*14*x^5, E, lr, d, e = valuation(x, 2));\n E = ellinit([0, v - u, 0, -u*v, 0]); lr = elllocalred(E, 2);\n d = valuation(E.disc, 2) - 12*valuation(lr[3][1], 2);\n if (u % 4 != 3, error(\"normalization\"));\n if ([lr[1], d] != if (e == 0, [5, 6], [1, 10*e - 6]), error(\"2-adic data \", [x, z, lr, d]));\n n++));\n print(\"(1) Frey curve at 2: f_2 = 5, v_2(Delta_min) = 6 (x odd); f_2 = 1, v_2(Delta_min) = 10 v_2(x) - 6\",\n \" (x even): \", n, \" residue classes\");\n}\nQ = [11, 13, 17, 31, 41, 61, 71, 101, 131, 151, 181, 191];\nF5x = [1, 2, 3, 4];\nT = [[0,2,3], F5x, F5x, [0,1,4], F5x, F5x, [2,3], F5x, [0,2,3], F5x, F5x, F5x];\n{\n print(\"(2) test primes q = \", Q);\n S = fq_sieve(210, Q, T); s210 = fq_print(210, Q, T, S);\n if (#s210 != 0, error(\"survivor at 210\"));\n S = fq_sieve(3360, Q, T); s3360 = fq_print(3360, Q, T, S);\n if (#s3360 != 2, error(\"expected two survivors at 3360\"));\n for (k = 1, 2, my(i = s3360[k][1]); if (poldegree(S[3][i][2]) != 1, error(\"non-rational survivor\"));\n print(\" survivor: orbit \", i, \" (rational), a_q for q in Q: \", vector(#Q, j, mfcoef(S[2][i], Q[j]))));\n print(\"PASS 1.4.5c: level 210: no survivor; level 3360: exactly two rational orbits survive\");\n}\nquit\n" }, { "path": "anc/code/1.4.5/1.4.5d_survivors.gp", "size_bytes": 3626, "sha256": "c486a4015528d442125246dd64438edfa1ac869232c8181d0e03075cfa39393b", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.4.5d (Section 1.4.5): the two surviving newforms of level 3360 (Lemma lem:1.4.5-pairing).\n\\\\ Written for the paper. PARI/GP 2.15 or later.\n\\\\ (1) The sieve of code 1.4.5c is repeated at level 3360 to get the two surviving orbits.\n\\\\ (2) G+ = [0,1,0,-890,-10200] and G- = [0,-1,0,-890,10200] (G- is the twist of G+ by -1): conductor\n\\\\ 3360 (Tate's algorithm, ellglobalred), minimal discriminant, multiplicative reduction at 3 and 5.\n\\\\ (3) Sturm bound for weight 2 and Gamma_0(3360): (2/12)[SL_2(Z):Gamma_0(3360)] = 1536; the q-expansion\n\\\\ coefficients a_0..a_1536 of each survivor equal those of exactly one of G+, G- (ellan).\n\\\\ (4) The square classes used in the pairing argument: v_3, v_5 of Delta_min(G+-) and of Delta_min(E)\n\\\\ (E: 2 + 10k at 3 and at 5, code 1.4.5a); and, as a check, v_3/v_5 for all curves isogenous to G+.\n\\\\ Run: gp -q 1.4.5d_survivors.gp (about 10 s)\ndefault(parisizemax, 1500000000);\nread(\"../common/frey_quintic/fqsieve.gp\");\nQ = [11, 13, 17, 31, 41, 61, 71, 101, 131, 151, 181, 191];\nF5x = [1, 2, 3, 4];\nT = [[0,2,3], F5x, F5x, [0,1,4], F5x, F5x, [2,3], F5x, [0,2,3], F5x, F5x, F5x];\n{\n S = fq_sieve(3360, Q, T);\n my(B = S[2], rep = S[3], surv = [], G, N = 3360, mu, bd, ok = [0, 0]);\n for (i = 1, #rep, for (k = 1, #rep[i][3], if (rep[i][3][k][2] == 0, surv = concat(surv, i))));\n print(\"(1) surviving orbits at level 3360: \", surv);\n G = [ellinit([0, 1, 0, -890, -10200]), ellinit([0, -1, 0, -890, 10200])];\n if (ellinit(ellminimalmodel(elltwist(G[1], -4)))[1..5] != G[2][1..5], error(\"twist\"));\n for (j = 1, 2,\n my(E = G[j], gr = ellglobalred(E), l3 = elllocalred(E, 3), l5 = elllocalred(E, 5));\n if (gr[1] != N || ellminimalmodel(E)[1..5] != E[1..5], error(\"conductor/minimality\"));\n if (gcd(E.c4, 15) != 1 || l3[1] != 1 || l5[1] != 1, error(\"not multiplicative at 3, 5\"));\n print(\"(2) G\", if (j == 1, \"+\", \"-\"), \" = \", E[1..5], \": conductor \", gr[1], \", Delta_min = \",\n factor(E.disc), \", gcd(c4, 15) = 1, Kodaira types at 3, 5: I\", l3[2] - 4, \", I\", l5[2] - 4));\n mu = N * prod(i = 1, #factor(N)~, 1 + 1/factor(N)[i, 1]); bd = 2*mu/12;\n print(\"(3) index of Gamma_0(3360) = \", mu, \", Sturm bound = \", bd);\n for (k = 1, #surv,\n my(A = mfcoefs(B[surv[k]], bd), m = []);\n for (j = 1, 2, if (A == concat([0], ellan(G[j], bd)), m = concat(m, j)));\n if (#m != 1, error(\"no unique match\"));\n ok[m[1]]++;\n print(\" orbit \", surv[k], \": a_0..a_\", bd, \" equal those of G\", if (m[1] == 1, \"+\", \"-\")));\n if (ok != [1, 1], error(\"matching\"));\n my(d3 = valuation(G[1].disc, 3), d5 = valuation(G[1].disc, 5), r3 = Mod(d3, 5)/Mod(2, 5), r5 = Mod(d5, 5)/Mod(2, 5));\n if (valuation(G[2].disc, 3) != d3 || valuation(G[2].disc, 5) != d5, error(\"G-\"));\n print(\"(4) v_3(Delta_G) = \", d3, \", v_5(Delta_G) = \", d5, \"; v_3(Delta_E) = v_5(Delta_E) = 2 mod 5;\");\n print(\" ratio at 3: \", d3, \"/2 = \", lift(r3), \" mod 5, square: \", issquare(r3),\n \"; ratio at 5: \", d5, \"/2 = \", lift(r5), \" mod 5, square: \", issquare(r5));\n if (issquare(r3) || !issquare(r5), error(\"square classes\"));\n my(C = ellisomat(G[1])[1], V = vector(#C, i, my(Ei = ellminimalmodel(ellinit(C[i][1])));\n [valuation(Ei.disc, 3), valuation(Ei.disc, 5)]));\n if (prod(i = 1, #V, !issquare(Mod(V[i][1], 5)/Mod(V[i][2], 5))) != 1, error(\"isogeny class\"));\n print(\" isogeny class of G+ (\", #C, \" curves): (v_3, v_5)(Delta_min) = \", V,\n \"; v_3/v_5 is a nonsquare mod 5 for all of them\");\n print(\"PASS 1.4.5d: the survivors are the newforms of G+ and G-; ratios 3 (nonsquare) at 3 and 1 (square) at 5\");\n}\nquit\n" }, { "path": "anc/code/1.4.5/run_all.py", "size_bytes": 928, "sha256": "08242fe1264e02b3e191ebc33096b754d421e5805c92cd7d7d34acde2efb6a4e", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the codes of Section 1.4.5 (14x^5 + 5y^5 + 3z^5 = 0) and compare with expected/.\n\nUsage: python3 run_all.py # all codes of this folder\n python3 run_all.py ... # only the listed code ids\n python3 run_all.py --update # rewrite expected/ from this run\nRequires Python 3 (standard library) and PARI/GP (gp on the PATH, or $GP); see README.md.\n\"\"\"\nimport sys\nfrom pathlib import Path\nHERE = Path(__file__).resolve().parent\nsys.path.insert(0, str(HERE.parent / 'common' / 'frey_quintic'))\nfrom runner import run_steps, table_consistency\n\nSTEPS = [\n ('1.4.5a', 'py', '1.4.5a_elementary.py'),\n ('1.4.5b', 'py', '1.4.5b_traces.py'),\n ('1.4.5c', 'gp', '1.4.5c_sieve.gp'),\n ('1.4.5d', 'gp', '1.4.5d_survivors.gp'),\n]\nCHECKS = [table_consistency('1.4.5b_traces.py', '1.4.5c_sieve.gp')]\n\nif __name__ == '__main__':\n run_steps(HERE, STEPS, sys.argv[1:], CHECKS)\n" }, { "path": "anc/code/1.4.6/1.4.6a_elementary.py", "size_bytes": 638, "sha256": "b220842aa2dc4d56c0fac80aa50adcdab61f8411e8079f01249efbc8ee213b88", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.6a (Section 1.4.6, 21x^5 + 5y^5 + 4z^5 = 0): size H, zero coordinates, hypotheses of\nLemma lem:1.4:terms, the even term, and the levels of Lemma lem:1.4:level. Written for the paper.\nRun: python3 -I 1.4.6a_elementary.py (< 1 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import grechuk_H, zero_coordinate_report, report_levels\n\nco = (21, 5, 4)\nH = grechuk_H(co)\nprint('21x^5 + 5y^5 + 4z^5 = 0: H = %d' % H)\nassert H == 960\nzero_coordinate_report(co)\nreport_levels(21, 5, 4, [210, 840])\nprint('PASS 1.4.6a')\n" }, { "path": "anc/code/1.4.6/1.4.6b_traces.py", "size_bytes": 686, "sha256": "e7137b32681cbc10978accdd3dbaca233c7079f8250e329ce46a3711bb32552c", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.6b (Section 1.4.6): the trace sets T_q of Lemma lem:1.4:sieve for 21x^5 + 5y^5 + 4z^5 = 0,\nby two implementations (as in code 1.4.5b). Written for the paper.\nRun: python3 -I 1.4.6b_traces.py (about 25 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import report_traces\n\nF5x = [1, 2, 3, 4]\nTABLE = {11: [1, 4], 13: F5x, 17: F5x, 31: [0, 1, 4], 41: F5x, 61: [2, 3], 101: F5x, 131: F5x,\n 151: [0, 2, 3], 181: [2, 3], 211: F5x}\nprint('T_q for 21x^5 + 5y^5 + 4z^5 = 0:')\nreport_traces(21, 5, 4, TABLE)\nprint('PASS 1.4.6b: the eleven sets of the table')\n" }, { "path": "anc/code/1.4.6/1.4.6c_sieve.gp", "size_bytes": 1356, "sha256": "ca6b142874415af45816fa619f4be6329e28781ddebb0f3ed750c9b3752cedb2", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.4.6c (Section 1.4.6, 21x^5 + 5y^5 + 4z^5 = 0). Written for the paper. PARI/GP 2.15 or later.\n\\\\ (1) The Frey curve of Lemma lem:1.4.6-frey at 2: (u, v, w) = (21x^5, 4z^5, 5y^5) with x = 3 mod 4;\n\\\\ for x = 3, 7, ..., 63 and z = 1..64, elllocalred gives f_2 = 3, v_2(Delta_min) = 8 (z odd) and\n\\\\ f_2 = 1, v_2(Delta_min) = 10 v_2(z) - 4 (z even), as in Lemma lem:1.4:frey.\n\\\\ (2) The newform sieve of Lemma lem:1.4.6-sieve at the levels 210 and 840 with the sets of code 1.4.6b.\n\\\\ Run: gp -q 1.4.6c_sieve.gp (about 3 s)\ndefault(parisizemax, 1000000000);\nread(\"../common/frey_quintic/fqsieve.gp\");\n{\n my(n = 0);\n forstep (x = 3, 63, 4, for (z = 1, 64, my(e = valuation(z, 2));\n fq_check2(21*x^5, 4*z^5, if (e, 1, 3), if (e, 10*e - 4, 8)); n++));\n print(\"(1) Frey curve at 2: f_2 = 3, v_2(Delta_min) = 8 (z odd); f_2 = 1, v_2(Delta_min) = 10 v_2(z) - 4\",\n \" (z even): \", n, \" residue classes\");\n Q = [11, 13, 17, 31, 41, 61, 101, 131, 151, 181, 211];\n F5x = [1, 2, 3, 4];\n T = [[1,4], F5x, F5x, [0,1,4], F5x, [2,3], F5x, F5x, [0,2,3], [2,3], F5x];\n print(\"(2) test primes q = \", Q);\n S = fq_sieve(210, Q, T); if (#fq_print(210, Q, T, S), error(\"survivor at 210\"));\n S = fq_sieve(840, Q, T); if (#fq_print(840, Q, T, S), error(\"survivor at 840\"));\n print(\"PASS 1.4.6c: no survivor at the levels 210 and 840\");\n}\nquit\n" }, { "path": "anc/code/1.4.6/run_all.py", "size_bytes": 883, "sha256": "0ae1d391cb6f3663101bd43f4d9f28dc618e24d28d8b04291ed654fb7c0ab8f2", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the codes of Section 1.4.6 (21x^5 + 5y^5 + 4z^5 = 0) and compare with expected/.\n\nUsage: python3 run_all.py # all codes of this folder\n python3 run_all.py ... # only the listed code ids\n python3 run_all.py --update # rewrite expected/ from this run\nRequires Python 3 (standard library) and PARI/GP (gp on the PATH, or $GP); see README.md.\n\"\"\"\nimport sys\nfrom pathlib import Path\nHERE = Path(__file__).resolve().parent\nsys.path.insert(0, str(HERE.parent / 'common' / 'frey_quintic'))\nfrom runner import run_steps, table_consistency\n\nSTEPS = [\n ('1.4.6a', 'py', '1.4.6a_elementary.py'),\n ('1.4.6b', 'py', '1.4.6b_traces.py'),\n ('1.4.6c', 'gp', '1.4.6c_sieve.gp'),\n]\nCHECKS = [table_consistency('1.4.6b_traces.py', '1.4.6c_sieve.gp')]\n\nif __name__ == '__main__':\n run_steps(HERE, STEPS, sys.argv[1:], CHECKS)\n" }, { "path": "anc/code/1.4.7/1.4.7a_elementary.py", "size_bytes": 1606, "sha256": "0cd9792b86ae85017ebfb1f294d8c5b27fb2fd2b55da8bf3e98523e3d91855f5", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.7a (Section 1.4.7, 17x^5 + 6y^5 + 3z^5 = 0): size H, zero coordinates, the reduction\nx = 3X to 1377X^5 + 2y^5 + z^5 = 0, hypotheses of Lemma lem:1.4:terms, the levels of Lemma lem:1.4:level,\nand (for the remark of the section) the solutions of 2X^5 + 2y^5 + z^5 = 0 modulo 25. Written for the paper.\nRun: python3 -I 1.4.7a_elementary.py (< 1 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import grechuk_H, zero_coordinate_report, report_levels, factor, fifth_powers_mod\n\nco = (17, 6, 3)\nH = grechuk_H(co)\nprint('17x^5 + 6y^5 + 3z^5 = 0: H = %d' % H)\nassert H == 832\nzero_coordinate_report(co)\n# modulo 3 the equation is 2x^5 = 0\nassert all((17 * pow(x, 5, 3)) % 3 != 0 for x in (1, 2))\nassert 17 * 3 ** 5 // 3 == 1377 and factor(1377) == {3: 4, 17: 1}\nprint('mod 3: 17x^5 + 6y^5 + 3z^5 = 2x^5, so x = 3X and 1377X^5 + 2y^5 + z^5 = 0 (1377 = 3^4*17)')\nreport_levels(1377, 2, 1, [102, 1632], 'Xyz')\n# remark: modulo 25 (fifth powers mod 25 depend only on the residue mod 5)\nassert all(pow(a + 5 * t, 5, 25) == pow(a, 5, 25) for a in range(5) for t in range(5))\nprint('fifth powers mod 25: %s; 1377 = %d mod 25' % (fifth_powers_mod(25), 1377 % 25))\nsols = sorted((X, y, z) for X in range(5) for y in range(5) for z in range(5)\n if (1377 * X ** 5 + 2 * y ** 5 + z ** 5) % 25 == 0)\nassert sols == sorted([(0, 0, 0)] + [(a, (-a) % 5, 0) for a in range(1, 5)]), sols\nprint('solutions (X, y, z) mod 5 of 1377X^5 + 2y^5 + z^5 = 0 mod 25: %s' % sols)\nprint('PASS 1.4.7a')\n" }, { "path": "anc/code/1.4.7/1.4.7b_traces.py", "size_bytes": 603, "sha256": "71c8fbc74f804ed0211a76e2bd37d0f3f0ea623dae1c7dd5ac776f3823c60675", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.7b (Section 1.4.7): the trace sets T_q of Lemma lem:1.4:sieve for 1377X^5 + 2y^5 + z^5 = 0,\nby two implementations (as in code 1.4.5b). Written for the paper.\nRun: python3 -I 1.4.7b_traces.py (about 15 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import report_traces\n\nTABLE = {11: [2, 3], 31: [0, 1, 4], 41: [0], 131: [0, 2, 3], 241: [0, 2, 3]}\nprint('T_q for 1377X^5 + 2y^5 + z^5 = 0:')\nreport_traces(1377, 2, 1, TABLE)\nprint('PASS 1.4.7b: the five sets of the table')\n" }, { "path": "anc/code/1.4.7/1.4.7c_sieve.gp", "size_bytes": 1587, "sha256": "c27a2e05f7b82fb18c44b76ee270497bbabbaaa4cc1ed01b1bd6d2824e22c3d6", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.4.7c (Section 1.4.7, 17x^5 + 6y^5 + 3z^5 = 0, x = 3X). Written for the paper. PARI/GP 2.15+.\n\\\\ (1) The Frey curve of Lemma lem:1.4.7-frey at 2: (u, v, w) = (1377X^5, 2y^5, z^5) with X = 3 mod 4;\n\\\\ for X = 3, 7, ..., 63 and y = 1..64: f_2 = 5, v_2(Delta_min) = 6 (y odd) and f_2 = 1,\n\\\\ v_2(Delta_min) = 10 v_2(y) - 6 (y even), as in Lemma lem:1.4:frey.\n\\\\ (2) The newform sieve of Lemma lem:1.4.7-sieve at the levels 102 and 1632, test primes in the order\n\\\\ 41, 11, 131 (then 31, 241, which remove nothing more), with the sets of code 1.4.7b.\n\\\\ Run: gp -q 1.4.7c_sieve.gp (about 3 s)\ndefault(parisizemax, 1000000000);\nread(\"../common/frey_quintic/fqsieve.gp\");\n{\n my(n = 0);\n forstep (X = 3, 63, 4, for (y = 1, 64, my(e = valuation(y, 2));\n fq_check2(1377*X^5, 2*y^5, if (e, 1, 5), if (e, 10*e - 6, 6)); n++));\n print(\"(1) Frey curve at 2: f_2 = 5, v_2(Delta_min) = 6 (y odd); f_2 = 1, v_2(Delta_min) = 10 v_2(y) - 6\",\n \" (y even): \", n, \" residue classes\");\n Q = [41, 11, 131, 31, 241];\n T = [[0], [2,3], [0,2,3], [0,1,4], [0,2,3]];\n print(\"(2) test primes q = \", Q);\n S = fq_sieve(102, Q, T); if (#fq_print(102, Q, T, S), error(\"survivor at 102\"));\n S = fq_sieve(1632, Q, T); if (#fq_print(1632, Q, T, S), error(\"survivor at 1632\"));\n my(rep = S[3]);\n for (i = 1, #rep, if (rep[i][3][1][2] == 3,\n print(\" orbit \", i, \" (degree \", poldegree(rep[i][2]), \"): (a_41, a_11, a_131) = \",\n [mfcoef(S[2][i], 41), mfcoef(S[2][i], 11), mfcoef(S[2][i], 131)])));\n print(\"PASS 1.4.7c: no survivor at the levels 102 and 1632\");\n}\nquit\n" }, { "path": "anc/code/1.4.7/run_all.py", "size_bytes": 883, "sha256": "0a3a9c029e986b438f75ad3f8803e1a42c9709be10ab5159002b15b9b59a9c6c", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the codes of Section 1.4.7 (17x^5 + 6y^5 + 3z^5 = 0) and compare with expected/.\n\nUsage: python3 run_all.py # all codes of this folder\n python3 run_all.py ... # only the listed code ids\n python3 run_all.py --update # rewrite expected/ from this run\nRequires Python 3 (standard library) and PARI/GP (gp on the PATH, or $GP); see README.md.\n\"\"\"\nimport sys\nfrom pathlib import Path\nHERE = Path(__file__).resolve().parent\nsys.path.insert(0, str(HERE.parent / 'common' / 'frey_quintic'))\nfrom runner import run_steps, table_consistency\n\nSTEPS = [\n ('1.4.7a', 'py', '1.4.7a_elementary.py'),\n ('1.4.7b', 'py', '1.4.7b_traces.py'),\n ('1.4.7c', 'gp', '1.4.7c_sieve.gp'),\n]\nCHECKS = [table_consistency('1.4.7b_traces.py', '1.4.7c_sieve.gp')]\n\nif __name__ == '__main__':\n run_steps(HERE, STEPS, sys.argv[1:], CHECKS)\n" }, { "path": "anc/code/1.4.8/1.4.8a_elementary.py", "size_bytes": 648, "sha256": "8e7f7d1e8cf6ebc9472343523676d1b337fd97518f371185fcab14fa02383564", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.8a (Section 1.4.8, 17x^5 + 9y^5 + 5z^5 = 0): size H, zero coordinates, hypotheses of\nLemma lem:1.4:terms, the three possible even terms, and the level of Lemma lem:1.4:level. Written for the paper.\nRun: python3 -I 1.4.8a_elementary.py (< 1 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import grechuk_H, zero_coordinate_report, report_levels\n\nco = (17, 9, 5)\nH = grechuk_H(co)\nprint('17x^5 + 9y^5 + 5z^5 = 0: H = %d' % H)\nassert H == 992\nzero_coordinate_report(co)\nreport_levels(17, 9, 5, [510])\nprint('PASS 1.4.8a')\n" }, { "path": "anc/code/1.4.8/1.4.8b_traces.py", "size_bytes": 575, "sha256": "5b1d4fefebe7bd2665d7d4959e882e830025baf3ffe6ffc81e30e4eb2b46b2d1", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.8b (Section 1.4.8): the trace sets T_q of Lemma lem:1.4:sieve for 17x^5 + 9y^5 + 5z^5 = 0,\nby two implementations (as in code 1.4.5b). Written for the paper.\nRun: python3 -I 1.4.8b_traces.py (about 3 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import report_traces\n\nTABLE = {11: [2, 3], 31: [2, 3], 41: [0], 71: [2, 3]}\nprint('T_q for 17x^5 + 9y^5 + 5z^5 = 0:')\nreport_traces(17, 9, 5, TABLE)\nprint('PASS 1.4.8b: the four sets of the table')\n" }, { "path": "anc/code/1.4.8/1.4.8c_sieve.gp", "size_bytes": 1402, "sha256": "88091e8c809f2ec5b83ec5814d18935b15033fdd714de149713efe243e1a2ade", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.4.8c (Section 1.4.8, 17x^5 + 9y^5 + 5z^5 = 0). Written for the paper. PARI/GP 2.15 or later.\n\\\\ (1) The Frey curve of Lemma lem:1.4.8-frey at 2: v = the even term, u = the first odd term, both\n\\\\ multiplied by eps = +-1 so that u = -1 mod 4; for each choice of the even variable t = 2..64 (even) and\n\\\\ the odd variables (odd residues mod 2^6): f_2 = 1, v_2(Delta_min) = 10 v_2(t) - 8, as in Lemma lem:1.4:frey.\n\\\\ (2) The newform sieve of Lemma lem:1.4.8-sieve at the level 510, test primes in the order 41, 11\n\\\\ (then 31, 71, which remove nothing more), with the sets of code 1.4.8b.\n\\\\ Run: gp -q 1.4.8c_sieve.gp (about 2 s)\ndefault(parisizemax, 1000000000);\nread(\"../common/frey_quintic/fqsieve.gp\");\n{\n my(n = 0, C = [17, 9, 5]);\n for (j = 1, 3,\n my(io = if (j == 1, 2, 1));\n forstep (t = 2, 64, 2, forstep (s = 1, 63, 2,\n my(e = valuation(t, 2), eps = if ((C[io]*s^5) % 4 == 3, 1, -1));\n fq_check2(eps*C[io]*s^5, eps*C[j]*t^5, 1, 10*e - 8); n++)));\n print(\"(1) Frey curve at 2: f_2 = 1, v_2(Delta_min) = 10e - 8 (e = v_2 of the even variable): \", n,\n \" residue classes (three choices of the even term)\");\n Q = [41, 11, 31, 71];\n T = [[0], [2,3], [2,3], [2,3]];\n print(\"(2) test primes q = \", Q);\n S = fq_sieve(510, Q, T); if (#fq_print(510, Q, T, S), error(\"survivor at 510\"));\n print(\"PASS 1.4.8c: no survivor at the level 510\");\n}\nquit\n" }, { "path": "anc/code/1.4.8/run_all.py", "size_bytes": 883, "sha256": "9f5fe9980628a4fcc0228b6fc460c03ac02bb1c5906096617afcf5a8b6e83a76", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the codes of Section 1.4.8 (17x^5 + 9y^5 + 5z^5 = 0) and compare with expected/.\n\nUsage: python3 run_all.py # all codes of this folder\n python3 run_all.py ... # only the listed code ids\n python3 run_all.py --update # rewrite expected/ from this run\nRequires Python 3 (standard library) and PARI/GP (gp on the PATH, or $GP); see README.md.\n\"\"\"\nimport sys\nfrom pathlib import Path\nHERE = Path(__file__).resolve().parent\nsys.path.insert(0, str(HERE.parent / 'common' / 'frey_quintic'))\nfrom runner import run_steps, table_consistency\n\nSTEPS = [\n ('1.4.8a', 'py', '1.4.8a_elementary.py'),\n ('1.4.8b', 'py', '1.4.8b_traces.py'),\n ('1.4.8c', 'gp', '1.4.8c_sieve.gp'),\n]\nCHECKS = [table_consistency('1.4.8b_traces.py', '1.4.8c_sieve.gp')]\n\nif __name__ == '__main__':\n run_steps(HERE, STEPS, sys.argv[1:], CHECKS)\n" }, { "path": "anc/code/1.4.9/1.4.9a_elementary.py", "size_bytes": 1321, "sha256": "884043a0275321aefcf4417275507aad46cc845fd5661032734e4bc84c8f772f", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4.9a (Section 1.4.9, 14x^5 + 13y^5 + 2z^5 = 0): size H, zero coordinates, the reduction\ny = 2Y to 7x^5 + 208Y^5 + z^5 = 0, hypotheses of Lemma lem:1.4:terms, the level of Lemma lem:1.4:level,\nand the projective points modulo 11 (Lemma lem:1.4.9-eleven), with T_11. Written for the paper.\nRun: python3 -I 1.4.9a_elementary.py (< 1 s)\"\"\"\nimport sys\nfrom pathlib import Path\nsys.path.insert(0, str(Path(__file__).resolve().parents[1] / 'common' / 'frey_quintic'))\nfrom fq import grechuk_H, zero_coordinate_report, report_levels, projective_points, report_traces, \\\n fifth_powers_mod, factor\n\nco = (14, 13, 2)\nH = grechuk_H(co)\nprint('14x^5 + 13y^5 + 2z^5 = 0: H = %d' % H)\nassert H == 928\nzero_coordinate_report(co)\nassert 13 * 2 ** 5 // 2 == 208 and factor(208) == {2: 4, 13: 1}\nprint('mod 2: 14x^5 + 13y^5 + 2z^5 = y^5, so y = 2Y and 7x^5 + 208Y^5 + z^5 = 0 (208 = 2^4*13)')\nreport_levels(7, 208, 1, [91], 'xYz')\nprint('fifth powers mod 11: %s; 208 = %d mod 11' % (fifth_powers_mod(11), 208 % 11))\npts = projective_points(7, 208, 1, 11)\nassert all(p[0] == 0 and p[1] * p[2] % 11 for p in pts), pts\nprint('projective points of 7x^5 + 208Y^5 + z^5 = 0 over F_11 (%d): %s; all have x = 0 and Yz != 0'\n % (len(pts), pts))\nreport_traces(7, 208, 1, {11: [2, 3]})\nprint('PASS 1.4.9a')\n" }, { "path": "anc/code/1.4.9/1.4.9b_newforms.gp", "size_bytes": 1753, "sha256": "53d699d6cf3f1c37f78b6ea8b5a6855664c375917cd2c5d80df706cd5d23e7e8", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.4.9b (Section 1.4.9, 14x^5 + 13y^5 + 2z^5 = 0, y = 2Y). Written for the paper. PARI/GP 2.15+.\n\\\\ (1) The Frey curve of Lemma lem:1.4.9-frey at 2: (u, v, w) = (7x^5, 208Y^5, z^5) with x = 1 mod 4;\n\\\\ for x = 1, 5, ..., 61 and Y = 1..64: good reduction (f_2 = 0, v_2(Delta_min) = 0) if Y is odd,\n\\\\ f_2 = 1 and v_2(Delta_min) = 10 v_2(Y) if Y is even, as in Lemma lem:1.4:frey.\n\\\\ (2) S_2(Gamma_0(91))^new: dimension, Galois orbits, the minimal polynomials of a_11, their values at 2\n\\\\ and 3 modulo 5, and the sieve of fqsieve.gp with T_11 = {2, 3}.\n\\\\ Run: gp -q 1.4.9b_newforms.gp (< 1 s)\ndefault(parisizemax, 1000000000);\nread(\"../common/frey_quintic/fqsieve.gp\");\n{\n my(n = 0, M, B, P);\n forstep (x = 1, 61, 4, for (Y = 1, 64, my(e = valuation(Y, 2));\n fq_check2(7*x^5, 208*Y^5, if (e, 1, 0), 10*e); n++));\n print(\"(1) Frey curve at 2: good if Y is odd; f_2 = 1, v_2(Delta_min) = 10 v_2(Y) if Y is even: \", n,\n \" residue classes\");\n M = mfinit([91, 2], 0); B = mfeigenbasis(M);\n if ([mfdim(M), #B] != [7, 4], error(\"level 91\"));\n P = vector(#B, i, minpoly(mfcoef(B[i], 11)));\n if (P != [x, x + 6, x^2 - 18, x^3 - 2*x^2 - 6*x + 8], error(\"minimal polynomials\"));\n print(\"(2) level 91: dim S_2^new = 7, orbits of dimensions \", vector(#B, i, poldegree(mffields(M)[i])),\n \"; minimal polynomials of a_11: \", P);\n print(\" values at T = 2, 3 modulo 5: \", vector(#P, i, [subst(P[i], x, 2) % 5, subst(P[i], x, 3) % 5]));\n for (i = 1, #P, for (t = 2, 3, if (subst(P[i], x, t) % 5 == 0, error(\"root mod 5\"))));\n S = fq_sieve(91, [11], [[2,3]]); if (#fq_print(91, [11], [[2,3]], S), error(\"survivor at 91\"));\n print(\"PASS 1.4.9b: no newform of level 91 has a_11 = 2 or 3 modulo a prime above 5\");\n}\nquit\n" }, { "path": "anc/code/1.4.9/run_all.py", "size_bytes": 789, "sha256": "4ce5d2c698378345fbaabf1925d61b2a4b6ecafa2c03d0a7f8178acc4e6f2e98", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the codes of Section 1.4.9 (14x^5 + 13y^5 + 2z^5 = 0) and compare with expected/.\n\nUsage: python3 run_all.py # all codes of this folder\n python3 run_all.py ... # only the listed code ids\n python3 run_all.py --update # rewrite expected/ from this run\nRequires Python 3 (standard library) and PARI/GP (gp on the PATH, or $GP); see README.md.\n\"\"\"\nimport sys\nfrom pathlib import Path\nHERE = Path(__file__).resolve().parent\nsys.path.insert(0, str(HERE.parent / 'common' / 'frey_quintic'))\nfrom runner import run_steps, table_consistency\n\nSTEPS = [\n ('1.4.9a', 'py', '1.4.9a_elementary.py'),\n ('1.4.9b', 'gp', '1.4.9b_newforms.gp'),\n]\nCHECKS = []\n\nif __name__ == '__main__':\n run_steps(HERE, STEPS, sys.argv[1:], CHECKS)\n" }, { "path": "anc/code/common/cyclic_cubic/brute_residues.c", "size_bytes": 5646, "sha256": "b703e7b2fe897d498c3b95364965167ad9ba32d11a11b12c4070ba5a4de122ea", "mode": 420, "language": "C", "encoding": "utf-8", "text": "/* brute_residues.c -- direct enumeration of ALL primitive solutions modulo p^k (no normalization, no tree).\n *\n * Part of codes 1.4.2c, 1.4.3c, 1.4.4c (Sections 1.4.2-1.4.4). Written for this bundle. C99, C library only.\n * Usage: brute_residues B | C | Q\n * B: F_B mod 2^6 and mod 3^4, pairs (v(l+), v(l-)), l+- = (-1 +- s)x + 4y, s = 45 (2-adic), 187 (3-adic);\n * C: F_C mod 3^4, pairs for l+- = (2 +- s)y + 3t, s = 31; and mod 8: the parities of (y, t);\n * Q: 8x^4+7y^4+2z^4-t^4 mod 3^4: v_3(f), f = 7y^2+2z^2-3t^2 (values >= 4 reported as 4);\n * mod 7^2: the product of the Legendre symbols (f/7)(A+/7), A+ = 2x^2+2xz+z^2, and v_7(f), v_7(A+).\n * A tuple mod p^k is primitive if not all four coordinates are divisible by p. Valuations are those of the\n * residue mod p^k (\"k\" means: divisible by p^k, i.e. not determined at this precision).\n */\n#include \n#include \n#include \n\ntypedef long long ll;\n\nstatic ll md(ll a, ll m) { a %= m; return a < 0 ? a + m : a; }\n\nstatic int val(ll a, ll p, ll m, int k) {\n a = md(a, m);\n if (a == 0) return k;\n int v = 0;\n while (a % p == 0) { a /= p; v++; }\n return v;\n}\n\nstatic ll FB(ll x, ll y, ll z, ll t, ll m) {\n ll r = 2*x*x%m*x + x*x%m*y + x*y%m*y + y*y%m*y + y*y%m*z - 2*x*z%m*z - z*z%m*z + t*t%m*y + t*z%m*z - t*t%m*t;\n return md(r, m);\n}\nstatic ll FC(ll x, ll y, ll z, ll t, ll m) {\n ll r = 2*x*x%m*x + 2*x*x%m*y + 2*y*y%m*y + y*y%m*z - 2*x*z%m*z - z*z%m*z + t*z%m*z - t*t%m*t;\n return md(r, m);\n}\nstatic ll FQ(ll x, ll y, ll z, ll t, ll m) {\n ll x2 = x*x%m, y2 = y*y%m, z2 = z*z%m, t2 = t*t%m;\n ll r = 8*(x2*x2%m) + 7*(y2*y2%m) + 2*(z2*z2%m) - t2*t2%m;\n return md(r, m);\n}\n\nstatic int leg7(ll a) { a = md(a, 7); if (!a) return 0; return (a == 1 || a == 2 || a == 4) ? 1 : -1; }\n\nstatic int fails = 0;\nstatic void check(int ok, const char *what) { if (!ok) { printf(\"FAIL: %s\\n\", what); fails++; } }\n\n/* returns the set of pairs as a bit mask: bit (8a+b) for the pair (a,b) */\nstatic unsigned long long pairs_BC(char which, ll p, int k, ll s) {\n ll m = 1; for (int i = 0; i < k; i++) m *= p;\n static ll cnt[8][8]; memset(cnt, 0, sizeof cnt);\n ll nsol = 0;\n for (ll x = 0; x < m; x++) for (ll y = 0; y < m; y++) for (ll z = 0; z < m; z++) for (ll t = 0; t < m; t++) {\n if (x % p == 0 && y % p == 0 && z % p == 0 && t % p == 0) continue;\n ll f = which == 'B' ? FB(x, y, z, t, m) : FC(x, y, z, t, m);\n if (f) continue;\n nsol++;\n int a, b;\n if (which == 'B') { a = val((-1 + s)*x + 4*y, p, m, k); b = val((-1 - s)*x + 4*y, p, m, k); }\n else { a = val((2 + s)*y + 3*t, p, m, k); b = val((2 - s)*y + 3*t, p, m, k); }\n cnt[a][b]++;\n }\n printf(\"%c mod %lld^%d (s=%lld): %lld primitive solutions; pairs (v(l+),v(l-)):count\", which, p, k, s, nsol);\n unsigned long long mask = 0;\n for (int a = 0; a <= k; a++) for (int b = 0; b <= k; b++) if (cnt[a][b]) {\n printf(\" (%d,%d):%lld\", a, b, cnt[a][b]);\n mask |= 1ULL << (8*a + b);\n }\n printf(\"\\n\");\n return mask;\n}\n#define PAIR(a, b) (1ULL << (8*(a) + (b)))\n\nint main(int argc, char **argv) {\n if (argc != 2) { fprintf(stderr, \"usage: %s B|C|Q\\n\", argv[0]); return 2; }\n char w = argv[1][0];\n if (w == 'B') {\n check(pairs_BC('B', 2, 6, 45) == (PAIR(2,1) | PAIR(5,1) | PAIR(2,4)), \"B at 2\");\n check(pairs_BC('B', 3, 4, 187 % 81) == (PAIR(0,0) | PAIR(3,0)), \"B at 3\");\n } else if (w == 'C') {\n check(pairs_BC('C', 3, 4, 31) == (PAIR(1,0) | PAIR(1,3)), \"C at 3\");\n ll m = 8, n = 0, bad = 0;\n for (ll x = 0; x < m; x++) for (ll y = 0; y < m; y++) for (ll z = 0; z < m; z++) for (ll t = 0; t < m; t++) {\n if (x % 2 == 0 && y % 2 == 0 && z % 2 == 0 && t % 2 == 0) continue;\n if (FC(x, y, z, t, m)) continue;\n n++;\n if (!(y % 2 == 1 && t % 2 == 0)) bad++;\n }\n printf(\"C mod 8: %lld primitive solutions, %lld with y even or t odd\\n\", n, bad);\n check(bad == 0 && n > 0, \"C at 2\");\n } else if (w == 'Q') {\n ll m = 81, n = 0; ll cv[5] = {0};\n for (ll x = 0; x < m; x++) for (ll y = 0; y < m; y++) for (ll z = 0; z < m; z++) for (ll t = 0; t < m; t++) {\n if (x % 3 == 0 && y % 3 == 0 && z % 3 == 0 && t % 3 == 0) continue;\n if (FQ(x, y, z, t, m)) continue;\n n++;\n cv[val(7*y*y + 2*z*z - 3*t*t, 3, m, 4)]++;\n }\n printf(\"Q mod 3^4: %lld primitive solutions; v_3(f):count\", n);\n for (int v = 0; v <= 4; v++) if (cv[v]) printf(\" %d:%lld\", v, cv[v]);\n printf(\"\\n\");\n check(cv[1] == 0 && cv[3] == 0 && cv[4] == 0 && cv[0] > 0 && cv[2] > 0, \"Q at 3\");\n m = 49; n = 0; ll plus = 0, minus = 0, nonunit = 0;\n for (ll x = 0; x < m; x++) for (ll y = 0; y < m; y++) for (ll z = 0; z < m; z++) for (ll t = 0; t < m; t++) {\n if (x % 7 == 0 && y % 7 == 0 && z % 7 == 0 && t % 7 == 0) continue;\n if (FQ(x, y, z, t, m)) continue;\n n++;\n ll f = 7*y*y + 2*z*z - 3*t*t, A = 2*x*x + 2*x*z + z*z;\n if (md(f, 7) == 0 || md(A, 7) == 0) { nonunit++; continue; }\n if (leg7(f) * leg7(A) == 1) plus++; else minus++;\n }\n printf(\"Q mod 7^2: %lld primitive solutions; f, A+ units at 7 with (f/7)(A+/7) = 1: %lld, = -1: %lld, \"\n \"f or A+ divisible by 7: %lld\\n\", n, plus, minus, nonunit);\n check(minus == 0 && nonunit == 0 && plus == n && n > 0, \"Q at 7\");\n } else { fprintf(stderr, \"unknown case\\n\"); return 2; }\n if (fails) return 1;\n printf(\"PASS brute_residues %c\\n\", w);\n return 0;\n}\n" }, { "path": "anc/code/common/cyclic_cubic/cubicfield.py", "size_bytes": 2798, "sha256": "d31121e5d7dd9358acf5043f605cc4dee7f48295b88c968fcc8b40974874b869", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Exact arithmetic in L = K(u), K = Q(s), s^2 = D, u a root of a monic cubic g in Z[u].\n\nHelper for codes 1.4.2a, 1.4.2b, 1.4.3a, 1.4.3b (Sections 1.4.2, 1.4.3). Written for this bundle.\nElements of L are SymPy expressions in u and s with rational coefficients, kept in the normal form\n sum_{i<3, j<2} c_ij u^i s^j\nby reduction modulo g(u) and s^2 - D. If disc(g) = D*m^2 (m rational), then the second root of g is\n tau(u) = (-u + m*s/g'(u)) / 2,\nbecause (u-u')(u-u'') = g'(u) and (u'-u'')^2 = disc(g)/g'(u)^2; the program checks g(tau(u)) = 0 and\ntau^3 = id, so tau is a generator of Gal(L/K) for this choice of the sign of s.\n\"\"\"\nimport os\nos.environ.setdefault('SYMPY_GROUND_TYPES', 'python')\nimport sympy as sp\n\nu, s = sp.symbols('u s')\n\n\nclass CubicOverQuadratic:\n def __init__(self, g, D, m):\n self.g = sp.Poly(g, u)\n assert self.g.is_monic and self.g.degree() == 3\n self.D = sp.Integer(D)\n self.m = sp.Rational(m)\n disc = sp.discriminant(self.g.as_expr(), u)\n assert disc == self.D * self.m**2, (disc, D, m)\n self.disc = disc\n gp = sp.diff(self.g.as_expr(), u)\n self.inv_gp = self.inverse(gp)\n self.tau_u = self.red((-u + self.m * s * self.inv_gp) / 2)\n assert self.red(self.g.as_expr().subs(u, self.tau_u)) == 0\n t2 = self.tau(self.tau_u)\n assert t2 != u and self.tau_u != u\n assert self.tau(t2) == u\n\n def red(self, e):\n \"\"\"Normal form modulo g(u), s^2 - D.\"\"\"\n e = sp.expand(e)\n e = sp.rem(sp.Poly(e, u), self.g).as_expr()\n e = sp.expand(e)\n e = sp.rem(sp.Poly(e, s), sp.Poly(s**2 - self.D, s)).as_expr()\n return sp.expand(e)\n\n def inverse(self, e):\n \"\"\"Inverse of an element of Q(u) (no s) modulo g.\"\"\"\n r = sp.invert(sp.expand(e), self.g.as_expr(), u)\n assert self.red(r * e) == 1\n return sp.expand(r)\n\n def tau(self, e):\n return self.red(sp.expand(e).subs(u, self.tau_u))\n\n def conj(self, e):\n \"\"\"The automorphism s -> -s, u -> u of the ring Q[u,s]/(g, s^2-D) (not K-linear).\"\"\"\n return self.red(sp.expand(e).subs(s, -s))\n\n def orbit(self, e):\n e0 = self.red(e)\n e1 = self.tau(e0)\n e2 = self.tau(e1)\n assert self.tau(e2) == e0\n return [e0, e1, e2]\n\n def in_K(self, e):\n \"\"\"True if the normal form has no u.\"\"\"\n return sp.Poly(self.red(e), u).degree() <= 0\n\n def norm_K_Q(self, e):\n \"\"\"Norm from K to Q of an element of K.\"\"\"\n assert self.in_K(e)\n return sp.expand(self.red(e * e.subs(s, -s)))\n\n def norm_L_K_poly(self, e):\n \"\"\"Product of the three Gal(L/K)-conjugates (for an element of L, as a K-expression).\"\"\"\n o = self.orbit(e)\n return self.red(o[0] * o[1] * o[2])\n" }, { "path": "anc/code/common/cyclic_cubic/restree.py", "size_bytes": 3506, "sha256": "c0875a5e9bc078091351f3951b617a6ba3a5eecad8ff571b3ea6513362dab7e0", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Complete residue trees for primitive p-adic points of a projective hypersurface, and small p-adic utilities.\n\nHelper for codes 1.4.2c, 1.4.3c, 1.4.4c (Sections 1.4.2--1.4.4). Pure Python, standard library only.\nWritten for this bundle.\n\nNormalization. Every primitive point P of the cone F = 0 over Z_p (coordinates in Z_p, not all in pZ_p) has a\nfirst coordinate (in the order x, y, z, t, ...) that is a p-adic unit; dividing P by it gives a primitive point\nwith that coordinate equal to 1 and with the same projective point. Level k of the tree is the list of all\ntuples (c_0, ..., c_{n-1}) with 0 <= c_j < p^k, c_i = 1 for the first index i with p not dividing c_i, c_j\ndivisible by p for j < i, and F(c) = 0 (mod p^k). Level k+1 is obtained from level k by adding p^k*e_j (0 <= e_j\n< p) to the coordinates j != i and keeping the tuples with F = 0 (mod p^(k+1)). Every normalized primitive\npoint of F = 0 over Z_p reduces to an element of every level, so the levels describe all of them.\n\"\"\"\nfrom itertools import product\n\n\ndef primes_upto(n):\n sieve = bytearray([1]) * (n + 1)\n sieve[0] = sieve[1] = 0\n for i in range(2, int(n ** 0.5) + 1):\n if sieve[i]:\n sieve[i * i::i] = bytearray(len(sieve[i * i::i]))\n return [i for i in range(n + 1) if sieve[i]]\n\n\ndef level1(F, p, n=4):\n out = []\n for i in range(n):\n for tail in product(range(p), repeat=n - 1 - i):\n P = (0,) * i + (1,) + tail\n if F(*P) % p == 0:\n out.append((i, P))\n return out\n\n\ndef tree(F, p, k, n=4):\n \"\"\"Return (level k as a list of (i, tuple), p^k, [sizes of levels 1..k]).\"\"\"\n cur = level1(F, p, n)\n sizes = [len(cur)]\n m = p\n for _ in range(2, k + 1):\n nxt = []\n for (i, P) in cur:\n free = [j for j in range(n) if j != i]\n for d in product(range(p), repeat=n - 1):\n Q = list(P)\n for j, e in zip(free, d):\n Q[j] += m * e\n if F(*Q) % (m * p) == 0:\n nxt.append((i, tuple(Q)))\n cur = nxt\n m *= p\n sizes.append(len(cur))\n return cur, m, sizes\n\n\ndef val_mod(a, p, m):\n \"\"\"p-adic valuation of a modulo m = p^k; None if a = 0 (mod m), i.e. if the valuation is not determined.\"\"\"\n a %= m\n if a == 0:\n return None\n v = 0\n while a % p == 0:\n a //= p\n v += 1\n return v\n\n\ndef sqrt_2adic(a, k):\n \"\"\"The square root r of a (a = 1 mod 8) in Z_2 with r = 1 (mod 4), modulo 2^k.\"\"\"\n assert a % 8 == 1\n r = 1\n for j in range(3, k + 2):\n if (r * r - a) % (2 ** j):\n r += 2 ** (j - 2)\n r %= 2 ** k\n assert (r * r - a) % (2 ** k) == 0 and r % 4 == 1\n return r\n\n\ndef sqrt_padic(a, p, k, r0):\n \"\"\"The square root of a in Z_p (p odd) congruent to r0 modulo p, modulo p^k (Hensel).\"\"\"\n assert (r0 * r0 - a) % p == 0 and (2 * r0) % p\n r, m = r0 % p, p\n for _ in range(1, k):\n m *= p\n r = (r - (r * r - a) * pow(2 * r, -1, m)) % m\n assert (r * r - a) % m == 0 and (r - r0) % p == 0\n return r\n\n\ndef roots_mod_p(coeffs, p):\n \"\"\"Roots in F_p of the polynomial with integer coefficients coeffs (highest degree first).\"\"\"\n out = []\n for r in range(p):\n v = 0\n for c in coeffs:\n v = (v * r + c) % p\n if v == 0:\n out.append(r)\n return out\n\n\ndef legendre(a, p):\n a %= p\n if a == 0:\n return 0\n return 1 if pow(a, (p - 1) // 2, p) == 1 else -1\n" }, { "path": "anc/code/common/frey_quintic/1.4qa_tate2.gp", "size_bytes": 4236, "sha256": "67edf1b8d7cc2df1da36fc17e4dab7c92a884d30488894190ed947c8624e5b26", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.4qa (common framework of Sections 1.4.5-1.4.10): the Frey curve E_{u,v}: Y^2 = X(X-u)(X+v)\n\\\\ at the prime 2 (Lemma lem:1.4:frey). Written for the paper.\n\\\\ (1) The identities behind the model for r = v_2(v) >= 4, as polynomials in u, v, R, S.\n\\\\ (2) The congruences used in the hand run of Tate's algorithm for r = 2, 3 (every residue class of\n\\\\ (u, v/2^r) modulo 2^7 with u = -1 mod 4; each tested expression has integer coefficients and is\n\\\\ tested modulo at most 2^5, so the classes modulo 2^7 cover all integers u, v).\n\\\\ (3) A comparison with PARI's own Tate algorithm (elllocalred) on the same classes for r = 1, ..., 12:\n\\\\ Kodaira type, conductor exponent f_2 and v_2 of the minimal discriminant. For information it also\n\\\\ prints the values for u = 1 mod 4 (the other sign), which the normalization u = -1 mod 4 avoids.\n\\\\ Run: gp -q 1.4qa_tate2.gp (about 2 s)\n\nbinv(a) = {\n my(a1=a[1], a2=a[2], a3=a[3], a4=a[4], a6=a[5], b2, b4, b6, b8);\n b2 = a1^2 + 4*a2; b4 = a1*a3 + 2*a4; b6 = a3^2 + 4*a6;\n b8 = a1^2*a6 + 4*a2*a6 - a1*a3*a4 + a2*a3^2 - a4^2;\n [b2, b4, b6, b8, b2^2 - 24*b4, -b2^2*b8 - 8*b4^3 - 27*b6^2 + 9*b2*b4*b6]\n}\n\n{\n \\\\ ---------------------------------------------------------------- (1) symbolic identities\n my(F = [0, v - u, 0, -u*v, 0], G = [1, (v - u - 1)/4, 0, -u*v/16, 0], bF = binv(F), bG = binv(G));\n if (bF[5] != 16*(u^2 + u*v + v^2), error(\"c4\"));\n if (bF[6] != 16*u^2*v^2*(u + v)^2, error(\"Delta\"));\n if ((8*S + 4*R)^2 - (4*R)*(4*R - u)*(4*R + v) != 64*(S^2 + R*S - R^3 - (v - u - 1)/4*R^2 + u*v/16*R),\n error(\"substitution\"));\n if (bG[5] != u^2 + u*v + v^2 || bG[6] != bF[6]/2^12, error(\"model r>=4\"));\n print(\"(1) c4 = 16(u^2+uv+v^2), Delta = 16u^2v^2(u+v)^2; X=4R, Y=8S+4R gives\");\n print(\" S^2+RS = R^3+((v-u-1)/4)R^2-(uv/16)R with c4' = c4/16 = u^2+uv+v^2 and Delta' = Delta/2^12\");\n}\n\n{\n \\\\ ---------------------------------------------------------------- (2) the hand run for r = 2, 3\n my(n = 0);\n for (r = 2, 3,\n forstep (u = 3, 127, 4, forstep (w = 1, 127, 2,\n my(v = 2^r*w, a2 = v - u - 1, a4 = -u*v);\n \\\\ after y -> y + x: (a1,a2,a3,a4,a6) = (2, v-u-1, 0, -uv, 0); P(T) = T^3 + (a2/2)T^2 + (a4/4)T\n if ((a2/2) % 2 != 0, error(\"a_{2,1}\"));\n if (r == 2,\n if ((a4/4) % 2 != 1, error(\"a_{4,2} odd\"));\n \\\\ x -> x + 2: a2'' = a2 + 6, a3'' = 4, a4'' = a4 + 4 a2 + 12, a6'' = 2 a4 + 4 a2 + 8\n if ((a2 + 6) % 4 != 2 || (a4 + 4*a2 + 12) % 8 != 0 || (2*a4 + 4*a2 + 8) % 16 != 0,\n error(\"I_1^* congruences\")),\n if ((a4/4) % 2 != 0 || valuation(a4, 2) != 3, error(\"III^* congruences\")));\n n++)));\n print(\"(2) r=2: v_2(a2'')=1, a3''=4, 8|a4'', 16|a6'' (type I_1^*); r=3: P(T)=T^3 mod 2, a3=a6=0, v_2(a4)=3\",\n \" (type III^*): \", n, \" residue classes\");\n}\n\n{\nkodname(k) =\n if (k == 1, return(\"I0\")); if (k > 4, return(Str(\"I\", k - 4))); if (k == 2, return(\"II\"));\n if (k == 3, return(\"III\")); if (k == 4, return(\"IV\")); if (k == -1, return(\"I0*\"));\n if (k < -4, return(Str(\"I\", -k - 4, \"*\"))); if (k == -2, return(\"II*\")); if (k == -3, return(\"III*\"));\n \"IV*\";\n}\n\n{\n \\\\ ---------------------------------------------------------------- (3) elllocalred on residue classes\n my(cnt = 0, other = vector(12, r, []));\n for (r = 1, 12,\n my(expf = [5, 3, 3, 0][min(r, 4)], expd = if (r <= 3, 4 + 2*r, 2*r - 8),\n expk = if (r <= 4, [3, -5, -3, 1][r], 4 + 2*r - 8), seen = []);\n if (r >= 5, expf = 1);\n forstep (u = -1, -127, -4, forstep (w = 1, 127, 2,\n my(v = 2^r*w, E = ellinit([0, v - u, 0, -u*v, 0]), lr = elllocalred(E, 2),\n d = valuation(E.disc, 2) - 12*valuation(lr[3][1], 2));\n if (lr[1] != expf || lr[2] != expk || d != expd, error(\"Tate table \", [u, v, lr, d]));\n cnt++));\n forstep (u = 1, 125, 4, forstep (w = 1, 31, 2,\n my(v = 2^r*w, E = ellinit([0, v - u, 0, -u*v, 0]), lr = elllocalred(E, 2));\n seen = setunion(seen, [lr[1]])));\n other[r] = seen;\n print(\"(3) r=\", r, \": type \", kodname(expk), \", f_2=\", expf, \", v_2(Delta_min)=\", expd,\n \" [for u = 1 mod 4: f_2 in \", seen, \"]\"));\n print(\"PASS 1.4qa: Tate table at 2 for u = -1 mod 4 (\", cnt, \" curves, r = 1..12, u and v/2^r modulo 2^7)\");\n}\nquit\n" }, { "path": "anc/code/common/frey_quintic/1.4qb_newdims.py", "size_bytes": 2876, "sha256": "b6b27aa7c425e03c9ebe50f81cd3df482b49fd6f396f6883fb3fafa349bc2aac", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Code 1.4qb (common framework of Sections 1.4.5-1.4.10): dimensions of S_2(Gamma_0(N))^new for the\nlevels of the six newform sieves, from the genus formula, without PARI. Written for the paper.\n\ndim S_2(Gamma_0(M)) is the genus of X_0(M):\n g = 1 + mu/12 - nu2/4 - nu3/3 - nuinf/2,\n mu = M prod_{p|M} (1 + 1/p), nu2 = 0 if 4|M else prod_{p|M} (1 + (-1/p)),\n nu3 = 0 if 9|M else prod_{p|M} (1 + (-3/p)), nuinf = sum_{d|M} phi(gcd(d, M/d)).\nThe new part is dim S_2^new(N) = sum_{M|N} beta(N/M) dim S_2(Gamma_0(M)), with beta multiplicative,\nbeta(p) = -2, beta(p^2) = 1, beta(p^k) = 0 for k >= 3 (Atkin-Lehner theory; G. Martin, J. Number Theory\n112 (2005), 298-331). The values are compared with those printed by mfdim in the codes 1.4.kc.\nRun: python3 -I 1.4qb_newdims.py (< 1 s)\n\"\"\"\nfrom fractions import Fraction\nfrom math import gcd\n\nLEVELS = {210: 5, 3360: 48, 840: 12, 102: 3, 1632: 32, 510: 9, 91: 7, 88: 3, 22: 0}\n\n\ndef factor(n):\n out, p = {}, 2\n while p * p <= n:\n while n % p == 0:\n out[p] = out.get(p, 0) + 1\n n //= p\n p += 1\n if n > 1:\n out[n] = out.get(n, 0) + 1\n return out\n\n\ndef divisors(n):\n ds = [1]\n for p, e in factor(n).items():\n ds = [d * p ** k for d in ds for k in range(e + 1)]\n return sorted(ds)\n\n\ndef phi(n):\n r = n\n for p in factor(n):\n r = r // p * (p - 1)\n return r\n\n\ndef kron(a, p):\n \"\"\"(a/p) for an odd prime p; (-1/2) = 0 and (-3/2) = -1 (Kronecker).\"\"\"\n if p == 2:\n return {-1: 0, -3: -1}[a]\n a %= p\n if a == 0:\n return 0\n return 1 if pow(a, (p - 1) // 2, p) == 1 else -1\n\n\ndef genus(M):\n f = factor(M)\n mu = Fraction(M)\n for p in f:\n mu *= Fraction(p + 1, p)\n nu2 = 0 if M % 4 == 0 else 1\n if nu2:\n for p in f:\n nu2 *= 1 + kron(-1, p)\n nu3 = 0 if M % 9 == 0 else 1\n if nu3:\n for p in f:\n nu3 *= 1 + (kron(-3, p) if p != 3 else 0)\n nuinf = sum(phi(gcd(d, M // d)) for d in divisors(M))\n g = 1 + mu / 12 - Fraction(nu2, 4) - Fraction(nu3, 3) - Fraction(nuinf, 2)\n assert g.denominator == 1 and g >= 0\n return int(g)\n\n\ndef beta(n):\n r = 1\n for p, e in factor(n).items():\n r *= {1: -2, 2: 1}.get(e, 0)\n return r\n\n\ndef newdim(N):\n return sum(beta(N // M) * genus(M) for M in divisors(N))\n\n\nif __name__ == '__main__':\n assert [genus(n) for n in (11, 37, 1, 22, 23)] == [1, 2, 0, 2, 2]\n for N, d in LEVELS.items():\n dn = newdim(N)\n print('N = %4d = %-16s g(X_0(N)) = %3d dim S_2^new = %2d' % (\n N, '*'.join('%d^%d' % (p, e) if e > 1 else str(p) for p, e in factor(N).items()), genus(N), dn))\n assert dn == d, (N, dn, d)\n print('PASS 1.4qb: new dimensions 5, 48, 12, 3, 32, 9, 7, 3, 0 at the levels 210, 3360, 840, 102, 1632,'\n ' 510, 91, 88, 22')\n" }, { "path": "anc/code/common/frey_quintic/1.4qc_modsym_check.gp", "size_bytes": 2148, "sha256": "88e7e73e5e17e61810217862101a8c2fb9644b405710f73ad265032c609d5452", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Code 1.4qc (common framework of Sections 1.4.5-1.4.10): a cross-check of the Hecke data used by the\n\\\\ newform sieves, by a second algorithm. Written for the paper.\n\\\\ For every level N of the six sections and every test prime q used at that level, the characteristic\n\\\\ polynomial of T_q on the new subspace of the modular symbols of weight 2 for Gamma_0(N) with sign +1\n\\\\ (msinit, msnew, mshecke) is compared with the product, over the Galois orbits of newforms given by\n\\\\ mfinit/mfeigenbasis (trace formula), of the characteristic polynomials of a_q over the coefficient field.\n\\\\ The two algorithms are independent inside PARI (modular symbols versus the trace formula).\n\\\\ Run: gp -q -D nbthreads=1 -D threadsizemax=1000000000 1.4qc_modsym_check.gp (about 2 minutes; 0.5 GB)\ndefault(parisizemax, 1500000000);\n{\nLEVELS = [ [210, [11,13,17,31,41,61,71,101,131,151,181,191,211]],\n [3360, [11,13,17,31,41,61,71,101,131,151,181,191]],\n [840, [11,13,17,31,41,61,101,131,151,181,211]],\n [102, [11,31,41,131,241]],\n [1632, [11,31,41,131,241]],\n [510, [11,31,41,71]],\n [91, [11]],\n [88, [3]],\n [22, [3]] ];\n}\n{\n my(t0 = getabstime());\n for (l = 1, #LEVELS,\n my(N = LEVELS[l][1], Q = LEVELS[l][2], t = getabstime());\n my(M = mfinit([N, 2], 0), B = mfeigenbasis(M), K = mffields(M));\n my(S = msinit(N, 2, 1), NW = msnew(S));\n if (msdim(NW) != mfdim(M), error(\"dimension mismatch at \", N));\n for (j = 1, #Q,\n my(q = Q[j], P1, P2);\n P1 = if (msdim(NW), charpoly(mshecke(S, q, NW)), 1);\n P2 = prod(i = 1, #B, my(a = mfcoef(B[i], q));\n if (poldegree(K[i]) == 1, x - a, charpoly(Mod(lift(a), K[i]))));\n if (P1 != P2, error(\"T_\", q, \" mismatch at level \", N)));\n print(\"level \", N, \": dim new = \", msdim(NW), \" (modular symbols) = \", mfdim(M),\n \" (mf); charpoly of T_q agrees for q in \", Q, \" [\", (getabstime() - t) \\ 1000, \" s]\"));\n print(\"PASS 1.4qc: Hecke polynomials from modular symbols = products over the mf orbits at all \",\n #LEVELS, \" levels [\", (getabstime() - t0) \\ 1000, \" s]\");\n}\nquit\n" }, { "path": "anc/code/common/frey_quintic/fq.py", "size_bytes": 10882, "sha256": "2e480971a4a11b360f51fead13b04e594356e6983cb6c092db6e12af8c62106c", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Shared exact helpers for the six diagonal quintics A x^5 + B y^5 + C z^5 = 0\n(Sections 1.4.5-1.4.10 of the paper, common framework of Section 1.4).\n\nWritten for the paper (not taken from the solver's certificates). Python 3 standard library only;\nall arithmetic is exact integer arithmetic. Imported by the scripts of code/1.4.5 ... code/1.4.10\n(they put this folder on sys.path explicitly, so they also run under `python3 -I`).\n\nConventions (as in the text). For pairwise coprime nonzero u, v, w with u + v + w = 0 the Frey curve is\n E_{u,v}: Y^2 = X (X - u) (X + v), c4 = 16 (u^2 + u v + v^2), Delta = 16 u^2 v^2 w^2.\nFor a prime q not dividing 10*A*B*C, the trace set T_q is the set of residues modulo 5 of\n * both signs of a_q(E_{A a^5, B b^5}) for every projective point (a:b:c) over F_q with abc != 0, and\n * both signs of q + 1 if some projective point has a zero coordinate.\n\"\"\"\n\nfrom itertools import permutations\n\n\n# ------------------------------------------------------------------ integers\ndef vp(n, p):\n \"\"\"p-adic valuation of a nonzero integer.\"\"\"\n if n == 0:\n raise ValueError('vp(0)')\n n = abs(n)\n k = 0\n while n % p == 0:\n n //= p\n k += 1\n return k\n\n\ndef factor(n):\n \"\"\"Factorization of a nonzero integer by trial division: dict p -> exponent (|n| small).\"\"\"\n n = abs(n)\n out = {}\n p = 2\n while p * p <= n:\n while n % p == 0:\n out[p] = out.get(p, 0) + 1\n n //= p\n p += 1\n if n > 1:\n out[n] = out.get(n, 0) + 1\n return out\n\n\ndef is_prime(n):\n if n < 2:\n return False\n p = 2\n while p * p <= n:\n if n % p == 0:\n return False\n p += 1\n return True\n\n\ndef grechuk_H(coeffs, degree=5):\n \"\"\"H = sum over monomials of |coefficient| * 2^degree.\"\"\"\n return sum(abs(c) for c in coeffs) * 2 ** degree\n\n\ndef fifth_power_witness(a, b):\n \"\"\"A prime p with v_p(a) - v_p(b) not divisible by 5, or None if |a/b| is a fifth power of a rational.\n Then -a/b (and a/b) is not the fifth power of a rational number.\"\"\"\n fa, fb = factor(a), factor(b)\n for p in sorted(set(fa) | set(fb)):\n if (fa.get(p, 0) - fb.get(p, 0)) % 5:\n return p\n return None\n\n\n# ------------------------------------------------------------------ finite fields\ndef legendre(a, q):\n \"\"\"Legendre symbol (a/q) for an odd prime q, by Euler's criterion.\"\"\"\n a %= q\n if a == 0:\n return 0\n return 1 if pow(a, (q - 1) // 2, q) == 1 else -1\n\n\ndef square_count_table(q):\n \"\"\"n[t] = #{Y in F_q : Y^2 = t}, by squaring every element (no Euler criterion).\"\"\"\n n = [0] * q\n for y in range(q):\n n[y * y % q] += 1\n return n\n\n\ndef frey_trace_charsum(u, v, q):\n \"\"\"a_q(E_{u,v}) = -sum_R ((R (R-u) (R+v)) / q) (good reduction: q odd, u v (u+v) != 0 mod q).\"\"\"\n return -sum(legendre(R * (R - u) * (R + v), q) for R in range(q))\n\n\ndef frey_trace_count(u, v, q, table=None):\n \"\"\"a_q(E_{u,v}) = q + 1 - #E(F_q), counting the points (X, Y) with a table of square roots.\"\"\"\n n = table if table is not None else square_count_table(q)\n affine = sum(n[X * (X - u) * (X + v) % q] for X in range(q))\n return q + 1 - (affine + 1)\n\n\ndef projective_points(A, B, C, q):\n \"\"\"All points (a:b:c) of A a^5 + B b^5 + C c^5 = 0 in P^2(F_q), first nonzero coordinate 1.\"\"\"\n f = [pow(t, 5, q) for t in range(q)]\n pts = []\n for b in range(q):\n for c in range(q):\n if (A + B * f[b] + C * f[c]) % q == 0:\n pts.append((1, b, c))\n for c in range(q):\n if (B + C * f[c]) % q == 0:\n pts.append((0, 1, c))\n if C % q == 0:\n pts.append((0, 0, 1))\n return pts\n\n\ndef trace_set(A, B, C, q):\n \"\"\"Implementation 1 of T_q (character sums for the pair (u, v) = (A a^5, B b^5)).\n Returns (number of points, number with a zero coordinate, sorted list of traces a_q, sorted T_q).\"\"\"\n assert is_prime(q) and q not in (2, 5) and (A * B * C) % q != 0, q\n pts = projective_points(A, B, C, q)\n traces, T, nzero = set(), set(), 0\n for (a, b, c) in pts:\n if a * b * c % q == 0:\n nzero += 1\n T.update({(q + 1) % 5, (-q - 1) % 5})\n continue\n t = frey_trace_charsum(A * pow(a, 5, q) % q, B * pow(b, 5, q) % q, q)\n traces.add(t)\n T.update({t % 5, -t % 5})\n return len(pts), nzero, sorted(traces), sorted(T)\n\n\ndef trace_set_variants(A, B, C, q):\n \"\"\"Implementation 2 of T_q: point counting (no Legendre symbols). For every point with abc != 0 and\n every scaling lambda in F_q^*, the twelve signed orderings (u, v) of the three terms\n (A a^5, B b^5, C c^5) are counted; the assertion checks that they give only the two traces +-t\n (permutations and the common sign give the curve or its twist by -1; scaling by lambda gives the twist\n by lambda^5). Returns (sorted set of all traces met, sorted T_q).\"\"\"\n n = square_count_table(q)\n pts = projective_points(A, B, C, q)\n seen, T = set(), set()\n for (a, b, c) in pts:\n if a * b * c % q == 0:\n T.update({(q + 1) % 5, (-q - 1) % 5})\n continue\n vals = set()\n for lam in range(1, q):\n terms = (A * pow(lam * a, 5, q) % q, B * pow(lam * b, 5, q) % q, C * pow(lam * c, 5, q) % q)\n assert sum(terms) % q == 0\n for (i, j) in permutations(range(3), 2):\n for s in (1, -1):\n vals.add(frey_trace_count(s * terms[i] % q, s * terms[j] % q, q, n))\n t = max(vals)\n assert vals <= {t, -t}, (q, (a, b, c), vals)\n seen |= vals\n T.update({t % 5, -t % 5})\n return sorted(seen), sorted(T)\n\n\n# ------------------------------------------------------------------ the levels (Lemmas lem:1.4:frey, lem:1.4:level)\ndef tate2(r):\n \"\"\"Lemma lem:1.4:frey at 2 for u = -1 mod 4 and r = v_2(v) >= 1: (Kodaira type, f_2, v_2(Delta_min)).\"\"\"\n if r == 1:\n return ('III', 5, 6)\n if r in (2, 3):\n return ('I1*' if r == 2 else 'III*', 3, 4 + 2 * r)\n if r == 4:\n return ('I0', 0, 0)\n return ('I%d' % (2 * r - 8), 1, 2 * r - 8)\n\n\ndef check_terms_hypotheses(A, B, C):\n \"\"\"Hypotheses of Lemma lem:1.4:terms: A, B, C pairwise coprime, every v_p at most 4,\n at most one of |A|, |B|, |C| equal to 1. Returns the list of the coefficient primes.\"\"\"\n from math import gcd\n assert gcd(A, B) == gcd(B, C) == gcd(A, C) == 1\n ps = sorted(set(factor(A)) | set(factor(B)) | set(factor(C)))\n for c in (A, B, C):\n for p, e in factor(c).items():\n assert 1 <= e <= 4, (c, p, e)\n return ps, sum(1 for c in (A, B, C) if abs(c) == 1)\n\n\ndef level_cases(A, B, C, emax=3):\n \"\"\"For each possible even term (Lemma lem:1.4:terms) and e = v_2(variable) = 0..emax (e >= 1 if the\n coefficient is odd): r, the Tate data at 2, whether 2 stays in N_5 (Lemma lem:1.4:level), and N_5.\n The pattern in e is periodic for e >= 1 (r grows by 5, and only r mod 5 matters), so e <= emax shows\n every case.\"\"\"\n coeffs = (A, B, C)\n even = [j for j in range(3) if coeffs[j] % 2 == 0]\n js = even if even else [0, 1, 2]\n assert len(even) <= 1\n odd_rad = 1\n for p in factor(A * B * C):\n if p != 2:\n odd_rad *= p\n out = []\n for j in js:\n s = vp(coeffs[j], 2) if coeffs[j] % 2 == 0 else 0\n for e in range(0 if s else 1, emax + 1):\n r = s + 5 * e\n kod, f, d = tate2(r)\n alpha = f if not (f == 1 and d % 5 == 0) else 0\n out.append((j, e, r, kod, f, d, alpha, 2 ** alpha * odd_rad))\n return out, odd_rad\n\n\ndef report_levels(A, B, C, expected_levels, names='xyz'):\n \"\"\"Print the hypotheses of Lemma lem:1.4:terms and the level table of Lemma lem:1.4:level for\n A x^5 + B y^5 + C z^5 = 0, and assert that the set of levels is expected_levels.\"\"\"\n ps, nunit = check_terms_hypotheses(A, B, C)\n print('equation %d%s^5 + %d%s^5 + %d%s^5 = 0: coefficients pairwise coprime, coefficient '\n 'primes %s, every exponent between 1 and 4; %d coefficient(s) of absolute value 1'\n % (A, names[0], B, names[1], C, names[2], ps, nunit))\n for p in ps:\n vals = [vp(c, p) if c % p == 0 else 0 for c in (A, B, C)]\n print(' p = %2d: v_p(A, B, C) = %s; v_p(Delta_min) = 2 v_p(coefficient) + 10 v_p(variable) = %d + 10k'\n ' (mod 5: %d)' % (p, vals, 2 * max(vals), 2 * max(vals) % 5) if p != 2 else\n ' p = 2: v_2(A, B, C) = %s' % vals)\n cases, odd_rad = level_cases(A, B, C)\n levels = set()\n for (j, e, r, kod, f, d, alpha, N) in cases:\n print(' even term %-7s v_2(%s) = %d%s: r = %2d, type %-4s f_2 = %d, v_2(Delta_min) = %2d, 2 %s N_5;'\n ' N_5 = %d' % ('%d%s^5,' % ((A, B, C)[j], names[j]), names[j], e,\n '' if e < 3 else ' (and likewise for every e > 3)', r, kod, f, d,\n 'in' if alpha else 'not in', N))\n levels.add(N)\n five = 'kept (5 | ABC, multiplicative, 5 does not divide v_5(Delta_min))' if (A * B * C) % 5 == 0 else \\\n 'removed (5 does not divide ABC: good reduction, or multiplicative with 5 | v_5(Delta_min))'\n print(' odd part of rad(ABC) = %d; the prime 5: %s' % (odd_rad, five))\n assert levels == set(expected_levels), levels\n print(' levels N_5: %s' % sorted(levels))\n return sorted(levels)\n\n\ndef zero_coordinate_report(coeffs):\n \"\"\"For the original equation: for each vanishing coordinate, a prime showing that the ratio of the\n other two coefficients is not a fifth power (so the other two coordinates vanish too).\"\"\"\n names = 'xyz'\n for i in range(3):\n j, k = [t for t in range(3) if t != i]\n p = fifth_power_witness(coeffs[j], coeffs[k])\n assert p is not None\n print(' %s = 0: -%d/%d is not a fifth power (v_%d)' % (names[i], coeffs[j], coeffs[k], p))\n\n\ndef report_traces(A, B, C, expected):\n \"\"\"Compute T_q for the primes q of `expected` (dict q -> list) by both implementations, print one\n line per q and assert equality with `expected` (the table of the text).\"\"\"\n for q in expected:\n npts, nzero, traces, T1 = trace_set(A, B, C, q)\n seen, T2 = trace_set_variants(A, B, C, q)\n assert T1 == T2, (q, T1, T2)\n assert sorted(set(traces) | {-t for t in traces}) == seen, (q, traces, seen)\n assert T1 == sorted(expected[q]), (q, T1, expected[q])\n print(' q = %3d: %3d points, %2d with a zero coordinate (q+1 = %d = %d mod 5); traces a_q at the '\n 'others: %-22s T_q = %s' % (q, npts, nzero, q + 1, (q + 1) % 5,\n fmt_set(sorted(set(traces) | {-t for t in traces})), fmt_set(T1)))\n\n\ndef fifth_powers_mod(m):\n return sorted({pow(t, 5, m) for t in range(m)})\n\n\ndef fmt_set(S):\n return '{' + ','.join(str(s) for s in S) + '}'\n" }, { "path": "anc/code/common/frey_quintic/fqsieve.gp", "size_bytes": 3602, "sha256": "e863389bb7171b84a327cc00b67e79c1c93c1f6537de4264d2f8c44f8fb1fbdd", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ fqsieve.gp -- newform sieve for the diagonal quintics (Sections 1.4.5-1.4.8 of the paper).\n\\\\ Written for the paper (not taken from the solver's certificates). PARI/GP 2.15 or later.\n\\\\ Read by the scripts 1.4.kc_sieve.gp of code/1.4.5 ... code/1.4.8 (and 1.4.9b, 1.4.10b).\n\\\\\n\\\\ fq_sieve(N, Q, T): S_2(Gamma_0(N))^new is computed with mfinit([N,2],0); every Galois orbit of newforms\n\\\\ (mfeigenbasis) is taken with its coefficient field K = Q[y]/(P) (mffields). For a non-rational K the\n\\\\ maximal order is computed by nfinit and certified by nfcertify, and every prime ideal lambda | 5 of O_K\n\\\\ (idealprimedec) is tested separately; for K = Q, lambda = 5. The pair (orbit, lambda) is killed at the\n\\\\ first test prime Q[j] for which a_{Q[j]} - t lies outside lambda for every t in T[j] (the test is\n\\\\ idealval(a - t, lambda) > 0, i.e. a = t in the residue field; T[j] is a set of residues mod 5).\n\\\\ Returns [M, B, report], where report[i] = [i, P, [[lambda data, j_kill, a_kill], ...]] (j_kill = 0:\n\\\\ the pair survives all tests).\n\n\\\\ fq_check2(u, v, f, d): u = -1 mod 4, and E_{u,v}: Y^2 = X(X-u)(X+v) has conductor exponent f and\n\\\\ v_2(Delta_min) = d at 2 (PARI's Tate algorithm, elllocalred); error otherwise.\nfq_check2(u, v, f, d) =\n{\n my(E = ellinit([0, v - u, 0, -u*v, 0]), lr = elllocalred(E, 2), dm = valuation(E.disc, 2) - 12*valuation(lr[3][1], 2));\n if (u % 4 != 3, error(\"normalization u = -1 mod 4 fails: \", [u, v]));\n if (lr[1] != f || dm != d, error(\"2-adic data \", [u, v, lr, dm, f, d]));\n 1\n}\n\nfq_in(nf, a, T, pr) =\n{\n for (s = 1, #T, if (idealval(nf, a - T[s], pr) > 0, return(1)));\n 0\n}\n\nfq_sieve(N, Q, T) =\n{\n my(M = mfinit([N, 2], 0), B = mfeigenbasis(M), K = mffields(M), nmax = vecmax(Q), rep = vector(#B));\n if (#B != #K, error(\"mffields\"));\n for (i = 1, #B,\n my(F = B[i], P = K[i], A = mfcoefs(F, nmax), out);\n if (mfparams(F)[4] != P, error(\"field polynomial\"));\n if (poldegree(P) == 1,\n out = [[[5, 1, 1], 0, 0]];\n for (j = 1, #Q,\n my(a = A[Q[j] + 1]);\n if (type(a) != \"t_INT\", error(\"rational orbit with non-integral a_q\"));\n if (!setsearch(T[j], a % 5), out = [[[5, 1, 1], j, a]]; break)),\n \\\\ else: non-rational coefficient field\n my(nf = nfinit(P), prs);\n if (nfcertify(nf) != [], error(\"nfcertify \", P));\n prs = idealprimedec(nf, 5);\n out = vector(#prs, k, [[5, prs[k].e, prs[k].f], 0, 0]);\n for (k = 1, #prs,\n for (j = 1, #Q,\n my(a = lift(A[Q[j] + 1]));\n if (!fq_in(nf, a, T[j], prs[k]), out[k] = [[5, prs[k].e, prs[k].f], j, a]; break))));\n rep[i] = [i, P, out]);\n [M, B, rep]\n}\n\n\\\\ Print the report: one line per orbit, and the counts of pairs (orbit, lambda) still alive after each q.\nfq_print(N, Q, T, S) =\n{\n my(M = S[1], rep = S[3], npairs = 0, alive, surv = List());\n print(\"level \", N, \": dim S_2^new = \", mfdim(M), \", orbits = \", #rep, \", field degrees = \",\n vector(#rep, i, poldegree(rep[i][2])));\n for (i = 1, #rep,\n my(r = rep[i], s = \"\");\n for (k = 1, #r[3],\n my(o = r[3][k]);\n npairs++;\n s = Str(s, \" [e,f]=[\", o[1][2], \",\", o[1][3], \"] \",\n if (o[2], Str(\"killed at q=\", Q[o[2]], \" (a_q=\", o[3], \")\"), \"SURVIVES\"));\n if (!o[2], listput(surv, [i, k])));\n print(\" orbit \", i, \": P=\", r[2], s));\n alive = npairs;\n my(line = Str(\" pairs (orbit, lambda): \", npairs));\n for (j = 1, #Q,\n my(c = 0);\n for (i = 1, #rep, for (k = 1, #rep[i][3], if (rep[i][3][k][2] == j, c++)));\n alive -= c;\n line = Str(line, \"; after q=\", Q[j], \": \", alive));\n print(line);\n Vec(surv)\n}\n" }, { "path": "anc/code/common/frey_quintic/run_all.py", "size_bytes": 1473, "sha256": "a086b346bd7a4630dd9b7b916b647ce8bd2ec195a4b30782286ef0dcc1242ac1", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Run the codes 1.4qa-1.4qc of the common framework of Sections 1.4.5-1.4.10 and compare with expected/.\n\nUsage: python3 run_all.py # 1.4qa, 1.4qb, 1.4qc (about 6 minutes, 1.4qc dominates)\n python3 run_all.py ... # only the listed code ids\n python3 run_all.py --sections # also run the run_all.py of code/1.4.5 ... code/1.4.10 (3 more minutes)\n python3 run_all.py --update # rewrite expected/ from this run\nRequires Python 3 (standard library) and PARI/GP (gp on the PATH, or $GP); see README.md.\n\"\"\"\nimport subprocess\nimport sys\nfrom pathlib import Path\nHERE = Path(__file__).resolve().parent\nsys.path.insert(0, str(HERE))\nfrom runner import run_steps\n\nSTEPS = [\n ('1.4qa', 'gp', '1.4qa_tate2.gp'),\n ('1.4qb', 'py', '1.4qb_newdims.py'),\n ('1.4qc', 'gp', '1.4qc_modsym_check.gp', ['-D', 'nbthreads=1', '-D', 'threadsizemax=1000000000']),\n]\n\nif __name__ == '__main__':\n args = sys.argv[1:]\n run_steps(HERE, STEPS, [a for a in args if a != '--sections'])\n if '--sections' in args:\n for k in range(5, 11):\n d = HERE.parent.parent / ('1.4.%d' % k)\n print('=== %s' % d.name, flush=True)\n r = subprocess.run([sys.executable, str(d / 'run_all.py')] + (['--update'] if '--update' in args else []))\n if r.returncode:\n raise SystemExit('FAIL in %s' % d.name)\n print('PASS: common framework and Sections 1.4.5-1.4.10')\n" }, { "path": "anc/code/common/frey_quintic/runner.py", "size_bytes": 4209, "sha256": "8b382ada010381fa579a05acf66e104e7f0207f09971d535968bf6ef51aea210", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Shared runner for the codes of Sections 1.4.5-1.4.10 and of the common framework (code/common/frey_quintic).\nWritten for the paper. Used by the run_all.py of each folder; Python 3 standard library only.\n\nEach step is (code id, kind, script) with kind 'py' (run as `python3 -I script`) or 'gp' (run as\n`nice -n 10 gp -q [-D ...] script`; the gp binary is $GP or `gp`). The combined output (stdout and stderr,\nwithout PARI's stack-size warnings) goes to out/.txt. A step passes when the process exits with status 0,\nits output contains a line starting with 'PASS ', and no PARI error line ('***' without 'Warning').\nThe output is then compared with expected/.txt, ignoring the timing lines ('[... s]', 'real', 'time').\n`--update` rewrites expected/ instead of comparing.\n\"\"\"\nimport os\nimport re\nimport subprocess\nimport sys\nimport time\nfrom pathlib import Path\n\nTIMING = re.compile(r'\\[\\d+ s\\]| \\[\\d+ s\\]$')\n\n\ndef _clean(text):\n lines = []\n for ln in text.splitlines():\n if 'Warning' in ln and '***' in ln:\n continue\n lines.append(ln.rstrip())\n return '\\n'.join(lines) + '\\n'\n\n\ndef _normal(text):\n return [TIMING.sub('[t]', ln) for ln in text.splitlines()]\n\n\ndef run_steps(here, steps, argv, extra_checks=()):\n here = Path(here)\n update = '--update' in argv\n want = [a for a in argv if not a.startswith('--')]\n known = [s[0] for s in steps]\n bad = [w for w in want if w not in known]\n if bad:\n raise SystemExit('unknown code id(s): %s; known: %s' % (bad, known))\n gp = os.environ.get('GP', 'gp')\n (here / 'out').mkdir(exist_ok=True)\n (here / 'expected').mkdir(exist_ok=True)\n failures = []\n for cid, kind, script, *opts in steps:\n if want and cid not in want:\n continue\n if kind == 'py':\n cmd = [sys.executable, '-I', script]\n else:\n cmd = ['nice', '-n', '10', gp, '-q'] + list(opts[0] if opts else []) + [script]\n t0 = time.time()\n r = subprocess.run(cmd, cwd=here, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)\n dt = time.time() - t0\n out = _clean(r.stdout)\n (here / 'out' / ('%s.txt' % cid)).write_text(out)\n ok = (r.returncode == 0 and any(ln.startswith('PASS ' + cid) for ln in out.splitlines())\n and not any('***' in ln for ln in out.splitlines()))\n status = 'PASS' if ok else 'FAIL'\n exp = here / 'expected' / ('%s.txt' % cid)\n if ok and update:\n exp.write_text(out)\n cmp = 'expected/ updated'\n elif ok and exp.exists():\n cmp = 'same as expected/' if _normal(exp.read_text()) == _normal(out) else 'DIFFERS from expected/'\n if cmp.startswith('DIFFERS'):\n status = 'FAIL'\n else:\n cmp = 'no expected output' if ok else 'see out/%s.txt' % cid\n print('%-8s %-28s %s (%.1f s, %s)' % (cid, script, status, dt, cmp), flush=True)\n if status != 'PASS':\n failures.append(cid)\n for name, fn in extra_checks:\n try:\n fn(here)\n print('%-8s %-28s PASS' % ('check', name))\n except AssertionError as e:\n print('%-8s %-28s FAIL %s' % ('check', name, e))\n failures.append(name)\n if failures:\n raise SystemExit('FAIL: %s' % failures)\n print('PASS: all requested checks in %s' % here.name)\n\n\ndef table_consistency(py_file, gp_file):\n \"\"\"The trace sets hard-coded in the gp sieve equal those asserted by the Python trace script.\"\"\"\n def check(here):\n py = (Path(here) / py_file).read_text()\n gpt = (Path(here) / gp_file).read_text()\n m = re.search(r'TABLE = (\\{.*?\\})\\n', py, re.S)\n table = eval(m.group(1), {'F5x': [1, 2, 3, 4]})\n q = eval(re.search(r'\\bQ = (\\[[^\\]]*\\]);', gpt).group(1))\n t = re.search(r'\\bT = (\\[.*?\\]);', gpt, re.S).group(1)\n t = eval(t.replace('F5x', '[1,2,3,4]'))\n assert len(q) == len(t), 'lengths'\n for qq, tt in zip(q, t):\n assert qq in table and sorted(table[qq]) == sorted(tt), (qq, tt, table.get(qq))\n return ('T_q tables (%s = %s)' % (py_file.split('_')[0], gp_file.split('_')[0]), check)\n" }, { "path": "anc/code/common/h31_classgroup/bound.py", "size_bytes": 6554, "sha256": "4203c84c738c1f585d7efc7f882e5e7db6a874707b0865183d13c970c6bdb4b8", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Evaluate the explicit-formula bound B^-(f) of Theorem B in Arb ball arithmetic.\n\n python3 bound.py PARAMS COUNTS.npz [more .npz] [--no-exp-terms]\n\nTheorem B: B^-(f) = C_inf - int_0^inf (1 - f(x)) W(x) dx\n + (4/n) sum_{q^m < e^T} c_m(q) log q / (q^m + 1) f(m log q),\nC_inf = gamma + log 4pi + alpha - log D / n, alpha = r1/n, c_m(q) = a(q) (m even), 2k(q) - a(q) (m odd).\nHere k(q) = a(q) for q <= C (= principal_bound, proved by check_witnesses.py) and k(q) = 0 above.\nThe window: v = step function with N equal cells on [0, T] and the given integer heights; f is its\nnormalized autocorrelation, piecewise linear with exact rational knots f_k = f(k T/N). Writing\nf = sum_k w_k (1 - |x|/(k delta))_+ with w_k = k (f_{k-1} - 2 f_k + f_{k+1}) gives the closed form\n C_inf - int (1-f) W = sum_k w_k A(k delta),\n A(a) = C_inf - pi^2/(4a) - 2 alpha log 2 / a + (2/a)(Li2(e^-a) - Li2(e^-2a)/4) + (2 alpha/a) log(1+e^-a).\n--no-exp-terms drops the last two (positive) terms of A, giving a smaller, still valid lower bound\n(this is the form used for the one-cell windows of sections 1.1.6 and 1.1.7).\nAll counts a(q) come from count_ideals.py output files whose ranges must tile [2, R-1].\n\"\"\"\nimport argparse, json, math, time\nfrom fractions import Fraction\nimport numpy as np\nfrom flint import arb, ctx\nimport os, sys\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nimport cgfield # noqa: E402\n\n\ndef main():\n ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)\n ap.add_argument('params')\n ap.add_argument('counts', nargs='+')\n ap.add_argument('--no-exp-terms', action='store_true')\n a = ap.parse_args()\n t0 = time.time()\n prm = cgfield.load_params(a.params)\n r1, r2 = (int(v) for v in prm['signature'])\n n = r1 + 2 * r2\n D = int(prm['field_discriminant'])\n C = int(prm['principal_bound'])\n R = cgfield.count_support(prm)\n ctx.prec = int(prm.get('precision_bits', 224))\n T = arb(int(prm['support'])).log() if 'support' in prm else arb(prm['T'])\n alpha = arb(r1) / n\n # ---- window: exact knots and signed triangle coefficients\n h = [int(x) for x in prm['window_heights']]\n N = len(h)\n assert N >= 1 and all(x > 0 for x in h)\n S = sum(x * x for x in h)\n fk = [Fraction(sum(h[i] * h[i + k] for i in range(N - k)), S) for k in range(N + 1)] + [Fraction(0)]\n assert fk[0] == 1 and fk[N] == 0 and all(x >= 0 for x in fk)\n wk = [None] + [k * (fk[k - 1] - 2 * fk[k] + fk[k + 1]) for k in range(1, N + 1)]\n assert sum(wk[1:]) == 1\n for j in range(N + 1): # the triangle expansion reproduces every knot exactly\n assert sum(wk[k] * (1 - Fraction(j, k)) for k in range(max(1, j), N + 1)) == fk[j]\n delta = T / N\n deltaf = float(delta.mid())\n Cinf = arb.const_euler() + (4 * arb.pi()).log() + alpha - arb(D).log() / n\n arch = arb(0)\n for k in range(1, N + 1):\n A = k * delta\n z = (-A).exp()\n val = Cinf - arb.pi() ** 2 / (4 * A) - 2 * alpha * arb(2).log() / A\n if not a.no_exp_terms:\n val += 2 / A * (z.polylog(2) - (z * z).polylog(2) / 4) + 2 * alpha / A * z.log1p()\n arch += arb(wk[k].numerator) / wk[k].denominator * val\n fa = [arb(x.numerator) / x.denominator for x in fk]\n\n def fval(x, xf):\n k = min(max(int(xf / deltaf), 0), N - 1)\n cand = []\n for kk in (k - 1, k, k + 1):\n if 0 <= kk < N and not (x < kk * delta) and not (x > (kk + 1) * delta):\n cand.append(kk)\n assert cand, ('knot search failed', xf)\n vals = [fa[kk] + (x / delta - kk) * (fa[kk + 1] - fa[kk]) for kk in cand]\n v = vals[0]\n for w in vals[1:]:\n v = v.union(w)\n return v, len(cand) > 1\n\n def below_support(m, q, lq):\n if 'support' in prm:\n return q ** m < R\n x = m * lq\n assert x < T or x > T, ('cannot decide q^m < e^T', q, m)\n return x < T\n\n # ---- counts: ranges must tile [2, R-1]\n ranges, qs, as_ = [], [], []\n for fn in a.counts:\n z = np.load(fn)\n lo, hi, sup = (int(v) for v in z['range'])\n assert sup == R, ('counts made with another support', fn, sup, R)\n ranges.append((lo, hi))\n qs.append(z['q']); as_.append(z['a'])\n ranges.sort()\n assert ranges[0][0] == 2 and ranges[-1][1] == R - 1 and all(ranges[i][1] + 1 == ranges[i + 1][0]\n for i in range(len(ranges) - 1)), ranges\n q_all = np.concatenate(qs)\n a_all = np.concatenate(as_)\n del qs, as_\n order = np.argsort(q_all, kind='stable')\n q_all, a_all = q_all[order], a_all[order]\n del order\n assert q_all.size == 0 or bool(np.all(q_all[1:] > q_all[:-1])), 'a norm occurs in two count files'\n pos, neg = arb(0), arb(0)\n terms = mterms = ambiguous = total = principal = 0\n def stream(chunk=1 << 20):\n for i in range(0, q_all.size, chunk):\n yield from zip(q_all[i:i + chunk].tolist(), a_all[i:i + chunk].tolist())\n\n for q, aq in stream():\n assert 2 <= q < R and aq > 0\n total += aq\n kq = aq if q <= C else 0\n principal += kq\n lq = arb(q).log()\n lqf = math.log(q)\n m = 1\n while below_support(m, q, lq):\n c = aq if m % 2 == 0 else 2 * kq - aq\n v, amb = fval(m * lq, m * lqf)\n ambiguous += amb\n t = c * lq * v / (q ** m + 1)\n if c > 0:\n pos += t\n else:\n neg += t\n terms += 1\n mterms += aq\n m += 1\n prime = 4 * (pos + neg) / n\n B = arch + prime\n rec = dict(degree=n, signature=prm['signature'], support_count_bound=R, principal_bound=C, cells=N,\n precision_bits=ctx.prec, exp_terms_dropped=a.no_exp_terms,\n prime_ideals_norm_below_support=total, prime_ideals_proved_principal=principal,\n prime_power_terms=terms, prime_power_terms_with_multiplicity=mterms,\n knot_straddling_terms=ambiguous,\n archimedean=arch.str(30), prime_sum=prime.str(30),\n positive_part=(4 * pos / n).str(25), negative_part=(4 * neg / n).str(25),\n B=B.str(40), B_rigorously_positive=bool(B > 0), seconds=round(time.time() - t0, 1))\n for k, v in rec.items():\n print(k, '=', json.dumps(v))\n print('B_INTERVAL', B.str(40), 'POSITIVE', bool(B > 0), flush=True)\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/common/h31_classgroup/cgfield.py", "size_bytes": 3777, "sha256": "50f08fc1ac240d9910b123aaecb07ecb6f6ff188f26eb975943ee1ea109bd365", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "\"\"\"Shared helpers for the class-group certificate tools (h31_classgroup).\n\nA parameter file (JSON) describes one equation's bitangent field K = Q[x]/(f):\n polynomial defining polynomial of K in the variable x (PARI syntax), monic, integral\n field_discriminant |disc(O_K)| as a decimal string (checked)\n signature [r1, r2] (checked)\n principal_bound C: every prime ideal of norm <= C must be proved principal (Lemma C)\n support or T T = log(support) (support an integer), or T given directly as a decimal string\n window_heights positive integers h_1..h_N: the step function v on [0,T] with N equal cells\n ([1] = the plain triangle window f(x) = 1 - |x|/T)\n precision_bits Arb precision for bound.py (default 224)\n\"\"\"\nimport json, math\nimport cypari2\n\n_P = None\n\n\ndef pari(stack=1_000_000_000):\n global _P\n if _P is None:\n _P = cypari2.Pari()\n _P.allocatemem(stack // 4, stack, silent=True)\n return _P\n\n\ndef load_params(path):\n with open(path) as fh:\n prm = json.load(fh)\n for key in ('polynomial', 'field_discriminant', 'signature', 'principal_bound', 'window_heights'):\n assert key in prm, 'parameter file lacks ' + key\n assert ('support' in prm) != ('T' in prm), 'give exactly one of \"support\" and \"T\"'\n return prm\n\n\ndef count_support(prm):\n \"\"\"Integer R such that the explicit formula needs exactly the prime-ideal norms q < R.\"\"\"\n if 'support' in prm:\n return int(prm['support'])\n from flint import arb, ctx\n ctx.prec = 256\n e = arb(prm['T']).exp()\n guess = math.floor(float(e.mid()))\n for lo in (guess - 1, guess, guess + 1):\n if arb(lo) < e and e < arb(lo + 1):\n break\n else:\n raise AssertionError('cannot locate e^T between consecutive integers')\n return lo + 1 # q < e^T <=> q <= floor(e^T) <=> q < floor(e^T)+1\n\n\nclass Field:\n \"\"\"K = Q[x]/(f) with an unconditionally certified maximal order (nfcertify empty).\"\"\"\n\n def __init__(self, prm, P=None):\n self.P = P = P or pari()\n self.f = P(prm['polynomial'])\n assert self.f.variable() == P('x') and int(self.f.poldegree()) >= 2\n self.n = int(self.f.poldegree())\n self.coeffs = [int(P.polcoef(self.f, j)) for j in range(self.n + 1)] # ascending\n assert self.coeffs[-1] == 1, 'polynomial must be monic'\n assert P.polisirreducible(self.f)\n fa = P.factor(P.poldisc(self.f))\n self.bad = sorted(int(p) for p in fa[0]) # primes dividing disc(f)\n self.nf = P.nfinit([self.f, self.bad]) # all index primes are among self.bad\n assert len(P.nfcertify(self.nf)) == 0, 'maximal order not certified'\n assert abs(int(self.nf[2])) == int(prm['field_discriminant']), 'discriminant mismatch'\n assert [int(v) for v in self.nf.nf_get_sign()] == list(prm['signature']), 'signature mismatch'\n zk = list(self.nf.nf_get_zk())\n assert zk[0] == 1\n raw = [[P.polcoef(z, j) for j in range(self.n)] for z in zk]\n self.den = math.lcm(*(int(c.denominator()) for row in raw for c in row))\n self.rows = [[int(c * self.den) for c in row] for row in raw] # den*zk_i, ascending coeffs\n self.zk = [str(z) for z in zk]\n self.badset = set(self.bad)\n assert self.den == 1 or all(int(q) in self.badset for q in P.factor(self.den)[0])\n\n def root_values(self, p, root):\n \"\"\"(zk_i(root) mod p)_i : membership g in (p, x-root) <=> sum c_i v_i == 0 mod p.\"\"\"\n inv = pow(self.den, -1, p)\n vals = []\n for row in self.rows:\n z = 0\n for c in reversed(row):\n z = (z * root + c) % p\n vals.append(z * inv % p)\n return vals\n" }, { "path": "anc/code/common/h31_classgroup/check_witnesses.py", "size_bytes": 6201, "sha256": "735ba7cfc2ede19802abb3e8458f52c6e36af49b05c81d7d806fc387bc523d31", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Exact check of strict norm-induction witnesses (Lemma C) for all prime ideals of norm <= C.\n\n python3 check_witnesses.py PARAMS WITNESSES.jsonl.gz [more files] [--bound C] [--lo LO] [--hi HI]\n\nThe prime ideals are enumerated here, independently of the witness files: idealprimedec in the\ncertified maximal order for p | disc(f) or p^2 <= C, roots of f mod p otherwise. For every prime\nideal p of norm q <= C over a rational prime in [LO, HI] some witness g must satisfy\n g integral (coordinates in the supplied basis, which must be a Z-basis of O_K), g != 0, g in p,\n |N(g)| = q * prod r^e exactly, every r a proved prime, every r^e < q.\nThen (g) p^{-1} has prime factors of norm < q only, and strong induction on the norm proves that\nall prime ideals of norm <= C are principal. Every witness in the range must be used once.\n\"\"\"\nimport argparse, gzip, heapq, json, time\nfrom flint import nmod_poly\nimport os, sys\nif hasattr(sys, 'set_int_max_str_digits'):\n sys.set_int_max_str_digits(0) # some proposed generators have more than 4300 digits\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nimport cgfield # noqa: E402\n\n\ndef main():\n ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)\n ap.add_argument('params')\n ap.add_argument('witnesses', nargs='+')\n ap.add_argument('--bound', type=int)\n ap.add_argument('--lo', type=int, default=2)\n ap.add_argument('--hi', type=int)\n a = ap.parse_args()\n prm = cgfield.load_params(a.params)\n C = a.bound or int(prm['principal_bound'])\n hi = min(a.hi or C, C)\n F = cgfield.Field(prm)\n P, nf, n = F.P, F.nf, F.n\n t0 = time.time()\n conv = None\n for fn in a.witnesses: # headers: the supplied basis must be a Z-basis of O_K\n with gzip.open(fn, 'rt') as fh:\n head = json.loads(fh.readline())\n assert head['type'] == 'header' and P(head['polynomial']) == F.f\n cols = [P.nfalgtobasis(nf, P.Mod(P(b), F.f)) for b in head['basis']]\n assert all(x.denominator() == 1 for col in cols for x in col), 'supplied basis not integral'\n Mi = [[int(cols[j][i]) for j in range(n)] for i in range(n)] # column j = basis element j\n assert abs(int(P.matdet(P.matrix(n, n, [x for row in Mi for x in row])))) == 1, \\\n 'supplied basis is not a Z-basis of O_K'\n assert conv is None or conv == Mi, 'all files must use the same basis'\n conv = Mi\n\n def records(fn): # streamed; files are sorted by p (as witnesses.py writes them)\n last = 0\n with gzip.open(fn, 'rt') as fh:\n fh.readline()\n for line in fh:\n r = json.loads(line)\n assert r['p'] >= last, ('witness file not sorted by p', fn)\n last = r['p']\n if a.lo <= r['p'] <= hi:\n yield r\n\n stream = heapq.merge(*[records(fn) for fn in a.witnesses], key=lambda r: r['p'])\n nxt = [next(stream, None)]\n nw = 0\n\n def witnesses_of(p):\n nonlocal nw\n out = []\n while nxt[0] is not None and nxt[0]['p'] <= p:\n assert nxt[0]['p'] == p, ('witness for a prime that is not enumerated', nxt[0]['p'])\n out.append(nxt[0])\n nxt[0] = next(stream, None)\n nw += len(out)\n return out\n\n def to_zk(c):\n return [sum(conv[i][j] * c[j] for j in range(n)) for i in range(n)]\n\n primality = {}\n\n def check(r, q):\n c = to_zk(r['g'])\n assert any(c)\n cof = 1\n for ell, e in r['cof']:\n if ell not in primality:\n primality[ell] = bool(P.isprime(ell))\n assert ell > 1 and e > 0 and primality[ell] and ell ** e < q, ('cofactor', r['p'])\n cof *= ell ** e\n assert abs(int(P.nfeltnorm(nf, P.Col(c)))) == q * cof, ('norm', r['p'], r['f'])\n return cof\n\n total_used = 0\n stats = dict(ideals=0, cofactor_one=0, cofactor_gt_one=0, by_degree={})\n\n def accept(r, q):\n cof = check(r, q)\n stats['ideals'] += 1\n stats['cofactor_one' if cof == 1 else 'cofactor_gt_one'] += 1\n stats['by_degree'][r['f']] = stats['by_degree'].get(r['f'], 0) + 1\n\n for pp in P.primes([a.lo, hi]):\n p = int(pp)\n ws = witnesses_of(p)\n used = set() # indices of the witnesses above p already matched\n if p in F.badset or p * p <= C:\n for pr in P.idealprimedec(nf, p):\n q = p ** int(pr[3])\n if q > C:\n continue\n for i, r in enumerate(ws):\n if i in used or p ** r['f'] != q:\n continue\n if int(P.nfeltval(nf, P.Col(to_zk(r['g'])), pr)) >= 1:\n accept(r, q); used.add(i); break\n else:\n raise AssertionError(('no witness for prime ideal', p, q))\n else:\n f = nmod_poly(F.coeffs, p)\n x = nmod_poly([0, 1], p)\n for root in sorted(int(z) for z, m in f.gcd(pow(x, p, f) - x).roots()):\n vals = F.root_values(p, root)\n for i, r in enumerate(ws):\n if i in used or r['f'] != 1:\n continue\n if sum(c * v for c, v in zip(to_zk(r['g']), vals)) % p == 0:\n accept(r, p); used.add(i); break\n else:\n raise AssertionError(('no witness for degree-one prime', p, root))\n assert len(used) == len(ws), ('unused witnesses above', p)\n total_used += len(used)\n assert nxt[0] is None, ('witness for a prime that is not enumerated', nxt[0]['p'])\n assert total_used == nw\n print('ALL', stats['ideals'], 'PRIME IDEALS OF NORM <=', C, 'OVER p IN', [a.lo, hi],\n 'HAVE VALID WITNESSES; COFACTOR_ONE', stats['cofactor_one'], 'COFACTOR_GT_ONE', stats['cofactor_gt_one'],\n 'BY_DEGREE', json.dumps(dict(sorted(stats['by_degree'].items()))), 'WITNESSES_USED', nw,\n 'SECONDS', round(time.time() - t0, 1), flush=True)\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/common/h31_classgroup/count_ideals.py", "size_bytes": 4145, "sha256": "813558ba6f81eb22534c0109c12893fcc081be9aee241519fa0d47baafd0aaa0", "mode": 420, "language": "Python", "encoding": "utf-8", "text": "#!/usr/bin/env python3\n\"\"\"Count all prime ideals of K with norm < R, grouped by norm (the numbers a(q) of Theorem B).\n\n python3 count_ideals.py PARAMS [--lo LO] [--hi HI] [--support R] [--workers W] [--out FILE.npz]\n\nRational primes p in [LO, HI] are treated (default: all p < R). For p dividing disc(f) or with\np^2 < R the prime ideals come from PARI's idealprimedec in the certified maximal order; for the\nother p only degree-one primes can have norm < R and their number is deg gcd(x^p - x, f mod p)\n(f is separable mod p and p does not divide the index). Output: FILE.npz with the sorted norms q,\nthe counts a(q) and the range; several files with disjoint ranges covering [2, R-1] can be passed\nto bound.py. The printed SHA-256 is taken over the packed stream (q, a(q)) as ' 1:\n with mp.Pool(a.workers, initializer=init, initargs=(a.params, support)) as pool:\n for res in pool.imap_unordered(block, tasks):\n take(res)\n else:\n init(a.params, support)\n for t in tasks:\n take(block(t))\n parts.sort(key=lambda t: t[0])\n q = np.concatenate([t[1] for t in parts]) if parts else np.zeros(0, dtype=np.int64)\n c = np.concatenate([t[2] for t in parts]) if parts else np.zeros(0, dtype=np.int32)\n del parts\n order = np.argsort(q, kind='stable')\n q, c = q[order], c[order]\n assert q.size == 0 or bool(np.all(q[1:] > q[:-1]))\n packed = np.empty(q.size, dtype=np.dtype([('q', '= 1\n\n\ndef witness(ideal, p, deg, vals):\n P = F.P\n q = p ** deg\n if not DIRECT:\n g = P.idealmin(F.nf, ideal)\n c = coordinates(g)\n norm = abs(int(P.nfeltnorm(F.nf, g)))\n assert norm % q == 0 and in_ideal(c, ideal, vals, p)\n cof = norm // q\n fa = P.factor(cof)\n cof = [[int(fa[0][i]), int(fa[1][i])] for i in range(len(fa[0]))]\n if all(r ** e < q and P.isprime(r) for r, e in cof):\n return c, cof, 'min'\n gen = P.bnfisprincipal(BNF, ideal, 4)[1]\n if gen.type() == 't_MAT': # factored form: expand\n v = P(1)\n for j in range(gen.nrows()):\n v = P.nfeltmul(F.nf, v, P.nfeltpow(F.nf, gen[j, 0], int(gen[j, 1])))\n gen = v\n c = coordinates(gen)\n assert abs(int(P.nfeltnorm(F.nf, P.Col(c)))) == q and in_ideal(c, ideal, vals, p)\n return c, [], 'bnf'\n\n\ndef block(task):\n lo, hi = task\n P = F.P\n recs = []\n for pp in P.primes([lo, hi]):\n p = int(pp)\n if p in F.badset or p * p <= C:\n for pr in P.idealprimedec(F.nf, p):\n deg = int(pr[3])\n if p ** deg <= C:\n c, cof, how = witness(pr, p, deg, None)\n recs.append(dict(p=p, f=deg, root=None, g=c, cof=cof, how=how))\n else:\n f = nmod_poly(F.coeffs, p)\n x = nmod_poly([0, 1], p)\n roots = sorted(int(r) for r, m in f.gcd(pow(x, p, f) - x).roots())\n for r in roots:\n vals = F.root_values(p, r)\n # column HNF of the kernel of O_K -> F_p, x -> r (first basis element is 1)\n ent = [0] * (F.n * F.n)\n ent[0] = p\n for j in range(1, F.n):\n ent[j] = -vals[j] % p\n ent[F.n * j + j] = 1\n hnf = P.matrix(F.n, F.n, ent)\n c, cof, how = witness(hnf, p, 1, vals)\n recs.append(dict(p=p, f=1, root=r, g=c, cof=cof, how=how))\n return lo, hi, recs\n\n\ndef main():\n ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)\n ap.add_argument('params')\n ap.add_argument('--bound', type=int, help='override C = principal_bound')\n ap.add_argument('--lo', type=int, default=2)\n ap.add_argument('--hi', type=int)\n ap.add_argument('--block', type=int, default=20000)\n ap.add_argument('--workers', type=int, default=1)\n ap.add_argument('--direct', action='store_true', help='only generators (|N(g)| = N(p)), no idealmin witnesses')\n ap.add_argument('--out', default='witnesses.jsonl.gz')\n a = ap.parse_args()\n prm = cgfield.load_params(a.params)\n bound = a.bound or int(prm['principal_bound'])\n hi = min(a.hi or bound, bound)\n t0 = time.time()\n tasks = [(lo, min(lo + a.block - 1, hi)) for lo in range(a.lo, hi + 1, a.block)]\n init(a.params, bound, a.direct)\n header = dict(type='header', polynomial=prm['polynomial'], basis=F.zk, bound=bound, lo=a.lo, hi=hi)\n stats = dict(ideals=0, strict=0, direct=0, by_degree={})\n with gzip.open(a.out, 'wt') as out:\n out.write(json.dumps(header) + '\\n')\n\n def emit(lo, h, recs):\n for r in recs:\n out.write(json.dumps(r, separators=(',', ':')) + '\\n')\n stats['ideals'] += 1\n stats['strict' if r['how'] == 'min' else 'direct'] += 1\n stats['by_degree'][r['f']] = stats['by_degree'].get(r['f'], 0) + 1\n print('BLOCK', lo, h, 'IDEALS', stats['ideals'], 'SECONDS', round(time.time() - t0, 1), flush=True)\n\n if a.workers > 1:\n with mp.Pool(a.workers, initializer=init, initargs=(a.params, bound, a.direct)) as pool:\n for lo, h, recs in pool.imap(block, tasks): # ordered output\n emit(lo, h, recs)\n else:\n for t in tasks:\n emit(*block(t))\n # STRICT: accepted idealmin elements (cofactor possibly 1); DIRECT: bnfisprincipal generators\n print('WITNESSES', stats['ideals'], 'STRICT', stats['strict'], 'DIRECT', stats['direct'],\n 'BY_DEGREE', json.dumps(dict(sorted(stats['by_degree'].items()))), 'BOUND', bound,\n 'RANGE', a.lo, hi, 'SECONDS', round(time.time() - t0, 1), flush=True)\n\n\nif __name__ == '__main__':\n main()\n" }, { "path": "anc/code/common/h31_descent_lib/descent_lib.gp", "size_bytes": 9146, "sha256": "ff4b26afbbc28bc48afb08c47207746fb0f2a38a01d042f45d5755c5330269a7", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Independent marked-bitangent 2-descent toolkit (own code). PARI/GP 2.15.\n\\\\ Curve F(x,y)=0, hyperflex O at infinity, finite bitangents y = m x + b.\n[x,y,m,b,t,w,s];\naa = varlower(\"aa\");\nbitaneqs(F)={\n my(Q=subst(F,y,m*x+b), e4=polcoef(Q,4,x), a3=polcoef(Q,3,x),a2=polcoef(Q,2,x),a1=polcoef(Q,1,x),a0=polcoef(Q,0,x), c1,c0);\n c1=a3/(2*e4); c0=(a2/e4-c1^2)/2;\n [numerator(a1-2*e4*c1*c0), numerator(a0-e4*c0^2), e4]\n};\n\\\\ build component data: [bnf, P(aa), mm, bval, Sprs, globals]\nmkcomp(F,f,Sp,bnffile)={\n my(E=bitaneqs(F), P=subst(f,m,aa), bnf, mm, g, bval, Sprs=[], su, gl, Q, r);\n if(bnffile==\"\", bnf=bnfinit(P,1), bnf=read(bnffile); if(bnf.pol!=P, error(\"pol mismatch\")));\n mm=if(poldegree(f)==1, -polcoef(f,0,m)/polcoef(f,1,m), Mod(aa,P));\n g=gcd(subst(E[1],m,mm), subst(E[2],m,mm));\n if(poldegree(g,b)!=1, error(\"b not unique\"));\n bval=-polcoef(g,0,b)/polcoef(g,1,b);\n \\\\ verify negative/positive quadratic square identity\n Q=subst(subst(F,y,mm*x+bval),m,mm); r=Q/E[3];\n my(c1=polcoef(r,3,x)/2, c0=(polcoef(r,2,x)-c1^2)/2);\n if(r!=(x^2+c1*x+c0)^2, error(\"square identity fails\"));\n if(c1^2-4*c0==0, print(\" note: hyperflex bitangent (coincident contacts) for component \",f));\n for(i=1,#Sp, Sprs=concat(Sprs, idealprimedec(bnf,Sp[i])));\n su=bnfsunit(bnf,Sprs);\n gl=concat([bnf.tu[2]], concat(bnf.fu, su[1]));\n gl=apply(z->if(type(z)==\"t_POLMOD\"||type(z)==\"t_INT\"||type(z)==\"t_FRAC\", z, nfbasistoalg(bnf,z)), gl);\n [bnf, P, mm, bval, Sprs, gl]\n};\n\\\\ local square-class character at prime pr\nmklocdata(nf,pr)={\n my(II);\n if(pr.p==2, II=idealpow(nf,pr,2*(pr.e)+1); [2, idealstar(nf,II,1)], [1, nfmodprinit(nf,pr)])\n};\nlocchar(nf,pr,ld,z)={\n my(u,v,r,res,lg,cyc,out);\n if(z==0, error(\"zero in locchar\"));\n v=nfeltval(nf,z,pr,&u);\n if(ld[1]==1,\n r=nfmodpr(nf,u,ld[2]); if(type(r)==\"t_INT\"||type(r)==\"t_FRAC\", r=Mod(r,pr.p));\n out=[v%2, if(issquare(r),0,1)],\n lg=ideallog(nf,u,ld[2]); cyc=ld[2].cyc; out=[v%2];\n for(j=1,#cyc, if(cyc[j]%2==0, out=concat(out,[lg[j]%2]))));\n out\n};\n\\\\ local coordinate structure at rational prime p over all components\nmkplace(comps,p)={\n my(L=List());\n for(i=1,#comps, my(nf=comps[i][1]); foreach(idealprimedec(nf,p),pr, listput(L,[i,pr,mklocdata(nf,pr)])));\n Vec(L)\n};\n\\\\ local vector of an element of L given as vector of component values (polmods)\nlocvec(comps,place,zs)={\n my(out=[]);\n for(k=1,#place, my(i=place[k][1]); out=concat(out, locchar(comps[i][1].nf,place[k][2],place[k][3],zs[i])));\n out\n};\n\\\\ global basis local vectors: element j of component i is (1,..,g,..,1)\nglobvecs(comps,place)={\n my(rows=List());\n for(i=1,#comps, foreach(comps[i][6],g,\n my(zs=vector(#comps,k,if(k==i,g,1))); listput(rows, locvec(comps,place,zs))));\n Mat(Vec(rows)~) \\\\ hmm\n};\n\\\\ delta of a point (x0,y0) (rationals): vector over components of eps*(y0 - m x0 - b)\ndelta(comps,eps,x0,y0)= vector(#comps,i, eps*(y0 - comps[i][3]*x0 - comps[i][4]));\n\\\\ delta of degree-d divisor cut by line y=k*x+b0, roots of monic g(x) (rational approx coeffs)\ndeltaline(comps,eps,k,b0,g)={\n my(d=poldegree(g));\n vector(#comps,i, my(c=k-comps[i][3], e=b0-comps[i][4]); if(c==0, eps^d*e^d, eps^d*(-c)^d*subst(g,x,-e/c)))\n};\n\\\\ F2 linear algebra helpers (matrices with entries 0/1 as integers)\nf2rank(M)= if(#M==0,0, matrank(Mod(M,2)));\nf2ker(M)= lift(matker(Mod(M,2)));\n\\\\ annihilator of span of rows R (list of vectors of length d): returns matrix d x k with columns spanning R^perp\nf2annih(R,d)={ if(#R==0, return(matid(d))); my(M=Mat(R)); \\\\ rows\n lift(matker(Mod(M,2))) };\n\nglobmat(comps,place)={\n my(rows=List(), d=0);\n for(i=1,#comps, foreach(comps[i][6],g,\n my(zs=vector(#comps,k,if(k==i,g,1))); listput(rows, locvec(comps,place,zs))));\n d=#rows[1];\n matrix(#rows,d,r,c,rows[r][c])\n};\n\\\\ Q_p points lifted from F_p points (affine), precision p^N\nliftpts(F,p,N)={\n my(L=List(), Fx=deriv(F,x), Fy=deriv(F,y));\n for(x0=0,p-1, my(r=polrootsmod(subst(F,x,x0),p));\n foreach(r,y0, my(yy=lift(y0), xx=x0);\n if(subst(subst(Fy,x,xx),y,yy)%p!=0,\n my(Y=Mod(yy,p^N)); for(it=1,12, Y=Y-subst(subst(F,x,xx),y,Y)/subst(subst(Fy,x,xx),y,Y)); listput(L,[xx,lift(Y)]),\n if(subst(subst(Fx,x,xx),y,yy)%p!=0,\n my(X=Mod(xx,p^N)); for(it=1,12, X=X-subst(subst(F,y,yy),x,X)/subst(subst(Fx,y,yy),x,X)); listput(L,[lift(X),yy]),\n error(\"singular point mod p\")))));\n Vec(L)\n};\n\\\\ local image at a place from list of L-elements (each a vector over components)\nlocimage(comps,place,elts)={ my(R=List()); foreach(elts,zs, listput(R,locvec(comps,place,zs))); Vec(R) };\nf2span_rank(R)={ if(#R==0,return(0)); matrank(Mod(matrix(#R,#R[1],r,c,R[r][c]),2)) };\n\\\\ constraint columns for place: G (n x d) times annihilator of span(R)\nconstraint(G,R)={ my(d=#G[1,], A); if(#R==0, return(G)); A=lift(matker(Mod(matrix(#R,d,r,c,R[r][c]),2))); lift(Mod(G,2)*Mod(A,2)) };\n\\\\ norm classes: rational norm of each global element -> (sign, v_p mod 2, p in Sp)\nnormmat(comps,Sp)={\n my(rows=List());\n for(i=1,#comps, foreach(comps[i][6],g, my(N=nfeltnorm(comps[i][1].nf,g));\n listput(rows, concat([if(N<0,1,0)], vector(#Sp,j,valuation(N,Sp[j])%2)))));\n matrix(#rows,#rows[1],r,c,rows[r][c])\n};\nseldim(Cmat)= #f2ker(Cmat~);\n\n\\\\ lift a single F_p point with the fixed coordinate shifted by j*p\nliftpt(F,p,N,x0,y0,j)={\n my(Fx=deriv(F,x), Fy=deriv(F,y), xx, yy, Y, X);\n if(subst(subst(Fy,x,x0),y,y0)%p!=0,\n xx=x0+j*p; Y=Mod(y0,p^N); for(it=1,12, Y=Y-subst(subst(F,x,xx),y,Y)/subst(subst(Fy,x,xx),y,Y)); [xx,lift(Y)],\n yy=y0+j*p; X=Mod(x0,p^N); for(it=1,12, X=X-subst(subst(F,y,yy),x,X)/subst(subst(Fx,y,yy),x,X)); [lift(X),yy])\n};\n\\\\ F_p points (affine)\nfppts(F,p)={ my(L=List()); for(x0=0,p-1, foreach(polrootsmod(subst(F,x,x0),p),y0, listput(L,[x0,lift(y0)]))); Vec(L) };\n\\\\ delta of a good-prime point: choose lift with all valuations < N-5\ndeltagood(comps,eps,F,p,N,P)={\n my(j=0, Q, zs, ok);\n while(1, Q=liftpt(F,p,N,P[1],P[2],j); zs=delta(comps,eps,Q[1],Q[2]); ok=1;\n for(i=1,#comps, my(nf=comps[i][1].nf); if(zs[i]==0, ok=0, foreach(idealprimedec(nf,p),pr, if(nfeltval(nf,zs[i],pr)>N-5, ok=0))));\n if(ok, return(zs)); j++; if(j>20, error(\"no good lift\")))\n};\ngoodplace(comps,eps,F,p,N)={\n my(pl=mkplace(comps,p), G=globmat(comps,pl), pts=fppts(F,p), imgs=List(), R);\n foreach(pts,P, listput(imgs, deltagood(comps,eps,F,p,N,P)));\n R=locimage(comps,pl,Vec(imgs));\n [G,R,#pts]\n};\n\n\\\\ ---------- dyadic (or any p) local points with certified precision ----------\n\\\\ returns [zs, certified] for divisor cut by line y=k*x+b0 with Q_p-irreducible factor g (padic coeffs)\ndline_cert(comps,eps,k,b0,g,p)={\n my(d=poldegree(g), Ng=vecmin(vector(d,j,padicprec(polcoef(g,j-1),p))), ga=Pol(apply(c->truncate(c),Vec(g))), zs, ok=1);\n ga=subst(ga,variable(g),x);\n zs=deltaline(comps,eps,k,b0,ga);\n for(i=1,#comps, if(zs[i]==0, return([zs,0])));\n for(i=1,#comps, my(nf=comps[i][1].nf, c=k-comps[i][3], e=b0-comps[i][4], ve, vc);\n foreach(idealprimedec(nf,p),pr, ve=if(e==0,10^6,nfeltval(nf,e,pr)); vc=if(c==0,10^6,nfeltval(nf,c,pr));\n my(v=nfeltval(nf,zs[i],pr), bnd=Ng*(pr.e) + vecmin(vector(d+1,j, (j-1)*ve+(d-j+1)*vc)));\n if(v+2*(pr.e)+1 >= bnd, ok=0)));\n [zs,ok]\n};\n\\\\ collect local images at p from lines y = k x + b0 over given ranges\nlinepts(comps,eps,F,p,N,ks,bs)={\n my(L=List(), nc=0);\n foreach(ks,k, foreach(bs,b0,\n my(q=subst(F,y,k*x+b0), fa);\n q=q/pollead(q);\n if(poldisc(q)!=0,\n fa=factorpadic(q,p,N)[,1];\n foreach(fa,g, if(poldegree(g)<4,\n my(r=dline_cert(comps,eps,k,b0,g,p)); if(r[2], listput(L,r[1]), nc++))))));\n [Vec(L),nc]\n};\n\\\\ infinity disk points: chart G(t,w)=0, t in p*Z, returns delta(P-O) using eps*(1-m t-b w)*w (w^2 removed)\ninfpts(comps,eps,F,p,N,tlist)={\n my(G=numerator(subst(subst(F,x,t/w),y,1/w)*w^4), L=List(), nc=0);\n foreach(tlist,t0, my(W=Mod(0,p^N)*1, Gt=subst(G,t,t0), zs, ok=1);\n W=O(p^N); for(it=1,15, W=W-subst(Gt,w,W)/subst(deriv(Gt,w),w,W));\n my(wv=truncate(W), Nw=padicprec(W,p));\n if(wv==0, next);\n zs=vector(#comps,i, eps*(1-comps[i][3]*t0-comps[i][4]*wv)*wv);\n for(i=1,#comps, my(nf=comps[i][1].nf); foreach(idealprimedec(nf,p),pr,\n my(v=nfeltval(nf,zs[i],pr), bnd=Nw*(pr.e)+min(0,nfeltval(nf,comps[i][4],pr))-1);\n if(v+2*(pr.e)+1>=bnd, ok=0)));\n if(ok, listput(L,zs), nc++));\n [Vec(L),nc]\n};\n\n\\\\ express an element zs of L (vector over comps) in the global basis via characters; returns [coeff vector or 0, residual check]\nauxchars(comps,Sp,qmax)={\n my(AX=List());\n for(i=1,#comps, my(nf=comps[i][1].nf);\n foreach(comps[i][5],pr, listput(AX,[i,pr,0]));\n forprime(q=3,qmax, if(setsearch(Set(Sp),q)==0, foreach(idealprimedec(nf,q),pr, listput(AX,[i,pr,mklocdata(nf,pr)])))));\n Vec(AX)\n};\ncharvec(comps,AX,zs)= vector(#AX,k, my(i=AX[k][1], nf=comps[i][1].nf); if(AX[k][3]==0, nfeltval(nf,zs[i],AX[k][2])%2, locchar(nf,AX[k][2],AX[k][3],zs[i])[2]));\nglobcharmat(comps,AX)={ my(rows=List()); for(i=1,#comps, foreach(comps[i][6],g, listput(rows, charvec(comps,AX,vector(#comps,k,if(k==i,g,1)))))); matrix(#rows,#AX,r,c,rows[r][c]) };\nexpress(GC,cv)={ my(sol=matsolve(Mod(GC~,2), Mod(cv~,2))); lift(sol) };\n" }, { "path": "anc/code/common/h31_descent_lib/descent_points.gp", "size_bytes": 4729, "sha256": "e02d0a8c2e05c6d15c8370325a8379fc65b28997042ce15926c1da84630ed045", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\ Certified local descent images of individual p-adic divisors (extension of descent_lib.gp;\n\\\\ read descent_lib.gp first). A local point is known only to finite precision; its delta value is\n\\\\ written as a polynomial in \"error variables\" (each error lies in p^N Z_p) and the error is\n\\\\ bounded by the valuations of all non-constant coefficients. The square class at a prime pr | p\n\\\\ is fixed once the error has valuation >= v(value) + 2 e(pr) + 1; we require \">\" (one extra unit).\n\\\\ error variables and the formal square root r: priority above the number-field variable aa of\n\\\\ descent_lib.gp (which is created with varlower), r above the error variables\ndc = varhigher(\"dc\"); da = varhigher(\"da\"); dy = varhigher(\"dy\"); r = varhigher(\"r\");\n\n\\\\ all monomials of a polynomial P in the variables vars: list of [coefficient, total degree]\nmonos(P, vars) = {\n if(#vars == 0, return([[P, 0]]));\n my(L = List(), v = vars[1], rest = vars[2..#vars]);\n for(k = 0, poldegree(P, v), my(c = polcoef(P, k, v));\n if(c != 0, foreach(monos(c, rest), mm, listput(L, [mm[1], mm[2] + k]))));\n Vec(L)\n};\n\\\\ E: vector over components of polynomials in vars (coefficients: elements of the component fields);\n\\\\ every variable is an error in p^N Z_p. Returns [values, ok, min margin].\ncertpoly(comps, p, E, vars, N) = {\n my(vals = vector(#comps), ok = 1, margin = 10^9);\n for(i = 1, #comps, my(nf = comps[i][1].nf, ms = monos(E[i], vars), c0 = 0);\n foreach(ms, mm, if(mm[2] == 0, c0 = mm[1]));\n if(c0 == 0, return([vals, 0, -1]));\n vals[i] = c0;\n foreach(idealprimedec(nf, p), pr,\n my(v0 = nfeltval(nf, c0, pr), be = 10^9);\n foreach(ms, mm, if(mm[2] > 0, be = min(be, nfeltval(nf, mm[1], pr) + N * pr.e * mm[2])));\n margin = min(margin, be - v0 - 2 * (pr.e));\n if(be <= v0 + 2 * (pr.e) + 1, ok = 0)));\n [vals, ok, margin]\n};\n\\\\ affine point (x0, y) with x0 exact and y a p-adic number (precision from PARI): delta(P - O)\nptimg(comps, eps, p, x0, ypad) = {\n my(N = padicprec(ypad, p), y0 = truncate(ypad));\n certpoly(comps, p, vector(#comps, i, eps * ((y0 + dy) - comps[i][3] * x0 - comps[i][4])), [dy], N)\n};\n\\\\ same with y0 exact and x a p-adic number\nptimgx(comps, eps, p, xpad, y0) = {\n my(N = padicprec(xpad, p), x0 = truncate(xpad));\n certpoly(comps, p, vector(#comps, i, eps * (y0 - comps[i][3] * (x0 + dy) - comps[i][4])), [dy], N)\n};\n\\\\ point of the disk at infinity with t = t0 exact and w a p-adic number: delta(P - O) is the class of\n\\\\ eps * (1 - m t - b w) * w (h = eps (y - m x - b) = eps (1 - m t - b w)/w, times the square w^2)\ninfimg(comps, eps, p, t0, wpad) = {\n my(N = padicprec(wpad, p), w0 = truncate(wpad));\n certpoly(comps, p, vector(#comps, i, eps * (1 - comps[i][3] * t0 - comps[i][4] * (w0 + dy)) * (w0 + dy)), [dy], N)\n};\n\\\\ ---- quadratic points over Q_p(r), r^2 = d (d a non-square unit times p^0 or p^1) ----\n\\\\ reduce a polynomial in r modulo r^2 - d and return [A, B] with E = A + B r\nsplitr(E, d) = { my(R = E % (r^2 - d)); [polcoef(R, 0, r), polcoef(R, 1, r)] };\n\\\\ Newton iteration for a root W = a + c r of g(W) = 0 in Z_p[r]/(r^2-d) (g a polynomial in W with\n\\\\ coefficients in Z[r]), starting from W0, with all coefficients kept mod p^N. The derivative must be\n\\\\ a unit; then the true root differs from the result by an element of p^M Z_p[r], M = valuation of\n\\\\ the residual. Returns [a, c, M].\nredr(e, d, p, N) = { my(ab = splitr(e, d)); lift(Mod(ab[1], p^N)) + lift(Mod(ab[2], p^N)) * r };\nnewtonr(g, W, W0, d, p, N) = {\n my(w = W0, gw = deriv(g, W));\n for(it = 1, 2 * N, my(num = splitr(subst(g, W, w), d), den = splitr(subst(gw, W, w), d), nd = den[1]^2 - d * den[2]^2);\n if(valuation(nd, p) != 0, error(\"derivative not a unit\"));\n w = redr(w - redr((num[1] + num[2] * r) * (den[1] - den[2] * r), d, p, N) * lift(Mod(1, p^N) / nd), d, p, N));\n my(res = splitr(subst(g, W, w), d), M = min(if(res[1], valuation(res[1], p), N), if(res[2], valuation(res[2], p), N)));\n my(ab = splitr(w, d));\n [ab[1], ab[2], min(M, N)]\n};\n\\\\ delta of the trace divisor R + R' - 2O for an affine point R = (x, y) over Q_p(r), where\n\\\\ x = X(r) exact and y = a + c r known mod p^M: norm of eps (y - m x - b)\nquadimg(comps, eps, p, d, X, a, c, M) = {\n my(E = vector(#comps, i, my(ab = splitr(eps * ((a + da) + (c + dc) * r - comps[i][3] * X - comps[i][4]), d)); ab[1]^2 - d * ab[2]^2));\n certpoly(comps, p, E, [da, dc], M)\n};\n\\\\ same for a point of the disk at infinity with t = T(r) exact and w = a + c r known mod p^M\nquadinfimg(comps, eps, p, d, T, a, c, M) = {\n my(E = vector(#comps, i, my(w = (a + da) + (c + dc) * r, ab = splitr(eps * (1 - comps[i][3] * T - comps[i][4] * w) * w, d)); ab[1]^2 - d * ab[2]^2));\n certpoly(comps, p, E, [da, dc], M)\n};\n" }, { "path": "anc/code/common/simon_ell/ell.gp", "size_bytes": 71853, "sha256": "f137f61c596b4d86c72c294b46bccb8743beac55e5373d74ec7265baaf708800", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ Copyright (C) 2011 Denis Simon\n\\\\\n\\\\ Distributed under the terms of the GNU General Public License (GPL)\n\\\\\n\\\\ This code is distributed in the hope that it will be useful,\n\\\\ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\\\\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\\\\ General Public License for more details.\n\\\\\n\\\\ The full text of the GPL is available at:\n\\\\\n\\\\ http://www.gnu.org/licenses/\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n/*\n Auteur :\n Denis SIMON -> simon@math.unicaen.fr\n adresse du fichier :\n www.math.unicaen.fr/~simon/ell.gp\n\n *********************************************\n * VERSION 06/04/2011 *\n *********************************************\n\n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n \\\\ Comment utiliser ce programme ? \\\\\n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n Programme de calcul du rang des courbes elliptiques\n dans les corps de nombres.\n langage: GP\n pour l'utiliser, lancer gp, puis taper\n \\r ell.gp\n\n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n \\\\ Description des principales fonctions \\\\\n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n Explications succintes :\n definition du corps :\n bnf=bnfinit(y^2+1);\n (il est indispensable que la variable soit y).\n on peut ensuite poser : \n X = Mod(y,bnf.pol);\n\n La fonction bnfellrank() accepte toutes les courbes sous la forme\n [a1,a2,a3,a4,a6]\n Les coefficients peuvent etre entiers ou non.\n L'algorithme utilise est celui de la 2-descente.\n La 2-torsion peut etre quelconque.\n Il suffit de taper : \n\n gp > ell = [a1,a2,a3,a4,a6];\n gp > bnfellrank(bnf,ell)\n\n Retourne un vecteur [r,s,vec]\n ou r est le rang probable (c'est toujours une minoration du rang),\n s est le 2-rang du groupe de Selmer,\n vec est une liste de points dans E(K)/2E(K).\n\n Courbes avec #E[2](K) >= 2:\n ell doit etre sous la forme \n y^2 = x^3 + A*^2 + B*x\n avec A et B entiers algebriques\n gp > ell = [0,A,0,B,0]\n gp > bnfell2descent_viaisog(ell)\n = algorithme de la 2-descente par isogenies\n Attention A et B doivent etre entiers\n\n Courbes avec #E[2](K) = 4: y^2 = (x-e1)*(x-e2)*(x-e3)\n -> bnfell2descent_complete(bnf,e1,e2,e3);\n = algorithme de la 2-descente complete\n Attention: les ei doivent etre entiers algebriques.\n\n\n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n \\\\ Affichage des calculs \\\\\n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n On peut avoir plus ou moins de details de calculs avec\n DEBUGLEVEL_ell = 0;\n DEBUGLEVEL_ell = 1; 2; 3;...\n\n*/\n\n\nnf_scalar_or_multable_to_alg(nf, z) = {\n if (type(z) == \"t_MAT\", nfbasistoalg(nf, z[,1]), z);\n}\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ SCRIPT \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ MANIPULATION OF GLOBAL VARIABLES \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n{default_ell(\n DEBUGLEVEL_ell_val:small = 0,\n LIM1_val:small = 2,\n LIM3_val:small = 4,\n LIMTRIV_val:small = 2,\n MAXPROB_val:small = 20,\n LIMBIGPRIME_val:small = 30\n ) = \n\n DEBUGLEVEL_ell = DEBUGLEVEL_ell_val;\n print(\" DEBUGLEVEL_ell = \",DEBUGLEVEL_ell);\n\n LIM1 = LIM1_val;\n print(\" LIM1 = \",LIM1);\n\n LIM3 = LIM3_val;\n print(\" LIM3 = \",LIM3);\n\n LIMTRIV = LIMTRIV_val;\n print(\" LIMTRIV = \",LIMTRIV);\n\n MAXPROB = MAXPROB_val;\n print(\" MAXPROB = \",MAXPROB);\n\n LIMBIGPRIME = LIMBIGPRIME_val;\n print(\" LIMBIGPRIME = \",LIMBIGPRIME);\n}\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ COMMON FUNCTIONS TO ell.gp AND ellQ.gp \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n{ellcomposeurst(urst1,urst2) =\nlocal(u1 = urst1[1], r1 = urst1[2], s1 = urst1[3], t1 = urst1[4],\n u2 = urst2[1], r2 = urst2[2], s2 = urst2[3], t2 = urst2[4]);\n [u1*u2,u1^2*r2+r1,u1*s2+s1,u1^3*t2+s1*u1^2*r2+t1];\n}\n{ellinverturst(urst) =\nlocal(u = urst[1], r = urst[2], s = urst[3], t = urst[4]);\n [1/u,-r/u^2,-s/u,(r*s-t)/u^3];\n}\n{mysubst(polsu,subsx) =\n if( type(lift(polsu)) == \"t_POL\",\n return(simplify(subst(lift(polsu),variable(lift(polsu)),subsx)))\n , return(simplify(lift(polsu))));\n}\n{degre(idegre) =\nlocal(ideg = idegre, jdeg = 0);\n\n while( ideg >>= 1, jdeg++);\n return(jdeg);\n}\n{nfissquare(nf, a) = #nfsqrt(nf,a) > 0;\n}\n{nfsqrt( nf, a) =\n\\\\ if a is a square in the number field nf returns [sqrt(a)], otherwise [].\nlocal(alift,ta,py,pfact);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting nfsqrt \",a));\n if( a==0 || a==1, \nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrt \",a));\n return([a]));\n\n alift = lift(a);\n ta = type(a);\n if( !poldegree(alift), alift = polcoeff(alift,0));\n\n if( type(alift) != \"t_POL\",\n if( issquare(alift), \nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrt \",sqrtrat(alift)));\n return([sqrtrat(alift)])));\n\n if( poldegree(nf.pol) <= 1,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrt \",[]));\n return([]));\n if( ta == \"t_POL\", a = Mod(a,nf.pol));\n\n\\\\ the norm should be a square\n\n if( !issquare(norm(a)),\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrt \",[]));\n return([]));\n\n\\\\ the real embeddings must all be >0\n\n for( i = 1, nf.r1,\n if( nfrealsign(nf,a,i) < 0,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrt \",[]));\n return([])));\n\n\\\\ factorization over nf of the polynomial X^2-a\n\n if( variable(nf.pol) == 'x,\n py = subst(nf.pol,'x,'y);\n pfact = lift(factornf('x^2-mysubst(alift,Mod('y,py)),py)[1,1])\n ,\n pfact = lift(factornf('x^2-a,nf.pol)[1,1]));\n if( poldegree(pfact) == 2,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrt \",[]));\n return([]));\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrt \",pfact));\n return([subst(polcoeff(pfact,0),'y,Mod(variable(nf.pol),nf.pol))]);\n}\n{nfrealsign(nf,a,i) =\n\\\\ return the sign of the algebraic number a in the i-th real embedding.\nlocal(nf_roots,ay,prec0);\n\n if( a == 0, return(0));\n\n a = lift(a);\n if( type(a) != \"t_POL\",\n return(sign(a)));\n\n nf_roots = nf.roots;\n prec0 = default(realprecision);\n\n ay = 0;\n while( ay == 0 || precision(ay) < 38,\n\n ay = subst(a,variable(a),nf_roots[i]);\n\n if( ay == 0 || precision(ay) < 38,\nif( DEBUGLEVEL_ell >= 3, \n print(\" **** Warning: doubling the real precision in nfrealsign **** \",\n 2*default(realprecision)));\n default(realprecision,2*default(realprecision));\n nf_roots = real(polroots(nf.pol))\n )\n );\n default(realprecision,prec0);\n\n return(sign(ay));\n}\n{sqrtrat(a) =\n sqrtint(numerator(a))/sqrtint(denominator(a));\n}\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ FUNCTIONS SPECIFIC TO ell.gp \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n{nfpolratroots(nf,pol) =\nlocal(f,ans);\n f = nffactor(nf,lift(pol))[,1];\n ans = [];\n for( j = 1, #f, \n if( poldegree(f[j]) == 1,\n ans = concat(ans,[-polcoeff(f[j],0)/polcoeff(f[j],1)])));\n return(ans);\n}\n{mynfhilbert2(nf,a,b,p) =\n\\\\ p is a prime output by idealprimedec() above 2\nlocal(v,res);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting mynfhilbert2\"));\n v = idealval(nf,a,p)\\2;\n if( v, a *= nfbasistoalg(nf,p[2])^(-2*v));\n\n v = idealval(nf,b,p)\\2;\n if( v, b *= nfbasistoalg(nf,p[2])^(-2*v));\n\n if( nfqp_soluble(nf,a*'x^2+b,initp(nf,p)), res = 1, res = -1);\nif( DEBUGLEVEL_ell >= 5, print(\" end of mynfhilbert2\",res));\n return(res);\n}\n{mynfhilbertp(nf,a,b,p) =\n\\\\ calcule le symbole de Hilbert quadratique local (a,b)_p\n\\\\ * en l'ideal premier p du corps nf,\n\\\\ * a et b sont des elements non nuls de nf, sous la forme\n\\\\ * de polmods ou de polynomes, et p renvoye par idealprimedec().\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting mynfhilbertp at \",p));\n if( a == 0 || b == 0, error(\"mynfhilbertp: argument = 0\"));\n if( p.p == 2,\nif( DEBUGLEVEL_ell >= 5, print(\" end of mynfhilbertp\"));\n return(mynfhilbert2(nf,a,b,p)));\n if( type(a) != \"t_POLMOD\", a = Mod(a,nf.pol));\n if( type(b) != \"t_POLMOD\", b = Mod(b,nf.pol));\nreturn(nfhilbert(nf,a,b,p));\n}\n{ideallistfactor(nf,listfact) =\nlocal(Slist,S1,test,k);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting ideallistfactor\"));\n Slist = []; test = 1;\n for( i = 1, #listfact,\n if( listfact[i] == 0, next);\n S1 = idealfactor(nf,listfact[i])[,1];\n for( j = 1, #S1, k = #Slist;\n for( k = 1, #Slist,\n if( Slist[k] == S1[j], test = 0; break));\n if( test, Slist = concat(Slist,[S1[j]]), test = 1);\n ));\nif( DEBUGLEVEL_ell >= 5, print(\" end of ideallistfactor\"));\n return(Slist);\n}\n{mynfhilbert(nf,a,b) =\n\\\\ calcule le symbole de Hilbert quadratique global (a,b):\n\\\\ =1 si l'equation X^2-aY^2-bZ^2=0 a une solution non triviale,\n\\\\ =-1 sinon,\n\\\\ a et b doivent etre non nuls.\nlocal(al,bl,S);\n\nif( DEBUGLEVEL_ell >= 4, print(\" starting mynfhilbert \",[a,b]));\n if( a == 0 || b == 0, error(\"mynfhilbert : argument = 0\"));\n al = lift(a); bl = lift(b);\n\n\\\\ solutions locales aux places reelles \n\n for( i = 1, nf.r1,\n if( nfrealsign(nf,al,i) < 0 && nfrealsign(nf,bl,i) < 0,\nif( DEBUGLEVEL_ell >= 3, print(\" mynfhilbert: no solution at infinity\"));\nif( DEBUGLEVEL_ell >= 4, print(\" end of mynfhilbert\"));\n return(-1))\n );\n\n if( type(a) != \"t_POLMOD\", a = Mod(a,nf.pol));\n if( type(b) != \"t_POLMOD\", b = Mod(b,nf.pol));\n\n\\\\ solutions locales aux places finies (celles qui divisent 2ab)\n\n S = ideallistfactor(nf,[2,a,b]);\n forstep ( i = #S, 2, -1,\n\\\\ d'apres la formule du produit on peut eviter un premier \n if( mynfhilbertp(nf,a,b, S[i]) == -1,\nif( DEBUGLEVEL_ell >= 3, print(\" mynfhilbert: no solution at: \",S[i]));\nif( DEBUGLEVEL_ell >= 4, print(\" end of mynfhilbert\"));\n return(-1)));\nif( DEBUGLEVEL_ell >= 4, print(\" end of mynfhilbert\"));\n return(1);\n}\n{initp( nf, p) =\n\\\\ pp[1] est l'ideal sous forme reduite \n\\\\ pp[2] est un entier de Zk avec une valuation 1 en p\n\\\\ pp[3] est la valuation de 2 en p\n\\\\ pp[4] sert a detecter les carres dans Qp \n\\\\ si p|2 il faut la structure de Zk/p^(1+2v) d'apres Hensel\n\\\\ sinon il suffit de calculer x^(N(p)-1)/2 \n\\\\ pp[5] est un systeme de representants de Zk/p \n\\\\ c'est donc un ensemble de cardinal p^f .\nlocal(idval,pp);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting initp for p = \",p));\n idval = idealval(nf,2,p);\n pp=[ p, nfbasistoalg(nf,p[2]), idval, 0, repres(nf,p) ];\n if( idval,\n pp[4] = idealstar(nf,idealpow(nf,p,1+2*idval)),\n pp[4] = p.p^p.f\\2 );\nif( DEBUGLEVEL_ell >= 5, print(\" end of initp\"));\n return(pp);\n}\n{deno(num) = \n\\\\ calcule un denominateur du polynome num\n\n if( num == 0, return(1));\n if( type(num) == \"t_POL\",\n return(denominator(content(num))));\n return(denominator(num));\n}\n{nfratpoint(nf,pol,lim,singlepoint=1) =\n\\\\ Si singlepoint == 1, cherche un seul point, sinon plusieurs.\nlocal(compt1,compt2,deg,n,AA,point,listpoints,vectx,evpol,sq,xpol);\n\nif( DEBUGLEVEL_ell >= 4,\n print(\" starting nfratpoint with pol = \",pol);\n print(\" lim = \",lim));\n\n compt1 = 0; compt2 = 0;\n deg = poldegree(pol); n = poldegree(nf.pol);\n AA = lim<<1;\n if( !singlepoint, listpoints = []);\n\n\\\\ cas triviaux \n sq = nfsqrt(nf,polcoeff(pol,0));\n if( sq!= [],\n point = [ 0, sq[1], 1];\n if( singlepoint,\nif( DEBUGLEVEL_ell >= 4, print(\" end of nfratpoint\"));\n return(point));\n listpoints = concat(listpoints,[point])\n );\n sq = nfsqrt(nf,pollead(pol));\n if( sq != [],\n point = [ 1, sq[1], 0];\n if( singlepoint,\nif( DEBUGLEVEL_ell >= 4, print(\" end of nfratpoint\"));\n return(point));\n listpoints = concat(listpoints,[point])\n );\n \n\\\\ boucle generale\n point = [];\n vectx = vector(n,i,[-lim,lim]);\n for( denoz = 1, lim,\n if( poldegree(pol)%2 == 0 &&\n !issquare(Mod(norm(pollead(pol)),denoz)), next);\n forvec( xx = vectx,\n if( denoz == 1 || gcd(content(xx),denoz) == 1,\n xpol = nfbasistoalg(nf,xx~);\n evpol = subst(pol,'x,xpol/denoz);\n sq = nfsqrt(nf,evpol);\n if( sq != [],\n point = [xpol/denoz, sq[1], 1];\n if( singlepoint, break(2));\n listpoints = concat(listpoints,[point])));\n ));\n\n if( singlepoint, listpoints = point);\nif( DEBUGLEVEL_ell >= 3, print(\" points found by nfratpoint = \",listpoints));\nif( DEBUGLEVEL_ell >= 4, print(\" end of nfratpoint\"));\n return(Vec(listpoints));\n}\n{repres(nf,p) =\n\\\\ calcule un systeme de representants Zk/p\nlocal(fond,mat,f,rep,pp,ppi,pp2,jppi,gjf);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting repres\"));\n fond = [];\n mat = idealhnf(nf,p);\n for( i = 1, #mat,\n if( mat[i,i] != 1, fond = concat(fond, nf.zk[i])));\n f = #fond;\n pp = p.p;\n rep = vector(pp^f,i,0);\n rep[1] = 0;\n ppi = 1;\n pp2 = pp\\2;\n for( i = 1, f,\n for( j = 1, pp-1,\n if( j <= pp2, gjf = j*fond[i], gjf = (j-pp)*fond[i]);\n jppi = j*ppi;\n for( k = 0, ppi-1, rep[jppi+k+1] = rep[k+1]+gjf ));\n ppi *= pp);\nif( DEBUGLEVEL_ell >= 5, print(\" end of repres\"));\n return(Mod(rep,nf.pol));\n}\n{val(nf,num,p) =\n if( num == 0, 32000, idealval(nf,lift(num),p));\n}\n{nfissquaremodpodd( nf, a, p) =\n\\\\ Return 1 if a is a p-adic square, 0 otherwise.\n\\\\ Only for a prime ideal p coprime to 2.\n\\\\ a = t_POLMOD\nlocal(v,ap,norme,den);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting nfissquaremodpodd\"));\n if( a == 0,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpodd\"));\n return(1));\n v = idealval(nf,lift(a),p);\n if( v%2,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpodd\"));\n return(0));\n ap = a/nfbasistoalg(nf,p[2])^v;\n\n norme = (p.p^p.f-1)/2;\n den = denominator(content(lift(ap)))%p.p;\n if( sign(den), ap *= Mod(1,p.p));\n ap = ap^norme-1;\n if( ap == 0,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpodd\"));\n return(1));\n ap = lift(lift(ap));\n if( idealval(nf,ap,p) > 0,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpodd\"));\n return(1));\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpodd\"));\n return(0);\n}\n{nfissquaremodp( nf, a, p, zinit) =\n\\\\ a is an algebraic integer of nf\n\\\\ returns 1 if a is a square modulo the prime ideal p, 0 otherwise\n\\\\ a = t_POLMOD\nlocal(valap,zlog);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting nfissquaremodp \",[a,p,zinit]));\n if( a == 0,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodp\"));\n return(1));\n\n if( p.p != 2,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodp\"));\n return(nfissquaremodpodd(nf,a,p)));\n\n valap = idealval(nf,a,p);\n if( valap%2,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodp\"));\n return(0));\n if( valap,\n zlog = ideallog(nf,a*(nf_scalar_or_multable_to_alg(nf,p[5])/p.p)^valap,zinit)\n ,\n zlog = ideallog(nf,a,zinit));\n for( i = 1, #zinit[2][2],\n if( !(zinit[2][2][i]%2) && (zlog[i]%2),\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodp\"));\n return(0)));\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodp\"));\n return(1);\n}\n{nfissquaremodpq( nf, a, p, q) =\n\\\\ cette fonction renvoie 1 si a est un carre\n\\\\ ?inversible? modulo P^q et 0 sinon.\n\\\\ P divise 2, et ?(a,p)=1?.\nlocal(vala,zinit,zlog);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting nfissquaremodpq \",[a,p,q]));\n if( a == 0,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpq\"));\n return(1));\n vala = idealval(nf,a,p);\n if( vala >= q,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpq\"));\n return(1));\n if( vala%2,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpq\"));\n return(0));\n zinit = idealstar(nf,idealpow(nf,p,q-vala),2);\n zlog = ideallog(nf,a*nf_scalar_or_multable_to_alg(nf,p[5]/2)^vala,zinit);\n for( i = 1, #zinit[2][2],\n if( !(zinit[2][2][i]%2) && (zlog[i]%2),\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpq\"));\n return(0)));\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfissquaremodpq\"));\n return(1);\n}\n{nfsqrtmodpq(nf,a,p,q) =\n\\\\ suppose que a est un carre modulo p^q\n\\\\ et renvoie x tel que x^2 = a mod p^q.\nlocal(p_hnf,f,aaa,qq,e,xx,yy,r,aux,b,m,vp,inv2x,zinit,zlog,expo,p_ini,non_sq,id);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting nfsqrtmodpq \",a,p,q));\n if( a == 0 || a == 1,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrtmodpq\"));\n return(a));\n f = idealval(nf,a,p);\n if( f >= q,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrtmodpq\"));\n return(0));\nif( f%2, error(\"nfsqrtmodpq: a is not a square, odd valuation\"));\n a = nfalgtobasis(nf,a);\n if( f, aaa = nfeltpow(nf,nfeltdiv(nf,a,nf_scalar_or_multable_to_alg(nf,p[5]/p.p)),f), aaa = a);\n p_hnf = idealhnf(nf,p);\n p_ini = nfmodprinit(nf,p);\nif( DEBUGLEVEL_ell >= 5, print(\" p_hnf = \",p_hnf));\nif( DEBUGLEVEL_ell >= 5, print(\" p_ini = \",p_ini));\n\n if( p.p != 2,\n\\\\ first case : p is odd\n\n\\\\ Shanks sqrt algorithm\nif( DEBUGLEVEL_ell >= 5, print(\" Shanks sqrt algorithm\"));\n non_sq = nfrandintmodid(nf,p_hnf);\n while( nfissquaremodpodd(nf,non_sq,p), non_sq = nfrandintmodid(nf,p_hnf));\n non_sq = nfalgtobasis(nf,non_sq);\n qq = ( p.p^p.f -1) \\ 2;\n e = 1; while( !(qq%2), e++; qq \\= 2);\n non_sq = nfeltpowmodpr(nf,non_sq,qq,p_ini);\n yy = non_sq; r = e;\n xx = nfeltpowmodpr(nf,aaa,qq\\2,p_ini);\n aux = nfeltmulmodpr(nf,aaa,xx,p_ini);\n b = nfeltmulmodpr(nf,aux,xx,p_ini); \n xx = aux;\n aux = b; m = 0;\n while( !val(nf,nfbasistoalg(nf,aux)-1,p),\n m++;\n aux = nfeltpowmodpr(nf,aux,2,p_ini)\n );\n while( m,\n if( m == r, error(\"nfsqrtmodpq: m = r\"));\n aux = nfeltpowmodpr(nf,yy,1<<(r-m-1),p_ini);\n yy = nfeltpowmodpr(nf,aux,2,p_ini);\n r = m;\n xx = nfeltmulmodpr(nf,xx,aux,p_ini);\n b = nfeltmulmodpr(nf,b,yy,p_ini);\n aux = b;m = 0;\n while( !val(nf,nfbasistoalg(nf,aux)-1,p),\n m++;\n aux = nfeltpowmodpr(nf,aux,2,p_ini)\n )\n );\n\n\\\\ lift de Hensel\n\\\\\n\n xx = nfbasistoalg(nf,xx);\n aaa= nfbasistoalg(nf,aaa);\n if( q > 1,\nif( DEBUGLEVEL_ell >= 5, print(\" Hensel lifting\"));\n vp = idealval(nf,xx^2-aaa,p);\n if( vp < q-f,\n yy = 2*xx;\n inv2x = nfbasistoalg(nf,idealaddtoone(nf,yy,p)[1])/yy;\n while( vp < q, vp++; xx -= (xx^2-aaa)*inv2x);\n );\n if( f, xx *= nfbasistoalg(nf,p[2])^(f\\2));\n );\n xx = mynfeltreduce(nf,xx,idealpow(nf,p,q))\n ,\n\\\\ cas ou p divise 2 */\n if( q-f > 1, id = idealpow(nf,p,q-f), id = p_hnf);\n zinit = idealstar(nf,id,2);\n zlog = ideallog(nf,aaa,zinit);\n xx = 1;\n for( i = 1, #zlog,\n expo = zlog[i];\n if( expo,\n if( !expo%2,\n expo = expo>>1\n , aux = zinit[2][i];\n expo = expo*((aux+1)>>1)%aux\n );\n xx *= nfbasistoalg(nf,zinit[2][3][i])^expo\n )\n );\n if( f,\n xx *= nfbasistoalg(nf,p[2])^(f>>1);\n id = idealpow(nf,p,q));\n xx = mynfeltreduce(nf,xx,id);\n );\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfsqrtmodpq \",xx));\n return(xx);\n}\n{nflemma6( nf, pol, p, nu, xx) =\nlocal(gx,gpx,lambda,mu);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting nflemma6\"));\n gx = subst( pol, 'x, xx);\n if( nfissquaremodpodd(nf,gx,p),\nif( DEBUGLEVEL_ell >= 5, print(\" end of nflemma6\"));\n return(1));\n gpx = subst( pol', 'x, xx);\n lambda = val(nf,gx,p);mu = val(nf,gpx,p);\n\n if( lambda>2*mu,\nif( DEBUGLEVEL_ell >= 5, print(\" end of nflemma6\"));\n return(1));\n if( (lambda >= 2*nu) && (mu >= nu),\nif( DEBUGLEVEL_ell >= 5, print(\" end of nflemma6\"));\n return(0));\nif( DEBUGLEVEL_ell >= 5, print(\" end of nflemma6\"));\n return(-1);\n}\n{nflemma7( nf, pol, p, nu, xx, zinit) =\nlocal(gx,gpx,v,lambda,mu,q);\n\nif( DEBUGLEVEL_ell >= 5, print(\"entree dans nflemma7 \",[xx,nu]));\n gx = subst( pol, 'x, xx);\n if( nfissquaremodp(nf,gx,p,zinit),\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(1));\n gpx = subst( pol', 'x, xx);\n v = p[3];\n lambda = val(nf,gx,p);mu = val(nf,gpx,p);\n if( lambda>2*mu,\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(1));\n if( nu > mu,\n if( lambda%2,\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(-1));\n q = mu+nu-lambda;\n if( q > 2*v,\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(-1));\n if( nfissquaremodpq(nf,gx*nf_scalar_or_multable_to_alg(nf,p[5]/2)^lambda,p,q),\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(1))\n ,\n if( lambda >= 2*nu,\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(0));\n if( lambda%2,\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(-1));\n q = 2*nu-lambda;\n if( q > 2*v,\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(-1));\n if( nfissquaremodpq(nf,gx*nf_scalar_or_multable_to_alg(nf,p[5]/2)^lambda,p,q),\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(0))\n );\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nflemma7\"));\n return(-1);\n}\n{nfzp_soluble( nf, pol, p, nu, pnu, x0) =\nlocal(result,pnup,lrep);\n\nif( DEBUGLEVEL_ell >= 5, print(\"entree dans nfzp_soluble \",[lift(x0),nu]));\n if( p[3] == 0,\n result = nflemma6(nf,pol,p[1],nu,x0),\n result = nflemma7(nf,pol,p[1],nu,x0,p[4]));\n if( result == +1,\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nfzp_soluble\"));\n return(1));\n if( result == -1,\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nfzp_soluble\"));\n return(0));\n pnup = pnu*p[2];\n lrep = #p[5];\n nu++;\n for( i = 1, lrep,\n if( nfzp_soluble(nf,pol,p,nu,pnup,x0+pnu*p[5][i]),\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nfzp_soluble\"));\n return(1)));\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nfzp_soluble\"));\n return(0);\n}\n{mynfeltmod(nf,a,b) =\nlocal(qred);\n\n qred = round(nfalgtobasis(nf,a/b));\n qred = a-b*nfbasistoalg(nf,qred);\n return(qred);\n}\n{mynfeltreduce(nf,a,id) =\n nfbasistoalg(nf,nfeltreduce(nf,nfalgtobasis(nf,a),id));\n}\n{nfrandintmodid( nf, id) =\nlocal(res);\n\nif( DEBUGLEVEL_ell >= 5, print(\"entree dans nfrandintmodid\"));\n res = 0;\n while( !res,\n res = nfrandint(nf,0);\n res = mynfeltreduce(nf,res,id));\nif( DEBUGLEVEL_ell >= 5, print(\"fin de nfrandintmodid\"));\n return(res);\n}\n{nfrandint( nf, borne) =\nlocal(d,res);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting nfrandint\"));\n d = poldegree(nf.pol);\n res = vectorv(d,i,if( borne, random(borne<<1)-borne, random()));\n res = nfbasistoalg(nf,res);\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfrandint\"));\n return(res);\n}\n{nfqp_solublebig( nf, pol, p,ap=0,b=1) =\nlocal(deg,xx,z,Px,cont,pi,pol2,Roots);\n\nif( DEBUGLEVEL_ell >= 4, print(\" starting nfqp_solublebig avec \",p.p));\n deg = poldegree(pol);\n\n if( nfissquaremodpodd(nf,polcoeff(pol,0),p),\nif( DEBUGLEVEL_ell >= 4, print(\" end of nfqp_solublebig\"));\n return(1));\n if( nfissquaremodpodd(nf,pollead(pol),p),\nif( DEBUGLEVEL_ell >= 4, print(\" end of nfqp_solublebig\"));\n return(1));\n\n\\\\ on tient compte du contenu de pol\n cont = idealval(nf,polcoeff(pol,0),p);\n for( i = 1, deg,\n if( cont, cont = min(cont,idealval(nf,polcoeff(pol,i),p))));\n if( cont, pi = nf_scalar_or_multable_to_alg(nf,p[5]/p.p));\n if( cont > 1, pol *= pi^(2*(cont\\2)));\n\n\\\\ On essaye des valeurs de x au hasard\n if( cont%2,\n pol2 = pol*pi\n , pol2 = pol;\n for( i = 1, MAXPROB,\n xx = nfrandint(nf,0);\n z = 0; while( !z, z = random());\n xx = -ap*z+b*xx;\n Px=polcoeff(pol,deg);\n forstep (j=deg-1,0,-1,Px=Px*xx+polcoeff(pol,j));\n Px *= z^deg;\n if( nfissquaremodpodd(nf,Px,p),\nif( DEBUGLEVEL_ell >= 4, print(\" end of nfqp_solublebig\"));\n return(1));\n )\n );\n\n\\\\ On essaye les racines de pol\n Roots = nfpolrootsmod(nf,pol2,p);\n pi = nfbasistoalg(nf,p[2]);\n for( i = 1, #Roots,\n if( nfqp_solublebig(nf,subst(pol,'x,pi*'x+Roots[i]),p),\nif( DEBUGLEVEL_ell >= 4, print(\"fin de nfqp_solublebig\"));\n return(1)));\n\nif( DEBUGLEVEL_ell >= 4, print(\" end of nfqp_solublebig\"));\n return(0);\n}\n{nfpolrootsmod(nf,pol,p) =\n\\\\ calcule les racines modulo l'ideal p du polynome pol.\n\\\\ p est un ideal premier de nf, sous la forme idealprimedec\nlocal(factlist,sol);\n\n factlist = nffactormod(nf,pol,p)[,1];\n sol = [];\n for( i = 1, #factlist,\n if( poldegree(factlist[i]) == 1,\n sol = concat(sol, [-polcoeff(factlist[i],0)/polcoeff(factlist[i],1)])));\n return(sol);\n}\n{nfqp_soluble( nf, pol, p) =\n\\\\ p is a prime output by initp()\n\\\\ return 1 if pol(x) = y^2 has a p-adic rational solution\n\\\\ (possibly oo)\n\\\\ coeff of nfqfsoluble must be integers.\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting nfqp_soluble \",p));\nif( DEBUGLEVEL_ell >= 5, print(\" pol = \",pol));\n if( nfissquaremodp(nf,pollead(pol),p[1],p[4]),\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfqp_soluble\"));\n return(1));\n if( nfissquaremodp(nf,polcoeff(pol,0),p[1],p[4]),\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfqp_soluble\"));\n return(1));\n if( nfzp_soluble(nf,pol,p,0,1,0),\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfqp_soluble\"));\n return(1));\n if( nfzp_soluble(nf,polrecip(pol),p,1, p[2],0),\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfqp_soluble\"));\n return(1));\nif( DEBUGLEVEL_ell >= 5, print(\" end of nfqp_soluble\"));\n return(0);\n}\n{nflocallysoluble( nf, pol, r=0,a=1,b=1) =\n\\\\ Test whether Y^2 = pol is Everywhere Locally Soluble\nlocal(pol0,plist,add,ff,p,Delta,c,s,t);\n\nif( DEBUGLEVEL_ell >= 4, print(\" starting nflocallysoluble \",[pol,r,a,b]));\n pol0 = pol;\n\n\\\\ places finies\n\n pol *= deno(content(lift(pol)))^2;\n for( ii = 1, 3,\n if( ii == 1, plist = idealprimedec(nf,2));\n if( ii == 2 && r, plist = idealfactor(nf,poldisc(pol0/pollead(pol0))/pollead(pol0)^6/2^12)[,1]);\n if( ii == 2 && !r, plist = idealfactor(nf,poldisc(pol0))[,1]);\n if( ii == 3,\n add = idealadd(nf,a,b);\n ff = factor(idealnorm(nf,add))[,1];\n addprimes(ff);\nif( DEBUGLEVEL_ell >= 4, print(\" list of primes = \",ff));\n plist = idealfactor(nf,add)[,1]);\n for( i = 1, #plist,\n p = plist[i]; \nif( DEBUGLEVEL_ell >= 3, print(\" p = \",p));\n if( p.p < LIMBIGPRIME || !LIMBIGPRIME,\n if( !nfqp_soluble(nf,pol,initp(nf,p)),\nif( DEBUGLEVEL_ell >= 2, print(\" not ELS at \",p));\nif( DEBUGLEVEL_ell >= 4, print(\" end of nflocallysoluble\"));\n return(0)),\n if( !nfqp_solublebig(nf,pol,p,r/a,b),\nif( DEBUGLEVEL_ell >= 2, print(\" not ELS at \",p.p,\" ( = big prime )\"));\nif( DEBUGLEVEL_ell >= 4, print(\" end of nflocallysoluble\"));\n return(0))));\n );\n\n\\\\ places reelles \n\n/*\n Peter Bruin, August 2014: code adapted to fix precision problems.\n\n We want to count the number of real roots of a polynomial of the\n form x^4 + s*x^2 + a*x + b. The action of complex conjugation on\n the complex roots determines the sign of the discriminant Delta:\n\n cycle type () or (1 2)(3 4), i.e. 4 or 0 real roots: Delta > 0\n cycle type (1 2), i.e. exactly 2 real roots: Delta < 0\n\n We may assume Delta > 0 and have to decide whether there are 0 or 4\n real roots. We apply Sturm's theorem to the following sequence\n (with t = 2*s^3 - 8*b*s + 9*a^2):\n\n p0 = x^4 + s*x^2 + a*x + b\n p1 = 4*x^3 + 2*s*x + a\n p2 = x*p1 - 4*p0\n = -2*s*x^2 - 3*a*x - 4*b\n p3 = (3*a - 2*s*x)*p2 - s^2*p1\n = -t*x - a*(s^2 + 12*b)\n p4 = Delta\n\n Note that the case of 4 real roots can only occur if both s and t\n are nonzero, otherwise the Sturm sequence is shorter than this one.\n By Sturm's theorem, the number of roots equals\n\n (sign changes in [1, -4, -2*s, t, Delta]) -\n (sign changes in [1, 4, -2*s, -t, Delta]).\n\n Hence the only way to have 4 real roots is if s < 0 and t < 0.\n*/\n if( nf.r1,\n c = pollead(pol);\n pol /= c;\n pol = subst(pol, 'x, 'x - polcoeff(pol, 3)/4);\n s = polcoeff(pol, 2);\n t = 2*s^3 - 8*s*polcoeff(pol, 0) + 9*polcoeff(pol, 1)^2;\n Delta = poldisc(pol);\n for( i = 1, nf.r1,\n if( nfrealsign(nf,c,i) > 0, next);\n if( nfrealsign(nf,Delta,i) < 0, next);\n if( nfrealsign(nf,s,i) < 0 && nfrealsign(nf,t,i) < 0, next);\nif( DEBUGLEVEL_ell >= 2, print(\" not ELS at infinity\"));\nif( DEBUGLEVEL_ell >= 4, print(\" end of nflocallysoluble\"));\n return(0);\n ));\nif( DEBUGLEVEL_ell >= 2, print(\" quartic ELS \"));\nif( DEBUGLEVEL_ell >= 4, print(\" end of nflocallysoluble\"));\n return(1);\n}\n{nfellcount( nf, c, d, KS2gen, pointstriv) =\nlocal(found,listgen,listpointscount,m1,m2,lastloc,mask,i,d1,iaux,j,triv,pol,point,deuxpoints,aux,v);\n\nif( DEBUGLEVEL_ell >= 4, print(\" starting nfellcount \",[c,d]));\n found = 0;\n listgen = KS2gen;\n listpointscount = [];\n\n m1 = m2 = 0; lastloc = -1;\n\n mask = 1 << #KS2gen;\n i = 1;\n while( i < mask,\n d1 = 1; iaux = i; j = 1;\n while( iaux, \n if( iaux%2, d1 *= listgen[j]);\n iaux >>= 1; j++);\nif( DEBUGLEVEL_ell >= 2, print(\" d1 = \",d1));\n triv = 0;\n for( j = 1, #pointstriv,\n if( pointstriv[j][3]*pointstriv[j][1]\n && nfissquare(nf,d1*pointstriv[j][1]*pointstriv[j][3]),\n listpointscount = concat(listpointscount,[pointstriv[j]]);\nif( DEBUGLEVEL_ell >= 2, print(\" comes from a trivial point\"));\n triv = 1; m1++;\n if( degre(i) > lastloc, m2++);\n found = 1; lastloc = -1; break\n ));\n if( !triv,\n pol = Pol([d1,0,c,0,d/d1]);\nif( DEBUGLEVEL_ell >= 3, print(\" quartic: y^2 = \",pol));\n point = nfratpoint(nf,pol,LIM1,1);\n if( point != [],\nif( DEBUGLEVEL_ell >= 2, print(\" point on the quartic\"));\nif( DEBUGLEVEL_ell >= 3, print(\" \",point));\n m1++;\n if( point[3] != 0,\n aux = d1*point[1]/point[3]^2;\n deuxpoints = [ aux*point[1], aux*point[2]/point[3] ]\n ,\n deuxpoints = [0]);\n listpointscount = concat(listpointscount,[deuxpoints]);\n if( degre(i) > lastloc, m2++);\n found = 1; lastloc = -1\n ,\n if( nflocallysoluble(nf,pol),\n if( degre(i) > lastloc, m2++; lastloc = degre(i));\n point = nfratpoint(nf,pol,LIM3,1);\n if( point != [],\nif( DEBUGLEVEL_ell >= 2, print(\" point on the quartic\"));\nif( DEBUGLEVEL_ell >= 3, print(\" \",point));\n m1++;\n aux = d1*point[1]/point[3]^2;\n deuxpoints = [ aux*point[1], aux*point[2]/point[3] ];\n listpointscount = concat(listpointscount,[deuxpoints]);\n if( degre(i) > lastloc, m2++);\n found = 1; lastloc = -1\n ,\nif( DEBUGLEVEL_ell >= 2, print(\" no point found on the quartic\"));\n ))));\n if( found,\n found = 0;\n v = 0; iaux = (i>>1);\n while( iaux, iaux >>= 1; v++);\n mask >>= 1;\n listgen = vecextract(listgen,(1<<#listgen)-(1< 1,\n if( subst('x^3+c*'x^2+d*'x,'x,listpointscount[i][1])-listpointscount[i][2]^2 != 0,\n error(\"nfellcount: WRONG POINT = \",listpointscount[i]))));\nif( DEBUGLEVEL_ell >= 4, print(\" end of nfellcount\"));\n return([listpointscount,[m1,m2]]);\n}\n{bnfell2descent_viaisog( bnf, ell) =\n\\\\ Calcul du rang des courbes elliptiques avec 2-torsion\n\\\\ dans le corps de nombres bnf\n\\\\ par la methode des 2-isogenies.\n\\\\\n\\\\ ell = [a1,a2,a3,a4,a6]\n\\\\ y^2+a1xy+a3y=x^3+a2x^2+a4x+a6\n\\\\\n\\\\ ell doit etre sous la forme\n\\\\ y^2=x^3+ax^2+bx -> ell = [0,a,0,b,0]\n\\\\ avec a et b entiers.\nlocal(P,Pfact,tors,pointstriv,apinit,bpinit,plist,KS2prod,oddclass,KS2gen,listpoints,pointgen,n1,n2,certain,np1,np2,listpoints2,aux1,aux2,certainp,rang,strange);\n\nif( DEBUGLEVEL_ell >= 2, print(\" Algorithm of 2-descent via isogenies\"));\nif( DEBUGLEVEL_ell >= 3, print(\" starting bnfell2descent_viaisog\"));\n if( variable(bnf.pol) != 'y,\n error(\"bnfell2descent_viaisog: the variable of the number field must be y\"));\n ell = ellinit(Mod(lift(ell),bnf.pol));\n\n if( ell.disc == 0,\n error(\"bnfell2descent_viaisog: singular curve !!\"));\n if( ell.a1 != 0 || ell.a3 != 0 || ell.a6 != 0,\n error(\"bnfell2descent_viaisog: curve not of the form [0,a,0,b,0]\"));\n if( denominator(nfalgtobasis(bnf,ell.a2)) > 1 || denominator(nfalgtobasis(bnf,ell.a4)) > 1,\n error(\"bnfell2descent_viaisog: non integral coefficients\"));\n\n P = Pol([1,ell.a2,ell.a4])*Mod(1,bnf.pol);\n Pfact = factornf(P,bnf.pol)[,1];\n tors = #Pfact;\n if( #Pfact > 1,\n pointstriv = [[0,0,1],[-polcoeff(Pfact[1],0),0,1],[-polcoeff(Pfact[2],0),0,1]]\n , pointstriv = [[0,0,1]]);\n\n apinit = -2*ell.a2; bpinit = ell.a2^2-4*ell.a4;\n\n\\\\ calcul des ideaux premiers de plist\n\\\\ et de quelques renseignements associes\n plist = idealfactor(bnf,6*ell.disc)[,1];\n\nif( DEBUGLEVEL_ell >= 3, print(\" Search for trivial points on the curve\"));\n P *= 'x;\nif( DEBUGLEVEL_ell >= 3, print(\" Y^2 = \",P));\n pointstriv = concat( pointstriv, nfratpoint(bnf.nf,P,LIMTRIV,0));\nif( DEBUGLEVEL_ell >= 1, print(\" trivial points on E(K) = \");\n print(lift(pointstriv)); print());\n\n KS2prod = ell.a4;\n oddclass = 0;\n while( !oddclass,\n KS2gen = bnfsunit(bnf,idealfactor(bnf,KS2prod)[,1]~);\n oddclass = KS2gen[5][1]%2;\n if( !oddclass,\n KS2prod = idealmul(bnf,KS2prod,(KS2gen[5][3][1])));\n );\n KS2gen = KS2gen[1];\n for( i = 1, #KS2gen,\n KS2gen[i] = nfbasistoalg(bnf, KS2gen[i]));\n KS2gen = concat(Mod(lift(concat(bnf.tu[2], bnf.fu)),bnf.pol),KS2gen);\nif( DEBUGLEVEL_ell >= 2,\n print(\" #K(b,2)gen = \",#KS2gen);\n print(\" K(b,2)gen = \",KS2gen));\n\n listpoints = nfellcount(bnf.nf,ell.a2,ell.a4,KS2gen,pointstriv);\n pointgen = listpoints[1];\nif( DEBUGLEVEL_ell >= 1,\n print(\" points on E(K) = \",lift(pointgen));\n print());\n n1 = listpoints[2][1]; n2 = listpoints[2][2];\n\n certain = (n1 == n2);\nif( DEBUGLEVEL_ell >= 1,\n if( certain,\n print(\"[E(K):phi'(E'(K))] = \",1<= \",1<= 2,\n print(\" #K(a^2-4b,2)gen = \",#KS2gen);\n print(\" K(a^2-4b,2)gen = \",KS2gen));\n\n P = Pol([1,apinit,bpinit])*Mod(1,bnf.pol);\n Pfact= factornf(P,bnf.pol)[,1];\n if( #Pfact > 1,\n pointstriv=[[0,0,1],[-polcoeff(Pfact[1],0),0,1],[-polcoeff(Pfact[2],0),0,1]]\n , pointstriv = [[0,0,1]]);\n\nif( DEBUGLEVEL_ell >= 3, print(\" Search for trivial points on the curve\"));\n P *= 'x;\nif( DEBUGLEVEL_ell >= 3, print(\" Y^2 = \",P));\n pointstriv = concat( pointstriv, nfratpoint(bnf.nf,P,LIMTRIV,0));\nif( DEBUGLEVEL_ell >= 1, print(\" trivial points on E'(K) = \");\n print(lift(pointstriv)); print());\n\n listpoints = nfellcount(bnf.nf,apinit,bpinit,KS2gen,pointstriv);\nif( DEBUGLEVEL_ell >= 1, print(\" points on E'(K) = \",lift(listpoints[1])));\n np1 = listpoints[2][1]; np2 = listpoints[2][2];\n listpoints2 = vector(#listpoints[1],i,0);\n for( i = 1, #listpoints[1],\n listpoints2[i] = [0,0];\n aux1 = listpoints[1][i][1]^2;\n if( aux1 != 0,\n aux2 = listpoints[1][i][2];\n listpoints2[i][1] = aux2^2/aux1/4;\n listpoints2[i][2] = aux2*(bpinit-aux1)/aux1/8\n , listpoints2[i] = listpoints[1][i]));\nif( DEBUGLEVEL_ell >= 1, print(\" points on E(K) = \",lift(listpoints2)); print());\n pointgen = concat(pointgen,listpoints2);\n\n certainp = (np1 == np2);\nif( DEBUGLEVEL_ell >= 1,\n if( certainp,\n print(\"[E'(K):phi(E(K))] = \",1<= \",1<np1), print1(1<<(np2-np1),\" <= \"));\n print1(\"#III(E/K)[2] \");\n if( certain && certainp, print1(\" \"), print1(\"<\"));\n print(\"= \",1<<(n2+np2-n1-np1));\n\n print(\"#E(K)[2] = \",1<= 1,\n if( certain && certainp,\n print(\"#E(K)/2E(K) = \",(1<<(rang+tors)));\n print(\"rank = \",rang); print()\n ,\n print(\"#E(K)/2E(K) >= \",(1<<(rang+tors))); print();\n print(rang,\" <= rank <= \",n2+np2-2); print()\n ));\n\n strange = (n2+np2-n1-np1)%2;\n if( strange,\nif( DEBUGLEVEL_ell >= 1,\n print(\" !!! III should be a square !!!\"); print(\"hence\"));\n if( certain,\n np1++;\n certainp = (np1 == np2);\nif( DEBUGLEVEL_ell >= 1,\n if( certainp,\n print(\"[E'(K):phi(E(K))] = \",1<= \",1<= 1,\n if( certain,\n print(\"[E(K):phi'(E'(K))] = \",1<= \",1<= 1,\n if( !certain && (np2>np1), print1(1<<(np2-np1),\" <= \"));\n print1(\"#III(E/K)[2] \");\n if( certain && certainp, print1(\" \"), print1(\"<\"));\n print(\"= \",1<<(n2+np2-n1-np1));\n print(\"#E(K)[2] = \",1<= 1,\n if( certain && certainp,\n print(\"#E(K)/2E(K) = \",(1<<(rang+tors))); print();\n print(\"rank = \",rang); print()\n ,\n print(\"#E(K)/2E(K) >= \",(1<<(rang+tors))); print();\n print(rang,\" <= rank <= \",n2+np2-2); print())\n ));\n\n\\\\ end of strange\n\nif( DEBUGLEVEL_ell >= 1, print(\" points = \",pointgen));\nif( DEBUGLEVEL_ell >= 3, print(\" end of bnfell2descent_viaisog\"));\n return([rang,n2+np2-2+tors,pointgen]);\n}\n{nfchinese( nf, b, fact) =\n\\\\ Chinese Remainder Theorem\nlocal(l,fact2);\n\nif( DEBUGLEVEL_ell >= 4, print(\" starting nfchinese\"));\n l = #fact[,1];\n fact2 = vector(l,i,idealdiv(nf,b,idealpow(nf,fact[i,1],fact[i,2])));\n fact2 = idealaddtoone(nf,fact2);\n for( i = 1, l,\n fact2[i] = nfbasistoalg(nf,fact2[i]));\nif( DEBUGLEVEL_ell >= 4, print(\" end of nfchinese\"));\n return(fact2);\n}\n{bnfqfsolve2(bnf, aleg, bleg, aut=['y]) =\n\\\\ Solves Legendre Equation x^2-aleg*Y^2=bleg*Z^2\n\\\\ Using quadratic norm equations\n\\\\ aut contains the Galois automorphisms of bnf ( as polynomials in y)\n\\\\ with aut[1] = y.\nlocal(aux,solvepolrel,auxsolve,solvepolabs,exprxy,rrrnf,bbbnf,SL0,SL1,SL,sunL,fondsunL,normfondsunL,SK,sunK,fondsunK,vecbleg,matnorm,matnormmod,expsolution,solution,reste,carre,verif,x0,x1);\n\nif( DEBUGLEVEL_ell >= 3, print(\" starting bnfqfsolve2\"));\n solvepolrel = 'x^2-aleg;\nif( DEBUGLEVEL_ell >= 4, print(\" aleg = \",aleg));\nif( DEBUGLEVEL_ell >= 4, print(\" bleg = \",bleg));\n\n if( nfissquare(bnf,aleg),\nif( DEBUGLEVEL_ell >= 4, print(\" aleg is a square !!\"));\n aleg = nfsqrt(bnf,aleg)[1];\n return([aleg,1,0]~)\n );\n\n if( #aut > 1,\nif( DEBUGLEVEL_ell >= 4, print(\" factorization of the discriminant using the automorphisms of bnf\"));\n for( i = 2, #aut,\n aux = abs(polresultant(lift(aleg)-subst(lift(aleg),'y,aut[i]),bnf.pol));\n if( aux, addprimes(factor(aux)[,1]))));\n\n auxsolve = rnfequation(bnf,solvepolrel,1);\n solvepolabs = auxsolve[1];\n exprxy = auxsolve[2];\n if( auxsolve[3],\nif( DEBUGLEVEL_ell >= 5, print(\" case with auxsolve[3] != 0\")));\nif( DEBUGLEVEL_ell >= 4, print(\" bbbnfinit \",solvepolabs));\n rrrnf = rnfinit(bnf,solvepolrel);\n bbbnf = bnfinit(solvepolabs,1);\nif( DEBUGLEVEL_ell >= 4, print(\" done\"));\n SL0 = 1;\nif( DEBUGLEVEL_ell >= 4, print(\" bbbnf.clgp = \",bbbnf.clgp));\n for( i = 1, #bbbnf.clgp[2],\n if( bbbnf.clgp[2][i]%2 == 0,\n SL0 = idealmul(bbbnf,SL0,bbbnf.clgp[3][i][1,1])));\n SL1 = idealmul(bbbnf,SL0,rnfeltup(rrrnf,bleg));\n SL = idealfactor(bbbnf,SL1)[,1]~;\n sunL = bnfsunit(bbbnf,SL);\n fondsunL = concat(concat(bbbnf.fu, bbbnf.tu[2]),vector(#sunL[1],i,nfbasistoalg(bbbnf,sunL[1][i])));\n normfondsunL = vector(#fondsunL, i, norm(rnfeltabstorel(rrrnf,fondsunL[i])));\n SK = idealfactor(bnf,idealnorm(bbbnf,SL1))[,1]~;\n sunK = bnfsunit(bnf,SK);\n fondsunK = concat(concat(bnf.fu, bnf.tu[2]),vector(#sunK[1],i,nfbasistoalg(bnf,sunK[1][i])));\n vecbleg = bnfissunit(bnf,sunK,bleg);\n matnorm = matrix(#fondsunK,#normfondsunL,i,j,0);\n for( i = 1, #normfondsunL,\n matnorm[,i] = lift(bnfissunit( bnf,sunK,normfondsunL[i] )));\n matnormmod = matnorm*Mod(1,2);\n expsolution = lift(matinverseimage( matnormmod, vecbleg*Mod(1,2)));\n if( !length(expsolution), error(\"bnfqfsolve2 : NO SOLUTION !! \"));\n solution = prod( i = 1, #expsolution, fondsunL[i]^expsolution[i]);\n solution = rnfeltabstorel(rrrnf,solution);\n reste = (lift(vecbleg) - matnorm*expsolution)/2;\n carre = prod( i = 1, #vecbleg, fondsunK[i]^reste[i]);\n solution *= carre;\n x1 = polcoeff(lift(solution),1,'x);\n x0 = polcoeff(lift(solution),0,'x);\n verif = x0^2 - aleg*x1^2-bleg;\nif( verif, error(\"bnfqfsolve2: WRONG POINT\"));\nif( DEBUGLEVEL_ell >= 3, print(\" end of bnfqfsolve2\"));\n return([x0,x1,1]~);\n}\n{bnfqfsolve(bnf, aleg, bleg, flag3, aut=['y]) =\n\\\\ cette fonction resout l'equation X^2-aleg*Y^2=bleg*Z^2\n\\\\ dans le corps de nombres nf.\n\\\\ la solution est [X,Y,Z],\n\\\\ [0,0,0] sinon.\nlocal(nf,aa,bb,na,nb,maxnb,mat,resl,t,sq,pol,vecrat,alpha,xx,yy,borne,test,sun,fact,suni,f,l,aux,alpha2,maxnbiter,idbb,rem,nbiter,mask,oldnb,newnb,bor,testici,de,xxp,yyp,rap,verif);\n\nif( DEBUGLEVEL_ell >= 5, print(\" starting bnfqfsolve\"));\nif( DEBUGLEVEL_ell >= 3, print(\" (a,b) = (\",aleg,\",\",bleg,\")\"));\n nf = bnf.nf;\n aleg = Mod(lift(aleg),nf.pol); aa = aleg;\n bleg = Mod(lift(bleg),nf.pol); bb = bleg;\n\n if( aa == 0, \nif( DEBUGLEVEL_ell >= 5, print(\" end of bnfqfsolve\"));\n return([0,1,0]~));\n if( bb == 0,\nif( DEBUGLEVEL_ell >= 5, print(\" end of bnfqfsolve\"));\n return([0,0,1]~));\n\n na = abs(norm(aa)); nb = abs(norm(bb));\n if( na > nb, maxnb = na, maxnb = nb);\n maxnb <<= 20;\n mat = Mod(matid(3),nf.pol); borne = 1;\n test = 0; nbiter = 0;\n\n while( 1,\n if( flag3 && bnf.clgp[1]>1, resl = bnfqfsolve2(bnf,aa,bb,aut); break);\nif( DEBUGLEVEL_ell >= 4, print(\" (na,nb,a,b) = \",lift([na,nb,aa,bb,norm(aa),norm(bb)])));\nif( DEBUGLEVEL_ell >= 5, print(\" ***\",nb,\"*** \"));\n if( nb >= maxnb, \n mat = Mod(matid(3),nf.pol);\n aa = aleg; bb = bleg; na = abs(norm(aleg)); nb = abs(norm(bleg)));\n if( aa == 1, resl = [1,1,0]~; break);\n if( bb == 1, resl = [1,0,1]~; break);\n if( aa+bb == 1, resl = [1,1,1]~; break);\n if( aa+bb == 0, resl = [0,1,1]~; break);\n if( aa == bb && aa != 1,\n t = aa*mat[,1];\n mat[,1] = mat[,3]; mat[,3] = t;\n aa = -1; na = 1);\n if( issquare(na),\n sq = nfsqrt(nf,aa);\n if( sq != [], resl = [sq[1],1,0]~; break));\n if( issquare(nb),\n sq = nfsqrt(nf,bb);\n if( sq != [], resl = [sq[1],0,1]~; break));\n if( na > nb,\n t = aa; aa = bb; bb = t;\n t = na; na = nb; nb = t;\n t = mat[,3]; mat[,3] = mat[,2]; mat[,2] = t);\n if( nb == 1,\nif( DEBUGLEVEL_ell >= 4, print(\" (a,b) = \",lift([aa,bb])));\nif( DEBUGLEVEL_ell >= 4, print(\" (na,nb) = \",lift([na,nb])));\n if( aleg == aa && bleg == bb, mat = Mod(matid(3),nf.pol));\n if( flag3, resl = bnfqfsolve2(bnf,aa,bb,aut); break);\n pol = aa*'x^2+bb; \n vecrat = nfratpoint(nf,pol,borne++,1);\n if( vecrat != 0, resl=[vecrat[2],vecrat[1],vecrat[3]]~; break);\n\n alpha = 0;\nif( DEBUGLEVEL_ell >= 4, print(\" bound = \",borne));\n while( alpha==0,\n xx = nfrandint(nf,borne); yy = nfrandint(nf,borne);\n borne++; \n alpha = xx^2-aa*yy^2 );\n bb *= alpha; nb *= abs(norm(alpha));\n t = xx*mat[,1]+yy*mat[,2];\n mat[,2] = xx*mat[,2]+aa*yy*mat[,1];\n mat[,1] = t;\n mat[,3] *= alpha\n ,\n test = 1;\nif( DEBUGLEVEL_ell >= 4, print(\"on factorise bb = \",bb));\n sun = bnfsunit(bnf,idealfactor(bnf,bb)[,1]~);\n fact = lift(bnfissunit(bnf,sun,bb));\nif( DEBUGLEVEL_ell >= 4, print(\"fact = \",fact));\n suni = concat(concat(bnf.fu, bnf.tu[2]),vector(#sun[1],i,nfbasistoalg(bnf,sun[1][i])));\n for( i = 1, #suni,\n if( (f = fact[i]>>1), \n test =0;\n for( k = 1, 3, mat[k,3] /= suni[i]^f);\n nb /= abs(norm(suni[i]))^(2*f);\n bb /= suni[i]^(2*f)));\nif( DEBUGLEVEL_ell >= 4, print(\" factorization of bb = \",bb));\n fact = idealfactor(nf,bb);\nif( DEBUGLEVEL_ell >= 4, print(\" fact = \",fact));\n l = #fact[,1];\n\n if( test,\n aux = 1;\n for( i = 1, l,\n if( (f = fact[i,2]>>1) &&\n !(fact[i,1][1]%2) && !nfissquaremodpodd(nf,aa,fact[i,1]),\n aux=idealmul(nf,aux,idealpow(nf,fact[i,1],f))));\n if( aux != 1,\n test = 0;\n alpha = nfbasistoalg(nf,idealappr(nf,idealinv(nf,aux)));\n alpha2 = alpha^2;\n bb *= alpha2; nb *= abs(norm(alpha2));\n mat[,3] *= alpha));\n if( test,\n maxnbiter = 1<= 4,\n print(\" sq = \",sq);\n print(\" fact = \",fact);\n print(\" l = \",l));\n if( l > 1, \n idbb = idealhnf(nf,bb);\n rem = nfchinese(nf,idbb,fact));\n test = 1; nbiter = 1;\n while( test && nbiter <= maxnbiter,\n if( l > 1,\n mask = nbiter; xx = 0;\n for( i = 1, l,\n if( mask%2, xx += rem[i]*sq[i], xx -= rem[i]*sq[i] ); mask >>= 1)\n , \n test = 0; xx = sq[1]);\n xx = mynfeltmod(nf,xx,bb);\n alpha = xx^2-aa;\n if( alpha == 0, resl=[xx,1,0]~; break(2));\n t = alpha/bb;\nif( DEBUGLEVEL_ell >= 4, print(\" [alpha,bb] = \",[alpha,bb]));\n oldnb = nb;\n newnb = abs(norm(t));\nif( DEBUGLEVEL_ell >= 4, print(\" [oldnb,newnb,oldnb/newnb] = \",[oldnb,newnb,oldnb/newnb+0.]));\n while( nb > newnb,\n mat[,3] *= t;\n bb = t; nb = newnb;\n t = xx*mat[,1]+mat[,2];\n mat[,2] = aa*mat[,1] + xx*mat[,2];\n mat[,1] = t;\n xx = mynfeltmod(nf,-xx,bb);\n alpha = xx^2-aa;\n t = alpha/bb;\n newnb = abs(norm(t));\n );\n if( nb == oldnb, nbiter++, test = 0);\n );\n if( nb == oldnb,\n if( flag3, resl = bnfqfsolve2(bnf,aa,bb,aut); break);\n pol = aa*'x^2+bb;\n vecrat =nfratpoint(nf,pol,borne++<<1,1);\n if( vecrat != 0, resl = [vecrat[2],vecrat[1],vecrat[3]]~; break);\n\n bor = 1000; yy = 1; testici = 1;\n for( i = 1, 10000, de = nfbasistoalg(nf,vectorv(poldegree(nf.pol),j,random(bor)));\n if( idealadd(bnf,de,bb) != matid(poldegree(bnf.pol)),next);\n xxp = mynfeltmod(bnf,de*xx,bb); yyp = mynfeltmod(bnf,de*yy,bb);\n rap = (norm(xxp^2-aa*yyp^2)/nb^2+0.);\n if( abs(rap) < 1,\nif( DEBUGLEVEL_ell >= 4, print(\" ********** \\n \\n MIRACLE \",rap,\" \\n \\n ***\"));\n t = (xxp^2-aa*yyp^2)/bb;\n mat[,3] *= t;\n bb = t; nb = abs(norm(bb));\nif( DEBUGLEVEL_ell >= 4, print(\" newnb = \",nb));\n t = xxp*mat[,1]+yyp*mat[,2];\n mat[,2] = aa*yyp*mat[,1] + xxp*mat[,2];\n mat[,1] = t;\n xx = xxp; yy = -yyp; testici = 0;\n ));\n\n if( testici, \n alpha = 0;\n while( alpha == 0,\n xx = nfrandint(nf,4*borne); yy = nfrandint(nf,4*borne);\n borne++;\n alpha = xx^2-aa*yy^2);\n bb *= alpha; nb *= abs(norm(alpha));\n t = xx*mat[,1] + yy*mat[,2];\n mat[,2] = xx*mat[,2]+aa*yy*mat[,1];\n mat[,1] = t;\n mat[,3] *= alpha;)))));\n resl = lift(mat*resl);\nif( DEBUGLEVEL_ell >= 5, print(\" resl1 = \",resl));\nif( DEBUGLEVEL_ell >= 5, print(\" content = \",content(resl)));\n resl /= content(resl);\n resl = Mod(lift(resl),nf.pol);\nif( DEBUGLEVEL_ell >=5, print(\" resl3 = \",resl));\n fact = idealadd(nf,idealadd(nf,resl[1],resl[2]),resl[3]);\n fact = bnfisprincipal(bnf,fact,3);\n resl *=1/nfbasistoalg(nf,fact[2]);\nif( DEBUGLEVEL_ell >= 5, print(\" resl4 = \",resl));\nif( DEBUGLEVEL_ell >= 3, print(\" resl = \",resl));\n verif = (resl[1]^2-aleg*resl[2]^2-bleg*resl[3]^2 == 0);\n if( !verif, error(\"bnfqfsolve: WRONG POINT\"));\nif( DEBUGLEVEL_ell >= 3, print(\" end of bnfqfsolve\"));\n return(resl);\n}\n{bnfredquartique( bnf, pol, r,a,b) =\n\\\\ reduction d'une quartique issue de la 2-descente\n\\\\ en connaissant les valeurs de r, a et b. \nlocal(gcc,princ,rp,pol2);\n\nif( DEBUGLEVEL_ell >= 4, print(\" starting bnfredquartique\"));\nif( DEBUGLEVEL_ell >= 4, print(\" \",[r,a,b]));\nif( DEBUGLEVEL_ell >= 3, print(\" reduction of the quartic \",pol));\n\n if( a == 0,\n rp = 0\n ,\n gcc = idealadd(bnf,b,a);\n if( gcc == 1,\n rp = nfbasistoalg(bnf,idealaddtoone(bnf.nf,a,b)[1])/a;\n rp = mynfeltmod(bnf,r*rp,b)\n ,\n princ = bnfisprincipal(bnf,gcc,3);\n if( princ[1] == 0, gcc = nfbasistoalg(bnf,princ[2])\n ,\nif( DEBUGLEVEL_ell >= 3, print(\" quartic not reduced\"));\nif( DEBUGLEVEL_ell >= 4, print(\" end of bnfredquartique\"));\n return([pol,0,1]));\n rp = nfbasistoalg(bnf,idealaddtoone(bnf.nf,a/gcc,b/gcc)[1])/(a/gcc);\n rp = mynfeltmod(bnf,r*rp,b)/gcc;\n b /= gcc;\n )\n );\n pol2 = subst(pol/b,'x,rp+b*'x)/b^3;\nif( DEBUGLEVEL_ell >= 3, print(\" quartic reduced: \",pol2));\nif( DEBUGLEVEL_ell >= 4, print(\" end of bnfredquartique\"));\n return([pol2,rp,b]);\n}\n{bnfell2descent_gen( bnf, ell, ext, help=[], bigflag=1, flag3=1, aut=['y]) =\n\\\\ bnf a un polynome en y.\n\\\\ si ell= y^2=P(x), alors ext est\n\\\\ ext[1] est une equation relative du corps (=P(x)),\n\\\\ ext[2] est le resultat rnfequation(bnf,P,1);\n\\\\ ext[3] est le bnfinit (sur Q) de l'extension.\n\\\\ dans la suite ext est note L = K(theta).\n\\\\ help est une liste de points deja connus sur ell.\n\\\\ si bigflag !=0 alors on applique bnfredquartique.\n\\\\ si flag3 ==1 alors on utilise bnfqfsolve2 (equation aux normes) pour resoudre Legendre\n\\\\ aut est une liste d'automorphismes connus de bnf\n\\\\ (ca peut aider a factoriser certains discriminants).\n\\\\ ell est de la forme y^2=x^3+A*x^2+B*x+C\n\\\\ ie ell=[0,A,0,B,C], avec A,B et C entiers.\n\\\\\nlocal(nf,unnf,ellnf,A,B,C,S,plist,Lrnf,SLprod,LS2,LS2gen,polrel,alpha,ttheta,KS2gen,normLS2,normcoord,LS2coordtilda,LS2tilda,aux,listgen,listpointstriv,listpoints,m1,m2,loc,lastloc,maskwhile,iwhile,zc,iaux,liftzc,ispointtriv,point,c,b,a,found,alphac,r,denc,dena,cp,alphacp,beta,mattr,vec,z1,cont,d,e,polorig,pol,redq,transl,multip,UVW,pointxx,point2,rang,listELS,listnotELS);\n\nif( DEBUGLEVEL_ell >= 4, print(\" starting bnfell2descent_gen\"));\n\n nf = bnf.nf;\n unnf = Mod(1,nf.pol);\n ellnf = ell*unnf;\n if( #ellnf <= 5, ellnf = ellinit(ellnf));\n\n A = ellnf.a2; if( DEBUGLEVEL_ell >= 2, print(\" A = \",A));\n B = ellnf.a4; if( DEBUGLEVEL_ell >= 2, print(\" B = \",B));\n C = ellnf.a6; if( DEBUGLEVEL_ell >= 2, print(\" C = \",C));\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ Construction of L(S,2) \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\nif( DEBUGLEVEL_ell >= 2, print(); print(\" Computing L(S,2)\"));\n\n polrel = ext[1];\n alpha = Mod(Mod('y,nf.pol),polrel); \\\\ alpha est l'element primitif de K\n ttheta = Mod('x,polrel); \\\\ ttheta est la racine de P(x)\n\n S = 6*lift(ellnf.disc);\n plist = idealfactor(nf,S)[,1];\n Lrnf = ext[3];\n SLprod = subst(lift(polrel'),'y,lift(ext[2][2]));\nif( DEBUGLEVEL_ell >= 3, print(\" \",ext[2]));\n\n while( 1,\n\\\\ Construction des S-unites\n LS2gen = bnfsunit(Lrnf, idealfactor(Lrnf,SLprod)[,1]~);\nif( DEBUGLEVEL_ell >= 4, print(\" LS2gen = \",LS2gen));\n\\\\ si le groupe de classes est impair, on a fini.\n if( LS2gen[5][1]%2, break);\nif( DEBUGLEVEL_ell >= 3, print(\" 2-class group \",LS2gen[5][3][1][1,1]));\n S *= LS2gen[5][3][1][1,1];\n SLprod = idealmul(Lrnf,SLprod,(LS2gen[5][3][1]));\n );\n\n KS2gen = bnfsunit(bnf,idealfactor(nf,S)[,1]~);\n \nif( DEBUGLEVEL_ell >= 3, print(\" #KS2gen = \",#KS2gen[1]));\nif( DEBUGLEVEL_ell >= 3, print(\" KS2gen = \",KS2gen[1]));\n\n LS2gen = LS2gen[1];\n LS2 = vector(#LS2gen,i,lift(nfbasistoalg(Lrnf,LS2gen[i])));\n LS2 = concat(lift(concat(Lrnf.fu, Lrnf.tu[2])),LS2);\n\n LS2 = subst(LS2,'x,ttheta);\n LS2 = LS2*Mod(1,polrel);\nif( DEBUGLEVEL_ell >= 3, print(\" #LS2 = \",#LS2));\nif( DEBUGLEVEL_ell >= 3, print(\" LS2 = \",LS2));\n\nif( DEBUGLEVEL_ell >= 2, print(\" L(S,2) = \",LS2));\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ Construction of the Selmer group \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\nif( DEBUGLEVEL_ell >= 2, print(); print(\" Computing the Selmer group\"));\n\n\\\\ dans LS2gen, on ne garde que ceux dont la norme est un carre.\n\n normLS2 = norm(LS2);\nif( DEBUGLEVEL_ell >= 4, print(\" normLS2 = \",normLS2));\n\n\\\\ matrice de l'application norme\n\n normcoord = matrix(#KS2gen[1]+#bnf[8][5]+1,#normLS2,i,j,0);\n for( i = 1, #normLS2,\n normcoord[,i] = bnfissunit(bnf,KS2gen,normLS2[i]));\nif( DEBUGLEVEL_ell >= 4, print(\" normcoord = \",normcoord));\n\n\\\\ construction du noyau de la norme\n\n LS2coordtilda = lift(matker(normcoord*Mod(1,2)));\nif( DEBUGLEVEL_ell >= 4, print(\" LS2coordtilda = \",LS2coordtilda));\n LS2tilda = vector(#LS2coordtilda[1,],i,0);\n for( i = 1, #LS2coordtilda[1,],\n aux = 1;\n for( j = 1, #LS2coordtilda[,i],\n if( sign(LS2coordtilda[j,i]),\n aux *= LS2[j]));\n LS2tilda[i] = aux;\n );\n\nif( DEBUGLEVEL_ell >= 3, print(\" LS2tilda = \",LS2tilda));\nif( DEBUGLEVEL_ell >= 3, print(\" norm(LS2tilda) = \",norm(LS2tilda)));\n\n\\\\ Fin de la construction de L(S,2)\n\n listgen = LS2tilda;\nif( DEBUGLEVEL_ell >= 2, print(\" #LS2gen = \",#listgen));\nif( DEBUGLEVEL_ell >= 2, print(\" LS2gen = \",listgen));\n\nif( DEBUGLEVEL_ell >= 3, print(\" (A,B,C) = \",[A,B,C]));\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ Recherche de points triviaux \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\nif( DEBUGLEVEL_ell >= 2, print(\" Search for trivial points on the curve\"));\n listpointstriv = nfratpoint(nf,'x^3+A*'x^2+B*'x+C,LIMTRIV,0);\n listpointstriv = concat(help,listpointstriv);\nif( DEBUGLEVEL_ell >= 1, print(\" Trivial points on the curve = \",listpointstriv));\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ parcours de L(S,2) \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n listpoints = [];\n m1 = 0; m2 = 0; lastloc = -1;\n maskwhile = 1<<#listgen;\n listELS = [0]; listnotELS = [];\n iwhile = 1;\n\n while( iwhile < maskwhile,\nif( DEBUGLEVEL_ell >= 4,\n print(\" iwhile = \",iwhile);\n print(\" listgen = \",listgen)\n);\n\n\\\\ utilise la structure de groupe pour detecter une eventuelle solubilite locale.\n loc = 0;\n for( i = 1, #listELS,\n for( j = 1, #listnotELS,\n if( bitxor(listELS[i],listnotELS[j]) == iwhile,\nif( DEBUGLEVEL_ell >= 3, print(\" Not ELS from group structure\"));\n listnotELS = concat(listnotELS,[iwhile]);\n iwhile++;\n next(3)\n )));\n\n for( i = 1, #listELS,\n for( j = i+1, #listELS,\n if( bitxor(listELS[i],listELS[j]) == iwhile,\nif( DEBUGLEVEL_ell >= 3, print(\" ELS from group structure\"));\n listELS = concat(listELS,[iwhile]);\n loc = 1;\n break(2)\n )));\n\n iaux = vectorv(#listgen,i,bittest(iwhile,i-1));\n iaux = (LS2coordtilda*iaux)%2;\n zc = unnf*prod( i = 1, #LS2, LS2[i]^iaux[i]);\n\nif( DEBUGLEVEL_ell >= 2, print(\" zc = \",zc));\n liftzc = lift(zc);\n\n\\\\ Est-ce un point trivial ?\n found = 0;\n ispointtriv = 0;\n for( i = 1, #listpointstriv,\n point = listpointstriv[i];\n if( #point == 2 || point[3] != 0,\n if( nfissquare(Lrnf.nf,subst((lift(point[1])-'x)*lift(liftzc),'y,lift(ext[2][2]))),\nif( DEBUGLEVEL_ell >= 2, print(\" comes from the trivial point \",point));\n listpoints = concat(listpoints,[point]);\n found = 1; ispointtriv = 1; break\n )));\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ On cherche a ecrire zc sous la forme a-b*theta\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\n\n if( !found, \\\\ si ce n'est pas un point trivial\n a = polcoeff(liftzc,0);\n b =-polcoeff(liftzc,1);\n c = polcoeff(liftzc,2);\n\n if( c != 0,\n alphac = (A*b+B*c-a)*c+b^2;\nif( DEBUGLEVEL_ell >= 3, print(\" alphac = \",alphac));\n r = nfsqrt(nf,norm(zc))[1];\n if( alphac == 0,\n\\\\ cas particulier\nif( DEBUGLEVEL_ell >= 3, print(\" continuing with 1/zc\"));\n zc = norm(zc)*(1/zc);\nif( DEBUGLEVEL_ell >= 2, print(\" zc = \",zc))\n ,\n\\\\ Il faut resoudre une forme quadratique\n\\\\ Existence (locale = globale) d'une solution :\n denc = deno(lift(c));\n if( denc != 1, cp = c*denc^2, cp = c);\n dena = deno(lift(alphac));\n if( dena != 1, alphacp = alphac*dena^2, alphacp = alphac);\nif( DEBUGLEVEL_ell >= 2, print(\" Hilbert symbol (\",alphacp,\",\",cp,\") = \"));\n if( !loc && mynfhilbert(nf, alphacp,cp) < 0,\nif( DEBUGLEVEL_ell >= 3, print(\" no local solution\"));\n listnotELS = concat(listnotELS,[iwhile]);\n iwhile++;\n next\n );\n\\\\ Ici on a l'existence locale\n beta = A*(A*b*c+B*c^2+b^2)-C*c^2+a*b;\n mattr = matid(3);\n mattr[1,1] = c ;mattr[2,2] = alphac ;\n mattr[3,3] = r ;mattr[2,3] = -beta;\n mattr[1,2] = -(b +A*c) ;mattr[1,3] = a-B*c+A*(A*c+b);\nif( DEBUGLEVEL_ell >= 2, print1(\" sol of quadratic equation = \"));\n vec = bnfqfsolve(bnf,alphacp,cp,flag3,aut);\nif( DEBUGLEVEL_ell >= 2, print(lift(vec)));\n aux = vec[2]*dena;\n vec[2] = vec[1];vec[1] = aux;\n vec[3] = vec[3]*denc;\n vec = (mattr^(-1))*vec;\n vec /= content(lift(vec));\n z1 = (vec[3]*ttheta+vec[2])*ttheta+vec[1];\nif( DEBUGLEVEL_ell >= 3, print(\" z1 = \",z1));\n zc *= z1^2;\nif( DEBUGLEVEL_ell >= 2, print(\" zc*z1^2 = \",zc));\n )\n )\n );\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\n\\\\ Maintenant zc est de la forme a-b*theta\n\\\\ \\\\\\\\\\\\\\\\\\\\\n\n if( !found,\n\nif( DEBUGLEVEL_ell >= 3, print(\" zc = \",zc));\n liftzc = lift(zc);\n a = polcoeff(liftzc,0);\n b =-polcoeff(liftzc,1);\n c = polcoeff(liftzc,2);\nif( c, error(\"bnfell2descent_gen : c <> 0\"));\n\n\\\\ remove denominators and try to simplify zc\n cont = idealadd(nf,a,b);\n if( cont != 1,\n cont = idealfactor(nf,cont);\n cont[,2] \\= 2;\n aux = 1;\n for( i = 1, #cont[,1],\n\\\\ *****************************************************************\n\\\\ aux = idealmul(nf,aux,idealpow(nf,cont[i,1],cont[i,2]))\n aux = idealmul(nf,aux,idealpow(nf,idealhnf(nf,cont[i,1]),cont[i,2]))\n\\\\ *****************************************************************\n );\n cont = nfbasistoalg(nf,bnfisprincipal(bnf,aux)[2])^2;\n a /= cont;\n b /= cont;\n zc/= cont;\n liftzc = lift(zc);\nif( DEBUGLEVEL_ell >= 3, print(\" new zc = \",zc));\n );\n\n if( nfissquare(nf,b),\nif( DEBUGLEVEL_ell >= 3, print(\" b is a square\"));\n point = [a/b,nfsqrt(nf,(a/b)^3+A*(a/b)^2+B*(a/b)+C)[1]];\nif( DEBUGLEVEL_ell >= 2, print(\" point found = \",point));\n listpoints = concat(listpoints,[point]);\n found = 1; ispointtriv = 1\n )\n );\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\n\\\\ Construction de la quartique \n\\\\ \\\\\\\\\\\\\\\\\\\\\\\n\n if( !found, \\\\ si ce n'est pas un point trivial\n r = nfsqrt(nf,norm(zc))[1];\nif( DEBUGLEVEL_ell >= 4, print(\" r = \",r));\n c = -2*(A*b+3*a);\nif( DEBUGLEVEL_ell >= 4, print(\" c = \",c));\n d = 8*r;\nif( DEBUGLEVEL_ell >= 4, print(\" d = \",d));\n e = (A^2*b^2 - 2*A*a*b-4*B*b^2-3*a^2);\nif( DEBUGLEVEL_ell >= 4, print(\" e = \",e));\n polorig = b*('x^4+c*'x^2+d*'x+e)*unnf;\nif( DEBUGLEVEL_ell >= 2, print(\" quartic: (\",lift(b),\")*Y^2 = \",lift(polorig/b)));\n pol = polorig;\n if( bigflag,\n redq = bnfredquartique(bnf,pol,r,a,b);\nif( DEBUGLEVEL_ell >= 2, print(\" reduced: Y^2 = \",lift(redq[1])));\n pol = redq[1]; transl = redq[2]; multip = redq[3]\n );\n\n\\\\ Search for a point on the quartic\n point = nfratpoint(nf,pol,LIM1,1);\n found = point != [];\n if( found,\n loc = 1\n );\n\\\\ If the quartic is not known to be ELS, check if it is\n if( !loc,\n if( bigflag,\n loc = nflocallysoluble(nf,pol,r,a,b)\n , loc = nflocallysoluble(nf,pol,0,1,1)\n ));\n if( !loc,\n listnotELS = concat(listnotELS,[iwhile]);\n iwhile++;\n next\n )\n );\n\n\\\\ If no point is found, search harder\n if( !found,\nif( DEBUGLEVEL_ell >= 2, print(\"quartic is ELS\"));\n point = nfratpoint(nf,pol,LIM3,1);\n found = point != []\n );\n\n if( found && !ispointtriv,\n if( bigflag,\n point[1] = point[1]*multip+transl;\n point[2] = nfsqrt(nf,subst(polorig,'x,point[1]/point[3]))[1]);\n mattr = matid(3);\n mattr[1,1] = -2*b^2; mattr[1,2] = (A*b+a)*b;\n mattr[1,3] = a^2+(2*B-A^2)*b^2; mattr[2,2] = -b;\n mattr[2,3] = a+A*b; mattr[3,3] =r;\n UVW = [point[1]^2,point[3]^2,point[1]*point[3]]~;\n vec = (mattr^(-1))*UVW;\n z1 = (vec[3]*ttheta+vec[2])*ttheta+vec[1];\n zc *= z1^2;\n zc /= -polcoeff(lift(zc),1);\nif( DEBUGLEVEL_ell >= 3, print(\" zc*z1^2 = \",zc));\n pointxx = polcoeff(lift(zc),0);\n point2 = [ pointxx, nfsqrt(nf,subst('x^3+A*'x^2+B*'x+C,'x,pointxx))[1]];\nif( DEBUGLEVEL_ell >= 1, print(\" point found = \",point2));\n listpoints = concat(listpoints,[point2]);\n );\n\n listELS = concat(listELS,[iwhile]);\n if( degre(iwhile) > lastloc, m2++; lastloc = degre(iwhile));\n\n if( found,\n m1++;\n found = 0; lastloc = -1;\n iwhile = 1<>= 1;\n LS2coordtilda = vecextract(LS2coordtilda,1<<#listgen-iwhile-1);\n listgen = vecextract(listgen,1<<#listgen-iwhile-1);\n while( listELS[#listELS] >= iwhile,\n listELS = vecextract(listELS,1<<(#listELS-1)-1));\n while( #listnotELS && listnotELS[#listnotELS] >= iwhile,\n listnotELS = vecextract(listnotELS,1<<(#listnotELS-1)-1))\n , iwhile ++\n )\n );\n\nif( DEBUGLEVEL_ell >= 2,\n print(\" m1 = \",m1);\n print(\" m2 = \",m2));\nif( DEBUGLEVEL_ell >= 1,\n print(\"#S(E/K)[2] = \",1<= 1,\n print(\"#E(K)/2E(K) = \",1<= 1,\n print(\"#E(K)/2E(K) >= \",1<= \",m1));\n rang = m1;\n if( (m2-m1)%2,\nif( DEBUGLEVEL_ell >= 1,\n print(\" III should be a square, hence \");\n if( m2-m1 > 1,\n print(\"#E(K)/2E(K) >= \",1<<(m1+1));\n print(\"#III(E/K)[2] <= \",1<<(m2-m1-1));\n print(\"rank(E/K) >= \",m1+1)\n ,\n print(\"#E(K)/2E(K) = \",1<<(m1+1));\n print(\"#III(E/K)[2] = 1\");\n print(\"rank(E/K) = \",m1+1)));\n rang = m1+1)\n );\n\nif( DEBUGLEVEL_ell >= 1, print(\" listpoints = \",listpoints));\n for( i = 1, #listpoints,\n if( #listpoints[i] == 3, \n listpoints[i] = vecextract(listpoints[i],3));\n if( !ellisoncurve(ellnf,listpoints[i]), \n error(\"bnfell2descent: WRONG POINT \")));\nif( DEBUGLEVEL_ell >= 4, print(\" end of bnfell2descent_gen\"));\n return([rang,m2,listpoints]);\n}\n{bnfellrank(bnf,ell,help=[],bigflag=1,flag3=1) =\n\\\\ Algorithme de la 2-descente sur la courbe elliptique ell.\n\\\\ help est une liste de points connus sur ell.\n\n\\\\ attention bnf a un polynome en y.\n\\\\ si bigflag !=0, on reduit les quartiques\n\\\\ si flag3 != 0, on utilise bnfqfsolve2\nlocal(urst,urst1,den,factden,eqtheta,rnfeq,bbnf,ext,rang,f);\n\nif( DEBUGLEVEL_ell >= 3, print(\" starting bnfellrank\"));\n if( #ell < 5, ell = ellinit(ell));\n ell = vector(5, i, ell[i]);\n\n\\\\ removes the coefficients a1 and a3\n urst = [1,0,0,0];\n if( ell.a1 != 0 || ell.a3 != 0,\n urst1 = [1,0,-ell.a1/2,-ell.a3/2];\n ell = ellchangecurve(ell,urst1);\n urst = ellcomposeurst(urst,urst1)\n );\n\n\\\\ removes denominators\n while( (den = idealinv(bnf,idealadd(bnf,idealadd(bnf,1,ell.a2),idealadd(bnf,ell.a4,ell.a6))))[1,1] > 1,\n factden = idealfactor(bnf,den)[,1];\n den = 1;\n for( i = 1, #factden,\n den = idealmul(bnf,den,factden[i]));\n den = den[1,1];\n urst1 = [1/den,0,0,0];\n ell = ellchangecurve(ell,urst1);\n urst = ellcomposeurst(urst,urst1);\n );\n\n help = ellchangepoint(help,urst);\n\n\\\\ choix de l'algorithme suivant la 2-torsion\n ell *= Mod(1,bnf.pol);\n eqtheta = Pol([1,ell.a2,ell.a4,ell.a6]);\nif( DEBUGLEVEL_ell >= 1, print(\" elliptic curve: Y^2 = \",eqtheta));\n f = nfpolratroots(bnf,eqtheta);\n\n if( #f == 0, \\\\ cas 1: 2-torsion triviale\n rnfeq = rnfequation(bnf,eqtheta,1);\n urst1 = [1,-rnfeq[3]*Mod('y,bnf.pol),0,0];\n if( rnfeq[3] != 0, \n ell = ellchangecurve(ell,urst1);\n urst = ellcomposeurst(urst,urst1);\n eqtheta = subst(eqtheta,'x,'x-rnfeq[3]*Mod('y,bnf.pol));\n rnfeq = rnfequation(bnf,eqtheta,1);\nif( DEBUGLEVEL_ell >= 2, print(\" translation: working with Y^2 = \",eqtheta));\n );\nif( DEBUGLEVEL_ell >= 3, print1(\" bbnfinit \"));\n bbnf = bnfinit(rnfeq[1],1);\nif( DEBUGLEVEL_ell >= 3, print(\" done\"));\n ext = [eqtheta, rnfeq, bbnf];\n rang = bnfell2descent_gen(bnf,ell,ext,help,bigflag,flag3)\n ,\n if( #f == 1, \\\\ cas 2: 2-torsion = Z/2Z\n if( f[1] != 0, \n urst1 = [1,f[1],0,0];\n ell = ellchangecurve(ell,urst1);\n urst = ellcomposeurst(urst,urst1)\n );\n rang = bnfell2descent_viaisog(bnf,ell)\n , \\\\ cas 3: 2-torsion = Z/2Z*Z/2Z\n rang = bnfell2descent_complete(bnf,f[1],f[2],f[3],flag3)\n ));\n \n rang[3] = ellchangepoint(rang[3],ellinverturst(urst));\nif( DEBUGLEVEL_ell >= 3, print(\" end of bnfellrank\"));\n\nreturn(rang);\n}\n{bnfell2descent_complete(bnf,e1,e2,e3,flag3=1,aut=['y]) =\n\\\\ calcul du rang d'une courbe elliptique\n\\\\ par la methode de 2-descente complete.\n\\\\ Y^2 = (x-e1)*(x-e2)*(x-e3);\n\\\\ en suivant la methode decrite par J.Silverman\n\\\\ si flag3 ==1 alors on utilise bnfqfsolve2 (equation aux normes)\n\\\\ pour resoudre Legendre \n\\\\ on pourra alors utiliser aut=nfgaloisconj(bnf.pol)\n\n\\\\ e1, e2 et e3 sont des entiers algebriques de bnf.\n\nlocal(KS2prod,oddclass,KS2gen,vect,selmer,rang,b1,b2,vec,z1,z2,d31,quart0,quart,cont,fa,point,solx,soly,listepoints,strange);\n\nif( DEBUGLEVEL_ell >= 2, print(\" Algorithm of complete 2-descent\"));\n\n\\\\ calcul de K(S,2)\n\n KS2prod = (e1-e2)*(e2-e3)*(e3-e1)*2;\n oddclass = 0;\n while( !oddclass,\n KS2gen = bnfsunit(bnf,idealfactor(bnf,KS2prod)[,1]~);\n oddclass = (KS2gen[5][1]%2);\n if( !oddclass,\n KS2prod = idealmul(bnf,KS2prod,(KS2gen[5][3][1])));\n );\n KS2gen = KS2gen[1];\n for( i = 1, #KS2gen,\n KS2gen[i] = nfbasistoalg(bnf, KS2gen[i]));\n KS2gen = concat(Mod(lift(concat(bnf.tu[2], bnf.fu)),bnf.pol),KS2gen);\nif( DEBUGLEVEL_ell >= 2,\n print(\" #K(S,2)gen = \",#KS2gen);\n print(\" K(S,2)gen = \",KS2gen)\n);\n\n\\\\ parcours de K(S,2)*K(S,2)\n\n vect = vector(#KS2gen,i,[0,1]);\n selmer = 0;\n rang = 0;\n listepoints = [];\n\n forvec( X = vect,\n b1 = prod( i = 1, #KS2gen, KS2gen[i]^X[i]);\n forvec( Y = vect,\n b2 = prod( i = 1, #KS2gen, KS2gen[i]^Y[i]);\n\nif( DEBUGLEVEL_ell >= 3, print(\" [b1,b2] = \",lift([b1,b2])));\n\n\\\\ points triviaux provenant de la 2-torsion\n\n if( b1==1 && b2==1, \nif( DEBUGLEVEL_ell >= 2, print(\" trivial point [0]\"));\n selmer++; rang++; next);\n if( nfissquare(bnf.nf,(e2-e1)*b1)\n && nfissquare(bnf.nf,(e2-e3)*(e2-e1)*b2),\nif( DEBUGLEVEL_ell >= 2, print(\" trivial point [e2,0]\"));\n selmer++; rang++; next);\n if( nfissquare(bnf.nf,(e1-e2)*b2)\n && nfissquare(bnf.nf,(e1-e3)*(e1-e2)*b1),\nif( DEBUGLEVEL_ell >= 2, print(\" trivial point [e1,0]\"));\n selmer++; rang++; next);\n if( nfissquare(bnf.nf,(e3-e1)*b1)\n && nfissquare(bnf.nf,(e3-e2)*b2),\nif( DEBUGLEVEL_ell >= 2, print(\" trivial point [e3,0]\"));\n selmer++; rang++; next);\n\n\\\\ premier critere local : sur les formes quadratiques\n\n if( mynfhilbert(bnf.nf,b1*b2,b1*(e2-e1)) < 0\n || mynfhilbert(bnf.nf,b2,b1*(e3-e1)) < 0\n || mynfhilbert(bnf.nf,b1,b2*(e3-e2)) < 0\n ,\nif( DEBUGLEVEL_ell >= 3, print(\" not ELS\"));\n next);\n\nif( DEBUGLEVEL_ell >= 2, print(\" [b1,b2] = \",lift([b1,b2])));\nif( DEBUGLEVEL_ell >= 2, print(\" quadratic forms locally soluble\"));\n\n\\\\ solution de la premiere forme quadratique\n\n if( b1 != b2,\n vec = bnfqfsolve(bnf,b1*b2,b1*(e2-e1),flag3);\nif( DEBUGLEVEL_ell >= 3, print(\" sol part = \",vec));\n if( vec[3] == 0, error(\"bnfell2descent_complete: BUG !!! : vec[3]=0 \"));\n z1 = vec[1]/vec[3]/b1; z2 = vec[2]/vec[3]\n ,\n z1 = (1+(e2-e1)/b1)/2; z2 = z1-1\n );\n d31 = e3-e1;\n quart0 = b2^2*(z1^2*b1 - d31)*'x^4 - 4*z1*b2^2*z2*b1*'x^3\n + 2*b1*b2*(z1^2*b1 + 2*b2*z2^2 + d31)*'x^2 - 4*z1*b2*z2*b1^2*'x\n + b1^2*(z1^2*b1 - d31);\n quart = quart0*b1*b2;\nif( DEBUGLEVEL_ell >= 4, print(\" quart = \",quart));\n quart *= denominator(simplify(content(quart)))^2;\n cont = simplify(content(lift(quart)));\n fa = factor(cont);\n for( i = 1, #fa[,1], quart /= fa[i,1]^(2*(fa[i,2]\\2)));\nif( DEBUGLEVEL_ell >= 3, print(\" quartic reduced = \",quart));\n\n\\\\ la quartique est-elle localement soluble ?\n \n if( !nflocallysoluble(bnf.nf,quart),\nif( DEBUGLEVEL_ell >= 2, print(\" quartic not ELS\"));\n next);\n selmer++;\n\n\\\\ recherche de points sur la quartique.\n\n point = nfratpoint(bnf.nf,quart,LIM3,1);\n if( point != [], \nif( DEBUGLEVEL_ell >= 2, print(\" point found on the quartic !!\"));\nif( DEBUGLEVEL_ell >= 3, print(\" \",point));\n if( point[3], \n point /= point[3];\n z1 = (2*b2*point[1]*z2-z1*(b1+b2*point[1]^2))/(b1-b2*point[1]^2);\n solx = b1*z1^2+e1;\n soly = nfsqrt(bnf.nf,(solx-e1)*(solx-e2)*(solx-e3))[1];\n listepoints = concat(listepoints,[[solx,soly]]);\nif( DEBUGLEVEL_ell >= 1, print(\" point on the elliptic curve =\",[solx,soly]))\n );\n rang++\n ,\nif( DEBUGLEVEL_ell >= 2, print(\" no point found on the quartic\"))\n )\n )\n );\n\n\\\\ fin\n\nif( DEBUGLEVEL_ell >= 1,\n print(\"#S^(2) = \",selmer));\n if( rang > selmer/2, rang = selmer);\nif( DEBUGLEVEL_ell >= 1,\n strange = rang != selmer;\n if( strange,\n print(\"#E[K]/2E[K]>= \",rang)\n, print(\"#E[K]/2E[K] = \",rang));\n print(\"#E[2] = 4\");\n);\n rang = ceil(log(rang)/log(2))-2;\n selmer = valuation(selmer,2);\nif( DEBUGLEVEL_ell >= 1,\n if( strange,\n print(selmer-2,\" >= rank >= \",rang)\n, print(\"rank = \",rang));\n if( rang, print(\"points = \",listepoints));\n);\n\nreturn([rang,selmer,listepoints]);\n}\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ HELP MESSAGES \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n{\n addhelp(bnfellrank,\n \"bnfellrank(K,E,help=[]): E is a 5-component vector defining an elliptic curve defined over the number field K (output by bnfinit()). Returns a vector [r,s,v], where r is a lower bound for the rank of E(K), s is the rank of its 2-Selmer group and v is a list of independant points in E(K)/2E(K). If help is a vector of nontrivial points on E(K), the result might be faster. See also ?default_ell\");\n\\\\ others\n addhelp(default_ell,\n \"default_ell(DEBUGLEVEL_ell, LIM1, LIM3, LIMTRIV, MAXPROB, LIMBIGPRIME): output/set the value of the global variables used for ellrank() and other related functions. DEBUGLEVEL_ell: 0-5 : choose the quantity of information printed during the computation (default=0: print nothing); LIM1 (resp LIM3): search limit for easy (resp hard) points on quartics; LIMTRIV: search limit for trivial points on elliptic curves; MAXPROB, LIMBIGPRIME: technical.\");\n}\n" }, { "path": "anc/code/common/simon_ell/qfsolve.gp", "size_bytes": 21937, "sha256": "739b6e06cb2c4b3e3adc7318bd327f3f5a3d9acef5fa2b52e68c34b85a0ac998", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ Copyright (C) 2014 Denis Simon\n\\\\\n\\\\ Distributed under the terms of the GNU General Public License (GPL)\n\\\\\n\\\\ This code is distributed in the hope that it will be useful,\n\\\\ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\\\\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\\\\ General Public License for more details.\n\\\\\n\\\\ The full text of the GPL is available at:\n\\\\\n\\\\ http://www.gnu.org/licenses/\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n/*\n Author:\n Denis SIMON -> simon@math.unicaen.fr\n address of the file:\n www.math.unicaen.fr/~simon/qfsolve.gp\n\n *********************************************\n * VERSION 09/01/2014 *\n *********************************************\n\n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n \\\\ English help \\\\\n \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n This package provides functions to solve quadratic equations over Q.\n language: GP\n It can be run under GP by the command\n gp > \\r qfsolve.gp\n\n This package contains 4 main functions:\n\n - qfsolve(G,{factD}): Solve over Q the quadratic equation X~*G*X = 0.\n G must be a symmetric matrix n*n, with coefficients in Z.\n The solution might be a single vector (vectorv)\n or a matrix (whose columns generate a totally isotropic subspace).\n If no solution exists, the output is a prime number\n indicating that there is no solution in the local field Q_p\n (-1 for the reals, p for Q_p).\n factD is an optional parameter. If present, it must be equal to\n the factorization of -abs(2*matdet(G)). This saves a lot of time.\n\n Example:\n gp > G = [1,0,0;0,1,0;0,0,-34];\n gp > qfsolve(G)\n %1 = [-3, -5, 1]~\n\n - qfparam(G,sol,fl): Coefficients of quadratic forms that parametrize the\n solutions of the ternary quadratic form G, using the particular\n solution sol.\n fl is optional and can be 1, 2, or 3, in which case the 'fl'th form is\n reduced. The default is fl=3.\n\n Example:\n gp > qfparam(G,[-3,-5,1]~)\n %2 = \n [ 3 -10 -3]\n\n [-5 -6 5]\n\n [ 1 0 1]\n Indeed, the solutions can be parametrized as\n [3*x^2 - 10*y*x - 3*y^2, -5*x^2 - 6*y*x + 5*y^2, x^2 + y^2]~\n \n - qflllgram_indef(G,c): Solve or reduce the quadratic form G with\n integral coefficients. G might be definite or indefinite.\n This is an lll-type algorithm with a constant 1/4 G = [1,0,0;0,1,0;0,0,-34];\n gp > qfsolve(G)\n %1 = [-3, -5, 1]~\n\n - qfparam(G,sol,fl): pour parametrer les solutions de la forme\n quadratique ternaire G, en utilisant la solution particuliere sol.\n fl est optionnel et peut prendre les valeurs 1,2 ou 3.\n Il indique que la 'fl'eme forme quadratique est reduite.\n Par defaut, fl=3\n\n Exemple:\n gp > qfparam(G,[-3,-5,1]~)\n %2 = \n [ 3 -10 -3]\n\n [-5 -6 5]\n\n [ 1 0 1]\n Ici, les solutions sont parametrees par\n [3*x^2 - 10*y*x - 3*y^2, -5*x^2 - 6*y*x + 5*y^2, x^2 + y^2]~\n\n - qflllgram_indef(G,c): pour resoudre ou reduire la forme quadratique\n G a coefficients entiers. Il s'agit d'un algorithme type LLL, avec la\n constante 1/4= 2.6.0\n\\\\ build the matrix whose diagonal blocks are listed in the vector v.\n{matdiagonalblock(v) =\nmy(M);\nmy(lv,lt=0);\n\n if( type(v) != \"t_VEC\" && type(v) != \"t_COL\",\n error(\"wrong type in matdiagonalblock()\"));\n\n lv = length(v);\n for( i = 1, lv, lt += length(v[i]));\n M = matrix(lt,lt);\n lt = 0;\n for( i = 1, lv,\n my( lvi = length(v[i]));\n for( j = 1, lvi,\n for( k = 1, lvi,\n M[lt+j,lt+k] = v[i][j,k]));\n lt += lvi\n );\nreturn(M);\n}\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ LINEAR ALGEBRA \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n\\\\ Gives a unimodular matrix with the last column equal to v.\n\\\\ redflag = 0 or 1. If redflag = 1, then the n-#v first columns are reduced.\n{completebasis(v,redflag=0) =\nmy(Mv,U,re);\nmy(n);\n\n if( type(v) != \"t_COL\" && type(v) != \"t_MAT\",\n error(\"wrong type in completebasis\"));\n\n if( type(v) == \"t_COL\", Mv = Mat(v), Mv = v);\n n = length(Mv[,1]);\n if( n == length(Mv), return(Mv));\n U = (mathnf(Mv~,1)[2]~)^-1;\n if( n==1 || !redflag, return(U));\n\\\\ extract the n-#v columns and LLL-reduce them\n re = qflll(vecextract(U,1<= 4, print(\" starting qflocalinvariants \",G));\n\n\\\\ convert G into a vector of symmetric matrices\n if( type(G) == \"t_VEC\", vG = G , vG = [G]);\n lG = length(vG);\n for( j = 1, lG,\n if( type(vG[j]) == \"t_QFI\" || type(vG[j]) == \"t_QFR\",\n vG[j] = Mat(vG[j])));\n\n\\\\ compute the factorization of -2*abs(det(G))\n if( !length(fa), \n fa = (factor(-abs(2*matdet(vG[1])))[,1]));\n\n\\\\ in dimension 2, each invariant is a single Hilbert symbol.\n if( length(vG[1]) == 2,\n sol = matrix(length(fa),lG,i,j,\n myhilbert(vG[j][1,1],-matdet(vG[1]),fa[i]) < 0);\nif( DEBUGLEVEL_qfsolve >= 4, print(\" end of qflocalinvariants\"));\n return([fa,sol])\n );\n\n sol = matrix(length(fa),lG);\n for( j = 1, lG,\n my( n = length(vG[j]));\n\\\\ in dimension n, we need to compute a product of n Hilbert symbols.\n vdet = vector(n+1, i, matdet(matrix(i-1,i-1,k,m,vG[j][k,m])));\n for( i = 1, length(fa),\n my( p = fa[i]);\n my( h = 1);\n for( k = 1, n-1, h *= myhilbert(-vdet[k],vdet[k+1],p));\n h *= myhilbert(vdet[n],vdet[n+1],p);\n sol[i,j] = h < 0;\n )\n );\nif( DEBUGLEVEL_qfsolve >= 4, print(\" end of qflocalinvariants\"));\nreturn([fa,sol]);\n}\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ QUADRATIC FORMS REDUCTION \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n\\\\ M = [a,b;b;c] has integral coefficients.\n\\\\ Gauss reduction of the binary quadratic form\n\\\\ qf = (a,b,c)=a*X^2+2*b*X*Y+c*Y^2\n\\\\ Returns the reduction matrix with det = +1.\n{qfbreduce(M) =\nmy(H,di,aux);\nmy(a,b,c,q,r,nexta,nextb,nextc);\nmy(test);\n\nif( DEBUGLEVEL_qfsolve >= 5, print(\" starting qfbreduce with \",M));\n\n a = M[1,1]; b = M[1,2]; c = M[2,2];\n\n H = matid(2); test = 1;\n while( test && a,\n di = divrem(b,a); q = di[1]; r = di[2];\n if( 2*r > abs(a), r -= abs(a); q += sign(a));\n H[,2] -= q*H[,1];\n nextc = a; nextb = -r; nexta= (nextb-b)*q+c;\n\n test = abs(nexta) < abs(a);\n if( test,\n c = nextc; b = nextb; a = nexta;\n aux = H[,1]; H[,1] = -H[,2]; H[,2] = aux\n )\n );\n\nif( DEBUGLEVEL_qfsolve >= 5, print(\" end of qfbreduce with \",H));\nreturn(H);\n}\n\n\\\\ Performs first a LLL reduction on a positive definite\n\\\\ quadratic form QD bounding the indefinite G.\n\\\\ Then finishes the reduction with qfsolvetriv().\n{qflllgram_indef(G,c=1,base=0) =\nmy(M,QD,M1,S,red);\nmy(n);\n\nif( DEBUGLEVEL_qfsolve >= 4, print(\" qflllgram_indef with G = \",G));\n n = length(G);\n M = matid(n);\n QD = G;\n for( i = 1, n-1,\n if( !QD[i,i],\n return(qfsolvetriv(G,base))\n );\n M1 = matid(n);\n M1[i,] = -QD[i,]/QD[i,i];\n M1[i,i] = 1;\n M = (M*M1);\n QD = (M1~*QD*M1)\n );\n M = (M^(-1));\n QD = (M~*abs(QD)*M);\n S = qflllgram(QD/content(QD));\n if( #S < n, S = completebasis(S));\n red = qfsolvetriv(S~*G*S,base);\n if( type(red) == \"t_COL\",\n red = (S*red);\n return(red));\n red[2] = S*red[2];\n if( length(red) == 3,\n red[3] = S*red[3]);\nreturn(red);\n}\n\n\\\\ LLL reduction of the quadratic form G (Gram matrix)\n\\\\ where we go on, even if an isotropic vector is found.\n{qflllgram_indefgoon(G,c=1) =\nmy(red,U1,G2,U2,G3,U3,G4,U,V,B,U4,G5,U5,G6);\nmy(n);\n\n red = qflllgram_indef(G,c,1);\n\\\\ If no isotropic vector is found, nothing to do.\n if( length(red) == 2, return(red));\n\\\\ otherwise a solution is found:\n U1 = red[2];\n G2 = red[1]; \\\\ On a G2[1,1] = 0\n U2 = mathnf(Mat(G2[1,]),4)[2];\n G3 = U2~*G2*U2;\n\\\\ The first line of the matrix G3 only contains 0,\n\\\\ except some 'g' on the right, where g^2| det G.\n n = length(G);\n U3 = matid(n); U3[1,n] = round(-G3[n,n]/G3[1,n]/2);\n G4 = U3~*G3*U3;\n\\\\ The coeff G4[n,n] is reduced modulo 2g\n U = vecextract(G4,[1,n],[1,n]);\n if( n == 2,\n V = matrix(2,0)\n , V = vecextract(G4,[1,n],1<<(n-1)-2));\n B = round(-U^-1*V);\n U4 = matid(n);\n for( j = 2, n-1,\n U4[1,j] = B[1,j-1];\n U4[n,j] = B[2,j-1]\n );\n G5 = U4~*G4*U4;\n\\\\ The last column of G5 is reduced\n if( n < 4, return([G5,U1*U2*U3*U4]));\n\n red = qflllgram_indefgoon(matrix(n-2,n-2,i,j,G5[i+1,j+1]),c);\n U5 = matdiagonalblock([Mat(1),red[2],Mat(1)]);\n G6 = U5~*G5*U5;\nreturn([G6,U1*U2*U3*U4*U5]);\n}\n\n\\\\ LLL reduction of the quadratic form G (Gram matrix)\n\\\\ in dim 3 only, with detG = -1 and sign(G) = [2,1];\n{qflllgram_indefgoon2(G,c=1) =\nmy(red,U1,G2,bez,U2,G3,U3);\nmy(cc);\n\n red = qflllgram_indef(G,c,1);\n\\\\ We always find an isotropic vector.\n U1 = [0,0,1;0,1,0;1,0,0];\n G2 = U1~*red[1]*U1;\n\\\\ G2 has a 0 at the bottom right corner.\n bez = bezout(G2[3,1],G2[3,2]);\n U2 = [bez[1],G2[3,2]/bez[3],0;bez[2],-G2[3,1]/bez[3],0;0,0,-1];\n G3 = U2~*G2*U2;\n\\\\ G3 has 0 under the co-diagonal.\n cc = (G3[1,1])%2;\n U3 = [1,0,0; cc,1,0;\n round(-(G3[1,1]+cc*(2*G3[1,2]+G3[2,2]*cc))/2/G3[1,3]),\n round(-(G3[1,2]+cc*G3[2,2])/G3[1,3]),1];\n\nreturn([U3~*G3*U3,red[2]*U1*U2*U3]);\n}\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ CLASS GROUP COMPUTATIONS \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n\\\\ Compute the square root of the quadratic form qfb.\n\\\\ This function is not fully implemented.\n\\\\ For the moment it only works for detqfb squarefree\n\\\\ (except at 2, where the valuation is 2 or 3).\n\\\\ factdet must be given and equal to factor(2*abs(det qfb))\n{qfbsqrt(qfb,factdet) =\nmy(G,m,n);\nmy(a,b,c,d,p);\nmy(aux,Q1,M);\n\nif( DEBUGLEVEL_qfsolve >=3, print(\" starting qfbsqrt with \",qfb,factdet));\n G = Vec(qfb);\n a = G[1]; b = (G[2]/2); c = G[3]; d = a*c-b^2;\n\n\\\\ 1st step: solve m^2 = a (d), m*n = -b (d), n^2 = c (d)\n m = n = Mod(1,1);\n factdet[1,2] -= 3;\n for( i = 1, length(factdet[,1]),\n if( !factdet[i,2], next);\n p = factdet[i,1];\n if( gcd(a,p) == 1,\n aux = sqrt(Mod(a,p));\n m = chinese(m,aux);\n n = chinese(n,-b/aux)\n ,\n aux = sqrt(Mod(c,p));\n n = chinese(n,aux);\n m = chinese(m,-b/aux)\n )\n );\n m = centerlift(m);\n n = centerlift(n);\nif( DEBUGLEVEL_qfsolve >=4, print(\" m = \",m); print(\" n = \",n));\n\n\\\\ 2nd step: build Q1, with det=-1 such that Q1(x,y,0) = G(x,y)\n Q1 = [(n^2-c)/d, (m*n+b)/d, n ;\n (m*n+b)/d, (m^2-a)/d, m ;\n n, m, d ];\n Q1 = -matadjoint(Q1);\n\n\\\\ 3rd step: reduce Q1 to [0,0,-1;0,1,0;-1,0,0]\n M = qflllgram_indefgoon2(Q1)[2][3,];\n if( M[1] < 0, M = -M);\nif( DEBUGLEVEL_qfsolve >=3, print(\" end of qfbsqrt\"));\n if( M[1]%2,\n return(Qfb(M[1],2*M[2],2*M[3]))\n , return(Qfb(M[3],-2*M[2],2*M[1])));\n}\n\n\\\\ Implementation of Shanks/Bosma-Stevenhagen algorithm\n\\\\ to compute the 2-Sylow of the class group of discriminant D.\n\\\\ Only works for D = fundamental discriminant.\n\\\\ When D = 1(4), work with 4D.\n\\\\ If given, factdetG must be equal to factor(abs(2*D)).\n\\\\ Apart from this factorization, the algorithm is polynomial time.\n\\\\ If Winvariants is given, the algorithm stops as soon as\n\\\\ an element having these W-invariants is found.\n{quadclass2(D,factdetG,Winvariants,U2) =\nmy(factD,listgen,E,invgen,im,Ker,Kerim,listgen2,G2,clgp2,red,auxg);\nmy(p,aux);\nmy(n,rang,m,vD,vp);\n\nif( DEBUGLEVEL_qfsolve >= 1, print(\" Construction of the 2-class group of discriminant \",D));\n if( D%4 == 2 || D%4 == 3, error(\"quadclass2: Discriminant not congruent to 0,1 mod 4\"));\n\n if( D==-4, return([[1],[Qfb(1,0,1)]]));\n\n if( !factdetG, factdetG = factor(2*abs(D)));\n factD = concat([-1],factdetG[,1]~);\n if( D%4 == 1, D *= 4; factdetG[1,2] += 2);\n\n n = length(factD); rang = n-3;\n if(D>0, m = rang+1, m = rang);\n if(m<0, m=0);\nif( DEBUGLEVEL_qfsolve >= 3, print(\" factD = \",factD));\n listgen = vector(m);\n\n vD = valuation(D,2);\n if( vD,\n E = Qfb(1,0,-D/4)\n , E = Qfb(1,1,(1-D)/4)\n );\nif( DEBUGLEVEL_qfsolve >= 3, print(\" E = \",E));\n\n if( type(Winvariants) == \"t_COL\"\n && (Winvariants == 0\n || length(matinverseimage(U2*Mod(1,2),Winvariants))>0)\n , return([[1],[E]]));\n\n for( i = 1, m, \\\\ no need to look at factD[1]=-1, nor factD[2]=2\n p = factD[i+2];\n vp = valuation(D,p);\n aux = (p^vp);\n if( vD,\n listgen[i] = Qfb(aux,0,-D/4/aux)\n , listgen[i] = Qfb(aux,aux,(aux-D/aux)/4))\n );\n if( vD == 2 && D%16 != 4,\n m++; rang++; listgen = concat(listgen,[Qfb(2,2,(4-D)/8)]));\n if( vD == 3,\n m++; rang++; listgen = concat(listgen,[Qfb(2^(vD-2),0,-D/2^vD)]));\n\nif( DEBUGLEVEL_qfsolve >= 3, print(\" listgen = \",listgen));\nif( DEBUGLEVEL_qfsolve >= 2, print(\" rank = \",rang));\n\n if( !rang, return([[1],[E]]));\n\n invgen = qflocalinvariants(listgen,factD)[2]*Mod(1,2);\nif( DEBUGLEVEL_qfsolve >= 3, print(\" invgen = \",lift(invgen)));\n\n clgp2 = vector(m,i,2);\n im = lift(matinverseimage(invgen,matimage(invgen)));\n while( (length(im) < rang) \n || (type(Winvariants) == \"t_COL\" && length(matinverseimage(concat(invgen,U2),Winvariants) == 0)),\n Ker = lift(matker(invgen));\n Kerim = concat(Ker,im);\n listgen2 = vector(m);\n for( i = 1, m,\n listgen2[i] = E;\n for( j = 1, m,\n if( Kerim[j,i],\n listgen2[i] = qfbcompraw(listgen2[i],listgen[j])));\n if( norml2(Kerim[,i]) > 1,\n red = qfbreduce(auxg=Mat(listgen2[i]));\n auxg = red~*auxg*red;\n listgen2[i] = Qfb(auxg[1,1],2*auxg[1,2],auxg[2,2]))\n );\n listgen = listgen2;\n invgen = invgen*Kerim;\n\nif( DEBUGLEVEL_qfsolve >= 4, print(\" listgen = \",listgen));\nif( DEBUGLEVEL_qfsolve >= 4, print(\" invgen = \",lift(invgen)));\n\n for( i = 1, length(Ker),\n G2 = qfbsqrt(listgen[i],factdetG);\n clgp2[i] <<= 1;\n listgen[i] = G2;\n invgen[,i] = qflocalinvariants(G2,factD)[2][,1]*Mod(1,2)\n );\n\nif( DEBUGLEVEL_qfsolve >= 3, print(\" listgen = \",listgen));\nif( DEBUGLEVEL_qfsolve >= 3, print(\" invgen = \",lift(invgen)));\nif( DEBUGLEVEL_qfsolve >= 3, print(\" clgp2 = \",clgp2));\n\n im = lift(matinverseimage(invgen,matimage(invgen)))\n );\n\n listgen2 = vector(rang);\n for( i = 1, rang,\n listgen2[i] = E;\n for( j = 1, m,\n if( im[j,i],\n listgen2[i] = qfbcompraw(listgen2[i],listgen[j])));\n if( norml2(im[,i]) > 1,\n red = qfbreduce(auxg=Mat(listgen2[i]));\n auxg = red~*auxg*red;\n listgen2[i] = Qfb(auxg[1,1],2*auxg[1,2],auxg[2,2]))\n );\n listgen = listgen2;\n\\\\ listgen = vector(rang,i,listgen[m-rang+i]);\n clgp2 = vector(rang,i,clgp2[m-rang+i]);\n\nif( DEBUGLEVEL_qfsolve >= 2, print(\" listgen = \",listgen));\nif( DEBUGLEVEL_qfsolve >= 2, print(\" clgp2 = \",clgp2));\n\nreturn([clgp2,listgen]);\n}\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ QUADRATIC EQUATIONS \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n\\\\ Try to solve G = 0 with small coefficients\n\\\\ This is proved to work if\n\\\\ - det(G) = 1, dim <= 6 and G is LLL reduced\n\\\\\n\\\\ Returns [G,matid] if no solution is found.\n\\\\ Exit with a norm 0 vector if one such is found.\n\\\\ If base == 1 and norm 0 is obtained, returns [H~*G*H,H,sol] where\n\\\\ sol is a norm 0 vector and is the 1st column of H.\n{qfsolvetriv(G,base=0) =\nmy(n);\nmy(H,sol,GG);\n\n n = length(G);\n H = matid(n);\n\n\\\\ case 1: A basis vector is isotropic\n for( i = 1, n,\n if( G[i,i] == 0,\n sol = H[,i];\n if( base == 0, return(sol));\n H[,i] = H[,1]; H[,1] = sol;\n return([H~*G*H,H,sol])\n )\n );\n\n\\\\ case 2: G has a block +- [1,0;0,-1] on the diagonal\n for( i = 2, n,\n if( G[i-1,i] == 0 && G[i-1,i-1]*G[i,i] == -1,\n H[i-1,i] = -1; sol = H[,i];\n if( base == 0, return(sol));\n H[,i] = H[,1]; H[,1] = sol;\n return([H~*G*H,H,sol])\n )\n );\n\n\\\\ case 3: a principal minor is 0\n for( i = 1, n,\n GG = vecextract(G,1<=3;\n{qfsolvemodp(G,p) =\nmy(vdet,G2,sol,x1,x2,x3,N1,N2,N3,s);\nmy(r);\nmy(n);\n\n n = length(G);\n vdet = [0,0,0];\n for( i = 1, 3,\n G2 = vecextract(G,1< G=[1637490518557, -9118398255553, -17114399686722; -9118398255553, -40039266946520, 44178901566187; -17114399686722, 44178901566187, 150094052078168];\n gp > qflllgram_indef(G)\n %1 = [-24749181067550, 1904107022307, -3382470700136]~\n\");\n}\n" }, { "path": "anc/code/common/simon_ell/resultant3.gp", "size_bytes": 8569, "sha256": "a195c027027ffd7e1134fbe1dfe88be2375e442a810c3ba51264701e885893b8", "mode": 420, "language": "PARI/GP", "encoding": "utf-8", "text": "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ Copyright (C) 2014 Denis Simon\n\\\\\n\\\\ Distributed under the terms of the GNU General Public License (GPL)\n\\\\\n\\\\ This code is distributed in the hope that it will be useful,\n\\\\ but WITHOUT ANY WARRANTY; without even the implied warranty of\n\\\\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\\\\ General Public License for more details.\n\\\\\n\\\\ The full text of the GPL is available at:\n\\\\\n\\\\ http://www.gnu.org/licenses/\n\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n/*\n Auteur :\n Denis SIMON -> simon@math.unicaen.fr\n adresse du fichier :\n www.math.unicaen.fr/~simon/resultant3.gp\n\n *********************************************\n * VERSION 13/01/2014 *\n *********************************************\n\n Ce fichier gp contient des fonctions pour calculer\n le resultant de trois polynomes p1, p2, p3 homogenes\n en trois variables (toujours x,y,z), ainsi que\n le discriminant d'un polynome homogene en ces trois variables.\n L'algorithme utilise est celui du sous-resultant.\n\n\n exemple d'utilisation :\n\n ? p1=x^2-3*z^2+y*z;p2=x-y+15*z;p3=y^2*x+z^3-x*y*z+x^2*z;\n ? resultant3([p1,p2,p3])\n %2 = 521784\n ? discriminant3(p3)\n %3 = -63\n\n la fonction hom sert a rendre homogene un polynome en x et y:\n ? ell=y^2-y-x^3+x^2;\n ? discriminant3(hom(ell))\n %5 = -11\n\n*/\n\nglobal(DEBUGLEVEL_res):small;\n\n DEBUGLEVEL_res = 0; \\\\ si DEBUGLEVEL_res = 1 : afficher des resultats intermediaires.\n\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\\\\ SCRIPT \\\\\n\\\\ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\n\n{default_res(\n DEBUGLEVEL_res_val:small = 0\n ) =\n\n DEBUGLEVEL_res = DEBUGLEVEL_res_val;\n print(\" DEBUGLEVEL_res = \",DEBUGLEVEL_res);\n}\n{hom(p) =\n p = substvec(p,['x,'y],['x/'z,'y/'z]);\n p /= 'z^valuation(p,'z);\nreturn(p);\n}\n{degreetot(p) =\n\\\\ degre d'un polynome homogene.\nmy(auxdeg,auxp);\n\n auxdeg = poldegree(p,'x); auxp = pollead(p,'x);\n auxdeg += poldegree(auxp,'y); auxp = pollead(auxp,'y);\n auxdeg += poldegree(auxp,'z); auxp = pollead(auxp,'z);\nreturn(auxdeg);\n}\n{ex( vec, i, j) =\nmy(aux);\n aux = vec[i]; vec[i] = vec[j]; vec[j] = aux;\nreturn(vec);\n}\n{mycontent(p) =\nmy(vz,co,dco);\n vz = valuation(p,'z);\n p = subst(p,'z,1);\n co = content(p);\n dco = poldegree(co,'y);\n if( dco, co = subst(co,'y,'y/'z)*'z^dco);\nreturn(co*'z^vz);\n}\n{myresultant2( p, q) =\nmy(dp,dq,valp,valq,auxr,auxp,auxq,res);\n\n if( p==0 || q==0, return(0));\n dp = degreetot(p); valp = valuation(p,'y);\n dq = degreetot(q); valq = valuation(q,'y);\n if( valp && valq, return(0));\n auxr = 1;\n if( valp,\n if(dq%2 && valp%2, auxr = -1);\n auxr *= pollead(q,'x)^valp\n );\n if( valq,\n auxr = pollead(p,'x)^valq\n );\n auxp = subst(p,'y,1);\n auxq = subst(q,'y,1);\n res = auxr*polresultant(auxp,auxq,'x);\nreturn(res);\n}\n{resultantcomp(vp=['x,'y,'z]) =\n\\\\ les vp[i] sont des pol homogenes en x,y et z.\n\\\\ vp[3] ne depend que de y et z.\nmy(p,q,rt,dp,dq,drt,vy,vz,lrt,lp,res,aux,res2,dres2);\n\n p = vp[1]; q = vp[2]; rt = vp[3];\n if( p==0 || q==0 || rt==0, return(0));\n dp = degreetot(p); dq = degreetot(q); drt = degreetot(rt);\n if( drt == 0, return(rt^(dp*dq)));\n vy = valuation(rt,'y); vz = valuation(rt,'z);\n rt = subst(rt,'y,1); if( vz, rt /= 'z^vz);\n lrt = polcoeff(rt,drt,'z); lp = polcoeff(p,dp,'x);\n res = 1;\n if( lp == 0,\n aux = p; p = q; q = aux;\n aux = dp; dp = dq; dq = aux;\n if( dp%2 && dq%2 && drt%2, res = -res);\n lp = polcoeff(p,dp,'x);\n if( lp == 0, return(0))\n );\n if( vy,\n if( dp%2 && dq%2, res2 = -1, res2 = 1);\n res2 *= myresultant2(subst(subst(p,'y,0),'z,'y),subst(subst(q,'y,0),'z,'y));\n res2 *= myresultant2(subst(subst(p,'y,0),'z,'y),subst(subst(q,'y,0),'z,'y));\n if( res2 == 0, return(0));\n res *= res2^vy\n );\n if( vz,\n res2 = myresultant2(subst(p,'z,0),subst(q,'z,0));\n if( res2 == 0, return(0));\n res *= res2^vz\n );\n drt -= vy+vz;\n if( drt == 0, return(res*rt^(dp*dq)));\n res2 = polresultant(subst(p,'y,1),subst(q,'y,1),'x);\n dres2 = poldegree(res2,'z);\n res2 = polresultant(rt,res2,'z);\n res *= res2;\n if( dq != poldegree(subst(q,'y,1),'x),\n res *= lp^(drt*(dq-poldegree(subst(q,'y,1),'x))));\n if( dres2 != dp*dq,\n res *= pollead(rt,'z)^(dp*dq-dres2));\nreturn(res);\n}\n{resultant3(vp=['x,'y,'z]) =\n\\\\ resultant de 3 polynomes homogenes en x,y,z.\n\\\\ on travaille sur la variable x.\nmy(vdt,vdx,prodd,s,denom,nume,lp,p0,q0,r0,dd,cq,rm,res,delta);\n\n for( i = 1, 3,\n if( vp[i] == 0, return(0)));\n vdt = vector(3,i,degreetot(vp[i]));\n vdx = vector(3,i,poldegree(vp[i],'x));\n if( vecmin(vdt-vdx), return(0));\n\\\\ en effet, dans ce cas, les polynomes sont dans l'ideal \n\n prodd = prod( i = 1, 3, vdt[i]);\n s = 1;\n denom = 1; nume = 1;\n\n\\\\ on echange pour que vdx[1] >= vdx[2] >= vdx[3]\n if(vdx[1]