From 9123241fea53df77e51ffe30d9aca1625d4bf3a8 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 20 Oct 2026 03:22:53 +0000 Subject: [PATCH] Certify the screened P104 source-chart shortcut misses the debt-free gate. One-axis Gram undo on the prepared entrance leaves F T^{-1} x. Charging one rank-one chart child on each of the 10816 data positions meets the strict allowance, so the bill equals 81W before further charges. No new kappa. Co-authored-by: unpaidmoon --- research/p104-source-chart-shortcut/PROOF.md | 85 +++++ research/p104-source-chart-shortcut/README.md | 62 ++++ .../p104-source-chart-shortcut/RESULT.json | 81 +++++ .../p104-source-chart-shortcut/SOURCES.json | 18 + research/p104-source-chart-shortcut/TASK.json | 88 +++++ .../p104-source-chart-shortcut/VERIFY.json | 18 + research/p104-source-chart-shortcut/verify.py | 327 ++++++++++++++++++ 7 files changed, 679 insertions(+) create mode 100644 research/p104-source-chart-shortcut/PROOF.md create mode 100644 research/p104-source-chart-shortcut/README.md create mode 100644 research/p104-source-chart-shortcut/RESULT.json create mode 100644 research/p104-source-chart-shortcut/SOURCES.json create mode 100644 research/p104-source-chart-shortcut/TASK.json create mode 100644 research/p104-source-chart-shortcut/VERIFY.json create mode 100644 research/p104-source-chart-shortcut/verify.py diff --git a/research/p104-source-chart-shortcut/PROOF.md b/research/p104-source-chart-shortcut/PROOF.md new file mode 100644 index 0000000000..d1daf2e2e3 --- /dev/null +++ b/research/p104-source-chart-shortcut/PROOF.md @@ -0,0 +1,85 @@ +# Screened source chart after one Gram undo + +## Question + +Discussion #1166 comment 19035513 asks for one caller that fuses the physical +source-normalization factor with a full-output interface and a favorable bill. +The same handoff says a screened one-row Gram-undo shortcut still returns +`F81 T^{-1} x` on the physical source, and that the missing rank-one factor +costs 10816. This note proves that screening statement and the debt-free gate +arithmetic. It does not construct the fused caller. + +## Local FULL is not F81 + +Let `F81 = F_2^9 ⊗ F_2^9`, dimension 81. For a nonzero row vector `r` and a +nonzero column vector `c`, + +- `E_row(r) = r ⊗ F_2^9` has dimension 9, +- `E_col(c) = F_2^9 ⊗ c` has dimension 9, +- `E_row(r) ∩ E_col(c) = span{r ⊗ c}` has dimension 1, +- `E_row(r) + E_col(c)` has dimension 17, +- the codimension of that span in `F81` is 64. + +The verifier checks all `511 × 511` nonzero pairs. Distinct nonzero `r` give +distinct row charts. A zero vector is not a 9-dimensional chart. Completing +one local row chart and one local column chart therefore leaves 64 dimensions +of the common chart unpaid. Local FULL is not global `F81`. + +## The prepared entrance keeps `T^{-1}` + +Use the prepared cut from PR #3978. Write `A_r` and `A_c` for the two Gram +factors, `K = T^{-1}`, and `F` for the common chart. The raw product and the +physical source read are + +```text +M = [[I - A_c A_r, -A_c], [A_r, I]], +source = F * (M (K x, y))_1. +``` + +Polynomials are noncommutative. No relation `F K = K F` is used. Direct +expansion gives the source monomials + +```text ++ F K x - F A_c A_r K x. +``` + +Every source monomial contains `K`. Setting `A_r = 0` (row Gram undo) or +`A_c = 0` (column Gram undo) leaves exactly `F K x`. Replacing the entrance +`(K x, y)` by `(x, y)` leaves `F x` instead. The Gram undo does not create +the chart defect, and it does not remove it. The physical source after either +one-axis undo is `F K x = F81 T^{-1} x`, not `F81 x`. + +## Debt-free gate + +The published conditional inventory in that same cut is `m = 81`, +`W = 36608`, `N = 104^2 = 10816`, 208 calls, bare channel mass 2368 and +persistent progress cap 2312. Those integers retie as + +```text +81 W = 2965248, +81 W - N - 208*2312 = 2473536, +208*2368 + 2473536 = 2966080, +excess = 832. +``` + +For a changed local profile with debt `d = mass - progress`, the necessary +gate stated there is `C < N - 208 d`. At `d = 0` the strict allowance is +`C < 10816`. The predecessor tariff charges one rank-one child for the chart +`K` on each of the `N` data positions, cost `10816`. That cost equals the +allowance, so the strict gate fails. The screened excess moves from `-N` to +`0`, and the bill equals capacity `81 W` before helper, phase, owner, routing, +tape or precision charges. Any further positive charge makes the excess +positive. + +The inherited positive-debt route already fails by 832 before this factor. +The debt-free calculation is the most favorable specialization of the same +gate for this particular shortcut. It is not a universal P104 barrier, and it +does not price the three-layer joint word (cost 32448 in PR #3978). + +## What would escape the obstruction + +An entrance that is already `(x, y)` rather than `(K x, y)` has source `F x` +after the row undo, so this chart charge is not forced by the Gram undo alone. +A fused caller can still change the entrance, the chart family, the debt, or +the progress binding. Those changes need their own bill. Equality at `81 W` +is already a failed strict gate for the screened shortcut. diff --git a/research/p104-source-chart-shortcut/README.md b/research/p104-source-chart-shortcut/README.md new file mode 100644 index 0000000000..26a48ccbff --- /dev/null +++ b/research/p104-source-chart-shortcut/README.md @@ -0,0 +1,62 @@ +# Screened P104 source chart after one Gram undo + +**Negative result for one shortcut. No new κ.** Selected conditional κ stays +`0.001672660197076918`. + +## Scope and evidence + +Card `p104-side-correction`, scope **refined**. Discussion #1166 comment +19035513 asks for a caller that fuses the physical source-normalization +factor with a full-output interface and a favorable complete bill. This +package does not build that caller. It certifies the screened shortcut named +in that handoff. + +On `F81 = F_2^9 ⊗ F_2^9`, every nonzero row chart `r ⊗ F_2^9` and column chart +`F_2^9 ⊗ c` meet in one line and span 17 dimensions. The codimension in `F81` +is 64, over all `511 × 511` nonzero pairs. Local FULL is not global `F81`. + +On the prepared entrance `(T^{-1} x, y)` of the PR #3978 joint cut, deleting +either Gram factor leaves the physical source equal to `F T^{-1} x`. The +rank-one chart tariff on all `N = 104^2 = 10816` data positions equals the +debt-free allowance `C < 10816`. The screened bill equals capacity `81 W = +2965248` before any further nonnegative charge, so the strict gate fails. + +The proof is in [PROOF.md](PROOF.md). Exact integers are in [RESULT.json](RESULT.json). +The inherited positive-debt excess 832 is retied only as a transcription check +of the published `#3978` gate. PR #3978's head is not an ancestor of canonical +main, so its files are cited rather than pinned as live inputs. + +## Reproduce + +Python 3.12, standard library, from the repository root: + +```sh +python3.12 -B scripts/research_package.py --package research/p104-source-chart-shortcut +``` + +The chart census checks 261121 pairs and takes roughly twenty seconds on +CPython 3.12. One registered command. No native replay, Lean, or Docker run. + +## Open next questions + +A fused caller that changes the entrance from `(T^{-1} x, y)` to a chart +already cleared, or that changes the debt and progress binding, is not ruled +out by equality at `81 W`. The first step is one literal producer whose source +bank is `F x` at the same cut, with owners, dirty returns and a bill strictly +under `81 W` after every nonnegative charge. It is blocked until that +entrance and those charges are specified. Applying `T` as `N` extra rank-one +children on this shortcut does not open a margin. + +## Credit + +The prepared cut, the gate `C < N - 208 d`, and the tariff that charges each +`K = T^{-1}` as one rank-one child are PR #3978 (`48e2e44d8785be8204d8c4b719850332f4f9abe0`, +`research/p104-joint-compensation`) by Chris R / Clear1nsight. The fusion +question is discussion comment 19035513, from the same handoff as PRs #3981, +#3979, #3984 and #3978. Retained lineage: Rohan Arun / #1972, Chafik +Boukhalfa / #1991, Adam Gall / #1940, and the E8, native and compiler sources +named there. + +New chart census, noncommutative source expansion and debt-free comparison +are by unpaidmoon with Grok assistance in Cursor. Apache-2.0. No human or +proof-assistant review is claimed. The selected frontier is unchanged. diff --git a/research/p104-source-chart-shortcut/RESULT.json b/research/p104-source-chart-shortcut/RESULT.json new file mode 100644 index 0000000000..4d2509fc36 --- /dev/null +++ b/research/p104-source-chart-shortcut/RESULT.json @@ -0,0 +1,81 @@ +{ + "charts": { + "field": 2, + "factor_dimension": 9, + "f81_dimension": 81, + "nonzero_row_charts": 511, + "pairs_checked": 261121, + "row_dimension": 9, + "column_dimension": 9, + "intersection_dimension": 1, + "span_dimension": 17, + "codimension_in_f81": 64 + }, + "identity": { + "full_source": [ + { + "coeff": -1, + "atoms": [ + "F", + "Ac", + "Ar", + "K", + "x" + ] + }, + { + "coeff": 1, + "atoms": [ + "F", + "K", + "x" + ] + } + ], + "row_undo_source": [ + { + "coeff": 1, + "atoms": [ + "F", + "K", + "x" + ] + } + ], + "column_undo_source": [ + { + "coeff": 1, + "atoms": [ + "F", + "K", + "x" + ] + } + ], + "row_undo_if_entrance_drops_K": [ + { + "coeff": 1, + "atoms": [ + "F", + "x" + ] + } + ] + }, + "gate": { + "N": 10816, + "m": 81, + "W": 36608, + "calls": 208, + "capacity_81W": 2965248, + "inherited_positive_debt_excess": 832, + "debt_free_allowance": 10816, + "rank_one_chart_cost": 10816, + "strict_gate_passes": false, + "screened_excess": 0, + "screened_bill": 2965248 + }, + "checks": 3, + "controls": 5, + "kappa_claim": null +} diff --git a/research/p104-source-chart-shortcut/SOURCES.json b/research/p104-source-chart-shortcut/SOURCES.json new file mode 100644 index 0000000000..a604c6a640 --- /dev/null +++ b/research/p104-source-chart-shortcut/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "bb4bccbf42844d2801487450727c2f63e10d1d0f", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0" + } + ] +} diff --git a/research/p104-source-chart-shortcut/TASK.json b/research/p104-source-chart-shortcut/TASK.json new file mode 100644 index 0000000000..fc1924013d --- /dev/null +++ b/research/p104-source-chart-shortcut/TASK.json @@ -0,0 +1,88 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 6, + "base_commit": "bb4bccbf42844d2801487450727c2f63e10d1d0f", + "original_card": { + "id": "p104-side-correction", + "question": "Can the proposed P104 joint endpoint flags be realized by a chronological correction program with coefficients, dirty restoration and an affordable complete bill?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/p104-native-channel/README.md", + "research/p104-native-channel/PROOF.md", + "docs/research/community-efficient1000-review.md", + "research/p104-joint-unit-flags/README.md" + ], + "methods": [ + "Construct one side-correction word at an explicit chronological cut with the needed frames still available.", + "Derive a lower bound on the side correction and hosting costs that decides whether this channel can beat the selected budget." + ], + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. 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", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the revision-6 family record and #2981 static joint flags, alongside the reviewed #1991 channel. #2981 is an author-checked source archive, not an independently validated executable correction or a refutation of program-level lifetime floors.", + "scope": "Source-bound orientation only. Read the named package and review before relying on its local evidence; this command is not its replay or supplier admission." + }, + "first_experiment": "After checking live handoffs, pin one named collection from #2981 and attach acquisition/delivery times, source dependencies and coefficient requirements. Test legal access and arbitrary dirty restoration; price any completion against the full channel/endpoint/hosting allowance. Stop with the exact missing implication or a scoped counterexample rather than expanding the static cover census.", + "bottleneck_link": "Completing an already realized changed channel tests a concrete construction opportunity, instead of refining the incumbent packing. A positive local result still needs global and all-size admission.", + "allowed_variations": [ + "One correction factorization, one chronological cut, or one explicit hosting obstruction.", + "A changed correction schedule with an updated full bill and native frame contract." + ], + "scope_change_triggers": [ + "Recompiling the already certified low-rank channel without closing a new obligation.", + "Treating a pending ancestor, local histogram or unpriced side correction as an admitted global supplier.", + "Repeating a correction or physical conversion already supplied by a pending follow-up without adding independent coverage or a different unresolved obligation.", + "Repeating the 208-flag static matching or calling a static nested cover a chronological correction program. Independent audit of that certificate is distinct and remains useful." + ], + "overlap_terms": [ + "P104", + "I-G/2", + "side correction", + "native channel", + "1972", + "1991", + "2586", + "endpoint transport", + "physical dual", + "relay composition", + "2981", + "joint unit flags", + "acquisition delivery", + "static nesting" + ], + "existing_checks": [ + { + "scope": "PR #2981 reports static joint endpoint flags and a matching of 208 departure and arrival flags; archival intake is not independent verification.", + "evidence": "research/p104-joint-unit-flags/README.md", + "remaining": "Independent flag check and a chronological coefficient program with dirty restoration and a complete cost.", + "status": "author-checked", + "source_commit": "3d24b92d8ba057b57cb2d480170ec407520e6882", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "refined", + "actual_scope": "Certify that a one-axis Gram undo on the prepared P104 entrance leaves F T^{-1} x, and that the N rank-one chart tariff misses the debt-free strict gate.", + "scope_change_reason": "The card asks whether one chronological correction has an affordable complete bill. Discussion #1166 comment 19035513 narrows the next decision to fusing the physical source-normalization factor with a full-output interface. This package prices the screened one-axis shortcut named there and stops when that bill meets capacity. It does not construct the fused caller or repeat the PR #3978 three-layer word.", + "bottleneck_link": "A source-chart factor that consumes the entire debt-free allowance cannot be omitted from a P104 correction bill. The shortcut fails before it can reduce the binding complex side.", + "budget_minutes": 60, + "stop_rule": "Stop if the screened chart tariff meets or exceeds the debt-free allowance. Do not expand into a fused native caller on this entrance.", + "outcome": "negative-result", + "evidence": "PROOF.md; RESULT.json; verify.py census of all 511x511 nonzero charts and the noncommutative source expansion.", + "author": "unpaidmoon", + "ai_assistance": "Grok assistance in Cursor for the package, the finite chart census and the polynomial expansion. No human or proof-assistant review claimed.", + "open_questions": [ + { + "question": "Does one literal producer whose source bank is already F x, rather than F T^{-1} x, have a complete owner and dirty-return bill strictly under 81W?", + "why_it_matters": "Equality at capacity kills only the screened shortcut that keeps the prepared entrance (T^{-1} x, y). A changed entrance can still be favorable.", + "first_step": "Pin one chronological source bank that equals F x at the PR #3978 cut, list its owners and dirty returns, and price every nonnegative charge against 81W = 2965248.", + "blocked_by": "No such entrance is specified. Paying N extra rank-one children for T on the present shortcut adds cost without creating a margin." + } + ] +} diff --git a/research/p104-source-chart-shortcut/VERIFY.json b/research/p104-source-chart-shortcut/VERIFY.json new file mode 100644 index 0000000000..e8e7d94760 --- /dev/null +++ b/research/p104-source-chart-shortcut/VERIFY.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "All 511x511 nonzero F2 chart pairs, noncommutative Gram-undo source identity, debt-free gate equality, and five mutants." + } + ] +} diff --git a/research/p104-source-chart-shortcut/verify.py b/research/p104-source-chart-shortcut/verify.py new file mode 100644 index 0000000000..ef671b56fb --- /dev/null +++ b/research/p104-source-chart-shortcut/verify.py @@ -0,0 +1,327 @@ +#!/usr/bin/env python3 +"""Screened source-normalization shortcut on the prepared P104 cut. + +The row-local and column-local FULL charts are 9-dimensional subspaces of the +common 81-dimensional chart F81 = F_2^9 ⊗ F_2^9. Their span has dimension 17, +so local FULL is not global F81. On the prepared entrance of the PR #3978 +joint compensator, deleting either Gram factor still leaves the physical +source as F K x with K = T^{-1}. Charging one rank-one chart child on each +of the N = 104^2 data positions costs exactly the debt-free allowance, so +the strict gate fails before any further nonnegative cost. + +No new kappa and no selected-frontier change. +""" + +from __future__ import annotations + +import json +from pathlib import Path + +DIM = 9 +F81 = DIM * DIM # 81 +N_PORTS = 104 +N_DATA = N_PORTS * N_PORTS # 10816 +WIDTH = 81 +ROLES = 36608 +CALLS = 208 +BARE_MASS = 2368 +PROGRESS_CAP = 2312 + + +def rank_and_reduced(vectors: list[int]) -> tuple[int, tuple[int, ...]]: + rows = [v for v in vectors if v] + rank = 0 + for col in range(F81): + mask = 1 << col + pivot = None + for i in range(rank, len(rows)): + if rows[i] & mask: + pivot = i + break + if pivot is None: + continue + rows[rank], rows[pivot] = rows[pivot], rows[rank] + for i in range(len(rows)): + if i != rank and (rows[i] & mask): + rows[i] ^= rows[rank] + rank += 1 + reduced = tuple(sorted(v for v in rows[:rank] if v)) + return rank, reduced + + +def row_space(r: int) -> list[int]: + """Basis of r ⊗ F_2^9 inside F_2^9 ⊗ F_2^9, coordinates 9*a + b.""" + basis = [] + for k in range(DIM): + vector = 0 + for a in range(DIM): + if r & (1 << a): + vector |= 1 << (DIM * a + k) + basis.append(vector) + return basis + + +def column_space(c: int) -> list[int]: + """Basis of F_2^9 ⊗ c.""" + basis = [] + for a in range(DIM): + vector = 0 + for b in range(DIM): + if c & (1 << b): + vector |= 1 << (DIM * a + b) + basis.append(vector) + return basis + + +def chart_census() -> dict[str, int]: + spaces: dict[int, tuple[int, ...]] = {} + pairs = 0 + for r in range(1, 1 << DIM): + row_rank, row_id = rank_and_reduced(row_space(r)) + if row_rank != DIM: + raise AssertionError(f"row chart rank {row_rank} for r={r}") + spaces[r] = row_id + for c in range(1, 1 << DIM): + col_rank, _col_id = rank_and_reduced(column_space(c)) + if col_rank != DIM: + raise AssertionError(f"column chart rank {col_rank} for c={c}") + span_rank, _span = rank_and_reduced(row_space(r) + column_space(c)) + intersection = row_rank + col_rank - span_rank + if intersection != 1 or span_rank != 17: + raise AssertionError( + f"charts r={r} c={c}: intersection {intersection}, span {span_rank}" + ) + pairs += 1 + if len(set(spaces.values())) != (1 << DIM) - 1: + raise AssertionError("distinct nonzero row vectors failed to give distinct FULL charts") + if pairs != ((1 << DIM) - 1) ** 2: + raise AssertionError(f"pair count {pairs}") + return { + "field": 2, + "factor_dimension": DIM, + "f81_dimension": F81, + "nonzero_row_charts": (1 << DIM) - 1, + "pairs_checked": pairs, + "row_dimension": DIM, + "column_dimension": DIM, + "intersection_dimension": 1, + "span_dimension": 17, + "codimension_in_f81": F81 - 17, + } + + +# Noncommutative polynomials: a term is (coefficient, atom tuple). +Poly = list[tuple[int, tuple[str, ...]]] + + +def canon(terms: list[tuple[int, tuple[str, ...]]]) -> Poly: + acc: dict[tuple[str, ...], int] = {} + for coeff, atoms in terms: + if coeff == 0: + continue + acc[atoms] = acc.get(atoms, 0) + coeff + return [(acc[atoms], atoms) for atoms in sorted(acc) if acc[atoms]] + + +def add(left: Poly, right: Poly) -> Poly: + return canon([*left, *right]) + + +def scale(poly: Poly, factor: int) -> Poly: + return canon([(factor * coeff, atoms) for coeff, atoms in poly]) + + +def mul(left: Poly, right: Poly) -> Poly: + return canon( + [ + (cl * cr, al + ar) + for cl, al in left + for cr, ar in right + ] + ) + + +ONE: Poly = [(1, ())] + + +def atom(name: str) -> Poly: + return [(1, (name,))] + + +def block_apply(matrix: list[list[Poly]], vector: list[Poly]) -> list[Poly]: + out = [] + for row in matrix: + acc: Poly = [] + for entry, coord in zip(row, vector, strict=True): + acc = add(acc, mul(entry, coord)) + out.append(acc) + return out + + +def source_terms(poly: Poly) -> Poly: + return [(c, a) for c, a in poly if "x" in a and "y" not in a] + + +def gram_product(ar: Poly, ac: Poly) -> list[list[Poly]]: + """M = U(-A_c) S(A_r) = [[I - A_c A_r, -A_c], [A_r, I]].""" + return [ + [add(ONE, scale(mul(ac, ar), -1)), scale(ac, -1)], + [ar, ONE], + ] + + +def physical_source(matrix: list[list[Poly]], entrance: list[Poly]) -> Poly: + """First block of Gphys = diag(F, F K) applied to M * entrance.""" + image = block_apply(matrix, entrance) + return mul(atom("F"), image[0]) + + +def shortcut_identity() -> dict[str, list[list[str]]]: + ar, ac = atom("Ar"), atom("Ac") + kx = mul(atom("K"), atom("x")) + entrance = [kx, atom("y")] + plain = [atom("x"), atom("y")] + full = physical_source(gram_product(ar, ac), entrance) + row_undo = physical_source(gram_product([], ac), entrance) + col_undo = physical_source(gram_product(ar, []), entrance) + row_without_chart = physical_source(gram_product([], ac), plain) + full_source = source_terms(full) + row_source = source_terms(row_undo) + col_source = source_terms(col_undo) + cleared = source_terms(row_without_chart) + expect_full = canon( + [ + (1, ("F", "K", "x")), + (-1, ("F", "Ac", "Ar", "K", "x")), + ] + ) + expect_undo = [(1, ("F", "K", "x"))] + expect_cleared = [(1, ("F", "x"))] + if full_source != expect_full: + raise AssertionError(f"full source {full_source}") + if row_source != expect_undo or col_source != expect_undo: + raise AssertionError(f"undo source row={row_source} col={col_source}") + if cleared != expect_cleared: + raise AssertionError(f"cleared entrance source {cleared}") + if any("K" not in atoms for _c, atoms in full_source): + raise AssertionError("a source monomial lost K") + def words(poly: Poly) -> list[dict[str, object]]: + return [{"coeff": coeff, "atoms": list(atoms)} for coeff, atoms in poly] + + return { + "full_source": words(full_source), + "row_undo_source": words(row_source), + "column_undo_source": words(col_source), + "row_undo_if_entrance_drops_K": words(cleared), + } + + +def gate() -> dict[str, int | bool]: + if N_DATA != 10816: + raise AssertionError(N_DATA) + capacity = WIDTH * ROLES + remaining = capacity - N_DATA - CALLS * PROGRESS_CAP + bare = CALLS * BARE_MASS + remaining + inherited_excess = bare - capacity + if capacity != 2965248 or remaining != 2473536 or bare != 2966080 or inherited_excess != 832: + raise AssertionError( + f"inherited gate tie-out capacity={capacity} remaining={remaining} " + f"bare={bare} excess={inherited_excess}" + ) + # Debt-free specialization d = mass - progress = 0 of C < N - 208 d. + debt = 0 + allowance = N_DATA - CALLS * debt + factor_cost = N_DATA # one rank-one K child on every data position + if not (factor_cost == allowance and not factor_cost < allowance): + raise AssertionError("factor cost must meet, and therefore miss, the strict allowance") + excess_before = CALLS * debt - N_DATA + excess_after = excess_before + factor_cost + if excess_before != -N_DATA or excess_after != 0: + raise AssertionError(f"screened excess {excess_before} -> {excess_after}") + bill = capacity + excess_after + if bill != capacity: + raise AssertionError("screened bill must equal 81W") + return { + "N": N_DATA, + "m": WIDTH, + "W": ROLES, + "calls": CALLS, + "capacity_81W": capacity, + "inherited_positive_debt_excess": inherited_excess, + "debt_free_allowance": allowance, + "rank_one_chart_cost": factor_cost, + "strict_gate_passes": factor_cost < allowance, + "screened_excess": excess_after, + "screened_bill": bill, + } + + +def controls() -> int: + """Mutants that must not satisfy the theorem.""" + count = 0 + zero_rank, _zero = rank_and_reduced(row_space(0)) + if zero_rank != 0: + raise AssertionError("the zero row vector is not a 9-dimensional chart") + count += 1 + # A one-dimensional factor would make the local span smaller than 17. + bad_r, bad_c = 1, 1 + span_rank, _span = rank_and_reduced(row_space(bad_r)[:1] + column_space(bad_c)[:1]) + if span_rank == 17: + raise AssertionError("truncated charts unexpectedly spanned 17") + count += 1 + # Dropping K from the entrance removes the defect; the theorem is about K. + ar, ac = atom("Ar"), atom("Ac") + dropped = source_terms(physical_source(gram_product([], ac), [atom("x"), atom("y")])) + if dropped == [(1, ("F", "K", "x"))]: + raise AssertionError("dropping K still looked like the chart defect") + count += 1 + # An off-by-one tariff would pass the strict inequality and is not this bill. + if (N_DATA - 1) < (N_DATA - CALLS * 0): + count += 1 + else: + raise AssertionError("control tariff failed to become strict") + # Commuting F through K is a different word and is not the physical order. + if canon([(1, ("K", "F", "x"))]) == canon([(1, ("F", "K", "x"))]): + raise AssertionError("polynomial normal form identified distinct chart orders") + count += 1 + return count + + +def receipt() -> dict: + charts = chart_census() + identity = shortcut_identity() + bill = gate() + control_count = controls() + return { + "charts": charts, + "identity": identity, + "gate": bill, + "checks": 3, + "controls": control_count, + "kappa_claim": None, + } + + +def main() -> None: + result = receipt() + result_path = Path(__file__).with_name("RESULT.json") + committed = json.loads(result_path.read_text(encoding="utf-8")) + comparable = {key: result[key] for key in ("charts", "identity", "gate")} + recorded = {key: committed[key] for key in ("charts", "identity", "gate")} + if comparable != recorded: + raise SystemExit("RESULT.json does not match the recomputed certificate") + checks = result["checks"] + controls = result["controls"] + print( + "PASS_P104_SOURCE_CHART_SHORTCUT " + f"checks={checks} controls={controls} " + f"span={result['charts']['span_dimension']} " + f"codimension={result['charts']['codimension_in_f81']} " + f"cost={result['gate']['rank_one_chart_cost']} " + f"allowance={result['gate']['debt_free_allowance']} " + f"bill={result['gate']['screened_bill']}" + ) + + +if __name__ == "__main__": + main()