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
65 changes: 65 additions & 0 deletions research/selected-regional-block-emitter/PHYSICAL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"recursive": {
"codec": {
"commands": 248,
"moves": 271092,
"reads": 287802,
"slot_tests": 4096,
"writes": 135489
},
"counts": {
"calls": 4,
"macros": 675,
"residuals": 20,
"returns": 4
},
"instructions": [
163,
23
],
"parking": {
"moves": 541968,
"reads": 677952,
"steps": 338976,
"writes": 270992
},
"payload_sha256": "52ab99ed3fbdb5f1a855afcdfe4d95f591d5a3804acf8d913822b097745cd812",
"restored": [
[
1,
4
],
[
1,
7
],
[
1,
14
],
[
1,
17
]
],
"saved": [
[
1,
4
],
[
1,
7
],
[
1,
14
],
[
1,
17
]
]
},
"status": "PASS_DIRECT_RUN_PHYSICAL_CONTINUATIONS"
}
165 changes: 165 additions & 0 deletions research/selected-regional-block-emitter/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Direct emission of the authenticated inner residual run

## Exact claim and inherited contract

Fix the authenticated `macro_code.compile_node`, `residual_blocks.Cursor` and
`itinerary` implementation pinned in SOURCES.json. Use the predecessor's
supported immutable plans/Residual fields, stable source namespace and complete
successful finite-emission domain. Python allocation/container identity, frame
tracing and hostile mutation are not observers in that contract. No source file
or live module global is changed. The replacement is opt-in.

The direct emitter replaces only the nested residual helper's axis/Cursor
enumeration with `operations.append_run(definition)`, plus the predecessor's
sink construction/finalization boundaries. The helper's factory call,
`residual_begin`, and `residual_end` statements are untouched. All outer
schedule, LOW, owner, route, scalar and factory loops remain literal source.
The source SHA256 is checked against the supplied pinned digest before AST
transformation; the entire replaced axis/Cursor subtree must match the exact
recorded syntax. This is not a generic compiler for unknown Cursor classes.

**Inner-run refinement.** For every successful admitted source invocation,
under these premises, the direct emitter makes the same ordered factory calls
with the same arguments and retains each exact returned Residual object. Its
indexed operations equal the original logical word at every original PC,
including every original Residual identity. It invokes no Cursor constructor
or `take`, emits no transient block tuple during compilation, and builds one
plan index/snapshot per distinct plan object. Original plans and definitions
are not interned or merged.

If a per-append observer is supplied, `compiler` intentionally delegates to the
predecessor enumerating compiler. Every original append is observed, and no
block-enumeration saving is claimed on that path. There is no silent observer
suppression or use of a host callback to stand in for skipped side effects.

## Literal Cursor substitution

The actual Cursor constructor sets `(position,stage)=(0,0)` and its finite
bound to3 for a good plan or the number C of fallback commands. It allocates a
finite schema and validates those initial labels. It does not call the factory,
modify the plan, touch a payload tape or publish an external event. Its `take`
only reads the immutable plan and advances its private position/stage.
These are the only omitted source actions. Allocation/frame instrumentation
could observe them and is explicitly outside the predecessor contract.

For a good plan the word is

```
(forward,0,0), (good,1,0), (backward,2,0).
```

For fallback command i, a child emits `(pair,i,0)`, `(pair,i,1)`, `(pair,i,2)`;
an add/sign emits `(sweep,i,0)`. Induction on the private Cursor position and
stage establishes exactly the concatenation of these words. Empty fallback
is empty. For an axis definition, the source emits the one block
`(axis,definition.axis,0)`, including axis0; it never constructs a Cursor.

The credited PlanIndex stores cumulative lengths with child weight3 and other
weight1. Its `at(k)` locates the unique command interval and returns exactly
the corresponding Cursor label. This index theorem and implementation are
predecessor work, reused unchanged. The new implication is that the
source-authenticated pure enumeration can be omitted entirely, with that index
standing for its complete output rather than validating each emitted label.
The supported plan grammar is unchanged: frozen immutable structures and the
closed add/sign/child alphabet. Unknown or mutable structures fail indexing.

## Sink invariant, factory observers and PCs

A direct segment proceeds through three states:

1. `residual_begin(role,d)` retains the original begin tuple and creates a
BlockRun referencing that exact d and its cached-or-new PlanIndex.
2. `append_run(d)` requires the same definition identity and an unemitted
segment; it retains one descriptor spanning its count, unless count is zero.
3. `residual_end(role,d)` requires the same role/identity and the explicit
emission state, then retains the original end tuple.

