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
127 changes: 127 additions & 0 deletions research/continuation-output-return/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Designated child-output return

Ali Romman with substantial OpenAI Codex assistance. Apache-2.0.

## Contract and retained stack

Use the seven-symbol tape alphabet and physical push/pop of
[PR #5356](https://github.com/CrocSwap/integer-mult-bounds/pull/5356), at
[the exact source](https://github.com/aliromman/integer-mult-bounds/blob/ef1cc26e1e9a08c11cf382de948ee433bebab16d/research/delimited-continuation-stack/stack.py).
That result restores k=16 payload roles, their presence bits, heads and an
opaque binary descriptor. It requires every child segment empty at return.
The unchanged stack and source adapter are retained in vendor/. Their source
bytes and notices are checked. This PR adds output delivery, not a new stack.

Reserve one occupied empty parent output role before push. Its head is at its
segment origin. All other parent segments and heads are arbitrary under the
retained ABI. The child leaves one designated binary output of length L on
one fixed role, with its head anywhere in that segment. The child may leave
other binary work on its roles. Slots are compile-time control labels; the
child and parent labels may be equal. Descriptors are arbitrary finite binary
words. All calls succeed and are properly nested.

Add one relay tape with a BASE marker and an empty current segment at its
origin. It is distinct from all payload, control and descriptor tapes. Its
arbitrary ancestor prefix is preserved. There are nineteen tapes in total,
independent of nesting depth. The source API's logical counters and lexical
allocation remain a separate calibration facade; the return routine never
reads them, a saved origin, a saved length or a parent object.

## Schedule and invariant

First check that the relay head is immediately after BASE and reads blank.
Rewind the child output to its nearest LEFT marker by unit moves. Copy its
binary symbols, in order, to the relay until blank. Rewind the relay to BASE.
This preserves the output in relay cells before any child cell is erased.

For each of the fixed payload roles, rewind to LEFT, erase each current
binary symbol while moving right, then rewind to LEFT. No ancestor cell is
read or changed. Invoke the unchanged physical pop. It erases its frame and
returns each parent payload, head, presence bit and descriptor exactly.
The relay is outside this bank, so pop cannot erase it.

Check that the reserved target is blank immediately after LEFT. Copy relay
symbols to that role in order. Erase each relay symbol after copying it.
Rewind both tapes to their markers. The target now contains exactly the
child output, with head zero. The relay is empty at its original head.
All other parent roles and the descriptor have the exact pre-push state.

These assertions prove a matched boundary by loop induction. The copy loop
preserves the copied prefix and unread suffix. The erase loops affect only
current segments. The retained pop theorem restores the parent. The final
copy loop preserves the delivered prefix and the unread relay suffix. Its
postcondition restores the entry condition of the shared relay. Induction
on a finite call tree therefore reuses the same relay for arbitrary finite
proper nesting. At an outer return, a previously delivered inner result is
an ordinary child output. No recursion frame stores return data in host state.

## Complete bill

Count each current-symbol read, write and unit move as one action. Let Sp be
the sum of parent extents and Hp the sum of parent head offsets. Let A be the
number of absent parent roles. Let d and q be the parent and child descriptor
lengths. Let W and Hc be the sums of child extents and head offsets immediately
before return. Thus L<=W and Hc<=W. All these symbols are analysis variables;
the routine does not receive their values.

The retained push costs

```text
4Hp + 2Sp + 10k + 7d + A + 11.
```

The retained pop, after payload retirement, costs

```text
9Hp + 2Sp + 21k + 11d + 5q + A + 28.
```

Rewinding from offset h to its marker costs 2h+3. Erasing a current segment
of size s from offset h costs 2h+5s+7. If the original output head is h0,
checking the relay and copying the output costs 2h0+6L+11. It leaves that
source at offset L. Retiring all roles then costs
2(Hc-h0+L)+5W+7k. Checking the target and installing the output while erasing
the relay costs 9L+11. Thus the complete matched push/return boundary costs
exactly

```text
13Hp + 4Sp + 38k + 18d + 5q + 2A + 2Hc + 5W + 17L + 61.
```

Child computation and its input/descriptor production are separate costs.
They are not hidden in this formula. Output copying, child cleanup, frame
cleanup, descriptor return and relay cleanup are included. Since Hp<=Sp,
Hc<=W, L<=W and A<=k, the boundary is at most

```text
17Sp + 40k + 18d + 5q + 24W + 61.
```

There is no ancestor-length or nesting-depth factor. If Sp,W,d,q=O(V), this
is O(V) and fits the retained per-node allowance. Those actual volume and
descriptor bounds are explicit premises, not established production facts.

The relay visits L cells in one boundary and is empty at its end. Across
successful calls its retained backing needs at most the maximum output
length seen so far, not a sum over nesting depths. The parent output owns L
cells in its reserved role. During the first copy the child and relay both
hold the result; neither this duplicate nor the parent output is free stock.
All inherited continuation frames and parked payload backing remain charged.

## Evidence and scope

The verifier checks 1800 exact small return bills, including zero-length
outputs and every head position through length three. Twelve nested cases
use depths 1,2,7,31 and ancestor lengths 16,257,4096. Six actual compact-source
cases run both retained layouts and deliver all 1024 output bits to the
parent. An independent direct record permutation checks their values. All
six returns cost 24388 actions. Six malformed-state controls reject. Errors
outside the ABI need not restore a partially executed boundary.

The source calibration still uses the predecessor's weak-reference allocator
and host logical counters. This result does not compile those facilities.
It does not implement recursive C, packet reorder, a general descriptor
producer, the full production rectangle, native admission, stock matching,
precision or outer recovery. It closes the physical output-return boundary
under a reserved-slot ABI. It does not change kappa or prove the complete
multiplication theorem. Independent human and proof-kernel review remain open.
61 changes: 61 additions & 0 deletions research/continuation-output-return/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Physical output return through a continuation

This package closes the designated child-output return question left by
[PR #5329](https://github.com/CrocSwap/integer-mult-bounds/pull/5329) and
[PR #5356](https://github.com/CrocSwap/integer-mult-bounds/pull/5356).
One added relay tape preserves the result through child cleanup and physical
pop, delivers it into a reserved empty parent role, and returns empty.
All other parent bytes, heads, presence bits and descriptors are restored.
The fixed nineteen-tape bank works for arbitrary finite proper nesting.

[PROOF.md](PROOF.md) gives the contract, nesting proof, exact linear bill and
space charge. [return_output.py](return_output.py) uses only current-symbol
operations and unit moves. [RESULT.json](RESULT.json) records 1800 exact
invoice cases, nested returns through depth 31, six unchanged compact-source
endpoints and six rejecting ABI controls. Both source layouts deliver 1024
bits in 24388 return actions for dirty ancestor lengths 16,257,4096.

```sh
python3.12 -B scripts/research_package.py --package research/continuation-output-return
```

Both registered isolated, warning-strict normal and optimized modes print
`PASS_CONTINUATION_OUTPUT_RETURN`. Source bytes and the complete receipt are
checked. No third-party package is needed. The all-size claim rests on the
written induction, not the finite tests.

The complete kappa calculation is unchanged. A reserved empty parent output
role is required. Actual packet order, recursive C, physical source allocation,
logical-counter compilation, full supplier/stock/precision and outer recovery
remain open. Lean, Docker, selected cold replay and full-history validation
were not run. The source calibration retains its explicit Python facade.

## Open next questions

Bind this returned stream to the actual FOUR/base packet order and its left
map. First show where the caller reserves the output role and how its child
width determines the stream grammar. Separately compile the source's logical
counters and lexical slots at the repair/stable_radix maximum-live cut.
Neither obligation is discharged by successful byte delivery alone.

## Credit and coordination

Base 7c472563474e60185e6ca101a17622133d047e56, priority7. The live stack handoff
was already complete, so this package takes only its remaining output-return
boundary. Current PR and Discussion bodies and main notes were checked;
arbitrary historical diffs and unpublished work remain outside coverage.

The byte-exact stack and adapter in vendor/ are consumed from Ali Romman's
pending PR #5356, head ef1cc26e1e9a08c11cf382de948ee433bebab16d. They are pinned
in [SOURCES.json](SOURCES.json). Replay pins resolve to the byte-exact copies
in this PR history. Each upstream_pin retains the original pending source.
Thus a clean checkout does not need an unmerged predecessor commit. They are
not claimed as main-branch or independently accepted results. The complete
linear theorem is conditional on that retained stack contract. JoyboyBrian supplied the segment refinement
and locality invoice. Jose Manuel/jmbarrancoml supplied the retained sequential
compact source. Douglas Colkitt supplied guard/repair, Cinna Davis the caller,
and Matarener the cover/stock lineage. Original notices remain unchanged.

New work: Ali Romman with substantial OpenAI Codex assistance in proof,
implementation, review and verification. Apache-2.0. No independent human or
proof-kernel acceptance is claimed.
75 changes: 75 additions & 0 deletions research/continuation-output-return/RESULT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"controls": 6,
"matched_boundary": "13Hp+4Sp+38k+18d+5q+2A+2Hc+5W+17L+61",
"nested": [
{
"depth": 1,
"steps": 2859
},
{
"depth": 2,
"steps": 5911
},
{
"depth": 7,
"steps": 22133
},
{
"depth": 31,
"steps": 118414
}
],
"return_sha256": "fbf3167da26c7887b769689075e5dc3afcea2ef668496975bc9e6afec8c85751",
"small_cases": 1800,
"source": [
{
"late": false,
"output_bits": 1024,
"prefix": 16,
"records": 128,
"return_steps": 24388,
"sha256": "4af9929ff7e3d8e72146e260c7e007e975b7c17ef26c0271355333fe64072a48"
},
{
"late": false,
"output_bits": 1024,
"prefix": 257,
"records": 128,
"return_steps": 24388,
"sha256": "4af9929ff7e3d8e72146e260c7e007e975b7c17ef26c0271355333fe64072a48"
},
{
"late": false,
"output_bits": 1024,
"prefix": 4096,
"records": 128,
"return_steps": 24388,
"sha256": "4af9929ff7e3d8e72146e260c7e007e975b7c17ef26c0271355333fe64072a48"
},
{
"late": true,
"output_bits": 1024,
"prefix": 16,
"records": 128,
"return_steps": 24388,
"sha256": "9b6381e2a8cffec1c0d499b50909c409c9dc178584321a9a6e73fafbdbfaf547"
},
{
"late": true,
"output_bits": 1024,
"prefix": 257,
"records": 128,
"return_steps": 24388,
"sha256": "9b6381e2a8cffec1c0d499b50909c409c9dc178584321a9a6e73fafbdbfaf547"
},
{
"late": true,
"output_bits": 1024,
"prefix": 4096,
"records": 128,
"return_steps": 24388,
"sha256": "9b6381e2a8cffec1c0d499b50909c409c9dc178584321a9a6e73fafbdbfaf547"
}
],
"status": "PASS_CONTINUATION_OUTPUT_RETURN"
}
64 changes: 64 additions & 0 deletions research/continuation-output-return/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"schema_version": 1,
"base_commit": "7c472563474e60185e6ca101a17622133d047e56",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "c35482cd9035843b15a634cc8276a7e1e40e8395",
"sha256": "6fe0a099b89aa2aed796a13c3a21dafc63f3388ebf397464e44e0451893b9375"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602",
"sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72"
},
{
"path": "research/complex-segment-boundary/README.md",
"usage": "input",
"git_blob": "0e2e520e4a9ade9cc1d2708419b1918b99e9302b",
"sha256": "94d652b8891f8f41442959d02bd0ca641fe1b3a99f32ba95812353e6d21344e2"
},
{
"path": "research/complex-segment-boundary/source/NOTICE.md",
"usage": "input",
"git_blob": "e82bfef53054bd753ba0aa8a966f84427faa2293",
"sha256": "74a9f03e9ce467c75f5f7cf1b8465d349ea38ef114afad261824c3bcf13da00f"
},
{
"path": "research/complex-segment-boundary/source/compact.py",
"usage": "input",
"git_blob": "60bc206c78150f23563a4775800b0dd32025843d",
"sha256": "0e1027a60f38c21cfd808c8ce44dcc2423810efdab0e15f02b07f261ad48fc3c"
},
{
"path": "research/complex-segment-boundary/source/monomial.py",
"usage": "input",
"git_blob": "5fa4494167c4ba668993a2b1c902969518728a4c",
"sha256": "394f9a465ac9148af0c20844d375e4befbef17d92b2fcc840d83419480dd4740"
},
{
"path": "research/complex-segment-boundary/source/streams.py",
"usage": "input",
"git_blob": "61542ce4c9eb51bfc113475b4f98649cb90a853e",
"sha256": "718a582a50aee8f1f04945ed942be1d4162962fe47dbf05c6ff37b7fb8c61257"
},
{
"path": "research/continuation-output-return/vendor/stack.py",
"usage": "provenance",
"pin": "head:1362d9350b733af1c8a8822e0a013c1ff7de64dc:research/continuation-output-return/vendor/stack.py",
"git_blob": "a5d6753b901901a5b2d1a4dd72134e53af70c666",
"sha256": "21a2213aa850c55e5eace4cd10b72b958d7ee84d83a014567902ce8ee9b3f4f2",
"upstream_pin": "head:ef1cc26e1e9a08c11cf382de948ee433bebab16d:research/delimited-continuation-stack/stack.py"
},
{
"path": "research/continuation-output-return/vendor/adapter.py",
"usage": "provenance",
"pin": "head:1362d9350b733af1c8a8822e0a013c1ff7de64dc:research/continuation-output-return/vendor/adapter.py",
"git_blob": "d860b58c603fc600f95e3413f9230398e9b957b3",
"sha256": "e13823e4124caa4b25050ddd9ac960db59c81e2db369b9ec7b201aca7efbebb8",
"upstream_pin": "head:ef1cc26e1e9a08c11cf382de948ee433bebab16d:research/delimited-continuation-stack/adapter.py"
}
]
}
Loading