diff --git a/research/stage2-e22-leaf-gaps/PROOF.md b/research/stage2-e22-leaf-gaps/PROOF.md new file mode 100644 index 0000000000..36a477f60f --- /dev/null +++ b/research/stage2-e22-leaf-gaps/PROOF.md @@ -0,0 +1,253 @@ +# Constant insertions after stage-2 E_22 and the stage-2 leaf + +No new kappa. In the nine-gate diagonal word of PR #7027, place constant +matrices `R` and `S` in the gap after stage-2 `E_22` and the gap after the +stage-2 leaf gate. Over `F_2`, the coefficient of `e` equals the pure +product `P` for exactly `2^40` pairs. The matched positions are the +off-diagonal pairs inside `{6, 7}` and inside `{0, 1, 2, 3, 4, 5}`. Every +such coefficient has diagonal entries in `{0, P_ii}`, and each `P_ii` +differs from `1`, so the coefficient is never `I`. The selected frontier +stays `363005817/100000000000`. + +This is an identity in `F_2[x, y, z][e]/(e^2)`. It is not a listing of the +`2^40` pairs. The count does not agree with PR #7287, and the level sets +do not: `(1, 4)` is blocked there and free here, while `(1, 6)` is free +there and blocked here. It is not a kappa improvement. + +## 1. Hypotheses + +The ring is `F_2[x, y, z][e]/(e^2)` with `e` central. The space has eight +coordinates + +```text +(0, 1, 2, 3, 4, 5, 6, 7) + = (core_0, core_1, leaf0_0, leaf0_1, leaf1_0, leaf1_1, leaf2_0, leaf2_1). +``` + +The historical labels `E_11` and `E_22` are the stage gates on coordinates +`0` and `1`. A witness written `E_{i,j}` below uses these same coordinates: +a one in row `i`, column `j`. + +Stage `s` uses the indeterminate `x_s`, written `x, y, z` for stages +`0, 1, 2`. Its three diagonal gates, in order, are + +```text +I + x_s E_11, I + x_s E_22, I + x_s (leaf of stage s), +``` + +supported on coordinate `0`, coordinate `1`, and the two coordinates of +leaf `s`. The word is stage 0, then stage 1, then stage 2. All nine gates +are diagonal, so they commute. Their product `P` is diagonal, with entries + +```text +P_00 = P_11 = (1 + x)(1 + y)(1 + z), +P_22 = P_33 = 1 + x, +P_44 = P_55 = 1 + y, +P_66 = P_77 = 1 + z. +``` + +Each entry is nonzero and is not `1`. The two insertions are constant +matrices over `F_2`: entries in `{0, 1}`, with no positive degree. They +occupy only the two named gaps. The equation under test is that the +coefficient of `e` equals `P`. + +## 2. The two slots + +Number the gates `G0, ..., G8` in the order above. Stage-2 `E_22` is `G7`. +The stage-2 leaf gate is `G8`, supported on coordinates `6` and `7`. The +word under test is + +```text +G0 G1 G2 G3 G4 G5 G6 G7 (I + e R) G8 (I + e S). +``` + +There is no gate after `G8`. The factor to the right of `S` is the empty +product, which is `I`. PR #7287 inserts after `G4` and `G6` instead. These +are different slots: the only gate strictly between the insertions here is +`G8`, the stage-2 leaf. + +Because `e^2 = 0` and `e` is central, the coefficient of `e^0` is `P` for +every `R` and `S`. Write + +```text +L = G0 G1 G2 G3 G4 G5 G6 G7, M = G8, T = I. +``` + +The coefficient of `e` is + +```text +C = L R (M T) + (L M) S T = L R M + (L M) S. +``` + +There is no `R S` term. On coordinates, the diagonals are + +```text +L = diag((1+x)(1+y)(1+z), (1+x)(1+y)(1+z), 1+x, 1+x, 1+y, 1+y, 1, 1), +M = diag(1, 1, 1, 1, 1, 1, 1+z, 1+z), +T = diag(1, 1, 1, 1, 1, 1, 1, 1). +``` + +Every entry of `L`, `M` and `T` is `1` or a product of terms `1` plus one +indeterminate, hence nonzero in the integral domain `F_2[x, y, z]`. The +entries `L_66 = L_77 = 1` are the empty products on coordinates `6` and +`7`: no earlier gate meets the stage-2 leaf. The product `L M T` is the +closed form of `P`. + +## 3. The entry formula + +Diagonal matrices act by scaling rows and columns. For `i, j` in `0..7`, + +```text +C_ij = L_i (M_j T_j) R_ij + (L_i M_i) T_j S_ij + = c_ij (M_j R_ij + M_i S_ij), +``` + +where `c_ij = L_i T_j = L_i` is nonzero. Therefore `C_ij` depends only on +the pair `(R_ij, S_ij)`. Matrix multiplication is bilinear, so a constant +matrix, being the sum of its occupied units, has the entry stated by this +formula at every position. + +`P` is diagonal, so `C = P` if and only if `C_ii = P_ii` and `C_ij = 0` +for `i ≠ j`. On the diagonal, `M_i` appears twice and +`c_ii M_i = P_ii`, so + +```text +C_ii = (R_ii + S_ii) P_ii. +``` + +Cancel the nonzero factor `P_ii`. The diagonal condition is + +```text +R_ii + S_ii = 1 for every coordinate i. +``` + +Off the diagonal, cancel the nonzero factor `c_ij`. The condition is + +```text +M_j R_ij + M_i S_ij = 0. +``` + +## 4. Which constant pairs work + +The middle diagonal takes two values, + +```text +M_6 = M_7 = 1+z, +M_0 = M_1 = M_2 = M_3 = M_4 = M_5 = 1. +``` + +Their sum is nonzero: + +```text +1 + (1+z) = z. +``` + +For bits `r, s` in `{0, 1}` the linear combination `M_j r + M_i s` is +`0`, `M_j`, `M_i`, or `M_i + M_j`. + +- If `M_i = M_j`, the combination is `M_i (r + s)`. It vanishes if and + only if `r = s`. Both bits may be `0`, or both may be `1`. +- If `M_i ≠ M_j`, each of `M_i`, `M_j` and `M_i + M_j` is nonzero, so the + only solution is `r = s = 0`. + +The level sets of `M` are `{6, 7}` and `{0, 1, 2, 3, 4, 5}`. The +off-diagonal positions inside a level set are + +```text +{6, 7}: (6, 7), (7, 6) 2 positions, +{0, 1, 2, 3, 4, 5}: 6 · 5 ordered pairs 30 positions. +``` + +That is `32` positions. The other `56 - 32 = 24` off-diagonal positions +are forced to `0` in both matrices. The free data are the eight diagonal +bits of `R`, with `S_ii = 1 + R_ii`, and one bit on each of the `32` +matched positions, copied into both matrices. The count is + +```text +2^(8 + 32) = 2^40. +``` + +The same count is the product of the per-position solution counts: +`2` choices on each of `40` positions and `1` choice on each of the other +`24`. The product equals the number of matrix pairs because each entry +pair `(R_ij, S_ij)` appears in only one equation. + +The solution set contains `(I, 0)` and `(0, I)`. It also contains pairs +with both matrices nonzero. Two examples, with `E_{i,j}` the coordinate +unit named above, are + +```text +R = I + E_{6,7}, S = E_{6,7}, +R = I + E_{0,1}, S = E_{0,1}. +``` + +Coordinates `6` and `7` lie in the level set of `1+z`. Coordinates `0` +and `1` lie in the level set of `1`. The pair +`R = I + E_{6,7} + E_{7,6}`, `S = E_{6,7} + E_{7,6}` is a third solution: +the two off-diagonal equations do not interact. + +PR #7287 has count `2^30` and middle diagonal +`diag(1+z, 1, 1, 1, 1+y, 1+y, 1, 1)`. Its level sets are `{0}`, `{4, 5}` +and `{1, 2, 3, 6, 7}`. Position `(1, 6)` is inside that last level set and +outside every level set here, so a constant `1` at `(1, 6)` solves the +earlier equation and misses this one. Position `(1, 4)` is the opposite +case: both coordinates have middle value `1` here, while PR #7287 gives +them the distinct values `1` and `1+y`. The two solution sets are not +equal. + +## 5. The coefficient is never the identity + +For any constant pair, and at every coordinate, + +```text +C_ii = (R_ii + S_ii) P_ii +``` + +is either `0` or `P_ii`. Section 1 records that every `P_ii` differs from +`1`. Every diagonal entry of `C` therefore differs from `1`, so `C` is +never `I`. This is the diagonal obstruction PR #7039 recorded for any +finite number of constant insertions. These two gaps do not remove it. + +## 6. What the checker establishes + +`verify.py` rebuilds the nine diagonals and checks the literal supports of +`G7` and `G8`. It checks that their matrix product is the closed form of +`P`, that `L`, `M` and `T` are the diagonals displayed in section 2, and +that `L M T = P`. It checks that the empty product after `S` is `I`. For +all `64` positions it checks + +```text +a_ij = c_ij M_j, b_ij = c_ij M_i, c_ij ≠ 0, +``` + +and that `a_ij = b_ij` if and only if `M_i = M_j`. It multiplies all `64` +matrix units in each gap, including the empty suffix, and checks that the +resulting coefficient is that single scale. It then solves all four +constant bit pairs at all `64` positions and checks that the solution sets +are exactly the ones in section 4. The witnesses of section 4 are +multiplied directly, and the blocked position `(1, 6)`, an unequal matched +bit, and a mixed matched-plus-blocked pair are rejected. + +The position `(1, 4)` is blocked in the PR #7287 pair and free here. The +position `(1, 6)` is free there and blocked here. The solution count +`32 + 8` is not that package's `22 + 8`. + +## 7. Limits + +The hypotheses are the two named slots, constant `F_2` entries, the nine +diagonal gates in this order, and the empty product after the leaf. A +polynomial entry such as `R_{0,6} = 1+z` and `S_{0,6} = 1` satisfies the +single blocked equation at `(0, 6)` and is outside this count. The gap +after stage-2 `E_11` and the gap after stage-2 `E_22` has its own middle +diagonal, the single gate `G7`. PR #7287 classifies the pair after +stage-1 `E_22` and stage-2 `E_11`. PR #7215 classifies the pair after +stage-0 `E_22` and stage-1 `E_11`. PR #7191 classifies polynomial entries +in the two stage-0 gaps of PR #7103. Neither classifies this pair. The +non-idempotent factor `N` of PR #7027 is a different stage-0 gate. This +identity is at `g = 3`, `d = 2`. It does not supply a word for `g = 13` or +`g = 31`, and it does not change the selected frontier. + +Evidence class: a proof of the entry formula and of the constant solution +set, with the scalar equations solved exhaustively on a domain of four bit +pairs. It is not a heuristic search, and it is not an enumeration of the +`2^40` matrices. diff --git a/research/stage2-e22-leaf-gaps/README.md b/research/stage2-e22-leaf-gaps/README.md new file mode 100644 index 0000000000..37a5f988f4 --- /dev/null +++ b/research/stage2-e22-leaf-gaps/README.md @@ -0,0 +1,110 @@ +# Constant insertions after stage-2 E_22 and the stage-2 leaf + +**No new kappa.** In the nine diagonal gates of PR #7027, constant matrices +`R` and `S` may sit in the gap after stage-2 `E_22` and the gap after the +stage-2 leaf gate. Over `F_2`, with `e` central and `e^2 = 0`, the +coefficient of `e` equals the pure product for exactly `2^40` pairs. The +factor after the second insertion is the empty product `I`, because the +word ends at that leaf. Every diagonal entry of that coefficient is `0` or +the corresponding entry of `P`, and each of those entries differs from `1`, +so the coefficient is never `I`. The selected frontier stays +`363005817/100000000000`. + +The argument and the limits are in [PROOF.md](PROOF.md). + +## Scope and evidence + +Original card: `joint-query-controller`. The card asks whether a changed +query demand removes real work. This package answers a different question: +the second open question of PR #7287, at the two gaps named in its first +step. The field stays `F_2[x, y, z][e]/(e^2)`. It is not a caller, a native +bill, or a change of kappa. Source commits, Git blobs and SHA256 pins are +in [SOURCES.json](SOURCES.json). The selected record and catalogue are +historical provenance. + +`current-priorities.md` at this base still prints the older decimal +`0.00310045`. The live selected record in `certificates/selected-result.json` +is `363005817/100000000000` from the PR #7000 / #7001 admission. This +package uses that record and edits neither file. + +The classification is an identity. The middle diagonal between the two +slots is `diag(1, 1, 1, 1, 1, 1, 1+z, 1+z)`. Constant solutions are the +pairs whose diagonal sums to `1` and whose off-diagonal bits agree on the +level sets `{6, 7}` and `{0, 1, 2, 3, 4, 5}`, and vanish off those level +sets. The machine check multiplies every one of the 64 matrix units in +each gap, compares the two scales with that middle diagonal at all 64 +positions, and solves all four bit pairs at all 64 positions. The solution +count is the product of those per-position counts. The `2^40` pairs were +not listed. Evidence class: a proof, with an exhaustive four-element +census of each scalar equation. A failed search is not what this record +claims. + +The count `2^30` occurs for the pair after stage-1 `E_22` and stage-2 +`E_11` in PR #7287. The matched sets differ: `(1, 4)` is blocked there and +free here, and `(1, 6)` is free there and blocked here. + +Overlap was checked on 2026-11-11 against open upstream PRs through #7288, +against the latest discussion #1166 comments, by GitHub search of open and +closed PR titles and bodies for this slot phrase, and against local notes +on base `e54523517d0f03e58352e647c403a5af3e525a57`. The only open record +that states these two slots is PR #7287, which leaves them as its second +open question and classifies the earlier pair instead. PR #7215 classifies +the pair after stage-0 `E_22` and stage-1 `E_11`. PR #7103 and PR #7191 +classify the adjacent stage-0 pair and its polynomial entries. PR #7039 is +the one-insertion theorem. No local package on this base solves these two +slots. The discussion snapshot used for overlap is the latest comments, +not a complete pagination of all 3692 comments on #1166. + +## Reproduce + +Python 3.12, standard library only. From the repository root: + +```sh +python3 -B scripts/research_package.py --package research/stage2-e22-leaf-gaps +``` + +The registered replay runs the verifier twice, once with `-O`. Both print +`PASS_STAGE2_E22_LEAF_GAPS`. The checks raise `SystemExit`, so optimized +mode does not drop them. Directly: + +```sh +python3 -B research/stage2-e22-leaf-gaps/verify.py +``` + +## Open next questions + +- Do entries in `F_2[x, y, z]` of degree at most 1, in these same two + gaps, give solutions of `C = P` beyond the `2^40` constant pairs? On a + blocked position the constant equation has only the zero solution, while + `M_6 = 1+z` and `M_0 = 1` make `R_{0,6} = 1+z`, `S_{0,6} = 1` a solution + of that one entry. The first step is to keep a legal constant diagonal + and legal matched bits, substitute that pair, and multiply the + coefficient against `P`. Nothing external blocks that substitution. + PR #7191 answers the polynomial question only for the two stage-0 gaps + of PR #7103. PR #7287 leaves the degree-at-most-1 question for its own + slots, after stage-1 `E_22` and stage-2 `E_11`, and does not take this + terminal pair. +- Which constant `F_2` pairs make `C = P` in the gap after stage-2 `E_11` + and the gap after stage-2 `E_22`? The single gate between those slots is + stage-2 `E_22`, supported only on coordinate `1`. The first step is that + diagonal. This package classifies the leaf gate instead, and PR #7287 + stops before stage-2 `E_22`. Nothing external blocks that calculation. + +## Credit + +The paired-star contract, the operator `T`, and the pure target are from +PR #5747 (Ali Romman), including PR #5673, PR #5631, and PR #5617. The +valuation-1 triple and the nine-gate word are PR #7027, head +`1ba2ac5adfe58fbe9dba34d50d4e5d30633ce3d0`. The one-insertion theorem is +PR #7039, head `e4ddcd2fde8c46b7e528e8806ab72d9bf7690978`. The adjacent +stage-0 classification is PR #7103, head +`f3af1384aeda8c75be58f09cb07da3941ba7aba3`. PR #7191, head +`4268eab9d5bc1293a006d27abf9164d125ff094d`, classifies polynomial entries +in that stage-0 pair. PR #7215, head +`e1656a671fffddcd0b9ad07d500825686ff852ae`, classifies the pair after +stage-0 `E_22` and stage-1 `E_11`. The question answered here is the +second open question of PR #7287, head +`0f1fc97b0fb02dbe8debb8ed1f480421d54027e2`. +Prepared by unpaidmoon with substantial Cursor Grok assistance. +Independent human review and a proof-assistant proof are unclaimed. +Apache-2.0. diff --git a/research/stage2-e22-leaf-gaps/SOURCES.json b/research/stage2-e22-leaf-gaps/SOURCES.json new file mode 100644 index 0000000000..5335fa97d9 --- /dev/null +++ b/research/stage2-e22-leaf-gaps/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "75d77b328ea02ded535e7f23aee5b1e55d0bb1a8", + "sha256": "154c3d30455d778fd3343b6b4851f0fa4665f0f7625b0adb3675e2bafbbf6bf1" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "3404fbdd5e7529a0674eef26114b5071e4586cec", + "sha256": "ead6cdc9d0af6d58e8a49744d8ec8c7c15e13d2ba93c276c434bcf9b51b93a81" + } + ] +} diff --git a/research/stage2-e22-leaf-gaps/TASK.json b/research/stage2-e22-leaf-gaps/TASK.json new file mode 100644 index 0000000000..ca4c54ef12 --- /dev/null +++ b/research/stage2-e22-leaf-gaps/TASK.json @@ -0,0 +1,90 @@ +{ + "schema_version": 1, + "task_id": "joint-query-controller", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "joint-query-controller", + "question": "Can a changed query demand or caller remove real work while satisfying native chronology and restoration?", + "starting_points": [ + "docs/research/current-priorities.md", + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md" + ], + "methods": [ + "Construct and independently check one source-bound instance of the stated first experiment.", + "Seek an exact counterexample or target-specific complete-budget obstruction to that same proposed change." + ], + "acceptance_gate": "A source-bound arbitrary-input identity and legal producer/consumer boundary with the complete paid and productive target invoice, including restoration, ownership, native alignment and extra charges. Price under the actual current model; historical ceiling.py assumptions must be established before use. A favorable optimistic relaxation keeps a route open but is not a completed supplier. A scoped local result remains useful; expansion requires the family-level budget gate.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_selected_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read revision 8, the selected review and live exact-source handoffs. Then follow this card's bounded first_experiment.", + "scope": "Source-bound orientation only, not a supplier replay or theorem proof." + }, + "first_experiment": "Choose an exact caller and a new demand/interface hypothesis. Read the scoped #5617/#5631/#5649/#5747 and #5720/#5745 objections before rebuilding an excluded schedule. Compare the complete matched source/consumer protocols including all retained helper outputs. For an active-mode injection, first check #5745: its canonical delivery claim repays the eight removed centre jobs. Audit that exact claim or change its channel/feedback hypothesis; do not repeat the same free-injection search. Stop if the full favorable budget fails or the required restored output is unobservable.", + "bottleneck_link": "Judge the actual current supplier contract and complete signed target/paid bill; frozen-profile ceilings require an applicability proof.", + "allowed_variations": [ + "One exact source head, helper/cut region or quantified proposition and changed hypothesis; check live handoffs first. Different seeds are not different scopes." + ], + "scope_change_triggers": [ + "Changing source head, helper/cut domain, operation alphabet or caller boundary without recording the new scope.", + "Treating an archived proposal or local numerical pass as complete supplier admission." + ], + "overlap_terms": [ + "query demand", + "active mode", + "5720", + "5745", + "5747", + "caller" + ], + "existing_checks": [ + { + "scope": "PR #4166: author-checked installed producer/service/return/bridge connection; native-component comparison loses.", + "evidence": "research/qq16-caller-install/README.md", + "remaining": "Complete matched physical protocol bill, or changed source-compatible demand/circuit; no affordable supplier yet.", + "status": "author-checked", + "source_commit": "0b082d22a0e9a442d264ab0633e35ef26c790630", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "Selected PR5599: complete helper-subspace construction and independent caller replay; five framework assumptions remain.", + "evidence": "docs/research/pr-intake-evidence/pr5599-completion/PROOF-REVIEW.md", + "remaining": "The next experiment must identify uncovered source-specific work. Successor archive intake does not transfer this admission.", + "status": "reviewed", + "source_commit": "09dd0965711ca7eeb169057a420abab1c9052137", + "selected_record_sha256": "2a0220e866417774606e0f991e41b9c1d26b1f43b97857238cf478dbc7d330b5" + } + ] + }, + "scope_status": "changed", + "actual_scope": "In the nine diagonal gates of the valuation-1 word, which constant F_2 matrices R and S, placed in the gap after stage-2 I+z E_22 and the gap after the stage-2 leaf gate I+z(E_66+E_77), make the coefficient of e equal the pure product?", + "scope_change_reason": "The card asks whether a changed query demand removes real work. The assigned open question is the second open question of PR #7287: constant insertions after stage-2 E_22 and the stage-2 leaf gate in the valuation-1 diagonal word. That system is a paired-star coefficient identity, not a caller or a native bill.", + "bottleneck_link": "Side result. A two-gap constant word that reproduces the pure product describes the e coefficient of the PR #7027 diagonal word at the two terminal slots left open by PR #7287. It supplies neither a caller nor a change to the selected frontier 363005817/100000000000. The same diagonal obstruction still keeps that coefficient away from I.", + "budget_minutes": 60, + "stop_rule": "Stop after the two named gaps, the constant-entry classification, and the diagonal obstruction to I. Do not solve other gap pairs, polynomial entries, the non-idempotent factor N, or g=13.", + "outcome": "completed", + "evidence": "verify.py checks the closed form of P, the middle diagonal diag(1, 1, 1, 1, 1, 1, 1+z, 1+z), the empty suffix I, the 32/24 scale split, all 64 matrix units in each gap, and all four bit pairs at all 64 positions. It prints PASS_STAGE2_E22_LEAF_GAPS, matched_off_diagonal 32, blocked_off_diagonal 24, solution_pairs 2^40, witness_both_nonzero 3, coefficient_equals_I 0. Python 3.12, standard library only. Evidence class: proof.", + "author": "unpaidmoon", + "ai_assistance": "Substantial Cursor Grok assistance. Independent human review and a proof-assistant proof are unclaimed.", + "open_questions": [ + { + "question": "Do entries in F_2[x, y, z] of degree at most 1, in these same two gaps, give solutions of C=P beyond the 2^40 constant pairs?", + "why_it_matters": "A blocked position forbids every nonzero constant pair. At (0, 6) the middle values are 1 and 1+z, so R_06=1+z and S_06=1 solves that one entry. PR #7191 answers the polynomial question only for the two stage-0 gaps of PR #7103, and PR #7287 leaves the degree-at-most-1 question for its own earlier slots.", + "first_step": "Keep a legal constant diagonal and legal matched bits, set R_06=1+z and S_06=1, leave every other blocked position at 0, and multiply the resulting coefficient against P.", + "blocked_by": "Nothing external. The substitution leaves the constant classification unchanged." + }, + { + "question": "Which constant F_2 pairs, if any, make C=P in the gap after stage-2 E_11 and the gap after stage-2 E_22?", + "why_it_matters": "The single gate between those slots is stage-2 E_22, supported only on coordinate 1. This package classifies the leaf that follows E_22, and PR #7287 stops before that gate.", + "first_step": "Form the diagonal of stage-2 E_22 alone, then solve the 64 entry equations.", + "blocked_by": "Nothing external. That gate is already one of the nine diagonals checked here." + } + ] +} diff --git a/research/stage2-e22-leaf-gaps/VERIFY.json b/research/stage2-e22-leaf-gaps/VERIFY.json new file mode 100644 index 0000000000..44d2d91d18 --- /dev/null +++ b/research/stage2-e22-leaf-gaps/VERIFY.json @@ -0,0 +1,28 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Closed form of the nine-gate pure product, middle diagonal diag(1, 1, 1, 1, 1, 1, 1+z, 1+z), empty suffix I, scale identity on all 64 positions, direct product of all 64 units in each of the two gaps, exhaustive four-bit solutions at every position, both-nonzero witnesses, and blocked-bit failure controls." + }, + { + "argv": [ + "{python}", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "The same identity under python -O. Checks raise SystemExit, so optimized mode does not drop them." + } + ] +} diff --git a/research/stage2-e22-leaf-gaps/verify.py b/research/stage2-e22-leaf-gaps/verify.py new file mode 100644 index 0000000000..986b0aaf3c --- /dev/null +++ b/research/stage2-e22-leaf-gaps/verify.py @@ -0,0 +1,405 @@ +#!/usr/bin/env python3 +"""Constant pairs after stage-2 E_22 and the stage-2 leaf gate. + +In the nine diagonal gates of the #7027 word, place constant F_2 matrices +R and S in the gap after stage-2 E_22 and the gap after the stage-2 leaf +gate. The scalar e is central and e^2 = 0. The nine-gate word ends at that +leaf, so the factor after S is the empty product I. This checker proves +which pairs make the coefficient of e equal the pure product P, counts +that set, and shows the coefficient is never I. Failures raise SystemExit, +so python -O still fails closed. + +The 2^40 pairs are not listed. Each of the 64 positions has a two-bit +equation, solved exhaustively, and the equations separate. The count and +the matched positions differ from PR #7287. +""" + +from __future__ import annotations + +ZERO = frozenset() +ONE = frozenset([(0, 0, 0)]) +X = frozenset([(0, 0, 0), (1, 0, 0)]) # 1 + x +Y = frozenset([(0, 0, 0), (0, 1, 0)]) # 1 + y +Z = frozenset([(0, 0, 0), (0, 0, 1)]) # 1 + z +MONO_Z = frozenset([(0, 0, 1)]) + + +def fail(message): + raise SystemExit("FAIL: " + message) + + +def require(ok, message): + if not ok: + fail(message) + + +def padd(left, right): + return (left - right) | (right - left) + + +def pmul(left, right): + if not left or not right: + return ZERO + out = set() + for a, b, c in left: + for d, e, f in right: + term = (a + d, b + e, c + f) + if term in out: + out.remove(term) + else: + out.add(term) + return frozenset(out) + + +def stage_shift(stage): + return (X, Y, Z)[stage] + + +def gate_diagonal(stage, kind): + """kind 0, 1, 2 are the historical E_11, E_22 and leaf gates.""" + leaf = 2 * (stage + 1) + if kind == 0: + positions = (0,) + elif kind == 1: + positions = (1,) + elif kind == 2: + positions = (leaf, leaf + 1) + else: + fail("unknown gate kind") + factor = stage_shift(stage) + return tuple(factor if index in positions else ONE for index in range(8)) + + +def nine_diagonals(): + gates = tuple( + gate_diagonal(stage, kind) for stage in range(3) for kind in range(3) + ) + require(len(gates) == 9, "nine gates") + return gates + + +def accumulate(gates): + acc = [ONE] * 8 + for gate in gates: + acc = [pmul(acc[index], gate[index]) for index in range(8)] + return tuple(acc) + + +def pure_closed_form(): + core = pmul(pmul(X, Y), Z) + return (core, core, X, X, Y, Y, Z, Z) + + +def literal_diagonal(spec): + return tuple(spec[index] for index in range(8)) + + +def matmul(left, right): + out = [[ZERO] * 8 for _ in range(8)] + for i in range(8): + for k in range(8): + factor = left[i][k] + if not factor: + continue + source = right[k] + dest = out[i] + for j in range(8): + if source[j]: + dest[j] = padd(dest[j], pmul(factor, source[j])) + return tuple(tuple(row) for row in out) + + +def diagonal_matrix(diag): + return tuple( + tuple(diag[i] if i == j else ZERO for j in range(8)) for i in range(8) + ) + + +def bits_matrix(entries): + rows = [] + for row in range(8): + value = 0 + for col in range(8): + if (row, col) in entries: + value |= 1 << col + rows.append(value) + return tuple(rows) + + +def constant_matrix(bits): + return tuple( + tuple(ONE if (bits[i] >> j) & 1 else ZERO for j in range(8)) + for i in range(8) + ) + + +def product_of(diags): + acc = diagonal_matrix(tuple(ONE for _ in range(8))) + for diag in diags: + acc = matmul(acc, diagonal_matrix(diag)) + return acc + + +def coefficient(left_diags, bits, right_diags): + return matmul( + matmul(product_of(left_diags), constant_matrix(bits)), + product_of(right_diags), + ) + + +def matrices_equal(left, right): + return all(left[i][j] == right[i][j] for i in range(8) for j in range(8)) + + +def scale_entry(left, right, row, col): + return pmul(left[row], right[col]) + + +def eye_bits(): + return bits_matrix({(index, index) for index in range(8)}) + + +def main(): + gates = nine_diagonals() + require( + gates[7] == literal_diagonal(tuple(Z if index == 1 else ONE for index in range(8))), + "stage-2 E_22 does not multiply only coordinate 1 by 1+z", + ) + require( + gates[8] == literal_diagonal(tuple(Z if index in (6, 7) else ONE for index in range(8))), + "stage-2 leaf gate does not multiply coordinates 6 and 7 by 1+z", + ) + + pure = accumulate(gates) + require(pure == pure_closed_form(), "pure product is not the closed form") + require(all(entry not in (ZERO, ONE) for entry in pure), + "a pure diagonal entry is 0 or 1") + require(matrices_equal(product_of(gates), diagonal_matrix(pure)), + "matrix product of the nine gates is not the pure diagonal") + + # Slots: after gate index 7 (stage-2 E_22) and after gate index 8 + # (stage-2 leaf). The word ends at index 8, so the suffix after S is empty. + # PR #7287 uses the slots after indices 4 and 6. + require(8 < 9, "the two slots are ordered") + left_r = accumulate(gates[:8]) + middle = accumulate(gates[8:9]) + right_s = accumulate(gates[9:]) + right_r = accumulate(gates[8:]) + left_s = accumulate(gates[:9]) + core = pmul(pmul(X, Y), Z) + expected_left = (core, core, X, X, Y, Y, ONE, ONE) + expected_middle = (ONE, ONE, ONE, ONE, ONE, ONE, Z, Z) + expected_right = (ONE, ONE, ONE, ONE, ONE, ONE, ONE, ONE) + require(left_r == expected_left, + "left diagonal is not diag((1+x)(1+y)(1+z), (1+x)(1+y)(1+z), 1+x, 1+x, 1+y, 1+y, 1, 1)") + require(middle == expected_middle, + "middle diagonal is not diag(1, 1, 1, 1, 1, 1, 1+z, 1+z)") + require(right_s == expected_right, + "the suffix after the leaf gate is not the empty product I") + require(product_of(()) == diagonal_matrix(expected_right), + "the empty matrix product is not I") + for index in range(8): + require(pmul(left_r[index], pmul(middle[index], right_s[index])) == pure[index], + "L M T does not recover P") + require(right_r[index] == pmul(middle[index], right_s[index]), + "the first right factor is not M T") + require(left_s[index] == pmul(left_r[index], middle[index]), + "the second left factor is not L M") + require(left_r[index] != ZERO and middle[index] != ZERO and right_s[index] != ZERO, + "a prefix, middle or suffix entry vanished") + + require(padd(ONE, Z) == MONO_Z and MONO_Z != ZERO, "1+(1+z) vanished") + value_set = {ONE, Z} + require(set(middle) == value_set, "middle diagonal uses a value outside {1, 1+z}") + levels = { + Z: [index for index in range(8) if middle[index] == Z], + ONE: [index for index in range(8) if middle[index] == ONE], + } + require(levels[Z] == [6, 7], "the 1+z level is not coordinates 6 and 7") + require(levels[ONE] == [0, 1, 2, 3, 4, 5], + "the 1 level is not coordinates 0, 1, 2, 3, 4, 5") + + matched = [] + blocked = [] + for row in range(8): + for col in range(8): + common = pmul(left_r[row], right_s[col]) + first = scale_entry(left_r, right_r, row, col) + second = scale_entry(left_s, right_s, row, col) + require(common != ZERO, "the cancelled factor c_ij vanished") + require(first == pmul(common, middle[col]), "a_ij is not c_ij M_j") + require(second == pmul(common, middle[row]), "b_ij is not c_ij M_i") + require((first == second) == (middle[row] == middle[col]), + "scale equality is not middle-diagonal equality") + require(first != ZERO and second != ZERO, "a gap scale vanished") + if row == col: + require(first == pure[row] == second, "diagonal scale is not P_ii") + continue + if middle[row] == middle[col]: + matched.append((row, col)) + else: + blocked.append((row, col)) + require(padd(first, second) != ZERO, "distinct middle values became equal scales") + + expected_matched = [ + (row, col) + for group in (levels[Z], levels[ONE]) + for row in group + for col in group + if row != col + ] + require( + set(matched) == set(expected_matched) and len(matched) == len(set(expected_matched)), + "matched positions are not the off-diagonal level-set pairs", + ) + require(len(matched) == 32 and len(blocked) == 24, "split is not 32 matched and 24 blocked") + # PR #7287 frees (1, 6) and blocks (1, 4). This middle diagonal reverses that. + require((1, 4) in matched, "coordinate pair (1, 4) is blocked, but it is free for this slot pair") + require((0, 1) in matched, "coordinate pair (0, 1) is blocked, but it is free for this slot pair") + require((6, 7) in matched, "coordinate pair (6, 7) is blocked, but it is free for this slot pair") + require((1, 6) in blocked, "coordinate pair (1, 6) is free, but it is blocked for this slot pair") + require((0, 6) in blocked, "coordinate pair (0, 6) is free, but it is blocked for this slot pair") + predecessor_matched = { + (row, col) + for group in ([4, 5], [1, 2, 3, 6, 7]) + for row in group + for col in group + if row != col + } + require(set(matched) != predecessor_matched, + "matched positions reproduced the PR #7287 level sets") + require(len(predecessor_matched) == 22, "the cited PR #7287 matched count is not 22") + + for passed in (8, 9): + left_diags = gates[:passed] + right_diags = gates[passed:] + for row in range(8): + for col in range(8): + direct = coefficient(left_diags, bits_matrix({(row, col)}), right_diags) + expect = [[ZERO] * 8 for _ in range(8)] + expect[row][col] = scale_entry( + accumulate(left_diags), accumulate(right_diags), row, col) + require( + matrices_equal(direct, tuple(tuple(item) for item in expect)), + "unit coefficient disagreed with the scale formula", + ) + + unit_sum = bits_matrix({(6, 7), (0, 1)}) + added = coefficient(gates[:8], unit_sum, gates[8:]) + separate = [[ZERO] * 8 for _ in range(8)] + for row, col in ((6, 7), (0, 1)): + piece = coefficient(gates[:8], bits_matrix({(row, col)}), gates[8:]) + for i in range(8): + for j in range(8): + separate[i][j] = padd(separate[i][j], piece[i][j]) + require(matrices_equal(added, tuple(tuple(item) for item in separate)), + "coefficient map is not additive on a two-unit sum") + + def entry_value(row, col, first_bit, second_bit): + value = ZERO + if first_bit: + value = padd(value, scale_entry(left_r, right_r, row, col)) + if second_bit: + value = padd(value, scale_entry(left_s, right_s, row, col)) + return value + + def predicted(row, col): + if row == col: + return {(1, 0), (0, 1)} + if middle[row] == middle[col]: + return {(0, 0), (1, 1)} + return {(0, 0)} + + choices = 1 + free_bits = 0 + for row in range(8): + for col in range(8): + target = pure[row] if row == col else ZERO + found = set() + for first_bit in (0, 1): + for second_bit in (0, 1): + value = entry_value(row, col, first_bit, second_bit) + if row == col: + require(value in (ZERO, pure[row]), + "a diagonal coefficient left {0, P_ii}") + if value == target: + found.add((first_bit, second_bit)) + require(found == predicted(row, col), + "scalar solutions disagreed with the middle-diagonal rule") + choices *= len(found) + if len(found) == 2: + free_bits += 1 + else: + require(len(found) == 1, "a position had neither one nor two solutions") + require(choices == 2 ** 40 and free_bits == 40, "solution count is not 2^40") + require(choices != 2 ** 30, "solution count reproduced the PR #7287 count") + require(8 + 32 + 24 == 64, "the 64 positions were not partitioned") + + pure_m = diagonal_matrix(pure) + identity = diagonal_matrix(tuple(ONE for _ in range(8))) + + def pair_coefficient(first_bits, second_bits): + left = coefficient(gates[:8], first_bits, gates[8:]) + right = coefficient(gates[:9], second_bits, gates[9:]) + return tuple( + tuple(padd(left[i][j], right[i][j]) for j in range(8)) + for i in range(8) + ) + + eye = eye_bits() + zero = bits_matrix(set()) + require(matrices_equal(pair_coefficient(eye, zero), pure_m), + "(I, 0) does not reproduce the pure product") + require(matrices_equal(pair_coefficient(zero, eye), pure_m), + "(0, I) does not reproduce the pure product") + require(not matrices_equal(pair_coefficient(eye, eye), pure_m), + "(I, I) reproduced the pure product") + require(not matrices_equal(pair_coefficient(eye, zero), identity), + "(I, 0) reproduced the identity") + + def split_with(entries): + return bits_matrix({(index, index) for index in range(8)} | set(entries)) + + witnesses = 0 + for entries in ({(6, 7)}, {(0, 1)}, {(6, 7), (7, 6)}): + both = bits_matrix(entries) + witness = pair_coefficient(split_with(entries), both) + require(matrices_equal(witness, pure_m), + "a both-nonzero level-set witness missed the pure product") + require(not matrices_equal(witness, identity), + "a both-nonzero witness produced the identity") + witnesses += 1 + require(witnesses == 3, "both-nonzero witness count changed") + + blocked_pair = pair_coefficient(split_with({(1, 6)}), bits_matrix({(1, 6)})) + require(not matrices_equal(blocked_pair, pure_m), + "blocked pair (1, 6) reproduced the pure product") + unequal = pair_coefficient(split_with({(6, 7)}), zero) + require(not matrices_equal(unequal, pure_m), + "unequal bits on a matched position reproduced the pure product") + mixed = pair_coefficient( + split_with({(6, 7), (1, 6)}), + bits_matrix({(6, 7), (1, 6)}), + ) + require(not matrices_equal(mixed, pure_m), + "a matched bit plus a blocked bit reproduced the pure product") + + for row in range(8): + for first_bit in (0, 1): + for second_bit in (0, 1): + require(entry_value(row, row, first_bit, second_bit) != ONE, + "a diagonal entry equalled 1") + + print("PASS_STAGE2_E22_LEAF_GAPS") + print("matched_off_diagonal", len(matched)) + print("blocked_off_diagonal", len(blocked)) + print("level_1_plus_z", len(levels[Z])) + print("level_one", len(levels[ONE])) + print("solution_pairs", "2^40") + print("witness_both_nonzero", witnesses) + print("coefficient_equals_I", 0) + print("distinguished_from_stage1_e22_stage2_e11", 1) + + +if __name__ == "__main__": + main()