Skip to content

Speed complete Eisenstein replay by 35% with exact rational rank - #5954

Open
petalas wants to merge 1 commit into
CrocSwap:mainfrom
petalas:research/w5-1022ad-scoped-obstruction
Open

petalas wants to merge 1 commit into
CrocSwap:mainfrom
petalas:research/w5-1022ad-scoped-obstruction

Conversation

@petalas

@petalas petalas commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reduce complete Eisenstein replay wall time by 35.27% on the measured fixture, answering Open next question 2 of ywz65's #2627. This is a finite exact equivalence certificate and local performance measurement. The new contribution is an optional rational-rank adapter; the cost-40 theorem remains Jose Manuel's cited #2017 result.

  359 K-rank calls: retain ywz65's integer-pair adapter
  311 F4-rank calls: retain the original implementation
- 209 Q-rank calls: Fraction elimination
+ 209 Q-rank calls: denominator-cleared primitive integer rows

The adapter, verifier and benchmark were produced by Nick Petalas. Credit ywz65 #2627 for the K adapter and Q-rank handoff, Jose Manuel / jmbarrancoml #2017 for the original verifier and theorem, and Jonathan Lam / Joel Pulikkan / GamingPuzzled for geometry. Integer-row elimination is classical.

Evidence

Six alternating fresh-process timing pairs after warmup, CPython 3.12.15 / macOS arm64:

  • Before: median 0.436824 s, range 0.428594–0.498021 s.
  • After: median 0.282744 s, range 0.278763–0.306366 s, 1.545x faster.
  • Zero timed failures. Every run executes all 879 rank calls, retains all seven original rejection controls and compares complete stdout bytes.
  • Separately, all 209 actual Q calls take median 0.198648 s before and 0.049803 s after. Q arithmetic is about 45% of the complete baseline. An untimed profile identified Fraction arithmetic as the main remaining cost.

research/eisenstein-rational-rank/BENCHMARK.json contains generated observations, order, environment, code hashes and the ordered matrix/rank digest. Shared-host load was uncontrolled; the nonoverlapping ranges support this local improvement, not a universal speed guarantee.

Local checks passed:

  • Every actual Q-call comparison and input-preservation check; byte-identical complete replay.
  • 1,798 rational matrices against a separate determinant/minor oracle, seven input/capacity controls and a wrong-adapter rejection through the original checks.
  • Normal and optimized registered verification plus Git-free integrity, timed individually at 0.825 s, 0.845 s and 0.791 s. Each registered timeout is 60 s.
  • All three live source corruptions reject before import.
  • Metadata/pins, exact committed bytes/modes/source history, official export/input coverage, and normal/optimized read-only Git-free export replays.

From the repository root, standard-library Python 3.12 suffices:

/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -W error -I -O -B research/eisenstein-rational-rank/replay.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -W error -I -B research/eisenstein-rational-rank/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/eisenstein-rational-rank
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/eisenstein-rational-rank --check-source-history --check-modes
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -W error -I -O -B research/eisenstein-rational-rank/benchmark.py --output /absolute/new/path/benchmark.json

Any CPython 3.12 path can replace the displayed local interpreter. Timing output must be new and outside the checkout. Expected correctness markers are PASS_EISENSTEIN_RATIONAL_RANK, PASS_EISENSTEIN_RATIONAL_INTEGRITY and PASS_REGISTERED_RESEARCH_PACKAGE.

Limitations and unrun obligations

The rational adapter rejects inputs exceeding 96 rows/columns, 128-bit rational components or 4096-bit integer rows. Coefficient growth can change performance elsewhere. The fixture reaches 80 by 80 with four-bit input heights.

This adds no pairing theorem, native supplier, complete multiplication theorem, kappa improvement or selected-frontier change. No Lean, Docker, selected scientific cold replay, physical caller, compiler, stock or precision admission was run. Independent human and formal proof-kernel review are unclaimed. Frozen sources and production verifiers are untouched.

Open next questions

Does this Q-rank adapter improve another named complete replay with larger ranks or coefficient heights? First capture that consumer's exact ordered matrix census and compare complete matched runs. Its coefficient bounds and actual workload are prerequisites; no further field optimization is included here.

Related open work

The completion refresh examined the twelve other open account PRs created since the advance CLAIM: #5944, #5945, #5946, #5947, #5948, #5949, #5950, #5951, #5952, #5953, #5956 and #5957. None studies this Eisenstein Q-rank fixture or reports a competing timing for it. No additional computations were run to check those contributions. The rank-135 fitting matrix in #5950 and rational-frame cut certificate in #5944 concern different matrices and quantities.

