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
11 changes: 11 additions & 0 deletions research/row-reversal-rejection-cleanup/NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Source notices

The new transformer, written proof and replay were produced by Nick Petalas,
under Apache-2.0. The visited-interval technique is classical.

The exact `reverse.py`, `controller_reference.py` and `NOTICE.md` exports
under `inputs/reversal/` are Jerry Chen / CubeJerry's #7427 at
`7662d01d827c95d90032579c168cae78aa531f2f`. Their notices remain unchanged.
The preserved notice describes the original package and its predecessors;
its historical verification and review statements are not new claims of
this package. No other predecessor programs are imported here.
152 changes: 152 additions & 0 deletions research/row-reversal-rejection-cleanup/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Retirement after a finite rejection

The transformer and this supplied-interface application were produced by Nick
Petalas. The visited-interval method is classical. The successful reversal,
its original implementation, and its original successful-run accounting are
Jerry Chen / CubeJerry's #7427, not results claimed here.

## Statement and premises

Fix a program on n tapes with the local instructions `read`, `write`, unit
`move`, `goto` and `halt`. A missing read branch is rejection. The program
and its finite alphabet are fixed before execution. Some tapes are public;
the rest are private. Each private cell the source execution will visit is
initially blank. Public cells may contain arbitrary alphabet symbols.

Add n distinct monitor tapes. Each starts at its own origin. Its window
corresponding to the source run's visited interval, with one additional cell
on each side, is blank on entry. These whole-window blankness premises must
be supplied by the caller. Opaque exterior contents are permitted. This is
not a method for discovering whether a borrowed dirty interval is blank.

Suppose the source halts or rejects after T instructions, counting its
terminal halt or rejecting read. Let I_i be its visited interval on tape i,
let l_i = |I_i|, and let L = sum_i l_i. The transformer emits a fixed program
on 2n tapes that has the following behavior.

1. It simulates every source instruction up to that terminal event.
2. It preserves the source's public contents at that event, erases every
visited private cell, and returns every original and monitor head to its
entry position. It erases all monitor marks.
3. It terminates at distinct accepting and rejecting locations, matching the
source's terminal event.
4. Its time is at most `5T + 16L + 6n <= 21T + 22n` local instructions.
5. Each original head visits at most one extra cell at each end of I_i.
Each monitor visits the corresponding interval with those two cells.

This is a scoped simulation and cleanup theorem. It asserts no cleanup on a
nonterminating execution, on a host interruption, on an absent blank window,
or on a machine fault outside the declared alphabet and instruction model.
Public writes already performed by a source are not rolled back.

The implementation supports 1 <= n <= 32, source tables of 1 to 10,000
locations, and alphabets of at most 16 symbols. These are compiler input
bounds, not bounds on T or the runtime descriptor values. The theorem holds
for each supported fixed table and every finite run meeting the premises.

## Simulation invariant

For tape i, the monitor head has the same displacement from its origin as
the original head has from its origin. The monitor stores `|` at its origin,
`1` at each other visited source position, and blank at unvisited positions.
Unit head motion makes the visited set an interval containing the origin.

Initialization writes the n origin markers. A source read, write or jump
uses one instruction. Read branches are relocated to the corresponding
compiled locations; absent branches go to rejection cleanup. A halt goes
to acceptance cleanup. A move becomes these local instructions:

1. Move the original head one cell.
2. Move its monitor head in the same direction.
3. Read the monitor. A prior mark branches directly to the next source
location. On blank, write `1` and jump there.

Thus every source instruction costs at most five compiled instructions.
No source value, integer, coordinate, length or history counter enters the
runtime control. The simulated original contents agree instruction by
instruction with the source. Marks never change a public or private source
symbol during simulation.

## Cleanup invariant

Acceptance and rejection have separate copies of the same cleanup graph.
The terminal status therefore needs no runtime status register.

For each tape and its monitor, the graph first moves both heads left until
the monitor is blank. This is exactly the cell immediately left of I_i.
It moves both heads right once and sweeps the l_i marked cells to the right.
On private tapes it writes blank at every such source cell; on public tapes
it makes no source write. It clears each `1` on the monitor, retaining `|`.
The first blank after the interval ends this sweep. No source cell outside
I_i is written.

