# AGENTS.md Read [README.md](README.md) first, then `KNOWN.md`. `main` is ECCompute: Lean that certifies lower bounds on the ranks of explicit elliptic curves, every check reduced in the kernel. What we want is that library made readable, and more curves and better bounds certified with it. Never describe a change here as progress on the Birch and Swinnerton-Dyer conjecture: a rank lower bound for a named curve says nothing about its L-function, and the statements in `Challenge.lean` are fixed. ## First session In your clone of this project, with Python 3 and no Lean: ```bash python3 checks/challenge.py . # last line: ok: 4 challenge files and the build configuration as approved; … git fetch origin issues && git show origin/issues:BOARD.md # the pieces, and who works on what cat Curves/Curve302.lean # one certified curve: the literal, one certify_curve call, rank ≥ 31 head -5 data/curve302.txt data/curve302-labels.txt # its points, and its descent characters (p, θ) ``` Then pick one piece nobody holds. Each issue says what to do, what it needs (a script and no Lean, compiling a few files, or a full build on a large machine), when it closes and what it does not show. By what you have: - **No Lean, a script**: V-8 (the 480 against the leaderboard), V-7 (check the 480 certificates with a program of your own), V-11 (where the certified bound is the known rank), V-9 (what "exactly 32" rests on), L-1 (one row of the table), P-3 or P-5 (the descent argument for a reader). - **A laptop with elan** (the library and its 480 curves build in minutes on Mathlib's cache): V-5 (rebuild, print the axioms, record it), then S-1 (certify one leaderboard curve: name its id in your route first), S-13, P-1, M-1. - **A large machine, or days**: a band of curves (S-6 to S-10), S-3 (the rank ≥ 32 records), S-14, V-3, R-3. ## Reruns and readings A rerun of anything (this project, a claim made elsewhere, a published table) is a dated record in `routes//RERUN.md`, one section per run, never replaced: a later run is a new section. The one template: ```markdown ## 2026-12-02: , by () - Machine: ; - Image: - Commit: - Command: - What it printed: - What was not checked: ``` A reading (a declaration against Cremona's paper, what a paper's theorem needs) is a note in the path its piece names, each verdict with the page and line it rests on. Both close when a second party (someone else's agent, or the house's maintainer agent) has checked them and said so in a review. A rerun says what ran; it never says a claim is true beyond what ran, and a rank bound never says anything about BSD. ## Claim an issue Work on a branch of your own, and say what you take in its notes: ```bash git switch -c my-change origin/main mkdir -p routes/my-change cat > routes/my-change/README.md <<'EOF' --- issue: 3 status: working --- # my-change Which files, and what I change in them. ## Next The first concrete step. EOF ``` A push keeps the claim alive. If you stop, leave `## Next` so whoever continues knows where you stopped. Your change itself is in the Lean files (and `data/` for a curve), anywhere in the repository; the notes say what it is. ## Changes we want - Docstrings, names and lemma structure in `ECCompute/Theory`, `ECCompute/Soundness` and `ECCompute/Tactic` that let a reader follow Cremona's descent argument from `HasRankGE` down to the `Bool` checkers. - Using a result from Mathlib in place of our own proof of it, and deleting ours; or moving a lemma from `ECCompute/ForMathlib/` into a Mathlib pull request and, once merged and bumped, deleting ours. Check that the statements agree, hypotheses included. - A new curve: `Curves/CurveNNN.lean` in upstream's form (the curve as a literal, one `certify_curve` call, its `IsElliptic` instance and `j`-invariant) with its `data/` files, and its line in `Curves.lean`. Or a better bound for a curve that is there: more points and characters in its data, and the theorem's `k` raised. - Making `certify_curve` or the checkers faster in the kernel, measured on the curves that take longest. - Fixing linter warnings, wrong docstrings and open issues. ## Changes we don't want - `native_decide`, `implemented_by`, `extern`, `ofReduceBool` or anything else that asks the compiler rather than the kernel: the `challenge` check fails the first three, and a maintainer refuses the rest. - A rank bound, or a point, computed elsewhere and stated as an axiom or a hypothesis. - Lowering a curve's bound, or deleting a curve, to make a build pass. - Inlining a lemma into its only caller, or folding named steps into one long proof. A step with a name still tells the reader what it proves. - Replacing `simp` with a long `simp only [...]` list, or expanding a tactic into many hand-written steps, to save a second or a few lines. - Adding or changing a reference to the literature without checking it against the source. - Any change to `Statement.lean`, `Challenge.lean`, `comparator.json`, `PrintAxioms.lean` or `checks/`: the `challenge` check fails it, as it fails a change to `lakefile.toml` beyond a `require`'s `rev`, `leanOptions`, `defaultTargets`, `lean_exe` or `[cache]`, a dependency outside leanprover and leanprover-community, a `lakefile.lean`, or files under `.lake/`. A new curve or a better bound is proved without them; to put it in the challenge, say so in the pull request, and a person who maintains the project extends these files in a pull request of their own. If you think a statement is wrong, open an issue titled "Ruling: …" and say why. ## Pull requests Keep each pull request to one change; fixing linter warnings in the files you edit doesn't count as a second one. Compile what you changed if you can (`lake exe cache get`, then `lake build` of the modules you changed); if you cannot, push and let the `build` check say. Either way, open the pull request, and don't write in it that it builds: `build` says that. Titles follow [Mathlib's convention](https://leanprover-community.github.io/contribute/commit.html). In the description, name the issue it answers (`Closes #3`), say in two or three sentences what the change does and why, and keep the title and description in step with the diff when you push more commits. A new curve or bound names the leaderboard id, the bound, who found the points, and where they come from. Leave out timings unless speed is the reason for the change; then give the few numbers a maintainer needs, and say how you measured them. If you want to make the same kind of change in many places, open one pull request first and wait for the maintainer to say we want it before you open the others. ## CI Two checks run on every push, and both gate the merge. Their code is `checks/` at the approved version, so editing it on your branch changes nothing about your verdict. - **`challenge`**, seconds: the Comparator challenge files and the build configuration are as approved, and the source has no `sorry`, `admit`, `axiom`, `native_decide`, `implemented_by` or `extern`. Run it yourself: `python3 checks/challenge.py .` - **`build`** (upstream's `lean_action_ci.yml`), minutes to an hour: in the project's Lean image with no network, `lake build` ends without error, no module reports `sorry`, the 480 theorems use no axiom beyond `propext`, `Classical.choice` and `Quot.sound`, and Comparator accepts the solution. Its last line says what held or what did not; its logs are kept with the job. If you can build, the same locally before you push: `lake exe cache get && lake build && lake env lean PrintAxioms.lean`, then `lake comparator --config comparator.json`; if you cannot, push and let `build` say. A toolchain or Mathlib bump passes `challenge`, but `build` needs a new image first (`docker/README.md`): open an issue for a person who maintains the project rather than a pull request that cannot pass. ## For the maintainer The house's maintainer agent (`bsd-maintainer`) comes about every two hours while people work here, at least twice a day, and within minutes when written to. It reviews (first line ``**Review of ``: **``), does not merge, logs each round on the issue "Maintainer log", and opens `Ruling: …` issues (`needs-person`) for what only a person decides. Here, as an `open` problem: - **Certificates rerun** (skill `verify-claim`): a new curve or bound is rebuilt in the project's Lean image with the approved checks, its points checked against the source it names (LMFDB label or paper), and a control run: the same certificate with one value changed must be refused. The record is a dated `RERUN.md` on a route of the agent's own. - **The ledger** (skill `ledger`) in "Where it stands": each curve and bound with its id, `k`, where its points come from, one of the README's four statuses, and who reproduced it. A request to add a merged curve to the challenge goes to a person. - **Sources watched**: `b-mehta/EllipticCurveRank` (the upstream) and new arXiv preprints on ranks of elliptic curves that a certificate here could check. Judge every pull request against the two lists above: whether ECCompute is easier to read or certifies more after it, and that nothing it proves now rests on anything but the kernel. - **Merge** a change we want once `challenge` and `build` have passed on its head, and the description says what it changes and why. - **Request changes** when the description and the diff disagree, when it is two changes in one, when it is on the second list (say which item), or when a new curve does not say where its points come from. - **Request changes** when `challenge` or `build` failed: quote the check's last line. - **Escalate** a change to the challenge files, to `checks/` or `docker/`, to `lakefile.toml`'s libraries or dependencies, a new dependency, a request to add a merged curve or bound to the challenge, or two reviews that disagree: say in one sentence what a person must decide. - **Close** a repeat of a change already merged or open, pointing to it, and a mass change opened before the first of its kind was wanted. Never merge on the author's word that it builds: only `build` on its head says so. After a merge, add to `KNOWN.md` what changed: a new curve or bound with its id and `k`, a lemma taken from Mathlib with its name.