Skip to content
Closed
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
39 changes: 39 additions & 0 deletions .github/workflows/five-stage-gen5-restorations-sinks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Verify gen5 with kernels, early restorations, terminal sinks and the PR233 complex word

on:
push:
paths:
- 'research/five-stage-gen5-restorations-sinks/**'
- '.github/workflows/five-stage-gen5-restorations-sinks.yml'
pull_request:
paths:
- 'research/five-stage-gen5-restorations-sinks/**'
- '.github/workflows/five-stage-gen5-restorations-sinks.yml'
workflow_dispatch:

permissions:
contents: read

jobs:
immutable-replay:
runs-on: ubuntu-24.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
python-version: ['3.11', '3.13']
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
with:
python-version: ${{ matrix.python-version }}
- name: Install the pinned arithmetic dependency
run: python -m pip install --disable-pip-version-check -r research/five-stage-gen5-restorations-sinks/requirements.txt
- name: Replay every mandatory stage (virtual, raw, bit, scalar, primes, banks, complex, math, finite)
run: python -B research/five-stage-gen5-restorations-sinks/verify.py --output "$RUNNER_TEMP/gen5-collective-kernels-verification"
- name: Regenerate the pinned bit word from the generator and both physical-layer producers
run: python -B research/five-stage-gen5-restorations-sinks/gen5bit/producer/regenerate.py --work "$RUNNER_TEMP/gen5-regeneration"
- name: Require committed files to remain unchanged
run: git diff --exit-code
39 changes: 39 additions & 0 deletions research/five-stage-gen5-restorations-sinks/BANK-PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Five-stage stage-private completed banks

This is a finite bank-allocation extension of the PR197/PR200 completed-bank construction to PR234's five-stage bit geometry, retained from eumemic's source527 package and applied here to the gen5 independent helper census. It does not claim a new all-size compiler theorem or replace the scalar admission.

For one complete local invocation, the source-bound physical telescope has no data/helper cross blocks. On an independent helper with genuine entrance projector sigma its endpoint is the exact partial swap D_(I24-sigma), supported in the active local window. This holds on arbitrary correlated dirty contents. The complemented inverse invocation has the same residual: its reversed endpoints are 0 and I24-sigma. Source-owned gauges are visible-data paths and are excluded from the independent helper census.

In stage i, PR234 routes the helper at local class d to physical class g=d*tau_i. Relative to g, the residual is P_i=tau_i*diag(I24-sigma,0,...,0)*tau_i, supported only in H_i. We give each stage a disjoint collection of banks. Every bank is filled by disjoint coordinate blocks of total dimension120. For the actual gauge chart B whose columns are residual columns followed by gauge columns, set

N_b=(b+1)*Pi_b*embed_i(B^-1).

For an ungauged role B=I24. Pi_b is the explicit coordinate permutation sending the first residual coordinates in H_i to the assigned bank interval. Thus N_b*P_i*N_b^-1 is exactly that coordinate projector. The scalar leaves conjugation unchanged. The checker reconstructs every actual chart, checks both inverse identities, the G-orthogonality of its two summands, its residual action and its elementary factorization. Therefore this is a projector identity for the actual bases, not a rank substitution.

The bank route is g -> g*N_b^-1, hence d*tau_i*N_b^-1 in the original local invocation. If the bank class is h, its residual is h*N_b*P_i*N_b^-1*h^-1. Every occurrence visits every bank class once because right multiplication is a bijection on the complete GL cover. If two roles in one local invocation are assigned the same bank family, their distinct N_b give distinct bank classes. Distinctness is literal: choose a coordinate j outside H_i. The embedded inverse fixes e_j; N_b*e_j=(b+1)e_(Pi_b(j)). The resulting columns differ for all b, at every eligible prime q>2^80 and every local ring Z/q^w. All scalars are between 1 and 40 and remain distinct units. The proof uses the full GL cover, not a projective quotient.

Complete the entire cover sweep for each stage and replica in fixed order before its boundary phase. The complete local source endpoint separates every bank from the data and other banks, so each subsequent invocation may receive arbitrary dirty bank contents. For each bank, its block projectors are disjoint and sum to I120. The literal partial swaps therefore compose to D_I120 on every address column. The common inherited ancestor chart is the same for each block and cancels between blocks. The checker verifies all240 address columns, the reverse schedule, and failures from omitting or repeating a block. No new independence assumption on dirt is used.