Both heads move left once, then continue left through the now blank monitor
until `|`. They are then at their original origins. Erasing `|` leaves the
monitor blank and makes the pair ready for another call. This loop stops
because the origin lies in I_i. Its stopping condition does not depend on
source symbols, which may include blanks and markers anywhere.

Processing a pair never moves or writes another pair. Induction through
the fixed list of n pairs proves all head returns and erasures. Initial
private blankness makes erasure restore its entry contents; exterior cells
retain their contents even when an end cell is visited by cleanup.

## Time and historical backing

Write a for the number of marked cells traversed in the first left scan and
b for the distance from the rightmost source position to its origin. Then
`a <= l_i` and `b <= l_i - 1`.

The first scan and its turn cost `4a + 3`. A right-sweep nonorigin cell
costs at most seven instructions, and the unique origin cell saves one.
The right turn costs three. The return costs `4b + 2`. Hence one pair costs
at most `15l_i + 3`, before the final cleanup halt. With n initialization
writes and that halt, the full run costs at most

`5T + 15L + 4n + 1 <= 5T + 16L + 6n`.

Each source move can enlarge the sum of visited lengths by at most one, so
`L <= T+n`. This gives the displayed bound `21T + 22n`. All loops have a
finite scan bound from l_i, a or b; no numerical length is supplied to the
runtime graph.

Relative to the source execution's historical backing, cleanup adds at most
2n original cells. The monitor run visits at most `L+2n` cells. If its prior
historical backing is H0, the combined historical backing is at most

`source historical backing + H0 + L + 4n`.

Erasing cells does not reduce historical backing. On subsequent calls the
same monitor objects, origins and histories persist. An old long erased
tail is not scanned: the current run marks only its current interval, whose
adjacent unmarked cells stop the cleanup sweeps.

## Whole-record reversal application

The retained table is precisely #7427 at commit
`7662d01d827c95d90032579c168cae78aa531f2f`. Its three descriptor tapes and
DATA are public, and its nine other tapes are private. The two retained
source files are byte-bound in `program.py` and `SOURCES.json`.

The predecessor stages the result and validates packet cardinality before
writing DATA. Its stated rejection contract preserves all public contents
but does not retire private state or heads. Taking that source property as
a premise, the new simulation preserves public contents on rejection and
adds the missing retirement. On acceptance it implements the same complete
record permutation. The new graph uses 26 tapes and the original four
symbols. It adds no trusted shape, address stream, runtime decoded integer
or payload callback.

For a valid packet the predecessor's source bound is O(V+E), so the new
bound is O(V+E). For malformed packets the statement is O(T) in the actual
finite rejected source execution. A descriptor can request much more work
than the actual DATA length, so no O(actual payload) rejection bound is
claimed. Providing the additional monitor windows and their owned lifetime
is an explicit caller obligation.

`verify.py` executes the emitted graph on valid and malformed packets and
on a rejected-then-valid reuse of the same 26 objects. Generic fixtures
also move left of the origin, retain public writes made before rejection,
and erase private intervals. These finite checks corroborate the invariant
proof; they do not enumerate all descriptors or prove a multiplication
theorem. Independent human and formal proof-kernel review are unclaimed.
106 changes: 106 additions & 0 deletions research/row-reversal-rejection-cleanup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Reuse reversal banks after a finite rejection

This scoped constructive proof and executable graph add rejection retirement
to Jerry Chen / CubeJerry's [#7427](https://github.com/CrocSwap/integer-mult-bounds/pull/7427).
The contribution was produced by Nick Petalas. No new kappa is claimed.

The new fixed graph uses **26 tapes, 2,145 locations and four symbols**.
After a finite malformed-input rejection it preserves all public contents,
erases private work and returns every head. The same private banks can then
serve a valid reversal. The predecessor's successful reversal and its public
preservation on rejection are cited premises. Their verification is not the
deliverable.

For a source run of T instructions on n tapes with total visited length L,
the new graph costs at most `5T+16L+6n <= 21T+22n`. Here n=13, giving
`21T+286`. The graph records visits on synchronized monitor tapes, clears
each marked private interval and returns to its retained origin marker.
The visited-interval method is classical; the explicit transformer and this
rejection/reuse application are the new contribution. [PROOF.md](PROOF.md)
gives the quantified premises, loop bounds and historical-backing bill.

The source is frozen at `7662d01d827c95d90032579c168cae78aa531f2f`.
Only its two executable files and original notice are retained locally.
[SOURCES.json](SOURCES.json) records their original paths, byte lengths,
Git blob IDs and SHA256 hashes. The verifier authenticates these local
exports before importing them. No pending Git object or network is needed.

