Skip to content
Merged
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
2,664 changes: 2,664 additions & 0 deletions research/encoded-child-spectators/CERTIFICATE.json

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions research/encoded-child-spectators/CONTEXT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"base_commit": "20ecf2891d80b5acf18d980b2164fb44ea7faa90",
"track": "bit-supplier",
"seed": 4,
"claim": "https://github.com/CrocSwap/integer-mult-bounds/pull/4062#issuecomment-6268379494",
"predecessors": [
{
"pr": 4025,
"head": "84bd28ef6da3a3473d14a48088f30ba82d414450",
"author": "ToikY",
"role": "Shared traversal for a fixed d\u00b2 high_power; credited mechanism precedent. Not imported."
},
{
"pr": 4062,
"head": "d7df855fc64525b43bfda7e7a24b17356d6c1d0e",
"author": "Chris R / Clear1nsight",
"role": "Complete Context/directory/admission preparation interval and released geometry/extents handoff. Not imported."
},
{
"pr": 2753,
"head": "7dba5452a4071a856a0b11cebdcd2d3b6bcd7659",
"author": "David Arias",
"role": "Actual ordered child geometry and Layout.child_extents, retained canonically in PR2809."
},
{
"pr": 2809,
"head": "e7d93dd0de0bb81308bc3356f65eddeeb22fd712",
"author": "Jose Manuel / jmbarrancoml",
"role": "Fixed-role physical caller and frozen Word/Count/Counter/Geometry closure."
}
],
"overlap": {
"open_pr_bodies": 772,
"scope": "Complete open body pagination including drafts; current1166 and12 recently updated discussion threads; exact4025/4062/4011/4059/4067 sources/comments. Broader closed/private/code coverage is partial."
},
"scope": "Only the new isolated package. Eight canonical runtime inputs are authenticated before execution; pending PRs supply handoff/provenance, not executable dependencies.",
"publication_refresh": {
"canonical_main": "20ecf2891d80b5acf18d980b2164fb44ea7faa90",
"recent_updated_pr_bodies": 100,
"parent_head": "d7df855fc64525b43bfda7e7a24b17356d6c1d0e",
"parent_comments": "The current comments contain our narrow claim; no competing claim or objection observed."
}
}
218 changes: 218 additions & 0 deletions research/encoded-child-spectators/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# Encoded shared atom powers at the child-spectator boundary

## 1. Statement and exact source boundary

Let q be the fixed source radix, let the admitted Ring modulus be A=q^w,
w>=1, and let each e_i be a borrowed canonical unsigned Word of width I.
For one to three distinct owned Count outputs v_i, the operation computes

`v_i <- v_i * A^(e_i)`.

The e_i and Ring/arena inputs return byte-for-byte unchanged at canonical
head 1. The caller supplies, or the setup creates, one distinct owned blank
counter role. It is returned blank at head 1, including its erased visited
backing. This is not an arbitrary-dirty loan. Output and workspace aliases
are rejected. Fixed output-role selection and fixed q are compile-time data;
e_i and w are never decoded into host integers or loop bounds.

The actual source is the eight-file closure in SOURCES.json, at canonical
base 20ecf2891d80b5acf18d980b2164fb44ea7faa90. Authentication checks its sealed
inventory, complete SHA256 and Git blob pins before executing any source.
The private Counter class contains the exact frozen class AST, with only
its Tape constructor bound to the single reusable blank role. The full Word,
Count, Natural, Counter, radix, Layout and Geometry methods are retained.
Only Geometry is extracted from numeric.py; native forms, source admission
and Callback are deliberately not imported or certified here.

The claim is successful valid-input source-method equivalence and an exact
source-action delta. It is not complete physical machine refinement, a full
caller/supplier admission or a multiplication exponent improvement.

## 2. Algorithm and encoded-loop proof

The old multiply_atom_power does the following for each output separately:

1. Create a Counter from e_i.
2. For each of its e_i decrements, run the complete radix_power validator.
3. On each of that validator's w yields, multiply v_i by fixed q.
4. Close the Counter and every validator temporary.

The new multi-power method first constructs and immediately closes a Counter
for each e_i, using only its finished Boolean to select zero versus positive.
If all are zero it returns, matching the old absence of a radix traversal.
Otherwise it runs one complete radix_power. At each yield it independently
counts down every positive e_i and multiplies its v_i by q once per decrement.
The new iteration order is radix digit, output role, atom. The former order
was output role, atom, radix digit.

Each v_i is multiplied by q exactly w*e_i times in either word. These
multiplications commute, touch no other v_j, and leave each Count head
canonical. Therefore the exact result is v_i*q^(w*e_i)=v_i*A^(e_i).
For each individual output, its sequence of Count values and Count primitive
operations is identical, even though operations on different outputs are
interleaved differently. Thus all Count multiplication work is unchanged.
The source radix validator is exhausted exactly once if any exponent is
positive; its prime-power checks and final cleanup remain active.

