Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/five-stage-493-fixed-prime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Fixed prime, seven levels and eta 1e-24 on the 493-source five-stage banks
on:
pull_request:
paths:
- 'research/five-stage-493-fixed-prime/**'
- 'research/five-stage-banks-493/**'
- '.github/workflows/five-stage-493-fixed-prime.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
full:
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
repository: CrocSwap/integer-mult-bounds
ref: af3fe331ca60c936229e060681ffccbc1c208678
path: .dependencies/pr234
persist-credentials: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
repository: eumemic/integer-mult-bounds
ref: 13311491eb74a3a9a443ba4e318c68c263f064f0
path: .dependencies/pr210
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
with:
python-version: '3.13'
- run: python -m pip install sympy==1.14.0
- run: python -B research/five-stage-493-fixed-prime/verify.py --pr210-root .dependencies/pr210 --pr234-root .dependencies/pr234 --full
- run: git diff --exit-code
prime-kernel:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
with:
python-version: '3.12'
- name: Install the fixed Lean release in runner temporary storage
run: |
python -m pip install zstandard==0.25.0
curl -fsSL https://github.com/leanprover/lean4/releases/download/v4.24.0/lean-4.24.0-linux.tar.zst -o "$RUNNER_TEMP/lean.tar.zst"
python - <<'PY'
import hashlib,os,tarfile,zstandard
from pathlib import Path
root=Path(os.environ['RUNNER_TEMP'])
expected='b14f5e5159219dd1a1956c3b806813319f5e94ccd5bdfd56f54520609a5bb5ec'
assert hashlib.sha256((root/'lean.tar.zst').read_bytes()).hexdigest()==expected
with (root/'lean.tar.zst').open('rb') as f:
with zstandard.ZstdDecompressor().stream_reader(f) as reader:
with tarfile.open(fileobj=reader,mode='r|') as archive:
archive.extractall(root,filter='data')
PY
echo "$RUNNER_TEMP/lean-4.24.0-linux/bin" >> "$GITHUB_PATH"
- name: Kernel-check the prime in a separate project copy
env:
MATHLIB_CACHE_DIR: ${{ runner.temp }}/mathlib-cache
run: |
cp -R research/five-stage-493-fixed-prime "$RUNNER_TEMP/prime-proof"
cd "$RUNNER_TEMP/prime-proof"
lake update
lake exe cache get Mathlib.NumberTheory.LucasLehmer
lake env lean Prime.lean
35 changes: 35 additions & 0 deletions .github/workflows/five-stage-banks-493.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Verify five-stage banks with the 493-source helper
on:
pull_request:
paths:
- 'research/five-stage-banks-493/**'
- '.github/workflows/five-stage-banks-493.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
full:
runs-on: ubuntu-24.04
timeout-minutes: 90
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
repository: CrocSwap/integer-mult-bounds
ref: af3fe331ca60c936229e060681ffccbc1c208678
path: .dependencies/pr234
persist-credentials: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
repository: eumemic/integer-mult-bounds
ref: 13311491eb74a3a9a443ba4e318c68c263f064f0
path: .dependencies/pr210
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
with:
python-version: '3.13'
- run: python -m pip install sympy==1.14.0
- run: python -B research/five-stage-banks-493/verify.py --pr210-root .dependencies/pr210 --pr234-root .dependencies/pr234 --full
- run: git diff --exit-code
29 changes: 29 additions & 0 deletions .github/workflows/five-stage-banks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Verify five-stage banks
on:
pull_request:
paths:
- 'research/five-stage-banks/**'
- '.github/workflows/five-stage-banks.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
full:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
repository: CrocSwap/integer-mult-bounds
ref: af3fe331ca60c936229e060681ffccbc1c208678
path: .dependencies/pr234
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
with:
python-version: '3.13'
- run: python -m pip install sympy==1.14.0
- run: python -B research/five-stage-banks/verify.py --pr234-root .dependencies/pr234 --full
- run: git diff --exit-code
14 changes: 14 additions & 0 deletions research/five-stage-493-fixed-prime/NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Notice

Fixed prime, seven finite levels and eta = 10^-24 on PR240's banked five-stage bit supplier. Apache-2.0.
Prepared by Rohan Arun (rohanarun) with Anthropic Claude assistance.

