Skip to content

Prove exact optimal QQ16 streaming sweep directions - #2794

Merged
Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
Arham-Tahir64:codex/qq16-bidirectional-sweeps
Oct 16, 2026
Merged

Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
Arham-Tahir64:codex/qq16-bidirectional-sweeps

Conversation

@Arham-Tahir64

Copy link
Copy Markdown
Contributor

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 from 3564N-896 to 3518N-850 and from 8302N-1944 to 8222N-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:

python3.12 -I -B scripts/research_package.py --package research/qq16-bidirectional-sweeps

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-controller is refined to this specific access obligation. The task/source base is b017900dbb94d81afec343924c1a7fa6d540a7db; the isolated branch was fast-forwarded before submission to 84f8e607779b81c05edc962d4981d1f9b4b9bc9f, with guidance, selected record, runner and relevant inputs unchanged. Historical source pins remain intact.

Direct predecessors: Nick Petalas / PR2722 a9ec1a4f45f36d4ec131e43cf8528ea0e40ea4e8; ywz65 / PR2709 d7749c49e967b214537c0bd832e435e177e21d4f. 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 key PR2722/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.

@Mister-Meeseeks
Mister-Meeseeks merged commit 227c6eb into CrocSwap:main Oct 16, 2026
23 of 61 checks passed
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