Counter construction copies the complete encoded Word, including padding;
decrement uses a finite borrow flag; multiplication by q uses a carry bounded
in terms of fixed q. The active-role list has at most three entries. There
is no numerical-width-dependent control table or cached host value of w/e_i.

After each Counter.close, the canonical body and every previously visited
body cell of its role are blank. Initially the role is blank. By induction
the next exact Counter constructor sees the same empty entrance as the
original Tape constructor supplied. Old erased suffix cells remain charged
backing. The one-role reuse is therefore an explicit sequential lifecycle,
not a sum-of-live-sizes claim that forgets retained cells.

## 3. Exact counter tariff

Vectors below are `(reads,writes,unit moves)` in one source-action lane.
Let b=bitlength(e), z=I-b. Counter construction reads the I-bit input once
through its full source loops and trims high zero digits. Its record invoice is

```
J(0,I) = (2I+5, 3I+3, 4I+8),
J(e,I) = (2I+3, I+1+2z, 2I+4+2z), e>0.
```

The input Word copy has the separate **index** invoice

`C(I) = (3I+3, 0, 2I+4)`.

For example, the initial rewind reads LEFT and moves twice. The I digit
iterations read the Word twice per digit and move once, the terminating
RIGHT test reads once, and the final rewind reads I+1 cells and moves I+2.
No numerical Word writes are omitted.

Closing a positive, not-yet-consumed Counter with B=bitlength(e) costs
`(2B+5,B+1,2B+6)` record actions. For zero use B=1. Define

`P(e,I) = J(e,I) + (2 max(1,b)+5, max(1,b)+1, 2 max(1,b)+6)`

as the complete probe constructor/close invoice. A fully consumed Counter
ends as ZERO,RIGHT; its close costs `(7,2,8)`.

For a decrement from k>0, let t be the number of trailing zero bits.

| k class | Record decrement invoice |
| --- | --- |
| k=1 | (6,4,8) |
| k=2^j, j>=1, B=j+1 | (2B+3,B+2,2B+4) |
| otherwise | (2t+5,t+1,2t+4) |

Since `sum_(k=1)^e v2(k)=e-popcount(e)`, summing these classes gives

`D(e)=(7e-2popcount(e)+1, 2e-popcount(e)+2b+1, 6e-2popcount(e)+2b+2)`.

The complete rundown tariff is `R(0,I)=P(0,I)` and, for e>0,
`R(e,I)=J(e,I)+D(e)+(7,2,8)`. The independent checker instead sums the
individual decrement cases, importing neither this closed-form implementation
nor the primary/runtime code. The control suite additionally compares both
formulas with the real source Counter at 26 zero/power-of-two/neighbor cases.

## 4. Complete source-action difference

Let E=sum e_i, k be the number of positive exponents, and rho the complete
residue-Word invoice of one source radix_power validator at the actual
modulus and Word width. Put u=1 if k>0, otherwise 0. Old-minus-new differences are

```
residue: (E-u) rho,
index: -w*k*C(I),
record: sum_i R(e_i,I) - sum_i P(e_i,I) - w*sum_(e_i>0) R(e_i,I).
```

The old implementation has one Counter per exponent and E radix traversals.
The new method has all probes plus w rundowns per positive exponent, sharing
one radix traversal. All output Count operations cancel from the difference.
These equations include every additional probe, index copy, countdown and
clear; negative lanes are retained. The verifier meters rho independently
outside the compared interval, with every validator allocation and cleanup.
Its value is not supplied by a presumed O(1) arithmetic primitive.

This is not a universal cost improvement. With one exponent e=1,w=1, both
methods have one radix traversal and one rundown, while the new one adds a
probe and index copy. The complete same-output losing control executes both.
Use the exact formula to establish affordability at a proposed source site;
any runtime selector or new parameter guard has its own implementation cost.

## 5. Actual Layout.child_extents integration

For parent width n, f=floor(n/64), delta=n-64f, define the unchanged physical
embedding phi(x)=x for x<64f and phi(x)=x+2delta otherwise. For child starts
a=phi(first), b=phi(second), width c, the method validates c>0, disjointness,
body bounds, physical contiguity of both complete chunks, and that no chunk
crosses the original external gap. It then forms powers with exponents

`e=(a, b-a-c, 2n-b-c)`.

Before the gap factor is installed, the three Counts are
`(B*A^e0, A^e1, S*A^e2)`. Exactly one receives G: the first if a>=n, the
last if b+c<=n, otherwise the middle. Consequently

