Skip to content

Joint denominator-13 decisions need fewer expected fair bits than separate calls - #6072

Merged
Mister-Meeseeks merged 2 commits into
CrocSwap:mainfrom
zxv:codex/paired-residue-sampler
Oct 28, 2026
Merged

Mister-Meeseeks merged 2 commits into
CrocSwap:mainfrom
zxv:codex/paired-residue-sampler

Conversation

@zxv

@zxv zxv commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Result

For every nonzero denominator-13 residue pair $a,b$, an explicit joint sampler produces independent Bernoulli decisions with probabilities $a/13,b/13$. Its optimal expected fair-bit count is strictly below $7/2$, compared with at least four draws for two separate standalone calls. For two 1/13 decisions it is below $9/4$, saving more than 43.75% of the standalone expected draws.

Every configuration has 312 internal control states and 624 binary transitions. State and output codes fit nine bits, giving a 702-byte packed transition table per configuration. The exact law is the four-outcome product distribution with weights

$$ ((13-a)(13-b),(13-a)b,a(13-b),ab)/169. $$

A periodic dyadic decision graph attains every depth's maximal completed-outcome count. The written counting argument proves exact distribution and expected-bit optimality; exact finite certificates establish the bounds over all 144 configurations. The underlying decision-graph method is classical and is not claimed as new.

Significance for researchers

This constructively changes the standalone sampling boundary in PR #6068. Its two-draw lower bound is not a per-scalar amortized limit. The sampler chooses the unbounded-stopping branch of that theorem; a finite control table does not provide a finite draw cap.

The denominator-13 inverse context is PR #5069, with Nick Petalas's PR #6026 providing the related stochastic-prefix interface. Both probabilities must be known before any batch bits are drawn. Adaptive probabilities, table preparation/selection, memory access, random-tape movement, stopping records, reversible cleanup and the complete native caller bill remain separate. No source-bound batching window, physical speedup, supplier or new κ is claimed.

Validation

CPython 3.12.8 normal and optimized registered checks construct all 144 tables, verify complete output-prefix counts over two 156-step periods per configuration, and independently enumerate 36,864 literal tapes. Exact rational expectations, resource bounds, wrong output-label controls, false standalone-bound transfer and false finite-cap claims are checked. No floating point or Monte Carlo is used. Committed bytes pass.

The optional full-history check is unavailable in this shallow checkout; source pins use the reachable base. The navigation-only repair from PR #6050 is included. Frozen sources and selection are unchanged; no selected/native cold replay, independent human review or formal-kernel acceptance is claimed.

Fresh read-only Git-free export replay also passes at head 9011bf83e85ecd0443c789cf03259442f750877d, under optimized isolated CPython with empty PATH/PYTHONPATH; exported file hashes remain unchanged. The newest hosted CI run is pending. Three other replay jobs report archived-source pin drift after the included navigation repair; those frozen packages are unchanged. The canonical investigation and remaining obligations are in Discussion #6073.

Open next questions

Find an actual nonadaptive pair of reached residues and price table selection, access and tape cleanup under its caller. Separately, test whether a shared dispatcher can lower the physical control cost across configurations. Lower expected bit count alone does not fund either module.

Prepared by zxv with substantial OpenAI Codex assistance. JoyboyBrian's inverse lineage and Nick Petalas's stochastic-prefix context retain their attribution. The scoped contribution is the complete small denominator-13 catalogue, exact optimal means and explicit logical resource ledger.

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