From 2834523b1cd4ea83ba7a043e2e2f5f3332cf9909 Mon Sep 17 00:00:00 2001 From: Clear Insight Date: Sun, 18 Oct 2026 10:48:58 +1100 Subject: [PATCH] Prove phase-compatible Gaussian exactness for the P104 collector Construct and prove the Gaussian Newton module, bind the actual15-event collector and all four archived wrappers, and retain a separate exact reconstruction with full-source receipts and an explicit codec bill. Prepared by Clear1nsight with substantial OpenAI assistance. Preserve predecessor credit and the explicit producer/consumer and physical limits. --- .../p104-clifford-exactness/INDEPENDENT.md | 200 +++++ research/p104-clifford-exactness/PROOF.md | 445 ++++++++++ research/p104-clifford-exactness/README.md | 280 ++++++ research/p104-clifford-exactness/RECEIPT.json | 823 ++++++++++++++++++ research/p104-clifford-exactness/SOURCES.json | 139 +++ research/p104-clifford-exactness/TASK.json | 251 ++++++ research/p104-clifford-exactness/VERIFY.json | 43 + .../p104-clifford-exactness/independent.py | 492 +++++++++++ research/p104-clifford-exactness/model.py | 428 +++++++++ research/p104-clifford-exactness/verify.py | 416 +++++++++ 10 files changed, 3517 insertions(+) create mode 100644 research/p104-clifford-exactness/INDEPENDENT.md create mode 100644 research/p104-clifford-exactness/PROOF.md create mode 100644 research/p104-clifford-exactness/README.md create mode 100644 research/p104-clifford-exactness/RECEIPT.json create mode 100644 research/p104-clifford-exactness/SOURCES.json create mode 100644 research/p104-clifford-exactness/TASK.json create mode 100644 research/p104-clifford-exactness/VERIFY.json create mode 100644 research/p104-clifford-exactness/independent.py create mode 100644 research/p104-clifford-exactness/model.py create mode 100644 research/p104-clifford-exactness/verify.py diff --git a/research/p104-clifford-exactness/INDEPENDENT.md b/research/p104-clifford-exactness/INDEPENDENT.md new file mode 100644 index 0000000000..3548c780c2 --- /dev/null +++ b/research/p104-clifford-exactness/INDEPENDENT.md @@ -0,0 +1,200 @@ +# Independent Gaussian-domain and collector review + +Clear1nsight, with substantial OpenAI assistance. This checker was derived +from the task's written proposal and the authenticated source word, native +recipe data and literal signed-floor definition. Its initial implementation +was completed before reading the primary `model.py` or `PROOF.md`. It imports +neither of those files nor any predecessor executable. This is a separate +implementation and mathematical review within the same assisted contribution; +it is not independent human review or proof-kernel verification. + +## Source and execution boundary + +`independent.py` authenticates all three input files against its own literal +SHA256 constants and exact byte lengths, with bounded reads. `WORD.json` +supplies the exact fifteen events, numbered +2025 through 2039 inclusive. `NATIVE.json.gz` supplies both separately archived +rank-seven recipes at events 2031 and 2033, including their four distinct +wrappers. `lifting.py` supplies the signed-floor convention and the input +address phase convention. It is authenticated but is not imported or executed. +The predecessor authors and exact source heads are recorded in `SOURCES.json`. + +The checker implements an exact mathematical numerator oracle separately +from the integer floor map. Its finite replay concerns this authenticated +scalar-reference convention. It is not a C++ native build, a compiler +admission, a whole-word execution or a physical-owner implementation. + +## Independent derivation of the domain + +Let pi = 1+i. For an array on the r-dimensional Boolean cube, use its unique +multilinear expansion + + f(x) = sum_S a_S product_(j in S) x_j. + +The coefficients are obtained by ordinary Boolean Mobius inversion. Define +B_r by `a_S / pi^|S|` being Gaussian integral for every S. The independent +encoder first multiplies coefficient S by `pi^|S|`, then applies the Boolean +zeta transform. Its decoder performs Mobius inversion followed by exact +Gaussian division. This is a different implementation strategy from a tensor +pair-sweep encoder. The two strategies describe the same explicit matrix E. + +Write a coordinate pair as `(a, a+d)`. The exact C map gives + + (a + d/pi, a + d/pi + i*d). + +In the normalized Newton coordinates `(c0,c1)`, this is + + (c0,c1) -> (c0+c1, i*c1). + +The inverse is `(c0,c1) -> (c0+i*c1, -i*c1)`. These are integral invertible +Gaussian matrices. Tensoring them with the untouched coordinates proves that +each C_j and its inverse preserve B_r. The statement is an intertwining +identity `C_j E = E T_j`; it does not say `C_j E = E C_j`. + +For necessity, suppose f and all products C_T f, with T a subset of the +coordinate set, take Gaussian integral values. Evaluation at the all-zero +address yields + + (C_T f)(0) = sum_(S subset T) a_S / pi^|S|. + +Mobius inversion on the subsets T expresses each `a_T / pi^|T|` as an integer +linear combination of these integral evaluations. Thus f belongs to B_r. +This proves the exact maximal domain for all partial-coordinate products. +Any integral module invariant under every C_j is a submodule of B_r, and the +previous construction shows that B_r itself is such a module. No maximality +for a single gate, one completed word or input-dependent cancellation follows. + +The checker preserves the distinction with `f = pi*x0*x1`. Its four values +are `(0,0,0,pi)`, which lie outside B_2. Each single coordinate step at the +entrance is exactly integral: C_0 gives `(0,0,1,i)`, and C_1 gives `(0,1,0,i)`. +A C_1 step following C_0 has a nonintegral exact result and the +literal floor pair rejects the equality check. Single-gate integrality is +therefore insufficient for the proposed phase-complete contract. + +## Why signed floors are exact on this domain + +For an integer t, put `epsilon(t) = t - 2*floor(t/2)`; it equals zero or one, +including for negative t. Put `d = a-b` and let J be multiplication by i +(or by -i for the inverse). The second output of the literal pair differs +from the exact C output by + + (epsilon(Jd) - epsilon(d))/2, + +component by component. Rotation exchanges the two parity bits; signs do +not change parity. The difference vanishes exactly when the real and +imaginary components of d have the same parity. This is equivalent to pi +dividing d. The first output has the same defect because both versions then +add Jd. + +This proof applies to every signed integer entrance satisfying the condition. +It justifies the all-input exactness claim; tests on basis columns alone +could not establish it for an arbitrary nonlinear floor map. The executable +also checks all 450 combinations of the two directions and real/imaginary +differences in [-7,7], including negative odd values. + +## Exact wrapper closure + +The source sends address x to A*x+b over F_2 and multiplies its value by a +power of i evaluated at the input x. Its exponent consists of a global +constant, linear coefficients modulo four, and twice a quadratic Boolean +polynomial. All four source wrapper permutations and phases are reconstructed +on all 512 addresses; each map is checked to be a bijection. + +An invertible affine Boolean map is generated by bit swaps, bit flips and +CNOTs. The phase alphabet is generated by global i, S_j=`i^x_j`, and +CZ_jk=`(-1)^(x_j*x_k)`. In normalized Newton coordinates the nontrivial +two-coordinate formulas, in coefficient order `(a,b,c,d)` for +`1, x, y, xy`, are + + CNOT_(x -> y): (a, b+c+pi*d, c, -(1-i)*c-d) + CZ: (a, b, c, i*a-(1-i)*(b+c)-d). + +For one coordinate, + + X: (a,b) -> (a+pi*b, -b) + S: (a,b) -> (a, i*a+i*b). + +Each formula is Gaussian integral. X, CNOT and CZ square to the identity; +S has order four. Bit swaps merely permute equal-degree Newton coefficients, +and global i is a unit. This proves preservation in both directions for the +entire literal wrapper alphabet. The independent checker reconstructs every +displayed matrix from its complete small coefficient basis and verifies the +stated orders. It does not assume that an arbitrary Boolean permutation or +arbitrary phase preserves B_r: the cubic phase `(-1)^(x0*x1*x2)` applied to +the constant-one vector is a rejecting control. + +The earlier phase witness `(1,i)` is accepted here. Its normalized Newton +coefficients are `(1,i)`, and C sends it exactly to `(pi,0)`. This supplies +the changed premise relative to a lattice lacking phase closure. + +## Actual collector verification + +The forward recipe U and the separately archived return V are used as +written. The checker first applies their exact rational numerator matrices +to all 512 standard complex coordinate vectors. Every column satisfies +`VU = I`, with the common denominator `2^14` handled as an integer identity. +These maps are complex linear, so the complete complex basis proves this +finite operator identity on all complex arrays. + +It then runs the literal signed-floor recipes on 1,024 signed generators of +the full Z-module B_9: one real and one imaginary encoder column at each +of the 512 coordinates, with alternating signs. Every one of the 3,670,016 +pair applications is compared with the separate rational pair formula; +every outbound array is decoded successfully, and every return equals its +entrance exactly. The signed-floor theorem and the generator closure proof, +rather than extrapolation from these fixtures, justify the universal claim. + +Three additional dense signed cases supply five nonzero source arrays and +an arbitrarily dirty query in B_9. They execute the exact source event list, +check Newton divisibility after each array operation and each transport +prefix, and compare the query with `query + U*sum(sources)`. All five sources +are checked unchanged. The private C is exactly zero before the ERASE event. +These verification snapshots are not claimed as storage in an efficient +execution of the collector. + +Two composition controls preserve the lattice but fail the endpoint: replacing +the return recipe by the forward recipe, and multiplying one actual return +wrapper by i. Both are rejected when the private field fails to erase. Thus +lattice preservation is not being substituted for source-operator correctness. + +## Interfaces and excluded conclusions + +The local source uses eleven unit-coefficient whole-array ADDs, two rank-seven +transports, four literal wrappers, one private zero allocation and its exact +erasure. The current checker does not replace the separately archived V by a +paired inverse when counting those wrappers. The actual execution-order cycle +counts are 64, 128, 160 and 64, totaling 416. The inherited one-zero-scratch +cycle implementation therefore uses 2,464 swaps. A full cost ledger must retain +source access, query writes, arithmetic, permutation execution and private +storage, plus any encoder, decoder or physical movement actually needed by a +caller. Unit ADD closure does not provide the preceding source arrays for free. + +For an integral array z, `z/4` belongs to B_r exactly when z belongs to 4B_r. +The rank-one example `z=(4,0)` is in B_1 while the integral array `z/4=(1,0)` +is outside it. The checker rejects its attempted exact C step. Constancy in +the other coordinates lifts this counterexample to B_9. This is an interface +restriction; the selected fifteen-event collector does not execute a quarter +ADD. + +Encoding arbitrary coefficient data by E changes the logical map to +`E^-1 U E`. The explicit `CE != EC` control prevents a claim of an unchanged +logical caller merely from having an invertible codec. No preparation of +this entrance by the preceding full word, downstream consumption, physical +owner realization, recursive tariff, precision improvement, supplier +admission or new kappa is established by this local theorem. + +## Replay + +From a repository containing the authenticated input paths: + +```sh +python3 -I -O -B research/p104-clifford-exactness/independent.py +``` + +Alternatively pass `--repo /path/to/source-root`. The module API is +`verify_independent(word_path, native_path, lifting_path)`, returning a +deterministic JSON-compatible receipt without writing files. All contracts +use explicit exceptions and remain active under `-O`. The receipt contains +source hashes, exact generator matrices, complete-column hashes, actual +wrapper plans, dense collector checkpoints and the rejecting controls; +it contains no absolute path, wall-clock or timing-dependent field. diff --git a/research/p104-clifford-exactness/PROOF.md b/research/p104-clifford-exactness/PROOF.md new file mode 100644 index 0000000000..10b3202c78 --- /dev/null +++ b/research/p104-clifford-exactness/PROOF.md @@ -0,0 +1,445 @@ +# A phase-complete Gaussian entrance for one literal P104 collector + +This result changes the admissible numerical states of one fixed collector. +It does not change its scalar/frame word, claim a new precision threshold, +or provide the missing complete P104 correction and supplier invoice. +The construction is motivated by Clifford-invariant and Barnes–Wall lattice +methods. The proof below uses the repository's exact Gaussian normalization; +it does not invoke a lattice classification theorem or claim a new lattice +family. + +The source is ywz65's PR #2586, head +`7953c9a8f788a8de5cf2ced63d9a61b67c22c6f1`, retained at +`research/p104-rounded-collector/inputs/WORD.json` and `NATIVE.json.gz`. +Tekalign's PR #3025 binds its first collector and supplies the literal signed +floor pair. Ross Richardson's PR #3068, head +`7d2c519a1fdcc6bf66f6f08757eed7c48762d3f2`, supplies the neighboring +period-domain contract and explicitly leaves a larger state exactness domain +open. Their constructions, inverses, source binding and earlier bounds retain +their credit. Exact consumed bytes and the isolated replay are recorded by +the accompanying source manifest and receipt. + +## 1. Coordinates and the explicit code + +Put `pi = 1+i`, so `pi^2 = 2i` and `1/pi = (1-i)/2`. An array of +`2^r` Gaussian integers is a function on the binary cube. It has unique +multilinear Newton coefficients: + +\[ + f(x)=\sum_{S\subseteq\{0,\ldots,r-1\}}a_S x^S, + \qquad x^S=\prod_{j\in S}x_j. +\] + +Uniqueness follows by Boolean differences, or by the triangular evaluation +matrix indexed by subsets. Define the Gaussian module + +\[ + \mathcal B_r=\{f:a_S\in\pi^{|S|}\mathbb Z[i]\text{ for every }S\}. +\] + +Its encoder is explicit: + +\[ + E_r=E_1^{\otimes r},\qquad + E_1=\begin{pmatrix}1&0\\1&\pi\end{pmatrix}. +\] + +Thus a coefficient pair `(c0,c1)` becomes `(c0,c0+pi*c1)`. Bit `j` is +the address bit `1< x xor y = x+y-2xy`, and gives + +\[ + (a,b,c,d)\longmapsto + (a,\ b+c+\pi d,\ c,\ (i-1)c-d). +\] + +The phase `CZ=(-1)^{xy}=1-2xy` gives + +\[ + (a,b,c,d)\longmapsto + (a,\ b,\ c,\ ia+(i-1)(b+c)-d). +\] + +These formulas use `x^2=x`, `y^2=y` and `2=-i*pi^2`. The other bits contribute +the same common coefficient factors, so the formulas apply at every rank. +Bit swaps simply permute coefficient indices. The listed self-inverse gates +remain self-inverse under conjugation; `C` and `S` have the integral inverses +shown above. Global Gaussian units preserve the module. Thus every full source +wrapper, and its inverse, preserves `B_r`. + +No unrestricted phase or permutation is admitted by this argument. For example, +the cubic phase `(-1)^(x0*x1*x2)` applied to the constant one produces Newton +coefficient `-2` at degree three. It is not divisible by `pi^3`, so the result +leaves `B_3`. The quadratic source schema matters. + +The old structured phase witness is a positive control here. The constant one +and `i^{x_j}=1+(i-1)x_j` both belong to `B_r`, because `i-1=i*pi`. +The latter leaves the older `Gamma` period lattice, as credited in PR #3068. +That earlier counterexample did not claim that it creates a lifting error. + +## 5. One complete source-bound collector + +Use zero-based events **2025–2039** of the retained PR #2586 word. They are: + +1. Allocate zero private `C` at the common source frame. +2. Add `D31,D30,D29,D28,D27` to `C`, in that order. +3. Apply the literal rank-seven transport `U` at event 2031. +4. Add `C` to the arbitrarily dirty query `Q7` at its common frame. +5. Apply the separately archived return `V` at event 2033. +6. Subtract the five original sources in reverse order; erase exact zero `C`. + +The source arrays have 512 complex entries and nine address bits. Both native +recipes have the form `M_left C_0 ... C_6 M_right`. The complete surrounding +wrapper acts on all nine bits, so the contract is `B_9`, not an unproved +rank-seven block restriction. Source authentication binds the two event +occurrences, their frames, the common-chart ADDs and their actual recipes. +The predecessor's exact native interpretation is retained; the finite operator +check of `VU=I` is separate from the lattice exactness argument. + +Assume the five source arrays and the initial query belong to `2^-f B_9`. +They are otherwise arbitrary, independently dirty and potentially correlated. +The five sources remain available and unchanged across this whole interval. +The private `C` is owned and starts zero. No alias of those distinct roles or +nonzero private initialization is granted. + +Let `s` be the sum of the five sources. Module closure gives `s in 2^-f B_9`. +By Sections 3–4 both actual transports execute their exact ideal maps on this +domain. The query becomes `Q7+U*s`. Since `VU=I`, the private register returns +to `s`; subtracting the unchanged sources makes it exactly zero. Thus the +literal endpoint is + +\[ + (D31,\ldots,D27,Q7,C=0) + \longmapsto(D31,\ldots,D27,Q7+U\sum_jD_j,C=0). +\] + +The query remains in the same declared lattice and grid. There is no rounded +query defect, per-input grid selection, residue history or numerical downcast +in this restricted-state execution. This permits the separately archived `V`; +the unrestricted approximate lifting contract instead needs its paired inverse. +They must not be interchanged when counting operations. + +This is a boundary assumption at the actual collector cut. The earlier producer +has not been proved to supply this state for arbitrary unrestricted inputs. +The later whole word also has additional operations. A repeated collector is +valid only when its sources, frames, permissions and declared lattice are +available at its own cut. + +## 6. Quarter ADD and the exact meaning of an encoder + +Whole-array ADD by any Gaussian-integer coefficient preserves `B_r`. For an +integral array `z`, a quarter source `z/4` belongs to `B_r` exactly when +`z` belongs to `4B_r`. Integral components alone do not imply that condition. +At rank one `(4,0)` belongs to `B_1`, but `(4,0)/4=(1,0)` does not. Extend +the pair constantly in the other eight bits for the actual nine-bit counterexample. +Conversely `z=4E_r c` always has the admissible quarter `E_r c`. +The named collector contains only unit ADDs, so this counterexample marks the +external interface; no quarter instruction is treated as free within its bill. + +Encoding arbitrary raw coefficients `c` as `E_r c` changes the logical action +of a physical native map `U` to + +\[ + T=E_r^{-1}UE_r. +\] + +The gate formulas prove that `T` is an explicitly described Gaussian-integral +automorphism for the stated alphabet. They do **not** say `UE_r=E_rU`. +Already `C E_1 != E_1 C`; a control checks this distinction. Substituting this +representation into a caller expecting a different map requires its own +intertwining adapters and their complete costs. + +For clarity, one fully specified optional cold preparation realizes this +different `T` contract. Keep five arbitrary raw Gaussian coefficient source +arrays borrowed and unchanged, and give the query mutable ownership. Allocate +five zero source banks, copy the borrowed sources into them by five full-array +ADDs, and encode the five banks and query. Run the original collector on these +six encoded fields. Decode the query and all five banks. Each source bank is +then exactly its original raw source; subtract that borrowed source, check zero +and dispose of the bank. The query endpoint is `q+T*sum(sources)`. + +This construction uses six encodes, six decodes, five copy ADDs, five cleanup +ADDs and five additional owned array lifetimes. It demonstrates a complete +logical codec schedule with literal restoration. It does not admit that `T` +as a requested recursive caller, give a free borrowed-input conversion, or +establish an advantage over an existing `U` implementation. + +## 7. Gate, codec and storage ledger + +All counts in this section concern a direct scalar reference with explicit +array access. They are not tape time, native child tariffs or a lower bound. +Gaussian units, signed arithmetic and addressing are separate operations. + +An encode or decode sweep has `r*2^(r-1)` tensor pairs. Encoding a pair uses +one multiplication by `pi` and one Gaussian ADD. Decoding uses one Gaussian +subtraction and one exact division by `pi`. Multiplication by `pi` is +`(a-b,a+b)`; exact division is `((a+b)/2,(b-a)/2)`. Thus each encode pair costs +four real additions/subtractions, while each decode pair adds two exact real +halvings. Each loads four real components and writes two. An in-place sweep +uses the owned numerical array and four real work words; loop/control storage +and physical routing are additional. Borrowed input cannot be overwritten to +obtain this in-place price. + +At `r=9`, each direction has **2,304 pairs**. The optional cold schedule therefore +adds 13,824 `pi` multiplications, 13,824 exact `pi` divisions, 110,592 real +additions/subtractions, 27,648 exact real halvings and its ten full-array copy/ +cleanup ADDs. Those ten ADDs add 10,240 real additions/subtractions, 20,480 +real-component reads and 10,240 writes. The codecs add 110,592 component reads +and 55,296 writes. Five extra owned banks add 2,560 complex words and 5,120 +component initializations and zero checks each. These quantities are additional +to the direct collector below; they are not paid by an abstract rank count. + +For the literal collector, both seven-stage transforms use `7*512=3,584` +pair applications altogether. Each credited signed-floor pair costs eight +real additions/subtractions, four real floor halvings and one Gaussian quarter +turn. The eleven field ADDs cost `22*512` more real additions/subtractions. +The four actual wrapper cycle counts, in chronological order, are + +\[ + U_{right}:64,\quad U_{left}:128,\quad V_{right}:160,\quad V_{left}:64. +\] + +The credited one-zero-Gaussian-scratch cycle algorithm uses `N+c` swaps for a +wrapper with `c` cycles and `N` unit phase applications. Here it gives **416 +cycles and 2,464 swaps**, plus 2,048 phase applications. The old paired-inverse +schedule's 384 cycles and 2,432 swaps do not price these separately archived +return wrappers. The phase acts on the cycle scratch before each swap, so its +arithmetic is counted without an extra full-array phase pass. + +| Direct collector operation | Count | +|---|---:| +| Signed-floor pair applications | 3,584 | +| Real additions/subtractions, including all eleven field ADDs | 39,936 | +| Real floor halvings | 14,336 | +| Pair Gaussian quarter turns | 3,584 | +| Actual wrapper Gaussian swaps | 2,464 | +| Actual wrapper unit phase applications | 2,048 | +| Butterfly real-component reads / writes | 14,336 / 14,336 | +| Field-ADD real-component reads / writes | 22,528 / 11,264 | +| Wrapper-swap component reads / writes, including scratch | 9,856 / 9,856 | +| Private initialization / zero-check component inspections | 1,024 / 1,024 | + +The 10,240 source-component reads are a subtotal of the field-ADD reads, not an +extra charge. The direct contract has five borrowed source arrays, one mutable +query, one owned zero private array and one zero Gaussian wrapper scratch, +with constant pair work. The optional cold schedule supplies the five source +arrays by additional owned copies. Source plans, range/type validation, +permissions, address/control work, physical movement, allocator behavior, +recursive children, precision metadata and final endpoint consumption require +their actual caller's tariff. They do not acquire a zero price from these +scalar counts. + +## 8. Finite headroom + +Let `H` bound the absolute value of every real and imaginary component at a +codec's own entrance. During an encode the exact largest real component row +sum after at most `r` factors is bounded by + +\[ + M_r=\sum_{k=0}^r {r\choose k} + (|\Re\pi^k|+|\Im\pi^k|). +\] + +This follows by expanding a tensor row; its entries are powers of `pi`, one +for each subset. A smaller partial row is covered by the same nonnegative +bound. For `r=9`, `M_r=3363`. Thus `M_r H` bounds stored encoder components; +`3 M_r H` is a conservative bound for its two-step arithmetic temporaries. + +A row of a `k`-factor inverse sweep is a signed sum of `2^k` inputs divided by +`pi^k`. Its real component row sum is +`2^k (|Re pi^-k|+|Im pi^-k|)=|Re pi^k|+|Im pi^k|`, at most +`2^ceil(r/2)`. Therefore decoder components are bounded by `2^ceil(r/2) H`, +and its subtraction/numerator temporaries by four times that amount. These +are sufficient arithmetic bounds, not a compression or precision advantage. + +For the direct collector suppose its six admitted entrance fields have +integer numerator components bounded by `H`. The sum of five sources has +Hilbert norm at most `5 sqrt(2N) H`. Every exact native prefix is unitary, +including each wrapper. At `N=512`, **160 H** bounds every native-prefix real +component; **161 H** bounds the updated query. A conservative signed-floor +pair scratch bound is **800 H**. Gathers and ungathers are bounded sums of at +most five unchanged sources. Partially written stages store either preceding +or completed pair values, so these same bounds cover the entire execution. + +For the optional cold caller, now let `H` bound its **raw coefficient** entrance. +Encoding gives `3363 H`; the collector therefore gives an encoded query bound +`161*3363 H=541443 H`. Decoding that query gives at most +`32*161*3363 H=17326176 H`. The conservative complete scratch bound is four +times this last quantity, **69304704 H**, which also dominates the encoder, +native pair, source-bank decoding and cleanup temporaries. These composed +bounds make the optional caller's finite-width obligation explicit; they are +not measured peaks or necessary widths. + +For a nonnegative integer component bound `M`, +`1+ceil_log2(M+1)` signed bits suffice. This states an explicit finite range; +an actual fixed-width implementation must use that range, retain the required +grid and charge its bit arithmetic. The older sharp scalar-grid/Clifford +denominator results remain credited and unchanged. + +## 9. Evidence boundary and stopping decision + +The written arguments hold at every finite rank. The new managed-Python model +and finite source checks are bounded by nine address bits, 512 complex entries +and 8,192 magnitude bits per admitted input or returned array component. +Signed storage may require another bit; exact arithmetic temporaries have the +additional finite headroom derived above. The functional model allocates fresh +lists, while the direct ledger prices the separately specified in-place codec +and credited cycle-scratch algorithm. It is not a measurement of Python +allocation. Membership checks and snapshots inside verification are test work; +a production caller must establish or pay for its lattice entrance. +Managed allocation and verification snapshots are not a physical memory +implementation. Exact checks use explicit exceptions, including under Python +optimization. + +Finite verification binds the two archived recipes, checks exact operators and +both literal directions on admitted states, tests dirty collector endpoints, +and exercises the missing-prefix, phase-alphabet, wrong weighting, quarter-ADD, +intertwiner and source/invoice failure boundaries. The separate checker uses +its own representation and does not derive a nonlinear universal theorem from +finite basis samples. Source-native correctness, physical ownership, eventual +recursive prices and human/proof-kernel admission remain separate premises. + +The result stops at a phase-compatible exactness theorem, one actual complete +local collector, an explicit codec/intertwiner, and their full direct logical +ledger. It neither proves that earlier arbitrary P104 inputs satisfy the +entrance nor extends the contract to the later quarter ADDs. A larger caller +needs an actual admitted source of this state and a compatible fully charged +consumer. No selected frontier, all-size supplier, new scalar-grid guard, +physical storage saving or new kappa follows. + +Prepared by Clear1nsight with substantial OpenAI assistance. Separate automated +derivation and review are not independent human or formal-kernel verification. +Apache-2.0; predecessor authors and original source notices retain their credit. diff --git a/research/p104-clifford-exactness/README.md b/research/p104-clifford-exactness/README.md new file mode 100644 index 0000000000..581edcfcbc --- /dev/null +++ b/research/p104-clifford-exactness/README.md @@ -0,0 +1,280 @@ +# A phase-compatible exact domain for one complete P104 collector + +This package gives an explicit Gaussian Newton lattice on which the original +fifteen-event P104 collector executes **exactly on its retained grid**, including +both separately archived native transports and all four actual phase wrappers. +Its five borrowed sources remain unchanged, its dirty query receives the exact +native update, and its owned private array returns to literal zero. + +The new result is the phase-compatible entrance contract, its all-rank +maximality theorem, and its application to this complete local collector. +The construction uses classical Clifford and Barnes–Wall/coding ideas, with a +self-contained proof for the source's Gaussian normalization. It does not +claim a new classical lattice family or a new scalar precision threshold. + +The entrance is a substantive restriction. A full P104 producer has not been +shown to supply it. The package also specifies and charges an optional codec +schedule for arbitrary coefficient inputs; that schedule realizes the conjugate +logical map `E^-1 U E`. Input conversion, later divisions, physical hosting and +recursive consumption still have to meet the larger caller's contract. There +is no supplier or kappa improvement in this contribution. + +## Mathematical result + +Put `R = Z[i]` and `pi = 1+i`. An array on an `r`-bit address cube has unique +multilinear Newton coefficients `a_S`. Define + +\[ + \mathcal B_r=\{f(x)=\sum_S a_Sx^S:\ \pi^{|S|}\mid a_S\}, + \qquad + E_r=\begin{pmatrix}1&0\\1&1+i\end{pmatrix}^{\otimes r}. +\] + +The encoder maps arbitrary Gaussian coefficients bijectively onto `B_r`. +For the source's Gaussian butterfly + +\[ + C(a,b)=\bigl((a+b+i(a-b))/2,\ (a+b-i(a-b))/2\bigr), +\] + +its coefficient action becomes the integral update + +\[ + E_1^{-1}CE_1:(c_0,c_1)\longmapsto(c_0+c_1,ic_1). +\] + +[PROOF.md](PROOF.md) establishes four linked statements. + +1. **Exact maximality.** `B_r` is exactly the Gaussian-integral entrance on + which every partial coordinate product `C_T` remains Gaussian integral. + It is consequently the largest integral module invariant under every + coordinate `C_j`. The proof is Boolean Möbius inversion of + `(C_T f)(0) = sum_(S subset T) a_S/pi^|S|`. +2. **Literal signed-floor exactness.** The credited lifting pair agrees with + the ideal butterfly exactly when `pi` divides the input difference. + The domain invariant supplies this condition at every prefix, including + negative integers. This all-input argument is separate from basis testing. +3. **Phase and address closure.** The module is preserved by invertible + binary affine address maps and input-address phases + `i^(p + sum l_j x_j + 2 sum q_jk x_j x_k)`. Explicit integral coefficient + formulas cover address XOR, SWAP, CNOT, S and CZ, with their inverses. + All four actual source wrappers have precisely this alphabet. +4. **One complete collector.** For five source arrays and an initial query + in `2^-f B_9`, the literal endpoint is + `(D,Q,C=0) -> (D,Q + U sum(D),C=0)`, on the same grid. The archived return + `V` satisfies `VU=I`; no paired-inverse substitution is made. + +The maximality quantifier matters. For `f=pi*x0*x1`, each of `C_0 f` and +`C_1 f` is integral, but the composed transform has constant coefficient +`1/pi`. The proof therefore concerns every partial product, rather than +individual entrance tests or arbitrary completed-word cancellations. + +This domain also has a precise relationship to the preceding work. Ross +Richardson's PR3068 structured phase witness `(1,i)` belongs to `B_1` and +executes exactly here. That changes the phase-closure premise. It does not +establish a global containment of the earlier Gamma/Lambda period lattices. + +## Exact source and collector boundary + +Scientific base: `6f100d4bb5083f8c35d96fd95a539811c62f245c`, priority revision 6. +[SOURCES.json](SOURCES.json) contains Git blobs, SHA256 digests, predecessor +heads and attribution. The twelve declared inputs include all executed or +authenticated source files and the retained source notices. The selected +record and originating task catalogue are historical provenance. + +| Source | Exact role | +|---|---| +| ywz65 / PR2586, `7953c9a8f788a8de5cf2ced63d9a61b67c22c6f1` | The literal 5,398-event word and native recipes, preserved by the rounded-collector archive | +| Tekalign / PR3025, `a544ef068a46f4de3bc47d1d02149cbdc3ba547f` | Signed-floor pair, source phase convention, in-place wrapper algorithm and earlier scalar invoice | +| Ross Richardson / PR3068, `7d2c519a1fdcc6bf66f6f08757eed7c48762d3f2` | Period-domain contract and the phase/exactness handoff motivating this changed scope | + +The consumed interval is **zero-based events 2025–2039**. The verifier binds +both unique native occurrences, at 2031 and 2033, and checks the word's frame +and private-lifetime syntax through event 2039. That structural prefix check +does not execute the preceding arithmetic or establish its numerical domain. + +| Item | Contract | +|---|---| +| Address space | 512 complex entries, nine binary address bits | +| Borrowed sources | D31, D30, D29, D28, D27; arbitrary within `2^-f B_9`, unchanged locally | +| Source frame | `[256,136,64,40,16,4,2,1]` | +| Mutable query | Arbitrarily dirty Q7 in `2^-f B_9`, frame `[364]` | +| Private C | Owned zero array, allocated at 2025 and checked zero before erasure at 2039 | +| Numerical word | Five gathers, rank-seven U, one query ADD, separately archived rank-seven V, five ungathers | +| Distinct roles | Source, query and private ownership remain separate; physical delivery is an external premise | + +## Evidence and reproducibility + +The retained [RECEIPT.json](RECEIPT.json) is reproduced in full, including +implementation hashes. The verifier compiles the captured source bytes +directly and rejects implementation changes during replay. It authenticates +external bytes before executing the predecessor differential oracle. + +The primary implementation checks 2,450 signed pair cases, 1,234 generator +intertwiners at ranks one through four, four dense signed collector entrances +with every event/native prefix checked, and a complete optional cold codec +call. It compares the actual source's ideal and literal kernels on all array +entries. Its frame, source, ownership, cleanup, domain and invoice controls +fail explicitly under Python optimization. + +[independent.py](independent.py) was initially implemented before its author +read the primary model or proof. It imports no predecessor executable and +uses a Newton/Möbius encoder plus a separate rational numerator oracle. +[INDEPENDENT.md](INDEPENDENT.md) documents its derivation and limits. It checks: + +- All **512 complex columns** of the actual ideal U followed by V. +- All **1,024 signed real/imaginary encoder columns** through literal U and V, + with **3,670,016** pair-level exact comparisons. +- Every address and phase of all four wrappers, their inverse permutations, + and their actual cycle counts. +- Three further dense signed collectors, with source preservation, query + equality and literal private erasure; wrong return and wrong phase controls + preserve the lattice but fail the endpoint. + +The combined checks retain controls for individual-gate versus partial-product +integrality, the admitted old phase witness, encoder intertwiners, +out-of-alphabet cubic phase, quarter division and unjustified codec commutation. +This is separate automated derivation and checking within one assisted +contribution. Independent human review and formal proof-kernel checking remain +unperformed. + +From a checkout containing the declared sources, using standard-library Python: + +```sh +python3.12 -B scripts/research_package.py --package research/p104-clifford-exactness --check-only +python3.12 -B scripts/research_package.py --package research/p104-clifford-exactness +``` + +The registered manifest runs the complete replay normally and under `-O`, +with a 300-second cap per command. A source-complete export needs neither Git +nor network for the mathematical replay: + +```sh +python3 -I -B research/p104-clifford-exactness/verify.py +python3 -I -O -B research/p104-clifford-exactness/verify.py +``` + +The standalone checker accepts `--repo /path/to/source-root`. The generic +metadata checker separately needs Git provenance and the original catalogue; +a Git-free mathematical PASS does not claim that metadata operation ran. +Native compiler, full selected-baseline, whole-word arithmetic and recursive +supplier replays are outside this local result. + +## Complete local accounting and remaining prices + +The direct invoice prices the specified in-place numeric schedule. Functional +Python copies, membership checks and verification snapshots are instrumentation. +A production caller must either establish the entrance precondition or pay +for its validation. Address plans, control/tape work and physical routes need +their actual implementation tariff. + +| Direct collector item | Exact count | +|---|---:| +| Unit whole-array ADDs | 11 | +| Signed-floor pair applications | 3,584 | +| Real additions/subtractions, including the eleven ADDs | 39,936 | +| Floor halvings | 14,336 | +| Pair quarter turns | 3,584 | +| Actual wrapper unit phases | 2,048 | +| Actual wrapper cycles | 416 | +| Actual wrapper Gaussian swaps | 2,464 | + +The four cycle counts are `[64,128,160,64]`. PR3025's different paired-inverse +schedule would give 384 cycles and 2,432 swaps. A rejecting invoice control +prevents those counts from being used for the actual archived V. The proof +and receipt retain component reads/writes, zero initialization/checks, source +access subtotals, one owned C bank, one Gaussian wrapper scratch and pair work. + +One nine-bit encoder or decoder has **2,304 pair steps**. The optional cold +coefficient call preserves five borrowed inputs by creating five owned copies, +encoding those copies and the mutable query, executing the collector, decoding +all six fields, and uncopying the five source banks to zero. In addition to +the direct collector it needs: + +- Six encodes and six decodes: 110,592 real additions/subtractions and + 27,648 exact real halvings. +- Five copy ADDs and five cleanup ADDs: 10,240 more real additions/subtractions. +- Five additional owned banks: 2,560 complex words, with explicit initialization, + zero checks and the component traversal counts in the receipt. + +The endpoint is `q + E^-1 U E sum(D)`. The package does not identify this with +an existing caller requesting U. The conversion is constructive and fully +counted in the direct numeric currency; its logical compatibility and physical +price still have to be established by a consumer. + +Finite headroom is explicit. For entrance component bound H, encoding has +conservative component bound `3363 H`, a direct admitted collector has native +prefix bound `160 H` and query bound `161 H`, and decoding has factor 32. +Composing the optional cold schedule gives query bound `17326176 H` and +conservative scratch bound `69304704 H`. These are sufficient range bounds, +with signed storage and primitive bit costs still to be charged. + +| Family-level obligation | Status in this contribution | +|---|---| +| Fixed local word, source bytes, frames and clean private endpoint | Supplied under the stated entrance contract | +| Every literal phase/native prefix is exact | Proved on `2^-f B_9` | +| Codec identity, borrowed-source strategy and direct numeric bill | Supplied for the explicit conjugate logical map | +| Earlier producer supplies B_9 at this cut | Unproved | +| Later quarter ADDs preserve the required domain | Require source in `4 B_r`; not automatic | +| Native backend, physical owners, routing, control tape and precision admission | Unpriced or inherited; no admission claimed | +| Favorable complete consumer or supplier moment | Unknown | + +The stopping decision is to retain this theorem and one complete collector +contract. An expansion needs an actual compatible producer/consumer and its +whole bill. No claimed saving is available for that consumer to inherit for +free. + +## Task selection and coordination + +This is a handoff-first, changed-scope continuation of the `p104-side-correction` +card, using PR3068's state-exactness question. The original card, seed, scope +key, source checkpoint and overlap limits are retained in [TASK.json](TASK.json). +The advance claim is +[Discussion2750 comment19008062](https://github.com/CrocSwap/integer-mult-bounds/discussions/2750#discussioncomment-19008062). + +At entry the check covered all 276 open PR records and 332 visible Discussion +records across twelve relevant threads, plus targeted P104/lattice/coding terms. +Discussion pagination and sparse local-package coverage were incomplete; +unpublished work was not inspected. Existing grid thresholds, period-index +studies and generic min-cut/frame optimizers were identified and left outside +this result. The card's baseline orientation command could not complete in +the sparse checkout because its selected assembly input was omitted; no +baseline PASS or selected-construction failure is inferred. + +## Open next questions + +1. **Can a real preceding producer supply this entrance?** This matters because + local exactness has value only when the required states reach the cut. The + first step is to trace one actual source producer's Newton divisibility, + including every coefficient division, and price any required preparation. + Arbitrary prior arithmetic and physical source availability are the blockers. +2. **Can an actual next consumer retain the representation?** Bind one real + downstream operation, its frames and requested map. For a quarter source, + prove membership in `4 B_r` before dividing; for coefficient coordinates, + prove the required intertwiner. Full caller compatibility is currently open. +3. **Can a complete physical implementation improve the bill?** Combine a + proven producer/consumer with the paid Gaussian-monomial and arithmetic + backend, retained storage, control tape, precision and cleanup costs. Until + those contracts are bound, there is no favorable recursive or supplier + moment to compare with the selected construction. + +## Credit and license + +Prepared by Clear1nsight with substantial OpenAI assistance, including three +concurrent agents for algebra, independent reconstruction and source/cost +review. Apache-2.0. Original headers, LICENSE, NOTICE, upstream/LICENSE and +source-specific READMEs are retained in the declared export closure. + +Credit ywz65/PR2586 and the native P104 lineage; Arham Tahir/PR2665/2999 and +numerical-boundary work; Tekalign/PR3025/3033; Ross Richardson/PR3068 and the +sharp Clifford-grid method; Nick Petalas/PR2754/2771/3035/3037; Arham Tahir's +PR3046; Alejandro Zarzuelo Urdiales's Gaussian parity work; and the retained +geometry/compiler lineage, including Chafik Boukhalfa/PR628. Jose Manuel's +PR3087 physical Gaussian monomial implementation is related context, with +its separate physical assumptions and costs retained. + +Classical inspiration: Nebe, Rains and Sloane, +[The invariants of the Clifford groups](https://arxiv.org/abs/math/0001038) and +[A Simple Construction for the Barnes-Wall Lattices](https://arxiv.org/abs/math/0207186). +The application, exact source contract and executable checks here are the +claimed contribution; those classical constructions retain their authorship. diff --git a/research/p104-clifford-exactness/RECEIPT.json b/research/p104-clifford-exactness/RECEIPT.json new file mode 100644 index 0000000000..6240d5c682 --- /dev/null +++ b/research/p104-clifford-exactness/RECEIPT.json @@ -0,0 +1,823 @@ +{ + "collector_event_range_inclusive": [ + 2025, + 2039 + ], + "implementation_sha256": { + "independent.py": "7c9197da4f7592cfbce401a8f581d1588ed3c334a1e6bf8b80db088cead0e1d1", + "model.py": "74c83367887dd885137b222155c86389fe0be9f1293a6f0e5fdb51d71f435fdd", + "verify.py": "0713d7b33d9484aff7fb29c08e74fb11247fedfac5031badd59008b3fd7fb153" + }, + "independent": { + "boundary_controls": { + "CE_e0": [ + [ + 1, + 0 + ], + [ + 1, + 0 + ] + ], + "cubic_phase_outside_B3": [ + [ + 1, + 0 + ], + [ + 1, + 0 + ], + [ + 1, + 0 + ], + [ + 1, + 0 + ], + [ + 1, + 0 + ], + [ + 1, + 0 + ], + [ + 1, + 0 + ], + [ + -1, + 0 + ] + ], + "first_exact_C0": [ + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 1, + 0 + ], + [ + 0, + 1 + ] + ], + "individual_exact_C1": [ + [ + 0, + 0 + ], + [ + 1, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 1 + ] + ], + "integral_quarter_outside_B1": [ + [ + 1, + 0 + ], + [ + 0, + 0 + ] + ], + "phase_witness": [ + [ + 1, + 0 + ], + [ + 0, + 1 + ] + ], + "phase_witness_coefficients": [ + [ + 1, + 0 + ], + [ + 0, + 1 + ] + ], + "quarter_source_in_B1": [ + [ + 4, + 0 + ], + [ + 0, + 0 + ] + ], + "second_C1_rejection": "literal pair rounding defect", + "signed_floor_cases": 450, + "single_gate_outside_B2": [ + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 1, + 1 + ] + ], + "two_times_EC_e0": [ + [ + 1, + 1 + ], + [ + 3, + 1 + ] + ] + }, + "collector": { + "actual_one_scratch_wrapper_swaps": 2464, + "actual_return_phase_control": "private C erases exactly", + "actual_wrapper_cycles": 416, + "dense_signed_fixtures": [ + { + "checkpoints": { + "2030": "81b9c670559101613e85287046031609dae51d539f8ad0b027bdbd1bef4a2235", + "2031": "955512b81af0f412b4e400c24874c86030ac5b635b41450a6e288211981acc3b", + "2033": "81b9c670559101613e85287046031609dae51d539f8ad0b027bdbd1bef4a2235", + "private_C": "c8e145f4220685e764568718191bfa96c3227f8b845bc8032698b49d8f8b4d16" + }, + "initial_query_sha256": "b9d8e1dc8c1c084042e55aaa65f6efcd70a8ba27296e68b174b5ba80716abbaf", + "query_sha256": "27155bfd9971a366eb83da7923ac352ab81c3046b0b6f01f4249accb7bb903ea", + "sources_sha256": "771cbbb48b57ba9863800ba8e5802dad12a1c8c764268e079f98ca6ab1b054b1" + }, + { + "checkpoints": { + "2030": "d22c2f12c73ea04d414e3c14d42993c78b622716012e2766a07bbbf178e50187", + "2031": "001bb56e7ca6321b7257c266d094bb45c6c1ffbf4055bb8cdcd401ef1d78e13f", + "2033": "d22c2f12c73ea04d414e3c14d42993c78b622716012e2766a07bbbf178e50187", + "private_C": "c8e145f4220685e764568718191bfa96c3227f8b845bc8032698b49d8f8b4d16" + }, + "initial_query_sha256": "4ce50e8025dfecce7344685cca853b7d5bba07b5ea051f597cfe1d2346b374fd", + "query_sha256": "5e3ef98d04ac44fa720390234e54136b3891f4143623a99ed61a1878ba9d5e9d", + "sources_sha256": "35fd82c1f94d178f59aa665a5b3f1c4c80b119a8b23ec1371e8e969729a8d9e2" + }, + { + "checkpoints": { + "2030": "f57177ba1868a156d79b131e27f4e16bedeceea18c60b2c4839d532a7ac8419d", + "2031": "32bed4f2df7b256366dab16b673437fb156d9eafb316b17bba3235029202ccba", + "2033": "f57177ba1868a156d79b131e27f4e16bedeceea18c60b2c4839d532a7ac8419d", + "private_C": "c8e145f4220685e764568718191bfa96c3227f8b845bc8032698b49d8f8b4d16" + }, + "initial_query_sha256": "7df6ebf43cdcff687558c20b24b32e438b064a71296a200114efcac91d15de43", + "query_sha256": "29aeb6ee1e0fc4dfa5f842010563ade34730f8baf0235bf9f01e0cfd5099fc96", + "sources_sha256": "fef861238bbecdaadd0960468c49661d0366baf06d6a127be2edc08b84272d1a" + } + ], + "forward_used_as_return_control": "private C erases exactly", + "literal_events": 15, + "literal_pair_invocations_per_collector": 3584, + "literal_wrapper_invocations": 4, + "transport_calls": 2, + "unit_array_ADDs": 11 + }, + "collector_event_range_inclusive": [ + 2025, + 2039 + ], + "collector_events_sha256": "168eb0ef65a3263f11d916cdf966b473627e712237f55b0783a3943649c35049", + "complete_columns": { + "VU_numerator_denominator": 16384, + "ideal_U_columns_sha256": "6b3a485a8bb8589b20f0085ea3c18d6548f6f569c0f73c44e4ed36cc1eda5177", + "ideal_U_numerator_denominator": 128, + "ideal_complex_columns": 512, + "literal_U_basis_sha256": "8ee8bd660f0219454e548ec75e9ef19b24c637b2e4ebe4fd053859d8c4a9f5c7", + "literal_basis_pair_obligations": 3670016, + "signed_Z_basis_columns": 1024 + }, + "generator_intertwiners": { + "C": [ + [ + [ + 1, + 0 + ], + [ + 1, + 0 + ] + ], + [ + [ + 0, + 0 + ], + [ + 0, + 1 + ] + ] + ], + "CNOT_0_to_1": [ + [ + [ + 1, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ] + ], + [ + [ + 0, + 0 + ], + [ + 1, + 0 + ], + [ + 1, + 0 + ], + [ + 1, + 1 + ] + ], + [ + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 1, + 0 + ], + [ + 0, + 0 + ] + ], + [ + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + -1, + 1 + ], + [ + -1, + 0 + ] + ] + ], + "CZ": [ + [ + [ + 1, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ] + ], + [ + [ + 0, + 0 + ], + [ + 1, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 0 + ] + ], + [ + [ + 0, + 0 + ], + [ + 0, + 0 + ], + [ + 1, + 0 + ], + [ + 0, + 0 + ] + ], + [ + [ + 0, + 1 + ], + [ + -1, + 1 + ], + [ + -1, + 1 + ], + [ + -1, + 0 + ] + ] + ], + "C_inverse": [ + [ + [ + 1, + 0 + ], + [ + 0, + 1 + ] + ], + [ + [ + 0, + 0 + ], + [ + 0, + -1 + ] + ] + ], + "S": [ + [ + [ + 1, + 0 + ], + [ + 0, + 0 + ] + ], + [ + [ + 0, + 1 + ], + [ + 0, + 1 + ] + ] + ], + "X": [ + [ + [ + 1, + 0 + ], + [ + 1, + 1 + ] + ], + [ + [ + 0, + 0 + ], + [ + -1, + 0 + ] + ] + ] + }, + "literal_wrappers": { + "2031:left": { + "addresses": 512, + "cycle_length_histogram": { + "1": 64, + "7": 64 + }, + "one_scratch_cycle_swaps": 640, + "permutation_cycles": 128, + "phase_histogram": [ + 128, + 128, + 128, + 128 + ], + "plan_sha256": "7e6a13783153c5c4c8ca245c3b999ef7c51f5a146e9336536c4d296d85824207", + "source_record_sha256": "995d0014b144b48cae82865674bda274e0383535c723ed022a33e524c80a04a9" + }, + "2031:right": { + "addresses": 512, + "cycle_length_histogram": { + "8": 64 + }, + "one_scratch_cycle_swaps": 576, + "permutation_cycles": 64, + "phase_histogram": [ + 128, + 128, + 128, + 128 + ], + "plan_sha256": "0057fb29d064227ff03f3d3c0d66509bb2da3f7555c0a5fa53b6b09e0fdd35be", + "source_record_sha256": "052a6f6f96033d19f2e2d00350fe680cfe29e029c51156ac28a39d6f69a81965" + }, + "2033:left": { + "addresses": 512, + "cycle_length_histogram": { + "1": 32, + "15": 32 + }, + "one_scratch_cycle_swaps": 576, + "permutation_cycles": 64, + "phase_histogram": [ + 128, + 128, + 128, + 128 + ], + "plan_sha256": "ca83360d48312a178d2c38b88979eb1f035053b7d2ddcadf40bbf61acc9b36da", + "source_record_sha256": "ec44d8823a6a90d82c1b17f14868edd2f790fd5491278f043da4632bb14821ff" + }, + "2033:right": { + "addresses": 512, + "cycle_length_histogram": { + "2": 64, + "4": 96 + }, + "one_scratch_cycle_swaps": 672, + "permutation_cycles": 160, + "phase_histogram": [ + 128, + 128, + 128, + 128 + ], + "plan_sha256": "345c23ad9689c9a842f5d2badf5904c8d7ec8eebaba1b8e132362c83ee4c383e", + "source_record_sha256": "fdb5b96d9e1ab2bf894d910d278feb51ec7c6e7e4e38b7b13297517db430ccdd" + } + }, + "schema_version": 1, + "scope": "Exact restricted-entrance local collector and Gaussian module; no caller supply, physical owner, recursive cost or frontier admission.", + "source_byte_sizes": { + "NATIVE.json.gz": 49610, + "WORD.json": 288482, + "lifting.py": 8567 + }, + "source_sha256": { + "NATIVE.json.gz": "ab91c78835c3e10cf3b2cb8a5d4e0b7cfc3df1ae5a811298d27842f2193e1e3d", + "WORD.json": "cec1fb3fbd0067b500ad5119a62ba60685be718e769374d7ec8abdd2beaa7e50", + "lifting.py": "9424ee08f22b717f6d58f7cc46f189c5549fa86778afcd0c0762ab2daf591160" + }, + "status": "PASS_INDEPENDENT_P104_PHASE_COMPLETE_DOMAIN" + }, + "literal_events_sha256": "168eb0ef65a3263f11d916cdf966b473627e712237f55b0783a3943649c35049", + "primary_algebra": { + "generator_intertwiner_cases_ranks_1_through_4": 1234, + "integral_quarter_rejected_at_ranks_1_and_9": true, + "phase_witness_admitted_exactly": true, + "signed_pair_cases_including_inverse": 2450, + "single_bit_coefficient_output_limit": "Gaussian component exceeds finite reference limit", + "single_gate_not_all_partial_products": "ideal Gaussian pair has a nonintegral component", + "unjustified_codec_commutation_rejected": true + }, + "primary_collector": { + "actual_wrappers": { + "U:left": { + "all_512_addresses_and_phases_match_source": true, + "cycles": 128, + "plan_sha256": "7e6a13783153c5c4c8ca245c3b999ef7c51f5a146e9336536c4d296d85824207" + }, + "U:right": { + "all_512_addresses_and_phases_match_source": true, + "cycles": 64, + "plan_sha256": "0057fb29d064227ff03f3d3c0d66509bb2da3f7555c0a5fa53b6b09e0fdd35be" + }, + "V:left": { + "all_512_addresses_and_phases_match_source": true, + "cycles": 64, + "plan_sha256": "ca83360d48312a178d2c38b88979eb1f035053b7d2ddcadf40bbf61acc9b36da" + }, + "V:right": { + "all_512_addresses_and_phases_match_source": true, + "cycles": 160, + "plan_sha256": "345c23ad9689c9a842f5d2badf5904c8d7ec8eebaba1b8e132362c83ee4c383e" + } + }, + "codec_bounds_for_unit_component_entrance": { + "decode_component_bound": 32, + "decode_component_gain": 32, + "decode_scratch_bound": 128, + "encode_component_bound": 3363, + "encode_component_gain": 3363, + "encode_scratch_bound": 10089, + "entrance_component_bound": 1, + "rank": 9 + }, + "codec_per_bank_per_direction": { + "borrowed_input_copy_included": false, + "complex_coordinates": 512, + "decode": { + "component_reads": 9216, + "component_writes": 4608, + "exact_pi_divisions": 2304, + "exact_real_halves": 4608, + "gaussian_subtracts": 2304, + "real_add_subtracts": 9216 + }, + "encode": { + "component_reads": 9216, + "component_writes": 4608, + "gaussian_adds": 2304, + "pi_multiplications": 2304, + "real_add_subtracts": 9216 + }, + "owned_in_place_complex_words": 512, + "pair_real_work_words": 4, + "pairs_per_direction": 2304, + "rank": 9, + "routing_included": false + }, + "cold_codec_bounds_for_unit_component_entrance": { + "complete_scratch_component_bound": 69304704, + "decoded_query_component_bound": 17326176, + "encoded_component_bound": 3363, + "encoded_query_component_bound": 541443, + "logical_output_map": "T = E_r^-1 U E_r", + "native_prefix_component_bound": 538080, + "rank": 9, + "raw_entrance_component_bound": 1 + }, + "cold_codec_extra_ledger": { + "add_to_direct_collector_invoice": true, + "codec_component_reads": 110592, + "codec_component_writes": 55296, + "codec_exact_pi_divisions": 13824, + "codec_exact_real_halves": 27648, + "codec_pi_multiplications": 13824, + "codec_real_add_subtracts": 110592, + "copy_cleanup_component_reads": 20480, + "copy_cleanup_component_writes": 10240, + "copy_cleanup_real_add_subtracts": 10240, + "decodes": 6, + "encodes": 6, + "extra_owned_source_complex_words": 2560, + "extra_private_initialization_components": 5120, + "extra_private_zero_check_components": 5120, + "logical_output_map": "T = E_r^-1 U E_r", + "original_U_caller_admitted": false, + "owned_source_cleanup_adds": 5, + "owned_source_copy_adds": 5, + "physical_routing_and_recursive_tariff_included": false, + "rank": 9 + }, + "cold_coefficient_contract": { + "five_copy_banks_return_zero": true, + "logical_map": "Q + E^-1 U E sum(D)", + "query_sha256": "73ed35980748e1d10663a6bec61472bd493668107d6b8893fc9265007b13a040" + }, + "collector_bounds_for_unit_component_entrance": { + "assumption": "exact unitary native prefixes on the admitted lattice", + "entrance_component_bound": 1, + "native_prefix_component_bound": 160, + "pair_scratch_component_bound": 800, + "query_component_bound": 161, + "rank": 9, + "source_count": 5 + }, + "controls": { + "cleanup_omission": "literal private zero at ERASE", + "out_of_domain_entrance": "collector lattice entrance", + "output_address_phase_substitution_differs": 384, + "owned_zero_required": "private C requires owned zero entrance", + "paired_inverse_invoice_rejected": "literal wrapper invoice differs from independent source counts", + "paired_inverse_swap_undercharge": [ + 2432, + 2464 + ], + "return_wrapper_record_differences": [ + 512, + 512 + ] + }, + "dense_signed_collectors": [ + { + "all_five_sources_unchanged": true, + "owned_private_C_erases_exactly": true, + "prefix_snapshots": 33, + "prefixes_sha256": "db87193583a0770e58f73cf4d486d4c0e16b7a6cc9c0de9d63bd4510dd956bc4", + "query_sha256": "0c3ab1b8bd48c204d2c06d1f6c2dcdf689a4ce80731341e0cf5b617595891185" + }, + { + "all_five_sources_unchanged": true, + "owned_private_C_erases_exactly": true, + "prefix_snapshots": 33, + "prefixes_sha256": "38979f1dda661dda0777571d96f989788df0ffa4cec71d3dd5971ff256a70526", + "query_sha256": "ca34eac93b653a2e337e391c31e31029c6b965ee151295ddfd6af3f765707fc7" + }, + { + "all_five_sources_unchanged": true, + "owned_private_C_erases_exactly": true, + "prefix_snapshots": 33, + "prefixes_sha256": "1ae11da2efe75a284621809b9d9d43b7f3bb6a21334e08e872db10eb772355f4", + "query_sha256": "b30636f087da7195e33110b3424628068d0cb77ce06ddbab024e5ea1ed083c98" + }, + { + "all_five_sources_unchanged": true, + "owned_private_C_erases_exactly": true, + "prefix_snapshots": 33, + "prefixes_sha256": "091ad1065bdba4974926a86fcdb40c30979756d3a7e2a705c16c754ba1ccebca", + "query_sha256": "4b375f1a687dea7819bbd3f1b6dcbeb1aee4a2e9d507821d9377985b2c933ba7" + } + ], + "direct_collector_ledger": { + "borrowed_source_complex_words": 2560, + "butterfly_component_reads": 14336, + "butterfly_component_writes": 14336, + "butterfly_quarter_turns": 3584, + "codecs_included": false, + "complex_coordinates": 512, + "field_add_component_reads": 22528, + "field_add_component_writes": 11264, + "field_adds": 11, + "floor_halves": 14336, + "mutable_query_complex_words": 512, + "native_rank_each_direction": 7, + "owned_private_complex_words": 512, + "pair_real_work_words": 4, + "paired_butterflies": 3584, + "physical_routing_and_recursive_tariff_included": false, + "private_initialization_components": 1024, + "private_zero_check_components": 1024, + "real_add_subtracts": 39936, + "source_component_reads_within_field_adds": 10240, + "wrapper_cycle_counts": [ + 64, + 128, + 160, + 64 + ], + "wrapper_cycles": 416, + "wrapper_swap_component_reads": 9856, + "wrapper_swap_component_writes": 9856, + "wrapper_swaps": 2464, + "wrapper_unit_phases": 2048, + "wrapper_zero_scratch_complex_words": 1 + } + }, + "schema_version": 1, + "scope": "Phase-compatible Gaussian domain and one complete restricted-input scalar collector; no prior caller admission, physical supplier, recursive saving or changed frontier.", + "source_and_binding_controls": { + "NATIVE.json.gz_corruption": "source SHA256 mismatch: research/p104-rounded-collector/inputs/NATIVE.json.gz", + "WORD.json_corruption": "source SHA256 mismatch: research/p104-rounded-collector/inputs/WORD.json", + "ambiguous_native_occurrence": "unique native occurrence", + "lifting.py_corruption": "source SHA256 mismatch: research/p104-reversible-lifting/lifting.py", + "query_frame_drift": "literal fifteen-event collector" + }, + "source_sha256": { + "LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4", + "NOTICE": "b49022cb4104d90b182e4c335f670faf45529025b15db77bf0291835083c28bd", + "research/p104-invariant-lifting-lattice/PROOF.md": "7a34534dd75a2ae4b77d9779fee9ce43372d8a6d2038c6a763deff1f99ce7830", + "research/p104-invariant-lifting-lattice/README.md": "426721af0f8b391aa56ce2c6968b78bf4e9b386e794eb5b4854d88243762c19d", + "research/p104-retimed-internal-grid/README.md": "8ed5890fa0cb995ad90c0b2f8306735ef43c53a00681cc42797bb3a6d4b8a72b", + "research/p104-reversible-lifting/README.md": "051a886e9777b6ace444920df1fd46c285dc0251d7ef6fac570dc12cca7c4bc8", + "research/p104-reversible-lifting/lifting.py": "9424ee08f22b717f6d58f7cc46f189c5549fa86778afcd0c0762ab2daf591160", + "research/p104-rounded-collector/PREDECESSORS.json": "89f17ce76729101536cfc0be02ad153451c6606ebcfd3a1d6588226a83c88c64", + "research/p104-rounded-collector/README.md": "a77514952eda13fac047c5a4daba92d6c01d3e83bb1b41da4b87211bec6c37c9", + "research/p104-rounded-collector/inputs/NATIVE.json.gz": "ab91c78835c3e10cf3b2cb8a5d4e0b7cfc3df1ae5a811298d27842f2193e1e3d", + "research/p104-rounded-collector/inputs/WORD.json": "cec1fb3fbd0067b500ad5119a62ba60685be718e769374d7ec8abdd2beaa7e50", + "upstream/LICENSE": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + "status": "PASS_P104_CLIFFORD_EXACTNESS", + "structural_cut_binding": { + "checked_structural_prefix_events": 2040, + "earlier_arithmetic_or_domain_admission_checked": false, + "entrance_query_frame": [ + 364 + ], + "entrance_source_frames": { + "D27": [ + 256, + 136, + 64, + 40, + 16, + 4, + 2, + 1 + ], + "D28": [ + 256, + 136, + 64, + 40, + 16, + 4, + 2, + 1 + ], + "D29": [ + 256, + 136, + 64, + 40, + 16, + 4, + 2, + 1 + ], + "D30": [ + 256, + 136, + 64, + 40, + 16, + 4, + 2, + 1 + ], + "D31": [ + 256, + 136, + 64, + 40, + 16, + 4, + 2, + 1 + ] + }, + "private_C_absent_at_both_boundaries": true + } +} diff --git a/research/p104-clifford-exactness/SOURCES.json b/research/p104-clifford-exactness/SOURCES.json new file mode 100644 index 0000000000..3968635020 --- /dev/null +++ b/research/p104-clifford-exactness/SOURCES.json @@ -0,0 +1,139 @@ +{ + "schema_version": 1, + "base_commit": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "provenance", + "git_blob": "b1fea0c94436b236cc2b7d41a7be032811b94c81", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "67f085acd86acd7d4e03922d9cf4b26bca66fed5", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0" + }, + { + "path": "LICENSE", + "usage": "input", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "NOTICE", + "usage": "input", + "git_blob": "59d8e0cf3102e15bd11db430838365531e2d7f18", + "sha256": "b49022cb4104d90b182e4c335f670faf45529025b15db77bf0291835083c28bd" + }, + { + "path": "upstream/LICENSE", + "usage": "input", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "research/p104-rounded-collector/inputs/WORD.json", + "usage": "input", + "git_blob": "93acaabc0a523789ef2f1b06f6eeeefed5551397", + "sha256": "cec1fb3fbd0067b500ad5119a62ba60685be718e769374d7ec8abdd2beaa7e50" + }, + { + "path": "research/p104-rounded-collector/inputs/NATIVE.json.gz", + "usage": "input", + "git_blob": "04f2877aa5444948b7ae37efd267745af82cb34d", + "sha256": "ab91c78835c3e10cf3b2cb8a5d4e0b7cfc3df1ae5a811298d27842f2193e1e3d" + }, + { + "path": "research/p104-rounded-collector/PREDECESSORS.json", + "usage": "input", + "git_blob": "944b9920686d1f3e23268191fcc652c66d246105", + "sha256": "89f17ce76729101536cfc0be02ad153451c6606ebcfd3a1d6588226a83c88c64" + }, + { + "path": "research/p104-rounded-collector/README.md", + "usage": "input", + "git_blob": "95288f6821cc4983df25f1f18aaacfc49f4f6299", + "sha256": "a77514952eda13fac047c5a4daba92d6c01d3e83bb1b41da4b87211bec6c37c9" + }, + { + "path": "research/p104-reversible-lifting/lifting.py", + "usage": "input", + "git_blob": "524ed59c1e498f78134681bea49fac55e9541068", + "sha256": "9424ee08f22b717f6d58f7cc46f189c5549fa86778afcd0c0762ab2daf591160" + }, + { + "path": "research/p104-reversible-lifting/README.md", + "usage": "input", + "git_blob": "05eddb238528e00e0985a2cdb2e04e7595cbbb51", + "sha256": "051a886e9777b6ace444920df1fd46c285dc0251d7ef6fac570dc12cca7c4bc8" + }, + { + "path": "research/p104-invariant-lifting-lattice/README.md", + "usage": "input", + "git_blob": "92a71faba58a00c1b145dc722fde38a0bf75ffb8", + "sha256": "426721af0f8b391aa56ce2c6968b78bf4e9b386e794eb5b4854d88243762c19d" + }, + { + "path": "research/p104-invariant-lifting-lattice/PROOF.md", + "usage": "input", + "git_blob": "5dfde304a04513f302de41861e9131f1446595b9", + "sha256": "7a34534dd75a2ae4b77d9779fee9ce43372d8a6d2038c6a763deff1f99ce7830" + }, + { + "path": "research/p104-retimed-internal-grid/README.md", + "usage": "input", + "git_blob": "5324d11bb78606cc1d278554db53462f9faa6373", + "sha256": "8ed5890fa0cb995ad90c0b2f8306735ef43c53a00681cc42797bb3a6d4b8a72b" + } + ], + "credit": [ + { + "author": "ywz65", + "pull_request": "https://github.com/CrocSwap/integer-mult-bounds/pull/2586", + "head": "7953c9a8f788a8de5cf2ced63d9a61b67c22c6f1", + "contribution": "Literal corrected-dual word and all four native collector wrappers; copied data ancestry preserved in the pinned PREDECESSORS.json." + }, + { + "author": "Arham Tahir", + "pull_request": "https://github.com/CrocSwap/integer-mult-bounds/pull/2665", + "contribution": "Retained first-collector source binding and strict-zero numerical counterexample; not reproduced as a new result." + }, + { + "author": "Tekalign / tekuuu", + "pull_request": "https://github.com/CrocSwap/integer-mult-bounds/pull/3025", + "head": "a544ef068a46f4de3bc47d1d02149cbdc3ba547f", + "contribution": "Literal signed-floor pair, inverse, source wrapper convention, in-place cycle algorithm and local scalar ledger. Authenticated lifting.py is executed only for primary differential checks." + }, + { + "author": "Ross Richardson", + "pull_request": "https://github.com/CrocSwap/integer-mult-bounds/pull/3068", + "head": "7d2c519a1fdcc6bf66f6f08757eed7c48762d3f2", + "contribution": "Neighboring Gamma/Lambda period-domain contract, phase/quarter boundary examples and larger state-exactness handoff." + }, + { + "author": "Jose Manuel / jmbarrancoml", + "pull_request": "https://github.com/CrocSwap/integer-mult-bounds/pull/3087", + "head": "e7e49fb8176772c71ad7006920a407109a89e440", + "contribution": "Related physical Gaussian-monomial work; context only, not imported, replayed or admitted here." + }, + { + "author": "Nick Petalas, Arham Tahir, Alejandro Zarzuelo Urdiales, Ross Richardson and retained P104 contributors", + "contribution": "Predecessor period/precision, Gaussian parity, native binding and sharp-grid methods remain credited. The retained READMEs preserve source-specific attribution." + } + ], + "literature_inspiration": [ + { + "authors": "Gabriele Nebe, Eric M. Rains, Neil J. A. Sloane", + "title": "The invariants of the Clifford groups", + "url": "https://arxiv.org/abs/math/0001038", + "use": "Classical Gaussian Clifford/invariant-lattice context; no theorem imported by the verifier." + }, + { + "authors": "Gabriele Nebe, Eric M. Rains, Neil J. A. Sloane", + "title": "A Simple Construction for the Barnes-Wall Lattices", + "url": "https://arxiv.org/abs/math/0207186", + "use": "Classical coding/lattice motivation; the new source-bound normalization is proved directly." + } + ] +} diff --git a/research/p104-clifford-exactness/TASK.json b/research/p104-clifford-exactness/TASK.json new file mode 100644 index 0000000000..034510e25c --- /dev/null +++ b/research/p104-clifford-exactness/TASK.json @@ -0,0 +1,251 @@ +{ + "schema_version": 1, + "task_id": "p104-side-correction", + "priority_revision": 6, + "base_commit": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "original_card": { + "id": "p104-side-correction", + "question": "Can the proposed P104 joint endpoint flags be realized by a chronological correction program with coefficients, dirty restoration and an affordable complete bill?", + "starting_points": [ + "docs/research/research-family-status.md", + "research/p104-native-channel/README.md", + "research/p104-native-channel/PROOF.md", + "docs/research/community-efficient1000-review.md", + "research/p104-joint-unit-flags/README.md" + ], + "methods": [ + "Construct one side-correction word at an explicit chronological cut with the needed frames still available.", + "Derive a lower bound on the side correction and hosting costs that decides whether this channel can beat the selected budget." + ], + "acceptance_gate": "An exact arbitrary-input identity, source/target frame availability and restoration at the chosen cut, plus the complete channel+correction+idle/hosting bill or an explicit favorable bound. The native channel alone is not a supplier. A scoped local result may be retained without a complete supplier. Expanding it into further construction rounds requires the family-level budget and obligation gate in research-family-status.md; an optimistic passing relaxation alone is not acceptance.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Read the revision-6 family record and #2981 static joint flags, alongside the reviewed #1991 channel. #2981 is an author-checked source archive, not an independently validated executable correction or a refutation of program-level lifetime floors.", + "scope": "Source-bound orientation only. Read the named package and review before relying on its local evidence; this command is not its replay or supplier admission." + }, + "first_experiment": "After checking live handoffs, pin one named collection from #2981 and attach acquisition/delivery times, source dependencies and coefficient requirements. Test legal access and arbitrary dirty restoration; price any completion against the full channel/endpoint/hosting allowance. Stop with the exact missing implication or a scoped counterexample rather than expanding the static cover census.", + "bottleneck_link": "Completing an already realized changed channel tests a concrete construction opportunity, instead of refining the incumbent packing. A positive local result still needs global and all-size admission.", + "allowed_variations": [ + "One correction factorization, one chronological cut, or one explicit hosting obstruction.", + "A changed correction schedule with an updated full bill and native frame contract." + ], + "scope_change_triggers": [ + "Recompiling the already certified low-rank channel without closing a new obligation.", + "Treating a pending ancestor, local histogram or unpriced side correction as an admitted global supplier.", + "Repeating a correction or physical conversion already supplied by a pending follow-up without adding independent coverage or a different unresolved obligation.", + "Repeating the 208-flag static matching or calling a static nested cover a chronological correction program. Independent audit of that certificate is distinct and remains useful." + ], + "overlap_terms": [ + "P104", + "I-G/2", + "side correction", + "native channel", + "1972", + "1991", + "2586", + "endpoint transport", + "physical dual", + "relay composition", + "2981", + "joint unit flags", + "acquisition delivery", + "static nesting" + ], + "existing_checks": [ + { + "scope": "PR #2981 reports static joint endpoint flags and a matching of 208 departure and arrival flags; archival intake is not independent verification.", + "evidence": "research/p104-joint-unit-flags/README.md", + "remaining": "Independent flag check and a chronological coefficient program with dirty restoration and a complete cost.", + "status": "author-checked", + "source_commit": "3d24b92d8ba057b57cb2d480170ec407520e6882", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Prove an all-rank phase-compatible Gaussian Newton exactness domain and explicit encoding/intertwiners, then bind the complete restricted-entrance P104 collector at PR2586 events2025–2039, with owned zero private space and an explicitly charged optional coefficient-space caller.", + "scope_change_reason": "Handoff-first continuation of PR3068 larger exactness-domain question; live work already covers static endpoint flags, scalar grid thresholds and period lattices. The new target is closure under the actual collector wrapper alphabet, not a new lattice-index census.", + "bottleneck_link": "A phase-compatible exactness contract can remove the local nonlinear lifting-defect hypothesis on admitted inputs. It does not provide input admission, a paid global consumer or a recursive saving.", + "budget_minutes": null, + "stop_rule": "Stop at one quantified interface theorem and one complete source-bound collector. Do not expand if required operations leave the domain or codec/native costs remain unpriced; record these remaining obligations.", + "outcome": "completed", + "evidence": "Written all-rank proof; independent512ideal complex columns,1024signed module columns and3670016pair obligations;7dense signed collector fixtures across two implementations; literal source/frame/ownership/cleanup/invoice controls; complete deterministic receipt SHA256 7aa3d2274fdc0cd3f93da9c89f0b783991af657de8fa683627f0d7bbc8365a52. Registered CPython3.12.14 normal and optimized replay and metadata/source-pin validation PASS; source-complete export verification is recorded in the publication handoff. Card baseline orientation exits1 because its selected assembly input is omitted in the sparse checkout; no baseline PASS or selected-construction failure claimed.", + "author": "Clear1nsight, with substantial OpenAI assistance", + "ai_assistance": "Substantial OpenAI assistance from root and three concurrent agents, with separate algebraic and executable checks to be documented.", + "open_questions": [ + { + "question": "Can a real preceding producer supply B_9 at this collector cut?", + "why_it_matters": "Local exactness helps only when actual numerical states reach the required source and query frames.", + "first_step": "Trace one actual source producer’s Newton divisibility, including every coefficient division, and price any needed preparation.", + "blocked_by": "Arbitrary prior arithmetic and physical source availability have not been proved to supply the entrance." + }, + { + "question": "Can an actual next consumer retain the representation and requested logical map?", + "why_it_matters": "An integral quarter output may leave B_r, and coefficient encoding changes the map to E^-1 U E.", + "first_step": "Bind one downstream operation, frames and requested map; prove source membership in4B_r before quarter division or the exact required intertwiner.", + "blocked_by": "Full caller compatibility and downstream domain admission are open." + }, + { + "question": "Can a complete physical implementation improve the bill?", + "why_it_matters": "The direct numerical ledger does not establish an affordable recursive child or supplier.", + "first_step": "Combine a proven producer/consumer with paid monomial/arithmetic backend, storage, control tape, precision and cleanup costs.", + "blocked_by": "Native/backend, ownership, routing and full-consumer tariffs remain unpriced or inherited." + } + ], + "budget_override": "User explicitly removed the 60-minute constraint and requested sustained multi-agent mathematical contributions.", + "selection": { + "handoff_first": true, + "card_seed": "6a8c7d90483306b0d8770073b580cf2d", + "original_scope_key": "c5367b1a1b7bed20db53", + "canonical_thread": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2750", + "upstream_checked_utc": "2026-10-17T23:07:14Z", + "claim": "https://github.com/CrocSwap/integer-mult-bounds/discussions/2750#discussioncomment-19008062", + "claim_created_utc": "2026-10-17T23:20:00Z", + "entry_overlap": { + "open_pr_records": 276, + "pagination": "100,100,76,0; complete open-PR inventory", + "visible_discussion_records": 332, + "threads": 12, + "discussion_pagination_complete": false, + "helper_leads": 93, + "targeted_terms": [ + "P104", + "Gaussian Newton", + "Clifford", + "Barnes-Wall", + "Reed-Muller", + "exactness module" + ], + "limitations": [ + "Discussion pagination incomplete", + "Sparse local package ledger coverage incomplete; targeted source READMEs were read separately", + "Unpublished code and every individual PR diff were not inspected" + ], + "decision": "Handoff-first PR3068 phase-compatible exactness continuation; no visible identical scoped claim found." + }, + "presubmit_overlap": { + "checked_at_utc": "2026-10-17T23:45:21Z", + "canonical_main": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "open_pr_records": 287, + "open_pr_pagination": [ + 100, + 100, + 87, + 0 + ], + "new_open_pr_records": 11, + "prior_open_heads_changed": 0, + "visible_discussion_records": 181, + "discussion_threads": [ + 2750, + 1166, + 1167, + 1163, + 1587 + ], + "discussion_pagination_complete": false, + "helper_sparse_local_records": 11, + "helper_lexical_leads": 60, + "relevant_new_prs": [ + 3363, + 3365, + 3371, + 3372 + ], + "relevant_new_scope": "Relay/channel coefficient work; no same-scope Gaussian Newton module proof observed.", + "direct_predecessor_heads_unchanged": true, + "claim_still_visible": true, + "decision": "continue narrow; no exhaustive novelty claim", + "limitations": [ + "Discussion pagination remains incomplete", + "Sparse local coverage and uninspected unpublished code remain limitations" + ] + } + }, + "checkpoints": [ + { + "checked_at_utc": "2026-10-17T23:07:14Z", + "canonical_main": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "priority_revision": 6, + "decision": "Read current guidance and follow handoff-first task selection; preserve earlier PR3326/3350 work." + }, + { + "checked_at_utc": "2026-10-17T23:43:30.301132+00:00", + "canonical_main": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "scientific_base": "6f100d4bb5083f8c35d96fd95a539811c62f245c", + "guidance_and_selected": [ + { + "path": "AGENTS.md", + "sha256": "eb25d8ec495b80190a4b1a634710819bb74f0fae88d5203285c2b75b6f147347", + "changed": false + }, + { + "path": "autoresearch.md", + "sha256": "8c98d179208c34a8c6768931e13f3bbeaa1cb63d59c660799ffde05c40935d9b", + "changed": false + }, + { + "path": "CONTRIBUTING.md", + "sha256": "8a49fe97e2ad088a2b2e0c5b222aaab08752783b1f9c1260790d7dd13011d215", + "changed": false + }, + { + "path": "docs/research/current-priorities.md", + "sha256": "c95e09baa997b48ba00a26ea29168e782b17392d28184ecb7a17eea5472dd77c", + "changed": false + }, + { + "path": "docs/research/agent-procedure.md", + "sha256": "b2dd2f64e5746fce6289422351f2e3d1eb224f7db09aeb72f4d6626263190aa1", + "changed": false + }, + { + "path": "docs/research/research-family-status.md", + "sha256": "9b98ab42364e90588e90410fd2773f9bc4bf5050f514101bed0a0246881b5b7e", + "changed": false + }, + { + "path": "docs/research/agent-task-catalog.json", + "sha256": "47b42433f5a85809a3aadd29c2c339da2c6ed728e4f7762df6b88bccb7874cf0", + "changed": false + }, + { + "path": "certificates/selected-result.json", + "sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129", + "changed": false + } + ], + "decision": "continue focused local theorem with frozen inputs", + "worktree_preserved": true + } + ], + "family_decision": { + "decision": "narrow: retain the checked theorem and one complete local collector; stop further implementation expansion until an actual compatible producer/consumer is bound", + "evidence_status": "author-checked with separate automated algebraic, executable and source/cost review; human/proof-kernel review and supplier admission unperformed", + "proved": [ + "Every partial coordinate C_T integral exactly on B_r", + "Actual affine/quadratic Gaussian wrappers preserve B_r", + "Actual15-event collector exact on six admitted public fields with owned zero private C", + "Exact codec/intertwining and source-preserving optional cold logical endpoint" + ], + "constructively_upper_bounded": [ + "Direct numeric collector operations and component I/O", + "Six encode/decode passes and ten source copy/cleanup ADDs with five extra owned banks", + "Finite direct/codec component and scratch ranges" + ], + "unknown": [ + "Earlier producer domain and physical availability", + "Downstream quarter-source4B_r membership and logical compatibility", + "Native recursive tariffs, physical ownership/routing, control tapes, precision and complete consumer cost", + "Favorable supplier moment or selected-frontier implication" + ], + "why_no_saving_is_exported": "The local query defect vanishes only on the admitted state. Ordinary coefficient preparation is explicit but realizes E^-1 U E and pays codecs/copies; neither work nor physical tariff disappears automatically in a consumer.", + "bounded_next_test": "Trace one actual producer or next consumer operation and prove its Newton divisibility/required intertwiner before a broader implementation campaign.", + "reopen_when": "An actual caller supplies and consumes this representation with all required source access, restoration and physical/recursive costs included." + } +} diff --git a/research/p104-clifford-exactness/VERIFY.json b/research/p104-clifford-exactness/VERIFY.json new file mode 100644 index 0000000000..b289d945a8 --- /dev/null +++ b/research/p104-clifford-exactness/VERIFY.json @@ -0,0 +1,43 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "LICENSE", + "NOTICE", + "upstream/LICENSE", + "research/p104-rounded-collector/inputs/WORD.json", + "research/p104-rounded-collector/inputs/NATIVE.json.gz", + "research/p104-rounded-collector/PREDECESSORS.json", + "research/p104-rounded-collector/README.md", + "research/p104-reversible-lifting/lifting.py", + "research/p104-reversible-lifting/README.md", + "research/p104-invariant-lifting-lattice/README.md", + "research/p104-invariant-lifting-lattice/PROOF.md", + "research/p104-retimed-internal-grid/README.md" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 300, + "checks": "Authenticate complete source closure; exact module intertwiners, literal signed-floor parity, actual15-event collector, frame/lifetime binding, cold codec schedule, failure controls, and complete independent512/1024column replay; compare entire retained receipt." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 300, + "checks": "The same complete source and mathematical checks under optimized Python, with explicit contract failures retained." + } + ] +} diff --git a/research/p104-clifford-exactness/independent.py b/research/p104-clifford-exactness/independent.py new file mode 100644 index 0000000000..6f6893bac5 --- /dev/null +++ b/research/p104-clifford-exactness/independent.py @@ -0,0 +1,492 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Independent Gaussian/Mobius and literal-collector checker. + +Clear1nsight, with substantial OpenAI assistance. No primary implementation +or predecessor executable is imported. The authenticated lifting source fixes +the native signed-floor convention; the rational and integer arithmetic below +were independently implemented from that convention and its closed matrix. +""" + +import argparse +import gzip +import hashlib +import json +from pathlib import Path + + +ZERO = (0, 0) +ONE = (1, 0) +I = (0, 1) +PI = (1, 1) +INPUTS = { + "WORD.json": "cec1fb3fbd0067b500ad5119a62ba60685be718e769374d7ec8abdd2beaa7e50", + "NATIVE.json.gz": "ab91c78835c3e10cf3b2cb8a5d4e0b7cfc3df1ae5a811298d27842f2193e1e3d", + "lifting.py": "9424ee08f22b717f6d58f7cc46f189c5549fa86778afcd0c0762ab2daf591160", +} +SOURCE_SIZES = {"WORD.json": 288482, "NATIVE.json.gz": 49610, "lifting.py": 8567} + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def add(a, b): + return a[0] + b[0], a[1] + b[1] + + +def sub(a, b): + return a[0] - b[0], a[1] - b[1] + + +def multiply(a, b): + return a[0] * b[0] - a[1] * b[1], a[0] * b[1] + a[1] * b[0] + + +def phase(z, power): + a, b = z + return ((a, b), (-b, a), (-a, -b), (b, -a))[power % 4] + + +def pi_divide(z): + a, b = z + require((a + b) % 2 == 0, "Newton coefficient not divisible by pi") + return (a + b) // 2, (b - a) // 2 + + +def dimension(values): + n = len(values) + require(n > 0 and n & (n - 1) == 0, "binary cube array") + require(all(len(z) == 2 and all(type(a) is int for a in z) for z in values), + "Gaussian integer array") + return n.bit_length() - 1 + + +def newton(values): + """Boolean Mobius inversion, independently of tensor encoder sweeps.""" + r = dimension(values) + coefficients = list(values) + for bit in range(r): + step = 1 << bit + for mask in range(len(values)): + if mask & step: + coefficients[mask] = sub(coefficients[mask], coefficients[mask ^ step]) + return coefficients + + +def decode(values): + coefficients = newton(values) + for mask, value in enumerate(coefficients): + for _ in range(mask.bit_count()): + value = pi_divide(value) + coefficients[mask] = value + return coefficients + + +def encode(coefficients): + """Weight each Newton coefficient, then Boolean zeta transform.""" + r = dimension(coefficients) + values = [] + for mask, value in enumerate(coefficients): + for _ in range(mask.bit_count()): + value = multiply(PI, value) + values.append(value) + for bit in range(r): + step = 1 << bit + for mask in range(len(values)): + if mask & step: + values[mask] = add(values[mask], values[mask ^ step]) + return values + + +def belongs(values): + try: + decode(values) + except ValueError as error: + require(str(error) == "Newton coefficient not divisible by pi", "membership diagnostic") + return False + return True + + +def rational_pair_numerators(a, b, direction=1): + """The two exact C outputs, with common denominator two.""" + require(direction in (1, -1), "C direction") + total = add(a, b) + difference = sub(a, b) + rotated = -direction * difference[1], direction * difference[0] + return add(total, rotated), sub(total, rotated) + + +def literal_pair(a, b, direction=1): + """Closed component formula for the literal signed-floor pair.""" + require(direction in (1, -1), "literal C direction") + dr, di = a[0] - b[0], a[1] - b[1] + qr, qi = -direction * di, direction * dr + br = b[0] + dr // 2 - qr // 2 + bi = b[1] + di // 2 - qi // 2 + return (br + qr, bi + qi), (br, bi) + + +def coordinate(values, bit, mode="literal", direction=1): + require(0 <= bit < dimension(values), "coordinate bit") + result = list(values) + for x in range(len(values)): + if x & (1 << bit): + continue + y = x | (1 << bit) + numerator = rational_pair_numerators(values[x], values[y], direction) + if mode == "numerator": + result[x], result[y] = numerator + else: + require(mode == "literal", "coordinate mode") + first, second = literal_pair(values[x], values[y], direction) + require(tuple(2 * a for a in first) == numerator[0] + and tuple(2 * a for a in second) == numerator[1], + "literal pair rounding defect") + result[x], result[y] = first, second + return result + + +def wrapper_plan(record): + require(set(record) == {"matrix_rows", "offset", "linear_Z4", "quadratic_rows", "phase"}, + "literal wrapper fields") + rows, linear, quadratic = [record[k] for k in ("matrix_rows", "linear_Z4", "quadratic_rows")] + require(len(rows) == len(linear) == len(quadratic) == 9, "nine-bit wrapper") + require(all(type(x) is int and 0 <= x < 512 for x in rows + quadratic), "wrapper binary words") + require(all(type(x) is int and 0 <= x < 4 for x in linear), "wrapper linear phase") + require(type(record["offset"]) is int and 0 <= record["offset"] < 512 + and type(record["phase"]) is int and 0 <= record["phase"] < 4, "wrapper constants") + plan = [] + for x in range(512): + destination = record["offset"] ^ sum(((row & x).bit_count() % 2) << j + for j, row in enumerate(rows)) + exponent = record["phase"] + for j in range(9): + if x & (1 << j): + exponent += linear[j] + exponent += 2 * (quadratic[j] & x & ~((1 << (j + 1)) - 1)).bit_count() + plan.append((destination, exponent % 4)) + require(len({destination for destination, _ in plan}) == 512, "wrapper affine bijection") + return plan + + +def wrapper(values, plan): + require(len(values) == len(plan), "wrapper address count") + out = [ZERO] * len(values) + for x, (destination, exponent) in enumerate(plan): + out[destination] = phase(values[x], exponent) + return out + + +def permutation_cycles(plan): + unseen = set(range(len(plan))) + lengths = [] + while unseen: + start = min(unseen) + address, length = start, 0 + while address in unseen: + unseen.remove(address) + length += 1 + address = plan[address][0] + require(address == start, "complete disjoint wrapper cycles") + lengths.append(length) + return lengths + + +def transform(values, recipe, mode="literal", check_prefixes=False): + current = wrapper(values, recipe["right_plan"]) + if check_prefixes: + decode(current) + for bit in range(recipe["rank"]): + current = coordinate(current, bit, mode) + if check_prefixes: + decode(current) + current = wrapper(current, recipe["left_plan"]) + if check_prefixes: + decode(current) + return current + + +def digest_object(obj): + return hashlib.sha256(json.dumps(obj, sort_keys=True, separators=(",", ":")).encode()).hexdigest() + + +def read_sources(word_path, native_path, lifting_path): + blobs = {} + for name, path in [("WORD.json", word_path), ("NATIVE.json.gz", native_path), ("lifting.py", lifting_path)]: + path = Path(path) + require(path.is_file() and not path.is_symlink(), "regular authenticated input " + name) + with path.open("rb") as stream: + data = stream.read(SOURCE_SIZES[name] + 1) + require(len(data) == SOURCE_SIZES[name], "bounded authenticated input size " + name) + require(hashlib.sha256(data).hexdigest() == INPUTS[name], "authenticated input " + name) + blobs[name] = data + word = json.loads(blobs["WORD.json"]) + native = json.loads(gzip.decompress(blobs["NATIVE.json.gz"])) + require(word["schema_version"] == native["schema_version"] == 1 + and word["chart"] == native["chart"], "source chart and schema") + require(len(word["program"]) == 5398 and len(native["transports"]) == 1245, "source event inventory") + frame = [256, 136, 64, 40, 16, 4, 2, 1] + sources = ["D31", "D30", "D29", "D28", "D27"] + expected = [["zero", "C", frame]] + expected += [["add", "C", source, 1, frame] for source in sources] + expected += [["transport", "C", frame, [364], 7], ["add", "Q7", "C", "1", [364]], + ["transport", "C", [364], frame, 7]] + expected += [["add", "C", source, "-1", frame] for source in reversed(sources)] + expected += [["erase", "C", frame]] + events = word["program"][2025:2040] + require(events == expected, "exact fifteen-event collector occurrence") + recipes = {} + for event in (2031, 2033): + hits = [entry for entry in native["transports"] if event in entry["events"]] + require(len(hits) == 1 and hits[0]["events"] == [event], "unique literal transport occurrence") + record = hits[0] + gate = word["program"][event] + require(record["old"] == gate[2] and record["new"] == gate[3], "transport frame binding") + recipe = record["recipe"] + require(set(recipe) == {"left", "right", "rank"} and recipe["rank"] == gate[4] == 7, + "rank-seven literal recipe") + recipes[event] = {"rank": 7, "left_plan": wrapper_plan(recipe["left"]), + "right_plan": wrapper_plan(recipe["right"]), + "source_recipe": recipe} + return events, recipes + + +def must_reject(function, expected): + try: + function() + except ValueError as error: + require(str(error) == expected, "control failed at wrong obligation: " + str(error)) + return expected + raise ValueError("negative control unexpectedly accepted: " + expected) + + +def check_generators(): + def matrix(r, operation): + columns = [] + for index in range(1 << r): + coefficients = [ZERO] * (1 << r) + coefficients[index] = ONE + columns.append(decode(operation(encode(coefficients)))) + return [list(row) for row in zip(*columns)] + + zero, one, imag, minus, pi, negbar = ZERO, ONE, I, (-1, 0), PI, (-1, 1) + expected = { + "C": [[one, one], [zero, imag]], + "C_inverse": [[one, imag], [zero, (0, -1)]], + "S": [[one, zero], [imag, imag]], + "X": [[one, pi], [zero, minus]], + "CNOT_0_to_1": [[one, zero, zero, zero], [zero, one, one, pi], + [zero, zero, one, zero], [zero, zero, negbar, minus]], + "CZ": [[one, zero, zero, zero], [zero, one, zero, zero], + [zero, zero, one, zero], [imag, negbar, negbar, minus]], + } + operations = { + "C": (1, lambda v: coordinate(v, 0)), + "C_inverse": (1, lambda v: coordinate(v, 0, direction=-1)), + "S": (1, lambda v: [v[0], phase(v[1], 1)]), + "X": (1, lambda v: [v[1], v[0]]), + "CNOT_0_to_1": (2, lambda v: [v[x ^ ((x & 1) << 1)] for x in range(4)]), + "CZ": (2, lambda v: [phase(z, 2 if x == 3 else 0) for x, z in enumerate(v)]), + } + found = {name: matrix(r, operation) for name, (r, operation) in operations.items()} + require(found == expected, "independent exact generator intertwiners") + for name, order in [("C", 4), ("S", 4), ("X", 2), ("CNOT_0_to_1", 2), ("CZ", 2)]: + r, operation = operations[name] + for index in range(1 << r): + coefficients = [ZERO] * (1 << r) + coefficients[index] = ONE + value = initial = encode(coefficients) + for _ in range(order): + value = operation(value) + decode(value) + require(value == initial, "generator inverse preserves lattice") + return found + + +def check_parity_and_boundaries(): + cases = 0 + for direction in (1, -1): + for real in range(-7, 8): + for imag in range(-7, 8): + a, b = (-5, 8), (-5 - real, 8 - imag) + actual = literal_pair(a, b, direction) + ideal = rational_pair_numerators(a, b, direction) + exact = all(tuple(2 * t for t in z) == w for z, w in zip(actual, ideal)) + require(exact == ((real - imag) % 2 == 0), "signed-floor parity equivalence") + cases += 1 + single_gate = [ZERO, ZERO, ZERO, PI] + require(not belongs(single_gate), "single-gate example lies outside B2") + first = coordinate(single_gate, 0) + require(first == [ZERO, ZERO, ONE, I], "first C is exactly integral outside maximal module") + other_single = coordinate(single_gate, 1) + require(other_single == [ZERO, ONE, ZERO, I], "other single C is exactly integral outside maximal module") + bad_prefix = must_reject(lambda: coordinate(first, 1), "literal pair rounding defect") + phase_witness = [ONE, I] + require(decode(phase_witness) == [ONE, I] and coordinate(phase_witness, 0) == [PI, ZERO], + "old phase witness now has exact phase-complete entrance") + quarter_source, quarter = [(4, 0), ZERO], [ONE, ZERO] + require(belongs(quarter_source) and not belongs(quarter), "integral quarter leaves B1") + must_reject(lambda: coordinate(quarter, 0), "literal pair rounding defect") + e0 = [ONE, ZERO] + ce = coordinate(encode(e0), 0) + ec_num = encode(coordinate(e0, 0, mode="numerator")) + require([tuple(2 * t for t in z) for z in ce] != ec_num, "CE is not EC") + cubic_phase = [phase(ONE, 2 if x == 7 else 0) for x in range(8)] + require(not belongs(cubic_phase), "cubic phase is outside quadratic wrapper contract") + return {"signed_floor_cases": cases, + "single_gate_outside_B2": single_gate, "first_exact_C0": first, + "individual_exact_C1": other_single, + "second_C1_rejection": bad_prefix, + "phase_witness": phase_witness, "phase_witness_coefficients": decode(phase_witness), + "quarter_source_in_B1": quarter_source, "integral_quarter_outside_B1": quarter, + "CE_e0": ce, "two_times_EC_e0": ec_num, + "cubic_phase_outside_B3": cubic_phase} + + +def check_complete_columns(recipes): + forward, backward = recipes[2031], recipes[2033] + column_hash = hashlib.sha256() + lattice_hash = hashlib.sha256() + for index in range(512): + column = [ZERO] * 512 + column[index] = ONE + sent = transform(column, forward, "numerator") + returned = transform(sent, backward, "numerator") + require(returned == [(16384, 0) if j == index else ZERO for j in range(512)], + "actual archived V times U identity on complete complex basis") + column_hash.update(json.dumps(sent, separators=(",", ":")).encode() + b"\n") + for component in range(2): + coefficients = [ZERO] * 512 + sign = -1 if (index + component) % 2 else 1 + coefficients[index] = (sign, 0) if component == 0 else (0, sign) + value = encode(coefficients) + require(decode(value) == coefficients, "complete signed encoder basis round trip") + actual_sent = transform(value, forward) + decode(actual_sent) + actual_returned = transform(actual_sent, backward) + require(actual_returned == value, "literal U V on complete signed Gaussian module basis") + lattice_hash.update(json.dumps(actual_sent, separators=(",", ":")).encode() + b"\n") + return {"ideal_complex_columns": 512, "ideal_U_numerator_denominator": 128, + "VU_numerator_denominator": 16384, "ideal_U_columns_sha256": column_hash.hexdigest(), + "signed_Z_basis_columns": 1024, "literal_U_basis_sha256": lattice_hash.hexdigest(), + "literal_basis_pair_obligations": 1024 * 2 * 7 * 256} + + +def collector(events, recipes, sources, initial_query, check_prefixes=True): + require(len(sources) == 5 and all(len(v) == 512 for v in sources) + and len(initial_query) == 512, "collector entrance shape") + for value in sources + [initial_query]: + decode(value) + source_names = ["D31", "D30", "D29", "D28", "D27"] + values = dict(zip(source_names, sources)) + values["Q7"] = list(initial_query) + frozen = [list(source) for source in sources] + checkpoints = {} + for index, event in enumerate(events, 2025): + operation = event[0] + if operation == "zero": + require(event[1] not in values, "fresh private C") + values[event[1]] = [ZERO] * 512 + elif operation == "add": + target, source, coefficient = event[1], event[2], int(event[3]) + require(coefficient in (-1, 1), "unit collector ADD") + values[target] = [add(a, b) if coefficient == 1 else sub(a, b) + for a, b in zip(values[target], values[source])] + elif operation == "transport": + values[event[1]] = transform(values[event[1]], recipes[index], check_prefixes=check_prefixes) + else: + require(operation == "erase", "literal collector operation") + require(values[event[1]] == [ZERO] * 512, "private C erases exactly") + checkpoints["private_C"] = digest_object(values[event[1]]) + del values[event[1]] + if operation != "erase": + decode(values[event[1]]) + if index in (2030, 2031, 2033): + checkpoints[str(index)] = digest_object(values["C"]) + require([values[name] for name in source_names] == frozen, "all borrowed source arrays unchanged") + total = [ZERO] * 512 + for source in sources: + total = [add(a, b) for a, b in zip(total, source)] + numerator = transform(total, recipes[2031], "numerator") + require(all(t % 128 == 0 for z in numerator for t in z), "exact source collector target") + expected = [add(q, (z[0] // 128, z[1] // 128)) for q, z in zip(initial_query, numerator)] + require(values["Q7"] == expected, "dirty query plus exact archived U source sum") + return {"query_sha256": digest_object(values["Q7"]), "checkpoints": checkpoints, + "sources_sha256": digest_object(sources), "initial_query_sha256": digest_object(initial_query)} + + +def check_collectors(events, recipes): + fixtures = [] + retained = None + for seed in range(3): + coefficient_arrays = [[(((mask * (2 * role + 3) + 5 * seed) % 17) - 8, + ((mask * (role + 5) + 7 * seed + role) % 19) - 9) + for mask in range(512)] for role in range(6)] + arrays = [encode(coefficients) for coefficients in coefficient_arrays] + require(all(any(a < 0 or b < 0 for a, b in value) for value in arrays), "signed dense entrances") + fixtures.append(collector(events, recipes, arrays[:5], arrays[5])) + if seed == 0: + retained = arrays + require(retained is not None, "nonvacuous collector controls") + corrupted = {key: dict(value) for key, value in recipes.items()} + corrupted[2033]["left_plan"] = [(destination, (exponent + 1) % 4) + for destination, exponent in recipes[2033]["left_plan"]] + wrong_phase = must_reject(lambda: collector(events, corrupted, retained[:5], retained[5], False), + "private C erases exactly") + wrong_return = dict(recipes) + wrong_return[2033] = recipes[2031] + wrong_return_rejection = must_reject(lambda: collector(events, wrong_return, retained[:5], retained[5], False), + "private C erases exactly") + return {"dense_signed_fixtures": fixtures, "actual_return_phase_control": wrong_phase, + "forward_used_as_return_control": wrong_return_rejection, + "literal_events": 15, "unit_array_ADDs": 11, "transport_calls": 2, + "literal_wrapper_invocations": 4, "literal_pair_invocations_per_collector": 3584} + + +def verify_independent(word_path, native_path, lifting_path): + events, recipes = read_sources(word_path, native_path, lifting_path) + generators = check_generators() + boundaries = check_parity_and_boundaries() + columns = check_complete_columns(recipes) + collectors = check_collectors(events, recipes) + wrappers = {} + for event, recipe in recipes.items(): + for side in ("left", "right"): + plan = recipe[side + "_plan"] + inverse = [None] * 512 + for x, (destination, exponent) in enumerate(plan): + inverse[destination] = (x, -exponent % 4) + values = [(x - 257, 3 * x - 911) for x in range(512)] + require(wrapper(wrapper(values, plan), inverse) == values, "literal wrapper inverse on all addresses") + lengths = permutation_cycles(plan) + wrappers[str(event) + ":" + side] = { + "addresses": 512, "phase_histogram": [sum(exponent == k for _, exponent in plan) for k in range(4)], + "plan_sha256": digest_object(plan), "source_record_sha256": digest_object(recipe["source_recipe"][side]), + "permutation_cycles": len(lengths), "cycle_length_histogram": { + str(length): lengths.count(length) for length in sorted(set(lengths))}, + "one_scratch_cycle_swaps": 512 + len(lengths)} + collectors["actual_wrapper_cycles"] = sum(item["permutation_cycles"] for item in wrappers.values()) + collectors["actual_one_scratch_wrapper_swaps"] = sum(item["one_scratch_cycle_swaps"] for item in wrappers.values()) + return {"status": "PASS_INDEPENDENT_P104_PHASE_COMPLETE_DOMAIN", "schema_version": 1, + "source_sha256": dict(INPUTS), "source_byte_sizes": dict(SOURCE_SIZES), + "collector_event_range_inclusive": [2025, 2039], + "collector_events_sha256": digest_object(events), "generator_intertwiners": generators, + "boundary_controls": boundaries, "complete_columns": columns, + "literal_wrappers": wrappers, "collector": collectors, + "scope": "Exact restricted-entrance local collector and Gaussian module; no caller supply, physical owner, recursive cost or frontier admission."} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--repo", type=Path, default=Path(__file__).resolve().parents[2]) + args = parser.parse_args() + inputs = args.repo / "research/p104-rounded-collector/inputs" + receipt = verify_independent(inputs / "WORD.json", inputs / "NATIVE.json.gz", + args.repo / "research/p104-reversible-lifting/lifting.py") + print(json.dumps(receipt, sort_keys=True, indent=2)) + + +if __name__ == "__main__": + main() diff --git a/research/p104-clifford-exactness/model.py b/research/p104-clifford-exactness/model.py new file mode 100644 index 0000000000..4dd24a2627 --- /dev/null +++ b/research/p104-clifford-exactness/model.py @@ -0,0 +1,428 @@ +"""Exact Gaussian Newton-lattice reference for the pinned P104 collector. + +Clear1nsight, with substantial OpenAI assistance. Apache-2.0. +The all-rank statements are written in PROOF.md. This finite reference accepts +at most nine address bits and 8192 magnitude bits per real array component. It imports +no predecessor implementation and makes no recursive or physical cost claim. +""" + +from math import comb, isqrt + +MAX_RANK = 9 +MAX_COMPONENT_BITS = 8192 +PI = (1, 1) +ZERO = (0, 0) + + +class ModelError(ValueError): + """A malformed input or violated finite-reference contract.""" + + +class OutsideLattice(ModelError): + """A required exact Gaussian division is unavailable.""" + + +def require(condition, message): + if not condition: + raise ModelError(message) + + +def rank_check(rank): + require(type(rank) is int and 0 <= rank <= MAX_RANK, "rank must be in 0..9") + return rank + + +def gaussian_check(value): + require(type(value) is tuple and len(value) == 2, "Gaussian value must be a pair") + require(all(type(x) is int for x in value), "Gaussian components must be integers") + require(all(x.bit_length() <= MAX_COMPONENT_BITS for x in value), + "Gaussian component exceeds finite reference limit") + return value + + +def validate(values, rank=None): + require(type(values) is list and values, "array must be a nonempty list") + size = len(values) + require(size <= 1 << MAX_RANK and size & (size - 1) == 0, "binary array length") + actual = size.bit_length() - 1 + if rank is not None: + require(rank_check(rank) == actual, "array rank mismatch") + for value in values: + gaussian_check(value) + return actual + + +def add(a, b): + return a[0] + b[0], a[1] + b[1] + + +def sub(a, b): + return a[0] - b[0], a[1] - b[1] + + +def mul(a, b): + return a[0] * b[0] - a[1] * b[1], a[0] * b[1] + a[1] * b[0] + + +def rot(value, phase): + a, b = value + return ((a, b), (-b, a), (-a, -b), (b, -a))[phase % 4] + + +def times_pi(value): + return value[0] - value[1], value[0] + value[1] + + +def divide_pi(value): + a, b = value + if (a + b) % 2: + raise OutsideLattice("not divisible by 1+i") + return (a + b) // 2, (b - a) // 2 + + +def half_exact(value): + if value[0] % 2 or value[1] % 2: + raise OutsideLattice("ideal Gaussian pair has a nonintegral component") + return value[0] // 2, value[1] // 2 + + +def pi_power(exponent): + rank_check(exponent) + result = (1, 0) + for _ in range(exponent): + result = times_pi(result) + return result + + +def encode(coefficients): + """E_r c, with E_1(c0,c1)=(c0,c0+(1+i)c1), in address-bit order.""" + rank = validate(coefficients) + out = coefficients[:] + for bit in range(rank): + step = 1 << bit + for address in range(len(out)): + if not address & step: + out[address | step] = add(out[address], times_pi(out[address | step])) + validate(out, rank) + return out + + +def decode(values): + """Exact E_r inverse; membership fails on an unavailable pi division.""" + rank = validate(values) + out = values[:] + for bit in reversed(range(rank)): + step = 1 << bit + for address in range(len(out)): + if not address & step: + out[address | step] = divide_pi(sub(out[address | step], out[address])) + validate(out, rank) + return out + + +def member(values): + validate(values) + try: + decode(values) + except OutsideLattice: + return False + return True + + +def newton(values): + """Unweighted multilinear coefficients, obtained by Boolean differences.""" + rank = validate(values) + out = values[:] + for bit in range(rank): + step = 1 << bit + for address in range(len(out)): + if not address & step: + out[address | step] = sub(out[address | step], out[address]) + validate(out, rank) + return out + + +def ideal_pair_numerators(a, b, inverse=False): + """Return twice C(a,b), so nonintegral examples can be checked exactly.""" + gaussian_check(a) + gaussian_check(b) + require(type(inverse) is bool, "inverse flag must be Boolean") + total = add(a, b) + difference = rot(sub(a, b), 3 if inverse else 1) + return add(total, difference), sub(total, difference) + + +def ideal_pair(a, b, inverse=False): + first, second = ideal_pair_numerators(a, b, inverse) + return half_exact(first), half_exact(second) + + +def lift_pair(a, b, inverse=False): + """Literal componentwise signed-floor lifting, without a grid change.""" + gaussian_check(a) + gaussian_check(b) + require(type(inverse) is bool, "inverse flag must be Boolean") + difference = sub(a, b) + middle = add(b, (difference[0] // 2, difference[1] // 2)) + difference = rot(difference, 3 if inverse else 1) + second = sub(middle, (difference[0] // 2, difference[1] // 2)) + return add(second, difference), second + + +def stage(values, bit, inverse=False, literal=False): + rank = validate(values) + require(type(bit) is int and 0 <= bit < rank, "address bit outside array") + require(type(inverse) is bool and type(literal) is bool, "stage flags must be Boolean") + out = values[:] + step = 1 << bit + pair = lift_pair if literal else ideal_pair + for address in range(len(out)): + if not address & step: + other = address | step + out[address], out[other] = pair(out[address], out[other], inverse) + validate(out, rank) + return out + + +def ideal_stage(values, bit, inverse=False): + return stage(values, bit, inverse=inverse) + + +def lift_stage(values, bit, inverse=False): + return stage(values, bit, inverse=inverse, literal=True) + + +def gate_bits(kind, bits, rank): + require(kind in ("C", "CINV", "S", "SINV", "X", "SWAP", "CNOT", "CZ"), + "unsupported gate") + count = 2 if kind in ("SWAP", "CNOT", "CZ") else 1 + require(type(bits) in (tuple, list) and len(bits) == count, "gate arity") + require(all(type(bit) is int and 0 <= bit < rank for bit in bits), "gate address bits") + require(len(set(bits)) == len(bits), "gate bits must be distinct") + return tuple(bits) + + +def value_gate(values, kind, bits): + """The physical Gaussian gate; CNOT bits are (control,target).""" + rank = validate(values) + bits = gate_bits(kind, bits, rank) + if kind in ("C", "CINV"): + return ideal_stage(values, bits[0], inverse=kind == "CINV") + out = [ZERO] * len(values) + for address, value in enumerate(values): + target, phase = address, 0 + first = (address >> bits[0]) & 1 + if kind == "X": + target ^= 1 << bits[0] + elif kind in ("S", "SINV"): + phase = first * (1 if kind == "S" else 3) + elif kind == "CNOT": + target ^= first << bits[1] + elif kind == "CZ": + phase = 2 * first * ((address >> bits[1]) & 1) + elif first != ((address >> bits[1]) & 1): + target ^= (1 << bits[0]) | (1 << bits[1]) + out[target] = rot(value, phase) + return out + + +def coefficient_pair(a, b, kind): + if kind == "C": + return add(a, b), rot(b, 1) + if kind == "CINV": + last = rot(b, 3) + return sub(a, last), last + if kind == "S": + return a, rot(add(a, b), 1) + if kind == "SINV": + return a, sub(rot(b, 3), a) + require(kind == "X", "unsupported coefficient pair") + return add(a, times_pi(b)), rot(b, 2) + + +def coefficient_gate(coefficients, kind, bits): + """Direct integral E^-1 gate E formulas; no encode/decode calls.""" + rank = validate(coefficients) + bits = gate_bits(kind, bits, rank) + if kind == "SWAP": + return value_gate(coefficients, kind, bits) + out = coefficients[:] + first = 1 << bits[0] + if len(bits) == 1: + for address in range(len(out)): + if not address & first: + other = address | first + out[address], out[other] = coefficient_pair(out[address], out[other], kind) + validate(out, rank) + return out + second = 1 << bits[1] + for address in range(len(out)): + if address & (first | second): + continue + a, b, c, d = (out[address | mask] for mask in (0, first, second, first | second)) + if kind == "CNOT": + out[address | first] = add(add(b, c), times_pi(d)) + out[address | first | second] = sub(rot(times_pi(c), 1), d) + else: + require(kind == "CZ", "unsupported coefficient block") + out[address | first | second] = sub(add(rot(a, 1), rot(times_pi(add(b, c)), 1)), d) + validate(out, rank) + return out + + +def wrapper_plan(record): + """Exact source convention: input x receives its phase, then moves to Ax+b.""" + keys = {"matrix_rows", "offset", "linear_Z4", "quadratic_rows", "phase"} + require(type(record) is dict and set(record) == keys, "wrapper schema") + rows, linear, quadratic = (record[name] for name in + ("matrix_rows", "linear_Z4", "quadratic_rows")) + require(type(rows) is list, "wrapper matrix rows") + rank = rank_check(len(rows)) + require(type(linear) is list and type(quadratic) is list, "wrapper phase arrays") + require(len(linear) == len(quadratic) == rank, "wrapper dimensions") + size = 1 << rank + require(all(type(row) is int and 0 <= row < size for row in rows + quadratic), + "wrapper binary rows") + require(all(type(value) is int and 0 <= value < 4 for value in linear), "linear phases") + require(type(record["offset"]) is int and 0 <= record["offset"] < size, "affine offset") + require(type(record["phase"]) is int and 0 <= record["phase"] < 4, "global phase") + result = [] + for address in range(size): + target = record["offset"] + phase = record["phase"] + for j in range(rank): + target ^= ((rows[j] & address).bit_count() & 1) << j + if address >> j & 1: + phase += linear[j] + for k in range(j + 1, rank): + phase += 2 * ((quadratic[j] >> k) & 1) * ((address >> k) & 1) + result.append((target, phase % 4)) + require(len({target for target, _ in result}) == size, "wrapper must be bijective") + return result + + +def wrapper(values, record, inverse=False): + validate(values) + require(type(inverse) is bool, "inverse flag must be Boolean") + plan = wrapper_plan(record) + require(len(plan) == len(values), "wrapper and array dimensions") + out = [ZERO] * len(values) + for source, (target, phase) in enumerate(plan): + if inverse: + out[source] = rot(values[target], -phase) + else: + out[target] = rot(values[source], phase) + return out + + +def codec_ledger(rank): + rank_check(rank) + size = 1 << rank + pairs = rank * size // 2 + return {"rank": rank, "complex_coordinates": size, "pairs_per_direction": pairs, + "encode": {"gaussian_adds": pairs, "pi_multiplications": pairs, + "real_add_subtracts": 4 * pairs, "component_reads": 4 * pairs, + "component_writes": 2 * pairs}, + "decode": {"gaussian_subtracts": pairs, "exact_pi_divisions": pairs, + "real_add_subtracts": 4 * pairs, "exact_real_halves": 2 * pairs, + "component_reads": 4 * pairs, "component_writes": 2 * pairs}, + "owned_in_place_complex_words": size, "pair_real_work_words": 4, + "borrowed_input_copy_included": False, "routing_included": False} + + +def codec_bounds(rank, component_bound): + """Sufficient integer bounds, per codec's own entrance; not physical prices.""" + rank_check(rank) + require(type(component_bound) is int and component_bound >= 0, "nonnegative bound") + gain = sum(comb(rank, k) * sum(abs(x) for x in pi_power(k)) for k in range(rank + 1)) + inverse_gain = 1 << ((rank + 1) // 2) + return {"rank": rank, "entrance_component_bound": component_bound, + "encode_component_gain": gain, "encode_component_bound": gain * component_bound, + "encode_scratch_bound": 3 * gain * component_bound, + "decode_component_gain": inverse_gain, + "decode_component_bound": inverse_gain * component_bound, + "decode_scratch_bound": 4 * inverse_gain * component_bound} + + +def collector_bounds(rank, source_count, component_bound): + rank_check(rank) + require(type(source_count) is int and 1 <= source_count <= 5, "source count in 1..5") + require(type(component_bound) is int and component_bound >= 0, "nonnegative bound") + size = 1 << rank + root = isqrt(2 * size) + if root * root < 2 * size: + root += 1 + native = source_count * root * component_bound + return {"rank": rank, "entrance_component_bound": component_bound, + "source_count": source_count, "native_prefix_component_bound": native, + "query_component_bound": native + component_bound, + "pair_scratch_component_bound": 5 * native, + "assumption": "exact unitary native prefixes on the admitted lattice"} + + +def collector_ledger(rank, native_rank, wrapper_cycle_counts): + """Complete direct collector counts; four actual source wrappers are required.""" + rank_check(rank) + require(type(native_rank) is int and 1 <= native_rank <= rank, "native rank") + size = 1 << rank + require(type(wrapper_cycle_counts) is list and len(wrapper_cycle_counts) == 4, + "four literal wrapper cycle counts required") + require(all(type(c) is int and 1 <= c <= size for c in wrapper_cycle_counts), + "wrapper cycle count") + pairs = native_rank * size + swaps = 4 * size + sum(wrapper_cycle_counts) + return {"complex_coordinates": size, "native_rank_each_direction": native_rank, + "paired_butterflies": pairs, "field_adds": 11, + "real_add_subtracts": 8 * pairs + 22 * size, + "floor_halves": 4 * pairs, "butterfly_quarter_turns": pairs, + "wrapper_cycle_counts": wrapper_cycle_counts[:], + "wrapper_cycles": sum(wrapper_cycle_counts), "wrapper_swaps": swaps, + "wrapper_unit_phases": 4 * size, + "butterfly_component_reads": 4 * pairs, "butterfly_component_writes": 4 * pairs, + "field_add_component_reads": 44 * size, "field_add_component_writes": 22 * size, + "source_component_reads_within_field_adds": 20 * size, + "wrapper_swap_component_reads": 4 * swaps, "wrapper_swap_component_writes": 4 * swaps, + "private_initialization_components": 2 * size, "private_zero_check_components": 2 * size, + "borrowed_source_complex_words": 5 * size, "mutable_query_complex_words": size, + "owned_private_complex_words": size, "wrapper_zero_scratch_complex_words": 1, + "pair_real_work_words": 4, "codecs_included": False, + "physical_routing_and_recursive_tariff_included": False} + + +def cold_codec_ledger(rank): + """Optional T=E^-1 U E caller: prepare five owned source banks and query.""" + codec = codec_ledger(rank) + size = 1 << rank + pairs = codec["pairs_per_direction"] + return {"rank": rank, "encodes": 6, "decodes": 6, + "owned_source_copy_adds": 5, "owned_source_cleanup_adds": 5, + "extra_owned_source_complex_words": 5 * size, + "extra_private_initialization_components": 10 * size, + "extra_private_zero_check_components": 10 * size, + "codec_real_add_subtracts": 48 * pairs, + "codec_exact_real_halves": 12 * pairs, + "codec_pi_multiplications": 6 * pairs, "codec_exact_pi_divisions": 6 * pairs, + "codec_component_reads": 48 * pairs, "codec_component_writes": 24 * pairs, + "copy_cleanup_real_add_subtracts": 20 * size, + "copy_cleanup_component_reads": 40 * size, + "copy_cleanup_component_writes": 20 * size, + "add_to_direct_collector_invoice": True, + "logical_output_map": "T = E_r^-1 U E_r", + "original_U_caller_admitted": False, + "physical_routing_and_recursive_tariff_included": False} + + +def cold_codec_bounds(rank, component_bound): + """Compose the optional cold caller's bounds from its raw coefficient entry.""" + encoder = codec_bounds(rank, component_bound) + physical = collector_bounds(rank, 5, encoder["encode_component_bound"]) + decoder = codec_bounds(rank, physical["query_component_bound"]) + return {"rank": rank, "raw_entrance_component_bound": component_bound, + "encoded_component_bound": encoder["encode_component_bound"], + "native_prefix_component_bound": physical["native_prefix_component_bound"], + "encoded_query_component_bound": physical["query_component_bound"], + "decoded_query_component_bound": decoder["decode_component_bound"], + "complete_scratch_component_bound": max(encoder["encode_scratch_bound"], + physical["pair_scratch_component_bound"], + decoder["decode_scratch_bound"]), + "logical_output_map": "T = E_r^-1 U E_r"} diff --git a/research/p104-clifford-exactness/verify.py b/research/p104-clifford-exactness/verify.py new file mode 100644 index 0000000000..f6f3c81b5c --- /dev/null +++ b/research/p104-clifford-exactness/verify.py @@ -0,0 +1,416 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 +"""Source-bound primary replay and independent receipt comparison. + +Clear1nsight, with substantial OpenAI assistance. Finite scalar reference; +not the repository's native compiler or a physical supplier. +""" + +import argparse +from copy import deepcopy +import gzip +import hashlib +from itertools import product +import json +from pathlib import Path, PurePosixPath +import types + +PACKAGE = Path(__file__).resolve().parent +WORD = "research/p104-rounded-collector/inputs/WORD.json" +NATIVE = "research/p104-rounded-collector/inputs/NATIVE.json.gz" +LIFTING = "research/p104-reversible-lifting/lifting.py" +SCIENTIFIC_SHA256 = { + WORD: "cec1fb3fbd0067b500ad5119a62ba60685be718e769374d7ec8abdd2beaa7e50", + NATIVE: "ab91c78835c3e10cf3b2cb8a5d4e0b7cfc3df1ae5a811298d27842f2193e1e3d", + LIFTING: "9424ee08f22b717f6d58f7cc46f189c5549fa86778afcd0c0762ab2daf591160", +} +SOURCES = ["D31", "D30", "D29", "D28", "D27"] +OLD_FRAME = [256, 136, 64, 40, 16, 4, 2, 1] +NEW_FRAME = [364] +ZERO = (0, 0) + + +def require(condition, message): + if not condition: + raise ValueError(message) + + +def digest(value): + return hashlib.sha256(json.dumps(value, sort_keys=True, separators=(",", ":")).encode()).hexdigest() + + +def source_module(path, data=None): + """Compile source bytes explicitly, ignoring adjacent bytecode caches.""" + module = types.ModuleType(path.stem) + module.__file__ = str(path) + exec(compile(path.read_bytes() if data is None else data, str(path), "exec"), module.__dict__) + return module + + +def checked_bytes(data, expected, name): + require(hashlib.sha256(data).hexdigest() == expected, "source SHA256 mismatch: " + name) + return data + + +def authenticate(repo): + inventory = json.loads((PACKAGE / "SOURCES.json").read_bytes())["files"] + manifest = json.loads((PACKAGE / "VERIFY.json").read_bytes()) + rows = [row for row in inventory if row["usage"] == "input"] + require(len({row["path"] for row in rows}) == len(rows), "duplicate source input") + require({row["path"] for row in rows} == set(manifest["inputs"]), "complete declared input closure") + loaded, hashes = {}, {} + for row in rows: + name = row["path"] + parts = PurePosixPath(name).parts + require(parts and not name.startswith("/") and ".." not in parts, "canonical input path") + path = repo.joinpath(*parts) + require(path.is_file() and not path.is_symlink(), "missing regular source input: " + name) + require(path.stat().st_size <= 32 * 1024 * 1024, "bounded source input") + data = checked_bytes(path.read_bytes(), row["sha256"], name) + if name in SCIENTIFIC_SHA256: + checked_bytes(data, SCIENTIFIC_SHA256[name], name) + loaded[name], hashes[name] = data, row["sha256"] + require(set(SCIENTIFIC_SHA256) <= loaded.keys(), "missing scientific source") + return loaded, hashes + + +def expected_events(): + return ([["zero", "C", OLD_FRAME]] + + [["add", "C", name, 1, OLD_FRAME] for name in SOURCES] + + [["transport", "C", OLD_FRAME, NEW_FRAME, 7], + ["add", "Q7", "C", "1", NEW_FRAME], + ["transport", "C", NEW_FRAME, OLD_FRAME, 7]] + + [["add", "C", name, "-1", OLD_FRAME] for name in reversed(SOURCES)] + + [["erase", "C", OLD_FRAME]]) + + +def frame_prefix(word): + """Syntactic frame/lifetime availability only; no earlier arithmetic claim.""" + frames = deepcopy(word["initial_frames"]) + entrance = None + for index, event in enumerate(word["program"][:2040]): + if index == 2025: + entrance = deepcopy(frames) + kind, name = event[:2] + if kind == "transport": + require(frames[name] == event[2], "transport entrance frame at " + str(index)) + frames[name] = event[3] + elif kind == "add": + require(frames[name] == frames[event[2]] == event[4], "ADD frames at " + str(index)) + elif kind == "sign": + require(frames[name] == event[3], "sign frame at " + str(index)) + elif kind == "zero": + require(name not in frames, "private ZERO needs new owned field") + frames[name] = event[2] + else: + require(kind == "erase" and frames[name] == event[2], "private ERASE frame") + del frames[name] + require(entrance is not None and "C" not in entrance and "C" not in frames, "owned private lifetime") + require(all(entrance[name] == OLD_FRAME for name in SOURCES), "source cut frames") + require(entrance["Q7"] == NEW_FRAME, "query cut frame") + require(entrance == frames, "collector restores all frame labels") + return {"checked_structural_prefix_events": 2040, + "entrance_source_frames": {name: entrance[name] for name in SOURCES}, + "entrance_query_frame": entrance["Q7"], "private_C_absent_at_both_boundaries": True, + "earlier_arithmetic_or_domain_admission_checked": False} + + +def bind_sources(word, native): + require(word["schema_version"] == native["schema_version"] == 1, "source schema") + require(word["chart"] == native["chart"] == "Delta_W = conjugate(Gamma_W) = Gamma_W^(-T)", "source chart") + require(len(word["program"]) == 5398 and len(native["transports"]) == 1245, "source inventory lengths") + events = word["program"][2025:2040] + require(events == expected_events(), "literal fifteen-event collector") + recipes = [] + for event_index in (2031, 2033): + matches = [row for row in native["transports"] if event_index in row["events"]] + require(len(matches) == 1, "unique native occurrence") + row, event = matches[0], word["program"][event_index] + require(row["events"] == [event_index], "exact native occurrence list") + require(row["old"] == event[2] and row["new"] == event[3], "native occurrence frames") + require(set(row["recipe"]) == {"rank", "left", "right"} and row["recipe"]["rank"] == event[4] == 7, + "native rank and recipe schema") + recipes.append(row["recipe"]) + return events, recipes, frame_prefix(word) + + +def must_reject(callback, text): + try: + callback() + except ValueError as error: + require(text in str(error), "wrong rejection: " + str(error)) + return str(error) + raise ValueError("control accepted: " + text) + + +def algebra_checks(m, predecessor): + pair_count = 0 + for ar, ai, br, bi, inverse in product(range(-3, 4), range(-3, 4), range(-2, 3), range(-2, 3), (False, True)): + a, b = (ar, ai), (br, bi) + literal = m.lift_pair(a, b, inverse) + require(literal == predecessor.pair(a, b, inverse), "literal predecessor differential") + parity = ((ar - br) - (ai - bi)) % 2 == 0 + numerators = m.ideal_pair_numerators(a, b, inverse) + require(all(tuple(2 * c for c in z) == n for z, n in zip(literal, numerators)) == parity, + "exact signed-floor iff pi divides difference") + require(m.lift_pair(*literal, not inverse) == (a, b), "literal pair exact reversal") + pair_count += 1 + intertwiner_count = 0 + for rank in range(1, 5): + n = 1 << rank + gates = [(kind, (bit,)) for kind in ("C", "CINV", "S", "SINV", "X") for bit in range(rank)] + gates += [(kind, (a, b)) for kind in ("CNOT", "CZ", "SWAP") for a in range(rank) for b in range(rank) if a != b] + for column in range(n): + coefficients = [ZERO] * n + coefficients[column] = (1 if column % 2 else -1, (column % 3) - 1) + values = m.encode(coefficients) + require(m.decode(values) == coefficients, "codec exact inverse") + for kind, bits in gates: + require(m.value_gate(values, kind, bits) == m.encode(m.coefficient_gate(coefficients, kind, bits)), + "integral generator intertwiner") + intertwiner_count += 1 + witness = [ZERO, ZERO, ZERO, (1, 1)] + require(not m.member(witness), "single-gate witness outside B2") + m.ideal_stage(witness, 0) + m.ideal_stage(witness, 1) + simultaneous = must_reject(lambda: m.ideal_stage(m.ideal_stage(witness, 0), 1), "nonintegral") + phase = [(1, 0), (0, 1)] + require(m.member(phase) and m.lift_stage(phase, 0) == [(1, 1), ZERO], "old phase witness is exactly admitted") + quarter_source, quarter = [(4, 0), ZERO], [(1, 0), ZERO] + require(m.member(quarter_source) and not m.member(quarter), "integral quarter leaves lattice") + require(not m.member([quarter[x & 1] for x in range(512)]), "actual ambient quarter boundary") + coefficients = [ZERO, (2, 0)] + require(m.value_gate(m.encode(coefficients), "C", (0,)) != m.encode(m.value_gate(coefficients, "C", (0,))), + "CE is not EC on an exact common entrance") + large = 1 << (m.MAX_COMPONENT_BITS - 1) + output_limit = must_reject(lambda: m.coefficient_gate([(large, 0), (large, 0)], "C", (0,)), + "finite reference limit") + return {"signed_pair_cases_including_inverse": pair_count, + "generator_intertwiner_cases_ranks_1_through_4": intertwiner_count, + "single_gate_not_all_partial_products": simultaneous, + "phase_witness_admitted_exactly": True, "integral_quarter_rejected_at_ranks_1_and_9": True, + "unjustified_codec_commutation_rejected": True, + "single_bit_coefficient_output_limit": output_limit} + + +def full_add(m, left, right, sign=1): + require(len(left) == len(right), "equal array ADD dimensions") + return [(a + sign * c, b + sign * d) for (a, b), (c, d) in zip(left, right)] + + +def native_map(m, values, recipe, trace=None): + out = m.wrapper(values, recipe["right"]) + if trace is not None: + require(m.member(out), "right wrapper lattice closure") + trace.append(digest(out)) + for bit in range(recipe["rank"]): + exact = m.ideal_stage(out, bit) + out = m.lift_stage(out, bit) + require(out == exact, "literal native pair-prefix exactness") + if trace is not None: + require(m.member(out), "native prefix lattice closure") + trace.append(digest(out)) + out = m.wrapper(out, recipe["left"]) + if trace is not None: + require(m.member(out), "left wrapper lattice closure") + trace.append(digest(out)) + return out + + +def collector(m, events, recipes, sources, query, private=None, omit_last_ungather=False): + require(len(sources) == 5, "five source arrays") + for value in sources + [query]: + m.validate(value, 9) + require(all(m.member(value) for value in sources + [query]), "collector lattice entrance") + require(private is None or private == [ZERO] * 512, "private C requires owned zero entrance") + values = {name: data[:] for name, data in zip(SOURCES, sources)} + values["Q7"] = query[:] + snapshots, at_query = [], None + for index, event in enumerate(events, 2025): + kind, destination = event[:2] + if kind == "zero": + require(destination not in values, "new owned private C") + values[destination] = [ZERO] * 512 + elif kind == "add": + if omit_last_ungather and index == 2038: + continue + values[destination] = full_add(m, values[destination], values[event[2]], int(event[3])) + if destination == "Q7": + at_query = values[destination][:] + elif kind == "transport": + values[destination] = native_map(m, values[destination], recipes[0 if index == 2031 else 1], snapshots) + else: + require(kind == "erase" and values[destination] == [ZERO] * 512, "literal private zero at ERASE") + del values[destination] + snapshots.append(digest([ZERO] * 512)) + continue + require(m.member(values[destination]), "whole-event lattice closure") + snapshots.append(digest(values[destination])) + require(all(values[name] == value for name, value in zip(SOURCES, sources)), "borrowed sources unchanged") + total = [ZERO] * 512 + for value in sources: + total = full_add(m, total, value) + expected = full_add(m, query, native_map(m, total, recipes[0])) + require(values["Q7"] == at_query == expected and "C" not in values, "complete collector endpoint") + return values["Q7"], {"query_sha256": digest(values["Q7"]), "prefix_snapshots": len(snapshots), + "prefixes_sha256": digest(snapshots), "all_five_sources_unchanged": True, + "owned_private_C_erases_exactly": True} + + +def collector_checks(m, predecessor, events, recipes): + wrappers, cycles, plans = {}, [], [] + for label, recipe in zip(("U", "V"), recipes): + for side in ("right", "left"): + record = recipe[side] + plan = m.wrapper_plan(record) + require(plan == predecessor.plan(record), "all-address wrapper source differential") + lengths = [len(cycle) for cycle in predecessor.cycles(plan)] + cycles.append(len(lengths)) + plans.append(plan) + wrappers[label + ":" + side] = {"plan_sha256": digest(plan), "cycles": len(lengths), + "all_512_addresses_and_phases_match_source": True} + require(cycles == [64, 128, 160, 64], "four literal wrapper cycle counts") + inverse_plans = [predecessor.inverse_plan(plans[1]), predecessor.inverse_plan(plans[0])] + return_differences = [sum(a != b for a, b in zip(actual, inverse)) + for actual, inverse in zip(plans[2:], inverse_plans)] + require(return_differences == [512, 512], "actual V not paired-inverse wrapper records") + cases, retained = [], None + for seed in range(4): + coefficients = [[(((x + 3) * (k + 5) + seed * 7) % 23 - 11, + ((x * x + 9) * (k + 1) + seed * 13) % 29 - 14) + for x in range(512)] for k in range(6)] + arrays = [m.encode(value) for value in coefficients] + result, evidence = collector(m, events, recipes, arrays[:5], arrays[5]) + for recipe in recipes: + left, right = predecessor.plan(recipe["left"]), predecessor.plan(recipe["right"]) + current = arrays[seed] + numerator = predecessor.exact(current, 7, left, right) + require(all(a % 128 == b % 128 == 0 for a, b in numerator), "ideal full recipe integral") + exact = [(a // 128, b // 128) for a, b in numerator] + require(native_map(m, current, recipe) == exact, "full source ideal oracle differential") + literal = current[:] + meter = {"pairs": 0, "wrapper_values": 0, "wrapper_cycles": 0, "wrapper_swaps": 0} + predecessor.kernel(literal, 7, left, right, meter=meter) + require(literal == exact, "authenticated predecessor literal kernel differential") + cases.append(evidence) + if seed == 0: + retained = (coefficients, arrays, result) + coefficients, arrays, result = retained + # Optional coefficient-space call: five owned copies, six encodes, the + # direct collector, query decode, and five source decodes/uncopies. + copied = [value[:] for value in coefficients[:5]] + encoded_sources = [m.encode(value) for value in copied] + coded_result, _ = collector(m, events, recipes, encoded_sources, m.encode(coefficients[5])) + decoded_query = m.decode(coded_result) + total = [ZERO] * 512 + for value in coefficients[:5]: + total = full_add(m, total, value) + expected_query = full_add(m, coefficients[5], m.decode(native_map(m, m.encode(total), recipes[0]))) + require(decoded_query == expected_query, "cold coefficient contract E^-1 U E") + for encoded, original in zip(encoded_sources, coefficients[:5]): + require(full_add(m, m.decode(encoded), original, -1) == [ZERO] * 512, "five owned copy banks uncompute") + controls = { + "owned_zero_required": must_reject(lambda: collector(m, events, recipes, arrays[:5], arrays[5], [(1, 0)] * 512), "owned zero"), + "cleanup_omission": must_reject(lambda: collector(m, events, recipes, arrays[:5], arrays[5], omit_last_ungather=True), "zero at ERASE"), + "return_wrapper_record_differences": return_differences, + "paired_inverse_swap_undercharge": [4 * 512 + 2 * sum(cycles[:2]), 4 * 512 + sum(cycles)], + } + bad_sources = deepcopy(arrays[:5]) + bad_sources[0][0] = m.add(bad_sources[0][0], (1, 0)) + controls["out_of_domain_entrance"] = must_reject(lambda: collector(m, events, recipes, bad_sources, arrays[5]), "lattice entrance") + wrong_phase = [(target, plans[0][target][1]) for target, phase in plans[0]] + require(wrong_phase != plans[0], "input-address phase convention discriminates output address") + controls["output_address_phase_substitution_differs"] = sum(a != b for a, b in zip(wrong_phase, plans[0])) + return {"dense_signed_collectors": cases, "actual_wrappers": wrappers, "controls": controls, + "cold_coefficient_contract": {"logical_map": "Q + E^-1 U E sum(D)", + "query_sha256": digest(decoded_query), "five_copy_banks_return_zero": True}, + "direct_collector_ledger": m.collector_ledger(9, 7, cycles), + "codec_per_bank_per_direction": m.codec_ledger(9), + "cold_codec_extra_ledger": m.cold_codec_ledger(9), + "codec_bounds_for_unit_component_entrance": m.codec_bounds(9, 1), + "collector_bounds_for_unit_component_entrance": m.collector_bounds(9, 5, 1), + "cold_codec_bounds_for_unit_component_entrance": m.cold_codec_bounds(9, 1)} + + +def source_controls(loaded, word, native): + controls = {} + for name, expected in SCIENTIFIC_SHA256.items(): + changed = loaded[name] + b"\n" + controls[Path(name).name + "_corruption"] = must_reject(lambda: checked_bytes(changed, expected, name), "SHA256 mismatch") + changed = deepcopy(word) + changed["program"][2032][4] = OLD_FRAME + controls["query_frame_drift"] = must_reject(lambda: bind_sources(changed, native), "fifteen-event") + changed_native = deepcopy(native) + selected = next(row for row in changed_native["transports"] if 2033 in row["events"]) + selected["events"].append(2031) + controls["ambiguous_native_occurrence"] = must_reject(lambda: bind_sources(word, changed_native), "unique native occurrence") + return controls + + +def compare_invoice(invoice, independent_collector): + require(invoice["wrapper_cycles"] == independent_collector["actual_wrapper_cycles"] + and invoice["wrapper_swaps"] == independent_collector["actual_one_scratch_wrapper_swaps"], + "literal wrapper invoice differs from independent source counts") + require(invoice["paired_butterflies"] == independent_collector["literal_pair_invocations_per_collector"] + and invoice["field_adds"] == independent_collector["unit_array_ADDs"], + "literal pair and ADD invoice differs from independent source counts") + + +def replay(repo): + implementation = {name: (PACKAGE / name).read_bytes() for name in ("verify.py", "model.py", "independent.py")} + loaded, hashes = authenticate(repo) + word, native = json.loads(loaded[WORD]), json.loads(gzip.decompress(loaded[NATIVE])) + events, recipes, frames = bind_sources(word, native) + m = source_module(PACKAGE / "model.py", implementation["model.py"]) + predecessor = source_module(repo / LIFTING, loaded[LIFTING]) + primary_algebra = algebra_checks(m, predecessor) + primary_collector = collector_checks(m, predecessor, events, recipes) + independent_module = source_module(PACKAGE / "independent.py", implementation["independent.py"]) + independent = independent_module.verify_independent(repo / WORD, repo / NATIVE, repo / LIFTING) + require(independent["status"] == "PASS_INDEPENDENT_P104_PHASE_COMPLETE_DOMAIN" + and independent["complete_columns"]["ideal_complex_columns"] == 512 + and independent["complete_columns"]["signed_Z_basis_columns"] == 1024 + and independent["complete_columns"]["literal_basis_pair_obligations"] == 3670016, + "complete independent coverage and success required") + require(independent["collector_events_sha256"] == digest(events), "independent complete event binding") + require(independent["collector"]["actual_wrapper_cycles"] == 416 + and independent["collector"]["actual_one_scratch_wrapper_swaps"] == 2464, "independent actual wrapper invoice") + invoice = primary_collector["direct_collector_ledger"] + compare_invoice(invoice, independent["collector"]) + changed_invoice = dict(invoice, wrapper_cycles=384, wrapper_swaps=2432) + primary_collector["controls"]["paired_inverse_invoice_rejected"] = must_reject( + lambda: compare_invoice(changed_invoice, independent["collector"]), "literal wrapper invoice") + for event, label in ((2031, "U"), (2033, "V")): + for side in ("right", "left"): + require(independent["literal_wrappers"][str(event) + ":" + side]["plan_sha256"] + == primary_collector["actual_wrappers"][label + ":" + side]["plan_sha256"], "independent complete wrapper plans") + require(all((PACKAGE / name).read_bytes() == data for name, data in implementation.items()), "implementation drift during replay") + return {"schema_version": 1, "status": "PASS_P104_CLIFFORD_EXACTNESS", + "implementation_sha256": {name: hashlib.sha256(data).hexdigest() for name, data in implementation.items()}, + "source_sha256": hashes, "collector_event_range_inclusive": [2025, 2039], + "literal_events_sha256": digest(events), "structural_cut_binding": frames, + "primary_algebra": primary_algebra, "primary_collector": primary_collector, + "source_and_binding_controls": source_controls(loaded, word, native), + "independent": independent, + "scope": "Phase-compatible Gaussian domain and one complete restricted-input scalar collector; no prior caller admission, physical supplier, recursive saving or changed frontier."} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--repo", type=Path, default=PACKAGE.parents[1]) + parser.add_argument("--write-receipt", type=Path, help="write an explicitly requested fresh receipt instead of comparing the retained one") + args = parser.parse_args() + receipt = replay(args.repo.resolve()) + encoded = (json.dumps(receipt, sort_keys=True, indent=2) + "\n").encode() + if args.write_receipt: + with args.write_receipt.open("xb") as output: + output.write(encoded) + else: + require(encoded == (PACKAGE / "RECEIPT.json").read_bytes(), "complete deterministic receipt differs") + print("PASS_P104_CLIFFORD_EXACTNESS " + json.dumps({"receipt_sha256": hashlib.sha256(encoded).hexdigest(), + "independent_complex_columns": 512, "independent_signed_module_columns": 1024, + "literal_collector_events": 15, "actual_wrapper_swaps": 2464}, sort_keys=True)) + + +if __name__ == "__main__": + main()