#2627 and #2017 are merged predecessors. This contribution does not recount their mathematical results as new coverage. Unpublished work and arbitrary code diffs remain outside the overlap search.

CI notes

Both hosted checks passed for 464b8c36e1de79422b2ad82b8a60a6732e4d50f6 in run 40531800664: plan in 4m40s and replay (research/eisenstein-rational-rank) in 2m0s. The completed checks were read once, and the run head matches the PR head.

All three registered commands passed locally under CPython 3.12.15. Hosted replay certifies the bounded automated package checks, not independent human or formal proof-kernel acceptance or a general performance guarantee. No CI failure remains.

Merge danger

Door: reversible. Blast radius: one optional research package. No shared code, frozen input, production verifier or selected record changes.

Advance claim.

@antunishdPursuit

Copy link
Copy Markdown
Contributor

Independent finite Windows/capacity-boundary audit of exact head 464b8c36e1de79422b2ad82b8a60a6732e4d50f6.

All three registered commands passed natively on Windows / CPython3.12.15, using their unchanged60-second timeouts, in a Git-free13-file export. Before export I compared every one of the six SOURCES entries to both its declared Git blob/SHA256 and the exact bytes at declared base 19fdb086ea96af9a9f87936a2b888e10af4ed810. This is source binding, not full source-history or scientific-theorem verification.

Additional scope beyond the package's small-minor fixtures:23 constructed exact-rank cases through96x96 (zero, deficient and full ranks, nonsquare matrices, row/column permutations, invertible row additions, rational/sign scalings), including three accepted128-bit rational diagonal cases. Expected ranks come from an explicit L*R factorization with an identity minor, not a second Gaussian-elimination implementation. A40-entry pairwise-coprime101-bit-denominator row is accepted at rank1;42entries reject at the declared LCM capacity. Oversized numerator, denominator, row count and column count also reject. No input changes observed in the constructed rank cases. The package's original209-Q-call comparisons, seven scientific controls, wrong-adapter rejection, both optimized/nonoptimized verification and three before-import corruption controls pass unchanged.

All six complete replay outputs in three alternating fresh-process timing pairs were byte-identical. Original seconds: [4.214923,2.558021,2.704845]; adapted: [1.863784,1.854993,3.183114]. The medians favor the adapter, but ranges overlap, this small check has no warmup and shared-host load is uncontrolled: these observations do not independently establish the advertised35% universal or Windows speedup. Registered command times were3.834s/11.956s/15.725s, all within60s.

No correctness defect found in this bounded audit; no production change or separate PR warranted. This adds Windows and declared-capacity boundary evidence, not general correctness on every admitted rational input, independent human/kernel review, a new floor theorem, supplier admission or a new kappa. No selected-frontier/cold replay. Live targeted all-state Eisenstein/rational-rank metadata and this PR's empty conversation were checked; this is limited overlap coverage, not a global novelty claim.

Credit Nick Petalas for this adapter and package; ywz65 #2627 for the retained K adapter and Q-rank handoff; Jose Manuel / jmbarrancoml #2017 and retained geometry contributors for the scientific consumer. Audit/constructed fixtures by Dennis / antunishdPursuit with substantial OpenAI Codex assistance, no subagents, Apache-2.0. Row-rank invariance and the rank-factorization argument are standard.

Reproduce the additional audit by saving the script below outside a checkout of the exact head, then running python3.12 -B /path/to/audit.py /path/to/checkout. It runs the registered commands directly with their declared argv/timeouts; this was not a run of the shared research_package wrapper. No timing receipt or source file is written by the script. Expected final marker: PASS_INDEPENDENT_EISENSTEIN_BOUNDARIES.

