Skip to content

Tooling improvement: output-identical fraction-free null_exact fast path for recycled-bit --all exact nesting - #2537

Merged
Mister-Meeseeks merged 3 commits into
CrocSwap:mainfrom
thakrarsagar:loop9d24/i12-s91-recycled-nesting-fastpath
Oct 16, 2026
Merged

Mister-Meeseeks merged 3 commits into
CrocSwap:mainfrom
thakrarsagar:loop9d24/i12-s91-recycled-nesting-fastpath

Conversation

@thakrarsagar

Copy link
Copy Markdown
Contributor

Status: Tooling improvement (no κ claim; certificate content, predicates and PASS lines unchanged)

Summary

make verify-recycled-bit (research/recycled-bit-integration/verify.py --all) spends most of its exact rational nesting stage in PR97 linalg.null_exact (Fraction RREF; about 72% of per-move cost by profile). This PR adds null_exact_ff, an integer fraction-free kernel that returns the same list of rows as linalg.null_exact (same RREF pivots/free columns, same sign, same primitive scaling), plus a faster prim. install_null_kernel patches linalg.null_exact, check_lifted.null_exact and frames147.prim at runtime before Exact is built. The frozen PR97 / bit-reuse-147 files are byte-unchanged. Non-integral or ragged input falls back to the original functions. VERIFY_NULL=reference restores the original kernel; VERIFY_NULL=audit runs both and asserts equality.

Files: research/recycled-bit-integration/verify.py (+~88 lines), one pin line in research/recycled-bit-integration/certificate.json (verify.py a5508f42... -> e8da17f2...), and a new note package research/recycled-bit-nesting-reuse/ (README, TASK/SOURCES/VERIFY.json, bounded verify.py package check, optional bench.py). This follows the precedent of 6fd436d (PR218 cherry-pick), which edited the same verifier and its pin; it needs maintainer acceptance.

Evidence (same shared 4-CPU host, Python 3.14.4, pinned base input)

  • Init audit: all 4,473 null_exact calls inside Exact.__init__ identical; kernel time 23.43 s -> 2.88 s.
  • Deterministic 400-move sample (seed 1, 709 keys): basis+null 4.50/3.88 s -> 1.25/1.11 s (~3.5x); maps identical.
  • Complete full-key audit over all 86,789 distinct keys and 85,017 targets: 145,513 null_exact calls (381.0 -> 48.7 s) and 1,683,853 prim calls (70.6 -> 3.6 s), all identical.
  • Full --all, VERIFY_JOBS=3: nesting stage 410 s -> 226 s wall (a second, more loaded fast run: 284 s), i.e. about 1.44-1.81x from one before/after pair on a loaded host; user CPU 825 -> 369 s. The before-run is VERIFY_NULL=reference on the patched file. No CI speedup factor is claimed.
  • Identity argument (README proof sketch, hand-checked by an independent reviewer; not a formal proof): each integer row is a positive multiple of the Fraction row at the same step, so pivots/free columns agree and each kernel vector is a positive multiple of the reference one, giving the same primitive row. A reviewer's third oracle (column-major Gauss-Jordan) agreed on 7,210 matrices.

Negative result (the original hypothesis): seeding Exact's basis memo from the discarded late_frames exact_basis cache covers only 2,230 of 86,789 keys (2.6%), and its whole cost is bounded by late_frames' ~25.5 s per process (≤ ~6% of the stage). Dropped; this was the one pivot.

Reproduce

python3 -B research/recycled-bit-nesting-reuse/verify.py && make verify-recycled-bit

Expected: PASS_RECYCLED_BIT_NULL_KERNEL (~30-40 s), then null_exact kernel: fast and the same PASS lines ending PASS kappa=472154791/1000000000000 = 0.000472154791; full fallback, both suppliers and 47 constraints, with the certificate equal. Optional: research/recycled-bit-nesting-reuse/bench.py (~13 min) reproduces the audit/timing table.

Negative controls (in the package check)

Sign-flipped and non-primitive kernel rows differ from the reference; VERIFY_NULL=audit rejects a wrong kernel (this control caught and fixed a re-entrancy bug during development); with the fast kernel installed a non-nested move is reported and a degenerate frame span(1^9 0^14) is rejected; the certificate pins the current verify.py, not the base bytes; ragged input raises like the reference and Fraction input falls back.

Scope, inherited assumptions, unresolved obligations

  • Inherited: the conditional recycled-bit-integration witness (analytic, fixed-tape, uniform-recursion, prime and ordinary-leaf interfaces) and correctness of the frozen PR97 / frames147.Exact predicates.
  • Trusted-base shift: in fast mode, acceptance of the nesting check now depends on the new null_exact_ff. A reviewer mutant that drops the last null vector still passes the end-to-end replay (inside() only becomes more permissive); a perturbed entry fails. Equivalence rests on the proof sketch plus the complete audit on the pinned input; the package check is the guard and CI runs it only when the package changes. A fail-closed completeness guard (annihilation + len(out) >= k - rank_mod) is Open next question 4.
  • sources() does not pin PR97 linalg.py/check_lifted.py (pre-existing); the package SOURCES.json pins them at base bytes.
  • 52 historical receipts in research/community-efficient{200..1000}-audit/ record the old verify.py/certificate shas; no live consumer re-hashes them; left unchanged.
  • Only Python 3.14.4 was run locally; the registered Python 3.12 replay and CI 3.11/3.13 were not run locally. The full end-to-end VERIFY_NULL=audit --all was not run by the author (a reviewer ran default-mode VERIFY_NULL=audit to PASS); bench.py covers the same distinct inputs.