Missing, duplicate, foreign, interrupted or unclosed segments reject. A zero
run still passes through step2, so an omitted run marker cannot masquerade as
a legitimate empty fallback. Non-block source operations are retained exactly.
Prefix ends and the inherited Python PC bound are checked by `Sink.retain`.
Thus direct retained intervals partition the identical original PC range.
The unchanged Word/BlockRun indexed fetch reconstructs exactly each omitted
block tuple. The tuple container's identity is not preserved; Residual identity
is. Negative indices, slices and bound behavior are inherited unchanged.

Induct over the original outer schedule. Before a residual, both prefixes and
factory state agree. The untouched call receives the same arguments and yields
the same object under any binding behavior observing only its permitted call
history/stable inputs. Cursor omission changes none of that permitted state.
The preceding run lemma restores the same logical prefix before the next
factory call. This proves the ordered factory/identity statement, not merely
a count or equal-looking definition statement. Literal outer LOW enumeration
is still required; no rank/unrank jump or lazy outer iterator is supplied.

The verifier's replay binding returns the very objects from an independently
executed original factory transcript and checks every argument/position. This
allows literal `is` comparisons at every begin/block/end, separately from the
written call-history induction. A supplied append observer gets the old eager
path instead, whose full observed tuple stream is compared independently.

## Snapshot work and honest cost boundary

Let A be the number of non-block source tuples, S the number of residual
segments, B the total block count, and P the structural size of the distinct
plan objects, including their command lists. After one build, the index keeps
a reference to its plan; object-id reuse after collection is impossible while
cached. The direct compiler does not call `PlanIndex.validate` at begin or end.
Its stable immutable-source premise is the same as the predecessor's simulation
premise. Repeating a whole-plan scan for every segment would reintroduce work
of order B for repeatedly used large fallback plans and is explicitly avoided.

The added direct-sink construction work is O(A+S+P) ordinary host operations
within the finite Python-PC domain, plus the unchanged factory/outer-route
work and fixed source parsing. It makes zero Cursor steps, versus B on the
original fallback/good path. The retained representation remains O(A+S+P);
this is not a new memory bound. All integer prefix ends are bounded by
`sys.maxsize`; no arbitrary-size unit-cost arithmetic theorem is inferred.
For an axis run B=S and each returned plan may be distinct: no uniform saving
is claimed, and plan indexing can add work absent from the original axis path.
Nor is this a fixed-tape tariff or a whole-compiler speed guarantee.

Runtime fetch is deliberately unchanged. It still validates the complete plan
snapshot and definition plan/axis before reconstructing a block, costing
O(log regions + log commands + current plan size). Illicit post-compilation
plan mutation still rejects at a block fetch. The direct compiler does not
promise the predecessor's extra diagnostic timing for mutation *during*
compilation, which lies outside the stable immutable-source theorem. In
particular, it cannot accept arbitrary hostile Python extensions safely merely
because a dataclass says frozen. No such new guarantee is claimed.

## Suspended continuation implication

The physical Machine uses operations length and indexed fetch. Equal lengths
therefore give equal header PC domains. At each equal `(mode,pc)`, dispatch sees
the same operation fields and original Residual identity, preserving its
geometry identity guard. A recursive call saves the same `pc+1`; the unchanged
codec restores that same nonzero PC; the direct word returns the same successor.
Induction on completed physical steps and nested call/return yields equal
payload, counters, ownership and cleanup under the inherited primitive and
termination premises. This reuses the predecessor continuation theorem, with
the new direct source-word equality as its premise.

The bounded physical replay, when recorded in PHYSICAL.json, is the original
first-two-GL2-lows fixture: four rows, all256 addresses per row, four child
calls/returns and the source's full cleanup. It is not a new selected GL64
admission or a replay of the older full six-low fixture. No mutable continuation
or hidden decoded payload enters the new emitter, which runs offline.

## Remaining obligations and credit

All outer LOW/factory enumeration remains. Even a zero-inner-Cursor compile
can be impossibly large at selected GL64. A separate outer regional emitter
must establish per-LOW lengths, total header domain, source lookup and observer
semantics; this package grants none of those. Selected-loader/provider admission,
source kernel realization, stock, native costs, precision and outer recovery
are unchanged. No kappa or recursive invoice changes.

