diff --git a/research/clifford-pointwise-faithfulness/APPLICATION-RESULT.json b/research/clifford-pointwise-faithfulness/APPLICATION-RESULT.json new file mode 100644 index 0000000000..53bdc2cb41 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/APPLICATION-RESULT.json @@ -0,0 +1,16 @@ +{ + "affected_independent_inputs": 104, + "ambient_axes": 17, + "finite_gram_lower_at_72": "15012035871336244158376742625882962056980917290227300430718349610187586298795724967750288241818388072331510355393216731687558989143138428798507710704884164192105304698649639726569/129672361527531029953512745740348785969138944757576153124864291552832900356653379574990845279596993571506183956603149661949848471106617978371464838566061365220661931356297172615168", + "finite_gram_lower_at_84": "3307688356600097832824604549253505021711762694675820630380988647763450661166142843805702790691122208883654326597829149758145507314212369741999146206603406894760888959824077189445396581768015141945681474091631148125685268535301461615363915903/3334007216439927137039925895360628898572379161157954080198128905882018618908816035760716100435777145371464955296716620222944400827059682540181678026165415023047578789757007279231539142955907012364482508067943300990845374018738230645581938688", + "first_proved_width": 72, + "late_grade7_words": 5408, + "later_squared_error_lower_bound": "125/126", + "later_width": 84, + "new_kappa": null, + "normalized_squared_error_lower_bound": "1/9", + "operator_norm_error_lower_bound": "1/3", + "proof_scope": "One frozen passive columnwise Clifford contract; see APPLICATION.md", + "source_replay": "PASS_PASSIVE_SAVED_QUERY_CEILING", + "status": "PASS_PASSIVE_CEILING_FROM_WIDTH_72_NO_NEW_KAPPA" +} diff --git a/research/clifford-pointwise-faithfulness/APPLICATION.md b/research/clifford-pointwise-faithfulness/APPLICATION.md new file mode 100644 index 0000000000..bc375ba2eb --- /dev/null +++ b/research/clifford-pointwise-faithfulness/APPLICATION.md @@ -0,0 +1,86 @@ +# The retained passive ceiling holds from width 72 + +This applies the new pointwise theorem to the retained +[passive saved-query ceiling](https://github.com/CrocSwap/integer-mult-bounds/blob/32890bc5de034ab8fc93ac88ead7279a6a416d04/research/passive-saved-query-ceiling/README.md). +Chris R supplies that proof and its independent source/grade audit in +[PR #4978](https://github.com/CrocSwap/integer-mult-bounds/pull/4978). +The actual native source is Dugongue's +[PR #4948](https://github.com/CrocSwap/integer-mult-bounds/pull/4948), head +`86e474038e05f99a76d41f71d81946ad2327e4a4`. +The retained source's result holds for all sufficiently large widths. +The new conclusion supplies an explicit width and a nonzero error bound. + +## Contract and source facts + +Read the frozen +[proof](https://github.com/CrocSwap/integer-mult-bounds/blob/32890bc5de034ab8fc93ac88ead7279a6a416d04/research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/PROOF.md) +with its mandatory +[uniform-alphabet addendum](https://github.com/CrocSwap/integer-mult-bounds/blob/32890bc5de034ab8fc93ac88ead7279a6a416d04/research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/UNIFORM-ALPHABET-ADDENDUM.md) +and +[owned-reset clarification](https://github.com/CrocSwap/integer-mult-bounds/blob/32890bc5de034ab8fc93ac88ead7279a6a416d04/research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/OWNED-RESET-CLARIFICATION.md). +All three are byte-pinned replay inputs. The following facts are inherited: + +- Four original main banks have 112 independent input fields each. Nine + macro cuts and three paid responses supply 39 observed bank fields. +- For 104 zero-diagonal source ports in original bank 0, the allowed + coefficient words have Fourier grades 0, 1 or 7. The exact audit checks + all 5,408 nonzero late grade-7 words. Their target `D1 Q^-1` has grade 9. +- Every allowed left code factor is a scalar sum of monomial Clifford + words. Left multiplication by each such word preserves Fourier grade. +- Every complete one-column word belongs to the same 17-axis Clifford + group. The finite universe is independent of width. A word containing + a Gaussian need not be monomial; the full Clifford theorem is used. + +Scalar coefficients, choices of controls and finite numbers of decoder +operations may depend on the width. The paid word and each paid input +expression stay fixed. Source scalar coefficients remain outside tensor +powers. Only a scalar inside a native operator acquires its f-th power. + +## New quantitative corollary + +Fix any allowed decoder at any integer width f>=72=4*17+4. Expand one +affected input-to-target coefficient into its finite Clifford words. +Combine projective copies, with their phases raised to f. Call the result +`sum_g b_g U_g^(tensor f)`, where each U_g is unitary. Fourier grade is +unchanged by scalar phase, so the grade-9 target T is not one of these +projective classes. Equation (4) of the [new proof](PROOF.md) gives + + 2^(-17f) ||T^(tensor f)-sum_g b_g U_g^(tensor f)||_HS^2 + >= (1/9)(1+sum_g |b_g|^2) >= 1/9. + +The operator norm error in this coefficient is at least 1/3. Set all other +independent inputs to zero and choose a unit vector which attains this +coefficient's operator norm. The corresponding complete endpoint also has +error at least 1/3 on that input, when the endpoint uses the direct-sum +Euclidean norm. This does not assert error on every input or add 104 errors +on one common input. + +At every f>=84=4*17+16 the same normalized squared-error lower bound can +be replaced by 125/126. The norm error is then at least sqrt(125/126). +These constants hold uniformly over all allowed width-dependent choices. +No enumeration of the 17-axis group or dense tensor matrix is needed. + +Thus this passive contract cannot provide even a uniformly small-error +version of the missing endpoint at these widths. This corollary adds no +new lower bound on reset cost. Storage, COPY, finite code work and owned +CLEAR/reset may all be granted for free, as the retained clarification says. + +## Verification and limits + +[verify_application.py](verify_application.py) first authenticates every +retained package file. It then runs the unchanged retained verifier, which +replays the author bank/grade calculation, the independent trace/grade +audit and the five wrapper rejection controls. Its complete output must +match [PASSIVE-REPLAY.json](PASSIVE-REPLAY.json). It computes both new exact +finite Gram bounds and compares [APPLICATION-RESULT.json](APPLICATION-RESULT.json). + +The source replay establishes the finite source facts. The written proofs +establish the uniform group premise, grade preservation and the universal +quantifiers. This is not an independent human review or a formal proof +kernel. No actual new decoder, physical emission, selected cold replay, +complete pricing, supplier admission or kappa improvement is claimed. + +Active feedback into later paid gates, new paid calls, changed words or +targets, other observations, native internal prefixes and noncolumnwise +payload routing change the contract. They are outside this corollary. +No active-feed task is reserved or rejected by this package. diff --git a/research/clifford-pointwise-faithfulness/MUTATIONS.json b/research/clifford-pointwise-faithfulness/MUTATIONS.json new file mode 100644 index 0000000000..3e805ac22e --- /dev/null +++ b/research/clifford-pointwise-faithfulness/MUTATIONS.json @@ -0,0 +1,76 @@ +{ + "checks": [ + { + "diagnostic": "Exact first Clifford overlap level", + "mutation": "first Clifford overlap", + "optimized": false + }, + { + "diagnostic": "Exact first Clifford overlap level", + "mutation": "first Clifford overlap", + "optimized": true + }, + { + "diagnostic": "Native/scalar phase residue", + "mutation": "native phase outside tensor", + "optimized": false + }, + { + "diagnostic": "Native/scalar phase residue", + "mutation": "native phase outside tensor", + "optimized": true + }, + { + "diagnostic": "Stabilizer pointwise Gram estimate", + "mutation": "projection scale outside tensor", + "optimized": false + }, + { + "diagnostic": "Stabilizer pointwise Gram estimate", + "mutation": "projection scale outside tensor", + "optimized": true + }, + { + "diagnostic": "Nonzero-trace Pauli fiber count", + "mutation": "unsigned fixed Pauli count", + "optimized": false + }, + { + "diagnostic": "Nonzero-trace Pauli fiber count", + "mutation": "unsigned fixed Pauli count", + "optimized": true + }, + { + "diagnostic": "Tensor phase covariance", + "mutation": "repair phase outside tensor", + "optimized": false + }, + { + "diagnostic": "Tensor phase covariance", + "mutation": "repair phase outside tensor", + "optimized": true + }, + { + "diagnostic": "Complete repair invoice hinges", + "mutation": "missing added repair charge", + "optimized": false + }, + { + "diagnostic": "Complete repair invoice hinges", + "mutation": "missing added repair charge", + "optimized": true + } + ], + "source_sha256": { + "audit_mutations.py": "ace28d7781cda16d2e1e4de015112f3d3a6bcccd67b23955e736ca4ac25e9b4d", + "bounds.py": "e2a742d1cd1a76d0f49cef4b233ca74a5c8c8b3bee5c954c0e003bc065878af2", + "census.py": "145fe9e335aa57c39e1c1411da351049d9b52fdc58fb02f994066e166a8235d4", + "native_pointwise.py": "7dea28f405137881de8048010951e7e42857a250d98972faa14cb4d3ed6228b2", + "source.py": "1ef7dada5daba9d0e89f8117285c944a401b0ba74c00c3a70673a9926bfe45ea", + "stabilizer.py": "7011f435441657d5168b23e32f32ed2a263cf608dd5c139cf86a40e88427a738", + "verify.py": "47fcf94881aee98843d10194560c41bc3dc2db13a3956caeba1a9e1f7e3a953e", + "verify_application.py": "f783fae54da7d8c6d2377d12c2013fce9ced55ebbbd27bb002ebd0a68e58b325", + "verify_repair.py": "013fb6f9743bc296e541b71a2e6b95f45b46d846ad26e64b23002bf189c8c073" + }, + "status": "PASS_TWELVE_SCIENTIFIC_MUTATION_REJECTIONS" +} diff --git a/research/clifford-pointwise-faithfulness/PASSIVE-REPLAY.json b/research/clifford-pointwise-faithfulness/PASSIVE-REPLAY.json new file mode 100644 index 0000000000..2f5d577c52 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/PASSIVE-REPLAY.json @@ -0,0 +1,38 @@ +{ + "author_exact_stdout_receipts": [ + { + "bytes": 4031, + "receipt": "BANK-SPAN.json", + "sha256": "c92a574492a18d501ae6acd8cb792aaaa28070312a7558990923d7a7e810073c" + }, + { + "bytes": 702206, + "receipt": "GRADE-GATE.json", + "sha256": "8267ff814fd7fa86638b6ce6384f0ac717a341d871bd302742de6aaf8ba00b6d" + } + ], + "independent_exact_stdout_receipt": { + "bytes": 5574, + "receipt": "INDEPENDENT.json", + "sha256": "bfbfeb0a835e11ef9a4638f57e9179758e7bda560c58993e26c6ec9cde8a47d9" + }, + "late_grade7_words": 5408, + "macro_cuts": 9, + "native_source": "86e474038e05f99a76d41f71d81946ad2327e4a4", + "new_kappa": null, + "observed_banks": 39, + "passive_only": true, + "phase": "all", + "physical_emission": false, + "status": "PASS_PASSIVE_SAVED_QUERY_CEILING", + "sufficiently_large_width": true, + "target_grade": 9, + "wrapper_mutation_rejections": [ + "unretained Git source request", + "undeclared dependency dispatch", + "altered mandatory reset clarification", + "altered scientific input bytes", + "wrong scientific receipt" + ], + "zero_diagonal_inputs": 104 +} diff --git a/research/clifford-pointwise-faithfulness/PROOF.md b/research/clifford-pointwise-faithfulness/PROOF.md new file mode 100644 index 0000000000..465009d9d1 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/PROOF.md @@ -0,0 +1,305 @@ +# Pointwise tensor faithfulness for Clifford and stabilizer maps + +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. + +This is an algebraic result. It supplies no physical implementation or new +kappa. The classical ingredients are stabilizer normal forms, symplectic +residual forms, character orthogonality and the Gram row bound. The new +contribution in this repository is their quantitative pointwise consequence. + +## 1. Statements + +Let C_n be the unitary n-qubit Clifford matrices with entries in Z[i,1/2]. +Its scalar subgroup is {I,iI,-I,-iI}. Choose one representative U_g for +each projective class. Indeed a unit Gaussian-dyadic scalar satisfies +a^2+b^2=4^k with integers a,b. Repeated parity reduction leaves only a +Gaussian unit. Set D=2^n. For n>=1 and every integer f>=4n+4, + + (1/9) sum_g |b_g|^2 + <= D^(-f) ||sum_g b_g U_g^(tensor f)||_HS^2 + <= (17/9) sum_g |b_g|^2. (1) + +The coefficients are arbitrary complex numbers at this one width. Thus all +the projective tensor operators are linearly independent at every such f. +Any subset has the same bounds. The choice of representative phase does not +change the bounds. The proof also applies to the usual Clifford group with +arbitrary unit scalar phases, after projective classes are combined. + +For a fixed residual in the exact dyadic group algebra, the following are +equivalent: + +1. Every exact-operator coefficient is zero. +2. The residual vanishes at every positive width. +3. It vanishes at the four widths 4n+4,...,4n+7. + +If M is the squared coefficient norm after equal exact operators are +combined, at least one of these four normalized squared norms is >= M/9. +Four tests are necessary for this exact group with arbitrary complex scalar +coefficients. This is a sufficient width bound, not a sharp width threshold. +For n=0 the group is the four scalar phases; widths 1,2,3,4 suffice. + +There is a broader result. A nonzero stabilizer map from a binary input +space to a binary output space is a matrix whose vectorization, up to a +nonzero scalar, is a pure stabilizer state. Let N be the total number of +input and output axes. Normalize these vectors to unit length and choose +one per projective class. At every f>=2N+6 their tensor Gram matrix has + + (2/5) I <= Gram_f <= (8/5) I. (2) + +This includes rectangular maps and Pauli projections. For arbitrary +unnormalized representatives A_g, (2) means + + ||sum_g b_g A_g^(tensor f)||_HS^2 + >= (2/5) sum_g |b_g|^2 ||A_g||_HS^(2f). (3) + +The statements at a single width allow different finite words, different +scalar coefficients and different subsets at each width. They do not infer +all-width equality of a changing family from four tests. Products must +still have the stated columnwise Clifford or stabilizer-map form. + +There is a robust consequence. If a unitary Clifford target T is absent +from a set of projective classes S, then for f>=4n+4, + + D^(-f) ||T^(tensor f)-sum_(g in S) b_g U_g^(tensor f)||_HS^2 + >= (1/9)(1+sum_g |b_g|^2) >= 1/9. (4) + +Its operator norm error is therefore at least 1/3. This is a worst-case +unit-input error bound, not a guarantee about the error on each input. +Later widths use the stronger constants in Section 4. In particular the +lower bound on normalized squared error tends to one as f increases. + +## 2. Count the stabilizer overlaps + +A projective N-qubit stabilizer state has a computational-basis support +which is an affine binary subspace. In coordinates t on its k-dimensional +support, its amplitudes have the form + + 2^(-k/2) i^(a.t + 2 sum_(j. A state has a nonzero overlap of modulus 2^(-k/2) +with it exactly when its support is a k-subspace containing zero. Normalize +its amplitude at zero to be positive. The remaining phase polynomial is +unique. There are + + A_(N,k) = [N choose k]_2 2^(k(k+3)/2) (5) + +such states, including A_(N,0)=1. Here + + [N choose k]_2 = product_(j=0..k-1) + (2^(N-j)-1)/(2^(k-j)-1). + +There are k coefficients with four choices and k(k-1)/2 coefficients with +two choices. This proves the exponent in (5). The other states have zero +overlap. Clifford conjugation is transitive on pure stabilizer states, so +the same distribution holds about every projective stabilizer state. + +Transitivity can also be seen directly: a basis change puts the support +on coordinate axes, a translation removes its offset, diagonal Clifford +phases remove its phase polynomial, and Hadamards send its uniform support +to zero. This argument does not use a counting formula for the Clifford +group. + +It follows that the absolute off-diagonal row sum of the f-fold tensor +Gram matrix of all these states is exactly + + S_(N,f) = sum_(k=1..N) A_(N,k) 2^(-kf/2). (6) + +An arbitrary subset has no larger row sum. This count concerns projective +states. Repeating scalar-phase copies would make a pointwise Gram singular. + +## 3. The Clifford first-overlap improvement + +Vectorize U/sqrt(D) to obtain its unit Choi state on 2n qubits. It is a +stabilizer state: the Bell state is a stabilizer state and Clifford action +on one half preserves that property. Projectively different matrices give +different projective Choi states. Formula (5), with N=2n, therefore bounds +their overlap counts. + +For k=1 the Clifford count is exactly + + B_(n,1) = 2(2^(2n)-1) = A_(2n,1)/2. (7) + +Here is a separate proof which retains the signs. Let S be the symplectic +Pauli action of U, and L=ker(S-I). In the Hermitian Pauli basis, conjugation +has trace |tr U|^2. Its contribution at a fixed label v is its sign epsilon(v). +On L these signs form a character: conjugation cancels the same Pauli +multiplication phase on both sides. Thus |tr U|^2 is either zero or +2^dim(L). + +For a fixed S, its projective Clifford lifts differ by the 2^(2n) Paulis. +They multiply the sign on L by every character of L, each with multiplicity +2^(2n-dim(L)). Therefore exactly 2^k lifts have nonzero trace when +rank(S-I)=k. Their normalized trace modulus is 2^(-k/2). + +A rank-one symplectic displacement is a transvection. Indeed, write +(S-I)x=ell(x)a for nonzero a. Symplecticity gives +ell(x) omega(a,y)+ell(y) omega(x,a)=0. Nondegeneracy then forces +ell(x)=omega(x,a) over F_2. Every nonzero a gives one such map. There are +2^(2n)-1 choices, and each has two nonzero-trace lifts. This proves (7). + +For clarity, a second count gives the same general upper bound without +Choi states. Put W=im(S-I), dim W=k. Then ker(S-I)=W-perp. The residual +form B((S-I)x,w)=omega(x,w) is well-defined, nonsingular and satisfies +B(u,v)+B(v,u)=omega(u,v). For fixed W there are at most +2^(k(k+1)/2) bilinear forms with this fixed symmetrization. Each nonsingular +one determines S uniquely: solve B((S-I)x,w)=omega(x,w) for every w in W. +There are [2n choose k]_2 possible W and 2^k nonzero-trace Pauli lifts. +Their product is exactly A_(2n,k). No equality is asserted for k>=2. + +The Choi and residual-form arguments are different derivations of the same +upper bound. The checks enumerate signed Pauli actions and literal Choi +vectors separately. + +## 4. Uniform rational row bounds + +Set d_k=product_(j=1..k)(2^j-1). The subspace count satisfies + + [N choose k]_2 <= 2^(k(N-k)) / + product_(j=1..k)(1-2^(-j)). + +At f=2N+4, its term in (6) is at most 1/d_k. The Clifford first term is +at most 1/2 by (7). Its whole off-diagonal row sum is consequently at most + + 1/2 + 1/3 + 1/21 + 1/315 + + (1/9765)/(1-1/63) < 8/9. (8) + +The tail starts at k=5. Each subsequent term has ratio at most 1/63. +The bound is independent of n. Terms with k>2n were added only to bound +the finite sum from above. At all larger widths the row sum can only fall. + +For all stabilizer states use f=2N+6. Each term is at most 2^(-k)/d_k, +so the full row sum is at most + + 1/2 + 1/12 + 1/168 + 1/5040 + + (1/312480)/(1-1/126) < 3/5. (9) + +Again this is a rational bound on the complete infinite tail. The executable +also provides the sharper finite sums for any specified axis count and any +even width. For an odd width it uses the preceding even width. A failed +sufficient bound is no decision, not evidence of linear dependence. + +If a Hermitian matrix has diagonal one and absolute off-diagonal row sums +at most s, then its eigenvalues lie in [1-s,1+s]. One direct proof bounds +each pair by 2|b_i b_j| <= |b_i|^2+|b_j|^2 in its quadratic form. +Apply this to the Gram matrices and (8)-(9). This proves (1)-(3). +Apply (1) to the residual with target coefficient one to obtain (4). +The inequality ||R||_HS <= sqrt(D^f)||R||_op gives its operator norm claim. + +There are useful stronger bounds at a slightly later width. At +f=4n+4+2s the Clifford row bound is at most + + 2^(-s-1) + sum_(k>=2) 2^(-sk)/d_k. (10) + +For s=2 this is <3/20. For s=6 it is <1/126. +Thus four consecutive widths starting at 4n+8 have a 17/20 lower bound; +four starting at 4n+16 have a 125/126 lower bound. The same geometric-tail +argument proves these constants. These are sufficient constants, not +optimal spectral values. + +## 5. Exact phases and the four-width theorem + +For the Gaussian-dyadic group write every exact matrix uniquely as i^j U_g, +where g is its projective class and j=0,1,2,3. For a fixed residual define + + beta_(g,r) = sum_(j=0..3) c_(g,j) i^(jr). + +At any f>=4n+4 with f=r modulo four, (1) says that the residual is zero +exactly when all beta_(g,r) vanish. This is the exact pointwise kernel: +only the unavoidable scalar-phase relations remain. Four consecutive +widths supply all four residues. Fourier inversion then makes every +c_(g,j) zero. + +Parseval gives (1/4) sum_(g,r)|beta_(g,r)|^2=M. Averaging (1) over the +four tested widths proves the M/9 claim. Formula (10) gives the two stronger +four-width constants stated above. Apply the argument to each entry of a +complete input-to-output register matrix; every dirty role must be retained. + +For each r the residual sum_(j=0..3) i^(-rj)[i^j I] vanishes at every width +outside r modulo four and is 4I in that residue. Thus three widths cannot +be a universal fixed-residual test. The same argument gives eight necessary +residues if a chosen finite normalized Clifford lift includes eighth-root +scalar phases. The four-test conclusion is for the repository's exact +Gaussian-dyadic group, not that larger central extension. + +## 6. Quantifiers, applications and exclusions + +At a single specified f>=4n+4, the coefficient vector may be chosen after +f. Its entries may be arbitrary complex numbers. Its finite support and +the finite word that produces it may also depend on f. There is no term +count in the theorem. Thus an equality at that width can be read as an +identity in the projective phase quotient of the group algebra. A scalar +phase is evaluated as its f-th power, not discarded. + +This gives an explicit threshold for future applications of the retained +finite-alphabet tensor-separation arguments. It replaces an unspecified +large width or a projective-group-size bound when the entire operator +alphabet in the argument is contained in this fixed n-axis Clifford group. +For n=9 the pointwise threshold is 40 and the four test widths are 40..43. +For n=17 they are 72 and 72..75. At n=64 they are 260 and 260..263. +The prior full-Clifford fixed-residual tests are 69..76, 133..140 and +509..516 respectively. These comparisons are theorem bounds, not measured +execution speedups. + +The [retained passive application](APPLICATION.md) meets the full alphabet +premise. It gives a uniform width-72 obstruction and an operator error bound +of 1/3 under that exact passive contract. Its sources and both mandatory +clarifications are retained as byte-pinned inputs. + +For stabilizer maps, terms which differ by any nonzero scalar must first be +combined with that scalar raised to f. Their coefficients may then depend +on f. Formula (3) does not identify scaled copies at all widths, and it does +not give four tests for arbitrary nonunitary scalings. + +This does not by itself strengthen an additional-call bound at a caller +cut with already paid observations. That needs its correct initial module, +source versions, ownership and cost ledger. Nor does it show that any +particular paid-history theorem's whole alphabet consists of Clifford +maps. A nominal matrix or a sum of Cliffords is not automatically a +Clifford or a stabilizer map. Each application must check that premise. + +Arbitrary non-Clifford matrices, nonlinear/rounded operations, operators +which act across tensor columns, unpriced physical routing, and omitted +dirty returns remain outside the result. No all-size multiplication +assumption is declared discharged by this algebraic theorem alone. + +## 7. Verification and attribution + +The registered verifier checks the finite counting identities by separate +state and signed-Pauli enumerations, the rational tail bounds, literal Gram +matrices, complete native register examples and deliberate invalid inputs. +The written proof supplies the all-dimension and all-width quantifiers. +Finite computation is corroboration; it is not a formal-kernel proof or +independent human acceptance. + +The retained tensor-Gram package supplies the exact native grammar, compact +quadratic sums and complete register frontend. Its original trace filter, +code invariant, one-axis sharpness and provider results remain its work. +The monomial tensor-cutoff package remains a stronger cutoff for its smaller +class. Chris R and the retained paid-history authors supply the earlier +finite-alphabet applications. Krzysztof Wojt and Nick Petalas supply the +repository's related residual-form and partial-Pauli statements. + +Classical stabilizer descriptions follow Dehaene and De Moor, +[*Clifford group, stabilizer states, and linear and quadratic operations +over GF(2)*](https://arxiv.org/abs/quant-ph/0304125). The finite symplectic residual-form +method is classical Wall-form theory. No general counting, Gram, Fourier, +stabilizer-simulation or literature-priority claim is made. Exact repository +pins and the role of each source are in SOURCES.json and README.md. + +## Open next questions + +Find the least pointwise threshold and best spectral constant for this +group, with the phase residue kept explicit. Test one actual complete +caller against the new pointwise kernel, retaining its available history +and complete bill. Extend the exact native frontend to a source-bound +nonunitary stabilizer caller only when its projections and scalar factors +are supplied. None of these follow-ups is claimed complete here. diff --git a/research/clifford-pointwise-faithfulness/README.md b/research/clifford-pointwise-faithfulness/README.md new file mode 100644 index 0000000000..a250d034c5 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/README.md @@ -0,0 +1,207 @@ +# Pointwise Clifford tensor faithfulness and a complete frozen-repair obstruction + +**Enabling proof and exact verification tools; no new kappa.** +For the full n-axis Clifford group, projectively distinct operators have +linearly independent tensor powers at **every width f>=4n+4**. Their +normalized tensor Gram matrix lies between **I/9 and 17I/9**. This holds +for arbitrary complex coefficients and finite words chosen separately at +each width. It gives a dimension-based threshold for the finite-alphabet +arguments used throughout the native-interface research. + +For one fixed complete scalar register program over the Gaussian-dyadic +Clifford group, **four tests at 4n+4,...,4n+7 decide equality at all positive +widths**. Four tests are necessary because of scalar phases. At least one +of those four normalized squared residuals is at least M/9, where M is the +squared coefficient norm after equal exact operators are combined. + +Read the [proof](PROOF.md), [exact result](RESULT.json), [source pins](SOURCES.json) +and [source-bound application](APPLICATION.md). The application strengthens +the retained passive saved-query ceiling: failure holds at every **f>=72**, +with worst-case operator error at least **1/3** in each affected coefficient. +At every f>=84 its normalized squared error is at least **125/126**. +The old observation contract and both source clarifications remain binding. + +The [paid-repair extension](REPAIR.md) now proves that this caller needs +**at least 104 additional field returns**, even with feedback among new +calls. With q returns, the selected block has squared operator norm error +at least **(1-q/104)_+/9** from width 72. The cheapest possible 104-return +repair makes the complete frozen invoice adverse for **every r^p tariff, +0=72, the frozen PR4948 passive caller needs at least +**104 additional paid field returns** to meet its original target. New +calls may use earlier new returns. Even if each new return costs only one +rank-one job, the complete optimistic invoice fails for every tariff +r^p with 0=1. A new multi-output supplier must +account for its actual paid primitives. The proof does not charge its +free outputs as extra queries. A supplier with a different ordinary +alphabet, capacity or price rule is outside this statement. + +## 2. Relative history dimension at one width + +**Reusable form.** Let H be any subgroup of the projective n-axis Clifford +group. Suppose the initial history is in a coefficient span that is +invariant under left H. In each of b independent input columns, let the +required unitary Clifford target T_j have its whole coset H T_j outside +that initial coefficient support. At any width with full-Clifford Gram +lower bound lambda>0, an exact decoder needs at least b additional +same-capacity returns. With q returns its selected block error satisfies +`D^(-f)||E||_HS^2 >= lambda(b-q)_+` and +`||E||_op^2 >= lambda(1-q/b)_+`, where D=2^n. +The targets must occupy distinct diagonal input/output positions. The +ordinary operations, arbitrary new linear returns and phase rules are +those of section 1. The proof below uses b=104 and a common T; replacing +these by b and T_j gives the stated general form. For another caller, +the complete initial history and coset exclusion must be proved anew. + +Let H be the projective monomial Clifford group on 17 axes, with h elements. +Choose unitary representatives. Its tensor lifts, including their phase +factors, span a unital algebra A at the fixed width. The pointwise theorem +in [PROOF.md](PROOF.md) shows that dim A=h for f>=72. Multiplication of +projective representatives can introduce a phase. It does not change this +dimension or the algebra closure. + +Restrict all input rows to the 104 zero-diagonal ports of original main +bank 0. Set every other independent input to zero. This is a legitimate +restriction of the required endpoint. The autonomous helper rows then +vanish. Let M be the A-module generated by all frozen observation rows +after this restriction. + +The source audit gives pure Clifford grades in {0,1,7} in each of these +input columns. Left monomial action preserves each grade. Thus M lies +in the span of these grades, separately in every input column. The +desired first target bank has diagonal coefficient T=D1 Q^-1, of grade 9. +Write t_j for the row with T^(tensor f) in input column j and zero elsewhere. + +For each j, the h words H T are projectively distinct. They all have +grade 9. The pointwise theorem shows that the h rows in A t_j are +independent. Different j have different independent input columns. +Consequently the target module L=sum_j A t_j has dimension 104h, and +L intersects M only at zero. This uses the complete finite Clifford +alphabet, not a free-word interpretation of its physical matrices. + +Let b_1,...,b_q be the new paid rows, in their actual order. After every +prefix, every available row lies in + + M + A b_1 + ... + A b_q. (1) + +Ordinary operations preserve this module. One new return adds a cyclic +module A b_i of dimension at most h. This statement needs no restriction +on the paid map and no assumption that A has no zero divisors. Overwrite, +clear and feedback do not invalidate (1). If every t_j is returned, +the final module contains L. Dimension in the quotient by M gives + + 104h <= dim((M + sum_i A b_i)/M) <= qh, + q >= 104. (2) + +This is the relative-history argument of PR5449, with its missing +physical source and all-width premises supplied here. Counting nominal +output rows alone would not prove (2): singular target rows can generate +smaller cyclic modules. The invertible unitary T and pointwise +faithfulness supply the full dimension h for each present target. + +The count is attained for this isolated target block in the enlarged +arbitrary-linear-oracle model: return each t_j in one call. This is not +a claim that 104 native calls suffice for the complete four-bank caller, +helper restoration or a permitted physical implementation. + +## 3. Error when fewer returns are used + +Give operator rows the normalized Hilbert--Schmidt inner product, with +normalization D^(-f), D=2^17. Let lambda_f be any lower Gram bound for +the complete projective Clifford alphabet. In this package one can use +lambda_f=1/9 for f>=72, and lambda_f=125/126 for f>=84. + +Form the 104h-column frame F whose columns are H t_j. Let Q be the +orthogonal projection onto the complement of M. For a coefficient +vector c and any m in M, the Clifford coefficient supports of F c and +m are disjoint in every input column. The pointwise Gram bound gives + + ||F c - m||^2 >= lambda_f ||c||^2. + +Take the infimum over m. Hence (QF)* QF >= lambda_f I. The subspace +N=Q(sum_i A b_i) has dimension at most qh. Let P_N be its orthogonal +projection. A basic rank approximation inequality gives + + ||(I-P_N) QF||_HS^2 >= lambda_f (104-q)_+ h. (3) + +For completeness, if a frame B has B*B>=lambda I_m and P has rank at +most r, choose m-r orthonormal vectors in ker(PB). Their squared image +norms are at least lambda each. Extend them to an orthonormal basis and +sum. This proves ||(I-P)B||_HS^2>=lambda(m-r). It is the elementary +rank bound behind classical low-rank approximation, not a new general +matrix approximation theorem. + +Suppose the decoder produces rows y_j, with error e_j=t_j-y_j. Each +H y_j lies in M+sum_i A b_i. Unitary left action preserves each error +norm. Thus the total squared error over the 104h orbit rows is exactly +h sum_j ||e_j||^2. It is at least (3). After division by h, the selected +104-output by 104-input block error E satisfies + + D^(-f) ||E||_HS^2 >= lambda_f (104-q)_+, + ||E||_op^2 >= lambda_f (1-q/104)_+. (4) + +The second inequality uses rank(E)<=104 D^f. It is a worst-case error +on the direct sum of the 104 input spaces. It does not assert that 104 +individual worst-case errors occur on one common field input. A complete +endpoint has at least this operator norm error, since restriction and +selection are contractions. New paid rows may lie outside the Clifford +span: only their module dimension enters (3). + +For example, at q=103 and f>=84 the squared operator norm error is at +least 125/13104. At q=0 and f>=72 it is at least 1/9, as in the original +passive application. Error below the corresponding q=103 threshold +therefore also requires at least 104 returns. + +## 4. The complete optimistic invoice is adverse + +The authenticated frozen mixed checker supplies these job histograms: + + P = {1:4754, 2:824, 3:1020, 4:254, 5:80, 8:224} + T = {4:56, 7:14, 8:94, 9:876, 17:224}. + +T includes all original helper credits exactly once. The source calls +this an optimistic, unrealized invoice. The histograms are frozen source +declarations; this package does not recount a new physical word. A lower-bound test can grant +every omitted finite cost as zero. By (2), a repair must add at least +104 positive-rank returns. Replace them all by rank-one jobs to obtain +the cheaper paid profile P'=P+104 delta_1. Do not remove an original paid +job, change its input, or add a target credit in this comparison. + +For d=P'-T, calculate K(k)=sum_r d_r min(r,k). The exact support knots are: + +| k | 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 | 17 | +|---|---|---|---|---|---|---|---|---|---| +| K(k) | 5996 | 7134 | 7448 | 6742 | 5838 | 3870 | 2900 | 1800 | 8 | + +Between support knots K is linear. All its positive integer values are +positive. For any increasing concave tariff phi with phi(0)=0, set +s_k=phi(k)-phi(k-1). Summation by parts gives + + sum_r d_r phi(r) + = s_17 K(17) + sum_(k=1..16) (s_k-s_(k+1)) K(k) >= 0. (5) + +For phi(r)=r^p with 00 and K(17)=8. The inequality is strict. +The original rank-mass surplus is 96; the unavoidable repair costs at +least 104. Equation (5) shows the loss at every positive concave power, +not merely at p=1 or at a numerical sample of exponents. No rounding or +root estimate is used. Constant-zero or flat concave tariffs need not +give a strict inequality. + +This applies the repository's existing +[exact invoice comparator](../../scripts/compare_recursive_invoices.py), +with its credit to classical concave order, mightyOil and predecessors. +The new [repair invoice](REPAIR-INVOICE.json) binds this arithmetic to +the source histograms and the proved added-return count. The comparator +alone does not establish those physical premises. + +There is also an error floor for any profitable approximate repair. +With 96 added rank-one jobs the same hinges remain nonnegative, with +K(17)=0 and the earlier knots positive. Such a repair cannot have a +positive margin for any 0=72. One new field row adds at most h dimensions even when it is +arbitrary and uses previous returns. This does not require a domain or +cancellation law for the ordinary algebra. + +The quantitative extension projects the target frame off the initial +history. The full Clifford Gram lower bound survives this projection +because the source and target coefficient supports are disjoint. A +classical rank approximation inequality then gives the deficit error +bound. The argument counts all H-translates of all target rows. It does +not sum separate worst-case inputs as if they were the same input. + +The actual frozen target is the first diagonal block D1 Q^-1 on original +bank 0. The same source supplies P and T, including all helper credits. +The mandatory clarification permits free owned CLEAR; no reset lower +bound is used. Source-declared invoice entries are loaded through the +unchanged portable loader, not reconstructed from a new physical word. +Its rank-mass surplus is 96, while the added-return lower bound is 104. +All nine signed concave-order hinges are positive after the cheapest +repair, so the adverse cost conclusion holds on the whole stated power +interval. The existing exact comparator supplies that arithmetic method. + +The interval engine also encloses the raw margin between 36 and 37 at +the pinned selected value used as a reference tariff. Thus an affordable +repair there has at most 36 new returns and a fixed nonzero operator +error floor. This is a tariff comparison, not selected-frontier replay. + +Exact small-group checks include central phases at four width residues, +feedback and overwrite histories, cached targets, wrong input versions, +least-squares approximation, complementary idempotents that share one +return, and width-one physical dependence. These controls check the +distinctions that the proof needs. The all-width proof, source extraction +and invoice assumptions remain separate from finite corroboration. + +The 07:29..07:30 UTC prepublication refresh found main unchanged and +covered 398 open PRs and 4,826 Discussion records. PR5531 uses the original +pointwise theorem on a different, 73-axis negative E endpoint. Its fixed +observation contract and norm-only conclusion do not overlap the present +104-column paid-repair and invoice result. Its pinned source remains the +unchanged original theorem commit. No new competing claim on this repair +scope was found. This is still a bounded overlap check, not global novelty. diff --git a/research/clifford-pointwise-faithfulness/RESULT.json b/research/clifford-pointwise-faithfulness/RESULT.json new file mode 100644 index 0000000000..e7640e5d53 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/RESULT.json @@ -0,0 +1,320 @@ +{ + "clifford_censuses": [ + { + "axes": 1, + "displacement_ranks": { + "0": 1, + "1": 3, + "2": 2 + }, + "overlaps": { + "0": 1, + "1": 6, + "2": 8 + }, + "projective_order": 24, + "symplectic_order": 6, + "zero_overlaps": 9 + }, + { + "axes": 2, + "displacement_ranks": { + "0": 1, + "1": 15, + "2": 100, + "3": 300, + "4": 304 + }, + "overlaps": { + "0": 1, + "1": 30, + "2": 400, + "3": 2400, + "4": 4864 + }, + "projective_order": 11520, + "symplectic_order": 720, + "zero_overlaps": 3825 + } + ], + "exact_positive_Gram_sizes": [ + 6, + 24 + ], + "examples": { + "native-1-identity.json": { + "axes": 1, + "decisions": [ + { + "equal": true, + "failures": [], + "gram_lower_bound": "1/2", + "phase_residue": 0, + "width": 8 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "1/2", + "phase_residue": 1, + "width": 9 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "25/32", + "phase_residue": 2, + "width": 10 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "25/32", + "phase_residue": 3, + "width": 11 + } + ], + "equal": true, + "problem_sha256": "5ec5c1d925fa7a79381eed41213c479caedb97a96b35a49eeba84624daf10940", + "schema": "clifford-pointwise/v1", + "scope": "all-positive-widths" + }, + "native-17-identity.json": { + "axes": 17, + "decisions": [ + { + "equal": true, + "failures": [], + "gram_lower_bound": "15012035871336244158376742625882962056980917290227300430718349610187586298795724967750288241818388072331510355393216731687558989143138428798507710704884164192105304698649639726569/129672361527531029953512745740348785969138944757576153124864291552832900356653379574990845279596993571506183956603149661949848471106617978371464838566061365220661931356297172615168", + "phase_residue": 0, + "width": 72 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "15012035871336244158376742625882962056980917290227300430718349610187586298795724967750288241818388072331510355393216731687558989143138428798507710704884164192105304698649639726569/129672361527531029953512745740348785969138944757576153124864291552832900356653379574990845279596993571506183956603149661949848471106617978371464838566061365220661931356297172615168", + "phase_residue": 1, + "width": 73 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "1471459829441411374401498041435645296974787735121481902610825478875458309655101119714192268819578336699467639240935585741319521261255209571291292613176387017337961205926674773122964589929635/2227754207823337509102134573095845373483021732054960903603121346630505452738612005129840239901060253798165190221481644194672219102234100585084307285020612396607419274589973120157653414182912", + "phase_residue": 2, + "width": 74 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "1471459829441411374401498041435645296974787735121481902610825478875458309655101119714192268819578336699467639240935585741319521261255209571291292613176387017337961205926674773122964589929635/2227754207823337509102134573095845373483021732054960903603121346630505452738612005129840239901060253798165190221481644194672219102234100585084307285020612396607419274589973120157653414182912", + "phase_residue": 3, + "width": 75 + } + ], + "equal": true, + "problem_sha256": "b2f90f43c62434ee0cb3d814ad1d3bf38cf7e4a01eb8c7297029fe1bfbf53ac4", + "schema": "clifford-pointwise/v1", + "scope": "all-positive-widths" + }, + "native-9-identity.json": { + "axes": 9, + "decisions": [ + { + "equal": true, + "failures": [], + "gram_lower_bound": "346536029241298546386630377264525115890954984566249/2993155353253689176481146537402947624255349848014848", + "phase_residue": 0, + "width": 40 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "346536029241298546386630377264525115890954984566249/2993155353253689176481146537402947624255349848014848", + "phase_residue": 1, + "width": 41 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "518264766085630586881918582378947208084462185796044874915/784637716923335095479473677900958302012794430558004314112", + "phase_residue": 2, + "width": 42 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "518264766085630586881918582378947208084462185796044874915/784637716923335095479473677900958302012794430558004314112", + "phase_residue": 3, + "width": 43 + } + ], + "equal": true, + "problem_sha256": "008064137e37bac54e75ad0824ea768c3b169c11b8ac77d145af2523d4a7a193", + "schema": "clifford-pointwise/v1", + "scope": "all-positive-widths" + }, + "native-9-phase-trap.json": { + "axes": 9, + "decisions": [ + { + "equal": false, + "failures": [ + { + "coefficient_mass": "2", + "input_role": 1, + "normalized_squared_norm": "2", + "output_role": 1, + "projective_terms": 1 + } + ], + "gram_lower_bound": "346536029241298546386630377264525115890954984566249/2993155353253689176481146537402947624255349848014848", + "phase_residue": 0, + "width": 40 + }, + { + "equal": true, + "failures": [], + "gram_lower_bound": "346536029241298546386630377264525115890954984566249/2993155353253689176481146537402947624255349848014848", + "phase_residue": 1, + "width": 41 + }, + { + "equal": false, + "failures": [ + { + "coefficient_mass": "2", + "input_role": 1, + "normalized_squared_norm": "2", + "output_role": 1, + "projective_terms": 1 + } + ], + "gram_lower_bound": "518264766085630586881918582378947208084462185796044874915/784637716923335095479473677900958302012794430558004314112", + "phase_residue": 2, + "width": 42 + }, + { + "equal": false, + "failures": [ + { + "coefficient_mass": "4", + "input_role": 1, + "normalized_squared_norm": "4", + "output_role": 1, + "projective_terms": 1 + } + ], + "gram_lower_bound": "518264766085630586881918582378947208084462185796044874915/784637716923335095479473677900958302012794430558004314112", + "phase_residue": 3, + "width": 43 + } + ], + "equal": false, + "problem_sha256": "11e38938ad0acbc75e5fe97a30a5089dd2420da8db9c37d354867774118956d6", + "schema": "clifford-pointwise/v1", + "scope": "all-positive-widths" + }, + "projection-correct.json": { + "coefficient_mass": "0", + "equal_to_zero": true, + "gram_lower_bound": "19/32", + "input_axes": 1, + "output_axes": 1, + "projective_classes": 1, + "schema": "stabilizer-pointwise/v1", + "squared_norm": "0", + "width": 10 + }, + "projection-scalar-trap.json": { + "coefficient_mass": "481/1024", + "equal_to_zero": false, + "gram_lower_bound": "19/32", + "input_axes": 1, + "output_axes": 1, + "projective_classes": 1, + "schema": "stabilizer-pointwise/v1", + "squared_norm": "481/1024", + "width": 10 + } + }, + "finite_bound_checks": 448, + "infinite_row_upper_bounds": { + "clifford_base": "53534/60543", + "clifford_plus12": "162912909217/20637399121920", + "clifford_plus4": "359294/2451015", + "stabilizer_base": "719543/1220625" + }, + "literal_complete_tensor_columns": 4, + "literal_map_entries": 8893, + "literal_pair_inner_products": 3837, + "literal_prefix_inner_products": 161, + "negative_controls": [ + "unproved width", + "Boolean role", + "Nonboolean inverse", + "Invalid native sign", + "dependent support", + "out-of-range offset", + "zero native scale", + "invalid phase", + "invalid phase pair", + "unproved stabilizer width", + "incompatible rectangular types", + "odd exact row request" + ], + "nonunitary_residual_checks": 36, + "source_nine_axis_columns": 1024, + "stabilizer_censuses": [ + { + "axes": 0, + "overlap_counts": [ + 1 + ], + "projective_states": 1, + "zero_overlaps": 0 + }, + { + "axes": 1, + "overlap_counts": [ + 1, + 4 + ], + "projective_states": 6, + "zero_overlaps": 1 + }, + { + "axes": 2, + "overlap_counts": [ + 1, + 12, + 32 + ], + "projective_states": 60, + "zero_overlaps": 15 + }, + { + "axes": 3, + "overlap_counts": [ + 1, + 28, + 224, + 512 + ], + "projective_states": 1080, + "zero_overlaps": 315 + }, + { + "axes": 4, + "overlap_counts": [ + 1, + 60, + 1120, + 7680, + 16384 + ], + "projective_states": 36720, + "zero_overlaps": 11475 + } + ], + "status": "PASS_POINTWISE_CLIFFORD_AND_STABILIZER_NO_NEW_KAPPA" +} diff --git a/research/clifford-pointwise-faithfulness/SOURCES.json b/research/clifford-pointwise-faithfulness/SOURCES.json new file mode 100644 index 0000000000..7c7418c7ae --- /dev/null +++ b/research/clifford-pointwise-faithfulness/SOURCES.json @@ -0,0 +1,378 @@ +{ + "schema_version": 1, + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "files": [ + { + "path": "certificates/selected-result.json", + "usage": "input", + "git_blob": "fc3d4ba105e1f097d0d7d051a308281e86ab1446", + "sha256": "66974efdced4083c00025f97d95d83909a226cdf801edb9301c195c6641f6903" + }, + { + "path": "docs/research/agent-task-catalog.json", + "usage": "provenance", + "git_blob": "f126dd2e2dad2b669e75d1d0d0bd05c600725602", + "sha256": "f7a48bfa2659b88378282a8eee7d9fe52cdf505594124c4d1686b58510fffd72" + }, + { + "path": "research/clifford-tensor-gram/compact.py", + "usage": "input", + "git_blob": "aa83f0f5652463d4e13ba403d03caedfdff495a1", + "sha256": "ddd6c245f8e66a02071e3475a6f8c1fecc21e0ad5de00ac0d0fe5d9244ff0497" + }, + { + "path": "research/clifford-tensor-gram/certify.py", + "usage": "input", + "git_blob": "95c1cbf710e1dc4faf4370ad1e468c4ad1798ab2", + "sha256": "a0dcd5a8551179305a993b1f9c034aa7c3898e08cd2344fd63f5ea9449dbb8bd" + }, + { + "path": "research/clifford-tensor-gram/check_witness.py", + "usage": "input", + "git_blob": "a3bca57b43a3fa05372510ff1cfa0e1512c9eb9a", + "sha256": "f3b811928a44301bb87b619bcedefa0a5dccb6ecc3fcaa9e69c21e7decf8ef3c" + }, + { + "path": "research/clifford-tensor-gram/quadratic.py", + "usage": "input", + "git_blob": "a57ba96a01569964538767001cb3c729052dacf0", + "sha256": "e10a809ab78b93340072a1b57d7158e1bf75fa8d1ddfda546b9262861883938b" + }, + { + "path": "research/clifford-tensor-gram/vendor/fields.py", + "usage": "input", + "git_blob": "f1b6dc83e26bd9fd9ec67ded3fedb330ef89598d", + "sha256": "0829ad6ed3775ba6e3d11cf04cfb3513ac763549b730aaed74958b1238e660d7" + }, + { + "path": "research/clifford-tensor-gram/vendor/clifford_exact.py", + "usage": "input", + "git_blob": "166841a037f069249f6f7f6dedb89248812f59e2", + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962" + }, + { + "path": "research/clifford-tensor-gram/README.md", + "usage": "provenance", + "git_blob": "9f6cdf24c5c093ac3c692905e04df57c516f26c5", + "sha256": "ee7dbe386bfc4ca2dfc38126ceb03011e9fd7eef3f7dc1b9ef9ed669a91ac162" + }, + { + "path": "research/clifford-tensor-gram/PROOF.md", + "usage": "provenance", + "git_blob": "cb8b75a33d0a623cfa64c32aaf7878d2a5816397", + "sha256": "f79c723a869a480c9959038f59db206359e4b6768e9839aff25b3921beaec84a" + }, + { + "path": "research/clifford-tensor-gram/ADVANCES.md", + "usage": "provenance", + "git_blob": "340c54f7526b4e1ebfd75d58a6eda32ae1bdde43", + "sha256": "f3fb828fa04cf35b94e2199e51955e36dec26fb04e5be781feb9c84f3278f700" + }, + { + "path": "research/clifford-tensor-gram/vendor/NATIVE-LINEAGE-NOTICE", + "usage": "input", + "git_blob": "380e979f0e84e00a22bd890615d87cc4684ad740", + "sha256": "ee0c73ca35877aad0e0b6adc560a3881cb82276dba4cf2d4fc58cd19e57cc420" + }, + { + "path": "research/native-tensor-cutoff/PROOF.md", + "usage": "provenance", + "git_blob": "2d92f17cd8e1064028656cd4ff06c1d38f14ebc0", + "sha256": "b2d31ea52b652f43cc8576affde6092a884d2832820221a43933e7e27dc07041" + }, + { + "path": "research/singular-rank-two-pauli/PROOF.md", + "usage": "provenance", + "git_blob": "c8ffbe676f33e14105c188959e47d8aafeaaae3e", + "sha256": "bc43da28cf432e370532cdeb1622ce8efb175d497fe83b632d8560fd27c20a5b" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/PROOF.md", + "usage": "input", + "git_blob": "3933f848e5bd6e253cd78ff0a15a15558aaa9d55", + "sha256": "02ccd0a9d93b381286e441afa4c28a902db153a4d0dae4d761cf813ede9f2f6d" + }, + { + "path": "research/passive-saved-query-ceiling/.gitattributes", + "usage": "input", + "git_blob": "4f7fc3ef1406bfab189a4a14744c344f36d77d9a", + "sha256": "730a35ae3d558080083c3103d9ac8100c3f6561678092abe341701dfa331eb1d" + }, + { + "path": "research/passive-saved-query-ceiling/ADAPTER.md", + "usage": "input", + "git_blob": "5dca82ab45f2d3e4ccb683b7a800f8ffd5007a91", + "sha256": "91874f3940c1b1e778925584a359ef6df5afe9ef4ce56e208b14fb6287b53bb5" + }, + { + "path": "research/passive-saved-query-ceiling/INPUTS.json", + "usage": "input", + "git_blob": "52d65f734c10b91d7c40200f3e3049ba9609214b", + "sha256": "d0d5ac6695c2c10137658bc417959e900e3d950b338b243a788aade4a9fe2498" + }, + { + "path": "research/passive-saved-query-ceiling/NOTICE.md", + "usage": "input", + "git_blob": "2a5c114f341dcec16a827aed8092f178caa93693", + "sha256": "08a9fec18655da8f87c8b7b96476594c0041019d00d0c55ccd4934c5fcc44434" + }, + { + "path": "research/passive-saved-query-ceiling/PACKAGE-FILES.json", + "usage": "input", + "git_blob": "97885c570ffcc088017b482a43fb275d220f91e7", + "sha256": "6738cd5607645bc4e3ad95921d82f06c4a7a842bdf7aea36543cb8106cdf54d4" + }, + { + "path": "research/passive-saved-query-ceiling/README.md", + "usage": "input", + "git_blob": "46c9b2a5487e5cc55bc48c878eb026837eaaa7db", + "sha256": "ac342b00d8d06635c68e9e381018715af7dfbc616b2cd94cde0b71285f2db1f5" + }, + { + "path": "research/passive-saved-query-ceiling/SOURCES.json", + "usage": "input", + "git_blob": "95437756bcfc9cd66ade8b0674c729e79d20e09c", + "sha256": "f26fb7f3e7f891b3fa766e78856559a632f9053a538303304d3dfac7820a4bf3" + }, + { + "path": "research/passive-saved-query-ceiling/TASK.json", + "usage": "input", + "git_blob": "cbfc3161d45435df2c3a7898badcc33b530c2848", + "sha256": "e22fea35e5dd676d4c251f29101c05b84a426f2ba1852755ce4b9754e2cc9aff" + }, + { + "path": "research/passive-saved-query-ceiling/VERIFY.json", + "usage": "input", + "git_blob": "d4c7b4c7eed37e8ee07d5060caa34c9a3525e5e7", + "sha256": "f9ab2045f2624aa92a4106f8aef87ef7f87e6431e50c3094b5108a0962fa0a54" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/ADDENDUM-HASH.json", + "usage": "input", + "git_blob": "205878510060e7cdf8ca913870b5a828261625c2", + "sha256": "83f7d8f35e379ad293500dcc60406fe0f3a8783157632c3a58f162385dd7f2ea" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/AUTHOR-RUNS.json", + "usage": "input", + "git_blob": "a40bd16f5dd989b3ff0dbdd17b5af3db509a9d31", + "sha256": "945dbb6b0c25ec1adb9acd0f9a82f96ae9e168d6f3054423f9c91342b3bc030b" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/FILES.json", + "usage": "input", + "git_blob": "57baa18a00e918a1ecef83a3d2b30c141cfe9361", + "sha256": "3fa257834ba6635cadc8b1df4c6dfadd602dba99111ce4fc56926829ac8cb58e" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/FROZEN-HASHES.json", + "usage": "input", + "git_blob": "14371832d521dc30f9a517559f5f605653d40577", + "sha256": "0531c49f6376ae74be4c20af66412304f7b4680cfe5280abd7a24ea40be48fc9" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/INDEPENDENT.json", + "usage": "input", + "git_blob": "d031b7db0b41aeaa99313fb8880a8dbc0c71bcb9", + "sha256": "bfbfeb0a835e11ef9a4638f57e9179758e7bda560c58993e26c6ec9cde8a47d9" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/REVIEW.md", + "usage": "input", + "git_blob": "a96f85b1aff079a0b6ddedd96804a454f2c5c416", + "sha256": "004a1e8d0fbb17f2ce3b6ca5cab4504a0b0432c9b22a0cc14659b328a5a4442d" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/RUNS.json", + "usage": "input", + "git_blob": "5458deddeba273b1e09ed17b24ff7b6377fdf992", + "sha256": "8d5950f50f37b5304e6f7649163c8d285f9f514403b97c57a433da0d9f28144e" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/SOURCES.json", + "usage": "input", + "git_blob": "04061b421cfaeb47fd7a7f5d07f56c68155b980e", + "sha256": "2ce39d5c24288ec02bdefd432cc4b592930d4c3bc1a7ec40efc481bc57597608" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/algebra.py", + "usage": "input", + "git_blob": "0fffec34c573ea98dbf083196c0b92fd173495d2", + "sha256": "f824a46d061be2326c544f2f3637eec0c2d2a38800848c2da2f2aa409cad43dc" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/bank_span-normal.json", + "usage": "input", + "git_blob": "b3b774f9419dabba47e3dd949dba216053deb153", + "sha256": "c92a574492a18d501ae6acd8cb792aaaa28070312a7558990923d7a7e810073c" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/bank_span-optimized.json", + "usage": "input", + "git_blob": "b3b774f9419dabba47e3dd949dba216053deb153", + "sha256": "c92a574492a18d501ae6acd8cb792aaaa28070312a7558990923d7a7e810073c" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-mixed-thin-gate/check.py", + "usage": "input", + "git_blob": "bee0ff7c400dd91dc7d05f893c7a211a28f7028f", + "sha256": "fe7db972d7ae238b21f8a453c21243360d131d728a76b91a469dacf447629582" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/BANK-SPAN.json", + "usage": "input", + "git_blob": "b3b774f9419dabba47e3dd949dba216053deb153", + "sha256": "c92a574492a18d501ae6acd8cb792aaaa28070312a7558990923d7a7e810073c" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/FILES.json", + "usage": "input", + "git_blob": "016743d451a390aa2c2f46ccd8f740bab5f315ee", + "sha256": "a7d684b92f2bc54ac2a201dcabdc52c549dba8089a1141bb54167806a92d6deb" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/GRADE-GATE.json", + "usage": "input", + "git_blob": "75481eb1e4e62311444d1e73e7f15f14e949476f", + "sha256": "8267ff814fd7fa86638b6ce6384f0ac717a341d871bd302742de6aaf8ba00b6d" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/HANDOFF.md", + "usage": "input", + "git_blob": "0039d7a76d4b3ecafc1122e5662cfbf44a982d21", + "sha256": "8808fa41d55040838827077ff51ad9ef8b3fb994a32b59c340d564de9895834e" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/OWNED-RESET-CLARIFICATION.md", + "usage": "input", + "git_blob": "75339d65d966610b4c035436ca93c2fd7417142c", + "sha256": "bd30b35ff2364fb6b430e31bd6cc3de969454a3e81d73adf4fc2f633ac0d9484" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/UNIFORM-ALPHABET-ADDENDUM.md", + "usage": "input", + "git_blob": "d742381500d94759a3278050d86b7d1dcc726a7e", + "sha256": "f51448dc7551e8b61613c642d9487282f06e2ddc6274b1693276920688d5496f" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/bank_span.py", + "usage": "input", + "git_blob": "513be55ff4c630dda408244223a0bfed6b76ad49", + "sha256": "55c5d1761812d847188fa893988decc491a40151ad45f3fb806e7f8c3337229d" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/grade_gate.py", + "usage": "input", + "git_blob": "4f17c18803ce7843803d2a685d7bc9cff998eb49", + "sha256": "5e1e3f18033cf6482094edb050ff4274515b85e7bb333647b41ad38d4f172a68" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/grade_gate-normal.json", + "usage": "input", + "git_blob": "75481eb1e4e62311444d1e73e7f15f14e949476f", + "sha256": "8267ff814fd7fa86638b6ce6384f0ac717a341d871bd302742de6aaf8ba00b6d" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/grade_gate-optimized.json", + "usage": "input", + "git_blob": "75481eb1e4e62311444d1e73e7f15f14e949476f", + "sha256": "8267ff814fd7fa86638b6ce6384f0ac717a341d871bd302742de6aaf8ba00b6d" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/independent-normal.json", + "usage": "input", + "git_blob": "d031b7db0b41aeaa99313fb8880a8dbc0c71bcb9", + "sha256": "bfbfeb0a835e11ef9a4638f57e9179758e7bda560c58993e26c6ec9cde8a47d9" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/independent-optimized.json", + "usage": "input", + "git_blob": "d031b7db0b41aeaa99313fb8880a8dbc0c71bcb9", + "sha256": "bfbfeb0a835e11ef9a4638f57e9179758e7bda560c58993e26c6ec9cde8a47d9" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/independent.py", + "usage": "input", + "git_blob": "34ed8a2f69ec26f054bddc40825df0a00d58672e", + "sha256": "d4375345586d07eddc9a2bdb0c5721629beae369eeecc52341916531863abc65" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/inputs/INVOLUTIVE-WORD.json.gz", + "usage": "input", + "git_blob": "eac634fb1d09428aa6715a47d652ae701dd0efc5", + "sha256": "ff2999f022e93e05a250160808aa3c32a08041039d7edfb01068c0308f50c138" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/inputs/NORMALIZERS.json", + "usage": "input", + "git_blob": "bca92c222c395d3d75c047fbb678f3cd0947c60f", + "sha256": "ae8aad06aa5d1811d725895b3ab5a4f4daa9dcdd88294aa0d5f723e78bb1e0da" + }, + { + "path": "research/passive-saved-query-ceiling/evidence/inputs/clifford_exact.py", + "usage": "input", + "git_blob": "166841a037f069249f6f7f6dedb89248812f59e2", + "sha256": "2982ead07721e83358dc67c6f49c2b4c16a236a6bebdfd72f58221be1f5d0962" + }, + { + "path": "research/passive-saved-query-ceiling/inputs/gauge.py", + "usage": "input", + "git_blob": "44ae72b314cccf677b44d75c374be6dcac1c8167", + "sha256": "390391d291353741c89daea999d483660ca185987ed96a15b82576280c487cad" + }, + { + "path": "research/passive-saved-query-ceiling/inputs/intervals.py", + "usage": "input", + "git_blob": "4b24a5096154736ce060474eb8c72dc64c303699", + "sha256": "0ce7e7137422d5ffeda22085c81fa88471bbe963100fdad62e659f1e3bf89326" + }, + { + "path": "research/passive-saved-query-ceiling/licenses/native-involutive-dual/ATTRIBUTION.md", + "usage": "input", + "git_blob": "03b9d323c2683ecaab822e15c18090b176f70216", + "sha256": "129c1ea99e6705d60f27fcc06b92d076f7628678e3ded8635aedf1db566bb4a0" + }, + { + "path": "research/passive-saved-query-ceiling/licenses/native-involutive-dual/LICENSE", + "usage": "input", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "research/passive-saved-query-ceiling/licenses/native-involutive-dual/NOTICE", + "usage": "input", + "git_blob": "304a64959a9b54d058a976d3da733a71c40eab13", + "sha256": "4cdeaee293544903e613743fedac3c56a1089a146d5f032db5001d33beac2180" + }, + { + "path": "research/passive-saved-query-ceiling/licenses/native-involutive-dual/ORIGINS.json", + "usage": "input", + "git_blob": "3401643709dba69f1f6246bf249d0d3fe0ac7ff9", + "sha256": "e331ba07271b50407b547aadff3cb0ad29a6d26dcae85bae70f2e508a331a4fc" + }, + { + "path": "research/passive-saved-query-ceiling/portable.py", + "usage": "input", + "git_blob": "8cfdc8207cb7c4145bd66dc2682378482760f2d0", + "sha256": "2f33763b8a6550895752e8dbf4d27712ec3e6b1079f22410402cdc382d310aac" + }, + { + "path": "research/passive-saved-query-ceiling/verify.py", + "usage": "input", + "git_blob": "561f3ddac12480a91c612dc97b020e303325876c", + "sha256": "b786ee95cfbef92f5f244e10261eba1f45dc2352b5399efaab4cbbc28213131e" + }, + { + "path": "research/clifford-tensor-gram/LICENSE", + "usage": "input", + "git_blob": "261eeb9e9f8b2b4b0d119366dda99c6fd7d35c64", + "sha256": "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + }, + { + "path": "scripts/compare_recursive_invoices.py", + "usage": "input", + "git_blob": "fda2a852e9937e42fe40df0707694465ca7c1b48", + "sha256": "3930c22c11da7bc6042cfeb6e459ecb06e4478430037bee3469d034353855fc6" + } + ] +} diff --git a/research/clifford-pointwise-faithfulness/TASK.json b/research/clifford-pointwise-faithfulness/TASK.json new file mode 100644 index 0000000000..200b3e7caf --- /dev/null +++ b/research/clifford-pointwise-faithfulness/TASK.json @@ -0,0 +1,107 @@ +{ + "schema_version": 1, + "task_id": "formal-interface-lemma", + "priority_revision": 7, + "base_commit": "32890bc5de034ab8fc93ac88ead7279a6a416d04", + "original_card": { + "id": "formal-interface-lemma", + "question": "Can one uncovered interface implication be formalized with exact caller and certificate bindings?", + "starting_points": [ + "docs/research/research-family-status.md", + "certificates/selected-result.json", + "research/gate-operand-parity-lean/README.md", + "research/staged544-certified-endpoint/README.md", + "research/unconditional-batched-crt/README.md" + ], + "methods": [ + "Formalize a missing boundary lemma identified by the selected review.", + "Audit a formal theorem-to-certificate binding independently." + ], + "acceptance_gate": "State the exact formalized proposition and remaining assumptions; avoid duplicate arithmetic formalizations already present.", + "first_step": { + "command": [ + "python3", + "-B", + "scripts/research_baseline.py" + ], + "expected": "PASS_RESEARCH_BASELINE_BINDINGS_ONLY", + "inspect": "Inventory the gate-operand parity lemma (#3807) and certified endpoint arithmetic (#3857). Neither is a full multiplication proof. For #4100, audit the compact-switch statement and its hypotheses before formalizing it.", + "scope": "Source-binding orientation only; no scientific replay, theorem acceptance or supplier admission. Budget any heavy replay separately." + }, + "first_experiment": "Write one missing statement with quantified hypotheses, actual caller and existing coverage. A compact-switch lemma is a candidate only after its mathematical contract is reviewed. Establish a bounded proof plan before a separately budgeted proof-assistant build; do not rerun large Lean jobs as orientation.", + "bottleneck_link": "A missing interface proof can reduce the conditional gap even if it does not change kappa.", + "allowed_variations": [ + "Narrow to one formal lemma or one theorem-to-certificate binding." + ], + "scope_change_triggers": [ + "Formalizing already-covered arithmetic and claiming the full multiplication theorem." + ], + "overlap_terms": [ + "hyperplane end", + "formal interface", + "Lean binding", + "3807", + "3857", + "4100", + "gate-operand-parity-lean", + "staged544-certified-endpoint", + "unconditional-batched-crt" + ], + "existing_checks": [ + { + "scope": "PR #3807: scoped gate-operand parity formalization.", + "evidence": "research/gate-operand-parity-lean/README.md", + "remaining": "Exact theorem-to-caller binding and genuinely uncovered interface lemmas.", + "status": "author-checked", + "source_commit": "4c3530f42a6abcc48e7a6bcffd6c901911dc8269", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #3857: certified real-power moment/endpoint arithmetic.", + "evidence": "research/staged544-certified-endpoint/README.md", + "remaining": "Uniform algorithmic implications, not another endpoint digit.", + "status": "author-checked", + "source_commit": "ef4315b8caa605e47a2515004845eb2d2ed71a86", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + }, + { + "scope": "PR #4100: compact-switch formalization proposed as future validation.", + "evidence": "research/unconditional-batched-crt/README.md", + "remaining": "Audit the statement and assumptions before a formal proof campaign.", + "status": "author-checked", + "source_commit": "337d04939571a637aeab54a0f58f54fde811663a", + "selected_record_sha256": "bb2eaa58647b353f88d0aec2eafb9d30df1be53589231b23e12ceef3e4bad129" + } + ] + }, + "scope_status": "changed", + "actual_scope": "Prove pointwise Clifford and stabilizer tensor bounds, implement exact residual decisions, and derive a source-bound 104-return repair floor, error tradeoff and complete adverse invoice.", + "scope_change_reason": "The full-Clifford fixed-program extension already exists in PR #5376. Its pointwise width, selected-window stability and nonunitary interface gaps lead to a written theorem instead of a proof-assistant formalization. The user requested a further significant contribution. The retained passive caller permits a relative-history application: PR5449 already supplies the dimension method, but its source binding, quantitative approximation consequence and complete repair budget were open here.", + "bottleneck_link": "Explicit native-interface thresholds and complete source-bound obstructions prevent unsupported endpoint and repair-cost claims. The frozen repair now fails for all positive concave power tariffs. The complete multiplication framework remains conditional.", + "budget_minutes": 180, + "stop_rule": "Finish the symbolic proof, independent finite counting paths, source-bound corollary, registered replay, publication-byte checks and focused handoff. Do not start an active caller construction.", + "outcome": "completed", + "evidence": "PROOF.md, RESULT.json, APPLICATION.md, APPLICATION-RESULT.json, PASSIVE-REPLAY.json and source-authenticated normal/optimized replays. REPAIR.md, REPAIR-RESULT.json and REPAIR-INVOICE.json add the quantitative paid-repair result.", + "author": "Ali Romman with substantial OpenAI Codex assistance", + "ai_assistance": "Substantial OpenAI Codex assistance with task selection, derivation, exact Python implementation, source audit, verification and documentation. One agent; no independent human or proof-kernel review.", + "open_questions": [ + { + "question": "What is the least pointwise width and best spectral constant for the full Clifford group?", + "why_it_matters": "A sharper bound can reduce exact interface tests and expose dimension obstructions.", + "first_step": "Compute exact small-group Gram spectra by central residue, then seek a uniform proof.", + "blocked_by": "The present row-sum bound is sufficient and does not determine optimal eigenvalues." + }, + { + "question": "Can an active change to an original paid input escape the proved frozen-history obstruction at a favorable complete price?", + "why_it_matters": "Only a source-bound endpoint and complete price can affect the multiplication result.", + "first_step": "Check current ownership, then bind one complete operator alphabet and its available paid history.", + "blocked_by": "The frozen PR4948 word requires at least 104 additional returns and fails every positive concave power tariff. A changed paid input needs a new complete dependency and price audit." + }, + { + "question": "Can the stabilizer-map residual frontend certify an actual projection or rectangular caller?", + "why_it_matters": "The theorem now permits these maps, but an actual endpoint must retain native scalars and all returns.", + "first_step": "Supply one literal native projection and its complete input/output contract.", + "blocked_by": "No source-bound nonunitary register compiler or physical caller is claimed." + } + ] +} diff --git a/research/clifford-pointwise-faithfulness/VERIFY.json b/research/clifford-pointwise-faithfulness/VERIFY.json new file mode 100644 index 0000000000..7c495f8619 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/VERIFY.json @@ -0,0 +1,141 @@ +{ + "schema_version": 1, + "status": "ready", + "python": "3.12", + "requirements": [], + "inputs": [ + "research/clifford-tensor-gram/compact.py", + "research/clifford-tensor-gram/certify.py", + "research/clifford-tensor-gram/check_witness.py", + "research/clifford-tensor-gram/quadratic.py", + "research/clifford-tensor-gram/vendor/fields.py", + "research/clifford-tensor-gram/vendor/clifford_exact.py", + "research/clifford-tensor-gram/vendor/NATIVE-LINEAGE-NOTICE", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/PROOF.md", + "research/passive-saved-query-ceiling/.gitattributes", + "research/passive-saved-query-ceiling/ADAPTER.md", + "research/passive-saved-query-ceiling/INPUTS.json", + "research/passive-saved-query-ceiling/NOTICE.md", + "research/passive-saved-query-ceiling/PACKAGE-FILES.json", + "research/passive-saved-query-ceiling/README.md", + "research/passive-saved-query-ceiling/SOURCES.json", + "research/passive-saved-query-ceiling/TASK.json", + "research/passive-saved-query-ceiling/VERIFY.json", + "research/passive-saved-query-ceiling/evidence/ADDENDUM-HASH.json", + "research/passive-saved-query-ceiling/evidence/AUTHOR-RUNS.json", + "research/passive-saved-query-ceiling/evidence/FILES.json", + "research/passive-saved-query-ceiling/evidence/FROZEN-HASHES.json", + "research/passive-saved-query-ceiling/evidence/INDEPENDENT.json", + "research/passive-saved-query-ceiling/evidence/REVIEW.md", + "research/passive-saved-query-ceiling/evidence/RUNS.json", + "research/passive-saved-query-ceiling/evidence/SOURCES.json", + "research/passive-saved-query-ceiling/evidence/algebra.py", + "research/passive-saved-query-ceiling/evidence/bank_span-normal.json", + "research/passive-saved-query-ceiling/evidence/bank_span-optimized.json", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-mixed-thin-gate/check.py", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/BANK-SPAN.json", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/FILES.json", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/GRADE-GATE.json", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/HANDOFF.md", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/OWNED-RESET-CLARIFICATION.md", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/UNIFORM-ALPHABET-ADDENDUM.md", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/bank_span.py", + "research/passive-saved-query-ceiling/evidence/frozen/pr4948-saved-query-macro-gate/grade_gate.py", + "research/passive-saved-query-ceiling/evidence/grade_gate-normal.json", + "research/passive-saved-query-ceiling/evidence/grade_gate-optimized.json", + "research/passive-saved-query-ceiling/evidence/independent-normal.json", + "research/passive-saved-query-ceiling/evidence/independent-optimized.json", + "research/passive-saved-query-ceiling/evidence/independent.py", + "research/passive-saved-query-ceiling/evidence/inputs/INVOLUTIVE-WORD.json.gz", + "research/passive-saved-query-ceiling/evidence/inputs/NORMALIZERS.json", + "research/passive-saved-query-ceiling/evidence/inputs/clifford_exact.py", + "research/passive-saved-query-ceiling/inputs/gauge.py", + "research/passive-saved-query-ceiling/inputs/intervals.py", + "research/passive-saved-query-ceiling/licenses/native-involutive-dual/ATTRIBUTION.md", + "research/passive-saved-query-ceiling/licenses/native-involutive-dual/LICENSE", + "research/passive-saved-query-ceiling/licenses/native-involutive-dual/NOTICE", + "research/passive-saved-query-ceiling/licenses/native-involutive-dual/ORIGINS.json", + "research/passive-saved-query-ceiling/portable.py", + "research/passive-saved-query-ceiling/verify.py", + "research/clifford-tensor-gram/LICENSE", + "scripts/compare_recursive_invoices.py", + "certificates/selected-result.json" + ], + "commands": [ + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Independent complete stabilizer and Clifford censuses, exact tail and Gram bounds, complete native endpoints, rectangular/projection maps and negative controls." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-W", + "error", + "-B", + "{package}/verify.py" + ], + "timeout_seconds": 180, + "checks": "Independent complete stabilizer and Clifford censuses, exact tail and Gram bounds, complete native endpoints, rectangular/projection maps and negative controls." + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify_application.py" + ], + "timeout_seconds": 180, + "checks": "Replay the pinned passive ceiling and check the explicit width-72 and width-84 error bounds." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-W", + "error", + "-B", + "{package}/verify_application.py" + ], + "timeout_seconds": 180, + "checks": "Replay the pinned passive ceiling and check the explicit width-72 and width-84 error bounds." + }, + { + "argv": [ + "{python}", + "-I", + "-W", + "error", + "-B", + "{package}/verify_repair.py" + ], + "timeout_seconds": 180, + "checks": "Replay actual source targets and invoice; check exact module, phase, approximation and concave-order examples for the 104-return repair floor." + }, + { + "argv": [ + "{python}", + "-I", + "-O", + "-W", + "error", + "-B", + "{package}/verify_repair.py" + ], + "timeout_seconds": 180, + "checks": "Replay actual source targets and invoice; check exact module, phase, approximation and concave-order examples for the 104-return repair floor." + } + ] +} diff --git a/research/clifford-pointwise-faithfulness/audit_mutations.py b/research/clifford-pointwise-faithfulness/audit_mutations.py new file mode 100644 index 0000000000..28a17254a3 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/audit_mutations.py @@ -0,0 +1,78 @@ +"""Check that the scientific replay rejects six deliberate defects. + +Each check uses a private copy. No source input is changed. +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +""" +import argparse +import hashlib +import json +from pathlib import Path +import shutil +import subprocess +import sys +import tempfile + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parent.parent +CASES = ( + ("first Clifford overlap", "bounds.py", "counts[1] //= 2", "counts[1] //= 1", + "Exact first Clifford overlap level", "verify.py"), + ("native phase outside tensor", "native_pointwise.py", + "coefficient*exact.power(phase, width)", "coefficient*phase", "Native/scalar phase residue", "verify.py"), + ("projection scale outside tensor", "stabilizer.py", "value*power(ratio, width)", + "value*ratio", "Stabilizer pointwise Gram estimate", "verify.py"), + ("unsigned fixed Pauli count", "census.py", "trace += 1 if delta == 0 else -1", + "trace += 1", "Nonzero-trace Pauli fiber count", "verify.py"), + ("repair phase outside tensor", "verify_repair.py", "value*exact.power(phase, width)", + "value*phase", "Tensor phase covariance", "verify_repair.py"), + ("missing added repair charge", "verify_repair.py", "paid.get(1, 0) + count", + "paid.get(1, 0)", "Complete repair invoice hinges", "verify_repair.py"), +) + + +def run(): + rows = [] + with tempfile.TemporaryDirectory(prefix="clifford-pointwise-mutations-") as directory: + root = Path(directory) + package = root / "research" / HERE.name + shutil.copytree(HERE, package) + for item in json.loads((HERE / "SOURCES.json").read_text())["files"]: + if item["usage"] == "input": + target = root / item["path"] + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copyfile(ROOT / item["path"], target) + for label, name, old, new, diagnostic, runner in CASES: + target = package / name + original = target.read_text() + if original.count(old) != 1: + raise ValueError("Mutation target is not unique: "+label) + target.write_text(original.replace(old, new)) + for optimized in (False, True): + argv = [sys.executable, "-I"]+(["-O"] if optimized else []) + argv += ["-W", "error", "-B", str(package / runner)] + result = subprocess.run(argv, capture_output=True, text=True, timeout=180) + if result.returncode == 0 or diagnostic not in result.stderr: + raise ValueError("Mutation did not fail as expected: "+label+"\n"+result.stderr) + rows.append({"mutation": label, "optimized": optimized, "diagnostic": diagnostic}) + target.write_text(original) + sources = {path.name: hashlib.sha256(path.read_bytes()).hexdigest() + for path in sorted(HERE.glob("*.py"))} + return {"status": "PASS_TWELVE_SCIENTIFIC_MUTATION_REJECTIONS", "checks": rows, + "source_sha256": sources} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write-result", action="store_true") + args = parser.parse_args() + result = run() + path = HERE / "MUTATIONS.json" + if args.write_result: + path.write_text(json.dumps(result, indent=2, sort_keys=True)+"\n") + elif result != json.loads(path.read_text()): + raise ValueError("The mutation receipt changed") + print(result["status"]) + + +if __name__ == "__main__": + main() diff --git a/research/clifford-pointwise-faithfulness/bounds.py b/research/clifford-pointwise-faithfulness/bounds.py new file mode 100644 index 0000000000..5e4dccb003 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/bounds.py @@ -0,0 +1,66 @@ +"""Exact bounds for projective Clifford tensor Gram matrices. + +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +""" +from fractions import Fraction + + +def gaussian_binomial(dimension, rank): + """Count binary subspaces of the specified rank.""" + if not 0 <= rank <= dimension: + return 0 + value = Fraction(1) + for j in range(rank): + value *= Fraction((1 << (dimension-j))-1, (1 << (rank-j))-1) + if value.denominator != 1: + raise ArithmeticError("Nonintegral subspace count") + return value.numerator + + +def overlap_counts(axes, *, clifford=False): + """Return exact stabilizer counts or upper bounds for Clifford counts. + + For Clifford maps, axes is the number of input axes. For stabilizer + states, axes is the number of state axes, including both Choi halves. + """ + if type(axes) is not int or axes < 0: + raise ValueError("Axes must be a nonnegative integer") + dimension = 2*axes if clifford else axes + counts = [gaussian_binomial(dimension, k)*(1 << (k*(k+3)//2)) + for k in range(dimension+1)] + if clifford and dimension: + counts[1] //= 2 + return counts + + +def row_bound(axes, width, *, clifford=False): + """Bound the absolute off-diagonal sum at an even tensor width.""" + if type(width) is not int or width <= 0 or width % 2: + raise ValueError("The exact rational row bound needs a positive even width") + counts = overlap_counts(axes, clifford=clifford) + return sum((Fraction(count, 1 << (k*width//2)) + for k, count in enumerate(counts) if k), Fraction()) + + +def decision_widths(axes): + if type(axes) is not int or axes < 0: + raise ValueError("Axes must be a nonnegative integer") + start = 4*axes+4 if axes else 1 + return list(range(start, start+4)) + + +def pointwise_bound(axes, width, *, clifford=False): + """Give a rational lower Gram bound at the requested width. + + Odd widths use the preceding even-width estimate. A nonpositive lower + bound gives no decision. It does not prove dependence. + """ + if type(axes) is not int or axes < 0: + raise ValueError("Axes must be a nonnegative integer") + if type(width) is not int or width <= 0: + raise ValueError("Width must be a positive integer") + if axes == 0: + return Fraction(1) + if width == 1: + return Fraction(1)-sum(overlap_counts(axes, clifford=clifford)[1:]) + return Fraction(1)-row_bound(axes, width-width % 2, clifford=clifford) diff --git a/research/clifford-pointwise-faithfulness/census.py b/research/clifford-pointwise-faithfulness/census.py new file mode 100644 index 0000000000..5a6962e8cc --- /dev/null +++ b/research/clifford-pointwise-faithfulness/census.py @@ -0,0 +1,208 @@ +"""Enumerate small stabilizer states and Clifford actions in two ways. + +The literal vectors use projective phases 0, 1, i, -1, -i. The second +enumerator uses signed Pauli images and no state vectors. +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +""" +from collections import Counter, deque + +UNITS = ((0, 0), (1, 0), (0, 1), (-1, 0), (0, -1)) + + +def require(ok, message): + if not ok: + raise ValueError(message) + + +def canonical(values): + a, b = next(value for value in values if value != (0, 0)) + norm = a*a+b*b + result = [] + for c, d in values: + if not (c or d): + result.append(0) + continue + require(c*c+d*d == norm, "Unequal stabilizer amplitude magnitudes") + real, imag = c*a+d*b, d*a-c*b + require(real % norm == imag % norm == 0, "Non-Gaussian projective phase") + result.append(UNITS.index((real//norm, imag//norm))) + return tuple(result) + + +def literal_gate(state, gate): + kind, j, *other = gate + if kind == "H": + out = [] + for x in range(len(state)): + a, b = UNITS[state[x & ~(1 << j)]] + c, d = UNITS[state[x | (1 << j)]] + sign = -1 if x >> j & 1 else 1 + out.append((a+sign*c, b+sign*d)) + return canonical(out) + if kind == "S": + out = [0 if value == 0 else 1+(value-1+((x >> j) & 1)) % 4 + for x, value in enumerate(state)] + elif kind == "CX": + k = other[0] + out = [state[x ^ (((x >> j) & 1) << k)] for x in range(len(state))] + else: + raise ValueError("Unknown literal gate") + phase = next(value-1 for value in out if value) + return tuple(0 if value == 0 else 1+(value-1-phase) % 4 for value in out) + + +def gates(n): + out = [(kind, j) for j in range(n) for kind in ("H", "S")] + out += [("CX", j, j+1) for j in range(n-1)] + out += [("CX", j+1, j) for j in range(n-1)] + return out + + +def orbit(initial, alphabet): + found = {initial} + queue = deque([initial]) + while queue: + state = queue.popleft() + for gate in alphabet: + value = literal_gate(state, gate) + if value not in found: + found.add(value) + queue.append(value) + return sorted(found) + + +def stabilizer_states(n): + return orbit((1,)+(0,)*((1 << n)-1), gates(n)) + + +def clifford_choi(n): + initial = tuple(int((x & ((1 << n)-1)) == (x >> n)) for x in range(1 << (2*n))) + return orbit(initial, gates(n)) + + +def state_overlap_histogram(states): + histogram = Counter() + zero = 0 + for state in states: + if not state[0]: + zero += 1 + else: + support = sum(bool(x) for x in state) + require(support & (support-1) == 0, "State support is not a power of two") + histogram[support.bit_length()-1] += 1 + return dict(sorted(histogram.items())), zero + + +def choi_overlap_histogram(states, n): + histogram = Counter() + zero = 0 + dimension = 1 << n + for state in states: + row_weight = sum(bool(x) for x in state[:dimension]) + require(row_weight > 0 and row_weight & (row_weight-1) == 0, "Clifford row weight") + a = b = 0 + for x in range(dimension): + c, d = UNITS[state[x | (x << n)]] + a += c + b += d + numerator = a*a+b*b + if not numerator: + zero += 1 + continue + denominator = row_weight*dimension*dimension + require(denominator % numerator == 0, "Clifford trace norm divisor") + quotient = denominator//numerator + require(quotient & (quotient-1) == 0, "Clifford trace norm power") + histogram[quotient.bit_length()-1] += 1 + return dict(sorted(histogram.items())), zero + + +def binary_rank(rows): + pivots = {} + for row in rows: + while row: + bit = row.bit_length()-1 + if bit not in pivots: + pivots[bit] = row + break + row ^= pivots[bit] + return len(pivots) + + +def pauli_gate(value, gate): + x, z, phase = value + kind, j, *other = gate + if kind == "H": + a, b = (x >> j) & 1, (z >> j) & 1 + phase += 2*a*b + if a != b: + x ^= 1 << j + z ^= 1 << j + elif kind == "S": + a = (x >> j) & 1 + phase += a + z ^= a << j + elif kind == "CX": + k = other[0] + x ^= ((x >> j) & 1) << k + z ^= ((z >> k) & 1) << j + else: + raise ValueError("Unknown Pauli gate") + return x, z, phase % 4 + + +def pauli_product(a, b): + x, z, p = a + y, w, q = b + return x ^ y, z ^ w, (p+q+2*((z & y).bit_count() % 2)) % 4 + + +def pauli_image(tableau, x, z): + n = len(tableau)//2 + value = (0, 0, (x & z).bit_count() % 4) + for j in range(n): + if x >> j & 1: + value = pauli_product(value, tableau[j]) + for j in range(n): + if z >> j & 1: + value = pauli_product(value, tableau[n+j]) + return value + + +def pauli_census(n): + initial = tuple([(1 << j, 0, 0) for j in range(n)]+[(0, 1 << j, 0) for j in range(n)]) + found, queue = {initial}, deque([initial]) + alphabet = gates(n) + while queue: + tableau = queue.popleft() + for gate in alphabet: + value = tuple(pauli_gate(p, gate) for p in tableau) + if value not in found: + found.add(value) + queue.append(value) + histogram, zero, fibers = Counter(), 0, {} + for tableau in found: + columns = tuple(x | (z << n) for x, z, _ in tableau) + rank = binary_rank([x ^ (1 << j) for j, x in enumerate(columns)]) + trace = 0 + for x in range(1 << n): + for z in range(1 << n): + a, b, phase = pauli_image(tableau, x, z) + if (a, b) == (x, z): + delta = (phase-(x & z).bit_count()) % 4 + require(delta in (0, 2), "Non-Hermitian fixed-Pauli phase") + trace += 1 if delta == 0 else -1 + require(trace in (0, 1 << (2*n-rank)), "Pauli trace magnitude") + fiber = fibers.setdefault(columns, [rank, 0, 0]) + fiber[1] += 1 + fiber[2] += bool(trace) + if trace: + histogram[rank] += 1 + else: + zero += 1 + for rank, size, nonzero in fibers.values(): + require(size == 1 << (2*n), "Projective Pauli fiber size") + require(nonzero == 1 << rank, "Nonzero-trace Pauli fiber count") + return {"projective_order": len(found), "symplectic_order": len(fibers), + "overlaps": dict(sorted(histogram.items())), "zero_overlaps": zero, + "displacement_ranks": dict(sorted(Counter(row[0] for row in fibers.values()).items()))} diff --git a/research/clifford-pointwise-faithfulness/examples/native-1-identity.json b/research/clifford-pointwise-faithfulness/examples/native-1-identity.json new file mode 100644 index 0000000000..e0be2ad223 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/examples/native-1-identity.json @@ -0,0 +1,56 @@ +{ + "axes": 1, + "roles": 3, + "operators": { + "H": [ + [ + "D", + [ + 1 + ], + [ + 1 + ] + ], + [ + "C", + 1, + 1 + ], + [ + "D", + [ + 1 + ], + [ + 1 + ] + ] + ], + "iI": [ + [ + "phase", + 1 + ] + ] + }, + "program": [ + { + "op": "apply", + "dst": 1, + "symbol": "H" + }, + { + "op": "apply", + "dst": 1, + "symbol": "H" + } + ], + "reference": [ + { + "op": "apply", + "dst": 1, + "symbol": "iI" + } + ] +} diff --git a/research/clifford-pointwise-faithfulness/examples/native-17-identity.json b/research/clifford-pointwise-faithfulness/examples/native-17-identity.json new file mode 100644 index 0000000000..c83bf47a34 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/examples/native-17-identity.json @@ -0,0 +1,120 @@ +{ + "axes": 17, + "roles": 3, + "operators": { + "H": [ + [ + "D", + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ], + [ + "C", + 1, + 1 + ], + [ + "D", + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ] + ], + "iI": [ + [ + "phase", + 1 + ] + ] + }, + "program": [ + { + "op": "apply", + "dst": 1, + "symbol": "H" + }, + { + "op": "apply", + "dst": 1, + "symbol": "H" + } + ], + "reference": [ + { + "op": "apply", + "dst": 1, + "symbol": "iI" + } + ] +} diff --git a/research/clifford-pointwise-faithfulness/examples/native-9-identity.json b/research/clifford-pointwise-faithfulness/examples/native-9-identity.json new file mode 100644 index 0000000000..1350efc44f --- /dev/null +++ b/research/clifford-pointwise-faithfulness/examples/native-9-identity.json @@ -0,0 +1,88 @@ +{ + "axes": 9, + "roles": 3, + "operators": { + "H": [ + [ + "D", + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ], + [ + "C", + 1, + 1 + ], + [ + "D", + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ] + ], + "iI": [ + [ + "phase", + 1 + ] + ] + }, + "program": [ + { + "op": "apply", + "dst": 1, + "symbol": "H" + }, + { + "op": "apply", + "dst": 1, + "symbol": "H" + } + ], + "reference": [ + { + "op": "apply", + "dst": 1, + "symbol": "iI" + } + ] +} diff --git a/research/clifford-pointwise-faithfulness/examples/native-9-phase-trap.json b/research/clifford-pointwise-faithfulness/examples/native-9-phase-trap.json new file mode 100644 index 0000000000..d825b9bff4 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/examples/native-9-phase-trap.json @@ -0,0 +1,88 @@ +{ + "axes": 9, + "roles": 3, + "operators": { + "H": [ + [ + "D", + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ], + [ + "C", + 1, + 1 + ], + [ + "D", + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + ] + ], + "iI": [ + [ + "phase", + 1 + ] + ] + }, + "program": [ + { + "op": "apply", + "dst": 1, + "symbol": "H" + }, + { + "op": "apply", + "dst": 1, + "symbol": "H" + } + ], + "reference": [ + { + "op": "scale", + "dst": 1, + "coefficient": "i" + } + ] +} diff --git a/research/clifford-pointwise-faithfulness/examples/projection-correct.json b/research/clifford-pointwise-faithfulness/examples/projection-correct.json new file mode 100644 index 0000000000..3892a8d2d0 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/examples/projection-correct.json @@ -0,0 +1,27 @@ +{ + "maps": [ + { + "input_axes": 1, + "output_axes": 1, + "offset": 0, + "basis": [], + "linear": [], + "pairs": [], + "scale": "1/2+1/2i" + }, + { + "input_axes": 1, + "output_axes": 1, + "offset": 0, + "basis": [], + "linear": [], + "pairs": [], + "scale": 1 + } + ], + "coefficients": [ + "1", + "0-1/32i" + ], + "width": 10 +} diff --git a/research/clifford-pointwise-faithfulness/examples/projection-scalar-trap.json b/research/clifford-pointwise-faithfulness/examples/projection-scalar-trap.json new file mode 100644 index 0000000000..5d2518e669 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/examples/projection-scalar-trap.json @@ -0,0 +1,27 @@ +{ + "maps": [ + { + "input_axes": 1, + "output_axes": 1, + "offset": 0, + "basis": [], + "linear": [], + "pairs": [], + "scale": "1/2+1/2i" + }, + { + "input_axes": 1, + "output_axes": 1, + "offset": 0, + "basis": [], + "linear": [], + "pairs": [], + "scale": 1 + } + ], + "coefficients": [ + "1", + "-1/2-1/2i" + ], + "width": 10 +} diff --git a/research/clifford-pointwise-faithfulness/native_pointwise.py b/research/clifford-pointwise-faithfulness/native_pointwise.py new file mode 100644 index 0000000000..75d1df9618 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/native_pointwise.py @@ -0,0 +1,84 @@ +"""Decide a complete native endpoint at one width or at all positive widths. + +Reuse the pinned parser, exact native paths and dirty-role expansion. +The new decision uses projective phase buckets and the pointwise theorem. +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +""" +import argparse +import hashlib +import json +from pathlib import Path +import sys + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import source +import compact +import certify as exact +from bounds import decision_widths, pointwise_bound + + +def projective_buckets(coefficients, paths, inner, width): + representatives, grouped = [], [] + for j, coefficient in enumerate(coefficients): + match = next((i for i, k in enumerate(representatives) + if exact.norm2(inner[k][j]) == 1), None) + if match is None: + representatives.append(j) + grouped.append(coefficient) + else: + phase = inner[representatives[match]][j] + exact.require(exact.power(phase, 4) == 1, "Dyadic Clifford scalar phase") + grouped[match] += coefficient*exact.power(phase, width) + keep = [i for i, value in enumerate(grouped) if value] + indices = [representatives[i] for i in keep] + return ([grouped[i] for i in keep], [paths[j] for j in indices], + [[inner[i][j] for j in indices] for i in indices]) + + +def decide(problem, width=None, *, witness=False): + n = problem.get("axes") + exact.require(type(n) is int and n >= 0, "Nonnegative axis count") + widths = decision_widths(n) if width is None else [width] + for f in widths: + exact.require(type(f) is int and f >= (4*n+4 if n else 1), + "Width is below the proved pointwise threshold") + entries = compact.residuals(problem) + decisions = [] + for f in widths: + lower = pointwise_bound(n, f, clifford=True) + exact.require(lower > 0, "Positive theorem bound") + failures = [] + for output_role, input_role, coefficients, paths, inner in entries: + coefficients, paths, inner = projective_buckets(coefficients, paths, inner, f) + if not coefficients: + continue + mass = sum(exact.norm2(value) for value in coefficients) + energy = exact.energy(coefficients, inner, f) + exact.require(lower*mass <= energy <= (2-lower)*mass, "Pointwise Gram estimate") + failure = {"output_role": output_role, "input_role": input_role, + "projective_terms": len(paths), "coefficient_mass": str(mass), + "normalized_squared_norm": str(energy)} + if witness: + failure["witness"] = compact.entry_witness(coefficients, paths, inner, f) + failures.append(failure) + decisions.append({"width": f, "phase_residue": f % 4, + "gram_lower_bound": str(lower), "equal": not failures, + "failures": failures}) + digest = hashlib.sha256(json.dumps(problem, sort_keys=True, separators=(",", ":")).encode()).hexdigest() + return {"schema": "clifford-pointwise/v1", "problem_sha256": digest, + "axes": n, "scope": "all-positive-widths" if width is None else "specified-width", + "equal": all(row["equal"] for row in decisions), "decisions": decisions} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("problem", type=Path) + parser.add_argument("--width", type=int) + parser.add_argument("--witness", action="store_true") + args = parser.parse_args() + print(json.dumps(decide(json.loads(args.problem.read_text()), args.width, + witness=args.witness), indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/clifford-pointwise-faithfulness/source.py b/research/clifford-pointwise-faithfulness/source.py new file mode 100644 index 0000000000..5f8887bd38 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/source.py @@ -0,0 +1,14 @@ +"""Load the declared, byte-pinned native predecessor modules.""" +import hashlib +import json +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parent.parent +for record in json.loads((HERE / "SOURCES.json").read_text())["files"]: + if record["usage"] == "input": + payload = (ROOT / record["path"]).read_bytes() + if hashlib.sha256(payload).hexdigest() != record["sha256"]: + raise ValueError("Source hash mismatch: "+record["path"]) +sys.path.insert(0, str(HERE.parent / "clifford-tensor-gram")) diff --git a/research/clifford-pointwise-faithfulness/stabilizer.py b/research/clifford-pointwise-faithfulness/stabilizer.py new file mode 100644 index 0000000000..63dd8c4227 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/stabilizer.py @@ -0,0 +1,116 @@ +"""Exact pointwise residuals for affine-quadratic stabilizer maps. + +Map coordinates list the output bits first, then the input bits. Scalars +inside a map are raised to the tensor width. Residual coefficients are not. +The exact quadratic-sum kernel is retained from the pinned predecessor. +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +""" +import argparse +import json +from pathlib import Path +import sys + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import source +from quadratic import Phase, gauss_sum, rank +from certify import G, scalar, norm2, conjugate, power, require +from bounds import pointwise_bound + + +class Map: + def __init__(self, specification): + require(type(specification) is dict and set(specification) == + {"input_axes", "output_axes", "offset", "basis", "linear", "pairs", "scale"}, + "Stabilizer map keys") + self.specification = specification + self.input_axes, self.output_axes = specification["input_axes"], specification["output_axes"] + require(all(type(n) is int and n >= 0 for n in (self.input_axes, self.output_axes)), "Map axes") + self.n = self.input_axes+self.output_axes + self.basis = specification["basis"] + self.offset = specification["offset"] + require(type(self.basis) is list and all(type(b) is int and 0 < b < 1 << self.n + for b in self.basis) and rank(self.basis) == len(self.basis), "Independent support basis") + require(type(self.offset) is int and 0 <= self.offset < 1 << self.n, "Support offset") + k = len(self.basis) + linear, pairs = specification["linear"], specification["pairs"] + require(type(linear) is list and len(linear) == k and + all(type(a) is int and 0 <= a < 4 for a in linear), "Quadratic linear phase") + require(type(pairs) is list and all(type(p) is list and len(p) == 2 and + all(type(j) is int for j in p) and 0 <= p[0] < p[1] < k for p in pairs), "Quadratic pairs") + require(len(set(map(tuple, pairs))) == len(pairs), "Duplicate quadratic pair") + self.scale = scalar(specification["scale"]) + require(bool(self.scale), "A map must be nonzero") + self.phase = Phase(k) + self.phase.linear = linear.copy() + self.phase.cross = set(map(tuple, pairs)) + self.coordinates = [((self.offset >> j) & 1) | + sum(((b >> j) & 1) << (t+1) for t, b in enumerate(self.basis)) + for j in range(self.n)] + + def entry(self, coordinate): + require(type(coordinate) is int and 0 <= coordinate < 1 << self.n, "Map coordinate") + equations = [value ^ ((coordinate >> j) & 1) for j, value in enumerate(self.coordinates)] + return self.scale*gauss_sum(self.phase, equations) + + +def inner(left, right, prefix=()): + require((left.input_axes, left.output_axes) == (right.input_axes, right.output_axes), "Common map type") + require(len(prefix) <= left.n and all(type(b) is int and b in (0, 1) for b in prefix), "Map prefix") + a, b = len(left.basis), len(right.basis) + phase = Phase(a+b) + phase.linear = [(-x) % 4 for x in left.phase.linear]+right.phase.linear + phase.cross = left.phase.cross | {(i+a, j+a) for i, j in right.phase.cross} + shift = lambda mask: (mask & 1) | ((mask >> 1) << (a+1)) + equations = [x ^ shift(y) for x, y in zip(left.coordinates, right.coordinates)] + equations += [left.coordinates[j] ^ bit for j, bit in enumerate(prefix)] + return conjugate(left.scale)*right.scale*gauss_sum(phase, equations) + + +def analyze(specifications, coefficients, width): + require(type(specifications) is list and bool(specifications), "Nonempty map list") + require(type(coefficients) is list and len(specifications) == len(coefficients), "Residual coefficient count") + maps = [Map(item) for item in specifications] + require(all((item.input_axes, item.output_axes) == (maps[0].input_axes, maps[0].output_axes) + for item in maps), "Common map type") + n = maps[0].n + require(type(width) is int and width >= 2*n+6, "Width is below the stabilizer threshold") + values = [scalar(value) for value in coefficients] + gram = [[inner(a, b) for b in maps] for a in maps] + diagonal = [row[j].real for j, row in enumerate(gram)] + require(all(row[j].imag == 0 and diagonal[j] > 0 for j, row in enumerate(gram)), "Positive map norm") + representatives, grouped = [], [] + for j, value in enumerate(values): + match = next((i for i, k in enumerate(representatives) + if norm2(gram[k][j]) == diagonal[k]*diagonal[j]), None) + if match is None: + representatives.append(j) + grouped.append(value) + else: + k = representatives[match] + ratio = gram[k][j]/diagonal[k] + grouped[match] += value*power(ratio, width) + mass = sum(norm2(value)*diagonal[k]**width for k, value in zip(representatives, grouped)) + energy = sum((conjugate(a)*b*power(gram[i][j], width) + for i, a in enumerate(values) for j, b in enumerate(values)), G(0)) + lower = pointwise_bound(n, width) + require(energy.imag == 0 and lower*mass <= energy.real <= (2-lower)*mass, + "Stabilizer pointwise Gram estimate") + return {"schema": "stabilizer-pointwise/v1", "input_axes": maps[0].input_axes, + "output_axes": maps[0].output_axes, "width": width, + "gram_lower_bound": str(lower), "projective_classes": len(representatives), + "coefficient_mass": str(mass), "squared_norm": str(energy.real), + "equal_to_zero": not any(grouped)} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("problem", type=Path) + args = parser.parse_args() + problem = json.loads(args.problem.read_text()) + require(type(problem) is dict and set(problem) == {"maps", "coefficients", "width"}, "Problem keys") + print(json.dumps(analyze(problem["maps"], problem["coefficients"], problem["width"]), + indent=2, sort_keys=True)) + + +if __name__ == "__main__": + main() diff --git a/research/clifford-pointwise-faithfulness/verify.py b/research/clifford-pointwise-faithfulness/verify.py new file mode 100644 index 0000000000..b1744a65cd --- /dev/null +++ b/research/clifford-pointwise-faithfulness/verify.py @@ -0,0 +1,321 @@ +"""Replay exact pointwise-theorem checks. This is not a proof kernel. + +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +""" +import argparse +from copy import deepcopy +from fractions import Fraction as Q +import json +from pathlib import Path +import random +import sys + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import source +import bounds +import census +import native_pointwise +import stabilizer +import certify as exact +import clifford_exact as native +from quadratic import Paths + +G, need = exact.G, census.require + + +def tail_bound(shift, clifford): + denominator, terms = 1, [] + for k in range(1, 6): + denominator *= (1 << k)-1 + terms.append(Q(1, (1 << (shift*k))*denominator)) + value = sum(terms[:4])+terms[4]/(1-Q(1, 63*(1 << shift))) + return value-Q(1, 1 << (shift+1)) if clifford else value + + +def spec_from_state(state, axes, input_axes): + support = [x for x, a in enumerate(state) if a] + offset, basis = support[0], [] + for x in support: + if census.binary_rank(basis+[x ^ offset]) > len(basis): + basis.append(x ^ offset) + need(len(support) == 1 << len(basis), "Complete affine support") + linear = [(state[offset ^ b]-1) % 4 for b in basis] + pairs = [] + for i, a in enumerate(basis): + for j in range(i+1, len(basis)): + value = (state[offset ^ a ^ basis[j]]-1-linear[i]-linear[j]) % 4 + need(value in (0, 2), "Even quadratic cross term") + if value: + pairs.append([i, j]) + return {"input_axes": input_axes, "output_axes": axes-input_axes, + "offset": offset, "basis": basis, "linear": linear, + "pairs": pairs, "scale": 1} + + +def literal_values(state): + return [G.pair(Q(a), Q(b)) for a, b in (census.UNITS[x] for x in state)] + + +def positive_definite(matrix): + """Check Hermitian elimination pivots with exact scalars.""" + a = [row.copy() for row in matrix] + for j in range(len(a)): + pivot = a[j][j] + need(pivot.imag == 0 and pivot.real > 0, "Positive Gram pivot") + for i in range(j+1, len(a)): + for k in range(j+1, len(a)): + a[i][k] -= a[i][j]*a[j][k]/pivot + + +def source_matrix(n, circuit): + op, columns = native.Op(n, native.identity(n), circuit), [] + for column in range(1 << n): + values, denominator = op.zero_state(column) + columns.append([G.pair(Q(a, 1 << denominator), Q(b, 1 << denominator)) for a, b in values]) + return [list(row) for row in zip(*columns)] + + +def literal_column(problem, width, input_role, address): + """Execute one tensor column without the signed-word compiler.""" + n, roles = problem["axes"], problem["roles"] + need(n == 1, "The literal tensor oracle is bounded to one axis") + size = 1 << width + matrices = {name: source_matrix(n, circuit) for name, circuit in problem["operators"].items()} + + def execute(instructions): + values = [[G(0) for _ in range(size)] for _ in range(roles)] + values[input_role][address] = G(1) + for op in instructions: + d, kind = op["dst"], op["op"] + s = op.get("src", d) + if kind == "swap": + values[s], values[d] = values[d], values[s] + continue + if kind == "scale": + values[d] = [G(op["coefficient"])*x for x in values[d]] + continue + image = values[s].copy() + if kind in ("apply", "query"): + matrix = matrices[op["symbol"]] + if op.get("inverse", False): + matrix = exact.adjoint(matrix) + for bit in range(width): + step = 1 << bit + for x in range(size): + if not x & step: + a, b = image[x], image[x | step] + image[x] = matrix[0][0]*a+matrix[0][1]*b + image[x | step] = matrix[1][0]*a+matrix[1][1]*b + if kind == "apply": + values[d] = image + else: + coefficient = G(op.get("coefficient", 1)) + values[d] = [x+coefficient*y for x, y in zip(values[d], image)] + return values + + a, b = execute(problem["program"]), execute(problem["reference"]) + return [[x-y for x, y in zip(row, other)] for row, other in zip(a, b)] + + +def rejected(call, label): + try: + call() + except (ValueError, TypeError, KeyError): + return label + raise ValueError("A negative control was accepted: "+label) + + +def run(): + rng = random.Random(20261024) + state_sets, state_rows = {}, [] + for n in range(5): + states = census.stabilizer_states(n) + state_sets[n] = states + histogram, zeros = census.state_overlap_histogram(states) + expected = bounds.overlap_counts(n) + need(histogram == dict(enumerate(expected)), "Complete stabilizer overlap census") + order = 1 << n + for j in range(1, n+1): + order *= (1 << j)+1 + need(len(states) == order, "Complete stabilizer orbit order") + state_rows.append({"axes": n, "projective_states": order, + "overlap_counts": expected, "zero_overlaps": zeros}) + + clifford_sets, clifford_rows = {}, [] + for n in (1, 2): + states = census.clifford_choi(n) + clifford_sets[n] = states + histogram, zeros = census.choi_overlap_histogram(states, n) + pauli = census.pauli_census(n) + need(len(states) == pauli["projective_order"], "Literal/Pauli group order") + need(histogram == pauli["overlaps"] and zeros == pauli["zero_overlaps"], "Independent Pauli trace census") + need(set(states) <= set(state_sets[2*n]), "Clifford Choi states are stabilizer states") + upper = bounds.overlap_counts(n, clifford=True) + need(histogram[1] == upper[1], "Exact first Clifford overlap level") + need(all(count <= upper[k] for k, count in histogram.items()), "Every Clifford overlap upper bound") + expected_order = 1 << (n*n+2*n) + for j in range(1, n+1): + expected_order *= (1 << (2*j))-1 + need(len(states) == expected_order, "Full projective Clifford order") + clifford_rows.append({"axes": n, **pauli}) + + constants = {"clifford_base": tail_bound(0, True), "stabilizer_base": tail_bound(1, False), + "clifford_plus4": tail_bound(2, True), "clifford_plus12": tail_bound(6, True)} + for name, limit in (("clifford_base", Q(8, 9)), ("stabilizer_base", Q(3, 5)), + ("clifford_plus4", Q(3, 20)), ("clifford_plus12", Q(1, 126))): + need(constants[name] < limit, "Uniform tail: "+name) + bound_checks = 0 + for n in range(1, 65): + for shift, limit in ((0, Q(1, 9)), (2, Q(17, 20)), (6, Q(125, 126))): + lower = bounds.pointwise_bound(n, 4*n+4+2*shift, clifford=True) + need(lower > limit, "Finite Clifford bound") + need(bounds.pointwise_bound(n, 4*n+5+2*shift, clifford=True) == lower, "Odd-width safe bound") + bound_checks += 2 + need(bounds.pointwise_bound(n, 2*n+6) > Q(2, 5), "Finite stabilizer bound") + bound_checks += 1 + + map_checks = pair_checks = prefix_checks = 0 + map_sets = {} + for n in range(4): + maps = [] + for state in state_sets[n]: + op = stabilizer.Map(spec_from_state(state, n, n//2)) + need([op.entry(x) for x in range(1 << n)] == literal_values(state), "Literal affine-quadratic map") + map_checks += 1 << n + maps.append(op) + map_sets[n] = maps + pairs = [(i, j) for i in range(len(maps)) for j in range(len(maps))] if n <= 2 else [ + (rng.randrange(len(maps)), rng.randrange(len(maps))) for _ in range(200)] + for i, j in pairs: + a, b = literal_values(state_sets[n][i]), literal_values(state_sets[n][j]) + expected = sum((exact.conjugate(x)*y for x, y in zip(a, b)), G(0)) + need(stabilizer.inner(maps[i], maps[j]) == expected, "Literal nonunitary Gram entry") + pair_checks += 1 + if i < 4 and j < 4: + for length in range(n+1): + for mask in range(1 << length): + prefix = [(mask >> bit) & 1 for bit in range(length)] + expected = sum((exact.conjugate(a[x])*b[x] for x in range(1 << n) + if x % (1 << length) == mask), G(0)) + need(stabilizer.inner(maps[i], maps[j], prefix) == expected, "Literal prefix Gram entry") + prefix_checks += 1 + + vectors = [literal_values(s) for s in state_sets[1]] + norms = [sum(exact.norm2(x) for x in vector) for vector in vectors] + gram = [[exact.power(sum((exact.conjugate(x)*y for x, y in zip(a, b)), G(0)), 8)/ + (norms[i]*norms[j])**4-G(Q(2, 5) if i == j else 0) + for j, b in enumerate(vectors)] for i, a in enumerate(vectors)] + positive_definite(gram) + vectors = [] + for state in clifford_sets[1]: + weight = sum(bool(x) for x in state[:2]) + divisor = exact.power(G("1+1i"), weight.bit_length()-1) + vectors.append([value/divisor for value in literal_values(state)]) + gram = [[exact.power(sum((exact.conjugate(x)*y for x, y in zip(a, b)), G(0))/2, 8)- + G(Q(1, 9) if i == j else 0) for j, b in enumerate(vectors)] for i, a in enumerate(vectors)] + positive_definite(gram) + + examples = {} + for path in sorted((HERE / "examples").glob("native-*-identity.json")): + result = native_pointwise.decide(json.loads(path.read_text())) + need(result["equal"], "Complete source native relation") + examples[path.name] = result + trap = json.loads((HERE / "examples/native-9-phase-trap.json").read_text()) + result = native_pointwise.decide(trap) + need([row["equal"] for row in result["decisions"]] == [False, True, False, False], "Native/scalar phase residue") + examples["native-9-phase-trap.json"] = result + for residue in range(4): + phase_test = {"axes": 0, "roles": 2, + "operators": {str(j): [["phase", j]] for j in range(4)}, + "program": [{"op": "query", "src": 0, "dst": 1, "symbol": str(j), + "coefficient": str(exact.power(G("0+1i"), (-residue*j) % 4))} + for j in range(4)], "reference": []} + decisions = native_pointwise.decide(phase_test)["decisions"] + need([row["equal"] for row in decisions] == [f % 4 != residue for f in range(1, 5)], + "Every phase residue is necessary") + for name, expected in (("projection-correct", True), ("projection-scalar-trap", False)): + problem = json.loads((HERE / f"examples/{name}.json").read_text()) + result = stabilizer.analyze(problem["maps"], problem["coefficients"], problem["width"]) + need(result["equal_to_zero"] == expected, "Projection scalar inside tensor power") + examples[name+".json"] = result + + native_columns = 0 + for sign in (-1, 1): + op, path = native.cgate(9, 173, sign), Paths(9, [["C", 173, sign]]) + for x in range(512): + vector, denominator = op.zero_state(x) + for y in (x, x ^ 173, x ^ 1): + a, b = vector[y] + need(path.entry(y, x) == G.pair(Q(a, 1 << denominator), Q(b, 1 << denominator)), "Source nine-axis C entry") + native_columns += 1 + + problem = json.loads((HERE / "examples/native-1-identity.json").read_text()) + literal_columns = 0 + for input_role in range(3): + delta = literal_column(problem, 8, input_role, 0) + need(all(not x for row in delta for x in row), "Literal complete dirty endpoint") + literal_columns += 1 + dirty = deepcopy(problem) + dirty["program"].append({"op": "scale", "dst": 2, "coefficient": 0}) + result = native_pointwise.decide(dirty, 8, witness=True) + need(not result["equal"], "Missing arbitrary dirty return rejected") + failure = result["decisions"][0]["failures"][0] + witness = failure["witness"] + address = sum(x << j for j, x in enumerate(witness["input_tuple"])) + output = sum(x << j for j, x in enumerate(witness["output_tuple"])) + delta = literal_column(dirty, 8, failure["input_role"], address) + need(delta[failure["output_role"]][output] == G(witness["discrepancy"]) != 0, "Literal witness without word expansion") + literal_columns += 1 + + residual_checks = 0 + for n in range(1, 4): + width = 2*n+6 + for _ in range(12): + indices = rng.sample(range(len(map_sets[n])), 3) + specifications = [map_sets[n][j].specification for j in indices] + coefficients = [str(rng.choice([-2, -1, 1, 2])) for _ in indices] + need(not stabilizer.analyze(specifications, coefficients, width)["equal_to_zero"], "Independent projective maps cannot cancel") + residual_checks += 1 + + controls = [rejected(lambda: native_pointwise.decide(problem, 7), "unproved width")] + for label, mutation in (("Boolean role", {"dst": True}), ("Nonboolean inverse", {"inverse": 1})): + malformed = deepcopy(problem); malformed["program"][0].update(mutation) + controls.append(rejected(lambda: native_pointwise.decide(malformed), label)) + malformed = deepcopy(problem); malformed["operators"]["H"] = [["C", 1, 0]] + controls.append(rejected(lambda: native_pointwise.decide(malformed), "Invalid native sign")) + base = deepcopy(map_sets[2][-1].specification) + for label, key, value in (("dependent support", "basis", [1, 1]), ("out-of-range offset", "offset", 4), + ("zero native scale", "scale", 0), ("invalid phase", "linear", [4]*len(base["basis"])), + ("invalid phase pair", "pairs", [[0, 0]])): + mutant = deepcopy(base); mutant[key] = value + controls.append(rejected(lambda mutant=mutant: stabilizer.Map(mutant), label)) + controls.append(rejected(lambda: stabilizer.analyze([base], [1], 9), "unproved stabilizer width")) + other = deepcopy(base); other["input_axes"], other["output_axes"] = 0, 2 + controls.append(rejected(lambda: stabilizer.analyze([base, other], [1, 1], 10), "incompatible rectangular types")) + controls.append(rejected(lambda: bounds.row_bound(2, 11), "odd exact row request")) + return {"status": "PASS_POINTWISE_CLIFFORD_AND_STABILIZER_NO_NEW_KAPPA", + "stabilizer_censuses": state_rows, "clifford_censuses": clifford_rows, + "infinite_row_upper_bounds": {key: str(value) for key, value in constants.items()}, + "finite_bound_checks": bound_checks, "literal_map_entries": map_checks, + "literal_pair_inner_products": pair_checks, "literal_prefix_inner_products": prefix_checks, + "exact_positive_Gram_sizes": [6, 24], "source_nine_axis_columns": native_columns, + "literal_complete_tensor_columns": literal_columns, "nonunitary_residual_checks": residual_checks, + "negative_controls": controls, "examples": examples} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write-result", action="store_true") + args = parser.parse_args() + result = json.loads(json.dumps(run())) + path = HERE / "RESULT.json" + if args.write_result: + path.write_text(json.dumps(result, indent=2, sort_keys=True)+"\n") + else: + need(json.loads(path.read_text()) == result, "Complete result receipt") + print(result["status"]) + + +if __name__ == "__main__": + main() diff --git a/research/clifford-pointwise-faithfulness/verify_application.py b/research/clifford-pointwise-faithfulness/verify_application.py new file mode 100644 index 0000000000..eb44300588 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/verify_application.py @@ -0,0 +1,61 @@ +"""Replay the retained passive ceiling and attach the new width bound. + +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +""" +import argparse +from fractions import Fraction +import json +from pathlib import Path +import subprocess +import sys + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE)) +import source +from bounds import pointwise_bound + + +def run(): + command = [sys.executable, "-I"] + if sys.flags.optimize: + command.append("-O") + command += ["-W", "error", "-B", str(HERE.parent / "passive-saved-query-ceiling/verify.py")] + process = subprocess.run(command, capture_output=True, text=True, timeout=150, check=True) + if process.stderr: + raise ValueError("The retained replay emitted diagnostics") + original = json.loads(process.stdout) + expected = json.loads((HERE / "PASSIVE-REPLAY.json").read_text()) + if original != expected: + raise ValueError("The complete retained passive receipt changed") + lower = pointwise_bound(17, 72, clifford=True) + later = pointwise_bound(17, 84, clifford=True) + if not lower > Fraction(1, 9) or not later > Fraction(125, 126): + raise ValueError("The application width bound failed") + return {"status": "PASS_PASSIVE_CEILING_FROM_WIDTH_72_NO_NEW_KAPPA", + "source_replay": original["status"], "ambient_axes": 17, + "first_proved_width": 72, "normalized_squared_error_lower_bound": "1/9", + "operator_norm_error_lower_bound": "1/3", + "finite_gram_lower_at_72": str(lower), + "later_width": 84, "later_squared_error_lower_bound": "125/126", + "finite_gram_lower_at_84": str(later), + "affected_independent_inputs": original["zero_diagonal_inputs"], + "late_grade7_words": original["late_grade7_words"], + "proof_scope": "One frozen passive columnwise Clifford contract; see APPLICATION.md", + "new_kappa": None} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write-result", action="store_true") + args = parser.parse_args() + result = run() + path = HERE / "APPLICATION-RESULT.json" + if args.write_result: + path.write_text(json.dumps(result, indent=2, sort_keys=True)+"\n") + elif result != json.loads(path.read_text()): + raise ValueError("The complete application receipt changed") + print(result["status"]) + + +if __name__ == "__main__": + main() diff --git a/research/clifford-pointwise-faithfulness/verify_repair.py b/research/clifford-pointwise-faithfulness/verify_repair.py new file mode 100644 index 0000000000..d0779fa2c0 --- /dev/null +++ b/research/clifford-pointwise-faithfulness/verify_repair.py @@ -0,0 +1,316 @@ +"""Check the source-bound return floor, approximation examples and invoice. + +Ali Romman, with substantial OpenAI Codex assistance. Apache-2.0. +The general proof is in REPAIR.md. This is not a proof kernel. +""" +import argparse +import contextlib +from fractions import Fraction as Q +import io +import json +from pathlib import Path +import sys + +HERE = Path(__file__).resolve().parent +ROOT = HERE.parent.parent +sys.path.insert(0, str(HERE)) +import source +import bounds +import census +import certify as exact +import verify_application +sys.path.insert(0, str(HERE.parent / "passive-saved-query-ceiling")) +import portable +sys.path.insert(0, str(ROOT / "scripts")) +import compare_recursive_invoices as invoices + +G, need = exact.G, census.require + + +def source_contract(): + application = verify_application.run() + with portable.private_stage() as (stage, requests, _work): + loader = portable.Loader(stage, requests) + stream = io.StringIO() + with contextlib.redirect_stdout(stream): + bank = loader.run(loader.author / "bank_span.py") + need(stream.getvalue().encode() == (loader.author / "BANK-SPAN.json").read_bytes(), + "Exact bank source replay") + a = bank["a"] + target = a.mul(bank["d"], bank["qi"]) + need(bank["targetrows"][0] == [target, {}, {}, {}], "Original first target bank") + mixed = bank["env"] + need(mixed["standard"][0] == [target, {}, {}, {}], "Original mixed target bank") + gate = json.loads((loader.author / "GRADE-GATE.json").read_text()) + ports = gate["actual_source_zero_diagonal_ports"] + need(len(set(ports)) == 104 and ports == sorted(ports), "104 distinct source ports") + independent = json.loads((stage / "INDEPENDENT.json").read_text()) + need(independent["earlier_grades"] == [0, 1] and independent["target_grade"] == 9, + "Disjoint initial and target grades") + need(independent["post_FULL_unselected_grade_census"] == {"7": 5408}, + "Complete late source grades") + need(independent["ownership"]["independent_native_helpers"] == 816, + "Independent helper inputs") + paid, targets = dict(mixed["P"]), dict(mixed["Tar"]) + selected = json.loads((ROOT / "certificates/selected-result.json").read_text()) + saving = Q(selected["kappa"]) + low_t, high_t = mixed["iv"].moment(targets, 1-saving) + low_p, high_p = mixed["iv"].moment(paid, 1-saving) + margin = low_t-high_p, high_t-low_p + need(Q(36) < margin[0] <= margin[1] < Q(37), "Exact reference-tariff budget") + budget = {"reference_saving": str(saving), "tariff_exponent": str(1-saving), + "source": "Pinned selected value used only as a reference tariff", + "margin_interval": list(map(str, margin)), + "margin_decimal_enclosure": mixed["iv"].display(margin), + "max_rank_one_returns_with_positive_margin": 36} + return application, ports, paid, targets, budget + + +def invoice(paid, targets): + return {"schema": invoices.SCHEMA, + "contract": {"model": "PR4948 frozen mixed word with extra same-capacity paid returns", + "rank_semantics": "One positive-rank recursive job returns one field", + "ambient_rank": 17, + "boundary": "Original 448 main targets and 816 autonomous helper credits; unchanged frozen paid inputs"}, + "paid": {str(k): v for k, v in sorted(paid.items())}, + "targets": {str(k): v for k, v in sorted(targets.items())}} + + +def cost_certificate(paid, targets, count): + paid = dict(paid) + paid[1] = paid.get(1, 0) + count + actual = invoice(paid, targets) + result = invoices.compare_invoices(invoice({}, {}), actual) + direct = [{"rank": k, "value": sum(v*min(r, k) for r, v in paid.items()) + - sum(v*min(r, k) for r, v in targets.items())} + for k in [0]+sorted(set(paid) | set(targets))] + need(result["hinges"] == direct, "Independent direct hinge calculation") + return actual, result + + +def small_group(): + matrices = [] + for state in census.clifford_choi(1): + denominator = G("1+i") if sum(bool(x) for x in state[:2]) == 2 else G(1) + matrices.append(tuple(tuple(G.pair(*map(Q, census.UNITS[state[i+2*j]]))/denominator + for j in range(2)) for i in range(2))) + + def projective(matrix): + first = next(z for row in matrix for z in row if z) + return exact.key(tuple(tuple(z/first for z in row) for row in matrix)) + + index = {projective(a): j for j, a in enumerate(matrices)} + need(len(index) == 24, "Complete one-axis projective group") + products = {} + for i, a in enumerate(matrices): + need(exact.multiply(exact.adjoint(a), a) == exact.identity(2), "Unitary representative") + for j, b in enumerate(matrices): + product = exact.multiply(a, b) + k = index[projective(product)] + phase = next(product[x][y]/matrices[k][x][y] for x in range(2) + for y in range(2) if matrices[k][x][y]) + need(phase in [G(1), G(-1), G("i"), G("-i")], "Exact central phase") + need(product == tuple(tuple(phase*z for z in row) for row in matrices[k]), + "Literal product including phase") + products[i, j] = k, phase + ordinary = [i for i, a in enumerate(matrices) if sum(bool(z) for row in a for z in row) == 2] + identity = index[projective(exact.identity(2))] + target = next(i for i in range(24) if i not in ordinary) + need(len(ordinary) == 8, "Complete one-axis monomial subgroup") + need(all(products[i, j][0] in ordinary for i in ordinary for j in ordinary), + "Ordinary group closure") + return matrices, products, ordinary, identity, target + + +def add(x, y, scale=G(1)): + result = dict(x) + for k, value in y.items(): + result[k] = result.get(k, G(0)) + scale*value + if not result[k]: + del result[k] + return result + + +def basis(rows): + pivots = {} + for row in rows: + row = dict(row) + while row: + k = min(row) + if k in pivots: + row = add(row, pivots[k], -row[k]) + else: + pivots[k] = {j: v/row[k] for j, v in row.items()} + break + return list(pivots.values()) + + +def action(g, row, products, width): + result = {} + for (column, word), value in row.items(): + new_word, phase = products[g, word] + result[column, new_word] = value*exact.power(phase, width) + return result + + +def orbit(rows, ordinary, products, width): + return [action(g, row, products, width) for row in rows for g in ordinary] + + +def gram(matrices, width): + return [[exact.power(sum((exact.conjugate(a[i][j])*b[i][j] + for i in range(2) for j in range(2)), G(0))/2, width) + for b in matrices] for a in matrices] + + +def inner(x, y, kernel): + return sum((exact.conjugate(a)*b*kernel[i][j] + for (c, i), a in x.items() for (d, j), b in y.items() if c == d), G(0)) + + +def projection_error(history, targets, kernel): + """Eliminate the history block from the physical Gram matrix.""" + rows = basis(history) + targets + size = len(rows)-len(targets) + matrix = [[inner(x, y, kernel) for y in rows] for x in rows] + for k in range(size): + pivot = matrix[k][k] + need(pivot.imag == 0 and pivot.real > 0, "Physical history Gram pivot") + for i in range(k+1, len(rows)): + for j in range(k+1, len(rows)): + matrix[i][j] -= matrix[i][k]*matrix[k][j]/pivot + result = sum((matrix[k][k] for k in range(size, len(rows))), G(0)) + need(result.imag == 0 and result.real >= 0, "Physical least-squares error") + return result.real + + +def finite_checks(): + matrices, products, ordinary, identity, target = small_group() + sources = [{(j, identity): G(1)} for j in range(3)] + targets = [{(j, target): G(1)} for j in range(3)] + counts = {"group_products": len(products), "phase_covariances": 0, + "history_prefixes": 0, "physical_approximation_cases": 0} + errors = [] + for width in range(8, 12): + kernel = gram(matrices, width) + for h in ordinary: + for i in range(24): + for j in range(24): + image_i = action(h, {(0, i): G(1)}, products, width) + image_j = action(h, {(0, j): G(1)}, products, width) + need(inner(image_i, image_j, kernel) == kernel[i][j], "Tensor phase covariance") + counts["phase_covariances"] += 1 + initial = orbit(sources, ordinary, products, width) + desired = orbit(targets, ordinary, products, width) + need(len(basis(initial)) == 24 and len(basis(initial+desired)) == 48, + "Full target quotient dimension") + for cached in range(4): + old = initial+desired[:8*cached] + need(len(basis(old+desired))-len(basis(old)) == 8*(3-cached), + "Correctly cached targets remove charges") + stale = initial+orbit([{(3, target): G(1)}], ordinary, products, width) + need(len(basis(stale+desired))-len(basis(stale)) == 24, "Wrong input version gives no credit") + for mode in ("direct", "mixed", "feedback"): + history, previous = list(initial), {} + for q in range(4): + dim = len(basis(history)) + need(dim <= 24+8*q, "One return adds at most one ordinary module") + if q < 3: + need(len(basis(history+desired)) > dim, "Too few returns cannot complete targets") + if mode == "direct" and q == 3: + need(len(basis(history+desired)) == dim, "Direct oracle attains isolated count") + counts["history_prefixes"] += 1 + if mode == "mixed" and q < 3: + error = projection_error(history, targets, kernel) + need(error >= bounds.pointwise_bound(1, width, clifford=True)*(3-q), + "Projected-frame approximation bound") + errors.append({"width": width, "returns": q, "squared_error": str(error)}) + counts["physical_approximation_cases"] += 1 + if q == 3: + continue + if mode == "direct": + new = targets[q] + elif mode == "mixed": + new = {} + for j, row in enumerate(targets): + new = add(new, row, G((j+1)**q)) + else: + new = add(targets[q], action(target, previous, products, width)) + new = add(new, sources[(q+1) % 3], G("i")) + previous = new + history += orbit([new], ordinary, products, width) + + # Two singular target rows need only one paid return. Row count alone fails. + width = 8 + z_matrix = ((G(1), G(0)), (G(0), G(-1))) + z = next(i for i, a in enumerate(matrices) if a == z_matrix) + positive = add({(0, identity): G(Q(1, 2))}, {(0, z): G(Q(1, 2))}) + negative = add({(1, identity): G(Q(1, 2))}, {(1, z): G(-Q(1, 2))}) + one_return = orbit([add(positive, negative)], ordinary, products, width) + singular = orbit([positive, negative], ordinary, products, width) + need(len(basis(one_return)) == len(basis(one_return+singular)) == 8, + "Complementary idempotents share one return") + need(len(basis(orbit([positive], ordinary, products, width))) == 4, + "A singular target need not generate the full algebra") + + # At width one, monomial matrices span every two-by-two matrix. + literal = [{(0, k): z for k, z in enumerate(sum((list(row) for row in a), [])) if z} + for a in matrices] + low = [literal[i] for i in ordinary] + need(len(basis(low)) == len(basis(low+[literal[target]])) == 4, + "Width-one physical counterexample to formal independence") + counts["controls"] = ["cached targets", "wrong input version", "complementary idempotents", + "small-width physical dependence", "arbitrary feedback rows"] + return counts, errors + + +def run(write=False): + application, ports, paid, targets, budget = source_contract() + actual, cost = cost_certificate(paid, targets, len(ports)) + need([row["value"] for row in cost["hinges"]] == + [0, 5996, 7134, 7448, 6742, 5838, 3870, 2900, 1800, 8], "Complete repair invoice hinges") + need(cost["classification"] == "uniformly_worse", "All concave tariffs are adverse") + need(sum(k*v for k, v in targets.items())-sum(k*v for k, v in paid.items()) == 96, + "Original rank-mass allowance") + for q in (0, 95, 96, 97, 103, 104): + _, control = cost_certificate(paid, targets, q) + need(control["hinges"][-1]["value"] == q-96, "Rank-mass price threshold") + if q < 96: + need(control["classification"] == "inconclusive", "Missing repair charge is not uniform failure") + else: + need(control["classification"] == "uniformly_worse", "No positive margin with 96 returns") + missing = len(ports)-budget["max_rank_one_returns_with_positive_margin"] + budget["operator_error_squared_from_width_72"] = str(Q(missing, 9*len(ports))) + budget["operator_error_squared_from_width_84"] = str(Q(125*missing, 126*len(ports))) + counts, errors = finite_checks() + result = {"status": "PASS_104_RETURN_FLOOR_ERROR_TRADEOFF_AND_ADVERSE_REPAIR_INVOICE", + "proof": "REPAIR.md; finite tests are not a proof kernel", + "source_replay": application["source_replay"], + "source_ports": ports, "new_returns_required": len(ports), + "first_width": 72, "squared_error_per_missing_return": "1/9", + "later_width": 84, "later_squared_error_per_missing_return": "125/126", + "operator_error_squared_at_103_returns_and_width_84": "125/13104", + "max_returns_for_any_positive_concave_power_margin": 95, + "any_profitable_repair_operator_error_squared_from_width_72": "1/104", + "any_profitable_repair_operator_error_squared_from_width_84": "125/1456", + "reference_tariff_budget": budget, + "optimistic_invoice_comparison": cost, "finite_checks": counts, + "physical_approximation_errors": errors, "new_kappa": None} + for name, value in (("REPAIR-INVOICE.json", actual), ("REPAIR-RESULT.json", result)): + path = HERE / name + if write: + path.write_text(json.dumps(value, indent=2, sort_keys=True)+"\n") + else: + need(value == json.loads(path.read_text()), "Complete repair receipt: "+name) + return result + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--write-result", action="store_true") + args = parser.parse_args() + print(run(args.write_result)["status"]) + + +if __name__ == "__main__": + main()