The five bank collections remain separate, and each is touched only in its own stage. This gives every physical bank its full required endpoint once. The data stage routes, bridge maps, idle children and final exchanges remain PR234's. Consequently there are no independent exterior rank5a children. Their removal follows from the completed bank endpoint; no internal, data, compensation or copied-center child is removed.

For gen5 the actual residual families are 3:354 (rank-21 entrances), 4:2182 (rank-20), 6:16 (rank-18), 7:2 (rank-17) and 24:13332 (ungauged roles). The total residual width is even, so sixty physical replicas fill each stage exactly with these 120-dimensional patterns (the rank-17 blocks share mixed banks with rank-20 blocks, as source527's 11/4 banks did):

| Blocks | Banks per stage |
| --- | ---: |
| 12 of dimension 7 and 9 of dimension 4 | 10 |
| 30 of dimension 4 | 4361 |
| 40 of dimension 3 | 531 |
| 20 of dimension 6 | 48 |
| 5 of dimension 24 | 159984 |

There are 164934 banks per stage, 824670 total banks and 422400 data families. Literal stock is 1247070. Its per-replica normalized value is 249414/12. The checker enumerates each of 4765800 actual role/replica/stage assignments exactly once, verifies the actual role's chart rank, and hashes the complete allocation.

Every actual chart (411 distinct entrance bases) uses at most 423 factors. At most 119 coordinate transpositions and 120 scalar-coordinate factors give 662 normalizer factors. A conservative added out-and-back selector bill, in addition to all retained PR234 route and scalar bills, is

2*5*60*((1247070-1)+15886*120*662)=757938545400 < 2^40.

The literal stock, not the rational per-replica stock, must be used for physical role routing and finite storage. All60 scalar replicas execute, and all recursive child counts are multiplied by60 in a literal realization. Any smaller integer normalization used only in the moment arithmetic must be distinguished from the literal replica count. Serial execution may share an external copied-center work stream only after erasure. The fixed bank selector bill is explicitly charged before the inherited positive ordinary-leaf gap absorbs it. After completion removal the maximum child is50 of120, so a single level halves; the histogram remains a one-level profile.

This witness leaves the full scalar/integer/sign audits, frame ledgers, exact global lowering, prime guard, complete fallback profile and 47 outer inequalities to the integrator (verify.py). Its input charts/census are the independently admitted gen5 helper. Existing compiler, common weighted chart, restored selectors, complete-stream routing and all-size analytic hypotheses remain conditional as in the cited sources.

Prepared with OpenAI Codex assistance (source527 package, eumemic); gen5 numbers rebound with Claude assistance. Apache-2.0; inherited source attribution remains unchanged.
43 changes: 43 additions & 0 deletions research/five-stage-gen5-restorations-sinks/KERNEL-PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Response-kernel entries on the gen5 word (per-entry cuts, rank-e entrances, multi-donor families)

This package is #287 (rohanarun: #285's gen5 five-stage banks + 904-gate descent retiming + 220 target-prefix squares)
with one added transcript stage, `kernel_transform.py`, after the target squares and before the five-stage lowering.

## Construction
Entries {pivot p, donors D (1 = twin pair, 2-3 = collective family), entrance E of rank e >= 1}: the pivot's complete
F2 target response is the XOR of the donors' (checked on the literal prefix); E is nondegenerate for 9I-J and lies in
every member's first frame. The entry cut is the later of the members' last frame-ZERO compensation reads (bound by
content: cut_read = [target, helper, coefficient]); no member is touched before it. The pivot starts at E (residual
rank 24-e) and loses its initial reads; each donor pays d += p at E after the cut and d -= p at the full frame; a donor
may serve several entries along a nested entrance chain (emitted MOVEs checked nested). Correctness: F2 replay of all
19,406 formal columns forward and inverse, both omission controls rejected; every required frame path rebuilt from
scalar/COPY events independently of the emitted MOVEs; both reflected ledgers; all used frames nondegenerate.
The selected helpers are plain dirty helpers; #287's target squares act on targets reading rank-20 gauges and its
retimed gates on source-pair mixes and internal gates, so the stages compose (the selection is bound to the
post-target word's hashes and the census was run on that word).

## Selection (discovery/)
Twin census (twin-census.txt) and collective census (coll/: families.py, fameval.py, pack.py adapted from the gen4
collective census): 450 entries = 260 twin pairs (244 e=1, 16 e=3) + 190 families (151 quads, 39 tris), total
entrance rank 1022, ranks 1..18. Greedy phi packing (phi(r) = r ln(120/r)), best prefix on the package's own ledger.

## Banks
`bank_template.build_patterns` keeps gen5's base patterns (7^12,4^9)x10, (3^40)x531, (6^20)x48 and, for each pivot
residual width r with k_r pivots, adds 15 k_r banks (r^4, 4^(30-r)) (#283's rule) whose rank-4 blocks come out of
the (4^30) banks; the (24^5) banks hold the remaining full-residual helpers. Pivot widths 6 and 7 coexist with the
base rank-18/17 gauges of the same widths. Every bank is 120 wide and fully filled; all assignments are enumerated.

## Pinned values
Every #287 literal changed by the rewrite is re-pinned in expected/kernel-pins.json and asserted via pins.pin
(recorded by discovery/generate_pins.py; verify.py refuses recording mode): kernel_pairs, kernel_entries,
kernel_entrance_rank, kernel_local_delta, kernel_helper_rank_mass, entrance_rank_histogram, entrance_count,
five_stage_calls, five_stage_rank_mass, gauge_dimension_histogram, bank_families, pivot_residual_census,
literal_stock, banks_total, charts, bundled_unique_bases, max_chart_factors, removed_completion_histogram,
priced_five_stage_calls, priced_five_stage_rank_mass, normalizer_factor_bound, conservative_extra_selector_calls,
intentional_family_collisions, scalar_events, scalar_coefficient_counts, scalar_event_sha256, forward/inverse
max row l1, literal_unit_additions, kappa. Gauge-entrance subtraction uses the subtract-and-delete form because
rank-e pivot entrances share five-stage buckets with ordinary children. No check is dropped.

## Result
kappa = 186178624839407/250000000000000000 = 7.447144993576280e-4 (+0.080% over #287's 7.44120696397042e-4),
bit side binding (bit coarse below the complex supplier's 7.47454944651775e-4).
78 changes: 78 additions & 0 deletions research/five-stage-gen5-restorations-sinks/LEVERS-PROOF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Early helper restoration and terminal sinks on the gen5 kernel word

Two transcript stages are added after the kernel stage of #290 (#285's gen5 word, #287's descent and target stages,
the 450 collective kernel entries), in this order: `restore_transform.py`, then `sink_transform.py`. Both screen the
actual input word freshly and must reproduce their frozen selection (`restore-selection.json`, `sink-selection.json`,
each bound to the SHA256 of its input word and scalar projection).

## 1. Early restoration (PR #280 mechanism, PR #283 endpoint-aware banking)

Cut: the first `cleanup_gate` ADD (record 601,737 of the kernel word). At the cut every target row is final (checked
on all 1,760 F2 target rows). A helper a qualifies when its formal row is untouched at the cut, its only remaining
scalar incidence is a += c·b, b is not written between the cut and that incidence, and no COPY/ERASE follows the cut.
On gen5 exactly 794 helpers pass; 440 of them (entrance rank 20, current frames of a and b rank 22) have an exact
rational join E of rank 23 that is nondegenerate for 9I−J; the other 354 (entrance 21, frames 23/23) join to the full
frame and are not changed. All 440 helpers and 440 donors are distinct and the two sets are disjoint; all c = −1.
These are exactly the counts and shapes of #280's gen4 screen. Kernel members are plain helpers (entrance 0), the
target squares act on targets, so neither stage overlaps.

Integer argument. The moved shear a += c·b commutes with every crossed gate u += d·w because u ≠ a, w ≠ a (a has no
other incidence) and u ≠ b (b unwritten on the interval) — checked on every crossed gate of the actual word. So
executing the 440 shears at the cut (disjoint registers, mutually commuting) preserves the signed scalar map for all
inputs, including arbitrary dirty helpers. a then ends at E, not FULL.

Endpoint and banks. With A = σ (the entrance) ⊂ E, both nondegenerate, P_σ P_E = P_E P_σ = P_σ, so D = P_E − P_σ is an
idempotent of rank dim E − dim σ = 3, with image E ∩ σ^⊥; the reflected reverse change (I−P_σ)−(I−P_E) is the same D.
The five-stage completion of such a helper is P_σ + (I − P_E) (rank 5·21 instead of 5·20) and its stage-private
residual is D in each of the five windows. `global_lowering` emits these completions (the endpoint frame rides in slot
3 of the COMPLETE record) and keeps the global deficit 4,400; `geometry527` checks one actual (σ, E) pair exactly
(idempotence, commutation, traces, disjoint windows) and rejects the old formula I − P_σ; `bank_check` builds every
chart from the G-orthogonal basis (E ∩ σ^⊥ | σ | E^⊥) — 440 new exact charts — and `bank_template` re-tiles: the 440
residuals of width 3 join the (3⁴⁰) banks (531 → 1,191 per stage) and leave the (4³⁰) banks (−880 per stage), all
assignments enumerated. Local paid delta {1: +1,320, 2: −880} (two rank-2 climbs become three rank-1 climbs per helper);
endpoint rank saving 440.

Checks: fresh screen = frozen selection; integer commutation on every crossed gate; F2 replay of all 19,406 columns
forward and inverse; omitting the moved restorations is rejected; every MOVE rebuilt from operand frames, both reflected
ledgers, all used frames nondegenerate; the completion histogram (completion rank σ + 24 − dim endpoint) is pinned and
used by the global, bank, math and finite stages.

## 2. Terminal sinks (PR #283 mechanism)

Entry: the last copied-centre ERASE (record 505,285). A zero-to-full helper r qualifies when its only uses are one
initial dirty read y_t += −r at ZERO for each t of a target set S before the entry, forward writes r += x after it,
one terminal delivery y_t += r at a common root frame for each t ∈ S after the last forward write, and cleanup writes
r −= x after the last delivery (never copied). 16 helpers on gen5 have this shape (as on gen4); in 8 of them a target of
S is read by #287's target squares, which breaks the commutation argument (and the pivot's frame chain), so they are
excluded. The 8 kept (S of size 4, two forward writes, two cleanups, root frame rank 21) have disjoint S, no target of
S is ever a scalar or COPY source anywhere in the word, and the pivot p (smallest such target) is not otherwise written
on the interval.

Integer argument. Originally each y_t receives −d_r + (d_r + X) = X, X the sum of the forward writes. In the new word
the writes go to y_p (so y_p receives X), y_t −= y_p is executed right after the entry and y_t += y_p right after the
last forward write, so each y_t (t ≠ p) also receives exactly X; nothing reads a target of S and nothing else writes p
in between, and r was read only by the deleted reads. r is deleted (registers compacted, n 19,406 → 19,398, R 15,886 →
15,878; the removed roles are recorded in the context so the bank census still checks the role set).

Checks: fresh screen = frozen selection; the coefficient pattern (−1 reads, +1 deliveries, +1 writes, −1 cleanups) and
the source/writer conditions on the actual word; F2 replay of all 19,398 remaining columns forward and inverse; three
omission controls (redirected writes, setup, restore) rejected; MOVEs rebuilt, both reflected ledgers; each removed
helper frees exactly its 24-rank path (local delta {3: −8, 21: −8}); the global lowering, banks ((24⁵) family shrinks by
96 per stage), scalar projection, math and finite stages run at R = 15,878 with the deficit 4,400 rechecked.

## Ledger and result

Both stages are priced from the fresh composed word, not added: local delta {1: +1,320, 2: −880, 3: −8, 21: −8};
φ-ledger (φ(r) = r·ln(120/r), deficit fixed) gains −886.6 and −381.4. Literal stock 1,244,515 → 1,243,415 → 1,242,935;
banks per stage 164,423 → 164,203 → 164,107. κ: #290 7.44714499357628·10⁻⁴ → 7.45272862652714·10⁻⁴ (restorations,
+0.0750%) → 745513573133379/10¹⁸ = 7.45513573133379·10⁻⁴ (sinks, +0.0323%; +0.1073% in all); bit coarse
7.46069778575685·10⁻⁴, below the complex supplier's 7.54736418878859·10⁻⁴ (#233 word in the five-stage layout), so the
bit side binds. Each value equals the ledger model's prediction made before the stage was built.

## Lever not shipped: transported dirty entrances (PR #280)

On gen5 the transport cut must follow #287's ZERO-frame target-prefix setups (record 505,945), which read targets as
sources; 1,910 of the 1,975 untouched plain helpers have a target in a square and fail the commutation condition. Of
the rest only 8 (four reads, first frame 19, entrance 19) have a negative φ balance (helper gain φ(19) against four
target climbs split at E), total −68.8 (≈ +0.006% κ); after the sinks only 4 remain (−34.4, ≈ +0.003%), the others'
targets now carry sink setups. Not implemented.
Loading