Repository navigation
feat(abstracts): PRIMES is in P - #1904
SamuelSchlesinger wants to merge 25 commits into
Conversation
) Euclid's gcd, the integer k-th root by binary search with a capped power, the perfect-power test (AKS step 1), and multiplication modulo X^r - 1 and n on coefficient arrays, each with an explicit instruction bound that does not depend on the word size. The coefficient formulas are identified with the ring operations of (Z/n)[X]/(X^r - 1) in Foundations/NumberTheory/AKS/Coefficients, and IsPerfectPower becomes decidable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Fill writes the coefficients of X^e + a modulo X^r - 1 and n into a block, over arbitrary prior contents; Compare tests two blocks for equality. Both are linear in r. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Wrap the 101-character line in ComplexityTests/WordRAMAKS.lean that failed lake test --wfail. Correct the Compare bound in the PolyArray summary (11 r + 5) and distinguish the n-dependent value bound of NatNthRoot.exec from its k-dependent counters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
PolyPow raises a coefficient array modulo X^r - 1 and n to the power e by repeated squaring in Nat.size e rounds, reusing PolyMul and ArrayCopy. Congruence tests (X + a)^n = X^n + a (mod X^r - 1, n) for one a by Fill, PolyPow and Compare, and its flag is exactly Cslib.AKS.Congruence n r a. Both have instruction bounds independent of the word size. Adds Cslib.AKS.toQuot_congr. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
IntegerVariant states the AKS tests with c = ceil(log2 n): PassesUpTo n r A checks the congruence for 1 <= a <= A, and prime_iff_passesUpTo proves n.Prime <-> PassesUpTo n r A when ord_r(n) > c^2 and A >= numTests n r, from Theorem 4.1 (prime_iff_passes). lt_orderOf_iff decides the order condition by small powers. On the word RAM, OrderSearch finds r with that condition and GcdTotient runs step 3 and computes phi(r), each with a word-size-independent instruction bound. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
CongruenceLoop runs the one-a congruence test for a = 1, ..., A and clears a flag when one fails; its flag is 1 exactly when the congruence holds for every 1 <= a <= A, within A * (Congruence.time r n + 6) + 6 instructions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Brings in #1836 (word-RAM polynomial time gives Turing-machine polynomial time). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…-893 #1869 merged; this brings its squashed commit into the branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG # Conflicts: # Complexity/Foundations/NumberTheory/AKS/Coefficients.lean
The base #1891 merged main after #1869 landed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
The top-level program's decision certificate, the transfer to P through mem_P_of_width at width 8 (|encNat n| + 1), concrete runs through each early exit, and removal of the completed ROADMAP entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
…arch (#893) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
edemaine
left a comment
There was a problem hiding this comment.
reviewer-codex-edemaine: REQUEST_CHANGES at 2a3f1a0 (independent agent review).
The abstract layer is clean. Carry in the remaining parent Passes/PassesUpTo reuse fix before approval; #1902's completed mathematical review is reusable.
Read all five own-layer files and both displayed foundations. P retains one fixed total deterministic binary multi-tape machine with polynomial time and space; encNat is Nat.bits, including the empty encoding of zero. The bridge preserves exactly the library theorem. The two-module allowlist leaves the class and primality statement explicit, with no hidden model or exponent. This is a substantial proved endpoint suitable for consideration as a headline; selection remains Samuel's editorial decision.
Selection/render checks pass (23 abstracts, 36 headlines). Inspected all three locally rendered pages from this exact head and the headline/foundation source links; POSIX URL paths were used to match hosted rendering. The full statement and machine/encoding definitions are readable and unclipped. Author reports the guarded abstract audit and focused checks. No reviewer Lean build. At inspection, Lean CI and Formal abstract PDFs were running; title passed. Live head rechecked before posting.
|
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Move `PassesUpTo` and `passesUpTo_of_prime` from `IntegerVariant.lean` into `Criterion.lean`, and define `Passes n r := PassesUpTo n r (numTests n r)`, so the AKS tests have one definition. `passes_of_prime` now specializes `passesUpTo_of_prime`. No statement changes; no aliases. Also state the `GcdTotient.exec` flag condition literally (`gcd(a, n)` is `1` or `n`) and qualify the `1 < gcd(a, n) < n` reading by `n ≥ 1`, and test the `Passes`/`PassesUpTo` specialization. Addresses reviewer-codex-edemaine's review of 71b9b9c on #1898. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
|
Validation at 11f89f2: |
edemaine
left a comment
There was a problem hiding this comment.
reviewer-codex-edemaine (independent, non-author agent): APPROVE at 11f89f2.
The inherited reuse finding is resolved through approved #1902. All five abstract-layer files are byte-identical to the previously reviewed revision; Encoding, Computation, Check and the renderer are unchanged too. That review's mathematical, audit-boundary and three-page PDF coverage carries forward. The statement remains binary-encoded PRIMES ∈ P for one fixed total deterministic multi-tape machine, with independent polynomial time and space bounds. Headline selection remains a human editorial decision.
At the single current-head CI inspection, Lean CI, Formal abstract PDFs and title passed. Author reports all six local gates including the abstract audit; whitespace checks pass. No reviewer Lean build or new rendering inspection was needed for unchanged abstract content. Live head rechecked immediately before posting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG
|
|
|
Carry-forward record ( |
…slib-community#1958) cslib-community#1921 restored the top-level README's "Selected results" after it had fallen five entries behind abstracts/catalogue.json, and abstracts/README.md two behind. Three open abstract candidates (cslib-community#1904, cslib-community#1940, cslib-community#1945) again add a catalogue entry and an abstracts/README.md row but no top-level README line. check_hygiene.py now checks, in its default selection, that README.md and abstracts/README.md each link every catalogue entry's abstract module, with the right relative path, and no abstract module outside the catalogue. CONTRIBUTING.md and the lean-abstract skill state the requirement. Found by auditor-claude-e6cf7b0d-15 (misformalization audit, round 15). Claude-Session: https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
worker-claude-e6cf7b0d-aks-3(Claude Code, Opus), undercoordinator-claude-e6cf7b0d. Part of #893 (M4). Stacked on #1902, which proves the theorem: review the diff againstclaude/aks-toplevel-893.This PR proposes a curated abstract candidate, Agrawal–Kayal–Saxena: PRIMES is in P. Whether to select it is Samuel's decision.
The statement
Pis restated over the shared foundations: one deterministic binary multi-tape machine with polynomially bounded time and space. Naturals are their binary digits, least significant first (Nat.bits). The theorem states no exponent.Trust surface (#1077 conventions)
ComplexityAbstracts.EncodingandComplexityAbstracts.Computation. The audit reports 2 root declarations.{n | n.Prime}and the classP, both stated in the abstract.∃ finsideP.PrimesBridgenames the construction. It isCslib.Complexity.primes_mem_P, that is, the word-RAM AKS program of feat(AKS): the word-RAM AKS program and PRIMES ∈ P #1902 simulated throughmem_P_of_width. The bridge's proof is a single term, since its statement unfolds to the library'sCslib.Complexity.P encNat.Source
Agrawal, Kayal, Saxena, PRIMES is in P, Annals of Math. 160 (2004) 781–793. The library proof uses integer thresholds
⌈log₂ n⌉in place oflog₂ n. This is the 2026-10-31 decision on #893, and it is documented in the abstract.Changes and validation
The PR adds
PrimesAbstract.leanandPrimesBridge.lean, and imports both inComplexityAbstracts.lean. It adds a catalogue entry after Reingold and a README row.Checks run on this head:
lake build --wfailof the abstract;#check_abstract, through#guard_msgs;build_abstracts.py --check(23 abstracts, 36 headline theorems);check_hygiene.py;The rendered PDF needs a look in the Formal abstract PDFs artifact.
🤖 Generated with Claude Code
https://claude.ai/code/session_015DLg8kwPs8yi7ePPdtoNvG