Skip to content

Reduce actual QQ16 Context construction from cubic to quadratic scans - #5371

Open
aliromman wants to merge 3 commits into
CrocSwap:mainfrom
aliromman:codex/five-harder-20261023-r4
Open

aliromman wants to merge 3 commits into
CrocSwap:mainfrom
aliromman:codex/five-harder-20261023-r4

Conversation

@aliromman

@aliromman aliromman commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

For fixed compiled radix q and dimension d, this reduces the actual QQ16 Context constructor's numerical/record source-action count from a cubic general-division term to a quadratic bound in the radix exponent w. The new fixed-width quotient scan costs exactly 5B+7 actions. One traversal validates M=q^w, saves its first quotient as cap, and emits the retained shared Count multiplications. No runtime exponent or Word is decoded into host control.

The proof and exact bills, constructor, receipt and source pins define the scope. At q=5,w=8,d=4, the complete unchanged new_context/save_count interval uses 96660 actions, versus 407496 for the already-shared predecessor and 2614926 for the literal source. The saving against the shared version is 76.28%. The local peaks fall from two record leases and nine numerical Words to one lease and four Words, including modulus and ring.one. Returned values, genuine Context type, aliases, heads and dirty protected records agree.

The complete kappa calculation is unchanged. These are numerical/record source actions, not a complete physical frontend tariff or wall-clock measurement. Compiled q and d are fixed control parameters; no uniform control-size bound as q grows is claimed. Input construction and returned Context disposal are outside the measured constructor interval; disposal is separately executed and checked. Pool/metadata control, full loader/codebook, actual caller root closure, parent parking, complete F(K), supplier stock/precision, native admission and outer recovery remain open.

Predecessor credit: ToikY's PR #4025 supplies shared high-power traversal. @Clear1nsight already applies it to Context in PR #4062, with the retained proof and exact shared function. @aliromman supplied the different unary-cache port in PR #5025. @mihir-s-05 supplies the installation audit and source fixture in PR #5363, whose byte-exact fixture is consumed here. Fixed-radix long division is classical and already present in the retained Natural.divide_small. The count formula and loop interchange are not new claims.

Validation on CPython 3.12.13, standard library only:

python3.12 -B scripts/research_package.py --package research/qq16-linear-radix-context
python3.12 -B scripts/check_research_commit.py --package research/qq16-linear-radix-context

Both registered isolated, warning-strict normal and optimized modes pass PASS_LINEAR_RADIX_CONTEXT. Evidence includes 1512 complete quotient cases with exact 5B+7 bills, 21 actual constructor runs in seven matched literal/shared/fused triples, exact complete constructor bills, dirty destination replacement, dimension64 at w=1, and four non-power rejection/rollback controls. Four disposable mutations reject in both modes before receipt comparison, including the wrong quotient inequality, wrong cap, second scratch lease and wrong exponent. Committed bytes, official export integrity and both read-only Git-free export commands pass; all 14 exported files remain unchanged.

Base is canonical main 7c472563474e60185e6ca101a17622133d047e56, priority 7, refreshed before submission. Main-source ancestry is verified. Replay pins bind the byte-exact fixture in this PR history; upstream_pin retains its original pending source. Clean checkout replay does not require the unmerged PR5363 commit. The final upstream checkpoint is 1ec1119; its selection update keeps the revision-7 mechanism allocation. This package retains its original frozen context and does not edit the selected record. The full-history wrapper, selected cold replay, full native/controller, Lean and Docker were not run. Hosted CI and independent human/proof-kernel acceptance remain separate.

Current PR/Discussion bodies, the live numerical-production handoff and relevant canonical-main notes were checked. The refreshed public snapshot covers 319 open PRs and 4651 Discussion records with complete pagination. Sparse local-note omissions, arbitrary historical diffs and unpublished work remain outside that coverage. Only this package is added.

Jose Manuel (@jmbarrancoml) and David Arias supplied the retained physical caller and cardinality source. @JoyboyBrian supplied the constructor handoff; Tekalign, ywz65 and the retained control/record lineage keep their attribution. Original source notices remain unchanged. New work: Ali Romman with substantial OpenAI Codex assistance in derivation, implementation, review and verification. Apache-2.0.

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.

1 participant