diff --git a/research/heisenberg-central-pair-seed0154/EXPECTED.json b/research/heisenberg-central-pair-seed0154/EXPECTED.json new file mode 100644 index 0000000000..ebb07eca07 --- /dev/null +++ b/research/heisenberg-central-pair-seed0154/EXPECTED.json @@ -0,0 +1,139 @@ +{ + "schema_version": 1, + "group": "UT3(F3)", + "group_order": 27, + "coefficient_field": "F2", + "registers": 2, + "paid_labels": [ + "x", + "x^-1", + "y", + "y^-1" + ], + "rank_one_idempotents": 6, + "target": "diag([z],[z]) where z=[x,y]", + "direct_witness": [ + "x", + "y", + "x^-1", + "y^-1", + "x", + "y", + "x^-1", + "y^-1" + ], + "direct_calls": 8, + "max_excluded_length": 7, + "minimum": 8, + "layers": [ + { + "depth": 0, + "raw_words": 1, + "unique_states": 1, + "sha256_sorted_states": "288b1793833bb59673891be54d485696d3f7d8ff9a9168758ef9d00b1bca8985" + }, + { + "depth": 1, + "raw_words": 24, + "unique_states": 24, + "sha256_sorted_states": "1ff8bf8693e35e212e976ec03752819f62a1533dfe648a7e0f232e15ddd6c26d" + }, + { + "depth": 2, + "raw_words": 576, + "unique_states": 413, + "sha256_sorted_states": "5d0f334f0ed44b3c126df7b80c426dbfe5f5003624e80044bdb00939393f481a" + }, + { + "depth": 3, + "raw_words": 13824, + "unique_states": 5927, + "sha256_sorted_states": "ab25c7dee773421bf8747865d325c920dc379e6e7e58389e9e9c39b5a290c52b" + }, + { + "depth": 4, + "raw_words": 331776, + "unique_states": 82063, + "sha256_sorted_states": "508a4fe9671ee72e2c3ddd45296736d1f510e69cfb3b9df3b6f82657440cc8df" + } + ], + "length_splits": [ + { + "length": 0, + "left_depth": 0, + "right_depth": 0, + "left_states": 1, + "right_states": 1, + "prefixes_checked": 1, + "target_found": false + }, + { + "length": 1, + "left_depth": 0, + "right_depth": 1, + "left_states": 1, + "right_states": 24, + "prefixes_checked": 1, + "target_found": false + }, + { + "length": 2, + "left_depth": 1, + "right_depth": 1, + "left_states": 24, + "right_states": 24, + "prefixes_checked": 24, + "target_found": false + }, + { + "length": 3, + "left_depth": 1, + "right_depth": 2, + "left_states": 24, + "right_states": 413, + "prefixes_checked": 24, + "target_found": false + }, + { + "length": 4, + "left_depth": 2, + "right_depth": 2, + "left_states": 413, + "right_states": 413, + "prefixes_checked": 413, + "target_found": false + }, + { + "length": 5, + "left_depth": 2, + "right_depth": 3, + "left_states": 413, + "right_states": 5927, + "prefixes_checked": 413, + "target_found": false + }, + { + "length": 6, + "left_depth": 3, + "right_depth": 3, + "left_states": 5927, + "right_states": 5927, + "prefixes_checked": 5927, + "target_found": false + }, + { + "length": 7, + "left_depth": 3, + "right_depth": 4, + "left_states": 5927, + "right_states": 82063, + "prefixes_checked": 5927, + "target_found": false + } + ], + "controls": { + "construction_mutations": 2, + "group_and_algebra_checks": 4, + "matrix_update_crosschecks": 144 + } +} diff --git a/research/heisenberg-central-pair-seed0154/README.md b/research/heisenberg-central-pair-seed0154/README.md new file mode 100644 index 0000000000..406da38a6e --- /dev/null +++ b/research/heisenberg-central-pair-seed0154/README.md @@ -0,0 +1,84 @@ +# The order-27 central pair costs its direct bill + +**Scoped exact register-model result; no new κ.** In the nonabelian group algebra `F2[UT3(F3)]`, two dirty scalar registers cannot jointly apply the central commutator with fewer calls than applying it to each register separately. The exact minimum is eight calls in the stated alphabet. + +## Model and target + +Represent `UT3(F3)` by triples `(a,b,c)` with multiplication + +```text +(a,b,c)(a',b',c') = (a+a', b+b', c+c'+a*b') in F3. +``` + +Let `x=(1,0,0)`, `y=(0,1,0)`, and `z=[x,y]=xyx^-1y^-1=(0,0,1)`. The group has order 27; `x`, `y`, and `z` have order three, and `z` is central. Work in the exact formal group algebra `F2[UT3(F3)]`. + +For two scalar registers, a paid call is + +```text +D_N(g) = I + ([g] + [e]) N, +``` + +where `g` is one of the four paid labels `x`, `x^-1`, `y`, `y^-1`, and `N=u v^T` is a binary rank-one idempotent (`v^T u=1`). There are six such `N`, hence 24 complete paid operations. The endpoint is + +```text +diag([z], [z]) +``` + +as a formal group-algebra matrix, so it is correct for arbitrary dirty register inputs. No extra register, free address operation, copy, clean allocation, or precision change is allowed. A call costs one unit. + +A direct schedule applies `x y x^-1 y^-1` to the first register and then to the second: eight calls. Four letters are necessary for one copy of `z`: in the abelianization `C3 × C3`, a word for `z` has zero x and y exponents modulo three; every shorter such word either is the identity or has nonzero abelianization. The displayed commutator attains four. + +Free scalar `GL2(F2)` changes of register basis do not enlarge the search. Since scalar matrices commute with the group algebra, they can be pushed through each factor, conjugating `N` to another rank-one idempotent. All six idempotents are enumerated. Any net scalar at the endpoint must be identity after augmentation, because every paid factor augments to `I` and the target augments to `I`. + +## Exact lower bound by complete state splitting + +Each factor is invertible: + +```text +D_N(g) = (I-N) + [g]N +D_N(g)^-1 = (I-N) + [g^-1]N. +``` + +The verifier builds the exact set of 2×2 group-algebra product matrices for every word length through four. Equal matrices at the same length are merged; this preserves all possible continuations because future multiplication depends only on the current matrix. For each total length `n=0,...,7`, split a word into prefix `P` and suffix `S`, with lengths `floor(n/2)` and `ceil(n/2)`. The endpoint equation `P S=T` is equivalent to `S=P^-1 T`. The verifier checks every prefix state against the complete suffix-state set at that length. No match occurs at any length through seven. + +`EXPECTED.json` retains the exact state counts and SHA-256 digests of the sorted states in each layer, plus every split's prefix/suffix coverage and result. The verifier regenerates these receipts and compares them exactly. The direct eight-call word gives the matching upper bound, so the minimum is exactly eight in this group, alphabet, register count and endpoint. + +| Word length | Raw words | Distinct exact product states | Sorted-state SHA-256 | +|---:|---:|---:|---| +| 0 | 1 | 1 | `288b1793833bb59673891be54d485696d3f7d8ff9a9168758ef9d00b1bca8985` | +| 1 | 24 | 24 | `1ff8bf8693e35e212e976ec03752819f62a1533dfe648a7e0f232e15ddd6c26d` | +| 2 | 576 | 413 | `5d0f334f0ed44b3c126df7b80c426dbfe5f5003624e80044bdb00939393f481a` | +| 3 | 13,824 | 5,927 | `ab25c7dee773421bf8747865d325c920dc379e6e7e58389e9e9c39b5a290c52b` | +| 4 | 331,776 | 82,063 | `508a4fe9671ee72e2c3ddd45296736d1f510e69cfb3b9df3b6f82657440cc8df` | + +The split sizes for lengths 0 through 7 are respectively `1×1`, `1×24`, `24×24`, `24×413`, `413×413`, `413×5,927`, `5,927×5,927`, and `5,927×82,063`. Every target lookup is negative. The full receipt, including exact per-length lookups, is in [EXPECTED.json](EXPECTED.json). + +## Reproduce + +From the repository root, with Python 3.10+ and no dependencies: + +```sh +python3 -B research/heisenberg-central-pair-seed0154/verify.py +python3 -I -O -B research/heisenberg-central-pair-seed0154/verify.py +python3 scripts/research_package.py --package research/heisenberg-central-pair-seed0154 --check-only +``` + +Expected verifier line: + +```text +PASS_HEISENBERG_CENTRAL_PAIR minimum=8 excluded_lengths=0..7 group_order=27 characteristic=2 registers=2 generators=4 idempotents=6 controls=6 matrix_crosschecks=144 state_counts=[(0, 1), (1, 24), (2, 413), (3, 5927), (4, 82063)] +``` + +The controls include the group presentation and noncommuting order, the inverse of every paid factor, an eight-call two-target positive word, a four-call one-target positive word, recovery of that one-target word by the split search, and rejection of its omitted-letter mutation. A separate 144-case check compares the optimized update with literal matrix multiplication. Equality is checked coefficient by coefficient in all 27 group coordinates. + +## Result boundary and overlap + +This answers only whether two registers can share a central-commutator implementation in this exact order-27 alphabet. It does not establish a general lower bound for nonabelian groups or another register count. The group algebra is an optimistic formal address model; no physical compiler, hosting, recursive supplier or analytic transfer is supplied. The result makes no κ or integer-multiplication claim. The selected construction remains unchanged and its complex supplier still binds. + +The closest predecessor is [PR #1822](https://github.com/CrocSwap/integer-mult-bounds/pull/1822), which treats central/noncommuting pairs in Q8. Here the group has odd order 27 over coefficient field F2, the central target has order three, and its shortest generator word has length four. Other nearby work includes [PR #1716](https://github.com/CrocSwap/integer-mult-bounds/pull/1716) on the order-six coordinate-CNOT alphabet and active claims on D8, UT4 and four-register affine/rational targets. The final 15:22 UTC overlap refresh completely paginated 535 open PRs and 594 discussions without warnings; it found no Heisenberg-group scope. Exact base and source pins are in [SOURCES.json](SOURCES.json). The superseded Q16 screen and its corrected direct baseline are recorded in the released claim at [Discussion #1167](https://github.com/CrocSwap/integer-mult-bounds/discussions/1167#discussioncomment-18926868). + +Prepared by Cinna Davis with substantial OpenAI Codex assistance. No predecessor implementation is copied. New work is Apache-2.0. + +## Open next questions + +[TASK.json](TASK.json) records one follow-up: test whether another odd-order class-two group has a central target whose direct generator word leaves room for register sharing. The first step is to specify the group and compute the exact direct word metric before building any register search. This is blocked until a group/target outside the active Q8, D8 and UT4 work has both a sufficiently long direct target word and a plausible shorter commutator schedule. diff --git a/research/heisenberg-central-pair-seed0154/SOURCES.json b/research/heisenberg-central-pair-seed0154/SOURCES.json new file mode 100644 index 0000000000..5eb3cdf91c --- /dev/null +++ b/research/heisenberg-central-pair-seed0154/SOURCES.json @@ -0,0 +1,42 @@ +{ + "schema_version": 1, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "input", + "git_blob": "ae6a99f28aa468649eb66a361e764d769363bf11", + "sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "06c96f5579bb67ed1b86d334e78fbed7da6945f1", + "sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075" + }, + { + "path": "research/binary-affine-register-bound/README.md", + "usage": "input", + "git_blob": "7b68583becf8be6f3cf666b05b0943e7eb99270c", + "sha256": "7951868efdf35fdb2aacdd302ca825cbde0586a5fae6df23aee78e29f30c332a" + }, + { + "path": "research/bit-dihedral-commutator/README.md", + "usage": "input", + "git_blob": "b7619a5d56f32daf7f48d6cc3a0e260c5a333510", + "sha256": "4f3f9df6d6d96a26ccb0fcd2ef947cce5d53b0d992da22e866f1e025be4c0492" + }, + { + "path": "research/bit-three-register-lower-bound/README.md", + "usage": "input", + "git_blob": "25e41c370c101a33a6deb978de08b03ed7539b79", + "sha256": "c12b33ef388deece0cbf891505a2ce2c0779a0c3a6cf1f0f7f7039bab59cbebd" + }, + { + "path": "research/coordinate-cnot-register-bound/README.md", + "usage": "input", + "git_blob": "cdcc5a9e7f11ab3dbf7745a175ddcca208c68211", + "sha256": "e1666512fb71cf34c427c69ffb61a18b61e897a7f8f91f87820edf744e85a9fe" + } + ] +} diff --git a/research/heisenberg-central-pair-seed0154/TASK.json b/research/heisenberg-central-pair-seed0154/TASK.json new file mode 100644 index 0000000000..df3eab47b5 --- /dev/null +++ b/research/heisenberg-central-pair-seed0154/TASK.json @@ -0,0 +1,71 @@ +{ + "schema_version": 1, + "task_id": "bit-new-register-model", + "priority_revision": 3, + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "original_card": { + "id": "bit-new-register-model", + "question": "Can an explicitly larger or nonabelian register model escape the scoped three-register obstruction?", + "starting_points": [ + "research/bit-three-register-lower-bound/README.md", + "certificates/selected-result.json" + ], + "methods": [ + "Construct the smallest exact identity in a newly specified legal operation alphabet.", + "Derive a target-specific relaxation bound for that same explicit alphabet." + ], + "acceptance_gate": "Name the changed hypothesis, all counted roles and a uniform identity; finite column tests alone do not certify it.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read Model section 1 of the three-register bound and identify the exact excluded free operations.", + "scope": "Positive control / source-bound orientation only; this is not a new construction or full cold replay." + }, + "first_experiment": "Write a complete operation alphabet outside one named premise and price a baseline before searching identities.", + "bottleneck_link": "A small-width completed saving changes the bit primitive; a finite-address identity alone is insufficient.", + "allowed_variations": [ + "Choose a fixed larger register count or a specified nonabelian operation family." + ], + "scope_change_triggers": [ + "Remaining inside the already-excluded three-register abelian model." + ], + "overlap_terms": [ + "three-register", + "nonabelian", + "group algebra" + ] + }, + "scope_status": "refined", + "actual_scope": "For two dirty registers and the 24 paid rank-one shears over F2[UT3(F3)] generated by x, x^-1, y, y^-1, is the exact minimum call count for diag([z],[z]) equal to the eight-call direct schedule, where z=[x,y]?", + "scope_change_reason": "The selector card allows one specified nonabelian address group. The first candidate Q16 was released after direct pricing showed x^4=y^2, so two targets cost four calls. This refinement uses the order-27 exponent-three Heisenberg group, where its central commutator has shortest generator word length four and the two-target direct bill is eight.", + "bottleneck_link": "A shorter exact nonabelian register word could lower a bit primitive call count. The exact eight-call lower bound rules out this particular cross-register mechanism in a changed address group; it does not alter the selected supplier or kappa.", + "budget_minutes": 60, + "stop_rule": "Exhaust exact product states at every word length 0 through 7 over all 24 operations (six rank-one idempotents times four generator labels). Compare against the explicit eight-call word and stop there. Do not vary group, register count, target, or operation prices in this cycle.", + "outcome": "negative-result", + "evidence": "python3 -B research/heisenberg-central-pair-seed0154/verify.py passes. It constructs exact F2[UT3(F3)] product-state layers, proves no endpoint match for lengths 0..7 by complete meet-in-the-middle, and verifies the direct length-8 witness. Layer state counts are 1, 24, 413, 5927, 82063 with pinned SHA-256 receipts; six controls and 144 optimized-versus-literal matrix checks pass.", + "author": "Cinna Davis", + "ai_assistance": "OpenAI Codex provided substantial assistance with the scope screening, exact model, exhaustive state search, proof explanation, and verifier/package preparation.", + "open_questions": [ + { + "question": "Can an odd-order class-two address group outside Q8/D8 admit a central target whose two-register shared word is shorter than its direct per-register words?", + "why_it_matters": "This package shows no sharing gain for the smallest exponent-three Heisenberg target; a different group may have a longer direct commutator word and leave room for a real call reduction.", + "first_step": "Specify one finite group and generator alphabet, then prove the target word metric and direct multi-register bill before searching rank-one register words.", + "blocked_by": "The next candidate must avoid the current Q8, D8, UT4 and affine-register overlaps and must have an explicit physical or supplier-level relevance." + } + ], + "assignment": { + "seed": "015429fd754bd0937d8449b9ae413a6b", + "track": "bit-mechanisms", + "task_id": "bit-new-register-model", + "priority_revision": 3, + "catalogue_sha256": "6686ad58f1fbdbc87134a78901b60fd53a20d3984355e91defbbebc9e9fa8075", + "base_commit": "0b1cccf86e2f5132ed286a26ef0a681a495740ea", + "selected_record_sha256": "10b9e340fd8e354a37a0c4813c90e5de1dd42044b5f6aca4a3fc5a42b685fa32", + "selected_kappa": "836330098538459/500000000000000000", + "discussion_claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/1167#discussioncomment-18926907" + } +} diff --git a/research/heisenberg-central-pair-seed0154/VERIFY.json b/research/heisenberg-central-pair-seed0154/VERIFY.json new file mode 100644 index 0000000000..694616f231 --- /dev/null +++ b/research/heisenberg-central-pair-seed0154/VERIFY.json @@ -0,0 +1,24 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "certificates/selected-result.json", + "research/bit-three-register-lower-bound/README.md", + "research/bit-dihedral-commutator/README.md", + "research/binary-affine-register-bound/README.md", + "research/coordinate-cnot-register-bound/README.md" + ], + "commands": [ + { + "argv": [ + "{python}", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Exact UT3(F3) group multiplication; complete F2 group-algebra product layers; meet-in-the-middle exclusion for all 0..7-call words; direct 8-call witness; one-target positive and mutation controls; exact receipt comparison; 144 optimized matrix-update crosschecks." + } + ] +} diff --git a/research/heisenberg-central-pair-seed0154/verify.py b/research/heisenberg-central-pair-seed0154/verify.py new file mode 100644 index 0000000000..f1c97f6211 --- /dev/null +++ b/research/heisenberg-central-pair-seed0154/verify.py @@ -0,0 +1,294 @@ +"""Exact meet-in-the-middle search over F2[UT3(F3)].""" + +from hashlib import sha256 +import json +from pathlib import Path + +# H=UT3(F3), encoded by (a,b,c) -> 9*a+3*b+c. Multiplication is +# (a,b,c)(a',b',c')=(a+a', b+b', c+c'+a*b') over F3. +def elem(a, b, c): + return (a % 3) * 9 + (b % 3) * 3 + (c % 3) + + +def decode(g): + return g // 9, (g // 3) % 3, g % 3 + + +def group_mul(g, h): + a, b, c = decode(g) + ap, bp, cp = decode(h) + return elem(a + ap, b + bp, c + cp + a * bp) + + +def group_inverse(g): + a, b, c = decode(g) + return elem(-a, -b, -c + a * b) + + +def group_pow(g, n): + out = 0 + for _ in range(n): + out = group_mul(out, g) + return out + + +IDENTITY = elem(0, 0, 0) +X = elem(1, 0, 0) +X_INV = elem(2, 0, 0) +Y = elem(0, 1, 0) +Y_INV = elem(0, 2, 0) +Z = elem(0, 0, 1) +Z_INV = elem(0, 0, 2) +LABELS = (X, X_INV, Y, Y_INV) +LABEL_INVERSE = {g: group_inverse(g) for g in LABELS} +COMMUTATOR_WORD = (X, Y, X_INV, Y_INV) +REVERSE_COMMUTATOR_WORD = (Y, X, Y_INV, X_INV) + + +def require(ok, message): + if not ok: + raise RuntimeError(message) + + +def group_ring_mul(a, b): + """Multiply F2[H] elements encoded as 27-bit coefficient masks.""" + result = 0 + left = a + while left: + low_left = left & -left + i = low_left.bit_length() - 1 + right = b + while right: + low_right = right & -right + j = low_right.bit_length() - 1 + result ^= 1 << group_mul(i, j) + right ^= low_right + left ^= low_left + return result + + +def matrix_multiply(a, b): + """Ordinary 2x2 matrix multiplication over the noncommutative group ring.""" + return tuple( + group_ring_mul(a[2 * i], b[j]) ^ group_ring_mul(a[2 * i + 1], b[2 + j]) + for i in range(2) for j in range(2) + ) + + +MATRIX_ID = (1, 0, 0, 1) +TARGET = (1 << Z, 0, 0, 1 << Z) +TARGET_ONE = (1 << Z, 0, 0, 1) + + +def idempotents(): + result = [] + for u in range(1, 4): + for v in range(1, 4): + if ((u & v).bit_count() & 1) == 1: + result.append((u, v)) + require(len(result) == 6, "wrong number of rank-one idempotents") + return tuple(result) + + +IDEMPOTENTS = idempotents() +OPERATIONS = tuple((n, g) for n in IDEMPOTENTS for g in LABELS) + + +def factor(n, g): + u, v = n + delta = (1 << g) ^ 1 # [g] + [e] over F2. + entries = [] + for i in range(2): + for j in range(2): + value = 1 if i == j else 0 + if ((u >> i) & 1) and ((v >> j) & 1): + value ^= delta + entries.append(value) + return tuple(entries) + + +FACTORS = {op: factor(*op) for op in OPERATIONS} + + +def matrix_right_factor(matrix, op): + """Right-multiply by D_N(g)=I+([g]+[e])N, using N=u v^T.""" + u, v = op[0] + delta = (1 << op[1]) ^ 1 + out = [] + for i in range(2): + added = 0 + if u & 1: + added ^= group_ring_mul(matrix[2 * i], delta) + if u & 2: + added ^= group_ring_mul(matrix[2 * i + 1], delta) + for j in range(2): + value = matrix[2 * i + j] + if (v >> j) & 1: + value ^= added + out.append(value) + return tuple(out) + + +def product_of(word): + result = MATRIX_ID + for op in word: + result = matrix_right_factor(result, op) + return result + + +def inverse_word(word): + return tuple((n, LABEL_INVERSE[g]) for n, g in reversed(word)) + + +def state_bytes(matrix): + return b"".join(value.to_bytes(4, "little") for value in matrix) + + +def build_layers(max_depth): + """Exhaustive product states; one representative word per equal state.""" + layers = [{MATRIX_ID: ()}] + for _depth in range(1, max_depth + 1): + current = {} + for matrix, word in layers[-1].items(): + for op in OPERATIONS: + current.setdefault(matrix_right_factor(matrix, op), word + (op,)) + layers.append(current) + return layers + + +def layer_receipts(layers): + receipts = [] + for depth, layer in enumerate(layers): + digest = sha256(b"".join(state_bytes(state) for state in sorted(layer))).hexdigest() + receipts.append((depth, 24 ** depth, len(layer), digest)) + return receipts + + +def search_upto(layers, maximum, target=TARGET): + # For a split P S=T, all paid factors are invertible, so S=P^-1 T. + # Exhaustive reachable-state layers therefore decide every word at each length. + splits = [] + for length in range(maximum + 1): + left_len = length // 2 + right_len = length - left_len + left_layer, right_layer = layers[left_len], layers[right_len] + checked_prefixes = 0 + for prefix_state, prefix_word in left_layer.items(): + checked_prefixes += 1 + inverse_state = product_of(inverse_word(prefix_word)) + required_suffix = matrix_multiply(inverse_state, target) + suffix_word = right_layer.get(required_suffix) + if suffix_word is not None: + witness = prefix_word + suffix_word + require(product_of(witness) == target, + "meet-in-the-middle witness fails literal product replay") + splits.append((length, left_len, right_len, len(left_layer), len(right_layer), checked_prefixes, True)) + return witness, splits + splits.append((length, left_len, right_len, len(left_layer), len(right_layer), checked_prefixes, False)) + return None, splits + + +def direct_eight_word(): + n00 = (1, 1) + n11 = (2, 2) + return tuple((n00, g) for g in COMMUTATOR_WORD) + tuple((n11, g) for g in COMMUTATOR_WORD) + + +def one_target_four_word(): + return tuple(((1, 1), g) for g in COMMUTATOR_WORD) + + +def verify_controls(layers): + # Exact group structure and noncommuting label order. + require(len({elem(a, b, c) for a in range(3) for b in range(3) for c in range(3)}) == 27, + "group encoding is not bijective") + require(group_pow(X, 3) == IDENTITY and group_pow(Y, 3) == IDENTITY, + "x and y must have order three") + require(group_pow(Z, 3) == IDENTITY and Z != IDENTITY, "z must have order three") + comm = IDENTITY + for g in COMMUTATOR_WORD: + comm = group_mul(comm, g) + require(comm == Z, "[x,y] != z") + reverse = IDENTITY + for g in REVERSE_COMMUTATOR_WORD: + reverse = group_mul(reverse, g) + require(reverse == Z_INV and Z_INV != Z, "reversed commutator did not invert z") + require(group_mul(X, Y) != group_mul(Y, X), "group multiplication lost noncommutativity") + require(Z not in LABELS and LABELS == (X, X_INV, Y, Y_INV), + "the target address was accidentally admitted as a paid label") + + # Projector family and paid-call inverses. + for u, v in IDEMPOTENTS: + require((u & v).bit_count() & 1, "rank-one matrix is not idempotent") + require(any(((u >> i) & 1) and ((v >> j) & 1) for i in range(2) for j in range(2)), + "zero matrix entered the paid alphabet") + for op in OPERATIONS: + inverse = (op[0], LABEL_INVERSE[op[1]]) + require(matrix_multiply(FACTORS[op], FACTORS[inverse]) == MATRIX_ID, + "paid factor inverse failed") + + # Independently compare the optimized update with full 2x2 matrix products. + matrix_crosschecks = 0 + for a in OPERATIONS[:12]: + for b in OPERATIONS[12:24]: + require(matrix_right_factor(FACTORS[a], b) == matrix_multiply(FACTORS[a], FACTORS[b]), + "optimized update disagrees with literal matrix multiplication") + matrix_crosschecks += 1 + + direct = direct_eight_word() + require(product_of(direct) == TARGET, "direct eight-call positive control failed") + one_target = one_target_four_word() + require(product_of(one_target) == TARGET_ONE, "single-target four-call control failed") + one_target_witness, _ = search_upto(layers, 4, TARGET_ONE) + require(one_target_witness is not None, + "meet-in-the-middle missed the known one-target word") + shortened = one_target[:-1] + require(product_of(shortened) != TARGET_ONE, "omitted commutator letter control escaped") + return 6, matrix_crosschecks + + +def main(): + layers = build_layers(4) + controls, matrix_crosschecks = verify_controls(layers) + witness, splits = search_upto(layers, 7) + receipts = layer_receipts(layers) + layer_rows = [ + {"depth": d, "raw_words": raw, "unique_states": unique, "sha256_sorted_states": digest} + for d, raw, unique, digest in receipts + ] + split_rows = [ + {"length": n, "left_depth": a, "right_depth": b, "left_states": l, + "right_states": r, "prefixes_checked": checked, "target_found": found} + for n, a, b, l, r, checked, found in splits + ] + expected_path = Path(__file__).with_name("EXPECTED.json") + expected = json.loads(expected_path.read_text()) + require(expected["group"] == "UT3(F3)" and expected["group_order"] == 27 + and expected["coefficient_field"] == "F2" and expected["registers"] == 2, + "receipt model does not match this verifier") + require(expected["paid_labels"] == ["x", "x^-1", "y", "y^-1"] + and expected["rank_one_idempotents"] == 6, + "receipt operation alphabet does not match this verifier") + require(expected["target"] == "diag([z],[z]) where z=[x,y]" + and expected["direct_calls"] == 8, + "receipt target or direct bill does not match this verifier") + require(expected["layers"] == layer_rows, "reachable-state receipt differs from EXPECTED.json") + require(expected["length_splits"] == split_rows, "length-split receipt differs from EXPECTED.json") + require(expected["minimum"] == 8 and expected["max_excluded_length"] == 7, + "expected result is not the claimed eight-call boundary") + require(expected["controls"] == {"construction_mutations": 2, + "group_and_algebra_checks": 4, + "matrix_update_crosschecks": 144}, + "receipt control coverage changed") + if witness is not None: + print("FOUND_HEISENBERG_WORD length=%d operations=%r" % (len(witness), witness)) + print("state_layers=%r controls=%d matrix_crosschecks=%d" % (receipts, controls, matrix_crosschecks)) + return 0 + require(product_of(direct_eight_word()) == TARGET, "direct upper bound missing") + print("PASS_HEISENBERG_CENTRAL_PAIR minimum=8 excluded_lengths=0..7 group_order=27 characteristic=2 registers=2 generators=4 idempotents=6 controls=%d matrix_crosschecks=%d state_counts=%r" % + (controls, matrix_crosschecks, [(r[0], r[2]) for r in receipts])) + return 0 + + +if __name__ == "__main__": + raise SystemExit(main())