Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions research/nonunit52-tail-circuit/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
retained/** -text whitespace=cr-at-eol
52 changes: 52 additions & 0 deletions research/nonunit52-tail-circuit/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Exact sources and attribution

Ali Romman supplied the complementary-tail formulas, ordered column-leaf
selection, two-mode reversible circuit, exact bill and complete-domain
checker with substantial OpenAI Codex assistance in research, implementation,
verification and writing. New material uses Apache-2.0.

Nick Petalas supplied the Boolean primitives, clean-oracle construction
and fixed-pair arithmetic model in
[PR #7746](https://github.com/CrocSwap/integer-mult-bounds/pull/7746), head
`71fdb2cf1ec973b5402c4d3c2466864014a1ccda`. The complete seven-file package
is retained. Its [circuit primitives](https://github.com/petalas/integer-mult-bounds/blob/71fdb2cf1ec973b5402c4d3c2466864014a1ccda/research/paired-ddg-arithmetic-step/circuit.py)
are inherited unchanged with an explicit new wire layout. No source
function or global is patched. Its
[verifier](https://github.com/petalas/integer-mult-bounds/blob/71fdb2cf1ec973b5402c4d3c2466864014a1ccda/research/paired-ddg-arithmetic-step/verify.py)
runs unchanged. Its modulus-169 gate count is prior evidence, not the new
modulus-thirteen bill.

JoyboyBrian supplied the actual inverse residue domain and nonadaptive
numerator window in
[PR #6096](https://github.com/CrocSwap/integer-mult-bounds/pull/6096), head
`e56f5094c83f3e514d9936fa7b1c8027745a0a00`. Its
[domain proof](https://github.com/JoyboyBrian/integer-mult-bounds/blob/e56f5094c83f3e514d9936fa7b1c8027745a0a00/research/inverse-residue-domain/README.md),
[basis and owner constructor](https://github.com/JoyboyBrian/integer-mult-bounds/blob/e56f5094c83f3e514d9936fa7b1c8027745a0a00/research/inverse-residue-domain/verify.py)
and [mode columns](https://github.com/JoyboyBrian/integer-mult-bounds/blob/e56f5094c83f3e514d9936fa7b1c8027745a0a00/research/coded-native-caller/NORMALIZERS.json)
are retained. The bounded-owner functions run for all 384 source pairs;
the full kernel fixture suite does not run. Its Dillon normalizer,
Dugongue/mdumitrean coded producer and inverse lineage stay credited.

Ali Romman supplied the exact entry classification and remaining mixed-tail
question in [PR #7757](https://github.com/CrocSwap/integer-mult-bounds/pull/7757),
head `5640f56b63ea04afc8505d45a4df1ea35466a94e`, with substantial OpenAI Codex
assistance. The [proof](https://github.com/aliromman/integer-mult-bounds/blob/5640f56b63ea04afc8505d45a4df1ea35466a94e/research/inverse52-phase-entry/PROOF.md),
[interface](https://github.com/aliromman/integer-mult-bounds/blob/5640f56b63ea04afc8505d45a4df1ea35466a94e/research/inverse52-phase-entry/interface.py),
guide and credit record are retained. Its first-entry boundary obligation
is not removed by the new inside-tail inverse.

The packed gate interpreter and separate scalar checks adapt Ali Romman's
[PR #7755 verifier](https://github.com/aliromman/integer-mult-bounds/blob/d6babec41a3d01928c3dbdb896ea2adf051ba305/research/runtime-paired-ddg-arithmetic/verify.py),
head `d6babec41a3d01928c3dbdb896ea2adf051ba305`, prepared with substantial
OpenAI Codex assistance. That file is retained for attribution; its full
runtime package is not replayed. The original ordered paired graph and
probability proof are zxv's
[PR #6072](https://github.com/CrocSwap/integer-mult-bounds/pull/6072), with
its exact [source guide](https://github.com/zxv/integer-mult-bounds/blob/9011bf83e85ecd0443c789cf03259442f750877d/research/paired-residue-sampler/README.md)
retained. The source notices also credit JoyboyBrian's reversal/lifecycle
work and the original dyadic decision-graph method.

All 19 retained files keep their exact notices and have Git-blob and
SHA-256 pins. The base manifest records provenance without unmerged
ancestry. No global novelty, gate optimum, complete physical supplier,
independent human review or formal-kernel acceptance is asserted.
166 changes: 166 additions & 0 deletions research/nonunit52-tail-circuit/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# One reversible draw for the nonunit denominator-52 tails

## Result and contract

This package supplies a different tail controller for the 288 mixed and
96 endpoint source pairs excluded from the exact nonzero-pair core
interface in PR7757. One fixed circuit uses 1,277 gates and 382 clean
work bits per draw. It preserves the original ordered coin-to-label
function, continuing-node index and stopping depth after entry.

The circuit accepts two read-only parameters `1 <= u,v <= 12`, one
orientation bit and one mode bit. These are fixed before the first tail
coin. Its live packet contains a four-bit unit phase modulo thirteen,
a two-bit node/label field and a stopping flag. The resident coin is
preserved. The input stopping flag and high node bit are zero. Endpoint
mode permits only node zero; mixed mode permits nodes zero and one.
Only the stated pending packets are the semantic input domain.

No physical tape tariff, prefix implementation, first-entry return or new
kappa is supplied. The source first-entry boundary from PR7757 remains
unpaid. A full sampler must retain enough control to distinguish that
boundary from a later cyclic tail return.

## Exact source reduction

The original joint weights, in label order `00,01,10,11`, are

```text
w = ((52-a)(52-b), (52-a)b, a(52-b), ab), 0 <= a,b < 52.
```

At depth four, the unfinished digit streams have residues `w mod169`.
For the 384 pairs considered here, all nonzero residues are multiples
of thirteen. Divide each residue by thirteen. Their later binary digits
are exactly those of the resulting four numbers over denominator
thirteen. The old integer parts cancel in every digit difference.

If `a=13t`, where `t` is 1, 2 or 3, and thirteen does not divide `b`, put

```text
u = (4-t)b mod13, v = tb mod13.
```

Both parameters are nonzero. The reduced row-pair weights are
`(13-u,u,13-v,v)`. If instead `b=13t`, use `a` in the formula and transpose
the two off-diagonal entries. These are the column-pair weights
`(13-u,13-v,u,v)`. Each vector sums to twenty-six, so it represents a
complete pool with two live nodes. It is not a fresh one-root probability
distribution.

If `a=0` and thirteen does not divide `b`, set `u=4b mod13`; the reduced
weights are `(13-u,u,0,0)`. If `b=0`, use `u=4a mod13` and weights
`(13-u,0,u,0)`. These endpoint pools have one live node. The source recipe
sets the unused parameter `v=u`. The circuit also permits every other
nonzero `v` in endpoint mode and charges its arithmetic.

The counts are `2*3*48=288` mixed pairs and `2*48=96` endpoint pairs.
The checker validates every one against the pinned actual inverse mode
columns, with a public owner witness in `{-1,0,1}^112`. It compares all
16,128 source-tail transitions over a complete period with a direct
integer-floor calculation using denominator 2,704. The sixteen dyadic
pairs have no tail, and the other 2,304 pairs use the different core
interface; neither class is accepted by this source recipe.

## A constant live-pool controller

The twelve powers of two modulo thirteen are distinct and return to one.
At phase `theta`, define

```text
du = 1 if (u*theta mod13) >= 7, otherwise 0,
dv = 1 if (v*theta mod13) >= 7, otherwise 0.
```

For a complementary pair `(13-u,u)`, the two probability digits are
`(1-du,du)`. Neither residue is zero. Thus each complementary pair gives
exactly one leaf at every step.

In mixed mode there are two leaves and two continuing children per step.
Node zero always stops: its coin selects the first or second ordered
leaf. Node one always continues: its new node is the coin. Row-pair
leaves have high bit equal to the coin and low bit selected from `du,dv`.

For column pairs, the two candidate labels are `2*du` and `2*dv+1`.
They are reversed in sorted order exactly when `du=1` and `dv=0`.
Put `swap=du*(1-dv)`, and select the column with `coin XOR swap`.
The output low bit is that column, and its high bit is the corresponding
digit. A plain transpose of the row output would not preserve ordered
coin labels in that case. The circuit includes the sorting condition.

In endpoint mode, coin zero stops at the unique leaf. Coin one continues
at node zero. Its leaf is `(du,0)` in low/high-bit order for row orientation
and `(0,du)` for column orientation. Both modes then double the phase
modulo thirteen.

## Inverse and complete reversible circuit

Write `theta'` for the new phase. The previous phase is

```text
theta = (theta' + 13*(theta' mod2))/2.
```

In mixed mode the old node is one minus the new stopping flag. In endpoint
mode it is zero. The previous high node bit and stopping flag are zero.
The coin and all four read-only parameters remain available. These formulas
recover the old valid packet even when the new packet is a terminal label.
They apply inside the tail; they do not invert the prefix-to-tail entry.

Nick Petalas's unchanged Boolean primitives implement the arithmetic.
The modular adder first forms the five-bit sum `s` in `[0,24]`. It also
forms `s+19 mod32`. The top bit of that second word distinguishes `s<13`
from `s>=13`, so selection gives `s mod13`. Repeated doubling and four
controlled terms form each parameter product. Adding nine to a residue
makes bit four equal to its threshold digit.

The forward oracle computes the new packet into seven clean backing bits
and reverses all temporary arithmetic. Seven bit swaps exchange the
packets. The inverse oracle computes the old packet into the backing bits,
which clears them, then reverses its temporary arithmetic. Every gate in
this sequence is counted. The generated gate list is a permutation on
all its wires; the claimed packet function is restricted to the valid
semantic domain above.

| Resource per tail draw | Count |
| --- | ---: |
| X / CNOT / Toffoli | 70 / 895 / 312 |
| Total gates | 1,277 |
| Temporary work + clean packet backing | 375 + 7 = 382 bits |
| Live packet / read-only parameters / resident coin | 7 / 10 / 1 bits |
| Total wires | 400 |

The ten parameter bits are the two four-bit residues, orientation and
mode. The same circuit handles 576 runtime parameter settings. The full
20,736-edge semantic domain is checked in both directions, including
every work bit, every parameter and the coin. A separate scalar gate
interpreter checks 1,152 boundary cases both ways. All 169 modular-addition
inputs and their uncomputation pass. Five gate controls alter the stopping
flag, residue parameter, mode, work state or output order and fail.

## Stopping and evidence limits

Under fresh independent fair coins, an endpoint entry needs two tail
coins in expectation. A mixed entry at node zero needs exactly one;
at node one it needs three in expectation. Indeed node one continues
for one step and then selects node zero or one with equal probability.
The unique finite solution is `E1=1+(1+E1)/2=3`. The two mixed entry
prefixes are equiprobable conditional on reaching the unfinished pool,
so their average is two. Worst-case stopping time remains unbounded.
These expected coin counts are not physical tape or complete caller costs.
Conditional freshness is an inherited obligation, not proved here.

All 19 retained source files are authenticated by Git blob and SHA-256.
The full fixed-pair arithmetic verifier runs unchanged as a primitive
source cross-check. The source-domain kernel fixtures, complete PR7757
verifier, full PR7755 runtime verifier, historical probability/mean
catalogue, selected cold replay, Lean and Docker were not run. The runtime
verifier file is retained for its interpreter attribution, not executed.

Parameter preparation, the first four coins, their entry/return protocol,
physical wire and tape access, output retention, stopping storage,
conditional freshness and the complete native invoice remain open.
The generic core's larger gate count concerns a different semantic domain;
no matched physical speedup or global gate optimum is claimed. All five
assumptions and the selected frontier remain unchanged. Separate numerical
and gate paths do not imply independent human or formal-kernel acceptance.
31 changes: 31 additions & 0 deletions research/nonunit52-tail-circuit/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Exact circuit for the mixed and endpoint denominator-52 tails

One reversible circuit now covers the 288 mixed and 96 endpoint source
tails that cannot enter the nonzero-pair core. It uses 1,277 gates and
382 clean work bits per draw. The ordered output labels, continuing-node
indices, stopping depths, parameters and coin are preserved.

Read the [proof and complete contract](PROOF.md), [circuit](tail.py),
[exact bill and all source recipes](RESULT.json), [checker](verify.py)
and [credits](CREDITS.md). This is a tail circuit, not a complete physical
sampler or a new kappa result.

Use Python 3.12 and the standard library:

```sh
python3.12 -B scripts/research_package.py --package research/nonunit52-tail-circuit
```

Both registered commands print `PASS_NONUNIT52_TAIL_CIRCUIT`. All 20,736
runtime transitions and 16,128 actual source-tail edges pass. The complete
fixed-pair primitive source verifier also runs unchanged. Exported replay
needs no Git or repository imports.

## Open next questions

- Can the four-coin prefix and its return boundary be implemented with
a complete physical bill for an actual inverse call? The tail inverse
does not implement the first-entry return.
- Can parameter preparation, conditional freshness, output retention and
unbounded stopping storage fit that caller's paid allowance? An expected
coin count or a local gate count does not establish that allowance.
Loading
Loading