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
1 change: 1 addition & 0 deletions research/r437-preparation-composition/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* -text
618 changes: 618 additions & 0 deletions research/r437-preparation-composition/POOLED-SOURCES.json

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions research/r437-preparation-composition/PREDECESSORS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"pins": {
"4025": "84bd28ef6da3a3473d14a48088f30ba82d414450",
"4011": "fc1426353de3389409a27e5b9bc146a95edf811c",
"4010": "92daee4bf12255efe4ae0102eeb5f72794bf9c57"
},
"files": {
"forward_fields.py": {
"sha256": "4b6cb4b8a20c920c32dbad7b8e99a728d75681b0b4cdc876f4bd60730302a83b",
"git_blob": "45dcf2467f2167293fada94ba93d6e9d367de18b"
},
"predecessor4025/source/CALLER.py": {
"sha256": "7bc6e42072a09a08ac961e05c3da01cde012d740d4b4c605f298d994f2ad7c5a",
"git_blob": "5a032e8923f7f8b22bb98f3e39b804beb9906c16"
},
"predecessor4025/source/NOTICE.md": {
"sha256": "c446b32b8a621844fb2fbe654810c8122035bdd43fed2132f1137d98cb6f9943",
"git_blob": "ef9f81510db86eaf2f0a7191d85e92a6db30ddc0"
},
"predecessor4025/source/cardinality.py": {
"sha256": "505d5e560c5a507e6184edcc19a87cf1fed243eb34a5cb21fbe1e4fe017e7f22",
"git_blob": "b8ba857e32c5903408e1e61ff916300848b4a208"
},
"predecessor4025/source/counts.py": {
"sha256": "00b476dbda0e8cc99886bf794439e1cb9e775f435f599a3557e99321fe084069",
"git_blob": "81b48940ce222290a40d4fb349ce827f4788469d"
},
"predecessor4025/source/directory.py": {
"sha256": "4270e370b2bfe38ef73aadcd97d1b3496b56bd582115d74331eb9e5ceb90bec7",
"git_blob": "c74cacf5ce809c0561d374f137a52df0992b4226"
},
"predecessor4025/source/records.py": {
"sha256": "0c9c4b23e998597fb877bb1a29da69ac869b68262abe635b162b4dba9c69b372",
"git_blob": "4f00467a0ff580954ad2fd0c7380240c753ddef3"
},
"predecessor4025/source/stream.py": {
"sha256": "c7dc7da5b00f27016982ada4c0416f8328568b00df16d97012f33d4b372d79b5",
"git_blob": "5e5a4bb0f98971447043e25d4dd6991bfc070389"
},
"predecessor4025/source/words.py": {
"sha256": "5c37f57708ba3131bdcb03139f9dbc29886bee44569c09cbba51b68f75acd7f9",
"git_blob": "8d4ba37e2778acb35b34e0719df2caf138fbeb50"
},
"predecessor4025/verify.py": {
"sha256": "b2c72707bebb9ecdba2b89675830439393e6e13c76f68dad20d42d6ef70e539a",
"git_blob": "614e57282c0edfe39f1afe45d140cf338210e62a"
}
},
"historical_pooled_archive_sha256": "d178f0be069810017113bdb824f6985bd9cfdd7b8a8ab2411c48c02f7a57eb30",
"pooled_manifest_sha256": "95635c15a09cdac656e91b3a13ad2bf481ef4ffdcf67c7dd3c27b8400b2751ef",
"transport": "Byte-identical materialized vendor directory; historical archive retained locally outside published package."
}
105 changes: 105 additions & 0 deletions research/r437-preparation-composition/PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Preparation composition and phase contract

This is a source-action theorem for successful valid inputs. It is not the
complete Pi term, a physical allocator tariff, or an exponent improvement.

## Interval

Borrow a canonical Program, old raw-directory tape, positive old-prefix Count,
encoded history depth, modulus and Ring. Their complete bytes, heads and live
numerical ownership are protected. Actively used Program/directory/Count tapes,
modulus, Ring operands, encoded depth and arena templates enter at their canonical
head1 positions; the runtime rewinds these inputs and does not promise restoration
of arbitrary active-input entry heads. Unused spectator Words may enter at other
valid heads (the fixtures use head2), and those heads are preserved.
Specifications are independently compiled
from the pinned pooled R437 catalogue. Create Context; create frame control
Words; produce the full next directory and prefix Count; read its first prefix,
run SelectedBinding.validate_residual, clear the prefix; read the first prefix
again, run SelectedBinding.child_program, clear the prefix; then clear both
returned tapes, close the returned Count and Context and release frame controls.
This is precisely the preparation sequence used by residual_begin and
prepare_child at these named component boundaries, with geometry, child_extents,
fixed handoff copies and payload roles explicitly factored out. It does not
execute the entire Machine methods or establish literal top-level reachability.