`B' G' S' A^(2c) = B G S A^(2n)`.

More strongly, the unchanged phi and complete source guards preserve the
ordered three spectator regions, not merely their volume. Returned Counts
retain the source's one-high-zero marginal format and canonical heads.

The adapter authenticates the complete Layout source and rewrites only its
three power-call expressions. The first two become deferred no-ops; the third
invokes the shared method on all three output/exponent pairs. All exponents
and output Counts are live at that point, before any gap multiplication or
release. Their intervening arithmetic depends only on geometry, not on the
Count values. It is therefore legal to defer the first two updates. Every
other statement, rejection guard, marginal conversion and finally cleanup
remains from the exact frozen method. The rewrite fails unless it finds the
expected three complete argument lists in source order.

## 6. Measured interval and completed coverage

Each comparison starts with the same canonical borrowed size/depth/child
Words, modulus/Ring, before/gap/suffix Counts, templates and unused spectator
Word. It includes the encoded size/64 division, real Geometry and Layout
construction, fields=depth+1, complete child_extents, marginal output disposal,
and geometry/field/column cleanup. Both variants preserve every borrowed byte,
head and live numerical owner; all newly created record and numerical backing
is erased. The observer checks full serialization without influencing runtime
control, and Word.inspect raises during the measured computation.

Fifteen pairs cover good, across-bank unit, head/tail pair and head/tail half
geometry at w=1 and3; a width 70 internal-child geometry; q=5 and an even-column
case; and the no-remainder/rank 42 boundary. OS seed 4 selects the nonunit
spectators. These are admissible geometry instances, not claims of literal
top-level reachability of every chosen current native source or of a complete
selected GL64 payload. q=3/5 fixtures do not instantiate the asymptotic large-q
supplier hypothesis. The identity/cost equations are uniform on their stated
valid-input domain; finite timings are additional observations only.

The named pairs save between about 28.49% and59.20% of complete source actions.
The width 70 pair is7,046,111→5,038,964 (28.49%). Each tested pair has the same
additional per-bank numerical peaks (index 21,residue 6). This does not prove
a complete joint physical reserve. Counter-role backing and all other newly
created source record backing are retained in the receipts, including erased
cells. No arbitrary dirty array is silently cleared or acquired.

## 7. Remaining boundaries and failure scope

The action units are retained source Tape/Word reads, writes and unit moves.
Python execution times in TIMINGS.json are single same-input observations;
there is no claimed physical-step tariff, stable wall-clock speedup or optimality.
The loop/control compiler, finite-q source setup, actual allocator and original
root-width stock retain their own costs. A supplied blank record role is not
a free dirty register. Malformed modulus contexts still reject, but the source
validator can retain its failing quotient/remainder, and loop interchange can
change partial outputs before rejection. Full malformed-input/interrupt rollback
is outside the successful admitted-input equivalence.

This fills the encoded atom-power/child-geometry component left separate by
PR4025/4062. Context/directory/admission composition, source-bound whole payload
handoff, coefficients, native routing, copied state, physical lifetime maxima,
precision and full supplier admission remain separate. No κ is inferred.

Credit: Jose Manuel/jmbarrancoml, David Arias/PR2753, ywz65/PR2590,
ToikY/PR4025, Chris R/Clear1nsight/PR4062 and the retained source/record/caller
lineage. Tekalign (`tekuuu`) with substantial OpenAI Codex assistance;
Apache-2.0. Frozen inputs are unchanged.
114 changes: 114 additions & 0 deletions research/encoded-child-spectators/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Encoded shared atom powers for recursive child spectators

The actual BIT caller builds three spectator cardinalities through repeated
`radix_power` traversals. This package moves that traversal outside the runtime
atom loop and shares it across all three powers. The exponents stay encoded;
one reusable blank counter role replaces repeated validator work.

