diff --git a/research/common-flag-frame-obstruction/CLAIM.md b/research/common-flag-frame-obstruction/CLAIM.md new file mode 100644 index 0000000000..614275b143 --- /dev/null +++ b/research/common-flag-frame-obstruction/CLAIM.md @@ -0,0 +1,70 @@ +# Sprint claim + +- Track: structural decoder research; OS-random assignment seed **42**. +- Started: 2026-10-13 06:03:27 UTC. Expected finish: 06:48 UTC; + verification and handoff reserved from 06:37 UTC. +- Base: `66849e1475c930fd7732b1a0067ffee7e1e95f60` (fresh `origin/main`). +- Branch: `research/seed42-structural-decoder`, isolated worktree. +- Scope: the all-role rational-frame XOR interface, with every assigned + matrix preserving one common complete flag after a common additive gauge. + Test whether nonprojection, possibly noncommuting upper-triangular labels + can yield a positive rank deficit. Include the commuting, nonsplit case + by passing to a characteristic-zero splitting field in the written proof. +- Method: one-dimensional characters of the additive frame group, a + telescoping rank bound over a characteristic-two Laurent fraction field, + and exact finite circuit/flag controls. No optimization search is planned. +- Deliverable: a scoped theorem or counterexample, independently checkable + finite evidence, source pins, and one reproduction command. No kappa claim. + +## Selection and overlap + +The three candidates were (1) mixed-beta overcomplete P112 decoders, +(2) Gaussian E8 asymmetric support costs, and (3) nonprojection rational +frame labels. Candidate 1 overlaps #717's unfinished mixed-beta question; +candidate 2 overlaps #738/#767. Seed 42 selects the third mechanism and +the finite controls' deterministic generation seed. Its common-flag +restriction changes the search class; this does not reopen a closed +puncture or star-decoder search with more computation. + +Read CONTRIBUTING, the selected record, current status, PR ledger, selected +#626 assembly, its source inventory and maintainer review, and the actual +K492 construction proof. Accepted conditional kappa is +`51110230636731/31250000000000000`, with #626 head +`660de893d27bb7abd1d5b01b1640207528a5c851` and #543 head +`2065fe4f72a914d907f1046603f5a36f17018535`. + +The initial complete open-PR metadata scan reached #808; the immediate +pre-claim refresh reached #810. Relevant predecessors: the historical +commuting-projection core obstruction, the general finite-bit contract and +routing obstruction, #717's explicitly open nonprojection-label question, +#791's distinct idempotent endpoint penalty, and #705/#800's Clifford +path-valuation criteria. None is treated as an accepted frontier claim. +GraphQL `pinnedIssues` returned an empty list. The only open issue was #650, +a request for Discussions, so this claim is local. + +All workers are restricted to this common-flag question. The selected +record, existing generators and `upstream/` are outside the edit scope. + +Prepared for @navinor with substantial OpenAI GPT-6 Astra assistance. +New material is under Apache-2.0. + +## Result update + +Submitted one focused PR: +[#825](https://github.com/CrocSwap/integer-mult-bounds/pull/825). +The common affine complete flag forces **s >= Wm** and hence a normalized +rank-child moment of at least one. This is a scoped negative theorem, with +no new kappa and no claim about unrestricted nontriangular frames. + +Completed finite evidence: 14 circuits, 13 tests and all 729 ordered +triangular-matrix differences. The existing scorer agrees on every edge +rank and all-role endpoint contract. Optimized/relocated replay, source and +receipt corruption rejection, output protection and regeneration passed; +see `VALIDATION.md` for commands, review responses and limitations. + +Final overlap snapshot: 637 open PRs through #824, no matching theorem +identified; pinned issues still empty. Upstream main was refreshed to +`7ee02b7c96d85f22b38d28bd7ed49bb8c1aeb261`, selecting #741/#589/#555. +The original research base is retained; all four mathematical source pins +are unchanged. The submission awaits human review of the written proof +and its interface scope. diff --git a/research/common-flag-frame-obstruction/EXPECTED.json b/research/common-flag-frame-obstruction/EXPECTED.json new file mode 100644 index 0000000000..1abcbb74ca --- /dev/null +++ b/research/common-flag-frame-obstruction/EXPECTED.json @@ -0,0 +1,1077 @@ +{ + "cases": { + "conjugated_affine": { + "baseline": 15, + "character_counts": [ + 27, + 29, + 27 + ], + "edge_character_masks": [ + 7, + 7, + 7, + 0, + 4, + 7, + 6, + 3, + 7, + 7, + 7, + 7, + 7, + 7, + 3, + 3, + 7, + 7, + 6, + 7, + 6, + 7, + 3, + 3, + 6, + 6, + 1, + 1, + 5, + 5, + 7, + 7, + 6, + 7, + 7 + ], + "edge_ranks": [ + 3, + 3, + 3, + 2, + 2, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 2, + 3, + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 2, + 3, + 3 + ], + "nilpotent_rank_excess": 5, + "rank_mass": 88 + }, + "grouped_five_port_gate": { + "baseline": 15, + "character_counts": [ + 10, + 10, + 10 + ], + "edge_character_masks": [ + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7 + ], + "edge_ranks": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "nilpotent_rank_excess": 0, + "rank_mass": 30 + }, + "noncommuting_jordan": { + "baseline": 15, + "character_counts": [ + 27, + 29, + 27 + ], + "edge_character_masks": [ + 7, + 7, + 7, + 0, + 4, + 7, + 6, + 3, + 7, + 7, + 7, + 7, + 7, + 7, + 3, + 3, + 7, + 7, + 6, + 7, + 6, + 7, + 3, + 3, + 6, + 6, + 1, + 1, + 5, + 5, + 7, + 7, + 6, + 7, + 7 + ], + "edge_ranks": [ + 3, + 3, + 3, + 2, + 2, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 2, + 3, + 2, + 3, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 2, + 3, + 3 + ], + "nilpotent_rank_excess": 5, + "rank_mass": 88 + }, + "nonsplit_commuting": { + "baseline": 10, + "character_counts": [ + 35, + 35 + ], + "edge_character_masks": [ + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "edge_ranks": [ + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2 + ], + "nilpotent_rank_excess": 0, + "rank_mass": 70 + }, + "seed42_m2_W4": { + "baseline": 8, + "character_counts": [ + 29, + 26 + ], + "edge_character_masks": [ + 2, + 3, + 3, + 1, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 1, + 1, + 2, + 3, + 2, + 1, + 1, + 1, + 2, + 2, + 3, + 3, + 1, + 3, + 3, + 3 + ], + "edge_ranks": [ + 1, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 1, + 1, + 1, + 2, + 1, + 1, + 1, + 1, + 1, + 1, + 2, + 2, + 1, + 2, + 2, + 2 + ], + "nilpotent_rank_excess": 0, + "rank_mass": 55 + }, + "seed42_m2_W5": { + "baseline": 10, + "character_counts": [ + 28, + 30 + ], + "edge_character_masks": [ + 2, + 3, + 3, + 2, + 3, + 3, + 3, + 1, + 3, + 3, + 0, + 1, + 3, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3 + ], + "edge_ranks": [ + 1, + 2, + 2, + 1, + 2, + 2, + 2, + 1, + 2, + 2, + 1, + 1, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 2 + ], + "nilpotent_rank_excess": 1, + "rank_mass": 59 + }, + "seed42_m2_W6": { + "baseline": 12, + "character_counts": [ + 31, + 30 + ], + "edge_character_masks": [ + 1, + 3, + 1, + 2, + 1, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 1, + 1, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 1, + 3, + 3 + ], + "edge_ranks": [ + 1, + 2, + 1, + 1, + 1, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2 + ], + "nilpotent_rank_excess": 0, + "rank_mass": 61 + }, + "seed42_m3_W4": { + "baseline": 12, + "character_counts": [ + 29, + 26, + 30 + ], + "edge_character_masks": [ + 5, + 6, + 1, + 0, + 6, + 7, + 7, + 7, + 7, + 7, + 3, + 7, + 5, + 5, + 4, + 7, + 7, + 1, + 5, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 6, + 7 + ], + "edge_ranks": [ + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 3, + 2, + 2, + 2, + 3, + 3, + 1, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 3 + ], + "nilpotent_rank_excess": 4, + "rank_mass": 89 + }, + "seed42_m3_W5": { + "baseline": 15, + "character_counts": [ + 24, + 31, + 29 + ], + "edge_character_masks": [ + 6, + 6, + 3, + 0, + 6, + 7, + 7, + 3, + 3, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 6, + 4, + 1, + 6, + 6, + 7, + 7, + 6, + 6, + 7, + 7, + 7, + 5, + 2 + ], + "edge_ranks": [ + 2, + 2, + 2, + 2, + 2, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 1, + 2, + 2, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 2, + 2 + ], + "nilpotent_rank_excess": 4, + "rank_mass": 88 + }, + "seed42_m3_W6": { + "baseline": 18, + "character_counts": [ + 35, + 31, + 30 + ], + "edge_character_masks": [ + 7, + 3, + 7, + 0, + 3, + 7, + 7, + 7, + 3, + 7, + 7, + 7, + 7, + 7, + 5, + 5, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 7, + 5, + 5, + 7, + 7, + 3, + 3, + 7, + 7, + 7, + 7, + 7, + 7 + ], + "edge_ranks": [ + 3, + 2, + 3, + 2, + 2, + 3, + 3, + 3, + 2, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 3, + 2, + 2, + 3, + 3, + 2, + 2, + 3, + 3, + 3, + 3, + 3, + 3 + ], + "nilpotent_rank_excess": 2, + "rank_mass": 98 + }, + "seed42_m4_W4": { + "baseline": 16, + "character_counts": [ + 27, + 26, + 29, + 31 + ], + "edge_character_masks": [ + 14, + 15, + 15, + 0, + 15, + 15, + 13, + 13, + 14, + 11, + 15, + 15, + 10, + 10, + 13, + 13, + 14, + 15, + 15, + 15, + 11, + 15, + 13, + 15, + 13, + 13, + 7, + 7, + 15, + 15, + 14, + 15, + 15, + 15 + ], + "edge_ranks": [ + 3, + 4, + 4, + 2, + 4, + 4, + 3, + 3, + 3, + 3, + 4, + 4, + 3, + 3, + 3, + 3, + 3, + 4, + 4, + 4, + 3, + 4, + 3, + 4, + 3, + 3, + 3, + 3, + 4, + 4, + 3, + 4, + 4, + 4 + ], + "nilpotent_rank_excess": 4, + "rank_mass": 117 + }, + "seed42_m4_W5": { + "baseline": 20, + "character_counts": [ + 27, + 27, + 31, + 31 + ], + "edge_character_masks": [ + 14, + 15, + 15, + 0, + 13, + 15, + 7, + 15, + 15, + 15, + 7, + 7, + 10, + 10, + 13, + 13, + 15, + 15, + 15, + 13, + 15, + 11, + 14, + 15, + 14, + 14, + 13, + 13, + 15, + 15, + 15, + 15, + 12, + 15, + 15 + ], + "edge_ranks": [ + 3, + 4, + 4, + 2, + 3, + 4, + 3, + 4, + 4, + 4, + 3, + 3, + 3, + 3, + 3, + 3, + 4, + 4, + 4, + 3, + 4, + 3, + 3, + 4, + 3, + 3, + 3, + 3, + 4, + 4, + 4, + 4, + 3, + 4, + 4 + ], + "nilpotent_rank_excess": 5, + "rank_mass": 121 + }, + "seed42_m4_W6": { + "baseline": 24, + "character_counts": [ + 31, + 30, + 27, + 27 + ], + "edge_character_masks": [ + 15, + 7, + 7, + 0, + 7, + 5, + 15, + 15, + 15, + 14, + 15, + 13, + 15, + 15, + 11, + 11, + 8, + 11, + 15, + 6, + 3, + 14, + 15, + 11, + 7, + 7, + 15, + 15, + 9, + 9, + 15, + 15, + 15, + 15, + 15, + 15 + ], + "edge_ranks": [ + 4, + 3, + 3, + 2, + 3, + 3, + 4, + 4, + 4, + 3, + 4, + 3, + 4, + 4, + 3, + 3, + 2, + 3, + 4, + 3, + 3, + 3, + 4, + 3, + 3, + 3, + 4, + 4, + 3, + 3, + 4, + 4, + 4, + 4, + 4, + 4 + ], + "nilpotent_rank_excess": 8, + "rank_mass": 123 + }, + "sharp_untouched": { + "baseline": 6, + "character_counts": [ + 3, + 3 + ], + "edge_character_masks": [ + 3, + 3, + 3 + ], + "edge_ranks": [ + 2, + 2, + 2 + ], + "nilpotent_rank_excess": 0, + "rank_mass": 6 + } + }, + "kappa": "unchanged", + "scope": "Finite consistency checks; universal theorem is written separately", + "seed": 42, + "status": "PASS_COMMON_FLAG_OBSTRUCTION", + "triangular_difference_census": { + "histogram": { + "rank0_diagonal0": 27, + "rank1_diagonal0": 54, + "rank1_diagonal1": 324, + "rank2_diagonal2": 324 + }, + "pairs": 729 + } +} diff --git a/research/common-flag-frame-obstruction/README.md b/research/common-flag-frame-obstruction/README.md new file mode 100644 index 0000000000..fc38e760e0 --- /dev/null +++ b/research/common-flag-frame-obstruction/README.md @@ -0,0 +1,234 @@ +# Common-flag obstruction for rational-frame XOR circuits + +**Scoped negative result; no new kappa.** In the all-role finite-bit +interface, rational frames that preserve one common complete flag cannot +give a positive rank deficit. This includes arbitrary commuting rational +frames, even with nonrational eigenvalues or Jordan blocks. It also includes +noncommuting upper-triangular frames. Nonprojection labels alone therefore +do not escape this obstruction. + +The result is a written theorem. The executable supplies exact examples, +finite consistency checks and rejection controls; it is not a formal proof +by enumeration or a proof-assistant formalization. + +## Statement and cost consequence + +Use the fixed-width XOR model of +[`finite_bit_contract.py`](../../scripts/finite_bit_contract.py) and the +[upstream finite shear contract](../../upstream/build/sections/04-swap.tex), +lines 103–204. There are W independently initialized roles, including every +scratch role, and a rational m by m matrix at each source, sink and gate. +Every port of a gate uses that gate's one common matrix. The complete +pointwise XOR circuit has scalar permutation rho, and + + M_out(rho(w)) - M_in(w) = I_m for every role w. + Delta_e = M_head(e) - M_tail(e) + s = sum_e rank_Q(Delta_e). + +Every physical edge is included, including terminal edges and untouched +roles. Suppose there are a single common matrix A and an invertible B over +a characteristic-zero extension K of Q such that + + B^-1 (M_v - A) B + +is upper triangular for every assigned vertex v. Then **s >= Wm**. +There is no restriction on scalar circuit length, topology, rho, signs, +denominators, idempotence or the entries above the diagonal. + +This is already a complete optimistic rejection of the proposed mechanism +within this interface. Even granting zero additional fixed overhead, its +rank-r child moment, for any 0 < q < 1, satisfies + + (1/W) sum_e (rank(Delta_e)/m)^q + >= s/(Wm) >= 1. + +The inequality uses x^q >= x on [0,1]. Splitting a child into smaller ranks +cannot help. All source access, internal and terminal frame changes, +restoration paths and scratch roles are included in the edge sum; adding +other nonnegative expenses cannot produce contraction. There is consequently +no candidate bit supplier to compose with a complex supplier or outer +assembly. This conclusion does not price a different copied-stream interface. + +## Proof + +Write T_v = B^-1(M_v-A)B. For each i in {1,...,m}, let lambda_i(M_v-A) +be the i-th diagonal entry of T_v. This is an additive functional; it takes +I_m to 1. For an upper-triangular matrix D, + + rank_K(D) >= number of nonzero diagonal entries of D. (1) + +Indeed, the principal submatrix on those entries is upper triangular with +nonzero determinant. Field extension and conjugation preserve rank, so (1) +applies to every Delta_e with its original rational rank. + +Fix i. Let Gamma be the additive subgroup of K generated by 1 and the +finitely many lambda_i(M_v-A). It is finitely generated and torsion free, +so it is a free abelian group. The group algebra F2[Gamma] is a Laurent +polynomial domain. Work in its fraction field L. Denote its monomial with +exponent a by z^a. In particular z^1 != 1. + +The **coefficients** are in F2, but the **exponents** stay in Gamma in +characteristic zero. No rational or algebraic matrix entry is reduced +modulo two. This distinction permits even denominators and nonsplit spectra. + +Replace each edge on role w by the W by W diagonal operator that multiplies +that role by z^(lambda_i(Delta_e)). Retain each scalar XOR gate as its +ordinary constant matrix over F2. At a gate, every participating role has +the same monomial frame. Scalar mixing therefore commutes with that common +frame. The same common-frame invariant as in the upstream transfer gives + + U_i = D_out P_rho D_in^-1 = z^1 P_rho. (2) + +Here D_in and D_out contain the monomials of the corresponding terminal +frames; the second equality uses the endpoint condition for **every** input +role. Setting every edge operator to identity instead gives P_rho. + +For products of matrices of equal size, telescoping one factor at a time +and using rank subadditivity bounds the rank of their difference by the +sum of the ranks of the differing factors. Each edge operator differs +from identity in rank zero if lambda_i(Delta_e)=0 and rank one otherwise. +The scalar factors are unchanged. By (2), + + W = rank_L((z^1-1) P_rho) + <= #{e : lambda_i(Delta_e) != 0}. (3) + +Summing (3) over all m diagonal positions and then applying (1) proves + + Wm <= sum_e #{i : lambda_i(Delta_e) != 0} + <= sum_e rank_Q(Delta_e) = s. + +No edge-disjoint routing or path-homogeneity assumption enters this proof. +The bound is sharp: zero source/gate frames and identity sink frames attain +s=Wm for any valid scalar permutation circuit. + +### Commuting rational frames + +A finite commuting family over an algebraic closure of Q has a common +eigenvector: take an eigenspace of one matrix, restrict the other commuting +matrices to that invariant space, and repeat. Pass to the quotient by the +resulting invariant line and induct on dimension. This gives a common +complete flag, without assuming diagonalizability. Apply the theorem with +A=0. The same conclusion holds when subtracting one common A makes the +assigned matrices commute. A field extension changes none of their ranks. + +## Exact finite evidence + +Run from the repository root, using Python 3.11 or later and the standard +library (tested on CPython 3.12.14 and 3.14.7): + +```sh +python3 -I -B research/common-flag-frame-obstruction/verify.py +``` + +The command checks four local mathematical-source pins, replays all formal +input columns over F2 Laurent polynomials with exact Fraction exponents, +checks the frozen +`EXPECTED.json`, and runs the rejection controls. It ends with: + +```text +PASS_COMMON_FLAG_OBSTRUCTION cases=14 tests=13 bound=s>=W*m kappa=unchanged +``` + +`--emit /new/path.json` regenerates the receipt after the same checks and +refuses to overwrite an existing file. JSON payload equality, rather than +container metadata, is the acceptance criterion. + +Run `python3 -I -B research/common-flag-frame-obstruction/validate.py` for +the isolated relocated replay, source/certificate tampering controls, +no-overwrite control and byte-identical regeneration check. It ends with +`PASS_COMMON_FLAG_CLI_CONTROLS` followed by the control names. + +The completed finite domain is: + +- Nine deterministic examples, m in {2,3,4} and W in {4,5,6}; seed + `42 + 10*m + W`. Each has 15 XOR gates. Upper-triangular entries are drawn + from {-2/3,-1/2,0,1/2,1,2}. +- A seed-42, W=5, m=3 example explicitly containing E12 and E23. These are + nonzero nilpotents and do not commute: their commutator is E13. A dense + rational conjugate plus a common additive gauge has exactly the same + edge costs and character counts. +- A five-port grouped gate containing all 15 XOR updates, testing the + single-frame condition with more than two participating roles. +- A sharp six-rank-unit example containing three untouched arbitrary-input + roles, and a commuting m=2 example with frames aI+bJ, J^2=-I. The latter's + two characters are a+bi and a-bi, stored as pairs of Fractions. A frame + with b nonzero has no rational eigenline. +- All 729 ordered differences of 2 by 2 upper-triangular matrices whose + three entries are in {-1,0,1}. A separate determinant formula checks + their exact ranks against elimination. + +These are consistency cases with a fixed stopping rule: complete this +finite list. No optimization search, timeout, or impossibility inference +from failed search is involved. The exact per-edge rank and active-character +masks are retained in `EXPECTED.json`. + +Controls reject a damaged endpoint, wrong scalar permutation, omitted XOR gate, +unlisted gate source, singular basis, non-preserved supplied flag, and +different per-port gate frames. Direct replay controls reject incorrect +characters, and the nonsplit example checks its eigenvector equations and +all pairwise commutators. Further controls check fractional exponent +addition and characteristic-zero rank. The dense matrix [[1,1],[1,1]] has +rank one but two nonzero diagonal entries: it explicitly invalidates step +(1) if the triangular hypothesis is discarded. Rejecting a supplied flag +does not certify that no other flag exists. + +## Relation to previous work and limits + +Douglas Colkitt's historical +[commuting-projection obstruction](../../docs/research/small-block-control.md) +bounds a particular triple-core label family by dimension counting. This +contribution establishes a related exclusion in a different model: the +complete fixed-W XOR interface with arbitrary nonprojection rational frames, +nonsplit spectra and noncommuting common-flag families. It neither derives +that predecessor's label-count inequality nor extends its numerical ceiling. + +The [routing obstruction](../../docs/research/cyclic-topology-audit.md) +excludes a topology for every rational frame assignment when the specified +permutation has edge-disjoint paths. This result instead restricts frame +geometry for any topology. The finite examples here are controls, not new +examples of nonroutable circuits. + +DreamingOfClouds' [#717](https://github.com/CrocSwap/integer-mult-bounds/pull/717), +section S2, explicitly leaves nonprojection rational labels open. The +common-flag subclass is excluded here; the unrestricted question remains. +@Curtis-D's [#791](https://github.com/CrocSwap/integer-mult-bounds/pull/791) +prices paths between idempotents. Ivan's +[#705](https://github.com/CrocSwap/integer-mult-bounds/pull/705) and +@jeremydiviney's [#800](https://github.com/CrocSwap/integer-mult-bounds/pull/800) +concern Clifford path valuations. Those are distinct models or hypotheses; +none of their executable code is imported. Exact inspected heads are in +`SOURCES.json`. @davidgovea's +[#720](https://github.com/CrocSwap/integer-mult-bounds/pull/720) removes a +flag restriction on three endpoint targets; the present restriction is on +every assigned circuit frame. No literature-priority claim is made for the +elementary rank telescope or simultaneous triangularization facts. + +The theorem requires a common full flag, linear XOR gates, one common +frame per gate and the endpoint identity on all W independent roles. +Arbitrary nontriangular frames, nonlinear gates, clean-input restrictions, +dependent copy streams counted as extra volume, changed-width circuits, +and the complex Clifford interface are outside scope. Common flags are +supplied in the finite examples; this package is not a general flag-finding +algorithm. It does not audit the selected supplier's physical realization. + +Base commit: `66849e1475c930fd7732b1a0067ffee7e1e95f60`, where the selected +conditional kappa was `51110230636731/31250000000000000` (#626 with #543). +During verification, main advanced to +`7ee02b7c96d85f22b38d28bd7ed49bb8c1aeb261` and selected +`1661202643272239/1000000000000000000` (#741 with #589 on #555). Its selected +assembly, actual SW4 construction and maintainer review were inspected; +the four mathematical source files pinned here are unchanged. The historical +frontier hashes in `SOURCES.json` record context, not runtime inputs, so a +frontier update does not invalidate this unrelated theorem replay. + +This contribution changes neither result. All-size compilation, common-label +and mutable-basis realization, hosting, normalized residual, precision, tape, +recovery and analytic obligations of those constructions remain inherited. + +Contributed for **@navinor**, with substantial **OpenAI GPT-6 Astra +assistance** in mathematics, implementation and writing, including a scoped +AI proof review and a separate implementation review. No independent human +review is claimed. +New material is Apache-2.0; the upstream and predecessor notices remain +with their sources. See `CLAIM.md` for coordination and `VALIDATION.md` for +the executed checks and handoff. diff --git a/research/common-flag-frame-obstruction/SOURCES.json b/research/common-flag-frame-obstruction/SOURCES.json new file mode 100644 index 0000000000..41f3ebdf2c --- /dev/null +++ b/research/common-flag-frame-obstruction/SOURCES.json @@ -0,0 +1,62 @@ +{ + "base_commit": "66849e1475c930fd7732b1a0067ffee7e1e95f60", + "assignment_seed": 42, + "base_files_sha256": { + "upstream/build/sections/04-swap.tex": "412b170ccaab38dba96e95e3cbfae09f4876a9818f8d278776a746b0f8044906", + "scripts/finite_bit_contract.py": "3cff26a332cb6056f656b824e3a523fb8937d15206ddcc4118b911ac8df1b2a7", + "docs/research/cyclic-topology-audit.md": "156f3bc880738b1a6d378fd5d1d97297fd1ae457eb71160690ccb1cc1f42fc4c", + "docs/research/small-block-control.md": "e945c9eb9ae9af67bf88f4e5e17a79d3c4d313434624ab17684d39a406254165" + }, + "context_files_at_base_sha256_not_runtime_inputs": { + "docs/research/next-steps.md": "ea4edef12ae88b1595caf7814db419c54d607da9d2ad6f87ea1ea4d010e1e651", + "certificates/selected-result.json": "b3bf402f31a69bde0629936a9b569bed48281568d7b16d5fba120b5311ea1f53", + "docs/research/community-k492-review.md": "3b731d30e80010b15408a289b0b32192700885474c8b36d48ee3320a7a8c5c47", + "research/complex-k492-owner-repair/PROOF-NOTE.md": "337d70fe7abd9afca1d90954c23bde87f4dc27888cc1a6b4bb80506fd6fbf8c5" + }, + "upstream_refresh": { + "commit": "7ee02b7c96d85f22b38d28bd7ed49bb8c1aeb261", + "selected_kappa": "1661202643272239/1000000000000000000", + "selected_source_head": "e516b1463606840a15f80aac1995d64ce0092e89", + "review": "docs/research/community-frontier741-review.md", + "review_sha256": "4634694fa75ea9e749ecf19d3db3e4d82effe3b61a2efdf08ac5a97275fb676a", + "runtime_source_files_unchanged_from_base": true + }, + "inspected_pending_work": [ + { + "pr": 717, + "author": "DreamingOfClouds", + "head": "4150829a2cb66b823f4282da98985959ee448a90", + "path": "research/format-limits-2/README.md", + "sha256": "fa79fa568ef766668442d3ef50d2f2b3cd2a9832a37da068770436e3b81c7211", + "section": "S2, the nonprojection rational-label question", + "use": "Motivation and scope reference; no code or theorem imported" + }, + { + "pr": 791, + "author": "Curtis-D", + "head": "f80382efd4cd3e37c67b2a966398b55bb56af53c", + "use": "PR metadata reviewed for overlap: idempotent endpoint path penalties" + }, + { + "pr": 705, + "author": "littleBro", + "head": "eeb0cd605415a73b792915aaa9185000f293c84a", + "use": "PR metadata reviewed for overlap: Clifford path-homogeneity obstruction" + }, + { + "pr": 800, + "author": "jeremydiviney", + "head": "d7d83e0a9b98f95a4443d1060336be267ac3fd80", + "use": "PR metadata reviewed for overlap: weighted Clifford path valuations" + }, + { + "pr": 720, + "author": "davidgovea", + "head": "a942c0ae1b463710ca535c1fba1b07b6431b5a86", + "use": "PR metadata reviewed for overlap: removing a flag restriction on three endpoint target matrices, not imposing a common flag on all circuit frames" + } + ], + "runtime_dependencies": "Python standard library; no repository module imports and no network access", + "attribution": "For navinor, substantial OpenAI GPT-6 Astra assistance, scoped AI proof review and separate implementation review", + "license": "Apache-2.0" +} diff --git a/research/common-flag-frame-obstruction/VALIDATION.md b/research/common-flag-frame-obstruction/VALIDATION.md new file mode 100644 index 0000000000..0671f38c96 --- /dev/null +++ b/research/common-flag-frame-obstruction/VALIDATION.md @@ -0,0 +1,110 @@ +# Verification and handoff + +Result: a written common-flag obstruction, **s >= Wm**, for the specified +all-role rational-frame XOR interface. No new kappa. The universal argument +is in `README.md`; the executable checks a finite evidence corpus. + +## Executed checks + +Executed on Windows on 2026-10-13, with CPython 3.14.7 and 3.12.14 managed +by uv. No external Python dependencies or network requests are needed by +the verifier. On this host the reproduction prefix was +`uv run --no-project --python 3.14 python` in place of `python3`. + +```sh +python3 -I -B research/common-flag-frame-obstruction/verify.py +python3 -I -B research/common-flag-frame-obstruction/validate.py +python3 -B -m unittest discover -s tests -p test_finite_bit_contract.py -v +python3 -B scripts/verify_selected_result.py +``` + +- Final local checker: **14 cases, 13 tests, 729 matrix differences**, PASS. +- Optimized (`-O`) checker on CPython 3.12.14: same full receipt, PASS. +- Relocated optimized replay: PASS, with all copied inputs byte-unchanged. +- Changed pinned source: rejected with `source pin mismatch`. +- Changed sharp-case rank in the receipt: rejected with `certificate mismatch`. +- Existing emission destination: rejected with `FileExistsError`; original + contents preserved. This also caught a repeated emission command during + the session without changing `EXPECTED.json`. +- New emission destination: regenerated bytes equal `EXPECTED.json`. +- Existing finite-bit contract suite: 9 tests, PASS. +- Selected-record check at the exact starting base: PASS for + `51110230636731/31250000000000000`, original source inventory and proof + supplement. This is not a cold replay of either supplier. + +The existing scorer independently checked every generated circuit's +per-edge rational ranks and all-role endpoint contract. This was run from +the repository root: + +```sh +python3 -B - <<'PY' +import importlib.util +from pathlib import Path +import sys + +root = Path.cwd() +sys.path.insert(0, str(root / 'scripts')) +from finite_bit_contract import inspect_candidate + +spec = importlib.util.spec_from_file_location( + 'flag', root / 'research/common-flag-frame-obstruction/verify.py') +v = importlib.util.module_from_spec(spec) +spec.loader.exec_module(v) +cases = [(case['candidate'], v.check_flag(**case)) for case in v.cases().values()] +cases.append((v.rotation_candidate(), v.rotation_case())) +for candidate, result in cases: + original = inspect_candidate(candidate, require_deficit=False) + if (original['s'] != result['rank_mass'] or + original['edge_ranks'] != result['edge_ranks']): + raise RuntimeError('independent scorer disagreement') +print('PASS independent repository scorer:', len(cases), 'cases') +PY +``` + +Review added direct character-replay rejection, +nonsplit eigenvector-equation validation, a multi-port gate case, and the +retained subprocess controls. There is no Linux or formal-proof execution +claim. Full `make verify` and selected-supplier cold replays were not run +for this additive research package. + +## Review resolution + +One scoped AI worker reviewed the algebraic proof. Its accepted findings +were that the characteristic-two payload and characteristic-zero exponent +group must stay distinct, the bound uses a rank perturbation argument +without routing, and the older commuting-projection label-count inequality +is a related result in a different model rather than a theorem derived here. +Speculative extra corollaries were omitted from the submission. + +A separate read-only AI implementation review passed with coverage requests. +The direct Laurent rejection, Q(i) structure check, five-port case and CLI +tampering controls address those requests. Moving historical frontier hashes +out of runtime inputs prevents an unrelated frontier update from breaking +this checker. The generated random fixtures are frozen by their receipt; +their reproduction has been checked on the two interpreter versions above. +No general stability claim for future Python RNG implementations is needed. + +## Source and upstream refresh + +Exact branch base: `66849e1475c930fd7732b1a0067ffee7e1e95f60`. +The initial selected value was #626 with #543. A fresh fetch during +verification reached `7ee02b7c96d85f22b38d28bd7ed49bb8c1aeb261`, selecting +#741 with #589/#555 at `1661202643272239/1000000000000000000`. +The newer selected record, assembly, actual SW4 construction and maintainer +review were inspected. The four mathematical-source hashes used at runtime +are identical at both commits. Their exact pins and the contextual source +heads are in `SOURCES.json`. + +The pre-submission overlap scan covered 637 open PRs through #824. It found +no matching common-flag obstruction. The nearby #720 flag claim concerns +three endpoint target matrices, not every circuit frame. #717, #791, +#705/#800 and the historical routing/core results are credited with their +distinct scopes in `README.md`. A second pinned-issue query was still empty; +the local claim is in `CLAIM.md`. + +Orientation and scope selection ended at 06:09 UTC, within the first 20% +of the planned 45-minute budget. Verification and handoff began early, at +06:20 UTC. All edits are under `research/common-flag-frame-obstruction/`. +The remaining review obligation is human review of the written theorem and +its exact interface scope, not a stronger exponent or a proposed frontier +replacement. diff --git a/research/common-flag-frame-obstruction/test_verify.py b/research/common-flag-frame-obstruction/test_verify.py new file mode 100644 index 0000000000..49d993ae69 --- /dev/null +++ b/research/common-flag-frame-obstruction/test_verify.py @@ -0,0 +1,113 @@ +"""Exact controls for the claimed hypothesis, endpoint and Laurent replay.""" +from copy import deepcopy +import importlib.util +from pathlib import Path +import unittest + + +class CommonFlagTests(unittest.TestCase): + def setUp(self): + path = Path(__file__).with_name("verify.py") + if not path.is_file(): + self.fail("The common-flag verifier is not implemented") + spec = importlib.util.spec_from_file_location("flag_verify", path) + self.v = importlib.util.module_from_spec(spec) + spec.loader.exec_module(self.v) + + def test_untouched_arbitrary_roles_attain_the_bound(self): + # Omitting a source/sink edge would undercount these six rank units. + c = dict(W=3, m=2, rho=[0, 1, 2], gates=[], + source_frames=[[[0, 0], [0, 0]]] * 3, + sink_frames=[[[1, 0], [0, 1]]] * 3) + result = self.v.check_flag(c, [[1, 0], [0, 1]], [[0, 0], [0, 0]]) + self.assertEqual(result["edge_ranks"], [2, 2, 2]) + self.assertEqual(result["character_counts"], [3, 3]) + self.assertEqual(result["rank_mass"], 6) + + def test_common_gauge_and_conjugation_preserve_edge_costs(self): + cases = self.v.cases() + plain = self.v.check_flag(**cases["noncommuting_jordan"]) + dense = self.v.check_flag(**cases["conjugated_affine"]) + self.assertEqual(plain, dense) + self.assertGreater(plain["nilpotent_rank_excess"], 0) + + def test_bad_flag_is_rejected_even_when_endpoint_contract_passes(self): + case = deepcopy(self.v.cases()["noncommuting_jordan"]) + # The frames stay valid rational matrices, but no longer preserve + # the *supplied* flag. This does not claim absence of another flag. + case["candidate"]["gates"][0]["frame"][2][0] = 1 + with self.assertRaisesRegex(ValueError, "flag"): + self.v.check_flag(**case) + + def test_singular_basis_is_not_a_flag_certificate(self): + case = deepcopy(self.v.cases()["noncommuting_jordan"]) + case["basis"][1] = case["basis"][0][:] + with self.assertRaisesRegex(ValueError, "singular"): + self.v.check_flag(**case) + + def test_changed_endpoint_and_wrong_rho_are_rejected(self): + case = deepcopy(self.v.cases()["noncommuting_jordan"]) + case["candidate"]["sink_frames"][0][0][0] += 1 + with self.assertRaisesRegex(ValueError, "endpoint"): + self.v.check_flag(**case) + case = deepcopy(self.v.cases()["noncommuting_jordan"]) + case["candidate"]["rho"] = list(range(case["candidate"]["W"])) + with self.assertRaisesRegex(ValueError, "permutation"): + self.v.check_flag(**case) + + def test_missing_xor_and_unlisted_source_are_rejected(self): + case = deepcopy(self.v.cases()["noncommuting_jordan"]) + case["candidate"]["gates"].pop() + with self.assertRaisesRegex(ValueError, "permutation"): + self.v.check_flag(**case) + case = deepcopy(self.v.cases()["noncommuting_jordan"]) + case["candidate"]["gates"][0]["roles"] = [0] + with self.assertRaisesRegex(ValueError, "ports"): + self.v.check_flag(**case) + + def test_fractional_exponents_do_not_reduce_modulo_two(self): + # z^(1/2)*z^(1/2)=z, whereas reducing rational coefficients + # into F2 is undefined. The exponent group stays characteristic zero. + from fractions import Fraction as Q + one = [frozenset({(Q(0),)})] + shifted = self.v.shift(self.v.shift(one, (Q(1, 2),)), (Q(1, 2),)) + self.assertEqual(shifted, [frozenset({(Q(1),)})]) + self.assertEqual(self.v.shift(shifted, (Q(-1),)), one) + + def test_different_gate_incidence_frames_are_not_silently_ignored(self): + case = deepcopy(self.v.cases()["noncommuting_jordan"]) + case["candidate"]["gates"][0]["incidence_frames"] = ["different", "frames"] + with self.assertRaisesRegex(ValueError, "common frame"): + self.v.check_flag(**case) + + def test_rank_is_over_rationals_not_the_payload_field(self): + self.assertEqual(self.v.rank([[1, 1], [1, -1]]), 2) + + def test_laurent_endpoint_check_rejects_wrong_characters(self): + candidate = self.v.cases()["noncommuting_jordan"]["candidate"] + frames, edges = self.v.contract(candidate) + for characters in ([(0,) for a in frames], [(2 * a[0][0],) for a in frames]): + with self.assertRaisesRegex(ValueError, "Laurent endpoint"): + self.v.replay(candidate, characters, edges) + + def test_nonsplit_commuting_frames_use_both_characters(self): + result = self.v.rotation_case() + self.assertEqual(result["character_counts"][0], result["character_counts"][1]) + self.assertEqual(result["rank_mass"], sum(result["character_counts"])) + self.assertGreaterEqual(result["rank_mass"], result["baseline"]) + + def test_nonsplit_eigenvector_equations_are_checked(self): + candidate = self.v.rotation_candidate() + candidate["gates"][0]["frame"][0][1] += 1 + with self.assertRaisesRegex(ValueError, "eigenvector"): + self.v.check_rotation(candidate) + + def test_dense_rank_one_diagonal_is_not_a_rank_lower_bound(self): + # Prevent extending the triangular diagonal bound to arbitrary frames. + dense = [[1, 1], [1, 1]] + self.assertEqual(self.v.rank(dense), 1) + self.assertEqual(sum(dense[i][i] != 0 for i in range(2)), 2) + + +if __name__ == "__main__": + unittest.main() diff --git a/research/common-flag-frame-obstruction/validate.py b/research/common-flag-frame-obstruction/validate.py new file mode 100644 index 0000000000..3f46e21455 --- /dev/null +++ b/research/common-flag-frame-obstruction/validate.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +"""Relocated CLI replay, tamper rejection and output-preservation controls.""" +import hashlib +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] +PACKAGE = HERE.relative_to(ROOT) + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def main(): + sources = json.loads((HERE / "SOURCES.json").read_text(encoding="utf-8")) + files = [Path(name) for name in sources["base_files_sha256"]] + files += [path.relative_to(ROOT) for path in HERE.iterdir() if path.is_file()] + with tempfile.TemporaryDirectory(prefix="common-flag-check-") as directory: + relocated = Path(directory) + for name in files: + target = relocated / name + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(ROOT / name, target) + command = [sys.executable, "-I", "-O", "-B", str(relocated / PACKAGE / "verify.py")] + + def run(success, message, *extra): + result = subprocess.run(command + list(extra), cwd=relocated.parent, + text=True, capture_output=True, check=False) + output = result.stdout + result.stderr + require((result.returncode == 0) == success and message in output, output) + + def hashes(): + return {str(name): hashlib.sha256((relocated / name).read_bytes()).hexdigest() + for name in files} + + before = hashes() + run(True, "PASS_COMMON_FLAG_OBSTRUCTION") + require(before == hashes(), "read-only replay modified an input") + source = relocated / "scripts/finite_bit_contract.py" + original = source.read_bytes() + source.write_bytes(original + b"\n") + run(False, "source pin mismatch") + source.write_bytes(original) + + certificate = relocated / PACKAGE / "EXPECTED.json" + original = certificate.read_bytes() + changed = json.loads(original) + changed["cases"]["sharp_untouched"]["rank_mass"] = 5 + certificate.write_text(json.dumps(changed), encoding="utf-8") + run(False, "certificate mismatch") + certificate.write_bytes(original) + + sentinel = relocated / "existing.json" + sentinel.write_bytes(b"KEEP") + run(False, "FileExistsError", "--emit", str(sentinel)) + require(sentinel.read_bytes() == b"KEEP", "existing output overwritten") + fresh = relocated / "regenerated.json" + run(True, "PASS_COMMON_FLAG_OBSTRUCTION", "--emit", str(fresh)) + require(fresh.read_bytes() == certificate.read_bytes(), "regenerated receipt differs") + print("PASS_COMMON_FLAG_CLI_CONTROLS relocated optimized read-only source-tamper certificate-tamper no-overwrite regeneration") + + +if __name__ == "__main__": + main() diff --git a/research/common-flag-frame-obstruction/verify.py b/research/common-flag-frame-obstruction/verify.py new file mode 100644 index 0000000000..4e32e8b1e9 --- /dev/null +++ b/research/common-flag-frame-obstruction/verify.py @@ -0,0 +1,309 @@ +#!/usr/bin/env python3 +"""Finite evidence for the common-flag obstruction; standard library only. + +The universal theorem is in README.md. This executable checks examples, +not every circuit. Exponents stay in characteristic zero; coefficients are F2. +""" +import argparse +from copy import deepcopy +from fractions import Fraction as Q +import hashlib +import importlib.util +from itertools import product as tuples +import json +from pathlib import Path +import random +import unittest + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parents[1] + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def matrix(rows, n): + require(len(rows) == n and all(len(row) == n for row in rows), "matrix dimensions") + require(all(type(x) in (int, str, Q) for row in rows for x in row), "exact entries required") + return [[Q(x) for x in row] for row in rows] + + +def eye(n): + return [[Q(i == j) for j in range(n)] for i in range(n)] + + +def sub(a, b): + return [[x - y for x, y in zip(ar, br)] for ar, br in zip(a, b)] + + +def add(a, b): + return [[x + y for x, y in zip(ar, br)] for ar, br in zip(a, b)] + + +def product(a, b): + return [[sum(x * y for x, y in zip(row, col)) for col in zip(*b)] for row in a] + + +def reduce_rows(rows, columns): + a = [[Q(x) for x in row] for row in rows] + r = 0 + for j in range(columns): + pivot = next((k for k in range(r, len(a)) if a[k][j]), None) + if pivot is None: + continue + a[r], a[pivot] = a[pivot], a[r] + scale = a[r][j] + a[r] = [x / scale for x in a[r]] + for k in range(len(a)): + if k != r: + scale = a[k][j] + a[k] = [x - scale * y for x, y in zip(a[k], a[r])] + r += 1 + return a, r + + +def rank(a): + return reduce_rows(a, len(a[0]))[1] + + +def inverse(a): + n = len(a) + rows, r = reduce_rows([row + unit for row, unit in zip(a, eye(n))], n) + require(r == n, "singular flag basis") + return [row[n:] for row in rows] + + +def contract(candidate): + """Reconstruct every physical edge, independently of the repository scorer.""" + w, m = candidate["W"], candidate["m"] + require(type(w) is int and w >= 2 and type(m) is int and m >= 2, "invalid dimensions") + gates = candidate["gates"] + sources, sinks = candidate["source_frames"], candidate["sink_frames"] + require(len(sources) == len(sinks) == w, "all-role terminals required") + frames = [matrix(a, m) for a in sources + [g["frame"] for g in gates] + sinks] + values, last, edges = [1 << j for j in range(w)], list(range(w)), [] + for index, gate in enumerate(gates): + require(set(gate) == {"roles", "xors", "frame"}, "one common frame required; unsupported gate fields") + roles = gate["roles"] + require(roles and len(set(roles)) == len(roles), "distinct gate ports required") + require(all(type(r) is int and 0 <= r < w for r in roles), "invalid gate ports") + for role in roles: + edges.append((last[role], w + index, role)) + last[role] = w + index + for t, s in gate["xors"]: + require(t in roles and s in roles and t != s, "XOR outside gate ports") + values[t] ^= values[s] + rho = candidate["rho"] + require(len(rho) == w and all(type(r) is int for r in rho) and + set(rho) == set(range(w)), "invalid permutation") + require(all(values[rho[j]] == 1 << j for j in range(w)), "scalar permutation fails") + for role in range(w): + edges.append((last[role], w + len(gates) + role, role)) + require(all(sub(frames[w + len(gates) + rho[j]], frames[j]) == eye(m) + for j in range(w)), "all-role endpoint fails") + return frames, edges + + +def shift(row, exponent): + """Multiply each F2 Laurent polynomial by a monomial (translation).""" + return [frozenset(tuple(x + y for x, y in zip(term, exponent)) for term in poly) + for poly in row] + + +def replay(candidate, characters, edges): + """Exact coefficient replay, retaining all W independent input columns.""" + w = candidate["W"] + zero = (Q(0),) * len(characters[0]) + unit = (Q(1),) + zero[1:] + rows = [[frozenset({zero}) if i == j else frozenset() for j in range(w)] + for i in range(w)] + cursor = 0 + for gate in candidate["gates"]: + for _ in gate["roles"]: + u, v, role = edges[cursor] + delta = tuple(b - a for a, b in zip(characters[u], characters[v])) + rows[role] = shift(rows[role], delta) + cursor += 1 + for t, s in gate["xors"]: + rows[t] = [a ^ b for a, b in zip(rows[t], rows[s])] + for u, v, role in edges[cursor:]: + delta = tuple(b - a for a, b in zip(characters[u], characters[v])) + rows[role] = shift(rows[role], delta) + for source, target in enumerate(candidate["rho"]): + expected = [frozenset({unit}) if j == source else frozenset() for j in range(w)] + require(rows[target] == expected, "Laurent endpoint fails") + active = [characters[u] != characters[v] for u, v, _ in edges] + require(sum(active) >= w, "character edge count below W") + return active + + +def receipt(candidate, frames, edges, character_lists): + masks = [replay(candidate, char, edges) for char in character_lists] + costs = [rank(sub(frames[v], frames[u])) for u, v, _ in edges] + counts = [sum(mask) for mask in masks] + diagonal_counts = [sum(mask[e] for mask in masks) for e in range(len(edges))] + require(all(d <= r for d, r in zip(diagonal_counts, costs)), "diagonal rank inequality fails") + baseline = candidate["W"] * candidate["m"] + require(sum(costs) >= baseline, "common-flag rank bound fails") + return dict(baseline=baseline, rank_mass=sum(costs), edge_ranks=costs, + character_counts=counts, + edge_character_masks=[sum(int(mask[e]) << j for j, mask in enumerate(masks)) + for e in range(len(edges))], + nilpotent_rank_excess=sum(costs) - sum(counts)) + + +def check_flag(candidate, basis, gauge): + frames, edges = contract(candidate) + m = candidate["m"] + basis, gauge = matrix(basis, m), matrix(gauge, m) + inv = inverse(basis) + triangular = [product(product(inv, sub(a, gauge)), basis) for a in frames] + require(all(a[i][j] == 0 for a in triangular for i in range(m) for j in range(i)), + "supplied common flag is not preserved") + characters = [[(a[i][i],) for a in triangular] for i in range(m)] + return receipt(candidate, frames, edges, characters) + + +def word(w, rng): + forward = [(1, 0), (2, 0)] + [tuple(rng.sample(range(w), 2)) for _ in range(4)] + return forward + forward[::-1] + [(0, 1), (1, 0), (0, 1)] + + +def make_case(w, m, seed): + rng = random.Random(seed) + alphabet = [Q(-2, 3), Q(-1, 2), Q(0), Q(1, 2), Q(1), Q(2)] + + def triangular(): + return [[rng.choice(alphabet) if i <= j else Q(0) for j in range(m)] for i in range(m)] + + sources = [triangular() for _ in range(w)] + rho = [1, 0] + list(range(2, w)) + sinks = [None] * w + for j in range(w): + sinks[rho[j]] = add(sources[j], eye(m)) + gates = [dict(roles=[t, s], xors=[[t, s]], frame=triangular()) for t, s in word(w, rng)] + if m >= 3: + # Fixed noncommuting nilpotents; the two gates share physical role 0. + for index, (i, j) in enumerate([(0, 1), (1, 2)]): + gates[index]["frame"] = [[Q(0)] * m for _ in range(m)] + gates[index]["frame"][i][j] = Q(1) + candidate = dict(W=w, m=m, rho=rho, gates=gates, source_frames=sources, sink_frames=sinks) + return dict(candidate=candidate, basis=eye(m), gauge=[[Q(0)] * m for _ in range(m)]) + + +def cases(): + result = {f"seed42_m{m}_W{w}": make_case(w, m, 42 + 10 * m + w) + for m in (2, 3, 4) for w in (4, 5, 6)} + plain = make_case(5, 3, 42) + result["noncommuting_jordan"] = plain + dense = deepcopy(plain) + basis = matrix([[1, 1, 0], [0, 1, 1], [1, 0, 1]], 3) + gauge = matrix([[0, 0, 1], [1, 0, 0], [0, 1, 0]], 3) + inv = inverse(basis) + + def conjugate(a): + return add(gauge, product(product(basis, a), inv)) + + c = dense["candidate"] + for key in ("source_frames", "sink_frames"): + c[key] = [conjugate(a) for a in c[key]] + for gate in c["gates"]: + gate["frame"] = conjugate(gate["frame"]) + dense.update(basis=basis, gauge=gauge) + result["conjugated_affine"] = dense + grouped = deepcopy(plain) + grouped["candidate"]["gates"] = [dict( + roles=list(range(5)), + xors=[update for gate in plain["candidate"]["gates"] for update in gate["xors"]], + frame=[[Q(0)] * 3 for _ in range(3)])] + result["grouped_five_port_gate"] = grouped + result["sharp_untouched"] = dict( + candidate=dict(W=3, m=2, rho=[0, 1, 2], gates=[], + source_frames=[[[0, 0], [0, 0]]] * 3, sink_frames=[eye(2)] * 3), + basis=eye(2), gauge=[[0, 0], [0, 0]]) + return result + + +def rotation_candidate(): + case = make_case(5, 2, 42) + c = case["candidate"] + # An additive conversion preserving I, applied also to endpoint matrices. + def rotate(a): + return [[a[0][0], -a[0][1]], [a[0][1], a[0][0]]] + for key in ("source_frames", "sink_frames"): + c[key] = [rotate(a) for a in c[key]] + for gate in c["gates"]: + gate["frame"] = rotate(gate["frame"]) + return c + + +def check_rotation(candidate): + """Check aI+bJ structure before using its exact Q(i) characters.""" + require(candidate["m"] == 2, "rotation dimension") + frames, edges = contract(candidate) + require(all(a[0][0] == a[1][1] and a[0][1] == -a[1][0] for a in frames), + "rotation eigenvector equations fail") + require(all(product(a, b) == product(b, a) for a in frames for b in frames), + "rotation frames do not commute") + require(any(a[1][0] != 0 for a in frames), "nonsplit example is trivial") + chars = [[(a[0][0], sign * a[1][0]) for a in frames] for sign in (1, -1)] + return receipt(candidate, frames, edges, chars) + + +def rotation_case(): + return check_rotation(rotation_candidate()) + + +def verify_sources(): + pins = json.loads((HERE / "SOURCES.json").read_text(encoding="utf-8")) + for name, digest in pins["base_files_sha256"].items(): + require(hashlib.sha256((ROOT / name).read_bytes()).hexdigest() == digest, + f"source pin mismatch: {name}") + + +def run(): + results = {name: check_flag(**case) for name, case in cases().items()} + results["nonsplit_commuting"] = rotation_case() + # A rank-one dense matrix invalidates the diagonal shortcut without a flag. + require(rank([[1, 1], [1, 1]]) == 1, "nontriangular boundary control") + triangular = [[[a, b], [0, d]] for a, b, d in tuples((-1, 0, 1), repeat=3)] + histogram = {} + for a in triangular: + for b in triangular: + delta = sub(a, b) + determinant = delta[0][0] * delta[1][1] + independent_rank = 2 if determinant else int(any(x for row in delta for x in row)) + diagonal = sum(delta[i][i] != 0 for i in range(2)) + require(rank(delta) == independent_rank >= diagonal, "triangular minor census") + key = f"rank{independent_rank}_diagonal{diagonal}" + histogram[key] = histogram.get(key, 0) + 1 + return dict(status="PASS_COMMON_FLAG_OBSTRUCTION", seed=42, cases=results, + triangular_difference_census=dict(pairs=729, histogram=histogram), + scope="Finite consistency checks; universal theorem is written separately", + kappa="unchanged") + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--emit", type=Path, help="write a freshly derived receipt to a NEW file") + args = parser.parse_args() + verify_sources() + result = run() + spec = importlib.util.spec_from_file_location("flag_tests", HERE / "test_verify.py") + tests = importlib.util.module_from_spec(spec) + spec.loader.exec_module(tests) + outcome = unittest.TextTestRunner(verbosity=1).run(unittest.defaultTestLoader.loadTestsFromModule(tests)) + require(outcome.wasSuccessful(), "negative controls failed") + if args.emit: + with args.emit.open("x", encoding="utf-8", newline="\n") as stream: + stream.write(json.dumps(result, indent=2, sort_keys=True) + "\n") + else: + expected = json.loads((HERE / "EXPECTED.json").read_text(encoding="utf-8")) + require(result == expected, "certificate mismatch") + print(f"PASS_COMMON_FLAG_OBSTRUCTION cases={len(result['cases'])} tests={outcome.testsRun} bound=s>=W*m kappa=unchanged") + + +if __name__ == "__main__": + main()