The Context constructor and final disposer are included. Input construction,
source/low-vocabulary compilation, Ring construction, old Program/directory
construction and later child consumption are outside this interval, and retain
separate charges. The frozen low specification is real; the admitted history is
a generic legal fallback history, not a projected good-class assertion.

## Two radix families

For dimension d, M=d², modulus q^w, both Context.high_count and directory.produce
invoke high_power. The original implementation repeats digit_suffix M times;
ToikY's #4025 adapter validates radix_power once and repeats the same ordered
M(w-1) Count multiplications by q. Its mathematical count is unchanged. Both
implementations exhaust the radix validator even when w=1. A complete traversal
has source-residue invoice rho; the saving is (M-1)rho per high_power.

This package applies the identical credited adapter at **both** original
bindings, including counts.high_power reached by Context.high_count. Therefore
the full interval saves exactly 2(M-1)rho source-residue actions. Count and record
actions, cardinality, output bytes/order and physical duplicate prefix
multiplicity are unchanged. It introduces no tape, numerical Word or extra
simultaneously live storage. Context still creates and later closes its high
Count and cap, and the producer retains its M-digit odometer. No Context charge
is silently borrowed from an already-live fixture.

## Chronological admission composition

The #4011 adapter changes only monotone Program/Fields admission. Both validation
and child creation construct one Callback over the same history and first
prefix. Each checks exactly the same chronological predicates and finishes with
the original random-access Program restored. The child extension's later access
and output copy are unchanged. Hence there are exactly two admission savings.

Let n=h+1, r=2I+L+5, c=Q+2I+90, F=Q+2+4096(L+1). For one admission, the removed
Program reads and moves are

3r n + (3c-1)h n/2, n(2r+2+ch).

The removed Fields reads and moves are

(3F-1)n(n+1)/2 - 3nF + 3nQ + 6n,
F n(n-1) + n(2Q+6).

Writes are unchanged. Twice their sum is the complete interval's record saving.
The source index-Word saving is separately metered; it is not inferred from
record actions. The adapter preserves residue actions and adds no live tape or
Word. Its AST guards fail on unreviewed admission shapes.

## Composition argument

Directory production returns byte-identical canonical prefixes under either
radix implementation; therefore both original and cursor Callback receive the
same bytes. Cursor admission returns the same accepted state and preserves
borrowed fields; therefore the subsequent extension and disposal are identical.
The two changes affect disjoint source-action lanes (residue versus record/index)
and restore the same protected boundary state. Sequential composition gives the
sum of savings without a cross term. The verifier executes all four combinations
and checks this equality in every action lane, and checks that phase invoices
partition the entire measured interval. It also checks identical created-tape
inventory, numerical peak and slot count; this is source runtime storage, not a
full physical backing/metadata tariff.

## Actual finite source boundary

The pinned #4010 replica catalogue independently resolves native IDLE896352,
rank14, and old common COPY1603, rank7, at low identity over q=3. Both low source
specifications are compiled by the actual Specifications path; the current
source is fallback. Its actual compiled plan begins with a UNIT child. Q=6512
includes the five-bit pooled source-code widening. At h=2 the old history uses
the distinct COPY and IDLE source codes, and every field belongs to its actual
compiled context. Roots are 2048*64^h, root unit2; admitted current width2048
extends to32. The tests cover h=0/B=1 and h=2/B=2, including duplicate physical
prefixes. They are complete dimension64 high cubes only at cap1 (modulus3);
no nontrivial 3^4096 cube is executed.

The universal source-code composition proof assumes every old/current context
is admitted, enough capacity, positive cardinalities and no concurrent mutation.
Malformed-input general rollback, selected source reachability, physical gather,
transport, geometry, coefficient evaluation, full CALL/RETURN, stock and kappa
remain separate obligations. This package cannot promote the low-level saving
to a complete recurrence.
88 changes: 88 additions & 0 deletions research/r437-preparation-composition/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Compose two preparation improvements on actual pooled R437 sources

This package joins ToikY's #4025 shared radix traversal with #4011 chronological
Callback admission and independently compiles #4010's actual pooled source
contexts. It measures a complete named interval: Context construction, full
next-directory production, both first-prefix read/validate and read/child-program
phases, and disposal of every owned result and Context.