Base and pins

Base 0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2 (origin/main unchanged at submission). Source pins in research/recycled-bit-nesting-reuse/SOURCES.json; upstream/, references/partial-gauge/pr97, research/bit-reuse-147, certificates/selected-result.json unchanged.

Overlap and credit

PR218 (6fd436d) parallelized the unchanged checks; this replaces the dominant exact kernel and keeps the pool. PR239 / PR1461 sped up different verifiers. #2361 changes CI selection only (complementary). No open PR touches null_exact or recycled-bit-integration (searched before submission).
Credit: Douglas Colkitt (recycled-bit-integration, with OpenAI Codex); Thomas Marchand #146, William Porter #147, Rohan Gupta / gupt1156 #148, DaysSky #150; PR97 snapshot by Zhihao Chen / jacklightChen with check_lifted/linalg by Swapnil Jain; Joel Pulikkan / GamingPuzzled (PR218); CubeJerry (PR1461), RichardHoekstra (PR239).

Sprint: track 85-94 Verification engineering, seed 91; claim: #1163 (comment)

Contributor: @thakrarsagar, with substantial AI assistance from Claude (Anthropic, Claude Opus 5.5 via Claude Code, run in an automated sprint loop). Apache-2.0.

🤖 Generated with Claude Code

thakrarsagar and others added 3 commits October 15, 2026 18:37
… fast path

Install an integer fraction-free drop-in for PR97 linalg.null_exact (and an
integer frames147.prim) at runtime from recycled-bit-integration/verify.py;
frozen PR97/bit-reuse-147 files stay byte-unchanged. VERIFY_NULL=reference
restores the Fraction kernel; VERIFY_NULL=audit runs both and asserts
equality. Only the verify.py source pin in certificate.json changes.

New package research/recycled-bit-nesting-reuse: profile, refuted
late_frames basis-reuse idea (2.6% key coverage), same-input timings,
equality audits, differential check and negative controls.

Prepared by thakrarsagar with substantial AI assistance from Claude
(Anthropic, Claude Opus 5.5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…runs, bench.py

Complete full-key equality audit (145,513 null_exact + 1,683,853 prim calls
identical) and back-to-back full --all runs (VERIFY_JOBS=3): nesting stage
410 s -> 226 s wall, same five PASS lines and certificate. Add the
reproducible audit/timing harness bench.py.

Prepared by thakrarsagar with substantial AI assistance from Claude
(Anthropic, Claude Opus 5.5).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ust scope, credits)

- null_fast/prim_fast materialise their input before the type check; re-pin verify.py (e8da17f2...).
- README: speedup given as ~1.44-1.81x from one pair on a loaded host (before = VERIFY_NULL=reference);
  late_frames time bound for the negative result; trusted-base shift and dropped-vector gap stated;
  52 historical receipts; 6fd436d precedent and base pins; Python 3.12 replay not run;
  PR97 credit to Zhihao Chen / jacklightChen; Open next question 4 (fail-closed guard).
- Reran package check and make verify-recycled-bit: same PASS lines, kappa=472154791/10^12.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ywz65

ywz65 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

DONE: concurrent PR2560 supplied the guard during this investigation, so I abandoned a duplicate guard PR. The independent full-ledger review, exact-source artifact and measured cost are published here: #2560 (comment)

Original claim preserved

CLAIM (ywz65; substantial OpenAI Codex assistance): I am addressing PR2537's explicit open question about a fail-closed completeness guard for the fast integer nullspace kernel. The author reports that dropping the final null vector can still pass the downstream nesting replay; I will preserve that attribution and reproduce the missing implication on a named actual caller.

Proposed contract: authenticate the fixed input A, check A*N^T=0 exactly, and certify that N is independent with rank(A)+rank(N)=the ambient dimension. Modular ranks give cheap lower bounds; a certified dimension sum can therefore prove completeness without assuming modular rank equals rational rank. If a selected prime is unlucky, use an exact rank fallback rather than silently accepting or replacing an incomplete candidate. Controls will include dropped/duplicated/perturbed vectors, modular-only zero mistakes and valid bad-prime cases. Equivalent sign/scaling choices need not be rejected merely for differing from the reference list: the guard certifies a complete rational basis, not canonical byte identity.

I plan a source-bound opt-in wrapper and actual-caller reproduction with a fully charged validation/timing report. This does not amend the frozen PR97 files, recertify the full mathematical supplier, or claim a speedup before measurement. PR2537 is pinned at222063b96ec1a109a8c9f40e5d615498a737c6dd. Canonical main refreshed at selection and pivot remains0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2, priority4.

The portable-replay card's baseline passed. The prior canonical-comparison and CI-navigation screens were already covered by PR2040/2214 and were discarded uncounted. Cached complete PR/Discussion overlap is supplemented with current source PR/body/comments; current Discussion coverage remains quota-limited. No duplicate completeness-guard claim was found in the bounded screen, which is not a novelty guarantee.

@Mister-Meeseeks
Mister-Meeseeks merged commit f6abdfc into CrocSwap:main Oct 16, 2026
55 of 61 checks passed
@thakrarsagar
thakrarsagar deleted the loop9d24/i12-s91-recycled-nesting-fastpath branch October 18, 2026 08:08
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.

3 participants