## Evidence and reproduction

From the repository root with CPython 3.12:

```sh
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -B -W error research/row-reversal-rejection-cleanup/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -I -O -B -W error research/row-reversal-rejection-cleanup/verify.py
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/research_package.py --package research/row-reversal-rejection-cleanup
/Users/nick/git/integer-mult-bounds/.venv/bin/python3.12 -B scripts/check_research_commit.py --package research/row-reversal-rejection-cleanup --check-source-history
```

A reviewer elsewhere may substitute their CPython 3.12 path. Expected markers
are `PASS_ROW_REVERSAL_REJECTION_CLEANUP`, `PASS_REGISTERED_RESEARCH_PACKAGE`
and `PASS_RESEARCH_COMMIT_BYTES`.

The complete replay executes 518 valid packets, 25 malformed packets, a
rejected-then-valid reuse chain and 16 generic left/right fixtures. It checks
public contents, opaque exteriors, original owner identity, all head returns,
private erasure, preserved historical backing and the instruction bound.
Eight controls reject omitted erasure, an unretired monitor origin and six
invalid compiler inputs. The valid-packet oracle reverses complete records
directly. The generic fixtures include public writes before rejection and
prove that cleanup preserves that terminal public state rather than rolling
it back. All counts enumerate the stated finite fixture sets.

`RESULT.json` is generated by `verify.py --record`, with hashes binding the
proof, program, verifier and source manifest. Default replay only reads the
receipt. Runtime transition counts are local-instruction counts; they are
not wall-clock speed claims or a proof-assistant certificate.

The compiler and checker use managed Python containers. The finite fixture
dimensions and two-million-instruction per-run cap bound replay resources.
The mathematical runtime is the emitted local graph; its scan loops have
the visited-interval bounds proved in PROOF.md.

## Limits and scope

The source program must halt or reject, and its private visited cells and
the additional monitor windows must be blank on entry. The caller must own
and provide those windows. Erasure preserves historical allocation. No
cleanup after interruption or nontermination is promised. This gives time
linear in the finite rejected execution, which can be much larger than the
actual DATA length for excessive descriptors.

Card `formal-interface-lemma`, priority revision 8, changes scope to #7427's
Open next question 4. Base `e54523517d0f03e58352e647c403a5af3e525a57`.
The source-binding orientation command passes at selected #7000; the older
#5599 values in the priorities prose are historical. This package changes no
selected record. It implements no complete native MOVE, physical caller,
common-grid conversion or multiplier. Those integrations, the selected cold
replay, independent human review and formal proof-kernel acceptance are unrun
or unclaimed.

## Open next questions

Can fewer monitor tapes preserve this contract over the original alphabet?
Start with one pair of source heads and prove their displacement relation
on every malformed path before sharing a monitor. Can a concrete caller
reject excessive descriptors before doing work exponential in their bit
length? First give its encoded resource cap and pre-write contract.
[TASK.json](TASK.json) records why these questions matter and their blockers.

## Credit and related open work

Jerry Chen / CubeJerry #7427 supplies the reversal, finite machine reference,
source contract and failure-retirement question. The canonical stream
two-stack algorithm and visited-interval cleanup are prior techniques.
The original notice is preserved in [inputs/reversal/NOTICE.md](inputs/reversal/NOTICE.md).

- #7427 implements the supplied-descriptor reversal with a success-only
retirement contract; this package adds rejection retirement.
- #7428 produces descriptors and applies that reversal to a selected
translation. Its descriptor producer and complete caller are outside this
package; its use of the original reversal does not include this wrapper.
- #7425 and #7426 implement related literal phase tables with success-only
private retirement. They are not transformed or priced here.

