From 8dd7120b9e6b7e5e6bd23635ce178ce2aa12b4bc Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 25 Oct 2026 07:16:23 +0000 Subject: [PATCH] Price the raw shared-port cut cleanup as a negative Gaussian moment. Exposing gate 11, continuing the fused banks, and removing the D and M C2 contaminants costs 8 H1 + 3 H3. Against five rank-3 jobs the predecessor gap is 2*3^t-8, at most -2 on [0,1]. Co-authored-by: unpaidmoon --- research/shared-port-raw-cut-invoice/PROOF.md | 97 ++++++++ .../shared-port-raw-cut-invoice/README.md | 91 ++++++++ .../shared-port-raw-cut-invoice/SOURCES.json | 30 +++ .../shared-port-raw-cut-invoice/TASK.json | 78 +++++++ .../shared-port-raw-cut-invoice/VERIFY.json | 31 +++ .../shared-port-raw-cut-invoice/verify.py | 208 ++++++++++++++++++ 6 files changed, 535 insertions(+) create mode 100644 research/shared-port-raw-cut-invoice/PROOF.md create mode 100644 research/shared-port-raw-cut-invoice/README.md create mode 100644 research/shared-port-raw-cut-invoice/SOURCES.json create mode 100644 research/shared-port-raw-cut-invoice/TASK.json create mode 100644 research/shared-port-raw-cut-invoice/VERIFY.json create mode 100644 research/shared-port-raw-cut-invoice/verify.py diff --git a/research/shared-port-raw-cut-invoice/PROOF.md b/research/shared-port-raw-cut-invoice/PROOF.md new file mode 100644 index 0000000000..e78e8a168d --- /dev/null +++ b/research/shared-port-raw-cut-invoice/PROOF.md @@ -0,0 +1,97 @@ +# The raw shared-port cut does not pay for its own cleanup + +This is a Gaussian invoice for one changed child interface. It is not a new +decoder, a kappa, or a re-proof of the recording-only image bound. + +## Source + +Use `research/block3-shared-port-composition/WORD.json` and the operator +definitions in `inputs/pr4813-verify_schedule.py`. Products act on a column +from right to left. `A = C0`, `K = C0 C1 C2`, and the source identities + + B = M C2 + 2 K a, D = Z1 V C2 W A + +are the ones asserted by `load_operators`. Grades are `log2` of the uniform +support size. Every pure letter in either five-port schedule has grade 0, 1 +or 3. The fused schedule's paid profile is two grade-1 calls and four grade-3 +calls. The raw and fused schedules have the same final group-algebra state. + +The predecessor moment charges an `Hr` call as `r^t` for real `t` in `[0, 1]` +and leaves monomials, field additions and the source's exact factor `1/2` +uncharged. That is the same exponent as `1-C` in the completion note's +`3^{1-C}` comparison. A positive gap means reward minus paid is positive. +Selected `κ` is not an input to this comparison. + +## The exposed state + +Index gates from zero. After raw gate 11, owner 1 is exactly + + u = B x0 + D x1 = (M C2) x0 + 2 (K a) x0 + D x1, + +and no other live owner depends on `x1`. The same glue, a grade-3 term on +`x0` together with a grade-2 term on `x1`, already holds after gates 9 and 10. +`D`, `K a` and `M C2` are invertible. Therefore, for every 8-by-8 matrix `L`, +the `x1` column of `L u` is `L D`, which vanishes if and only if `L = 0`. Any +left-linear image of the five live owners with zero `x1` column must put +`L = 0` on owner 1, and then that image does not contain the summand +`2 (K a) x0`. + +Isolation needs a new carrier of `D x1`. Saved original inputs are the free +bypass already allowed by the completion argument. `H`, the source's monomial +multiple of `1/2`, sends `2 K a` to `K` and does not kill `D` or `M C2`. + +## What it costs to continue and to clean + +Raw gate 12 is one grade-1 `A`. The state after that gate equals the fused +state after `N`. Continuing with the remaining fused gates reproduces the +fused endpoint. Dropping gate 12 does not. The resulting hybrid pays + + 5 H1 + 3 H3. + +That is the exposure-and-continuation bill: the fused `2 H1 + 4 H3`, plus +three rank-1 calls, minus the one rank-3 call that the raw prefix replaces. + +`D = Z1 V C2 W A` uses exactly two grade-1 letters. No schedule letter has +grade 2, and a monomial preserves grade, so `D` is not one source paid letter. +A fresh copy on a saved `x1` therefore costs two `H1`. `M C2` is one `H1` on +a saved `x0`, followed by the free monomial `M`. One field subtraction for +each contaminant, then `H`, leaves the pure grade-3 unit `K x0`. + +The full Gaussian bill is + + 8 H1 + 3 H3. + +## Moment + +Credit five rank-3 jobs: the four already available from the final image, plus +this new `K`. That credit is generous. It does not charge cleanup of the +off-diagonal grade-3 terms already present in the final rows. + + gap(t) = 5 * 3^t - 8 - 3 * 3^t = 2 * 3^t - 8. + +The derivative `2 ln(3) 3^t` is positive, so the maximum on `[0, 1]` is +`gap(1) = -2`. The gap is strictly negative on the whole interval. + +If a new grade-2 letter equal to `D` is added to the alphabet, it replaces +only the two cleanup letters inside `D`. The bill becomes `6 H1 + 1 H2 + 3 H3` +and + + f(t) = 2 * 3^t - 2^t - 6. + +Now `f'(t) > 0` if and only if `(3/2)^t > ln 2 / (2 ln 3)`. The left side is +at least 1 for `t >= 0`. The right side is strictly less than 1 because +`ln 2 < ln 9`, that is `2 < 9`. Thus `f` is increasing and +`f(1) = -2 < 0`. Widening the alphabet by this one letter does not create a +positive gap. + +Leaving both contaminants uncharged, and still crediting the fifth rank-3 job, +gives gap `2 * 3^t - 5`, which equals `+1` at `t = 1`. The three cleanup +rank-1 calls are what moves that endpoint from `+1` to `-2`. + +## What this does not decide + +Nonlinear maps, feedback into a live owner, precision, compiler reserve and +outer transfer are outside the invoice. Each of those, if charged, adds a +nonnegative cost on a gap that is already negative. A different cut, or a +consumer that accepts the glued sum `B x0 + D x1` as one legal child, is a +different contract. diff --git a/research/shared-port-raw-cut-invoice/README.md b/research/shared-port-raw-cut-invoice/README.md new file mode 100644 index 0000000000..6fba01b52e --- /dev/null +++ b/research/shared-port-raw-cut-invoice/README.md @@ -0,0 +1,91 @@ +# The first raw shared-port cut loses its Gaussian moment + +**Negative result. No new κ.** The selected conditional exponent stays +`605457647/200000000000`. + +The recording-only theorem for the fused five-bank producer leaves one escape: +the raw state after gate 11, whose grade-3 channel has image dimension `5d`. +This package prices that state as a child that must be exposed, continued and +cleaned. On the predecessor moment, for every exponent `t` in `[0, 1]`, + +```text +gap(t) = 2 * 3^t - 8 <= -2. +``` + +Replacing the two cleanup letters inside `D` by one new grade-2 letter still +gives `2 * 3^t - 2^t - 6 <= -2`. + +## Scope and evidence + +Original card: `complex-rank-shape-decoder`. Scope status: **refined**. The +card asks for a larger-rank decoder profile. The open request actually taken +is the changed-resource invoice after the fixed-producer completion ceiling +([discussion comment 19133451](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19133451)). +Open PR [#5491](https://github.com/CrocSwap/integer-mult-bounds/pull/5491) +already shows that this raw cut raises the grade-3 image dimension from `4d` +to `5d`, and it leaves the cleanup bill open. This package does not replay +that image proof. It prices the bill. + +The exposed owner is `B x0 + D x1`, with `B = M C2 + 2 K a`. No left-linear +image of the live owners can drop `D x1` and keep `2 K a x0`. A fresh `D` +costs two source rank-1 calls, and `M C2` costs one more. Keeping the later +fused banks costs the hybrid profile `5 H1 + 3 H3` before that cleanup. The +proof, the derivative comparison, and the controls are in [PROOF.md](PROOF.md). + +The moment does not charge monomials, field additions, the factor `1/2`, or a +field copy of the exposed owner. Charging any of them widens the deficit. +Precision, compiler reserve, outer transfer and feedback into a live owner are +not decided here. They are further nonnegative charges on a gap that is already +negative. + +Source pins are in [SOURCES.json](SOURCES.json). The two live inputs are the +predecessor gate list and operator file, used at their bytes on this base. +They are not copied. + +## Reproduce + +From the repository root, Python 3.12, standard library only: + +```sh +python3 -B scripts/research_package.py --package research/shared-port-raw-cut-invoice --check-only +python3 -B scripts/research_package.py --package research/shared-port-raw-cut-invoice +``` + +Direct checks, each under two seconds here: + +```sh +python3 -B research/shared-port-raw-cut-invoice/verify.py +python3 -O -B research/shared-port-raw-cut-invoice/verify.py +``` + +Both print `PASS_SHARED_PORT_RAW_CUT_INVOICE` with `gap_t1=-2`. The verifier +rejects a missing aligning rank-1 call, an add-sign fault, a wrong pivot +operator, and a grade-2 letter hiding in the source schedule. No native suite, +Lean build, selected cold replay or full compiler/outer replay was run. + +## Open next questions + +1. Can a feedback write into the live owner, outside the recording-only + interface, separate `D x1` from `K a x0` with fewer than two extra rank-1 + letters? This matters because that is the only Gaussian saving large enough + to flip `gap(1)`. The first step is one explicit feedback word and its paid + profile. The blocker is that every pure source letter is invertible, so a + left multiply cannot delete `D`. + +2. Do the off-diagonal grade-3 terms in the final rows need their own cleanup + before those four jobs are legal children? This matters because the reward + used here already credits all four. The first step is to price one + off-diagonal class on row 3. The blocker is a consumer contract that says + whether an image-dimension credit is a legal child. + +## Credit + +The gate list and operators are the PR4813 / block3 schedule retained in +`research/block3-shared-port-composition`, including the hexapode, Dugongue, +Yiyang / Lyy-iiis, lee-phys, Jacob Alan Sussman and Cinna Davis / 1337isnot1337 +lineage recorded there. The recording-only `4d` bound and the raw-cut `5d` +witness are Chris R / Clear1nsight and JoyboyBrian's open +[#5491](https://github.com/CrocSwap/integer-mult-bounds/pull/5491). This +package only prices the cleanup those results leave open. + +Prepared by unpaidmoon with substantial Cursor Grok assistance. Apache-2.0. diff --git a/research/shared-port-raw-cut-invoice/SOURCES.json b/research/shared-port-raw-cut-invoice/SOURCES.json new file mode 100644 index 0000000000..478521c17a --- /dev/null +++ b/research/shared-port-raw-cut-invoice/SOURCES.json @@ -0,0 +1,30 @@ +{ + "schema_version": 1, + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "fc3d4ba105e1f097d0d7d051a308281e86ab1446", + "sha256": "66974efdced4083c00025f97d95d83909a226cdf801edb9301c195c6641f6903" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + }, + { + "path": "research/block3-shared-port-composition/WORD.json", + "usage": "input", + "git_blob": "6126739ac5dce9122bc201c454e8213e8b1bac55", + "sha256": "05c81a7dfb37c240fdaef332474deb90f1b38e60dec392f3a23089f973a5f1ba" + }, + { + "path": "research/block3-shared-port-composition/inputs/pr4813-verify_schedule.py", + "usage": "input", + "git_blob": "17a8439633effba74fff63a8fe4c332b8d709d80", + "sha256": "6216fd67f1a762303f0eed0e37b90ea0c72cf8e0cb7db70b1b27b2001ac20069" + } + ] +} diff --git a/research/shared-port-raw-cut-invoice/TASK.json b/research/shared-port-raw-cut-invoice/TASK.json new file mode 100644 index 0000000000..5fbcb87e5c --- /dev/null +++ b/research/shared-port-raw-cut-invoice/TASK.json @@ -0,0 +1,78 @@ +{ + "schema_version": 1, + "task_id": "complex-rank-shape-decoder", + "priority_revision": 7, + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "original_card": { + "id": "complex-rank-shape-decoder", + "question": "Can a decoder deliver the local paid mass in fewer, larger-rank children (block frame climbs instead of rank-1 to rank-3 steps)?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/complex-local-word-ceiling/README.md", + "research/complex-decoder-field-extension-seed44/README.md", + "research/complex-frame-pair-decoders/README.md", + "research/selected-k8-unrestricted-ends/README.md", + "research/eisenstein-reduction-copy-floor/README.md" + ], + "methods": [ + "Find one exact small decoding identity whose frame path climbs in blocks, and price its complete per-call profile.", + "Bound the best effective child rank achievable for one fixed support alphabet, including copies, frames and restoration." + ], + "acceptance_gate": "A per-call local profile, with all copied information, frames and restoration counted, whose ceiling exceeds the selected word's by at least 5%; masked or overcomplete supports must change an assumption of the eight-term all-pairs bound. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "research/complex-local-word-ceiling/verify.py" + ], + "expected": "PASS_COMPLEX_LOCAL_WORD_CEILING", + "inspect": "Read the selected word's per-call local profile, its packing ceiling and the lever table; run levers.py for the ideal budget of the lever you target.", + "scope": "Positive control and planning budget only; this is not a new construction or full cold replay." + }, + "first_experiment": "Before any synthesis, write the candidate per-call local profile (and centre charge / unpaid coordinates if changed) and screen it with ceiling.ceiling(); reject it if even the ideal ceiling does not beat the selected word's by your stated margin. Ideal budget: rank-16 delivery is 2.31x (levers.py).", + "bottleneck_link": "Rank-1 children are about half of recursive cost; the selected word's effective child rank is about 3.9. Larger-rank delivery lowers recursive cost per unit of paid mass.", + "allowed_variations": [ + "One masked, overcomplete or block decoder family with exact labels and supports.", + "A scoped lower bound on effective rank for one alphabet.", + "If the coverage law, template or guard changes, derive an applicable fully charged replacement bound instead of applying the incumbent ceiling outside its scope." + ], + "scope_change_triggers": [ + "Repacking idle remainders of an unchanged word (covered by the packing ceiling).", + "Repeating the eight-term all-pairs search inside its proved scope.", + "Only changing helper terminal subspaces and monotone frames within the fixed scalar word, entrances and cleanup contract already covered by #1995/#2013.", + "Searching below C=40 in the #2017 Eisenstein binary scalar-rectangle or fixed-support block-linear additive pairing model; specify a changed premise instead. This bound does not cover every complex decoder.", + "Continuing a partial cost improvement while leaving the same unpriced consumer, restoration or central-readout obligation unresolved; refresh the family expansion decision first. Local product-retiming evidence has a narrow scope and is not a ban on changed graphs or contracts." + ], + "overlap_terms": [ + "rank shape", + "block climb", + "masked decoder", + "overcomplete", + "effective rank" + ] + }, + "scope_status": "refined", + "actual_scope": "Price the raw gate-11 shared-port cut as an exposed, continued and cleaned child, and decide whether its Gaussian moment is positive on the predecessor exponent interval.", + "scope_change_reason": "The catalogue card asks for a larger-rank decoder profile. The open handoff after the fixed-producer completion ceiling instead asks for one changed resource and a complete optimistic invoice before any synthesis. This package answers that invoice for the raw internal cut and stops because the gap is negative.", + "bottleneck_link": "This five-bank word spends its local mass on four rank-3 calls. The raw cut appears to add a fifth rank-3 job. The cleanup returns three extra rank-1 calls, so the route does not raise effective child rank.", + "budget_minutes": 60, + "stop_rule": "Stop when the Gaussian gap is nonpositive for every exponent t in [0, 1], including the one-letter grade-2 widening. Do not synthesize a decoder on this cut.", + "outcome": "negative-result", + "evidence": "python3 -B research/shared-port-raw-cut-invoice/verify.py prints PASS_SHARED_PORT_RAW_CUT_INVOICE with gap_t1=-2. The same command with -O passes. PROOF.md records the operator identity, the hybrid bill and the derivative comparison.", + "author": "unpaidmoon", + "ai_assistance": "Substantial Cursor Grok assistance.", + "open_questions": [ + { + "question": "Can a feedback write into the live owner separate D x1 from K a x0 with fewer than two extra rank-1 letters?", + "why_it_matters": "That is the only Gaussian saving large enough to make gap(1) positive. Left multiplication cannot do it, because D is invertible.", + "first_step": "Write one explicit feedback word that uses the live owner and price its paid profile against 8 H1 + 3 H3.", + "blocked_by": "A legal feedback contract. The recording-only interface forbids writing into the producer, and every pure source letter is invertible." + }, + { + "question": "Do the off-diagonal grade-3 terms in the final rows require more cleanup before those four jobs are legal children?", + "why_it_matters": "The reward credited here already counts all four. Further cleanup would deepen the deficit, not open a saving.", + "first_step": "Price one off-diagonal grade-3 class on final row 3 under the same source letters.", + "blocked_by": "A consumer contract that says whether image dimension 4d is itself a legal child or only a necessary condition." + } + ] +} diff --git a/research/shared-port-raw-cut-invoice/VERIFY.json b/research/shared-port-raw-cut-invoice/VERIFY.json new file mode 100644 index 0000000000..1ff3cfebf3 --- /dev/null +++ b/research/shared-port-raw-cut-invoice/VERIFY.json @@ -0,0 +1,31 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/block3-shared-port-composition/WORD.json", + "research/block3-shared-port-composition/inputs/pr4813-verify_schedule.py" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 60, + "checks": "Exact pivot identity, hybrid endpoint, paid profiles, unitarity, D factorization, and both negative endpoint gaps, plus aligning-call and ADD-sign rejection controls." + }, + { + "argv": [ + "{python}", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 60, + "checks": "The same certificate with assertions stripped. The checks use explicit exceptions, so the optimized run must still reject the controls." + } + ] +} diff --git a/research/shared-port-raw-cut-invoice/verify.py b/research/shared-port-raw-cut-invoice/verify.py new file mode 100644 index 0000000000..bb5c7117e5 --- /dev/null +++ b/research/shared-port-raw-cut-invoice/verify.py @@ -0,0 +1,208 @@ +#!/usr/bin/env python3 +"""Price the raw gate-11 shared-port cut, including contaminant cleanup. + +The gate list and Clifford operators are the pinned predecessor files. This +module does not re-prove the recording-only 4d image bound. It prices the one +internal cut that escapes that bound. + +Prepared by unpaidmoon with substantial Cursor Grok assistance. Apache-2.0. +Predecessor operators: hexapode / the PR4813 schedule retained in +research/block3-shared-port-composition. +""" + +from __future__ import annotations + +import hashlib +import json +from collections import defaultdict +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[2] +WORD = ROOT / "research/block3-shared-port-composition/WORD.json" +ALGEBRA = ROOT / "research/block3-shared-port-composition/inputs/pr4813-verify_schedule.py" +PINS = { + WORD: "05c81a7dfb37c240fdaef332474deb90f1b38e60dec392f3a23089f973a5f1ba", + ALGEBRA: "6216fd67f1a762303f0eed0e37b90ea0c72cf8e0cb7db70b1b27b2001ac20069", +} + + +def need(ok, why): + if not ok: + raise ValueError(why) + + +def load(): + for path, digest in PINS.items(): + need(hashlib.sha256(path.read_bytes()).hexdigest() == digest, "pin " + path.name) + namespace = {"__name__": "schedule"} + exec(compile(ALGEBRA.read_bytes(), str(ALGEBRA), "exec"), namespace) + operators = namespace["load_operators"]() + word, adj = namespace["word"], namespace["adjoint"] + ident = namespace["ident"]() + monomial = namespace["monomial"] + s_letter = namespace["s_letter"] + pauli = namespace["pauli"] + v = monomial([0, 2, 1, 3, 4, 6, 5, 7]) + s = s_letter(7) + p = word(s, monomial([0, 5, 2, 7, 4, 1, 6, 3]), s) + q = word(s, v, s) + letters = dict( + operators, + P=p, + Pinv=adj(p), + Q=q, + Qinv=adj(q), + V=v, + Z1=pauli(0, 2), + N=word(operators["A"], operators["D"], adj(operators["K"])), + ) + return namespace, operators, letters, ident + + +def grade(matrix, zero): + counts = {sum(entry != zero for entry in row) for row in matrix} + need(len(counts) == 1, "pure uniform support") + return next(iter(counts)).bit_length() - 1 + + +def replay(gates, letters, word, ident, width=5): + state = [[{ident: 1} if row == col else {} for col in range(width)] for row in range(width)] + cuts = [[[dict(cell) for cell in row] for row in state]] + for gate in gates: + kind, dst = gate[:2] + if kind == "add": + src, coeff = gate[2:] + for col in range(width): + acc = defaultdict(int, state[dst][col]) + for matrix, weight in state[src][col].items(): + acc[matrix] += coeff * weight + state[dst][col] = {matrix: weight for matrix, weight in acc.items() if weight} + else: + need(kind in ("paid", "mono") and gate[2] in letters, "gate " + repr(gate)) + factor = letters[gate[2]] + state[dst] = [{word(factor, matrix): weight for matrix, weight in cell.items()} for cell in state[dst]] + cuts.append([[dict(cell) for cell in row] for row in state]) + return cuts + + +def only(cell): + need(len(cell) == 1, "expected one term") + return next(iter(cell.items())) + + +def paid_profile(gates, letters, zero): + counts = defaultdict(int) + for gate in gates: + if gate[0] == "paid": + counts[grade(letters[gate[2]], zero)] += 1 + return dict(counts) + + +def gap_at(reward_rank3, paid, t): + """reward minus paid at exponent t, with r^t evaluated at the integer endpoints.""" + need(t in (0, 1), "endpoint exponent") + reward = reward_rank3 * (3 ** t) + cost = sum(count * (rank ** t) for rank, count in paid.items()) + return reward - cost + + +def main(): + namespace, operators, letters, ident = load() + zero = namespace["ZERO"] + word = namespace["word"] + adj = namespace["adjoint"] + schedule = json.loads(WORD.read_text(encoding="utf-8")) + raw, fused = schedule["five_ports"], schedule["fused_five_ports"] + raw_cuts = replay(raw, letters, word, ident) + fused_cuts = replay(fused, letters, word, ident) + need(raw_cuts[-1] == fused_cuts[-1], "raw and fused endpoints differ") + + # Gate 12 (0-based) is the aligning rank-1 A. After it, the raw state matches + # the fused state after mono N, so the remaining fused gates are a legal continuation. + need(raw_cuts[13] == fused_cuts[9], "aligning A does not restore the fused representative") + hybrid = raw[:13] + fused[9:] + hybrid_cuts = replay(hybrid, letters, word, ident) + need(hybrid_cuts[-1] == fused_cuts[-1], "hybrid continuation misses the fused endpoint") + dropped = raw[:12] + fused[9:] + need(replay(dropped, letters, word, ident)[-1] != fused_cuts[-1], "aligning H1 is not necessary") + + fused_paid = paid_profile(fused, letters, zero) + hybrid_paid = paid_profile(hybrid, letters, zero) + need(fused_paid == {1: 2, 3: 4}, "fused bill " + str(fused_paid)) + need(hybrid_paid == {1: 5, 3: 3}, "exposure bill " + str(hybrid_paid)) + + ka = word(operators["K"], namespace["pauli"](1, 3)) + mc2 = word(operators["M"], operators["C2"]) + d_matrix = operators["D"] + for gate_index in (9, 10, 11): + owner1 = raw_cuts[gate_index + 1][1] + need({col for col, cell in enumerate(owner1) if cell} >= {0, 1}, "cut lost a column") + need(not any(raw_cuts[gate_index + 1][row][1] for row in (0, 2, 3, 4)), "another live owner depends on x1") + x0_grades = {grade(matrix, zero) for matrix in owner1[0]} + x1_grades = {grade(matrix, zero) for matrix in owner1[1]} + need(3 in x0_grades and x1_grades == {2}, "glue window " + str(gate_index)) + + owner1 = raw_cuts[12][1] + g1, c1 = only({matrix: weight for matrix, weight in owner1[0].items() if grade(matrix, zero) == 1}) + g3, c3 = only({matrix: weight for matrix, weight in owner1[0].items() if grade(matrix, zero) == 3}) + g2, c2 = only(owner1[1]) + need(c1 == 1 and c3 == 2 and c2 == 1, "pivot coefficients") + need(g1 == mc2 and g3 == ka and g2 == d_matrix, "pivot operators") + need(namespace["plus"](mc2, namespace["scale"](namespace["q"](2), ka)) == operators["B"], "B splitting") + for unit in (d_matrix, ka, mc2, operators["A"], operators["K"]): + product = word(unit, adj(unit)) + need(product == namespace["ident"](), "unit " + str(grade(unit, zero))) + + # H cleans 2 Ka into K and does not delete either contaminant. + h_matrix = operators["H"] + need({sum(entry != zero for entry in row) for row in h_matrix} == {1}, "H is not monomial") + need(namespace["mm"](h_matrix, namespace["scale"](namespace["q"](2), ka)) == operators["K"], "H misses K") + need(namespace["mm"](h_matrix, d_matrix) != [[zero] * 8 for _ in range(8)], "H unexpectedly kills D") + need(namespace["mm"](h_matrix, mc2) != [[zero] * 8 for _ in range(8)], "H unexpectedly kills MC2") + + # D is exactly two source rank-1 letters times monomials, and no schedule + # letter has grade 2, so one source paid letter cannot produce it. + product = namespace["ident"]() + factor_grades = [] + for name in ("A", "W", "C2", "V", "Z1"): + factor = letters[name] + factor_grades.append(grade(factor, zero)) + product = word(factor, product) + need(product == d_matrix, "D factorization") + need(factor_grades == [1, 0, 1, 0, 0], "D paid-letter count") + used = {gate[2] for gate in raw + fused if gate[0] in ("paid", "mono")} + need({grade(letters[name], zero) for name in used} <= {0, 1, 3}, "schedule invented a grade-2 letter") + need(all(grade(letters[name], zero) in (1, 3) for name in used if any(g[0] == "paid" and g[2] == name for g in raw + fused)), "paid grade") + + # Gaussian invoice. Exposure is the hybrid bill. Cleanup adds two H1 for a + # fresh D and one H1 for M C2. Reward credits five pure rank-3 jobs. + exposure = {1: 5, 3: 3} + full = {1: 8, 3: 3} + widened = {1: 6, 2: 1, 3: 3} # one H2 replaces the two cleanup letters inside D + uncharged = {1: 5, 3: 3} # fifth job credited while D and MC2 remain glued + need(gap_at(5, full, 1) == 2 * 3 - 8 == -2, "full endpoint") + need(gap_at(5, full, 0) == 2 - 8 == -6, "full at zero") + need(gap_at(5, widened, 1) == 2 * 3 - 2 - 6 == -2, "widened endpoint") + need(gap_at(5, widened, 0) == 2 - 1 - 6 == -5, "widened at zero") + need(gap_at(5, uncharged, 1) == 1, "uncharged t=1 gap drifted") + need(2 < 9, "derivative comparison 2 ln 3 > ln 2") + # Finite corroboration of 2*3^t < 8 on the uniform grid, which is the + # in-alphabet gap. The all-real argument is the monotonicity proof. + for k in range(65): + need(pow(3, k) < pow(4, 64), "grid " + str(k)) + + # An actual source ADD sign fault must change the endpoint. + bad = [list(gate) for gate in fused] + add_at = next(i for i, gate in enumerate(bad) if gate[0] == "add") + bad[add_at][3] *= -1 + need(replay(bad, letters, word, ident)[-1] != fused_cuts[-1], "ADD sign fault accepted") + + print( + "PASS_SHARED_PORT_RAW_CUT_INVOICE " + f"fused={fused_paid} exposure={exposure} full={full} " + f"gap_t1={gap_at(5, full, 1)} widened_gap_t1={gap_at(5, widened, 1)}" + ) + + +if __name__ == "__main__": + main()