Repository navigation
Speed up the enabled matching-capacity census 4.92x with exact traversal - #5340
Conversation
|
Independent review (James Reed, with Claude Code). Head Verdict: the incremental state is an exact replacement for the old scan on every path where it is used, and a differential run beyond your domain agrees byte for byte. Code check against
|
| N, L, split | budgets | old / new time | reports | hits |
|---|---|---|---|---|
| 5, 12, (6,6) | on / off | 5 / 3 ms | equal | equal (828) |
| 5, 14, (7,7) | on / off | 45 / 28 ms | equal | equal (24,787) |
| 6, 14, (7,7) | on | 36 / 11 ms | equal | equal (0) |
| 6, 14, (7,7) | off | 106 / 28 ms | equal | equal (0) |
| 6, 16, (8,8) | on | 1,862 / 439 ms | equal | equal (6,744) |
| 6, 16, (8,8) | off | 2,375 / 622 ms | equal | equal (6,744) |
The (5,14) and (6,16) cases have many universal hits and 11.3M nodes, which your timing domain lacked, so they also exercise the hit path. The speedup (3–4×) is consistent with your 4.92×.
No objections. This review covers implementation equivalence only, not the #5001 capacity theorem, which remains a pinned premise as you state.
This algorithmic improvement replaces repeated cube/prefix scans in PR #5033's matching-capacity predicate with exact incremental state. In seven serialized alternating runs on the complete n=6, L=14, split (7,7) root shard, enabled median runtime falls from 200.42 ms to 40.73 ms (4.92x) with identical search reports. Capacity disabled still takes 20.68 ms, so the option remains off by default. This improves an existing optional verifier; it does not change a pruning theorem, exclusion, supplier or the complete kappa calculation. Selected kappa remains 60403/20000000.
Count invariant and scope, complete source delta, deterministic receipt, timing samples, and source pins are at reviewed head
08bba0dcd71e79f0d517740792c9b5a7ca9cecb8. Base and all consumed input pins:ff3cc58e370d0f678e529246f8c73e8094e18fcf.For each omitted coordinate and each functional class, the engine stores visited vertices a, used stay edges e, and matching pairs with both endpoints visited b. The unused matching-pair count is exactly
2^(n-2)-a+b; unused vertices are2^(n-1)-a. The two endpoint mates give one-vertex capacity. A child copies its parent's depth row and updates these counts on a fresh insertion. Siblings overwrite only the child row; each shard resets the initial state. The original completion inequality, simple-path gate, closing edge, search order, output contract and cap behavior remain intact. The new fixed state uses at most 3,696 bytes on the tested four-byte-int platform.Both enabled engines visit exactly 495,919 nodes, retain 89,782 restored leaves and make 2,922 capacity prunes. Disabled capacity visits 506,239 nodes with the same leaves. There are no universal hits in this timing domain. Samples use the same compiler, uninstrumented native programs and complete no-budget root shard; compile time is excluded and process startup is included. These are local timings, not a production seven-label prediction or a CI performance threshold.
From the repository root, Python 3.12, standard library, and C11 compiler with unsigned
__int128and undefined-behavior/bounds sanitizer support:Expected direct marker:
PASS_INCREMENTAL_PREFIX_CAPACITY. Normal and optimized CPython 3.12.13, plus optimized 3.14.7, pass. Twenty complete configurations compare all non-timing report fields and full restored/hit Counters at (2,4), (3,6), (4,8), (4,10), (5,12), with budgets and capacity independently on/off. Separate controls cover repeat-capable bypass, multiple shards and a 17-node cap. An independent split checker compares 1,988 prefix/functional cases; the sanitizer build agrees. Four source mutants fail: lost occupied pairs, wrong mate, lost parent state and lost final endpoint. Committed-byte checks and the official 13-file export pass; the Git-free optimized extraction passes and rejects source and receipt corruption. Full-history preflight is not claimed from this shallow checkout.The preserved predicate is the theorem from PR #5001, with its pinned proof. That theorem and the predecessor traversal remain explicit premises. This PR proves the new count invariant and checks implementation equivalence. No full seven-label census, selected cold replay, Lean/Docker run, native supplier admission, independent human or proof-kernel acceptance is claimed. Hosted CI and external review remain separate.
The advance claim takes the predecessor's first open question. Final overlap covered 381 open PRs, 4,566 Discussion records and all 7,091 tracked README/TASK notes; the source handoff and this claim were the relevant matches. Canonical main still matched the base. Unpublished work and arbitrary diffs remain outside coverage.
Credit @JoyboyBrian for the maintained integration, @aliromman for the earlier completion theorem, @petalas for matching balance and the union census, Nicholas Stone for the parity correction, Mihir Srivastava for the handoff, Ross Richardson for the prefix model, and Aaron Wang/opencode and all retained source notices. Prepared by @aliromman with substantial OpenAI Codex assistance in proof, code, verification and review; Apache-2.0.