The new composition applies radix sharing to Context.high_count as well as the
directory producer. Both variants exhaust validation and retain every ordered
Count multiplication. The interval saves **8190 validated radix traversals**
worth **4,283,370 reads, 778,050 writes and 4,553,640 moves** of source residue
Words in each dimension64/cap1 case. No tape or numerical word is added.
The chronological adapter separately saves two complete admissions; the four
original/candidate combinations prove exact additive savings without cross terms.

| Actual-source fixture | Original total source actions | Composed total | Reduction |
|---|---:|---:|---:|
| h=0, one old physical prefix | 11,709,798 | 2,023,876 | 82.716% |
| h=2, two duplicate old physical prefixes | 21,090,379 | 10,356,737 | 50.894% |

Totals sum separately recorded record-Tape, residue-Word and index-Word reads,
writes and unit moves. They are source-operation counts, not wall-clock or a
physical bit-machine tariff. RESULT.json preserves all lanes and phase invoices.
At h=2 the record lane alone drops 7,331,381 to 6,247,715 actions, and numerical
peak remains 4097 additional residue Words and 16 index Words (including Context
and frame controls). Created tapes and backing slots agree in all four modes.

The current source is **native IDLE896352, rank14, Q=6512**; the old history also
uses **common COPY1603, rank7**. Actual Specifications compilation checks the low
identity contexts over q=3. The IDLE is fallback, and its actual plan starts with
a UNIT child. Legal generic histories reach current width2048 and produce a
width32 child. Active inputs enter at canonical head1; unused spectators also test head2.
Every borrowed byte/head, spectator Word, input Count and numeric
ownership set is restored after complete disposal. The first prefix is cleared
and reread between validation and extension, matching the real caller boundaries.

These are complete dimension64 high cubes at cap1 (modulus3). They do not execute
a nontrivial 3^4096 cube. Source compilation is real; top-level selected-history
reachability and a full physical CALL/RETURN are not established. Geometry,
child_extents, transport/gather/scatter, handoff copies, coefficient evaluations,
control/allocator tariffs, original-width stock and remaining Pi terms stay
explicit. There is no new kappa or selected-frontier change.

## Evidence and reproduction

Run `python3 -B scripts/research_package.py --package research/r437-preparation-composition`.
The package is self-contained: its authenticated 154-file materialized pooled export preserves
all frozen notices and complete loader inventory; exact #4025 sources and the
#4011 adapter are retained with original hashes. PREDECESSORS.json and
POOLED-SOURCES.json bind bytes and upstream heads. Shared/frozen files are never
edited. The checker independently compiles both source specifications, then runs
four modes for each fixture. An independent serializer checks every returned child byte and its width32 extent. The independent invoice checker imports no runtime.
Eleven controls include two actual same-output losing compositions: leaving
Context unoptimized and silently skipping validation. Checks remain active under
optimized Python. This is AI-assisted reviewable source evidence, not independent
human acceptance or formal kernel verification.

## Open next questions

PROOF.md states the success contract and exact formulas. Input/low-vocabulary
compilation and construction of the borrowed Ring/old history are separate entry
charges. Successful valid-input cleanup is proved; general malformed-input
rollback is not promised. TASK.json records scope, overlap and structured next
questions. The next useful join prices geometry/child extents and fixed handoff
copies on this same pooled context, including arbitrary dirty acquisition before
the residual; it must not reuse an unpooled rank26 fixture as rank14 evidence.

## Credit

ToikY/#4025 supplies high_power_shared, complete producer metering and the exact
validated radix invoice. ywz65/#2590 supplied the prior cubic repeated-setup
analysis and explicitly requested shared traversal; ywz65/#2566 supplies primitive
analysis. Ross Richardson's numerical peak audit retains its credit. Chris R /
Clear1nsight #4011 supplies the forward admission adapter and source invoices;
#4010 supplies actual replica-indexed pooled source compilation. Jose Manuel /
jmbarrancoml supplies the physical caller and encoded runtime; David Arias/#2753,
Nick Petalas and the retained controller/record lineage retain their notices.
The R437/OQ4, pooling and chart work retains ai-nanachi/#3647, zxv/#3690,
Ali Romman/#1043, Sagar Thakrar/#3700, #3936/#3950/#3967, #3958/#3959/#3995,
and the authors credited by those packages. New composition, lifecycle boundary,
exact joined invoice and controls: Chris R / Clear1nsight with substantial OpenAI
Codex assistance and a separate AI review. Apache-2.0.

Publication uses the154 unchanged upstream source files under vendor/, with exact
file/directory inventory, SHA256 and no-link checks before execution. Missing,
extra, linked and corrupted inputs reject. The original compressed archive was
retained as local evidence outside this package; transport changed, science did not.
Loading