diff --git a/research/p104-signed-mixed-carrier-bank/CLAIM.md b/research/p104-signed-mixed-carrier-bank/CLAIM.md new file mode 100644 index 0000000000..fb190c2c65 --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/CLAIM.md @@ -0,0 +1,10 @@ +# Bounded innovation experiment: signed mixed-term bank + +- Research object: bypass the fixed-term carrier premise of CrocSwap PR #1125 without claiming a new κ. +- Base geometry: PR #968 and merged PR #1125, with PR #2820 finite projection-width audit as context. +- Hypothesis: a redundant two-variant bank of reusable pair sums may reduce exact abstract target delivery frame moves and data ADDs, even after paid mixer creation. +- Explicit class: binary F₂ frame/subspace access and integer ±1 scalar READ/ADD; targets monotone; input and mixed carriers return to home after each read; new helpers permitted to terminate with data; no physical compiler certification. +- Tested alternatives: 105 perfect matchings and every one of 4096 cube-edge mixer banks; an independent optimizer and exact 2288 sign assignments; one full signed E8 frame pair exemplar. +- Findings: 12-edge bank, 24 signed helpers, 288 ADDs and 1312 frame rank vs 416 and 2224 in the given direct schedule. Eight-edge bank gives same 288 ADDs, 1328 rank with 16 helpers. Restricted global replacement-basis no-go over Q also independently checked. +- Stopping rule: terminate after complete finite bank search and verification; do not infer full recursive improvement without physical word, paid host/cleanup and outer moment replay. +- Attribution: CrocSwap predecessors #968 and #1125 (Ali Romman), user @Chrisbryan17's #2820; substantial GPT-6 assistance. Apache-2.0. No upstream modifications, merge, frontier edit, or new κ claim. \ No newline at end of file diff --git a/research/p104-signed-mixed-carrier-bank/NATIVE_GATE.md b/research/p104-signed-mixed-carrier-bank/NATIVE_GATE.md new file mode 100644 index 0000000000..b41232793d --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/NATIVE_GATE.md @@ -0,0 +1,21 @@ +# Native realization gate: direct E8 root-line adapter fails + +The prior schematic signed mixed-carrier bank places new scalar values on binary labels \(u_i+u_j\). This is a valid **formal vector-space** line but not an existing E8 **root line**. + +In the standard P104 label realization \(u_r=(\mathrm{rootBits}(r),1)\in\mathbb F_2^9\), every root-line label has ninth coordinate 1, whereas a sum of two root-line labels has ninth coordinate 0. Hence no two-root sum equals any root-line label. This applies to all 120 E8 root lines, not just one selected decoder. + +`root_line_gate.py` reconstructs the exact 120-by-120 mod-2 pairing signatures from 240 doubled-coordinate E8 roots and checks all 7,140 distinct pairs. No XOR of two root signatures equals another root signature. This is independent of the selected P104 frame. + +**Implication:** a proposed implementation cannot simply relabel a mixed sum as another primitive root-line carrier. One must exhibit a legal generalized frame/phase and scalar word, or another encoding. The result does **not** rule out all arbitrary one-dimensional subspaces of the nine-dimensional label space, nor block generalized-frame constructions. + +Required next gate: specify permissible registers, phase conversions, and source/copy/erase/restore primitives; compile an exact signed example; count the extra child ranks and cleanup operations; then compare the full paid moment with current selected frontier. Until then, the 30.8% ADD and 41% frame-rank savings are schematic rather than multiplication bounds. + +## Follow-up: rank-two home frame avoids the line-label obstruction + +The even-parity obstruction excludes *single original E8 root-line names* for mixed values, not the rank-two subspace `U_ij=span(u_i,u_j)` built from **two existing root labels**. A mixed auxiliary can stay in `U_ij` throughout target delivery in the relaxed source/target frame trace. For each target whose support contains both indices, `U_ij` is contained in its target sink, and a single signed arithmetic ADD reads the value. + +`rank2_gate.py` constructs these home frames, executes exact symbolic target outputs, returns each original source to its rank-one home, reverses every mixer preparation, and erases all 16 auxiliaries to frame zero. It checks all 2288 signed target cases. Across 4096 cube-edge banks, the 8-edge bank has **320 ADDs, 1520 frame-rank moves, 16 auxiliaries**; the stipulated direct baseline has 416 ADDs, 2224 frame-rank moves. There are six symmetry-related minimizing 8-edge bank masks. + +Per 8-edge bank, mixer build+erase costs 64+64 frame-rank units and 32+32 signed ADDs; target paths supply the rest. The two-dimensional carrier home adds a small modeled read cost relative to a non-root composite rank-one label, but eliminates the requirement for a non-existent physical root line. The earlier rank-one bank with explicit cleanup is separately checked by `zero_restore.py` and costs 320 ADDs / 1408 rank units, but still needs new line-alphabet realization. + +**This does not certify a native carrier.** The real E8 compiler must prove a legal rank-two carrier storing the mixed scalar, correct operator phase, source access, routing, physical inverse, precision, live helper ownership, all child rank charges, and a complete selected-moment budget. Generalized algebraic frame inclusion alone does not establish these properties. diff --git a/research/p104-signed-mixed-carrier-bank/PROOF.md b/research/p104-signed-mixed-carrier-bank/PROOF.md new file mode 100644 index 0000000000..4399aa71b0 --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/PROOF.md @@ -0,0 +1,54 @@ +# Signed pair-mixture carriers: finite schematic proof and restrictions + +## A. The frame-line identity + +Let `u_0,...,u_7` denote the independent binary labels in the reviewed P104 model, and `H_t` the target's binary hyperplane. Define `S_t={i:u_i∈H_t}`. For any two distinct indices `i,j`, because `H_t` is the kernel of a linear functional `λ_t`, + +`λ_t(u_i+u_j)=λ_t(u_i)+λ_t(u_j)∈F₂`. + +Therefore `u_i+u_j∈H_t` iff either `i,j ∈ S_t` or `i,j ∉ S_t`. This identity is independent of target signs. In the former case either integer data `x_i+x_j` or `x_i−x_j` on a *new allowed carrier with line* `` can replace the two individual signed reads: for `c_i,c_j∈{−1,1}` choose `m⁺` if `c_i=c_j`, else `m⁻`, and add it to the target with sign `c_i`. Then exactly `c_i m^± = c_i x_i + c_j x_j`. + +This is a necessary algebraic and geometric compatibility statement. Existence of such a new carrier as a physically legal recursive word is a **separate, unproved requirement**. + +## B. Constructive schedule inside the relaxed frame model + +For each selected edge `(i,j)`, put `U=span(u_i,u_j)` (rank two). Move both original clean source carriers from their rank-one home lines to U (cost one each). Create two zero helpers and move each from frame `0` to U (cost two each). Perform four signed ADDs to create both `m⁺` and `m⁻`. Restore both source carriers to their own home lines (cost one each), and move each new helper down from U to `` (cost one each). The invoice is **10 rank-move units and 4 ADDs per edge**, including helper creation; two new live auxiliaries remain. + +For each target support S, select a matching of disjoint available edges inside S. Every selected pair becomes one signed mixer read. Every remaining vertex becomes a singleton read. Their binary labels are independent because their constituent vertex sets are disjoint subsets of the original independent eight `u_i`. All these ingredient lines lie in H_t. Starting with a zero target, read them successively at the monotonically increasing span U_j, then grow the target to H_t. Each source carrier comes up from its home line, executes an ADD, and goes back to its home line. For k ingredients, the target pays **8** frame-rank units and the k individual carrier trips pay `2∑_{j=1}^k(j−1)=k(k−1)`; the target executes k signed ADDs. All scalar identities hold over the integers, not merely mod 2. This verifies the complete *abstract trace*, not its real E8 compiler lowering. + +## C. Exhaustive bank optimization + +The three-cube has exactly 12 edges. There are 4096 subsets B. For each target S define `matching(S,B)` to be the maximum cardinality matching among edges of B with both endpoints in S. Then `k(S,B)=|S|−matching(S,B)`. For q edges in the bank the complete schematic invoice is: + +`ADD(B) = 4 q + ∑_{S∈F} k(S,B)` + +`RANK(B) = 10 q + 104·8 + ∑_{S∈F} k(S,B)(k(S,B)−1)`. + +The script computes all 4096 masks by an edge-conflict recurrence and identifies the unique minimum RANK at all 12 edges: ADD=288 and RANK=1312. It separately checks this solution by actually evolving register frames and symbolic data. The independent checker derives the maximum matchings using a vertex-delete / pair recurrence, reproducing every one of the 4096 invoices. The unmixed fixed return-home baseline has ADD=416 and RANK=2224. No claim is made that the baseline is the optimal real decoder or that RANK equals the project's actual recursive cost. + +## D. Restricted static-basis obstruction (unsigned case) + +For the 104 binary incidence masks S, interpret its **unsigned** target coefficient vector as `1_S∈Q^8`. Suppose eight independent persistent carriers encode an invertible linear basis of the eight original term scalars. Each basis carrier j has a fixed nonzero decoding functional `f_j∈Q^8`: its coefficient in the unique expansion of any output y_S equals `f_j(1_S)`. Its fixed geometric home line is a nonzero `v_j∈span_F2(u_0,...,u_7)`. It may only be read when `v_j∈H_S`. Thus `f_j(1_S)=0` whenever `v_j∉H_S`. + +For each nonzero binary v, define `Bad(v)={1_S : S∈F, parity(v ∩ (complement S))=1}`. The checker exhibits an explicit set of eight rows in Bad(v) linearly independent modulo 3 for each of the 247 non-singleton v. They are therefore independent over Q and force any f_j vanishing on Bad(v) to be zero, a contradiction. For each of eight singleton v, Bad(v) has rank seven, and the only allowed f_j is a scalar multiple of the original corresponding coordinate. Consequently a global invertible eight-channel home-line basis cannot use nontrivial mixed lines in the unsigned fixed-access model. A redundant dictionary escapes because its channel coefficients need not be a fixed inverse-basis functional across *every* output and it has extra channels. + +This excludes neither signed geometry-dependent target coefficients nor dynamic changes to a frame, and says nothing about the general P104 decoding problem. + +## E. Limits + +Do not conflate these exact finite results with a certificate for a complete recursive multiplication algorithm. The new composite lines and terminated helper values require source/phase/cleanup work not discharged here. Existing P104 price screens may make a full realization uneconomical even when this schematic beats its stipulated direct baseline. Upstream signed E8 geometry is tested for one exemplar and carries inherited assumptions for other instances. +## F. Constructive zero-restoration and rank-two re-encoding + +The relaxed rank-one composite-label bank in sections A-C originally leaves new helper data resident. An exact inverse of its four-ADD preparation at each edge, followed by paid frame descent to rank zero, restores two auxiliaries to zero while preserving original terms; that adds four ADDs and ten frame-rank units per chosen edge. Exhausting all 4096 banks with this correction gives the minimum 320 ADDs and 1408 rank units at an eight-edge bank, with sixteen zero-restored auxiliaries (`zero_restore.py`). + +A distinct relaxation avoids the unavailable root-label `u_i+u_j` by storing both signed mixtures on the rank-two frame `U_ij=span(u_i,u_j)`. Each such frame consists of two actual root-line labels. If the target support contains i and j, both source lines and hence U are in the target sink. A mixed read costs one symbolic signed ADD but introduces both frame directions; choose all singleton reads before pair reads to minimize return-home moves. If a target has n terms and p disjoint mixed pairs, the source return-home travel is exactly `n(n-1)-2p(n-p)` rank units. Building and erasing both signed variants costs 8 ADDs and 16 rank units per selected bank edge. The targets collectively cost 832 rank units for their sinks. Thus: + +``` +ADD_2D(B) = 8*|B| + sum_S (|S|-p_B(S)) +RANK_2D(B) = 16*|B| + 832 + + sum_S (|S|*(|S|-1)-2*p_B(S)*(|S|-p_B(S))). +``` + +Here p_B(S) is a maximum matching of available cube edges within target support S. Complete exhaustive cost enumeration gives six eight-edge minimizing banks, each with `ADD_2D=320`, `RANK_2D=1520`, and 16 live supplementary scalar values that are **all returned to zero**. `rank2_gate.py` executes the signed scalar traces and every frame transition and checks all 2288 possible signed output assignments. + +These are finite formal F2 frame and scalar ADD identities only. A legal native E8 operator/phase schedule at rank-two homes, recursive child pricing, full source access, and all-size reduction to integer multiplication remain separate obligations. diff --git a/research/p104-signed-mixed-carrier-bank/PULL_REQUEST.md b/research/p104-signed-mixed-carrier-bank/PULL_REQUEST.md new file mode 100644 index 0000000000..024ffb06a9 --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/PULL_REQUEST.md @@ -0,0 +1,16 @@ +# Research construction: signed pair mixtures for P104 (schematic frame model, no new κ) + +**Classification: finite research construction, not a supplier or bound improvement.** + +This package investigates a specific escape from PR #1125's *fixed-term* carrier restriction: redundant, reversible-in-sign **mixed scalar values** `x_i ± x_j` on new pair-label lines `span(u_i+u_j)` (not a reversible full native circuit). Every target picks disjoint pair sums independently of the others. The source values are unchanged and restored to their home frames after mixer construction and reads. **New auxiliaries are not restored/erased at the end**; this is a key open cost obligation. + +- Verified target frame inclusion for **one genuine signed E8 decoder** and every required pair/target relation in it. General 7168-decoder support uniformity is inherited from merged PR #1125. +- Exact per-gate symbolic integer trace, F₂ subspace inclusion and all charged frame transitions in the explicitly relaxed model. +- Exhaustive **2,288 target/sign configurations**, all **105** perfect matchings and all **4,096** cube-edge mixture banks. +- Two independent optimization algorithms: edge-conflict DP and vertex recursion. Unique minimum frame-rank bank uses all 12 cube edges, adding 24 auxiliaries (2 signed variants per edge). +- Against a **specified, non-optimal** unmixed home-return schedule, modeled ADDs decrease 416 to 288; frame-rank moves decrease 2,224 to 1,312. These are finite schematic counts, **not** a κ/runtime gain. +- Separate restricted exact obstruction: fixed *nonredundant* eight-channel global recoding over Q with home-line-only reads cannot use 247 non-coordinate line labels for the unsigned support family (F₃ full-rank minor witnesses and independent rational verification). + +Validation of the committed subset: `python -I -B research/p104-signed-mixed-carrier-bank/RUN_SUBMITTED.py`; standard library only. The larger local laboratory also ran optional independent scripts, but those are not included in this PR. The added `root_line_gate.py` confirms no mixed two-root label is an ordinary E8 root line. + +Open gates: physical lowering of composite label lines, actual signed decoder word, new helper ownership/cleanup, paid source access, recursive child ranks, phase frames, full optimized unmixed comparator, full strict moment/outer recheck. This branch changes **no upstream/** file, no selected source and no κ. Upstream PR #1125 and #968 receive credit; PR #2820 supplies parallel projection context. Substantial GPT-6 assistance disclosed. Apache-2.0. \ No newline at end of file diff --git a/research/p104-signed-mixed-carrier-bank/README.md b/research/p104-signed-mixed-carrier-bank/README.md new file mode 100644 index 0000000000..8fa16bb821 --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/README.md @@ -0,0 +1,81 @@ +# P104 signed mixed-carrier research laboratory + +**Status:** A tested *finite schematic construction*, **not** a completed P104 supplier, an improved conditional exponent, or a new integer-multiplication algorithm. Based on CrocSwap/integer-mult-bounds PR #968 (frame-pair decoders), PR #1125 (asynchronous terminal-read model), and PR #2820 (255 survivor-projection widths). Full predecessor attribution must be preserved. + +## New mechanism + +Start with eight independent term carriers `x_i` at binary frame lines `E_i = `. For each cube edge `(i,j)`, optionally create two *redundant* carriers: + +- `m⁺_ij = x_i + x_j`; +- `m⁻_ij = x_i - x_j`. + +Both live on the composite line `E_ij = ` in the relaxed binary frame model. They do **not** replace the eight source carriers: they are new auxiliaries. A target that requires both i and j can use exactly one of `m⁺_ij` or `m⁻_ij`, possibly negated, instead of two separate term reads. If a target needs only one of i,j, it uses the corresponding original carrier instead. This lets targets select *different disjoint subsets of pairs*. + +The crucial accessibility identity follows immediately from the reviewed P104 incidence: `E_i ⊂ H_t` exactly when `i ∈ S_t`. Therefore `E_ij ⊂ H_t` iff `i,j` are both in `S_t` **or** both outside `S_t`. In the both-in case, the signed pair-sum is a legitimate one-read *schematic* replacement for the two term contributions. `e8_instance.py` independently constructs one actual root-frame decoder and verifies this identity for all 12 edges and 104 targets, including ± coefficient signs. + +## Fully priced **within the explicitly relaxed frame experiment** + +Each output target starts at the zero frame and grows monotonically to its rank-eight sink. Original and precomputed auxiliary carriers begin each read at their home one-dimensional line, join the target's current frame to read, and return home. Target arithmetic uses exact integer coefficient vectors. Each pair's **two** signed auxiliaries are prepared together, adding four signed ADDs and ten frame-rank units; no part of that preparation is silently omitted. All finite moves are charged by `d(U,W) = dim U + dim W − 2 dim(U∩W)`. + +| Finite schedule | Target ADDs | Mixer ADDs | Total ADDs | Target sink frame rank | Source reposition rank | Mixer preparation rank | Total frame rank | Extra auxiliary carriers | +|---|---:|---:|---:|---:|---:|---:|---:|---:| +| Eight unmixed originals, return home | 416 | 0 | **416** | 832 | 1,392 | 0 | **2,224** | 0 | +| One fixed perfect matching of four cube edges | 304 | 16 | **320** | 832 | 648 | 40 | **1,520** | 8 | +| Eight selected cube edges (16 auxiliaries) | 256 | 32 | **288** | 832 | 416 | 80 | **1,328** | 16 | +| All twelve cube edges (24 auxiliaries) | 240 | 48 | **288** | 832 | 360 | 120 | **1,312** | 24 | + +The last row is optimal for the **12-edge bank-subset class and stated frame invoice**: exhaustive evaluation of all `2^12 = 4096` subsets finds mask 4095 the **unique** minimum-frame-rank bank. The minimum ADD count 288 ties with certain smaller banks. A separate vertex-recursion optimizer independently corroborates all 4096 cases. No optimality beyond the two-signed-variant cube-edge-bank model is claimed. The eight-edge solution wins over the twelve-edge solution when each auxiliary helper has even a small positive price (two or more frame-rank-equivalent units), so actual host/tape costs matter. + +### Relative to this one restricted baseline + +- All-edge bank: **30.77% fewer ADDs**, **41.01% less charged frame-move rank**. +- Eight-edge bank: same 30.77% ADD savings with 16 auxiliaries, but 16 more frame-rank units than the 12-edge bank. +- These percentages **are not** savings in multiplication runtime, actual P104 recursive cost, or a review-accepted κ. + +## Separate structural result: why eight global replacement carriers fail + +For unsigned outputs `y_S = Σ_{i∈S} x_i`, suppose we replace all eight original independent carriers by exactly eight new independent fixed home-line carriers, with no redundant channels, and each target reads only carriers whose line lies in its sink. For any proposed line `v` from the eight-dimensional source span, its coefficient functional must vanish on all targets `S` for which ` != 0`. The unsigned target coefficient vectors of those forbidden targets have rank **eight over the rationals** for each of the **247 non-coordinate** lines `v`. The other eight coordinate lines have rank seven. Therefore a nonzero fixed coefficient functional exists only at an original coordinate line: an invertible, fixed eight-channel recoding cannot beat the direct-home accessibility requirement in this precisely stated class. A full-rank minor over F₃ is a short exact rational certificate; `independent.py` independently checks all ranks with SymPy over Q. + +This no-go result does not apply to the **redundant signed dictionary**, to unequal geometry-dependent coefficients, to moving frames, or to target-specific encoding. + +## Reproduce this GitHub submission + +The upstream contribution contains the primary standalone standard-library verifier, a 4096-bank invoice census, the E8 root-line gate, and two further zero-restored construction checkers. + +From the repository root, Python 3.10+: + +```bash +python3 -I -B research/p104-signed-mixed-carrier-bank/RUN_SUBMITTED.py +``` + +Expected final line: + +```text +PASS_P104_SCHEMATIC_SUBMISSION no_kappa no_native_supplier +``` + +The committed checks emit: +- `verify.py`: 2288 signed target configurations, 105 perfect matchings, abstract scalar/frame traces, 247 forbidden static noncoordinate line choices. +- `optimize_bank.py`: every one of 4096 edge banks, unique minimum-frame rank 1312, total ADDs 288. +- `root_line_gate.py`: all 7140 distinct E8 root-line pairs have pair-sum labels absent from the root-line family.\n- `zero_restore.py`: exact rank-one mixed helper cleanup after all outputs.\n- `rank2_gate.py`: exact rank-two framed alternative, full helper cleanup and signed cases. + +These are the reviewable checks committed in this PR. The expanded local laboratory was also exercised with separate optimization, E8-example and negative-control scripts, but those auxiliary scripts are **not included** in this focused GitHub submission; the PR makes no claim that its committed runner executes them. The selected frontier and `upstream/` are unchanged. + +## Stronger zero-restored constructions added in this PR + +The first one-dimensional composite-label bank is a schematic relaxation. `root_line_gate.py` proves that no sum of two distinct E8 root labels is itself an E8 root label. + +- `zero_restore.py` reverses every rank-one mixer preparation and zeros all 16 helper values. The exact full-bank audit chooses an eight-edge bank (one of six equivalent minima), costing **320 ADDs and 1408 rank units**, with zero-restored auxiliary endpoints. New composite rank-one physical labels remain unimplemented. +- `rank2_gate.py` instead keeps each mixed scalar on the *rank-two* span of its two genuine root lines, which is included in a target sink whenever both originals are read. It also restores every helper to zero. Exhaustive 4096-bank search and 2288 signed cases give **320 ADDs and 1520 rank units** with 16 auxiliaries, versus 416 / 2224 for the fixed unmixed baseline. + +Neither route establishes a valid native E8 scalar operator, paid source/phase routing, hosting or new recursive exponent. The rank-two variant removes the nonexistent-root-line naming obstacle, not the full realization obligation. + +## Critical remaining gates before claiming a new integer multiplication result + +1. **Physical lowering:** construct a valid register word realizing new line `E_i+E_j` and preserving scalar information and frame phase. The abstract frame move alone does not establish physical realizability. +2. **Full paid invoice:** account for source access, both signed auxiliaries' construction, all source/copy/erase/restore work, helper provisioning, live width, recursive children, all phase changes, and eventual cleanup of auxiliary data (this experiment permits them to terminate with data). +3. **Competitive baseline:** compare with an optimized unrestricted *unmixed* delivery word and the currently accepted P104-related constructions, not merely this fixed return-home schedule. +4. **Finite/native semantics and full geometry:** replay every required original signed decoder, not only supports and one concrete E8 instance. +5. **Moment/outer requirements:** show a strict gain under the current selected certificate and all analytic, compiler, hosting, bit-interface, and precision assumptions. The previously reviewed P104 optimistic budget is extremely tight; nominal savings here do not imply a positive κ. + +**Attribution/license:** Prepared with substantial OpenAI GPT-6 assistance. Concept and finite construction developed in this sprint; prior P104 geometry/theorem: Ali Romman (#1125), decoder constraints: #968 and predecessors, 255 projections: Chrisbryan17 (#2820). Research package offered under Apache-2.0, with upstream sources unmodified. No human review of this new construction is claimed. \ No newline at end of file diff --git a/research/p104-signed-mixed-carrier-bank/RUN_SUBMITTED.py b/research/p104-signed-mixed-carrier-bank/RUN_SUBMITTED.py new file mode 100644 index 0000000000..adf09b3681 --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/RUN_SUBMITTED.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python3 +"""Standard-library acceptance for the committed subset of the finite laboratory.""" +import subprocess,sys +from pathlib import Path +root=Path(__file__).resolve().parent +for name in ('verify.py','optimize_bank.py','root_line_gate.py','zero_restore.py','rank2_gate.py'): + subprocess.run([sys.executable,'-I','-B',str(root/name)],check=True) +print('PASS_P104_SCHEMATIC_SUBMISSION zero_restored=YES no_kappa no_native_supplier') diff --git a/research/p104-signed-mixed-carrier-bank/optimize_bank.py b/research/p104-signed-mixed-carrier-bank/optimize_bank.py new file mode 100644 index 0000000000..3fab80febc --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/optimize_bank.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +"""Exact exhaustive 12-edge-bank cost audit in the relaxed P104 model.""" +from itertools import combinations +import importlib.util +from pathlib import Path +p=Path(__file__).resolve().parent/'verify.py' +s=importlib.util.spec_from_file_location('p104_mixed_verify',p) +mod=importlib.util.module_from_spec(s) +s.loader.exec_module(mod) +support_family=mod.support_family +E=tuple((i,j) for i,j in combinations(range(8),2) if (i^j).bit_count()==1) +assert len(E)==12 +conflict=[sum(1<>a&1 and s>>b&1) for s in F] +costs=[] +for bank in range(4096): + counts=[s.bit_count()-match[bank&available] for s,available in zip(F,allowed)] + costs.append((832+10*bank.bit_count()+sum(k*(k-1) for k in counts), + 4*bank.bit_count()+sum(counts))) +best=min(x[0] for x in costs) +winners=[i for i,x in enumerate(costs) if x[0]==best] +assert best==1312 and winners==[4095] +assert min(x[1] for x in costs)==288 +assert costs[0]==(2224,416) and costs[4095]==(1312,288) +print('PASS_BANK_4096 rank=1312 adds=288 winner=4095 no_kappa') diff --git a/research/p104-signed-mixed-carrier-bank/rank2_gate.py b/research/p104-signed-mixed-carrier-bank/rank2_gate.py new file mode 100644 index 0000000000..c8d66876da --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/rank2_gate.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +"""Exact signed P104 rank-two framed mixers, all values zero-restored. + +A complete finite F2-frame construction, NOT a native/hosted P104 supplier. +""" +from functools import lru_cache +from itertools import combinations,product +from pathlib import Path +import importlib.util +HERE=Path(__file__).resolve().parent +spec=importlib.util.spec_from_file_location('mix_v',HERE/'verify.py') +v=importlib.util.module_from_spec(spec);spec.loader.exec_module(v) +E=tuple((a,b) for a,b in combinations(range(8),2) if (a^b).bit_count()==1) +F=v.support_family() +assert len(E)==12 and len(F)==104 +CONFLICT=[sum(1<>a&1) and (s>>b&1)) for s in F] +@lru_cache(None) +def matching(mask): + if not mask:return () + bit=mask&-mask;j=bit.bit_length()-1 + no=matching(mask^bit) + yes=(E[j],)+matching(mask&~CONFLICT[j]) + return yes if len(yes)>len(no) else no + +def invoice(bank): + rank=832+16*bank.bit_count();adds=8*bank.bit_count() + for S,A in zip(F,ALLOWED): + n=S.bit_count();p=len(matching(bank&A)) + adds+=n-p;rank+=n*(n-1)-2*p*(n-p) + return rank,adds,2*bank.bit_count() +prices=[invoice(bank) for bank in range(4096)] +winners=[i for i,x in enumerate(prices) if x[0]==min(vv[0] for vv in prices)] +assert winners==[1781,1995,2526,2995,3437,3646] +assert all(prices[i]==(1520,320,16) for i in winners) +assert prices[0]==(2224,416,0) and prices[4095]==(1552,336,24) + +def sources(bank,t): + regs={str(i):v.Register(v.vec(1<>j)&1:continue + U=(1<>i&1 and i not in selected] + ingredients +=[(f'{a},{b}'+('+' if coeff[a]==coeff[b] else '-'),coeff[a]) for a,b in pairs] + y=v.Register((0,)*8,(),f'target_{S}') + frame=[] + for name,sgn in ingredients: + reg=regs[name] + assert v.included(reg.home,h) + for basis in reg.home: + assert not v.contains(tuple(frame),basis) + frame.append(basis) + t.move(y,frame);t.move(reg,frame) + t.accum(y,reg,sgn) + t.move(reg,reg.home) + t.move(y,h) + assert y.data==tuple(coeff[i] if S>>i&1 else 0 for i in range(8)) + assert v.rank(y.frame)==8 + +def clean(bank,regs,t): + for j,(a,b) in enumerate(E): + if not (bank>>j)&1:continue + ra,rb=regs[str(a)],regs[str(b)] + plus,minus=regs[f'{a},{b}+'],regs[f'{a},{b}-'] + U=(1<>i&1] + for x in product((-1,1),repeat=len(members)): + coeff=[0]*8 + for i,c in zip(members,x):coeff[i]=c + t=v.Trace();regs=sources(bank,t) + target(S,coeff,regs,t,M) + clean(bank,regs,t) + signed+=1 +assert signed==2288 +print('PASS_RANK2_MIXERS banks=4096 winner_count=6 frame_rank=1520 adds=320 helpers=16 signed=2288 zero_restored=YES native=UNPROVEN') diff --git a/research/p104-signed-mixed-carrier-bank/root_line_gate.py b/research/p104-signed-mixed-carrier-bank/root_line_gate.py new file mode 100644 index 0000000000..3d9842465a --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/root_line_gate.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +"""Exact E8 root-pair signature gate: pair sums are not root-line labels.""" +from itertools import combinations,product +roots=[] +for i,j in combinations(range(8),2): + for ai,aj in product((2,-2),repeat=2): + x=[0]*8;x[i]=ai;x[j]=aj;roots.append(tuple(x)) +for x in product((1,-1),repeat=8): + if x.count(-1)%2==0: roots.append(x) +def canon(v): + return v if next(x for x in v if x)>0 else tuple(-x for x in v) +L=sorted({canon(v) for v in roots}) +assert len(L)==120 +N=[sum(((sum(a*b for a,b in zip(x,y))//4+1)&1)<= 3.10, standard library only. +""" +import itertools +import json +from collections import Counter +from pathlib import Path + +HERE = Path(__file__).resolve().parent + +def chk(x, name): + if not x: raise AssertionError(name) + +def rank(vectors): + pivots={} + for vector in vectors: + v=vector + while v: + col=v.bit_length()-1 + if col in pivots: v ^= pivots[col] + else: pivots[col]=v;break + return len(pivots) + +def contains(frame, vector): + return rank(frame + (vector,)) == rank(frame) + +def included(left,right): + return all(contains(right,v) for v in left) + +def dist(left,right): + return 2*rank(left+right)-rank(left)-rank(right) + +def dot(x,y):return (x&y).bit_count()&1 + +def vec(*masks): + t=[0]*8 + for m in masks: + for j in range(8):t[j]+=(m>>j)&1 + return tuple(t) + +def scale(x,c):return tuple(c*v for v in x) + +def add(x,y,c=1):return tuple(a+c*b for a,b in zip(x,y)) + +def induced_tree(s): + v=[i for i in range(8) if s>>i&1] + if len(v)<2 or len(v)>5:return False + edges=sum((a^b).bit_count()==1 for a,b in itertools.combinations(v,2)) + seen={v[0]} + while True: + next_seen=seen|{b for a in seen for b in v if (a^b).bit_count()==1} + if next_seen==seen:break + seen=next_seen + return len(seen)==len(v) and edges==len(v)-1 + +def support_family(): + # Includes the 12 complements of edges, but avoids duplicating five-vertex trees. + ans=set(s for s in range(1,255) if induced_tree(s)) + ans|={255^((1<len(out): + out.append(v) + if len(out)==8:break + chk(len(out)==8,'hyperplane rank') + return tuple(out) + +def matching_enumeration(): + # All 7*5*3*1=105 unordered perfect matchings, not just cube edges. + def rec(remaining): + if not remaining: + yield () + return + a=remaining[0] + for b in remaining[1:]: + for tail in rec(tuple(x for x in remaining if x not in (a,b))): + yield ((a,b),)+tail + return list(rec(tuple(range(8)))) + +def assemble(s, signs, source, trace, matching=()): + # src states stay clean in home lines; target grows monotonically. + h=hyperplane(s) + pieces=[] + done=0 + for a,b in matching: + pair=(1<>i)&1 and not(done>>i)&1: + pieces.append((str(i),signs[i])) + target=Register((0,)*8,(),f'target_{s}') + frame=[] + for j,(name,sgn) in enumerate(pieces): + reg=source[name] + chk(contains(h,reg.home[0]),'sink does not admit carrier') + chk(not contains(tuple(frame),reg.home[0]),'dependent ingredient labels') + frame.append(reg.home[0]) + trace.move(target,frame) + trace.move(reg,frame) + trace.accum(target,reg,sgn) + trace.move(reg,reg.home) + chk(included(tuple(frame),h),'target cannot finish by monotone expansion') + trace.move(target,h) + expected=tuple(signs[i] if (s>>i)&1 else 0 for i in range(8)) + chk(target.data==expected,f'invalid symbolic output {s} {signs}: {target.data} vs {expected}') + chk(rank(target.frame)==8,'target endpoint rank') + return len(pieces) + +def sources(matching,trace): + result={str(i):Register(vec(1<>i)&1 for i in range(8)] + for c in range(8): + if row[c]==0:continue + if c in pivots:row=[(x-row[c]*y)%p for x,y in zip(row,pivots[c])] + else: + inverse=pow(row[c],-1,p) + pivots[c]=[(x*inverse)%p for x in row] + selected.append(s) + break + return selected + +def global_basis_obstruction(F): + # Every selected global-basis carrier at label v must have a nonzero dual + # coefficient functional f. Bad outputs cannot read its line. If their + # coefficient vectors span Q^8, no nonzero such f exists. + result={} + for v in range(1,256): + witness=modular_rank_witness(v,F) + expected=7 if v.bit_count()==1 else 8 + chk(len(witness)==expected,'unexpected obstruction rank') + chk(all(dot(v,255^s) for s in witness),'invalid witness') + result[str(v)]=witness + return result + +def run(): + F=support_family() + chk(len(F)==104,'support count') + chk(Counter(s.bit_count() for s in F)==Counter({2:12,3:24,4:32,5:24,6:12}),'support sizes') + base=case((),F) + variants=[case(M,F) for M in matching_enumeration()] + chk(len(variants)==105,'complete perfect matching enumeration') + best=min(variants,key=lambda x:(x['rank_cost'],x['matching'])) + chk((base['rank_cost'],base['adds'])==(2224,416),'baseline invoice') + chk((best['rank_cost'],best['adds'],best['prep_rank'],best['prep_adds'])==(1520,320,40,16),'signed mixer invoice') + chk(Counter(v['rank_cost'] for v in variants)[1520]==3,'optimal matching multiplicity') + chk(all(v['rank_cost']>=1520 and v['adds']>=320 for v in variants),'complete matching lower bound') + chk(best['target_reads']==304,'target reads') + # Signed exhaustive validation includes every possible nonzero coefficient sign + # pattern for each of the 104 supports, not just a randomized or fixed sample. + sign_cases=0 + for S in F: + members=[i for i in range(8) if (S>>i)&1] + for assignment in itertools.product((-1,1),repeat=len(members)): + signs=[0]*8 + for k,sgn in zip(members,assignment):signs[k]=sgn + t=Trace();src=sources([tuple(pair) for pair in best['matching']],t) + assemble(S,signs,src,t,[tuple(pair) for pair in best['matching']]) + sign_cases+=1 + chk(sign_cases==2288,'sign-case completeness') + obst=global_basis_obstruction(F) + # Negative controls: choose wrong mixture sign, omit one preparation ADD, + # pretend line a+b is valid for exactly one member, and corrupt one target. + t=Trace();src=sources([tuple(pair) for pair in best['matching']],t) + a,b=best['matching'][0] + plus=src[f'{a},{b}+'];minus=src[f'{a},{b}-'] + chk(plus.data!=minus.data,'sign variant mutation') + S=next(s for s in F if s>>a&1 and not(s>>b&1)) + chk(not contains(hyperplane(S),plus.home[0]),'half-pair forbidden geometry') + chk(add(plus.data,scale(src[str(a)].data,-1)) != plus.data,'dropped read mutation') + report={ + 'status':'finite schematic construction only; no new kappa, no legal P104 supplier', + 'model':'one-shot monotone target frame growth, original source lines restored after each read, fresh mixed auxiliaries retained', + 'source_supports':F, + 'support_count':len(F),'signed_cases_exhausted':sign_cases, + 'matching_count':105, + 'baseline':{k:v for k,v in base.items() if k!='trace'}, + 'signed_mixers_best':{k:v for k,v in best.items() if k!='trace'}, + 'alternatives':[{k:v for k,v in item.items() if k in ('matching','rank_cost','adds','read_hist')} for item in variants], + 'global_eight_basis_obstruction':{ + 'nonzero_labels':255,'rank7_labels':8,'rank8_labels':247, + 'modular_prime':3,'witnesses':obst, + 'scope':'nontrivial fixed global independent 8-carrier basis over characteristic zero, home-line direct reads, unsigned unit coefficient vector outputs; not a limit for redundant carriers or arbitrary frame moves' + }, + 'limitations':[ + 'This is an abstract F2 frame-path schedule plus exact scalar linear algebra; does not lower to native multiplications', + 'The nine-dimensional hyperplane representatives match incidences, but are not re-embedded in a signed E8 full decoder', + 'The direct-only baseline is a specified return-home schedule, not optimal among all unmixed schedules', + 'New mixed lines and auxiliaries may violate actual source-access, phase, restoration, tape, rank-child and hosting constraints', + 'Complete paid recursive invoices and outer moment analysis are missing' + ] + } + (HERE/'RESULT.json').write_text(json.dumps(report,indent=2,sort_keys=True)+'\n') + print('PASS_MIXED_CARRIER signed_cases=2288 decoders=104 matchings=105 baseline_adds=416 mixed_adds=320 baseline_frame_rank=2224 mixed_frame_rank=1520 global_nontrivial_basis_obstructions=247 NO_KAPPA') +if __name__=='__main__':run() \ No newline at end of file diff --git a/research/p104-signed-mixed-carrier-bank/zero_restore.py b/research/p104-signed-mixed-carrier-bank/zero_restore.py new file mode 100644 index 0000000000..a890bd2af0 --- /dev/null +++ b/research/p104-signed-mixed-carrier-bank/zero_restore.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python3 +"""Exact zero-restoration of a signed P104 mixed bank in the relaxed frame model. + +No native supplier, recursive invoice or new exponent is claimed. +""" +from functools import lru_cache +from itertools import combinations, product +from pathlib import Path +import importlib.util + +HERE=Path(__file__).resolve().parent +spec=importlib.util.spec_from_file_location("mixed_primary", HERE/"verify.py") +v=importlib.util.module_from_spec(spec) +spec.loader.exec_module(v) +E=tuple((a,b) for a,b in combinations(range(8),2) if (a^b).bit_count()==1) +assert len(E)==12 +CONFLICT=tuple(sum(1<>a&1 and s>>b&1) for s in F) + +@lru_cache(maxsize=None) +def matching(mask): + if not mask: return () + bit=mask&-mask; idx=bit.bit_length()-1 + drop=matching(mask^bit) + take=(E[idx],)+matching(mask&~CONFLICT[idx]) + return take if len(take)>len(drop) else drop + +def cost(bank): + reads=[s.bit_count()-len(matching(bank&allowed)) + for s,allowed in zip(F,ALLOWED)] + q=bank.bit_count() + # Build plus/minus; deliver; reverse build to erase both helpers. + return (832+20*q+sum(k*(k-1) for k in reads),8*q+sum(reads),2*q) + +cases=[cost(b) for b in range(4096)] +winners=[b for b,c in enumerate(cases) if c[0]==min(x[0] for x in cases)] +assert winners==[1781,1995,2526,2995,3437,3646] +assert min(x[1] for x in cases)==320 +assert all(cases[b]==(1408,320,16) for b in winners) +assert cases[0]==(2224,416,0) +assert cases[4095]==(1432,336,24) + +def cleanup(bank,regs,trace): + cleaned=0 + for j,(a,b) in enumerate(E): + if not bank>>j&1: continue + U=(1<>j&1] +choices=[matching(bank&allowed) for allowed in ALLOWED] +assert len(edges)==8 +t=v.Trace();regs=v.sources(edges,t) +assert (t.rank_cost,t.adds)==(80,32) +for S,M in zip(F,choices): + signs=[-1 if (S+i).bit_count()%2 else 1 for i in range(8)] + v.assemble(S,signs,regs,t,M) +assert cleanup(bank,regs,t)==8 +assert (t.rank_cost,t.adds)==(1408,320) +assert all(r.frame==() and r.data==(0,)*8 for k,r in regs.items() if "," in k) +assert all(regs[str(i)].data==v.vec(1<>i&1] + for coeffs in product((-1,1),repeat=len(members)): + signs=[0]*8 + for i,c in zip(members,coeffs): signs[i]=c + t=v.Trace();regs=v.sources(edges,t) + v.assemble(S,signs,regs,t,M) + cleanup(bank,regs,t) + assert all(r.frame==() and r.data==(0,)*8 + for k,r in regs.items() if "," in k) + signed_cases+=1 +assert signed_cases==2288 +print("PASS_ZERO_RESTORE banks=4096 winner_count=6 frame_rank=1408 adds=320" + " helpers=16 signed_cases=2288 native=UNPROVEN no_kappa")