Reused, with credit:
- Gabriele Nespoli, PR235 (OpenAI Codex assistance): the fixed-prime rare-density argument, the seven-level
finite bootstrap, the paid q-power overcharge, `Prime.lean`, `lakefile.toml`, `lean-toolchain` and
`base_two_moment.py` (copied unchanged), applied there to PR237.
- Rohan Arun, PR237/PR240: completed width-120 banks and the 493-source five-stage word (unchanged here).
- hcg890 and Jacob Sussman, PR234: five-stage cover, moment engine, outer-47 assembly and finite bill.
- eumemic, PR210 (with Dugongue, PR216, and sennemmi, PR230): the 493-source helper.
- Evan McKinney (PR197), Chafik Boukhalfa (PR200), Avi Eisenberg (PR193), and every contributor credited by
those packages. Original notices remain in the pinned sources.
22 changes: 22 additions & 0 deletions research/five-stage-493-fixed-prime/Prime.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/- Copyright 2026 Gabriele Nespoli. Apache-2.0. Developed with OpenAI Codex.
Lucas-Lehmer criterion and norm_num extension: mathlib contributors.
This verifies prime eligibility only, not the integer multiplication theorem. -/
import Mathlib.NumberTheory.LucasLehmer

theorem fixed_prime_prime : (mersenne 127).Prime :=
lucas_lehmer_sufficiency _ (by simp) (by norm_num)

theorem fixed_prime_value : mersenne 127 = 170141183460469231731687303715884105727 := by
norm_num [mersenne]

theorem fixed_prime_large : 2 ^ 80 < mersenne 127 := by
norm_num [mersenne]

theorem fixed_prime_density :
(0 : ℚ) < 3456000 / 170141183460469231731687303715884105727 ∧
(3456000 / 170141183460469231731687303715884105727 : ℚ) < 1 / 10 ^ 16 := by
norm_num

#print axioms fixed_prime_prime
#print axioms fixed_prime_large
#print axioms fixed_prime_density
38 changes: 38 additions & 0 deletions research/five-stage-493-fixed-prime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Fixed prime and seven finite levels on PR240's five-stage banks

Conditional κ = **709424410568125629699 / 10^24 = 7.09424410568125629699 × 10^-4**.

That is +3.91 × 10^-12 over PR240 (`28376976266399/(4·10^16)` = 7.09424406659975 × 10^-4). PR240's banked five-stage word, its 493-source helper and all of its checks are unchanged. Only three fixed arithmetic parameters change:

| Parameter | PR240 | This |
|---|---|---|
| Rare-class density in the paid moment | envelope 10^-16 | proved 2m^3/q with the fixed prime q = 2^127 − 1, full 32m^2 fallback still paid |
| Finite ordinary levels | 3 | 7 |
| Outer-47 backoff η (β = 10^-9 unchanged) | 10^-12 | 10^-24 |

The first two are PR235's refinement of PR237 (Gabriele Nespoli), applied here to PR240. The third is new: all 47 strict inequalities and 7 margins of PR234's unchanged assembly still hold at η = 10^-24; it adds about 2.1 × 10^-15 on its own.

## Reproduce

```sh
git worktree add --detach ../pr210 13311491eb74a3a9a443ba4e318c68c263f064f0
git worktree add --detach ../pr234 af3fe331ca60c936229e060681ffccbc1c208678
python3 -m pip install sympy==1.14.0
python3 -B research/five-stage-493-fixed-prime/verify.py --pr210-root ../pr210 --pr234-root ../pr234 [--full]
```

The verifier first runs PR240's own verifier from the same checkout (all F2 and integer columns, telescope, five-stage lowering, geometry, primes, finite bill, 231 charts, 176,915 banks and the 60-colouring) and requires PR240's certificate to be reproduced. Then it:

- bisects the coarse saving `177482012714287685545103/(2.5·10^26)` on the 10^-27 grid with PR234's engine, checks both sides with an independent atanh engine, and checks that the old 10^-16 density fails at this point;
- runs seven acyclic levels from the retained completed saving 384599/10^10, with PR234's cutoff checks;
- runs the outer-47 assembly on the 10^-24 κ grid and rejects the next grid point;
- reproduces PR240's published κ with η = 10^-12 and three levels;
- recomputes the fully paid q-power constant with PR240's fresh finite-bill values (coefficient 62,150,081,742,953,667,360 < 2^80 < q).

About 5 minutes; `--full` also runs PR234's fresh verifier (about 10). `certificate.json` holds the key values and the SHA-256 of the complete recomputed record; `--dump PATH` writes the full record. `Prime.lean` kernel-checks q with mathlib's Lucas–Lehmer theorem (CI job `prime-kernel`).

## Scope

This is a conditional finite certificate with exactly PR234/PR240's hypotheses. The large fixed prime makes initialization and table constants enormous but finite and paid, as argued in PR235's PROOF.md. No construction changes.

Prepared by Rohan Arun with Anthropic Claude assistance. Apache-2.0.
63 changes: 63 additions & 0 deletions research/five-stage-493-fixed-prime/base_two_moment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env python3
"""Maintainer arithmetic cross-check of the pinned PR39 certificate.

Uses no producer/checker imports. Counts are inputs, not proved by this script.
80-term rational logarithms and 12-term exponentials independently enclose
the two moments. The accompanying written review addresses their realization.
"""
import argparse
from fractions import Fraction as Q
from hashlib import sha256
import json
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
GRID = 10**30


