Repository navigation
Prove exact optimal QQ16 streaming sweep directions - #2794
Merged
Mister-Meeseeks merged 1 commit intoOct 16, 2026
Merged
Conversation
This was referenced Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change and mathematical scope
PR #2722 prices its QQ16 bank-major streaming word with every scalar pass visiting sites in increasing order. This proves and supplies the exact optimum over choosing one increasing or decreasing full-site sweep per instruction: 11740N - 2714 closed two-tape word-address steps for every integer N >= 1, saving 126(N-1) against its 11866N - 2840 tariff.
The resulting scalar/native word is unchanged. Its full added local scalar allowance remains 17,472 primitives, including the predecessor's 24 extra unit ADDs; its native invoice is inherited. The construction retains the existing whole-window W/Z0 ownership conditions. This is a local access-protocol lemma and independent tariff check, with no new kappa or selected-frontier change.
Validation
One new opt-in package,
research/qq16-bidirectional-sweeps/, contains the proof, exact schedules, standalone checker, receipts and source pins. The two windows improve from3564N-896to3518N-850and from8302N-1944to8222N-1864.The endpoint DP has at most four states. Every direction path has affine travel in N and the same cost at N=1, so minimizing at N=2 proves optimality for all positive integer N; the constants are not polynomial fits. The supplied path preserves each site's exact scalar order and dirty-Z0 restoration. Optimality applies only to these fixed separately closed instruction sweeps, not general scheduling, layouts, resynthesis or caching.
Validation on native macOS arm64 / CPython 3.12.14:
Registered normal and optimized replays and five CLI groups pass. They cover independent literal address traces at N=1..32,64, exhaustive direction checks for 120 toy words / 6,216 path cases, all 223 bank deltas / 3,568 affine-edge cases, exact rational dirty-state comparisons, wrong-site and omitted-return controls, and malformed scope inputs. CLI groups cover Git-free read-only replay, source-byte corruption, typed result corruption, schedule corruption and equivalent gzip recompression. Metadata/pin checking, direct optimized CPython 3.14.7 replay and whitespace checks pass. The retained 202,523 source bytes match the independently fetched PR2709 Git blob exactly.
Task and overlap
The current-main task picker drew recursive interfaces, nonce
2b009b56cc2256f685cd5a8d0b321095, priority revision 5.joint-query-controlleris refined to this specific access obligation. The task/source base isb017900dbb94d81afec343924c1a7fa6d540a7db; the isolated branch was fast-forwarded before submission to84f8e607779b81c05edc962d4981d1f9b4b9bc9f, with guidance, selected record, runner and relevant inputs unchanged. Historical source pins remain intact.Direct predecessors: Nick Petalas / PR2722
a9ec1a4f45f36d4ec131e43cf8528ea0e40ea4e8; ywz65 / PR2709d7749c49e967b214537c0bd832e435e177e21d4f. PR2722 excludes other sweep schedules from its claim, so this extends rather than corrects that tariff. PR2651/2540 and the retained QQ16/native lineage keep their credit. TASK.json records scope keyPR2722/fixed-bridge-word/bidirectional-full-instruction-sweeps. The final complete body snapshot covers 723 open PRs at 22:03 UTC and 1,434 Discussion records at 22:05 UTC, with no warnings. Exact predecessor heads are unchanged; no separate direction result was identified. This does not cover arbitrary diffs or unpublished work. No advance public reservation is claimed; the result will be reported in Discussion #2617.Whole-window caller availability, retention, bit arithmetic, source-register implementation, instruction control, surrounding native movement, output consumption and the complete supplier moment remain open. No native-kernel or selected cold replay, formal-kernel proof or independent human review is claimed. Family decision: narrow and stop at this local lemma; unknown costs are not zero. The README gives the next whole-caller budget test.
Credit
Prepared by Arham Tahir with substantial OpenAI Codex assistance in task selection, derivation, implementation, checking and writing. New work is Apache-2.0. Credit Nick Petalas, ywz65, commdata2338, Ali Romman, starship-s, Sagar Thakrar, Ross Richardson and the retained geometry/supplier contributors. Bellman optimization and sweep reversal are standard; the contribution is this exact source-bound optimum and proof.
Open next questions
The README gives the next test: pin an actual producer/native/consumer schedule, verify whole-window W/Z0 availability and price the complete physical bill. The missing caller and unified movement/retention/control budget block a supplier conclusion; stop if that bill is unfavorable. Further local schedule searches are not the recommended next task.