Jose Manuel supplied the actual emitter/Cursor/runtime and reduced fixtures;
Kewin Talaga supplied source authentication and visitation bridges; Nick Petalas,
David Arias, ywz65 and retained source notices retain the correspondence,
continuation and owner lineage. JoyboyBrian's PR4791 supplies the unchanged
PlanIndex/Word and prior pointwise continuation proof. This package adds direct
inner-loop omission, its work/observer boundary and falsifying controls.
New work: JoyboyBrian, with substantial OpenAI Codex assistance; Apache-2.0.
No independent human or proof-assistant acceptance is claimed.
76 changes: 76 additions & 0 deletions research/selected-regional-block-emitter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Direct residual-run emission with unchanged continuation PCs

The actual pinned compiler can skip its inner Cursor enumeration entirely:
it emits one existing BlockRun descriptor per residual while preserving every
factory call, original Residual identity and indexed operation. This closes
PR4791's explicit block-enumeration handoff. Outer LOW and factory enumeration
remain unchanged; no selected GL64 practicality or new κ is claimed.

The [proof](PROOF.md) justifies the exact source-AST substitution under the
predecessor stable immutable-source contract. Each distinct plan is indexed and
snapshotted once during compilation. Compilation calls neither Cursor nor
repeated plan validation. The inherited indexed runtime still performs its
full mutation checks; it is not made faster by this change.

A per-append observer deliberately selects the old enumerating path and gets
every tuple. Source namespace replacement, hostile mutation during compilation,
allocation identity and frame tracing remain outside the declared contract.
No frozen predecessor file is edited or production loader modified.

## Evidence and reproduction

Python3.12 and standard library only:

```sh
python3.12 -I -B research/selected-regional-block-emitter/verify.py
python3.12 -I -O -B research/selected-regional-block-emitter/verify.py
python3.12 -I -B research/selected-regional-block-emitter/verify.py --physical
```

[RESULT.json](RESULT.json) includes independent literal Cursor grammar checks,
six actual GL2 source schedules (both modes,1/2/8 replicas), every indexed tuple
and original-wrapper identity, exact factory transcript, and full append-observer
comparisons. During direct compile, Cursor construction/take and repeated
PlanIndex.validate are replaced by failing sentinels; exactly one PlanIndex
build per distinct plan is counted. This distinguishes skipped work from storage
compression that still enumerates every block.

[PHYSICAL.json](PHYSICAL.json) records the separately budgeted original/direct
actual two-level physical fixture, including nonzero saved/restored PCs,
independent1024-bit payload endpoint, borrowed fields, counters and erasure.
It is not a full selected supplier replay. Source hashes and typed receipts
are checked before and after replay; committed exports need no Git/network.

For fallback-heavy repeated plans, direct sink work becomes O(A+S+P) rather
than retaining an O(B) block loop: A is non-block tuples, S residual segments,
P distinct-plan size and B block count. Outer/factory work is unchanged, and
runtime snapshot scans remain paid. Axis-only mode can gain nothing and incurs
index overhead. No physical tariff, production speed benchmark or stock saving
is inferred from these host-operation counts.

## Open next questions

- Prove an outer regional LOW schedule with source-dependent lengths, exact
header PCs and callback contract; it must not hide enumeration in indexing.
This package leaves those loops untouched and supplies only the inner run.
- Admit the direct representation through the selected loader/bindings and
full resource model. Start with the actual installation policy; reduced
same-byte fixtures do not provide selected admission.
- Enforce immutable plan ownership cheaply enough to remove runtime snapshots.
That separate observer/lifetime problem is deliberately not weakened here.

## Coordination and credit

Base32890bc5de034ab8fc93ac88ead7279a6a416d04, priority7; selected conditional
κ=.003027288235 unchanged. [Discussion2319](https://github.com/CrocSwap/integer-mult-bounds/discussions/2319#discussioncomment-19173187)
contains the canonical claim. Fresh overlap covered352openPRs and4747Discussion
records; the released PR4791 finding leaves this exact inner task open. The
parallel outer LOW scheduling task is separate. Closed histories, arbitrary
diffs and unpublished work were not exhaustively searched.

Prepared for **JoyboyBrian**, with substantial **OpenAI Codex assistance**.
Retain Jose Manuel's emitter/Cursor/physical runtime; Kewin Talaga's source
bridge; Nick Petalas's correspondence/continuation audits; David Arias/ywz65
and all original source notices. PR4758 wrapper sharing and PR4791's existing
itinerary index remain predecessor contributions. Apache-2.0; no human or
formal-kernel acceptance, Lean run, selected promotion or invoice change.
Loading