def require(condition, message):
if not condition:
raise ValueError(message)


def log_unit(x):
require(1 <= x <= 2, "logarithm range")
z = (x-1)/(x+1)
lo = 2*sum((z**(2*j+1)/(2*j+1) for j in range(80)), Q(0))
return lo, lo+2*z**161/(161*(1-z*z))


def log_bounds(x):
k = 0
while x > 2:
x /= 2
k += 1
lo, hi = log_unit(x)
l2, u2 = log_unit(Q(2))
lo, hi = lo+k*l2, hi+k*u2
# Outward rational rounding keeps later certificates compact.
return Q((lo*GRID).__floor__(), GRID), Q((hi*GRID).__ceil__(), GRID)


def exp_bounds(x):
require(0 <= x < 1, "exponential range")
term = total = Q(1)
for j in range(1, 13):
term *= x/j
total += term
tail = term*x/13/(1-x/14)
return total, total+tail


def moment(m, W, entries, saving):
lo = hi = Q(0)
for t, count in entries:
t, count = int(t), int(count)
require(0 < t < m and count > 0, "improper child")
l, u = log_bounds(Q(m, t))
lower = exp_bounds(saving*l)[0]
upper = exp_bounds(saving*u)[1]
lo += Q(t*count, m*W)*lower
hi += Q(t*count, m*W)*upper
return Q((lo*GRID).__floor__(), GRID), Q((hi*GRID).__ceil__(), GRID)

52 changes: 52 additions & 0 deletions research/five-stage-493-fixed-prime/certificate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"beta": "1/1000000000",
"coarse": "177482012714287685545103/250000000000000000000000000",
"coarse_grid": 1000000000000000000000000000,
"complex_saving": "29898197786071/40000000000000000",
"controls": [
"cyclic supplier",
"unattained coarse ordinary leaf",
"corrupt Lucas-Lehmer residue",
"old-density paid moment at new coarse point",
"adjacent coarse and kappa grid points"
],
"depth": 7,
"eta": "1/1000000000000000000000000",
"excluded_coarse": "709928050857150742180413/1000000000000000000000000000",
"full_record_note": "SHA-256 of the compact sorted JSON of the complete recomputed record; write it out with --dump PATH.",
"full_record_sha256": "de8771e266553c196243a2c979de68d42d5423102c69ccca2eef0b2044d7fb6d",
"gain_over_pr240": "3908150629699/1000000000000000000000000",
"kappa": "709424410568125629699/1000000000000000000000000",
"kappa_decimal": "0.000709424410568125629699",
"kappa_grid": 1000000000000000000000000,
"minimum_strict_constraint": "10832642377581035494695296821178533499673945779813408255286918911514209978022657405185936620440519269216604609649967868394833616688605989605177135955517175213216408326174719786469010781230802601418458882803839/15258789062500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"parent_eta": "1/1000000000000",
"parent_eta_seven_level_kappa": "354712205282999181517/500000000000000000000000",
"pr240_certificate_sha256": "9309284d492d5631e794cef134e183c266e96c48715994bdbed7113ce7233362",
"pr240_kappa": "28376976266399/40000000000000000",
"prime": {
"criterion": "Lucas-Lehmer sufficiency, independently kernel-checked in Prime.lean",
"fixed_before_all_widths": true,
"iterations": 125,
"p": 127,
"q": 170141183460469231731687303715884105727
},
"prime_residues_sha256": "6cf3fcaaa2a1b05097bab0a570cfb0f9c1b56efb83ec49aa3dff9a08281dfc5a",
"q_power_bound": {
"coefficient": 62150081742953667360,
"enlarged_role_charge": 654573856200,
"low_matrix_power": 14400,
"original_coefficient": 1567472751689902,
"original_copies": 12,
"per_selector_coefficient": 5088069708,
"route_families": 208450,
"selector_calls": 12211167492,
"strict_upper": "q^14401"
},
"rare_density": "3456000/170141183460469231731687303715884105727",
"relative_gain_over_pr240": "3908150629699/709424406659975000000",
"schema": "five-stage-493-fixed-prime/1",
"six_level_kappa": "354712205284062814807/500000000000000000000000",
"strict_constraints": 47,
"three_level_kappa": "354712205164106803993/500000000000000000000000"
}
6 changes: 6 additions & 0 deletions research/five-stage-493-fixed-prime/lakefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name = "fixed_prime_certificate"
version = "0.1.0"
[[require]]
name = "mathlib"
git = "https://github.com/leanprover-community/mathlib4.git"
rev = "f897ebcf72cd16f89ab4577d0c826cd14afaafc7"
1 change: 1 addition & 0 deletions research/five-stage-493-fixed-prime/lean-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
leanprover/lean4:v4.24.0
1 change: 1 addition & 0 deletions research/five-stage-493-fixed-prime/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sympy==1.14.0
Loading
Loading