This fills the **child-geometry component** explicitly left open by
[PR4025](https://github.com/CrocSwap/integer-mult-bounds/pull/4025) and
[PR4062](https://github.com/CrocSwap/integer-mult-bounds/pull/4062).
It supplies an opt-in kernel, an adapter to the **actual frozen
`Layout.child_extents` method**, and a complete source-action comparison.
It does not supply the complete recursive caller or a new κ.

| Same complete geometry/cleanup input | Original actions | Shared actions | Reduction |
| --- | ---: | ---: | ---: |
| Internal-child width 70, n=321, q=3, w=2 | 7,046,111 | 5,038,964 | 28.49% |
| q=5, even columns, w=2 | 2,334,453 | 1,042,650 | 55.34% |
| No remainder, rank 42, w=1 | 84,977 | 34,668 | 59.20% |

Across the fifteen declared pairs the reduction is about 28.49%–59.20%.
These totals sum retained **record, residue-Word and index-Word** reads,
writes and unit moves. Added probes, counters, copies, marginal conversions
and disposal are charged. They are not physical-machine step counts or a
measured production-runtime speedup. The tested additional per-bank numerical
peaks remain index 21/residue 6. No complete physical reserve follows.

## Component API and exact budget

`Powers(env, workspace=None).multiply(items, ring, q)` accepts one to three
fixed pairs `(owned_count, borrowed_exponent_word)`. It maps each Count v to
`v*(q^w)^e`, preserves the Ring/exponent inputs at their canonical heads,
and returns its distinct **owned blank** counter role erased at head 1.
A caller can provide an existing blank role; arbitrary dirty acquisition is
not implemented. `runtime.adapt(env,powers)` returns the source-method adapter
without changing the original method or frozen files. The reference loader
uses a private interpreter/module context; this is a research component,
not shared-caller installation.

For E=sum(e), k positive exponents and complete radix invoice rho, the exact
old-minus-new residue invoice is `(E-1)*rho` when k>0. The extra index bill
is `w*k*(3I+3,0,2I+4)`; the complete counter delta has a closed form in
[PROOF.md](PROOF.md). It is checked against individual trailing-zero cases
and actual source Counters. Counter costs are not treated as free.

A **same-output exponent-one losing control** demonstrates why this is not
a universally faster primitive. Future callers must prove the complete
budget at their site, including any dispatch rule, instead of replacing
all powers indiscriminately.

## Reproduce

From the repository root, Python 3.12, standard library only:

```sh
python3.12 -B scripts/research_package.py --package research/encoded-child-spectators
```

Expected markers: `PASS_ENCODED_CHILD_SPECTATORS`,
`PASS_INDEPENDENT_CHILD_SPECTATORS`, `PASS_CHILD_SPECTATOR_CONTROLS`, then
`PASS_REGISTERED_RESEARCH_PACKAGE`. Normal replay is read-only; receipt
creation with `verify.py --write` refuses an existing destination.

[CERTIFICATE.json](CERTIFICATE.json) records all paired bytes, complete
lane invoices, ownership/head restoration, erased backing and geometry.
[TIMINGS.json](TIMINGS.json) records single same-input Python observations;
timing values are not mathematical acceptance fields.

Coverage includes all six source child-geometry branches at w=1/w3, remainder
and gap placements, width 70 (above the recursive cutoff), q=5 and rank 42.
These are valid geometry instances, not complete production packets or a
proof of every chosen source's top-level reachability. The independent
checker imports no runtime/primary code. It rederives geometry and counter
accounting, taking rho as the measured validator invoice rather than
reimplementing the source's full Ring arithmetic. Controls include real source
geometry guards, 26 Counter tariff calibrations, omitted output work,
alias/reentrancy, invalid radix detection, source/inventory corruption,
typed receipts and overwrite refusal. Word.inspect is disabled during the
measured interval. Error detection is retained; full malformed-input or
interruption rollback is not claimed.

Exact base: `20ecf2891d80b5acf18d980b2164fb44ea7faa90`.
[SOURCES.json](SOURCES.json) seals eight canonical live files; all are checked
before source execution. [CONTEXT.json](CONTEXT.json) pins predecessor heads
and the claim. OS seed 4 selects the BIT track and nonunit spectator cases.
Frozen predecessors and the selected frontier remain unchanged.

## Open next questions

Compose this adapter with #4062's actual Context/directory/admission interval,
using one existing blank counter role, then pay fixed capsule and payload
copies and all lifetime backing. That is the next concrete join; a tiny
controlled payload does not establish the full production caller.

Prove a useful source-coupled parameter region from the exact action formula,
including any encoded original/shared dispatch. The existing finite savings
do not establish a global speedup. Physical control/allocator tariffs,
original-width stock, whole payload/source admission and supplier transfer
remain separate. Structured first steps and blockers are in [TASK.json](TASK.json).

## Credit

David Arias/PR2753 supplied ordered child geometry and the logical caller;
Jose Manuel/jmbarrancoml supplied the fixed-role caller and retained runtime.
ToikY/PR4025 supplied the fixed-d² shared-radix precedent, following ywz65/PR2590;
Chris R/Clear1nsight/PR4062 supplied the preparation composition and released
geometry handoff. All retained source/record/codec/caller attribution remains
with the unchanged originals. This extends the mechanism to **runtime encoded
atom exponents and the actual three-spectator method**; it does not re-claim
the fixed-d² result.

Tekalign (`tekuuu`), substantial OpenAI Codex assistance in design, tariff
proof, implementation, controls and packaging. Apache-2.0. Exact finite
checks are not independent human review or formal multiplication verification.
Loading