From f8f3fb33a5d8f629ebd4b810cf1c07d21e49a0ca Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 22 Oct 2026 13:36:43 +0000 Subject: [PATCH] Classify port-dependent C_u chart pairs on F_2^4 Show that C_b C_a^{-1} fixes every data character if and only if a = b. The 240 unequal pairs each fail on exactly 8 characters. No new kappa. Co-authored-by: unpaidmoon --- research/p104-port-chart-pair/PROOF.md | 71 +++++++++ research/p104-port-chart-pair/README.md | 118 ++++++++++++++ research/p104-port-chart-pair/SOURCES.json | 18 +++ research/p104-port-chart-pair/TASK.json | 139 +++++++++++++++++ research/p104-port-chart-pair/VERIFY.json | 19 +++ research/p104-port-chart-pair/test_verify.py | 49 ++++++ research/p104-port-chart-pair/verify.py | 154 +++++++++++++++++++ 7 files changed, 568 insertions(+) create mode 100644 research/p104-port-chart-pair/PROOF.md create mode 100644 research/p104-port-chart-pair/README.md create mode 100644 research/p104-port-chart-pair/SOURCES.json create mode 100644 research/p104-port-chart-pair/TASK.json create mode 100644 research/p104-port-chart-pair/VERIFY.json create mode 100644 research/p104-port-chart-pair/test_verify.py create mode 100644 research/p104-port-chart-pair/verify.py diff --git a/research/p104-port-chart-pair/PROOF.md b/research/p104-port-chart-pair/PROOF.md new file mode 100644 index 0000000000..cd9c611fda --- /dev/null +++ b/research/p104-port-chart-pair/PROOF.md @@ -0,0 +1,71 @@ +# Port-dependent charts in the C_u family match a data line only when they are equal + +No new κ. The selected conditional exponent stays `60403/20000000`. + +## Changed premise + +PR #4136 shows that a uniform chart `C_u` preserves its own encoding, and that +an exit `C_u` (`u ≠ 0`) does not match the single next entrance `C_0 = I`. +The open data-line question is the changed premise: the next entrance may be +any chart in the same family, not only `I`. + +The address space is `F_2^4`, with the character basis of size 16. For +`u` in that space, `X_u` is diagonal, + +```text +X_u |z⟩ = (-1)^{u·z} |z⟩, +``` + +and the published chart is + +```text +C_u = ((1+i) I + (1-i) X_u) / 2. +``` + +Thus `C_u |z⟩ = |z⟩` when `u·z = 0`, and `C_u |z⟩ = i |z⟩` when `u·z = 1`. +In particular `C_0 = I`, and `C_u^{-1}` multiplies the odd set of `u` by `-i`. + +An adjacent data line whose exit chart is `C_a` and whose next entrance chart +is `C_b` matches every data character when `C_b C_a^{-1}` acts by `1` on every +character. + +## Classification + +On a character `z`, the multiplier of `C_b C_a^{-1}` is: + +| `a·z` | `b·z` | multiplier | +|---|---|---| +| 0 | 0 | 1 | +| 1 | 1 | 1 | +| 0 | 1 | `i` | +| 1 | 0 | `-i` | + +The two dot products agree for every `z` if and only if `a` and `b` are the +same linear form, hence the same vector. Therefore + +```text +C_b C_a^{-1} = I ⟺ a = b. +``` + +If `a ≠ b`, write `g = a + b ≠ 0`. The characters where the forms disagree are +exactly `{z : g·z = 1}`, a set of size 8. Every one of those characters is +multiplied by `i` or by `-i`, so the pair fails on exactly half of the data +line. The other eight characters, where the forms agree, are fixed. + +There are 16 charts and 256 ordered pairs. The 16 pairs with `a = b` match +every character. The other 240 pairs fail on exactly eight characters. The +15 pairs checked in #4136 are the column `b = 0`, `a ≠ 0` of this table. + +## What the phase is doing + +If the odd eigenvalue `i` is replaced by `1`, every `C_u` becomes `I` and every +ordered pair matches. The obstruction is the relative phase, not the support +of `X_u` alone. Forgetting that phase is a false witness; the verifier rejects +it by counting 16 matches rather than 256. + +## Scope + +This is the data-line half of the changed chart premise. Helper roles are not +in the model, and this note does not supply an intertwiner, a dirty +restoration, a hosting bill, or a supplier. A different chart family could +still match. The uniform pairs `a = b` do match; they are not port-dependent. diff --git a/research/p104-port-chart-pair/README.md b/research/p104-port-chart-pair/README.md new file mode 100644 index 0000000000..601e06ae10 --- /dev/null +++ b/research/p104-port-chart-pair/README.md @@ -0,0 +1,118 @@ +# Port-dependent C_u charts match a data line only when they are equal + +**Partial negative result. No new κ.** The selected conditional exponent stays +`60403/20000000` (`0.00302015`, #4470). + +## Result + +In the chart family used by the uniform-commutation gap, an adjacent data line +matches every character if and only if the exit chart and the next entrance +chart are the same chart. + +The address space is `F_2^4`. For each `u` in that space the chart is + +```text +C_u = ((1+i) I + (1-i) X_u) / 2, +X_u |z⟩ = (-1)^{u·z} |z⟩. +``` + +So `C_u` fixes the even characters of `u` and multiplies the odd characters by +`i`. The changed premise, relative to PR #4136, is that the next entrance may +be an arbitrary chart `C_b` in this family, not only the common chart `I`. +The exit is `C_a`. These two charts transport every data character by `1` if +and only if `a = b`. + +There are 16 charts and 256 ordered pairs: + +| Pairs | Count | Data-line outcome | +|---|---:|---| +| `a = b` | 16 | Match on all 16 characters | +| `a ≠ b` | 240 | Fail on exactly 8 characters | + +The eight failures are the odd set of the nonzero form `a + b`. On that set +the multiplier is `i` or `-i`. The 15 pairs in #4136, exit `C_u` for `u ≠ 0` +against entrance `I`, are one column of this table. + +Replacing the odd eigenvalue `i` by `1` makes every chart the identity and +every pair a match. The obstruction is that relative phase. + +The argument is in [PROOF.md](PROOF.md). `verify.py` evaluates `C_u` from the +displayed formula, checks the four-case multiplier, and enumerates all 256 +pairs. It does not import the #4136 package. + +## Scope + +Task card `p104-side-correction`, priority revision 7, base +`fbc9ea0249746acca4f504d4fda2b84e0e36cf0d`. Scope status is **refined**. + +The card asks whether a changed producer/consumer contract can escape the +scoped chart obstruction with a favorable full bill. This package changes one +hypothesis of the published chart obstruction: the entrance chart is any +`C_b`, not only `I`. Inside this family the data-line mismatch survives for +every port-dependent pair. Helper roles, dirty restoration, an intertwiner +and a hosting bill are not in the model, so this is not a supplier and not a +complete channel bill. + +Ordered eligible list for this session, after dropping obligations already +delivered on main or by the listed unpaidmoon PRs. Order is the +priority-revision-7 table in `docs/research/current-priorities.md`, with the +first row expanded by the shortest unaudited list in +`docs/research/pr4100-audit-coverage-map.md` and then by the successor +questions those audits still leave open: + +1. PR2809 encoded-stack visited-space bound (open question of `bit-stock-recurrence-audit`). +2. One PR4088 global program's frame-label cancellation (open question of `complex-cover-lift-audit`). +3. QQ16 matched parent park/restore bill (open question of `qq16-caller-install`). +4. R437 residual binding to uniform fixed-tape primitives (open question 1 of `r437-carrier-integration`). +5. **This package.** The fifth remaining item is the P104 row. Its delivered + static obstructions (#4133, #4136, #4140, #4153, #4154, #4370 and the other + listed P104 PRs) are excluded. The distinct remaining piece is open + question 1 of #4136: an adjacent pair whose entrance chart may depend on + the port. The data-line half is answered here. The helper half is still open. + +## Reproduce + +Python 3.12, standard library only, from the repository root: + +```sh +python3 scripts/research_package.py --package research/p104-port-chart-pair --check-only +python3.12 -B scripts/research_package.py --package research/p104-port-chart-pair +``` + +Direct checks: + +```sh +python3 -B research/p104-port-chart-pair/verify.py +python3 -B research/p104-port-chart-pair/test_verify.py +``` + +Expected marker: + +```text +PASS_P104_PORT_CHART_PAIR address=F2^4 charts=16 ordered_pairs=256 matching_pairs=16 failing_pairs=240 failures_per_unequal_pair=8 entrance_I_failures=15 data_match_iff_equal_charts=true helpers=out_of_model no_new_kappa +``` + +Not run: Lean, Docker, the selected cold replay, a helper-role model, and any +hosting or moment calculation. + +## Open next questions + +1. Does one helper block, written in this same chart family, have an exit and + a next entrance that match on every helper role when the data charts already + differ? The first step is to name the helper roles and their charts. This + package has no helper roles, so it cannot answer that half. +2. Is there a chart family outside `{C_u}`, still legal for the P104 encoding, + in which two different charts transport every data character by `1`? A + positive example would reopen the adjacent-pair search. This classification + does not search that family. + +## Credit + +The chart formula, the uniform-match statement, and the 15 entrance-`I` +failures are PR #4136 (unpaidmoon), from the two-axis gate in PR #3954 +(Chris R / Clear1nsight). The request for one adjacent pair is discussion +#1166 comment 19034066. Predecessor lineage named in #4136 remains theirs, +including Rohan Arun, Chafik Boukhalfa, and Adam Gall. + +Prepared by unpaidmoon with substantial Cursor Grok assistance. Apache-2.0. +No independent human or formal-kernel review is claimed. diff --git a/research/p104-port-chart-pair/SOURCES.json b/research/p104-port-chart-pair/SOURCES.json new file mode 100644 index 0000000000..9b3d9dc421 --- /dev/null +++ b/research/p104-port-chart-pair/SOURCES.json @@ -0,0 +1,18 @@ +{ + "schema_version": 1, + "base_commit": "fbc9ea0249746acca4f504d4fda2b84e0e36cf0d", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "c35482cd9035843b15a634cc8276a7e1e40e8395", + "sha256": "6fe0a099b89aa2aed796a13c3a21dafc63f3388ebf397464e44e0451893b9375" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + } + ] +} diff --git a/research/p104-port-chart-pair/TASK.json b/research/p104-port-chart-pair/TASK.json new file mode 100644 index 0000000000..231e85b7d3 --- /dev/null +++ b/research/p104-port-chart-pair/TASK.json @@ -0,0 +1,139 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 7, + "base_commit": "fbc9ea0249746acca4f504d4fda2b84e0e36cf0d", + "original_card": { + "id": "p104-side-correction", + "question": "Can a changed P104 producer/consumer contract escape the scoped slot, chart and completion obstructions with a favorable full bill?", + "starting_points": [ + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "research/p104-literal-slot-defect/README.md", + "research/p104-uniform-commutation-gap/README.md", + "research/p104-uniform-encoding-gap/README.md", + "research/p104-source-chart-shortcut/README.md", + "research/p104-fiber-tag-seam/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 named successor obstructions before extending #2981 static flags. Distinguish literal-slot action, commutation, uniform encoding, source-chart shortcut and fiber-tag seam scopes; none excludes all P104 mechanisms.", + "scope": "Source-binding orientation only; no scientific replay, theorem acceptance or supplier admission. Budget any heavy replay separately." + }, + "first_experiment": "Name one hypothesis changed from these exact interfaces. Write a literal producer-to-consumer timeline and an arbitrary-dirty-input positive/control pair, then charge acquisition, coefficients, completion, hosting and restoration. Stop if the same slot/fiber mismatch persists or the favorable full budget already fails. A scoped independent audit remains useful; another static count is not a new completion.", + "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.", + "Repeating a static cover, source-chart shortcut or fiber-tag seam without changing the hypothesis responsible for its obstruction." + ], + "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", + "4133", + "4136", + "4140", + "4153", + "4154", + "p104-literal-slot-defect", + "p104-uniform-commutation-gap", + "p104-uniform-encoding-gap", + "p104-source-chart-shortcut", + "p104-fiber-tag-seam" + ], + "existing_checks": [ + { + "scope": "PR #4133: literal-slot defect", + "evidence": "research/p104-literal-slot-defect/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "88666f1dee93fbd85b31fd5d6f91a219e111b5f4", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4136: uniform commutation gap", + "evidence": "research/p104-uniform-commutation-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "281ce601a8be9db470de630759179c23e1dfaa88", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4140: uniform encoding gap", + "evidence": "research/p104-uniform-encoding-gap/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "de25c6525aa866962309df5d107b32d55e6e5628", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4153: source-chart shortcut exhausts its optimistic allowance", + "evidence": "research/p104-source-chart-shortcut/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "9123241fea53df77e51ffe30d9aca1625d4bf3a8", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4154: fiber-tag seam mismatch", + "evidence": "research/p104-fiber-tag-seam/README.md", + "remaining": "Independently validate the stated scope or change its producer/consumer premise and pay the complete boundary.", + "status": "author-checked", + "source_commit": "4ffcdaee5d6255a9cea1fe53a5424435068089d0", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "refined", + "actual_scope": "In the F_2^4 chart family C_u of the uniform-commutation gap, an adjacent data line matches every character if and only if the exit chart and the next entrance chart are equal. All 240 port-dependent pairs fail on exactly 8 characters. Helper roles and a hosting bill are out of scope.", + "scope_change_reason": "The card asks whether a changed producer/consumer contract escapes the chart obstruction with a full bill. The delivered P104 obstructions, including #4136, are excluded. This package changes one hypothesis of #4136: the next entrance may be any chart C_b in the same family, not only I. That is the data-line half of #4136 open question 1. It stops when every port-dependent data pair fails, and it does not build a helper block or a channel bill.", + "bottleneck_link": "A port-dependent entrance was the stated way past the uniform chart obstruction. Inside this family it does not produce a data-line match, so that premise does not yet supply a cheaper P104 channel. No selected exponent is changed.", + "budget_minutes": 60, + "stop_rule": "Stop once every ordered pair in this chart family is classified. Do not search a second chart family or price a hosting bill in this session.", + "outcome": "partial", + "evidence": "Exact classification. verify.py prints PASS_P104_PORT_CHART_PAIR with matching_pairs 16, failing_pairs 240, failures_per_unequal_pair 8 and entrance_I_failures 15. test_verify.py prints PASS_P104_PORT_CHART_PAIR_CONTROLS controls=counts,identity,half_fail,eigenvalues,closed_form,phase,odd_set. PROOF.md gives the multiplier table. No new kappa.", + "author": "unpaidmoon", + "ai_assistance": "Substantial Cursor Grok assistance.", + "open_questions": [ + { + "question": "Does one helper block in this same chart family match on every helper role when the data charts already differ?", + "why_it_matters": "The card's adjacent pair has to match helper roles as well as data roles. A helper mismatch would extend the obstruction; a helper match would be the first positive half of the pair.", + "first_step": "Name the helper roles and write their exit and entrance charts in this C_u family.", + "blocked_by": "This model has no helper roles." + }, + { + "question": "Is there a legal P104 chart family outside {C_u} in which two different charts transport every data character by 1?", + "why_it_matters": "A positive example would reopen the adjacent-pair search that this family closes.", + "first_step": "Write one alternative legal chart on the same 16 characters and test it against C_0.", + "blocked_by": "No second chart family is an input of this package." + } + ] +} diff --git a/research/p104-port-chart-pair/VERIFY.json b/research/p104-port-chart-pair/VERIFY.json new file mode 100644 index 0000000000..5033fff5d0 --- /dev/null +++ b/research/p104-port-chart-pair/VERIFY.json @@ -0,0 +1,19 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": ["{python}", "-B", "{package}/verify.py"], + "timeout_seconds": 60, + "checks": "All 256 ordered C_u pairs: the displayed eigenvalue formula agrees with the four-case multiplier, equal charts match all 16 characters, and each of the 240 unequal charts fails on exactly 8 characters. The entrance-I column recovers the 15 failures from PR #4136. Forgetting the odd phase i matches all 256 pairs and is not accepted as the theorem." + }, + { + "argv": ["{python}", "-B", "{package}/test_verify.py"], + "timeout_seconds": 60, + "checks": "Independent controls: C_0 is the identity, C_1 sends an odd character to i, transport against I is -i, the disagreement set is the odd set of a+b, and the phase-forgotten witness is rejected." + } + ] +} diff --git a/research/p104-port-chart-pair/test_verify.py b/research/p104-port-chart-pair/test_verify.py new file mode 100644 index 0000000000..cf9dd9177e --- /dev/null +++ b/research/p104-port-chart-pair/test_verify.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +"""Failure controls for the port-dependent chart-pair classification.""" + +from verify import ( + DIM, + I_UNIT, + NEG_I, + ONE, + c_eigenvalue, + classify, + closed_transport, + failures, + parity, + phase_forgotten_matches, + transport, +) + + +def expect(condition, message): + if not condition: + raise SystemExit(message) + + +def main(): + row = classify() + expect(row["matching_pairs"] == 16, row) + expect(row["failing_pairs"] == 240, row) + expect(failures(0, 0) == [], "identity pair must match") + expect(len(failures(1, 0)) == 8, "nonzero exit against I must miss half the characters") + expect(c_eigenvalue(0, 7) == ONE, "C_0 is the identity") + expect(c_eigenvalue(1, 1) == I_UNIT, "odd character of C_1 is i") + expect(transport(1, 0, 1) == NEG_I, "C_0 C_1^{-1} multiplies an odd character by -i") + expect(closed_transport(3, 1, 2) == transport(3, 1, 2), "closed form drifted") + false_matches = phase_forgotten_matches() + expect(false_matches == 256, false_matches) + expect(false_matches != row["matching_pairs"], "phase-blind witness must not equal the theorem") + # Disagreement is exactly the odd set of one nonzero linear form. + for gap in range(1, DIM): + odd = [z for z in range(DIM) if parity(gap, z)] + expect(len(odd) == 8, gap) + expect(failures(0, gap) == odd, (gap, failures(0, gap), odd)) + print( + "PASS_P104_PORT_CHART_PAIR_CONTROLS " + "controls=counts,identity,half_fail,eigenvalues,closed_form,phase,odd_set" + ) + + +if __name__ == "__main__": + main() diff --git a/research/p104-port-chart-pair/verify.py b/research/p104-port-chart-pair/verify.py new file mode 100644 index 0000000000..dea95fbf59 --- /dev/null +++ b/research/p104-port-chart-pair/verify.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python3 +"""Every port-dependent C_u pair fails the adjacent data-line match. + +Address space F_2^4. Charts are the published diagonal family +C_u = ((1+i) I + (1-i) X_u) / 2. An exit chart C_a followed by an entrance +chart C_b matches every data character if and only if a = b. No new kappa. +""" + +from __future__ import annotations + +M = 4 +DIM = 1 << M +ONE = (1, 0) +I_UNIT = (0, 1) +NEG_I = (0, -1) + + +def parity(u: int, z: int) -> int: + return (u & z).bit_count() & 1 + + +def x_eigenvalue(u: int, z: int) -> int: + """X_u |z> = (-1)^{u·z} |z>, returned as ±1.""" + return -1 if parity(u, z) else 1 + + +def c_eigenvalue(u: int, z: int): + """Evaluate C_u on character z from the displayed formula, not from a case table.""" + x = x_eigenvalue(u, z) + # ((1+i) + (1-i) x) / 2. For x = ±1 both coordinates are even. + real = 1 + x + imag = 1 - x + if real % 2 or imag % 2: + raise AssertionError((u, z, real, imag)) + return (real // 2, imag // 2) + + +def inverse_unit(value): + norm = value[0] * value[0] + value[1] * value[1] + if norm != 1: + raise AssertionError(value) + return (value[0], -value[1]) + + +def multiply(left, right): + return ( + left[0] * right[0] - left[1] * right[1], + left[0] * right[1] + left[1] * right[0], + ) + + +def transport(a: int, b: int, z: int): + """Eigenvalue of C_b C_a^{-1} on |z>.""" + return multiply(c_eigenvalue(b, z), inverse_unit(c_eigenvalue(a, z))) + + +def closed_transport(a: int, b: int, z: int): + """Same multiplier from the four dot-product cases in PROOF.md.""" + pa, pb = parity(a, z), parity(b, z) + if pa == pb: + return ONE + if pa == 0: + return I_UNIT + return NEG_I + + +def failures(a: int, b: int): + return [z for z in range(DIM) if transport(a, b, z) != ONE] + + +def classify(): + equal = [] + unequal = [] + for a in range(DIM): + for b in range(DIM): + bad = failures(a, b) + for z in range(DIM): + if transport(a, b, z) != closed_transport(a, b, z): + raise AssertionError((a, b, z)) + if a == b: + if bad: + raise AssertionError((a, b, bad)) + equal.append((a, b)) + else: + if len(bad) != DIM // 2: + raise AssertionError((a, b, bad)) + gap = a ^ b + if gap == 0 or any(parity(gap, z) != 1 for z in bad): + raise AssertionError((a, b, gap, bad)) + if any(parity(gap, z) == 1 for z in range(DIM) if z not in bad): + raise AssertionError((a, b, bad)) + unequal.append((a, b)) + if len(equal) != DIM or len(unequal) != DIM * DIM - DIM: + raise AssertionError((len(equal), len(unequal))) + # The #4136 slice is the entrance-I column, every nonzero exit. + entrance_i = [a for a in range(1, DIM) if failures(a, 0)] + if len(entrance_i) != DIM - 1: + raise AssertionError(len(entrance_i)) + return { + "address_bits": M, + "charts": DIM, + "ordered_pairs": DIM * DIM, + "matching_pairs": len(equal), + "failing_pairs": len(unequal), + "failures_per_unequal_pair": DIM // 2, + "entrance_identity_failures": len(entrance_i), + } + + +def forgotten_phase_multiplier(u: int, z: int): + """The false chart that stores the odd eigenvalue as 1 instead of i.""" + del u, z + return ONE + + +def phase_forgotten_matches(): + """That false chart makes every ordered pair look like a match.""" + matches = 0 + for a in range(DIM): + for b in range(DIM): + if all( + multiply( + forgotten_phase_multiplier(b, z), + inverse_unit(forgotten_phase_multiplier(a, z)), + ) + == ONE + for z in range(DIM) + ): + matches += 1 + return matches + + +def main(): + row = classify() + if phase_forgotten_matches() != DIM * DIM: + raise SystemExit("phase-forgotten control did not match every pair") + if row["matching_pairs"] != 16 or row["failing_pairs"] != 240: + raise SystemExit(row) + if row["entrance_identity_failures"] != 15: + raise SystemExit(row) + print( + "PASS_P104_PORT_CHART_PAIR " + f"address=F2^{row['address_bits']} charts={row['charts']} " + f"ordered_pairs={row['ordered_pairs']} " + f"matching_pairs={row['matching_pairs']} " + f"failing_pairs={row['failing_pairs']} " + f"failures_per_unequal_pair={row['failures_per_unequal_pair']} " + f"entrance_I_failures={row['entrance_identity_failures']} " + "data_match_iff_equal_charts=true helpers=out_of_model no_new_kappa" + ) + + +if __name__ == "__main__": + main()