diff --git a/research/last-call-common-postmap/PROOF.md b/research/last-call-common-postmap/PROOF.md new file mode 100644 index 0000000000..e8cfe2af2d --- /dev/null +++ b/research/last-call-common-postmap/PROOF.md @@ -0,0 +1,128 @@ +# A common free post-map can be moved before the last call + +## Result and model + +Consider one prepared last call followed by one common free map on its output. When the shared part has one level-two leading term and only lower-level companion terms, this post-map adds no power to finishing a level-three target. A target-frame projection forces the post-map to be invertible in a specific subgroup algebra. It can then be moved before the call. + +As a consequence, the nonplain kind B obstruction in [PR #7683](https://github.com/CrocSwap/integer-mult-bounds/pull/7683) also holds with arbitrary common free postprocessing. This includes arbitrary spare address bits and all nonzero rational coefficients. A second result within this same boundary check is an explicit false positive for a larger linear-span test: two independently prepared and independently postprocessed columns can span the target, while one prepared call cannot produce it. The distinction is the common post-map, not the availability of a free matrix. + +Work in `Q[G]`, where `G=Sp(2m,2)`, `m>=3`, and `P=Stab_G(L)` for the raw Lagrangian L. Terms are formal group basis elements. Their level is `ell(g)=m-dim(L intersection g^-1 L)`. Level is invariant under free left or right factors and is subadditive. Free combinations form the algebra `Q[P]`. A paid call T is an involution of level one. + +Let M have level two with `ell(TM)=3`. Let B be any finite collection of terms of level at most one. Let z be any rational combination of terms of level at most one, and set + +```text +y = M+z, +U = sum_(b in B) Q[P] b + Q[P] y, +H = P intersection T P T. +``` + +Every term in U has level at most two. U is closed under left multiplication by `Q[P]`. The most general output under the present one-call contract is + +```text +u+F T v, u,v in U, F in Q[P]. +``` + +The same F acts on the whole output of the one call. It is not assumed invertible. Free preparation of v and free additions of earlier arrays are unrestricted within U. Several consecutive free post-maps compose to one F. + +**Folding theorem.** The target TM has a representation `u+F T v` if and only if it lies in `U+TU`. In every such representation, F is a unit of `Q[H]`, and `F T = T (T F T)` with `T F T` free. + +The statement concerns this fixed target TM and one last call. It does not cover a second last output, multiple call outputs with separate post-maps, a second level-two companion term, Pauli phases, or a physical realization of the free algebra. No new kappa or general two-in-five impossibility follows. + +## Project onto the target's frame + +Let C be the left coset `P TM` and let pi keep only coefficients with indices in C. Every term in C has level three. Since free left multiplication preserves each left coset of P, pi commutes with left multiplication by every F in `Q[P]`. + +For any p in P and b in B, `Tpb` has level at most two. The same bound holds for every term of `Tpz`. Hence only the leading term `TpM` can contribute to `pi(Tv)`. It belongs to C exactly when + +```text +(TpM)(TM)^-1 = TpT is in P. +``` + +In that case `h=TpT` lies in H, since `ThT=p` is also free. Conversely every h in H has this form with p free. Therefore + +```text +pi(Tv) = A TM for some A in Q[H]. +``` + +Also `pi(u)=0`. If `TM=u+F T v`, projection gives `TM=F A TM`. The group term TM is invertible, so + +```text +F A = 1. +``` + +This is an identity in the full free group algebra. It is not a coefficient equation in a quotient where extra support can be ignored. + +## A one-sided inverse stays in the subgroup algebra + +P and H are finite groups. From `FA=1`, left multiplication by A is injective on the finite-dimensional space `Q[H]`: `Ax=0` implies `x=FAx=0`. It is therefore surjective on that space. There is a B0 in `Q[H]` with `A B0=1`. + +Now `F=F A B0=B0`. Thus F belongs to `Q[H]` and is the two-sided inverse of A. This proves invertibility rather than assuming it. It also excludes a singular post-map that tries to erase other level-three frames. + +By the definition of H, `T F T` belongs to `Q[P]`. Consequently + +```text +F T v = T (T F T) v is in TU. +``` + +The last inclusion uses the left `Q[P]` stability of U. Thus every postprocessed finishing witness is already a call-alone witness. The reverse direction uses F=1. This proves the folding theorem at every address width. It does not require an enumeration of the group or a choice of coefficients in z. + +## Corollary for nonplain kind B + +Take `B={1,D}`, `M=WD` and `z=cW gamma`, where D,W,T are paid calls, gamma is free, `c!=0`, `ell(TWD)=3`, and `W gamma` is outside PD. The sole companion term has level one. All hypotheses of the folding theorem hold. + +The [call-alone proof at its exact head](https://github.com/aliromman/integer-mult-bounds/blob/9b99d7b30972a78e1ad0e90dd6ff3187bd3cc86c/research/kind-b-last-call-obstruction/PROOF.md) gives `TM` outside `U+TU`. It supplies a two- or three-coordinate separating functional for that space. Folding therefore rules out `TM=u+F T v` for every common F and every u,v in U. No nonplain kind B part finishes under this one-call postprocessing contract, including with spare bits. + +This strengthens the stated call-alone boundary. It still leaves joint decoding, different shared-call arrangements and extra high-level terms open. It is a formal-frame result, not a physical engine lower bound. + +## A relaxed span gives a false positive + +Use three address bits and binary row-matrix encoding in order `(x0,x1,x2,z0,z1,z2)`. Let `D=t_1`, `W=t_2`, `T=t_5`, with pure horizontal normals given by those bit masks. Use the following free matrices, with each row written as its bit mask: + +```text +gamma = (1,2,5,40,16,32), +R = (5,4,2,8,40,16), +S = (3,5,2,40,32,56). +``` + +Here gamma swaps D and T by conjugation and commutes with W. Also `R T R^-1=W` and `S=R^-1 gamma`. Set `M=WD`, `E=W gamma` and `y=M+cE`. The target TM has level three and E is nonplain. Exact multiplication gives + +```text +TE = E D = R T S D, +TM = T y - c R T (S D). +``` + +The right side belongs to the linear span of independently prepared and independently postprocessed columns: one input is y with identity post-map, and the other input is SD with post-map R. Both inputs are in U. But the theorem proves that no single common F on one prepared call produces TM, for any nonzero rational c. This identity can be executed with two separate calls; treating its column span as one call loses the common-factor constraint. + +The checker also verifies the exact call-alone separator for this example over all 10752 free preparations, with polynomial coefficients in c. Its support is `TM,TE,gamma E`, with weights `c^2,-c,1`. Every old or paid binomial and earlier singleton is killed. The relaxed identity is checked at five nonzero rational coefficients; its displayed symbolic equality proves it for all c. This is a counterexample to sufficiency of the relaxed test, not a construction of a two-in-five unit. + +## Why the low-level companion condition matters + +Kind A can have a second level-two term. The folding theorem then does not apply. A positive control uses `D=t_1`, `W=t_2`, `T=t_4`, + +```text +gamma_A = (1,2,6,8,52,34), +E_A = W gamma_A D, +h = (1,6,4,8,20,50). +``` + +E_A has level two and a different frame from M. The free element h has order two, lies outside H, and satisfies `T E_A=h TM`. For coefficient two, + +```text +T (M+2E_A) = (1+2h) TM, +F = (2h-1)/3, +F T (M+2E_A) = TM. +``` + +This is one actual prepared call followed by one common free map. The target-coset coefficient is now `1+2h`, which lies outside `Q[H]` because the second high-level term also contributes. This verifies the boundary of the new lemma. The existence of kind A post-call gains is prior work in [PR #7629](https://github.com/CrocSwap/integer-mult-bounds/pull/7629) and [PR #7649](https://github.com/CrocSwap/integer-mult-bounds/pull/7649); this example is a control, not a new claimed construction. + +## Exact checks and limits + +The finite checker enumerates all 10752 three-bit free elements and all 32 calls that raise the fixed `WD` to level three. It checks all 344064 preparation/call pairs. Exactly 768 columns survive the target-frame projection for each call, for 24576 surviving columns in total. Every survivor is in the intersection subgroup. All paid earlier inputs and every kind B companion family stay below level three. The latter check is independent of gamma because a free factor on the right does not change level. + +For all 32 calls, explicit group-algebra units and their inverses verify the fold. Nonunit examples have a checked nonzero kernel, and an outside-subgroup unit has an inverse outside the required projection space. Ninety-six wider conjugated contracts at widths four through six verify these unit and nonunit statements with a spare coordinate in the conjugation. The relaxed false positive and the kind A positive control are checked as exact group-algebra identities. [Receipt and matrices](RESULT.json) · [Verifier](verify.py) + +These finite checks support the proof; they do not enumerate arbitrary rational post-maps or all wider groups. The prior call-alone proof is a mathematical dependency, not a runtime import. Its full census was not rerun. Native operators, selected cold replay, Lean and Docker were not run. Independent human and formal-kernel review are unclaimed. All five selected assumptions and the selected frontier remain unchanged. + +## Attribution + +Prepared by Ali Romman with substantial OpenAI Codex assistance. Jacob Sussman supplied the kind B definitions and the untested post-call question in [PR #7629](https://github.com/CrocSwap/integer-mult-bounds/pull/7629), [pinned source](https://github.com/jacobalansussman/integer-mult-bounds/blob/c2a2131e7dba35f9396b16588e125a7e8b5fab8e/research/complex-m3-shared-call-finish-or-remove/README.md). Nick Petalas supplied the related coset method and post-call boundary in [PR #7649](https://github.com/CrocSwap/integer-mult-bounds/pull/7649), [pinned proof](https://github.com/petalas/integer-mult-bounds/blob/f642d2740265a61f8ac64b3a087f0118382c56e3/research/kind-a-last-call-coset/README.md). Ali Romman's [PR #7683](https://github.com/CrocSwap/integer-mult-bounds/pull/7683) supplies the call-alone obstruction used in the corollary. Binary matrix routines are reused from that package and its [PR #7679](https://github.com/CrocSwap/integer-mult-bounds/pull/7679) predecessor. The common-factor proof and exact separation from the relaxed column span are the new work. New work is Apache-2.0. diff --git a/research/last-call-common-postmap/README.md b/research/last-call-common-postmap/README.md new file mode 100644 index 0000000000..28efcfeb95 --- /dev/null +++ b/research/last-call-common-postmap/README.md @@ -0,0 +1,37 @@ +# Enforce one common free map after one last call + +If a shared part has one level-two leading term and only lower-level companions, a free map on one last-call output adds no finishing power. Projection onto the level-three target frame forces that map to be an invertible element of `Q[P intersection TPT]`. It can be moved before the call. + +For nonplain kind B parts, the [call-alone obstruction #7683](https://github.com/CrocSwap/integer-mult-bounds/pull/7683) therefore extends to arbitrary common free postprocessing, at every address width and every nonzero rational coefficient. An explicit two-column identity shows why the larger span of independently postprocessed calls is insufficient as a one-call test. A known kind A post-call mechanism gives a positive control when there is a second level-two term. + +[Proof and scope](PROOF.md) · [Exact receipt and matrices](RESULT.json) · [Verifier](verify.py) · [Task and questions](TASK.json) + +No general two-in-five impossibility, joint decoder, phase lift, native word or kappa improvement is claimed. The theorem concerns one common map applied to one prepared call output. The call-alone proof is a mathematical dependency and is linked at its exact commit. + +## Reproduce + +Use CPython 3.12 and its standard library. No external file is read at run time. + +```sh +python3.12 -I -W error -B research/last-call-common-postmap/verify.py +python3.12 -I -W error -B -O research/last-call-common-postmap/verify.py +python3.12 -B scripts/research_package.py --package research/last-call-common-postmap +``` + +Expected status: `PASS_LAST_CALL_COMMON_POSTMAP`. The verifier checks all 344064 three-bit preparation/call pairs, all 24576 surviving target-frame columns, 32 unit/nonunit cases, 96 wider conjugated contracts, the relaxed-span false positive and an actual kind A one-call post-map. The latter is a boundary control, not a new construction. Each registered command has a 120-second bound. + +The written proof covers all widths and all common free maps. Finite checks do not enumerate arbitrary rational maps or the full wider groups. The predecessor's full call-alone census, native operators, selected cold replay, Lean and Docker were not rerun. Independent human and formal-kernel review are unclaimed. + +## Task and scope + +Base: canonical main `e54523517d0f03e58352e647c403a5af3e525a57`, priority revision 8, card `complex-rank-shape-decoder` refined to the post-call boundary. The [advance claim](https://github.com/CrocSwap/integer-mult-bounds/discussions/1166#discussioncomment-19704278) explicitly separates a relaxed span from one common-map realization. The family gate keeps this a bounded proof task; no physical cost or supplier gain is inferred. Refreshed open/closed PR and Discussion overlap contains the earlier finite, kind A and call-alone results. Sparse local and unpublished work remain coverage limits. + +## Open next questions + +Can two last outputs jointly decode both input parts? Keep separate common-map factors for each physical output. The relaxed identity here uses two calls and shows why freely summing prepared/postprocessed columns can undercount them. + +Can the target-frame unit argument handle two or more high-level companions? First compute their full projected coefficient algebra. The kind A control shows that it can exceed the intersection subgroup and that the present fold then fails. A phase lift and full physical invoice remain separate obligations. [Structured questions](TASK.json) + +## Credit + +Prepared by Ali Romman with substantial OpenAI Codex assistance. Credit Jacob Sussman for the definitions and kind B post-call question in [PR #7629](https://github.com/CrocSwap/integer-mult-bounds/pull/7629), [exact source](https://github.com/jacobalansussman/integer-mult-bounds/blob/c2a2131e7dba35f9396b16588e125a7e8b5fab8e/research/complex-m3-shared-call-finish-or-remove/README.md); Nick Petalas for the related coset method and boundary in [PR #7649](https://github.com/CrocSwap/integer-mult-bounds/pull/7649), [exact proof](https://github.com/petalas/integer-mult-bounds/blob/f642d2740265a61f8ac64b3a087f0118382c56e3/research/kind-a-last-call-coset/README.md); and Ali Romman's [PR #7683](https://github.com/CrocSwap/integer-mult-bounds/pull/7683), [exact call-alone proof](https://github.com/aliromman/integer-mult-bounds/blob/9b99d7b30972a78e1ad0e90dd6ff3187bd3cc86c/research/kind-b-last-call-obstruction/PROOF.md), for the corollary's required predecessor. Its binary matrix code, originally from [PR #7679](https://github.com/CrocSwap/integer-mult-bounds/pull/7679), is reused. New work is Apache-2.0. diff --git a/research/last-call-common-postmap/RESULT.json b/research/last-call-common-postmap/RESULT.json new file mode 100644 index 0000000000..7874776780 --- /dev/null +++ b/research/last-call-common-postmap/RESULT.json @@ -0,0 +1,63 @@ +{ + "status": "PASS_LAST_CALL_COMMON_POSTMAP", + "projection_census": { + "preparation_call_pairs": 344064, + "finishing_calls": 32, + "surviving_projection_columns": 24576, + "unit_and_nonunit_checks": 32 + }, + "wider_unit_contracts": 96, + "relaxed_span_counterexample": { + "gamma_rows": [ + 1, + 2, + 5, + 40, + 16, + 32 + ], + "last_normal": 5, + "post_rows": [ + 5, + 4, + 2, + 8, + 40, + 16 + ], + "prep_rows": [ + 3, + 5, + 2, + 40, + 32, + 56 + ], + "nonzero_coefficients_checked": 5, + "separator_columns_checked": 21504, + "meaning": "The relaxed span accepts two independently prepared/postprocessed columns; the common-map theorem excludes one call." + }, + "higher_term_positive_control": { + "gamma_rows": [ + 1, + 2, + 6, + 8, + 52, + 34 + ], + "post_binomial_rows": [ + 1, + 6, + 4, + 8, + 20, + 50 + ], + "post_binomial_order": 2, + "coefficient": "2", + "extra_level": 2, + "actual_one_call_finish": true + }, + "scope": "One common free post-map on one call output, with a unique level-two leading term and only lower-level companions; no joint decoder or kappa." +} diff --git a/research/last-call-common-postmap/SOURCES.json b/research/last-call-common-postmap/SOURCES.json new file mode 100644 index 0000000000..5335fa97d9 --- /dev/null +++ b/research/last-call-common-postmap/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/last-call-common-postmap/TASK.json b/research/last-call-common-postmap/TASK.json new file mode 100644 index 0000000000..ab588df9fb --- /dev/null +++ b/research/last-call-common-postmap/TASK.json @@ -0,0 +1,81 @@ +{ + "schema_version": 1, + "task_id": "complex-rank-shape-decoder", + "priority_revision": 8, + "base_commit": "e54523517d0f03e58352e647c403a5af3e525a57", + "original_card": { + "id": "complex-rank-shape-decoder", + "question": "Can a legal decoder or coframe change improve the full signed moment, including changed helper targets?", + "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", + "docs/research/recursive-invoice-preflight.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": "Price one complete changed itinerary with both paid and productive histograms. Check #5693/#5698 for overlap and their exact hypotheses before another coframe search. Use the signed invoice preflight where its boundary contract agrees; an inconclusive concave comparison is not a power crossing. Stop if an optimistic complete budget fails at the chosen target or native delivery remains unspecified.", + "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": [ + "coframe", + "signed moment", + "5693", + "5698" + ], + "existing_checks": [ + { + "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": "refined", + "actual_scope": "Prove that a common free post-map folds before one call when the leading level-two term is unique; apply this to kind B and separate the physical one-call model from a relaxed column span.", + "scope_change_reason": "The finite source leaves kind B postprocessing untested. This proof retains the common post-map constraint and resolves that single-output boundary, rather than treating independent column spans as physical calls.", + "bottleneck_link": "It closes a post-call route for kind B and gives a concrete false positive that a joint-decoder search must reject when counting calls.", + "budget_minutes": 60, + "stop_rule": "Stop at the general folding proof, kind B corollary, relaxed-span counterexample and exact controls. Joint outputs, higher-level companion terms and physical costs remain separate.", + "outcome": "completed", + "evidence": "PROOF.md; RESULT.json; complete 344064-pair projection table, exact units/nonunits, 96 wider contracts, relaxed-span identity and kind A positive boundary control.", + "author": "Ali Romman", + "ai_assistance": "Substantial OpenAI Codex assistance; independent human and formal-kernel review unclaimed.", + "open_questions": [ + { + "question": "Can two last outputs jointly decode both parts with one common post-map per output?", + "why_it_matters": "Independent column spans can count two physical calls as one.", + "first_step": "Retain separate preparation and post-map factors for each actual output.", + "blocked_by": "No joint factorized decoder or complete invoice is supplied." + }, + { + "question": "What projected algebra replaces the subgroup algebra for several high-level companions?", + "why_it_matters": "The kind A positive control shows that the simple fold can fail.", + "first_step": "Compute all coefficients on the target frame before imposing a unit condition.", + "blocked_by": "This proof assumes one leading term and only lower-level companions." + } + ] +} diff --git a/research/last-call-common-postmap/VERIFY.json b/research/last-call-common-postmap/VERIFY.json new file mode 100644 index 0000000000..8f86e31da1 --- /dev/null +++ b/research/last-call-common-postmap/VERIFY.json @@ -0,0 +1,34 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Complete target-frame projection, exact subgroup inverses/nonunits, wider conjugations, relaxed-span false positive and actual higher-term post-map control." + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "-O", + "{package}/verify.py" + ], + "timeout_seconds": 120, + "checks": "Complete target-frame projection, exact subgroup inverses/nonunits, wider conjugations, relaxed-span false positive and actual higher-term post-map control." + } + ] +} diff --git a/research/last-call-common-postmap/verify.py b/research/last-call-common-postmap/verify.py new file mode 100644 index 0000000000..432ae579e9 --- /dev/null +++ b/research/last-call-common-postmap/verify.py @@ -0,0 +1,288 @@ +#!/usr/bin/env python3 +"""Check the common post-map restriction and the relaxed-span counterexample. + +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +""" +from collections import Counter +from fractions import Fraction +import json +from pathlib import Path + +ROOT = Path(__file__).resolve().parent +COEFFICIENTS = (Fraction(1), Fraction(-1), Fraction(2), Fraction(1, 2), Fraction(-2, 3)) + + +def need(ok, message): + if not ok: + raise ValueError(message) + + +def unit(n): + return tuple(1 << i for i in range(n)) + + +def mul(a, b): + rows = [] + for row in a: + value = 0 + while row: + bit = row & -row + value ^= b[bit.bit_length()-1] + row ^= bit + rows.append(value) + return tuple(rows) + + +def transpose(a): + return tuple(sum(((row >> j) & 1) << i for i, row in enumerate(a)) for j in range(len(a))) + + +def inv(a): + n = len(a) + rows = [row | (1 << (n+i)) for i, row in enumerate(a)] + for i in range(n): + j = next(j for j in range(i, n) if rows[j] & (1 << i)) + rows[i], rows[j] = rows[j], rows[i] + for j in range(n): + if j != i and rows[j] & (1 << i): + rows[j] ^= rows[i] + return tuple(row >> n for row in rows) + + +def rank2(rows): + pivots = {} + for row in rows: + while row: + i = row.bit_length()-1 + if i not in pivots: + pivots[i] = row + break + row ^= pivots[i] + return len(pivots) + + +def is_free(g): + m = len(g)//2 + return all(row >> m == 0 for row in g[:m]) + + +def level(g): + m = len(g)//2 + return rank2(row >> m for row in g[:m]) + + +def call(m, normal): + paired = ((normal & ((1 << m)-1)) << m) | (normal >> m) + return tuple((1 << i) ^ (paired if normal & (1 << i) else 0) for i in range(2*m)) + + +def all_free(m): + def bases(rows): + if len(rows) == m: + yield tuple(rows) + else: + for x in range(1, 1 << m): + if rank2([*rows, x]) > len(rows): + yield from bases([*rows, x]) + places = [(i, j) for i in range(m) for j in range(i, m)] + form = tuple(1 << ((i+m) % (2*m)) for i in range(2*m)) + result = [] + for a in bases([]): + b = transpose(inv(a)) + for mask in range(1 << len(places)): + s = [0]*m + for bit, (i, j) in enumerate(places): + if mask & (1 << bit): + s[i] |= 1 << j + s[j] |= 1 << i + lower = mul(b, s) + g = a + tuple(lower[i] | (b[i] << m) for i in range(m)) + need(is_free(g) and mul(mul(g, form), transpose(g)) == form, 'free symplectic matrix') + result.append(g) + need(len(result) == len(set(result)) == 10752, 'three-bit free group') + return result + + +def orbit(start, step): + points = [start] + point = mul(start, step) + while point != start: + need(point not in points, 'orbit closure') + points.append(point) + point = mul(point, step) + return points + + +def algebra_sum(*terms): + result = {} + for coefficient, word in terms: + for g, value in word.items(): + total = result.get(g, 0)+coefficient*value + if total: + result[g] = total + else: + result.pop(g, None) + return result + + +def algebra_product(a, b): + result = {} + for g, x in a.items(): + for h, y in b.items(): + term = mul(g, h) + total = result.get(term, 0)+x*y + if total: + result[term] = total + else: + result.pop(term, None) + return result + + +def inverse_binomial(h, coefficient): + powers = orbit(unit(len(h)), h) + divisor = 1-(-coefficient)**len(powers) + need(divisor != 0, 'singular binomial') + return {g: Fraction((-coefficient)**j, divisor) for j, g in enumerate(powers)} + + +def in_intersection(g, last): + return is_free(g) and is_free(mul(mul(last, g), last)) + + +def unit_checks(last, inside, outside): + identity = {unit(len(last)): Fraction(1)} + a = algebra_sum((1, identity), (2, {inside: Fraction(1)})) + f = inverse_binomial(inside, 2) + need(algebra_product(f, a) == algebra_product(a, f) == identity, 'two-sided free inverse') + need(all(in_intersection(g, last) for g in f), 'inverse stays in intersection') + pushed = {mul(mul(last, g), last): value for g, value in f.items()} + need(all(is_free(g) for g in pushed), 'pushed input map is free') + need(algebra_product(f, {last: 1}) == algebra_product({last: 1}, pushed), 'common post-map fold') + kernel = {g: Fraction(1) for g in orbit(unit(len(last)), inside)} + singular = algebra_sum((1, identity), (-1, {inside: Fraction(1)})) + need(kernel and not algebra_product(singular, kernel), 'singular projection has a nonzero kernel') + outside_inverse = inverse_binomial(outside, 2) + need(any(not in_intersection(g, last) for g in outside_inverse), 'outside inverse cannot be a projection') + return {'inside_order': len(kernel), 'outside_order': len(outside_inverse)} + + +def projection_census(group): + first, shared = call(3, 1), call(3, 2) + middle = mul(shared, first) + counts = Counter(); witnesses = [] + for normal in range(1, 64): + last = call(3, normal) + target = mul(last, middle) + if level(target) != 3: + continue + target_inverse = inv(target) + intersection = [] + outside = None + for p in group: + tp = mul(last, p) + need(level(tp) == 1 and level(mul(tp, first)) <= 2, 'earlier paid inputs stay below target') + need(level(mul(tp, shared)) <= 2, 'every kind B extra stays below target') + point = mul(tp, middle) + relative = mul(point, target_inverse) + conjugate = mul(tp, last) + need(relative == conjugate, 'target-coset coefficient') + if is_free(relative): + need(in_intersection(relative, last), 'projection is in subgroup algebra') + intersection.append(relative) + else: + outside = p + counts['preparation_call_pairs'] += 1 + need(len(intersection) == len(set(intersection)) == 768, 'complete intersection') + inside = next(g for g in intersection if g != unit(6)) + unit_checks(last, inside, outside) + witnesses.append((last, inside, outside)) + counts['finishing_calls'] += 1 + counts['surviving_projection_columns'] += len(intersection) + need(counts['finishing_calls'] == 32 and counts['preparation_call_pairs'] == 344064, 'complete projection domain') + counts['unit_and_nonunit_checks'] = len(witnesses) + return dict(counts), witnesses + + +def relaxed_span_control(group): + first, shared, last = call(3, 1), call(3, 2), call(3, 5) + gamma = (1, 2, 5, 40, 16, 32) + post = (5, 4, 2, 8, 40, 16) + prep = (3, 5, 2, 40, 32, 56) + middle, extra = mul(shared, first), mul(shared, gamma) + target, second, third = mul(last, middle), mul(last, extra), mul(gamma, extra) + need(all(is_free(g) for g in (gamma, post, prep)), 'relaxed maps are free') + need(level(target) == 3 and not is_free(mul(extra, first)), 'nonplain relaxed example') + need(mul(mul(mul(post, last), prep), first) == second, 'second independently postprocessed column') + # The complete call-alone separator is checked once, as a polynomial in c. + weights = {target: (2, 1), second: (1, -1), third: (0, 1)} + for p in group: + tp = mul(last, p) + need(all(g not in weights for g in (p, mul(p, first), tp, mul(tp, first))), 'relaxed control singleton') + for left in (p, tp): + polynomial = Counter() + for g, shift in ((mul(left, middle), 0), (mul(left, extra), 1)): + if g in weights: + power, sign = weights[g] + polynomial[power+shift] += sign + need(all(x == 0 for x in polynomial.values()), 'relaxed control exact separator') + for c in COEFFICIENTS: + y = {middle: Fraction(1), extra: c} + first_column = algebra_product({last: 1}, y) + second_column = algebra_product({post: 1}, algebra_product({last: 1}, {mul(prep, first): 1})) + need(algebra_sum((1, first_column), (-c, second_column)) == {target: 1}, 'relaxed two-column identity') + return {'gamma_rows': list(gamma), 'last_normal': 5, 'post_rows': list(post), 'prep_rows': list(prep), + 'nonzero_coefficients_checked': len(COEFFICIENTS), 'separator_columns_checked': 2*len(group), + 'meaning': 'The relaxed span accepts two independently prepared/postprocessed columns; the common-map theorem excludes one call.'} + + +def kind_a_control(): + first, shared, last = call(3, 1), call(3, 2), call(3, 4) + gamma = (1, 2, 6, 8, 52, 34) + middle = mul(shared, first) + extra = mul(mul(shared, gamma), first) + target = mul(last, middle) + h = mul(mul(last, extra), inv(target)) + need(is_free(gamma) and is_free(h) and level(extra) == 2, 'kind A higher extra term') + need(not is_free(mul(extra, inv(middle))) and not in_intersection(h, last), 'kind A breaks the projection restriction') + a = {unit(6): Fraction(1), h: Fraction(2)} + f = inverse_binomial(h, 2) + y = {middle: Fraction(1), extra: Fraction(2)} + need(algebra_product({last: 1}, y) == algebra_product(a, {target: 1}), 'kind A same post-call frame') + need(algebra_product(f, algebra_product({last: 1}, y)) == {target: 1}, 'actual one-call post-map control') + return {'gamma_rows': list(gamma), 'post_binomial_rows': list(h), 'post_binomial_order': len(f), + 'coefficient': '2', 'extra_level': 2, 'actual_one_call_finish': True} + + +def embed(g, m): + places = [0, 1, 2, m, m+1, m+2] + out = list(unit(2*m)) + for old, new in enumerate(places): + out[new] = sum(((g[old] >> j) & 1) << places[j] for j in range(6)) + return tuple(out) + + +def wider(witnesses): + count = 0 + for m in (4, 5, 6): + h = call(m, (1 << m) | (1 << (2*m-1))) + need(is_free(h), 'spare-bit conjugation') + for triple in witnesses: + changed = [mul(mul(h, embed(g, m)), h) for g in triple] + unit_checks(*changed) + count += 1 + return count + + +def compute(): + group = all_free(3) + counts, witnesses = projection_census(group) + return {'status': 'PASS_LAST_CALL_COMMON_POSTMAP', 'projection_census': counts, + 'wider_unit_contracts': wider(witnesses), 'relaxed_span_counterexample': relaxed_span_control(group), + 'higher_term_positive_control': kind_a_control(), + 'scope': 'One common free post-map on one call output, with a unique level-two leading term and only lower-level companions; no joint decoder or kappa.'} + + +if __name__ == '__main__': + result = compute() + need(json.loads((ROOT/'RESULT.json').read_text()) == result, 'retained result') + print(json.dumps(result, indent=2, sort_keys=True))