Skip to content

Tooling: 2.87× faster ternary verify_invocation_frames with identical receipts - #2100

Merged
Mister-Meeseeks merged 4 commits into
CrocSwap:mainfrom
VictorLiwentao:cursor/ternary-frame-cleared-cache-60b9
Oct 15, 2026
Merged

Mister-Meeseeks merged 4 commits into
CrocSwap:mainfrom
VictorLiwentao:cursor/ternary-frame-cleared-cache-60b9

Conversation

@VictorLiwentao

Copy link
Copy Markdown
Contributor

Change and scope

At base 0fdd7d82de03e43c9e5a1000dfbcd380d1b687d2, the historical ternary-side small controls (scripts/audit_ternary_side.py on h=8,9) spend almost all wall time in scripts/experiments/ternary_side.py:verify_invocation_frames. Profiling shows repeated Fraction matrix products/inverses while building Gram projections, and repeated rank(sub(F, old)) work on recurring physical edges.

This PR keeps the default checker path and:

  1. clears denominators once per Gram factor for products and clears the pivot row before Gauss–Jordan scaling for inverses (same rational values as the historical entrywise Fraction arithmetic);
  2. memos exact ordered frame transitions for one verify_invocation_frames call by identity-then-value interning;
  3. caches projections on immutable row tuples within the call.

Every support/topology require, both orientations, and every orientation evidence field stay identical. Only the scripts/experiments/ternary_side.py source pin changes inside certificates/ternary-side.json. The h=29 DAG construction and assembly invoice are not replayed. Open CrocSwap/integer-mult-bounds#1922's audit_joint_frames.py edit is left independent; this answers that PR's open ternary inverse question on the ternary frame stream only.

Tooling improvement; no new kappa. Selected frontier untouched.

Result

On Linux / CPython 3.12.3 (Linux-6.12.94+-x86_64-with-glibc2.39), five alternating fresh-process pairs timing build(..., retain_graph=True) plus verify_invocation_frames for h=8 and h=9 gave median wall time 13.578 → 4.733 seconds (2.87×). Timing is host-descriptive and is not a correctness gate. Every orientation receipt matches the baseline checker fieldwise.

Package: research/ternary-frame-cleared-cache/.

Validation

python3.12 -I -B research/ternary-frame-cleared-cache/verify.py
python3.12 -I -O -B research/ternary-frame-cleared-cache/verify.py
python3.12 -B scripts/research_package.py --package research/ternary-frame-cleared-cache
python3.12 -I -B research/ternary-frame-cleared-cache/benchmark.py --rounds 5

Expected:

PASS_TERNARY_FRAME_CLEARED_CACHE frame_cases=2 product_cases=160 certs=1 no_new_kappa
PASS_REGISTERED_RESEARCH_PACKAGE research/ternary-frame-cleared-cache outcome=completed
PASS_IDENTICAL_TERNARY_FRAME_RECEIPTS

Default verify is read-only. Cleared-product scale-omission and poisoned transition-memo foils reject. Full make verify, selected cold replay, Lean, and multiplication-theorem obligations were not rerun for this isolated historical-checker change.

Overlap and credit

Closest priors (different objects or delivery): CrocSwap/integer-mult-bounds#756, CrocSwap/integer-mult-bounds#1217 (opt-in ternary frame-pair memo; credited, not re-opened), CrocSwap/integer-mult-bounds#1922 (cleared product + open ternary inverse question; audit_joint_frames.py left independent), CrocSwap/integer-mult-bounds#1793, CrocSwap/integer-mult-bounds#1861, CrocSwap/integer-mult-bounds#1984, CrocSwap/integer-mult-bounds#1994. No competing open PR on the default verify_invocation_frames path at refresh.

Douglas R. Colkitt authored the ternary checker; Zhihao Chen’s #7 supplied the five-subset motif. Prepared by Wentao Li (VictorLiwentao, @Is__Victor) with substantial AI assistance, under Apache-2.0.

Cleared-denominator Gram products/inverses and an invocation-local exact
frame-transition cache speed verify_invocation_frames for the historical
h=8/h=9 ternary-side controls while preserving orientation evidence.
Only the ternary_side.py source pin changes in certificates/ternary-side.json.
No new kappa.

Prepared by Wentao Li with substantial AI assistance.
Avoid double-binding h when packing verify_invocation_frames rows.
Five alternating fresh-process pairs on CPython 3.12.3 / Linux give median
13.578 → 4.733 seconds with fieldwise-identical orientation receipts.
Replace the certificate-temp-mutant stand-in with a memo poison that fails
the nested-rank require; keep VERIFY.json wording aligned.
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