New material is Apache-2.0. Independent human and formal proof-kernel review
are unclaimed.
57 changes: 57 additions & 0 deletions research/row-reversal-rejection-cleanup/RESULT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"bindings": {
"PROOF.md": "9a34020b394d15aa26f40efe06bb9446206769a13bdb6f98577f6f89d422f04e",
"SOURCES.json": "b43a18d5fe88f4244466f079d2e56447baeec68773d0181ea8072484f018ce23",
"program.py": "905712189a9785244cb3058c8c552dae438a31eca565e72f7b8e1455202e326f",
"verify.py": "a36baae51054f0e30e475e139ab7b6b9f79c453aed7ff799770105150981ffe5"
},
"controls": [
"private_erasure",
"origin_retirement",
"bad_jump",
"long_move",
"unknown_write",
"fallthrough",
"missing_operand",
"nonlocal_opcode"
],
"generic": {
"calls": 16,
"evidence_sha256": "4567b13409914b2e4346154de783281833381f294b02ead341c13b8eceaeecf6"
},
"locations": 2145,
"pins": {
"inputs/reversal/NOTICE.md": "940493cde2626cb55438be8abda72b9ad971bf059f7c9046591665163e266904",
"inputs/reversal/inputs/controller_reference.py": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73",
"inputs/reversal/reverse.py": "4b516d85baf3303db809bc1174394009b1fc71a8f7d17fb6c729ec8bb6aba245"
},
"rejection": {
"calls": 25,
"evidence_sha256": "d82f14a4a3087fb9250ad50c6962a1a2862c0e010783a6317aeb40d51ba3832a",
"transitions": 25832
},
"reuse": {
"final_history": 178,
"first": {
"source_span": 57,
"source_steps": 499,
"status": "reject",
"steps": 1768
},
"prior_history": 166,
"second": {
"source_span": 54,
"source_steps": 587,
"status": "accept",
"steps": 1851
}
},
"source_locations": 524,
"status": "PASS_ROW_REVERSAL_REJECTION_CLEANUP",
"success": {
"calls": 518,
"evidence_sha256": "218e3351d3fbbebea3e17c3eac18d24e29f3c470a773c3d7c7b293a0f1e9e9a5",
"transitions": 1121672
},
"tapes": 26
}
50 changes: 50 additions & 0 deletions research/row-reversal-rejection-cleanup/SOURCES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"schema_version": 1,
"base_commit": "e54523517d0f03e58352e647c403a5af3e525a57",
"files": [
{
"path": "certificates/selected-result.json",
"usage": "provenance",
"git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8",
"sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1"
},
{
"path": "docs/research/agent-task-catalog.json",
"usage": "provenance",
"git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec",
"sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81"
}
],
"retained_exports": [
{
"local_path": "inputs/reversal/reverse.py",
"origin_repository": "CrocSwap/integer-mult-bounds",
"origin_commit": "7662d01d827c95d90032579c168cae78aa531f2f",
"origin_path": "research/literal-row-reversal/reverse.py",
"origin_url": "https://github.com/CrocSwap/integer-mult-bounds/blob/7662d01d827c95d90032579c168cae78aa531f2f/research/literal-row-reversal/reverse.py",
"sha256": "4b516d85baf3303db809bc1174394009b1fc71a8f7d17fb6c729ec8bb6aba245",
"git_blob": "60fce51dd8c3336e2bcf2873df254190e2203e14",
"bytes": 6649
},
{
"local_path": "inputs/reversal/inputs/controller_reference.py",
"origin_repository": "CrocSwap/integer-mult-bounds",
"origin_commit": "7662d01d827c95d90032579c168cae78aa531f2f",
"origin_path": "research/literal-row-reversal/inputs/controller_reference.py",
"origin_url": "https://github.com/CrocSwap/integer-mult-bounds/blob/7662d01d827c95d90032579c168cae78aa531f2f/research/literal-row-reversal/inputs/controller_reference.py",
"sha256": "e664a748e6b6797d4b60f60a7a7dd68b59a5608acf56b9c5d8b466f363755f73",
"git_blob": "3ab6d0361f35038ffcdf0cf81a157f7a17b40e72",
"bytes": 5938
},
{
"local_path": "inputs/reversal/NOTICE.md",
"origin_repository": "CrocSwap/integer-mult-bounds",
"origin_commit": "7662d01d827c95d90032579c168cae78aa531f2f",
"origin_path": "research/literal-row-reversal/NOTICE.md",
"origin_url": "https://github.com/CrocSwap/integer-mult-bounds/blob/7662d01d827c95d90032579c168cae78aa531f2f/research/literal-row-reversal/NOTICE.md",
"sha256": "940493cde2626cb55438be8abda72b9ad971bf059f7c9046591665163e266904",
"git_blob": "45c98a1b3ebf215989afaa966fe413af072a0973",
"bytes": 2009
}
]
}
Loading
Loading