Standalone reproduction script
"""Independent finite boundary audit by Dennis / antunishdPursuit, with OpenAI Codex assistance. Apache-2.0.
Consumer: Nick Petalas PR5954 exact464b8c36e1de79422b2ad82b8a60a6732e4d50f6.
No theorem, universal performance or supplier-admission claim.
"""
import hashlib, importlib.util, json, math, pathlib, subprocess, sys, time
from fractions import Fraction
root=pathlib.Path(sys.argv[1]).resolve()
package=root/'research/eisenstein-rational-rank'
raw=(package/'rational_rank.py').read_bytes()
EXPECTED_SHA='e323bb0d9e6ff62df11754b12eba6204eb9edfe67b0fcffbc23d68c7e93358e8'
assert hashlib.sha256(raw).hexdigest()==EXPECTED_SHA
spec=importlib.util.spec_from_file_location('audited_rank',package/'rational_rank.py')
engine=importlib.util.module_from_spec(spec);spec.loader.exec_module(engine)
# First r columns of L have an identity minor. R's first r columns are identity.
# Hence L*R has rank r: upper bound by factorization, lower bound by that minor.
# Invertible row/column operations, scalings and permutations preserve this rank.
cases=[]
for h,w in [(0,0),(1,96),(96,1),(7,96),(96,7),(32,48),(48,32),(96,96)]:
 for rank in sorted(set([0,min(h,w)//2,min(h,w)])):
  L=[[int(i==j) if i<rank else ((i+3*j)%7-3) for j in range(rank)] for i in range(h)]
  R=[[int(j==i) if j<rank else ((2*i+j)%5-2) for j in range(w)] for i in range(rank)]
  A=[[sum(L[i][k]*R[k][j] for k in range(rank)) for j in range(w)] for i in range(h)]
  if h>1:
   for i in range(h-1):A[i]=[x-2*y for x,y in zip(A[i],A[i+1])]
  A=[[Fraction(x*(-1 if j%2 else 1),i+1) for j,x in enumerate(row)] for i,row in enumerate(A)]
  A=[list(reversed(row)) for row in reversed(A)]
  before=[row[:] for row in A]
  observed=engine.rank(A)
  assert observed==rank,(h,w,rank,observed)
  assert A==before
  cases.append([h,w,rank])
# Exact accepted 128-bit boundaries; each nonzero diagonal gives an explicit minor.
for n in [1,8,96]:
 a=Fraction((1<<127)-1,(1<<128)-1)
 A=[[a if i==j else 0 for j in range(n)] for i in range(n)]
 assert engine.rank(A)==n
 cases.append([n,n,n,'128-bit diagonal'])
# Independent pairwise-coprime denominators stress the LCM guard through rank().
denominators=[];candidate=(1<<100)+1
while len(denominators)<42:
 if all(math.gcd(candidate,d)==1 for d in denominators):denominators.append(candidate)
 candidate+=2
safe=[[Fraction(1,d) for d in denominators[:40]]]
assert engine.rank(safe)==1
bad=[[[Fraction(1,d) for d in denominators]],[[1<<128]],[[Fraction(1,1<<128)]],[[0]*97],[[0]]*97]
reasons=[]
for A in bad:
 try:engine.rank(A)
 except ValueError as e:reasons.append(str(e))
 else:raise AssertionError('capacity exhaustion accepted')
assert reasons[0]=='row denominator too large'
# Generic rank controls would detect either a constant-zero or full-rank adapter.
assert any(r[2]>0 for r in cases)
assert any(r[0]>0 and r[1]>0 and r[2]<min(r[:2]) for r in cases)
manifest=json.loads((package/'VERIFY.json').read_text(encoding='utf-8'))
commands=[]
for command in manifest['commands']:
 argv=[x.replace('{python}',sys.executable).replace('{package}',str(package)) for x in command['argv']]
 start=time.perf_counter();r=subprocess.run(argv,cwd=root,capture_output=True,timeout=command['timeout_seconds'])
 assert r.returncode==0,(argv,r.stdout.decode(errors='replace'),r.stderr.decode(errors='replace'))
 commands.append({'command':command['argv'],'elapsed_seconds':round(time.perf_counter()-start,6),'stdout_sha256':hashlib.sha256(r.stdout).hexdigest(),'markers':[x for x in r.stdout.decode().splitlines() if x.startswith('PASS_')]})
# Matched fresh-process complete replay timings, serial and alternating, three pairs.
timings={'original':[],'adapted':[]};out=None
for pair in range(3):
 for original in ([True,False] if pair%2==0 else [False,True]):
  argv=[sys.executable,'-W','error','-I','-O','-B',str(package/'replay.py')]+(['--original'] if original else [])
  start=time.perf_counter();r=subprocess.run(argv,cwd=root,capture_output=True,timeout=60);elapsed=time.perf_counter()-start
  assert r.returncode==0,r.stderr
  if out is None:out=r.stdout
  assert r.stdout==out
  timings['original' if original else 'adapted'].append(round(elapsed,6))
print(json.dumps({'rank_cases':cases,'lcm_positive_cases':1,'capacity_rejections':reasons,'registered_commands':commands,'timings':timings,'complete_stdout_sha256':hashlib.sha256(out).hexdigest(),'python':sys.version},indent=2))
print('PASS_INDEPENDENT_EISENSTEIN_BOUNDARIES')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants