From e58335bd7ffe55e23f071295b61332b80261d90e Mon Sep 17 00:00:00 2001 From: Ruge Lin Date: Wed, 28 Oct 2026 20:25:18 +0800 Subject: [PATCH 1/2] Build a six-T field decoder and reduce the complete four-address indicator --- WORKSPACE.md | 22 +- docs/reference/VERIFICATION_CATALOGUE.md | 2 + research/README.md | 3 +- research/ROUTE_DECISIONS.md | 2 + .../depth/ENCODED_DIRTY_COPY_INTERFACE.md | 5 + research/depth/FIELD_COPY_CLIFFORD_PILOT.md | 4 + research/depth/FIELD_SHEAR_INTERTWINER.md | 5 + research/depth/FLAT_FIELD_BANK_PILOT.md | 438 ++++++++++++++++++ research/depth/NATIVE_COPY_INTERACTION.md | 200 +++++++- tests/test_flat_field_bank_duals.py | 247 ++++++++++ tests/test_flat_field_bank_native.py | 220 +++++++++ tests/test_seed_fingerprint.py | 174 +++++++ 12 files changed, 1307 insertions(+), 15 deletions(-) create mode 100644 research/depth/FLAT_FIELD_BANK_PILOT.md create mode 100644 tests/test_flat_field_bank_duals.py create mode 100644 tests/test_flat_field_bank_native.py create mode 100644 tests/test_seed_fingerprint.py diff --git a/WORKSPACE.md b/WORKSPACE.md index 0837d89..dd05eaa 100644 --- a/WORKSPACE.md +++ b/WORKSPACE.md @@ -11,9 +11,9 @@ Manuscript drafting and the changed-decoder supplement are separate tasks. ## Current checkpoint -Verified baseline: [PR #266](https://github.com/GoGoKo699/Hopf-Frame-Compilation/pull/266), -`2217955f3c0149d80917b5edf88939f9f655098e`, 28 October 2026. -Its reviewed tree passed 2,009 tests locally and in both CI versions, plus the full gate and presentation checks. +Verified baseline: [PR #267](https://github.com/GoGoKo699/Hopf-Frame-Compilation/pull/267), +`68f0ce342bf105e4b3aa3b1a7c5d76c3f579998b`, 28 October 2026. +Its reviewed tree passed 2,020 tests locally and in both CI versions, plus the full gate and presentation checks. Fetch current main; this baseline is not a pin. Exact-tree receipts belong in the PR record. Read the [resource frontier](docs/OPEN_PROBLEM.md) for general theorems, @@ -123,9 +123,9 @@ requires strong cross-commutators on every independent address pair; monomial query-eigenbasis seeds have a half-error floor. The full-Hadamard field seed passes the mixing test but still has a half-error spectral floor. -The [four-address pilot](research/depth/FIELD_COPY_CLIFFORD_PILOT.md) pays -the seed, copy and inverses: 288 T gates, at most 96 bands and seven dirty -wires. Its cheaper query gives the direct decoder 300 T, 160 bands and three dirty wires. +The [flat-seed four-address pilot](research/depth/FLAT_FIELD_BANK_PILOT.md) has a six-T, +three-band decoder and a complete 72-T, 28-band indicator with three dirty wires. +Its full intertwiner has a Clifford completion; no uniform decoder is yet paid. The [Clifford-seed bounds](research/depth/CLIFFORD_SEED_COPY_STRUCTURE.md) give error at least 1/64 for p at least seven for projectively involutive seeds with commuting symplectic orbits, even for an arbitrary copy. For p at least nine, every Clifford seed has one-band @@ -139,11 +139,11 @@ and full copy error at least $`1/\sqrt6`$ for every unitary seed. This family is The [Clifford-dual grading](research/depth/CLIFFORD_DUAL_COPY_GRADING.md) requires each output dual's symplectic orbit group to have binary abelianization rank at least $`m-p-1`$ exactly. An odd-order pair gives an explicit robust word obstruction. -**Next question:** construct changed joint walls with this grading and a genuinely -non-Clifford $`R=VPV^\dagger`$, then solve the full carrier equations. Two-band V -and a one-band copy would give at most 42 indicator bands; this remains conditional. -Price every inverse and common budget. Empty kernels reject exact instances; -approximation needs quantitative certificates. The [whole-table alternative](research/depth/TABLE_SPECIFIC_INDICATOR_INTERFACES.md#5-what-this-changes-and-what-it-leaves-unpaid) remains unpaid. +The [seed fingerprint](research/depth/NATIVE_COPY_INTERACTION.md#seed-coefficient-rigidity) +excludes product THT-dagger seeds below 3/32 for every one-band field copy at p at least two. +**Next question:** extend the flat decoder uniformly, allowing the complete probe's +commutant freedom, with sublogarithmic depth and polynomial discovery budgets. +The joint seed/copy alternative remains open; two-band V and one-band C would give 42 bands conditionally. The [four-band Clifford front end](research/depth/CLIFFORD_INVOLUTION_SOURCE.md), [weighted outer-phase route](research/depth/JOINT_ADDRESS_HELPER_SOURCE.md), diff --git a/docs/reference/VERIFICATION_CATALOGUE.md b/docs/reference/VERIFICATION_CATALOGUE.md index b26e25a..db36419 100644 --- a/docs/reference/VERIFICATION_CATALOGUE.md +++ b/docs/reference/VERIFICATION_CATALOGUE.md @@ -281,6 +281,8 @@ without an extra native fixture. | Non-Clifford copy-axis span | [Proof](../../research/depth/COPY_AXIS_SPAN.md), [exact fixtures](../../tests/test_copy_axis_span.py) | Exhaustive small affine-map quotient counts and full-matrix noncommuting rotations test the span argument, including interference and mixed X/Z axes. The all-size norm bound is analytic and does not lower-bound growing depth | | Monomial query seed | [Proof](../../research/depth/MONOMIAL_QUERY_SEED_OBSTRUCTION.md), [exact fixtures](../../tests/test_monomial_query_seed_obstruction.py) | Non-Hermitian phases, shifted planes, Fourier field queries and arbitrary helper mixing check the alternating word. A nonmonomial escape guards the hypothesis. Rational/native commutator fixtures and an exact order-three Hadamard pilot check the stronger mixing requirement and its insufficiency. All-size floors are analytic; escape alone supplies no source | | Finite Clifford field copy | [Proof](../../research/depth/FIELD_COPY_CLIFFORD_PILOT.md), [algebra fixtures](../../tests/test_field_copy_clifford_pilot.py), [native fixtures](../../tests/test_field_copy_clifford_native.py) | Exact seed and central-sector algebra; all sector-controlled native factors and actual inverses; all 16 output-X copy sectors; every principal/dirty query column and the finite ledgers. The copy indicator has 288 T gates, 96 bands and seven dirty wires; reusing the improved query in the direct decoder gives 300 T, 160 bands and three dirty wires. Both assembled native directions are checked; neither is an all-size compiler | +| Flat field bank and six-T decoder | [Proof](../../research/depth/FLAT_FIELD_BANK_PILOT.md), [native fixtures](../../tests/test_flat_field_bank_native.py), [dual and completion fixtures](../../tests/test_flat_field_bank_duals.py) | Exact flat seed, full commuting-bank grading, three physical decoder bands, literal copy action, full intertwiner completion and actual inverses. All 512 direct-indicator columns retain arbitrary address, output and dirty-mask inputs and literal phases. The 72-T, 28-band, 350-gate finite word uses three returned dirty wires. Exact signed-support enumeration proves no Clifford singleton dual; its gap is scoped to this seed. No uniform compiler or minimum-cost claim | +| Seed coefficient and fingerprint rigidity | [Proof](../../research/depth/NATIVE_COPY_INTERACTION.md#seed-coefficient-rigidity), [exact fixtures](../../tests/test_seed_fingerprint.py) | Exact Pauli correlation levels, helper subgroup preservation, paired-axis normalizers, literal one-cell Clifford overlaps and affine scalar words challenge the analytic rigidity proof. Unique maxima give a coefficient-gap floor; product THT-dagger seeds give 3/32 independently of width, under Clifford output duals and arbitrary fixed Clifford embedding. Flat seeds and unrestricted copies are outside that product theorem | | Clifford seed copy structure | [Proof](../../research/depth/CLIFFORD_SEED_COPY_STRUCTURE.md), [nested-cube fixtures](../../tests/test_clifford_seed_copy_structure.py), [one-band fixtures](../../tests/test_one_band_clifford_seed.py) | Degree inflation, literal scalar phases and a complete 128-address field word support the commuting-orbit theorem. Exact signed affine-axis and modulo-four phase checks support the separate one-band theorem for every Clifford seed: error at least $`\sin(\pi/8)`$ for p at least nine. The analytic rigidity and degree-eight proof permit arbitrary dirty width and joint Clifford walls; non-Clifford seeds and general copies remain outside that second theorem | | Clifford output-dual grading | [Proof](../../research/depth/CLIFFORD_DUAL_COPY_GRADING.md), [exact fixtures](../../tests/test_clifford_dual_copy_grading.py) | Regular-module annihilators, Pauli-kernel transport and literal relation-word checks support the necessary symplectic-group quotient. Each exact one-band output dual needs binary abelianization rank at least $`m-p-1`$, for arbitrary unitary seeds. Quantitative gaps require explicit bounded words; the group-rank bound itself is exact and does not exclude every one-band copy | | Reduced pair-register gauge | [Proof](../../research/depth/COHERENT_CENTRAL_TRANSPORT.md#reduced-carrier-gauge), [exact fixtures](../../tests/test_reduced_pair_gauge.py) | Arbitrary pair/carrier action, helper-free native pair factors and root completion, interpolation and a nonrepresentation gauge check the complete probe. The low-row degree constraint is analytic and gauge-specific; no shallow joint schedule follows | diff --git a/research/README.md b/research/README.md index 47fa193..13b4f70 100644 --- a/research/README.md +++ b/research/README.md @@ -191,13 +191,14 @@ These are complete interfaces and conditional transfers, not constructions of th - [Table-specific probes and the remaining joint-word freedom](depth/TABLE_SPECIFIC_INDICATOR_INTERFACES.md) - [Encoded dirty copy without a synthesized decoder](depth/ENCODED_DIRTY_COPY_INTERFACE.md) — jointly paid carrier/copy interactions supply a physical indicator; an address-independent Clifford copy has a uniform error floor for one field-query orbit - [Exact dirty copying as a parity grading](depth/DIRTY_COPY_GRADING.md) — a complete criterion for arbitrary unitary families, robust word tests, field-pair rigidity and a noncommuting all-size calibration -- [Native copy interactions and dual readout](depth/NATIVE_COPY_INTERACTION.md) — paid non-Clifford components, an extensive copy T-count floor, and exact support screens for specified product-magic and coded families +- [Native copy interactions and dual readout](depth/NATIVE_COPY_INTERACTION.md) — paid components, extensive copy T count, support screens, and a width-independent 3/32 floor for product THT-dagger seeds with Clifford output duals - [Complete one-band copy feasibility](depth/ONE_BAND_COPY_FEASIBILITY.md) — signed Walsh support spaces and spectra, the exact carrier fixed-point criterion, and a native triple-axis joint-wall family with zero complete seed space and a $`1/\sqrt6`$ copy-error floor despite passing the tensor screen - [Clifford output-dual grading](depth/CLIFFORD_DUAL_COPY_GRADING.md) — every exact one-band copy, even with an arbitrary unitary seed, requires an extensive binary abelianization of each dual's symplectic orbit group; explicit relation words give robust certificates - [Affine Pauli-orbit copy screen](depth/PAULI_ORBIT_COPY_SCREEN.md) — a one-quarter error floor with Clifford dual probes, the native one-bit endpoint and the paid dirty-mask gauge - [Extensive non-Clifford copy-axis span](depth/COPY_AXIS_SPAN.md) — quotient-sector weight gives a robust output-axis and T-count requirement, with no growing depth conclusion - [Monomial query-seed copy obstruction](depth/MONOMIAL_QUERY_SEED_OBSTRUCTION.md) — commuting original and seed-conjugated query algebras force a four-word identity and copy error at least one half, even with an arbitrary physical copy - [Four-address Clifford seed and physical copy](depth/FIELD_COPY_CLIFFORD_PILOT.md) — a noncommuting central-sector grading, a paid native copy and a complete 288-T, 96-band finite indicator with seven arbitrary dirty wires +- [Flat-seed field bank and six-T decoder](depth/FLAT_FIELD_BANK_PILOT.md) — a genuinely non-Clifford graded four-address bank, a three-band decoder with a full Clifford intertwiner completion, and a complete 72-T, 28-band indicator with three returned dirty wires; no all-size depth improvement - [Clifford seed copy structure](depth/CLIFFORD_SEED_COPY_STRUCTURE.md) — projectively involutive seeds with commuting symplectic orbits have a 1/64 field-copy floor at p at least seven for arbitrary copies; every Clifford seed has a $`\sin(\pi/8)`$ floor at p at least nine when the copy has one physical T band - [Joint bank routing and the complete dirty indicator](depth/JOINT_ROUTING_INDICATOR_INTERFACES.md) diff --git a/research/ROUTE_DECISIONS.md b/research/ROUTE_DECISIONS.md index 9f55278..d00d601 100644 --- a/research/ROUTE_DECISIONS.md +++ b/research/ROUTE_DECISIONS.md @@ -25,6 +25,8 @@ Start with a complete interface; consult component families only when the propos | [Localized non-Clifford copy repair](depth/COPY_AXIS_SPAN.md) | A one-shear orbit requires at least $`m-p-1`$ independent physical-X directions in the copy rotation-axis span exactly, and an extensive span at constant error below square root two. | This span bound alone does not exclude a broad one-band copy; pay it jointly with the seed. This is a count/span screen, not a growing depth obstruction. | | [Monomial seed in query eigen-coordinates](depth/MONOMIAL_QUERY_SEED_OBSTRUCTION.md) | Copy error is at least one half for p at least two, even for arbitrary non-Clifford copies. The broader screen is commutation of original and seed-conjugated query algebras. | Break that algebra condition with genuine eigenspace mixing and certify the complete copy. Nonlinear reversible permutations or phases in the same query eigenbasis do not suffice. The all-Hadamard field seed passes the quantitative mixing test but still has a half-error floor from an order-three orbit-pair product. | | [Finite Clifford field copy](depth/FIELD_COPY_CLIFFORD_PILOT.md) | A noncommuting four-address Clifford orbit has a central-sector grading and a paid physical copy. Its indicator uses 288 T gates, at most 96 bands and seven arbitrary dirty wires. The same cheaper query improves the direct decoder to 300 T, 160 bands and three dirty wires; the copy's depth gain costs more workspace and total gates. | Use its explicit sector-control construction as a component, not an all-size compiler. Its Pauli-valued commutators fall under the eventual obstruction below. | +| [Flat field bank and shallow finite decoder](depth/FLAT_FIELD_BANK_PILOT.md) | A genuinely non-Clifford four-address seed has full commuting-bank grading. A six-T three-band decoder yields a 12-T six-band complete copy and a cheaper direct indicator with 72 T gates, at most 28 bands, 350 total gates and three returned dirty wires. A separate Clifford completion makes the decoder a full field intertwiner. The same seed has one-band copy error at least $`1/(2\sqrt2)`$. | Extend the decoder uniformly within the polynomial discovery budgets and sublogarithmic depth, allowing the complete probe's commutant freedom. A full intertwiner below error one needs axis pairing rank at least $`m-2`$ on the query-fixed Pauli space; disjoint cells retaining all their core-fixed controls fail. This rank condition does not constrain the weaker one-probe decoder. The finite words establish no asymptotic bound or minimum cost. | +| [Seed coefficient and fingerprint rigidity](depth/NATIVE_COPY_INTERACTION.md#seed-coefficient-rigidity) | A unique largest Pauli magnitude with gap g forces field-copy error at least g/2 for p at least two when a selected output dual is Clifford. Product THT-dagger seeds have the width-independent floor 3/32, even after an arbitrary Clifford embedding and with arbitrary identity helpers. | For a one-band copy, change the product seed and remove its distinguished Pauli witness; degeneracy alone is insufficient. Deeper copies with non-Clifford duals remain eligible, as the paid flat-bank pilot illustrates. This is a seed/readout restriction, not an all-two-band-seed or unrestricted-copy theorem. | | [Clifford seed copy structure](depth/CLIFFORD_SEED_COPY_STRUCTURE.md) | A projectively involutive Clifford seed with commuting symplectic orbit has field-copy error at least 1/64 for p at least seven, for an arbitrary copy. With one physical copy band, every Clifford seed has error at least $`\sin(\pi/8)`$ for p at least nine; no orbit commutation or seed-order assumption is needed. | A one-band field copy needs a genuinely non-Clifford seed at sufficiently small error. In $`R=VPV^\dagger`$, V must therefore use at least two T bands. A Clifford-seed route needs more copy bands and must still leave the older commuting-orbit class. Neither condition supplies a construction. | | [Clifford output-dual grading](depth/CLIFFORD_DUAL_COPY_GRADING.md) | Every exact one-band copy induces a copyable Clifford orbit at each physical output dual, even for an arbitrary unitary seed. Its symplectic orbit group needs elementary binary abelianization rank at least $`m-p-1`$ for the field query. Explicit symplectic relation words yield quantitative scalar-word tests; the rank bound alone has no uniform approximate gap. | Design a dual group that retains the required address grades, then satisfy the complete carrier equations and synthesize the seed. Noncommuting symplectic generators alone are insufficient. An odd-order orbit-pair product already gives a robust obstruction for p at least three, with its certified order in the denominator. | | [Projector-Gram readout](depth/NILPOTENT_PENCIL_OBSERVABLE_SOURCE.md#paired-projector-readout) | Four-call recovery and serial promotion are paid: complete error $`64\sqrt\delta`$ for one clean signal, $`128\sqrt\delta`$ for two jointly accepted signals. The six-call block-error alternative remains. | A normalized native Gram source, allowing arbitrary accepted private fibers; actual source synthesis remains essential. | diff --git a/research/depth/ENCODED_DIRTY_COPY_INTERFACE.md b/research/depth/ENCODED_DIRTY_COPY_INTERFACE.md index 0ea6693..5a73d49 100644 --- a/research/depth/ENCODED_DIRTY_COPY_INTERFACE.md +++ b/research/depth/ENCODED_DIRTY_COPY_INTERFACE.md @@ -273,6 +273,11 @@ at p at least seven, a projectively involutive Clifford seed with commuting symplectic orbit actions has copy error at least 1/64, even with arbitrary C. The all-size task remains a jointly paid pair satisfying (2) within (4). +The later [flat four-address bank](FLAT_FIELD_BANK_PILOT.md) supplies a +genuinely non-Clifford seed, a 12-T six-band physical copy, and a cheaper +direct indicator through its six-T three-band decoder. Extending that +complete probe decoder uniformly is another concrete route; its finite +word does not settle either all-size interface. For a Clifford seed, noncommuting symplectic dynamics are therefore necessary at arbitrarily small fixed error; non-Clifford seeds are another possibility. The complete dual readout, native inverse and every arbitrary-input sector diff --git a/research/depth/FIELD_COPY_CLIFFORD_PILOT.md b/research/depth/FIELD_COPY_CLIFFORD_PILOT.md index 2df0af7..4fefe62 100644 --- a/research/depth/FIELD_COPY_CLIFFORD_PILOT.md +++ b/research/depth/FIELD_COPY_CLIFFORD_PILOT.md @@ -15,6 +15,10 @@ not exclude every Clifford seed at this address size. This is a finite complete-operator pilot. Its four addresses do not give an all-size source or improve the general frame-depth frontier. +The later [flat-seed pilot](FLAT_FIELD_BANK_PILOT.md) gives a different +commuting bank and a cheaper 72-T, 28-band direct indicator with three +dirty wires. The noncommuting central-sector construction here remains +a distinct algebraic and native calibration. ## 1. The physical seed and query diff --git a/research/depth/FIELD_SHEAR_INTERTWINER.md b/research/depth/FIELD_SHEAR_INTERTWINER.md index b0175d0..4b9afa3 100644 --- a/research/depth/FIELD_SHEAR_INTERTWINER.md +++ b/research/depth/FIELD_SHEAR_INTERTWINER.md @@ -303,6 +303,11 @@ does not compile that change into native gates. ## 6. A paid four-wire decoder for two address bits +The later [flat-bank decoder](FLAT_FIELD_BANK_PILOT.md) supplies a different +six-T, three-band full intertwiner at this size. The construction below +retains its punctured-coordinate mechanism and exact native fixtures; +neither finite word establishes an all-size shallow decoder. + There is also a native p=2 decoder, independent of the canonical eigenbasis choice in (17). It uses only the four bank wires. The following construction explains its full action, including the zero diff --git a/research/depth/FLAT_FIELD_BANK_PILOT.md b/research/depth/FLAT_FIELD_BANK_PILOT.md new file mode 100644 index 0000000..3cc389c --- /dev/null +++ b/research/depth/FLAT_FIELD_BANK_PILOT.md @@ -0,0 +1,438 @@ +# A flat non-Clifford field bank with a three-band decoder + +[Field query](FIELD_SHEAR_INTERTWINER.md) · +[Complete copy grading](DIRTY_COPY_GRADING.md) · +[Encoded copy contract](ENCODED_DIRTY_COPY_INTERFACE.md) · +[Earlier Clifford-seed pilot](FIELD_COPY_CLIFFORD_PILOT.md) + +The two-bit field query admits an independent commuting bank of four +genuinely non-Clifford reflections. Its seed has a three-T, two-band +preparation. A six-T, three-band decoder maps the complete bank to +physical Paulis, giving a twelve-T, six-band copy. Used directly on the +physical output bank, the decoder gives an exact four-address indicator +with **72 T gates, 28 T bands, 350 total gates and three returned dirty +wires**. Every principal and helper input is arbitrary. All T-band counts +are upper bounds from the displayed schedules; no minimal-depth claim is made. + +A further Clifford wall completes the same six T gates to a full +field-to-wire-translation intertwiner. This is a finite construction, +not an all-size compiler or a new general frame-depth bound. The seed +also has a one-band copy error floor of $`1/(2\sqrt2)`$: the successful +readout lies outside that narrower grammar. + +## 1. Physical coordinates and a native flat seed + +Use four carrier wires $`(0,1,2,3)=(u_0,u_1,v_0,v_1)`$. Address labels +0,1,2,3 are binary, with addition by XOR. The retained field query is + +```math +Q_x|u,v\rangle=|u,v+M_xu\rangle,\qquad +M_0=0,\quad M_1=I,\quad +M_2=\begin{pmatrix}0&1\\1&1\end{pmatrix},\quad M_3=M_1+M_2. +``` + +For a Hermitian Pauli P, retain the native scalar in +$`T(P)=\exp(i\pi(I-P)/8)`$. On two wires put + +```math +R_*=(X_0+Y_0+Z_0X_1-Z_0Z_1)/2,\qquad +V_*=T(X_0X_1)T(Y_0Z_1)T(Z_0). + \qquad(1) +``` + +The four signed Pauli summands anticommute pairwise, so $`R_*^2=I`$. +Direct conjugation gives $`R_*=V_*X_0V_*^\dagger`$. The outer two +rotation axes commute and are independent. A native Clifford U that +maps $`Z_0,Z_1`$ to those axes is the chronological word + +```text +U: H(1), CX(1,0), S(0), S(0), S(0), H(0), H(1). +``` + +Thus $`V_*`$ has the chronological word +$`T(0),U^\dagger,[T(0),T(1)],U`$. The bracket denotes one physical +T band on distinct wires. Reducing the three reversed S gates modulo +four gives 15 total gates in either direction, with three T gates in +two bands, two arbitrary wires and no helpers. + +The seed is not Clifford. The inner Clifford +$`T(Z_0)X_0T(Z_0)^\dagger=(X_0+Y_0)/\sqrt2`$ sends the outer +axis $`X_0X_1`$ to $`Y_0X_1`$, which is neither outer axis. +The [exact one-band axis-matching theorem](ONE_BAND_AXIS_MATCHING.md) +therefore excludes a Clifford result for the outer conjugation. + +Embed the two-wire preparation on the first two field wires and apply +the following fixed chronological Clifford F: + +```text +S(1), H(0), H(1), CX(0,2), S(2), S(0), CX(1,0), +H(2), S(0), CX(2,0), H(2), S(2), H(1). +``` + +Then $`V=FV_*`$ prepares the seed + +```math +R=VX_0V^\dagger + =(Z_0X_1Y_2+Z_0Z_2-Y_0Z_1Z_2-Y_0Y_1Z_2)/2. \qquad(2) +``` + +Its preparation has three T gates in two bands, with 28 total forward +gates and 38 in the actual inverse after expanding S-dagger. No state +is initialized. This is a preparation ledger; an emitted R also pays +the preparation's actual inverse and the central Pauli. + +For concise exact tables, use the Hermitian Pauli convention + +```math +P_{a+16b}=i^{\mathrm{wt}(a\mathbin\&b)}X^aZ^b, +\qquad a,b\in\mathbb F_2^4. +``` + +The complete field orbit $`R_x=Q_xRQ_x^\dagger`$ is: + +| Address x | $`2R_x`$ | +| --- | --- | +| 0 | $`P_{86}+P_{80}-P_{113}-P_{115}`$ | +| 1 | $`P_{78}+P_{64}-P_{101}-P_{111}`$ | +| 2 | $`P_{122}+P_{112}-P_{89}-P_{87}`$ | +| 3 | $`P_{98}+P_{96}-P_{77}+P_{75}`$ | + +These signs follow from literal field CNOT conjugation of (2). An independent +non-Clifford certificate is +$`RX_1R=(-P_{37}-P_{39}+P_{35}-P_{33})/2`$, which is not a Pauli. +The decoder below proves their complete commuting-bank structure; +pairwise orthogonality alone would not do so. + +## 2. Six rotations decode the entire bank + +Let D be the chronological product of the following three bands: + +```math +[T(P_{33}),T(P_{41})],\qquad +[T(P_2),T(P_{14})],\qquad +[T(P_{35}),T(P_{39})]. \qquad(3) +``` + +Each pair is commuting and independent. For a literal physical +implementation, the following chronological Clifford words map the +specified single-wire Z axes to the corresponding pair: + +| Band | Clifford $`K_i`$ | Native T wires | +| --- | --- | --- | +| 1 | $`\mathrm{CX}(0,3),H(0),H(3),H(1),\mathrm{CX}(0,1),H(1)`$ | 0,3 | +| 2 | $`\mathrm{CX}(1,2),H(1),H(2),\mathrm{CX}(2,3)`$ | 1,2 | +| 3 | $`\mathrm{CX}(1,2),H(1),S(1),\mathrm{CX}(1,0),H(2)`$ | 1,2 | + +Emit $`K_i^\dagger,[T,T],K_i`$ for each row, in order. With +S-dagger expanded into three S gates, D and its actual inverse each +have six T gates, three physical bands and 38 total gates. There are +four arbitrary wires and no private helper. + +Applying the exact rule +$`T(A)PT(A)^\dagger=(P-iAP)/\sqrt2`$ when A anticommutes with P, +and leaving P unchanged otherwise, gives + +```math +DR_0D^\dagger=-P_{113},\quad +DR_1D^\dagger=P_{64},\quad +DR_2D^\dagger=-P_{89},\quad +DR_3D^\dagger=P_{96}. \qquad(4) +``` + +Call the four signed Paulis on the right $`B_0,\ldots,B_3`$. +They commute and their binary labels are independent. Every nonempty +subset product is therefore a nonidentity Pauli and has trace zero. +Conjugating back proves the same facts for the $`R_x`$, including +$`R_0R_1R_2R_3=X_3`$. Their sixteen joint sign projectors have rank +one. Every word reduces to a subset product, so the full +[copy-grading criterion](DIRTY_COPY_GRADING.md#1-the-exact-full-space-criterion) +holds for every word length and order. + +### The three-band word is a coherent Clifford selection + +There is a small algebra behind (3). Put +$`A=X_0Z_1`$, $`B=X_1`$, $`C=X_0Y_1=-iAB`$. +The pairs in (3) are $`(A,AX_3)`$, $`(B,BX_2X_3)`$ and +$`(C,CX_2)`$. The control Paulis $`X_2,X_3`$ commute with A,B,C. +For $`L=\pm1`$ in a control sector, + +```math +T(A)T(AL)=e^{i\pi/4} +\begin{cases} +e^{-i\pi A/4},&L=+1,\\ +I,&L=-1. +\end{cases} \qquad(5) +``` + +Writing $`S_A=e^{-i\pi A/4}`$, the Pauli algebra gives +$`S_CS_BS_A=S_B`$. Up to the one common scalar $`e^{3i\pi/4}`$, +D therefore selects $`S_B`$ when the two control signs agree, +$`S_C`$ for $`(X_2,X_3)=(+1,-1)`$, and $`S_A`$ for +$`(-1,+1)`$. This is a complete coherent operation on the control +sectors, not a promise about their inputs or a measurement. + +## 3. A physical bank decoder and complete copy + +The following chronological Clifford L maps $`B_j`$ to $`Z_j`$ +with literal positive signs: + +```text +S(0), S(0), S(0), H(0), CX(1,0), CX(2,0), +H(0), S(0), S(0), H(0), +CX(1,2), CX(2,1), CX(1,2), H(3), +CX(0,2), CX(3,2), CX(0,3), CX(1,3), CX(2,3). +``` + +It has 19 forward gates and 17 in its actual inverse. The complete +bank decoder $`E=LD`$ consequently obeys + +```math +ER_jE^\dagger=Z_j,\qquad +T(E)=6,\quad D_T(E)\le3,\quad +G_{\rm all}(E)=57,\quad G_{\rm all}(E^\dagger)=55. \qquad(6) +``` + +On a separate arbitrary four-qubit output bank Y, let +$`C_Z=\prod_jH_j\mathrm{CX}(j;Y_j)H_j`$, so that +$`C_ZZ_jC_Z^\dagger=Z_jX_{Y_j}`$. The chronological copy word +$`E,C_Z,E^\dagger`$ is +$`C=(E^\dagger\otimes I_Y)C_Z(E\otimes I_Y)`$ and satisfies + +```math +C(R_j\otimes I_Y)C^\dagger=R_j\otimes X_{Y_j}. \qquad(7) +``` + +Both directions use twelve T gates, six bands and 124 total gates on +the four carrier and four output wires. There are no extra helpers or +initialized inputs. The actual reversed native word is used even +though the ideal copy is an involution. Equation (7) includes the full +carrier action, not only the output dual signatures, and therefore +supplies complete return in the +[encoded-copy echo](ENCODED_DIRTY_COPY_INTERFACE.md#1-cancel-an-encoding-only-on-the-returned-dirty-carrier). + +## 4. The cheaper direct four-address indicator + +This commuting bank permits using E directly on the physical output +register. Put $`S_x=EQ_xE^\dagger`$. Equations (2) and (6) imply + +```math +S_xZ_0S_x^\dagger=Z_x. \qquad(8) +``` + +Only (8) is needed for this implementation; the stronger full +intertwinement in the next section uses a different Clifford suffix. +For the coherent $`S=\sum_x|x\rangle\langle x|\otimes S_x`$, +the chronological word + +```math +H_Y,\quad S^\dagger,\quad Z_{Y_0},\quad S,\quad H_Y \qquad(9) +``` + +is exactly $`|x,Y,h\rangle\mapsto|x,Y\mathbin\oplus e_x,h\rangle`$. +The retained [three-cube query](FIELD_COPY_CLIFFORD_PILOT.md#4-three-cube-coherent-query-and-the-complete-indicator) +has 24 T gates, eight bands, 58 total gates and three arbitrary +returned masks. Its actual inverse has the same bounds. Use physical +address wires 0,1, output wires 2 through 5 and masks 6 through 8. +Lift E to the four output wires; its word introduces no other work. + +There are four E/adjoint appearances and two query appearances in +(9). Including the eight output Hadamards and the two-S implementation +of Z gives, in either direction, + +```math +T_I=4\cdot6+2\cdot24=72,\qquad +D_T(I)\le4\cdot3+2\cdot8=28, +``` +```math +G_{\rm all}(I)=2(57+55)+2\cdot58+8+2=350, +\qquad w=9,\quad b_{\rm dirty}=3,\quad a_{\rm clean}=0. \qquad(10) +``` + +The component equalities prove the full operator identity on every +coherent address, output, mask and external reference. Exact native +execution of all 512 basis columns in both directions separately +checks allocation, chronology, literal phases and return. This +improves the retained finite direct-decoder ledger of 300 T gates, +160 bands and 892 total gates using the same three masks. It is not +an optimality claim about the four-address problem. + +## 5. The same six T gates also give a full intertwiner + +Let $`Q'_x=DQ_xD^\dagger`$. Exact conjugation of the eight physical +Pauli generators shows that every $`Q'_x`$ is Clifford. A complementary +orbit of signed Paulis is + +```math +C_0=P_{240},\quad C_1=P_{198},\quad C_2=P_{224},\quad C_3=P_{218}, +\qquad Q'_xC_yQ_x'^\dagger=C_{x+y}. \qquad(11) +``` + +The C's commute, and $`B_jC_k=(-1)^{[j=k]}C_kB_j`$. They therefore +complete the B's to a Pauli basis. After L, the chronological suffix + +```text +J: S(1)-dagger, S(3), H(3), CX(0,3), CX(2,3), H(3) +``` + +fixes every $`Z_j`$ and maps $`LC_jL^\dagger`$ to $`X_j`$. +Expand S-dagger into three S gates. This adds eight gates in either +direction. Hence +$`E_{\rm full}=JLD`$ has six T gates in at most three bands and 65 forward +or 63 inverse total gates, on the same four arbitrary wires. + +Both B and C are permuted by $`Q'_x`$ with exactly the XOR action. +Thus $`E_{\rm full}Q_xE_{\rm full}^\dagger`$ has the same +conjugation on every physical X and Z as the wire translation $`W_x`$. +The two operators differ by a scalar only. For nonzero x both have +trace four, by the field character and the two-swap character; +the scalar is therefore one. At x=0 both are identity. This proves +the complete literal identity + +```math +E_{\rm full}Q_xE_{\rm full}^\dagger=W_x +\qquad(x=0,1,2,3). \qquad(12) +``` + +The finite native fixture also verifies (12) on all sixteen columns +for all four addresses and checks the actual inverse. No gauge or +unknown global phase is omitted. The shorter E in (6) remains the +word used for the cheaper ledger (10). + +## 6. A one-band copy cannot read this seed accurately + +For this finite seed, no Clifford J can implement any one of the four +singleton sign patterns + +```math +JR_xJ^\dagger=(-1)^{[x=j]}R_x\qquad(x=0,1,2,3). \qquad(13) +``` + +Here is a complete finite verification specification. Each R has four +distinct Pauli labels with coefficient magnitude one half. A Clifford +satisfying (13) must permute its four support labels, with the signs +fixed by its coefficient signs and the requested singleton. There are +24 permutations per address. Extend these candidates one address at +a time, retaining only assignments that preserve all binary label +relations, symplectic pairings and literal Pauli multiplication, with injectivity on the support span. + +For the ordered section $`P(a,b)=X^aZ^b`$, multiplication contributes +$`2b\cdot a'`$ modulo four. If a source Hermitian label v maps to w, +the prescribed ordered-section phase is + +```math +2(s_x+c_v+c_w)+\mathrm{wt}(a_w\mathbin\&b_w) + -\mathrm{wt}(a_v\mathbin\&b_v)\pmod4, \qquad(14) +``` + +where $`s_x=[x=j]`$ and the c's record the two coefficient signs. +Exact subgroup closure with this multiplication law checks every induced +relation in the seven-dimensional union of the support spans. For +each singleton, the surviving restricted maps after addresses 0,1,2,3 +number exactly $`24,8,4,0`$. This exhausts all possible Clifford +actions on the supported Paulis. The identity sign pattern has four +surviving maps, providing a positive consistency check. Additional +identity helpers cannot repair the contradictory relations: each +supported Pauli still has to map to the specified carrier-only support. + +There is a quantitative consequence. Two distinct four-term Pauli expansions +whose coefficients all have magnitude one half have Hilbert--Schmidt inner product at most +$`3/4`$. Their normalized Hilbert--Schmidt distance, and hence their +operator distance, is at least $`1/\sqrt2`$. If a copy has complete +error eta, an output dual $`J=C^\dagger Z_{Y_j}C`$ obeys + +```math +\|J(R_x\otimes I)J^\dagger-(-1)^{[x=j]}R_x\otimes I\| +\le2\eta. +``` + +When J is Clifford and $`2\eta<1/\sqrt2`$, every one of these four +relations must therefore be exact, contradicting the enumeration. +Every one-band native copy has Clifford Pauli output duals, so + +```math +\eta_{\rm copy}\ge\frac1{2\sqrt2}. \qquad(15) +``` + +This bound concerns the seed (2) in its stated field coordinates and +arbitrary identity helpers. It does not exclude other flat seeds, +other embeddings, two-band copies or the six-band copy above. + +The [native fixtures](../../tests/test_flat_field_bank_native.py) preserve +the preparation, decoder, copy, direct indicator and actual inverse words. +The [grading and dual fixtures](../../tests/test_flat_field_bank_duals.py) +retain the exact support-map enumeration, literal multiplication phases, +all subset traces and the full-intertwiner checks. + +## 7. Scope and the next construction obligation + +The construction pays an entire compatible finite bank and its +physical readout. It avoids using a nonzero linear kernel or a +collection of output duals as a substitute for a complete carrier +identity. The earlier noncommuting Clifford pilot remains a distinct +graded algebra; its proofs and native words are preserved in their +own home. + +The next substantive task is an all-size analogue of the coherent +selection in (5), jointly with its field orbit and full copy or +decoder. A proposed extension must prove the complete grading and +operator identities, emit actual forward and reverse native words, +and meet the common count, width and precision budgets. Recursing +through independently paid field recouplers retains a depth cost at +every level; the +[recursive-decoder limitation](RECURSIVE_FIELD_SHEAR_DECODER.md#4-what-remains-to-be-compiled-and-what-the-recursion-costs) +still applies. The finite six-T identity does not supply that missing +uniform construction, and R96 remains unchanged. + + + +### A necessary test for extending the full intertwiner + +For the all-size field query on m core wires and h identity helpers, +let $`\mathcal F`$ be its common fixed Pauli-label space. It consists +of the $`Z_u,X_v`$ labels and all helper Paulis, so +$`\dim\mathcal F=m+2h`$. Absorb the Clifford walls of a proposed +native full intertwiner into +$`E=L\prod_jT_{\epsilon_j}(P_j)`$, and let A span its absorbed +Pauli rotation axes. The complete error is + +```math +\eta=\max_x\|EQ_xE^\dagger-W_x\otimes I_h\|. +``` + +If $`\eta<1`$, then + +```math +\mathrm{rank}\bigl(\langle\ ,\ \rangle|_{A\times\mathcal F}\bigr) +\ge m-2,\qquad T(E)\ge m-2. \qquad(16) +``` + +To prove this, every label in $`\mathcal F\cap A^\perp`$ supplies +a Pauli fixed literally by all source queries and commuting with +every rotation. Its image under E is therefore the Pauli supplied +by L alone. It is fixed by every $`EQ_xE^\dagger`$, so its distance +from its conjugate under $`W_x\otimes I_h`$ is at most $`2\eta`$. +An involutive wire permutation sends every Pauli to a commuting +Pauli: in binary labels the relevant symplectic pairing vanishes +because the permutation matrix is symmetric. Any two unequal +commuting Hermitian Paulis have operator distance two, including +opposite signs. Thus the image is fixed exactly when $`\eta<1`$. + +The common target fixed-label space consists of $`X_{\rm all}`$, +$`Z_{\rm all}`$ and helper Paulis, of dimension $`2+2h`$. +Injectivity of L gives +$`\dim(\mathcal F\cap A^\perp)\le2+2h`$, proving (16). +This is an extensive count and axis-rank requirement, not a growing +T-depth bound. It concerns full intertwinement; the weaker one-probe +decoder contract in (8) does not impose it. + +For example, the two control Paulis of each disjoint copy of the +four-wire gadget (3) commute with all its axes. A direct tensor +extension that leaves these controls inside the original core-fixed +space $`\mathrm{span}\{Z_u,X_v\}`$, with untouched identity helpers, +retains at least $`m/2+2h`$ such directions. For $`m>4`$ it +fails the full-intertwiner test below error one. An extension must +change that alignment or couple the cells. This does not reject +arbitrary three-band designs or a weaker probe-only construction. The +[fixed-Pauli fixture](../../tests/test_flat_field_bank_duals.py) checks +the two-control kernel, a failed eight-wire disjoint extension and +the target Pauli-distance premise exactly. diff --git a/research/depth/NATIVE_COPY_INTERACTION.md b/research/depth/NATIVE_COPY_INTERACTION.md index ce24cf6..93a3309 100644 --- a/research/depth/NATIVE_COPY_INTERACTION.md +++ b/research/depth/NATIVE_COPY_INTERACTION.md @@ -10,7 +10,9 @@ $`THT^\dagger`$ has a two-T, one-band copy interaction with no helpers. That observation does not supply a compatible all-size field-orbit seed. This chapter gives an extensive T-count floor for arbitrary copies, a dual-readout rank test, and exact failures of two concrete product -constructions. The unrestricted one-band field-copy problem remains open. +constructions. Sections 7--8 add a Pauli-coefficient test and a uniform +error floor for an extensively supported product seed with arbitrary +Clifford embedding, for copies with a Clifford output dual. The unrestricted one-band field-copy problem remains open. The [complete one-band feasibility reduction](ONE_BAND_COPY_FEASIBILITY.md) gives exact affine Walsh support spaces, their spectrum and the remaining @@ -335,11 +337,203 @@ does not extend that all-size theorem to repeated query cores. The [native fixtures](../../tests/test_native_copy_interaction.py) retain this exact finite calculation, native checks of its signed label conventions, the full one-band component and inverse, and a small -complete coded-copy/dual fixture. The analytic all-size statements -are Sections 1--5. +complete coded-copy/dual fixture. Their associated analytic all-size +statements are Sections 1--5. The remaining constructive target is a native interaction whose carrier/output mixing or carrier phase axes escape these specific support restrictions, jointly with a compatible seed. The extensive T-count floor permits such a construction within the discovery count budget; its complete action and depth still have to be paid. + + + + +## 7. A unique largest Pauli coefficient obstructs Clifford-dual copies + +The next two screens concern the seed, allowing arbitrary joint Clifford +walls in the copy. Suppose a selected physical output dual +$`J=C^\dagger Z_{Y_t}C`$ is Clifford. Every one-band native copy has +this property, as established in the +[dual reduction](CLIFFORD_DUAL_COPY_GRADING.md#1-one-output-dual-gives-an-independently-graded-clifford-orbit). +For a copy with complete error eta, that reduction also gives the direct form + +```math +\|J(R_x\otimes I_Y)J^\dagger + -(-1)^{[x=t]}(R_x\otimes I_Y)\|\le2\eta. \qquad(14) +``` + +Expand the Hermitian seed in the Hermitian Pauli section, +$`R=\sum_v r_v\tau(v)`$. Suppose its largest absolute coefficient +is unique, at label $`v_*`$, and write + +```math +a=|r_{v_*}|,\qquad b=\max_{v\ne v_*}|r_v|,\qquad g=a-b>0. +``` + +Include zero coefficients in this maximum. For any Clifford U and +$`s\in\{1,-1\}`$, the inequality +$`\|URU^\dagger-sR\|\lt g`$ forces +$`U\tau(v_*)U^\dagger=s\tau(v_*)`$. +If the largest label moved elsewhere, the coefficient discrepancy at +its image would be at least a-b. If it stayed at that label with the +wrong sign, the discrepancy would be 2a. An individual Pauli coefficient +is bounded by normalized Hilbert--Schmidt norm, which is bounded by +operator norm. This argument does not require rigidity of the whole seed. + +Every queried seed has the same unique maximum, at the literal signed +Pauli $`P_x=Q_x\tau(v_*)Q_x^\dagger`$. Thus $`\eta\lt g/2`$ +would force + +```math +JP_xJ^\dagger=(-1)^{[x=t]}P_x\quad\text{for every }x. \qquad(15) +``` + +For the field query and $`p\ge2`$, choose two independent address +directions and their four-address affine plane through t. The xor of +its four labels is zero, because the field symplectic action is affine. +The ordered product of the four literal Paulis is therefore a nonzero +scalar times identity. Conjugating by J must fix that scalar, while +(15) negates it because t occurs once. Consequently + +```math +\eta\ge\frac{a-b}{2}\qquad(p\ge2). \qquad(16) +``` + +This includes arbitrary identity helpers and fixed Clifford embeddings: +neither changes the coefficient magnitudes. A single Clifford output +dual at t suffices. Exact copying is excluded whenever the maximum is +unique, however small its gap. Uniqueness alone gives no uniform +approximation floor as the width grows. + +More generally, (16) holds for a Clifford query whose symplectic entries +have Boolean degree at most d when $`p\ge d+1`$. Use an affine cube +with d+1 independent directions through t. Its label xor is the vanishing +finite difference, so its ordered Pauli product is again scalar. +Literal phases are retained; the proof never assumes that scalar is +1. +This extension needs no additive query law beyond the stated degree. + + + +## 8. Product A seeds have a uniform Clifford-dual gap + +Consider the extensive native component + +```math +R=A^{\otimes w}\otimes I_h,\qquad +A=THT^\dagger=X/2+Y/2+Z/\sqrt2,\qquad w\ge1. +``` + +An arbitrary fixed Clifford embedding of all active and helper wires +is allowed. Its +[two-band preparation and actual inverse](NONCLIFFORD_SEED_SPREAD.md#an-extensive-seed-with-a-paid-two-band-source) +are already paid. The following bound concerns every copy with the +selected Clifford output dual in (14), including every one-band copy: + +```math +\eta\ge\frac3{32}\qquad\text{for the field query and }p\ge2. + \qquad(17) +``` + +The constant is independent of w, the helper count, and the fixed +embedding. It does not apply to an arbitrary two-band seed or to a +deeper copy whose relevant output dual is non-Clifford. + +### A Pauli fingerprint fixes the active pairs + +Work first before the fixed embedding. Let $`\tau_0`$ denote normalized +trace, and for a Hermitian Pauli P define + +```math +q_R(P)=\tau_0(RPRP). +``` + +On an active wire its values on I,X,Y,Z are respectively +$`1,-1/2,-1/2,0`$; every helper factor contributes one. Hence the +product value is zero if an active Z occurs, and otherwise equals +$`(-1/2)^k`$, where k counts active X/Y factors. In particular, +q equals one exactly on the full helper Pauli subgroup H. Its value +$`-1/2`$ occurs exactly on one active X or Y times any helper Pauli. +The latter level is separated from every other possible value by at +least $`3/8`$; the level one is separated by at least $`3/4`$. + +Suppose a Clifford U and a sign s satisfy +$`\delta=\|URU^\dagger-sR\|\lt3/16`$. Telescoping the two R +factors gives + +```math +|q_R(U^\dagger P U)-q_R(P)|\le2\delta\lt3/8. \qquad(18) +``` + +The binary symplectic action therefore preserves H and the +$`-1/2`$ level exactly. The helper label space H is nondegenerate, +so its orthogonal complement, the active Pauli space, is preserved too. +No active image can acquire a helper attachment. Inside this complement +the $`-1/2`$ labels are exactly $`X_i,Y_i`$. Their only nonzero +pairings are $`\langle X_i,Y_i\rangle=1`$. Thus U permutes the +active paired planes and, within each plane, sends X,Y to signed X,Y, +possibly swapped. Its helper action may be any Clifford. + +### Every remaining nonexact signed action has a constant gap + +On one active pair write the X,Y image signs as epsilon,zeta. The literal +relation $`Z=-iXY`$ fixes the Z sign as their product without a swap, +and as minus their product with a swap. The exact cell overlap is + +```math +\tau_0(AUAU^\dagger)= +\begin{cases} +(\epsilon+\zeta)/4+\epsilon\zeta/2,&\text{without a swap},\\ +(\epsilon+\zeta)/4-\epsilon\zeta/2,&\text{with a swap}. +\end{cases} \qquad(19) +``` + +Its possible values are $`1,-1,1/2,-1/2,0`$. The full overlap factors, +since permuting identical A cells leaves R unchanged. It is either +plus or minus one, giving an exact signed symmetry, or has absolute +value at most one half. In the latter case, the normalized +Hilbert--Schmidt distance from either signed target is at least one. +This contradicts the assumed operator error below $`3/16`$. Therefore + +```math +\|URU^\dagger-sR\|\lt3/16 +\quad\Longrightarrow\quad URU^\dagger=sR. \qquad(20) +``` + +Conjugating U back through a fixed outer Clifford proves the same +rigidity for every allowed embedding, including one mixing active and +helper wires. No physical fingerprint measurement is being supplied; +q is only a mathematical invariant used in the proof. + +The unique largest coefficient of R is at +$`Z_1\cdots Z_w\otimes I_h`$, with magnitude $`2^{-w/2}`$. +Every other magnitude is at most $`1/\sqrt2`$ times that value. +If the copy error were below $`3/32`$, (14) and (20) would force exact +signed symmetry at every address, and hence exact signed transport of +this unique Pauli. Section 7's scalar-plane contradiction proves (17). +For a degree-d Clifford query the same argument gives (17) when +$`p\ge d+1`$. + +For an actual unitary seed and query within operator distances epsilon +and delta of this ideal class, while retaining a Clifford output dual, +full-operator telescoping gives the stable form + +```math +\eta_{\rm actual}+2\epsilon+4\delta\ge3/32. \qquad(21) +``` + +These are distances to the specified class; small commutators do not +by themselves establish them. + +The [exact fingerprint fixtures](../../tests/test_seed_fingerprint.py) +check native Pauli values with an arbitrary helper, all 720 two-wire +symplectic actions, all 24 literal one-cell Cliffords and their signed +overlap values, and scalar four-address products with literal phases. +The analytic arguments above establish the all-size scope. + +For $`p\ge2`$, a seed eligible for exact field copying with Clifford +output duals must therefore have a degenerate largest Pauli magnitude. The +[flat field-bank pilot](FLAT_FIELD_BANK_PILOT.md) supplies a finite +non-Clifford alternative with equal coefficient magnitudes and complete +abstract grading. It requires its own paid decoder and copy; degeneracy +alone does not give the singleton dual symmetries or carrier return. diff --git a/tests/test_flat_field_bank_duals.py b/tests/test_flat_field_bank_duals.py new file mode 100644 index 0000000..3e2fbcd --- /dev/null +++ b/tests/test_flat_field_bank_duals.py @@ -0,0 +1,247 @@ +"""Exact grading and Clifford-dual checks for the four-address flat bank. + +This finite native pilot is not an all-size field compiler. Literal Pauli +phases are retained in every word and every partial Clifford homomorphism. +""" +from fractions import Fraction +from itertools import permutations +import unittest + +from tests.exact_matrices import CI, CO, CQ2, CZ, adjoint, native_columns +from tests.test_flat_field_bank_native import ( + AXES, ORBIT, TARGET, full_intertwiner, ledger, +) +from tests.test_field_copy_clifford_native import _fixed_query +from tests.test_joint_lookup_pauli_source import _inverse + + +def _pairing(left, right, width): + mask = (1 << width) - 1 + return (((left & mask) & (right >> width)).bit_count() + + ((left >> width) & (right & mask)).bit_count()) % 2 + + +def _hermitian_phase(label, width): + return ((label & ((1 << width) - 1)) & (label >> width)).bit_count() + + +def _ordered_phase(left, right, width): + # P(x,z)=X^x Z^z, without an implicit quotient by scalar phase. + return 2 * ((left >> width) & (right & ((1 << width) - 1))).bit_count() + + +def _multiply_pauli_expansions(left, right, width=4): + result = {} + for a, coefficient in left.items(): + for b, other in right.items(): + exponent = (_hermitian_phase(a, width) + _hermitian_phase(b, width) + - _hermitian_phase(a ^ b, width) + + _ordered_phase(a, b, width)) % 4 + value = coefficient * other * (CO, CI, -CO, -CI)[exponent] + label = a ^ b + result[label] = result.get(label, CZ) + value + return {label: value for label, value in result.items() if value != CZ} + + +def _extend_clifford_map(mapping, source, target, phase, width): + """Extend a map on the entire generated Pauli-label subgroup. + + mapping[v]=(k,w) means P(v) maps to i^k P(w), for the ordered XZ + section. Storing the complete small subgroup makes every dependency + explicit, independently of a choice of elimination pivots. + """ + phase %= 4 + if source in mapping: + return mapping if mapping[source] == (phase, target) else None + if any(_pairing(a, source, width) != _pairing(b, target, width) + for a, (_, b) in mapping.items()): + return None + extended = dict(mapping) + for a, (alpha, b) in mapping.items(): + image = ((alpha + phase + _ordered_phase(b, target, width) + - _ordered_phase(a, source, width)) % 4, b ^ target) + label = a ^ source + if label in extended and extended[label] != image: + return None + extended[label] = image + if len({b for _, b in extended.values()}) != len(extended): + return None + return extended + + +def _signed_supports(width=4): + result = [] + for operator in ORBIT: + row = {} + for label, coefficient in operator.items(): + lifted = (label & 15) | ((label >> 4) << width) + # Every coefficient is exactly +/-1/2, with no sqrt(2) part. + assert coefficient.b == 0 and abs(coefficient.a) == Fraction(1, 2) + row[lifted] = int(coefficient.a < 0) + result.append(row) + return result + + +def _clifford_characters(mask, width=4): + states = [{0: (0, 0)}] + counts = [] + for address, support in enumerate(_signed_supports(width)): + labels = sorted(support) + next_states = {} + for mapping in states: + for permutation in permutations(labels): + current = mapping + for source, target in zip(labels, permutation): + sign = ((mask >> address) & 1) ^ support[source] ^ support[target] + phase = (2 * sign + _hermitian_phase(target, width) + - _hermitian_phase(source, width)) + current = _extend_clifford_map( + current, source, target, phase, width) + if current is None: + break + if current is not None: + next_states[tuple(sorted(current.items()))] = current + states = list(next_states.values()) + counts.append(len(states)) + return states, counts + + +def _wire_translation(address): + word = [] + for left in range(4): + right = left ^ address + if left < right: + word += [('CX', left, right), ('CX', right, left), ('CX', left, right)] + return word + + +class FlatFieldBankDualTests(unittest.TestCase): + def test_complete_commuting_grading_and_literal_full_product(self): + orbit = [{label: CQ2(value) for label, value in operator.items()} + for operator in ORBIT] + for i, left in enumerate(orbit): + self.assertEqual(_multiply_pauli_expansions(left, left), {0: CO}) + for right in orbit[i + 1:]: + self.assertEqual(_multiply_pauli_expansions(left, right), + _multiply_pauli_expansions(right, left)) + # A literal Pauli image with four nonzero terms certifies that + # the seed itself is genuinely non-Clifford. + image = _multiply_pauli_expansions( + _multiply_pauli_expansions(orbit[0], {2: CO}), orbit[0]) + self.assertEqual(image, {37: -CO * Fraction(1, 2), + 39: -CO * Fraction(1, 2), + 35: CO * Fraction(1, 2), + 33: -CO * Fraction(1, 2)}) + for mask in range(1, 16): + product = {0: CO} + for address, operator in enumerate(orbit): + if (mask >> address) & 1: + product = _multiply_pauli_expansions(product, operator) + self.assertNotIn(0, product) + if mask == 15: + self.assertEqual(product, {8: CO}) # +X_v1, not -X_v1. + # The exact simultaneous Pauli images are a full virtual bank. + labels = [next(iter(operator)) for operator in TARGET] + span = {0} + for label in labels: + span |= {value ^ label for value in tuple(span)} + self.assertEqual(len(span), 16) + + def test_every_clifford_sign_character_and_singleton_rejection(self): + for mask in range(16): + states, counts = _clifford_characters(mask) + self.assertEqual(counts[:3], [24, 8, 4]) + self.assertEqual(len(states), 0 if mask.bit_count() % 2 else 4) + for mapping in states: + self.assertEqual(len(mapping), 128) # Seven independent labels. + if mask in (1, 2, 4, 8): + self.assertEqual(counts, [24, 8, 4, 0]) + + def test_literal_phase_constraint_and_identity_helper_stability(self): + # Identity on X and Z fixes Y. A projective-only mapper would + # incorrectly accept the negative-Y image below. + mapping = _extend_clifford_map({0: (0, 0)}, 1, 1, 0, 1) + mapping = _extend_clifford_map(mapping, 2, 2, 0, 1) + self.assertIsNotNone(_extend_clifford_map(mapping, 3, 3, 0, 1)) + self.assertIsNone(_extend_clifford_map(mapping, 3, 3, 2, 1)) + for width in (5, 7): + states, counts = _clifford_characters(1, width) + self.assertEqual(states, []) + self.assertEqual(counts, [24, 8, 4, 0]) + # For arbitrary identity helpers, exact flat support matching + # forces every supported input label to a carrier-only label. + # The same seven-dimensional phase contradiction therefore persists. + + def test_literal_full_intertwiner_on_every_column_and_actual_inverse(self): + word = full_intertwiner() + forward = native_columns(4, word) + self.assertEqual(native_columns(4, _inverse(word)), adjoint(forward)) + for address in range(4): + actual = native_columns(4, _inverse(word) + _fixed_query(address) + word) + self.assertEqual(actual, native_columns(4, _wire_translation(address))) + self.assertEqual(ledger(word), (6, 3, 65, 4)) + self.assertEqual(ledger(_inverse(word)), (6, 3, 63, 4)) + + def test_fixed_pauli_axis_rank_and_disjoint_cell_failure(self): + def rank(rows): + pivots = {} + for value in rows: + while value: + bit = value.bit_length() - 1 + if bit not in pivots: + pivots[bit] = value + break + value ^= pivots[bit] + return len(pivots) + + def relabel(label, placement, width): + x, z = label & 15, label >> 4 + return (sum(1 << placement[j] for j in range(4) if (x >> j) & 1) + | sum(1 << (width + placement[j]) + for j in range(4) if (z >> j) & 1)) + + def rows_for(axes, fixed, width): + return [sum(_pairing(axis, value, width) << j + for j, value in enumerate(fixed)) for axis in axes] + + axes = [axis for band in AXES for axis in band] + fixed = [16, 32, 4, 8] # Z_u0, Z_u1, X_v0, X_v1. + rows = rows_for(axes, fixed, 4) + self.assertEqual(rows, [1, 1, 2, 2, 3, 3]) + self.assertEqual(rank(rows), 2) + kernel = [value for value in range(16) + if all((row & value).bit_count() % 2 == 0 for row in rows)] + self.assertEqual(kernel, [0, 4, 8, 12]) # Exactly span{X_v0,X_v1}. + + # Two natural disjoint cells on the p=3 field bank retain four + # independent field-fixed controls. Identity helpers add 2h to + # both fixed spaces, so they cannot repair the rank deficit. + for helpers in (0, 1, 3): + width = 8 + helpers + doubled = [relabel(axis, placement, width) + for placement in ((0, 1, 4, 5), (2, 3, 6, 7)) + for axis in axes] + fixed = ([1 << (width + j) for j in range(4)] + + [1 << (4 + j) for j in range(4)] + + [1 << j for j in range(8, width)] + + [1 << (width + j) for j in range(8, width)]) + self.assertEqual(rank(rows_for(doubled, fixed, width)), 4) + self.assertEqual(len(fixed) - 4, 4 + 2 * helpers) + self.assertGreater(len(fixed) - 4, 2 + 2 * helpers) + + # An involutive wire permutation maps every Hermitian Pauli to a + # commuting Hermitian Pauli. A nonidentical image therefore has + # operator distance 2; this is the robust rank filter's exact gap. + target_fixed = set(range(256)) + for address in range(4): + placement = [j ^ address for j in range(4)] + for label in range(256): + image = relabel(label, placement, 4) + self.assertEqual(_pairing(label, image, 4), 0) + if image != label: + target_fixed.discard(label) + self.assertEqual(target_fixed, {0, 15, 240, 255}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_flat_field_bank_native.py b/tests/test_flat_field_bank_native.py new file mode 100644 index 0000000..c72a014 --- /dev/null +++ b/tests/test_flat_field_bank_native.py @@ -0,0 +1,220 @@ +"""A paid four-address flat seed, six-T bank decoder and complete indicator. + +Every native comparison retains scalar phases, arbitrary output and dirty +inputs, and the actual inverse. This finite pilot is not an all-size rule. +""" +from collections import Counter +from fractions import Fraction +import unittest + +from tests.exact_matrices import ( + CO, CZ, Q2, Gate, add, adjoint, apply_word, eye, multiply, native_columns, scale, +) +from tests.test_field_copy_clifford_native import _fixed_query, _three_cube_query +from tests.test_field_copy_clifford_pilot import _pauli +from tests.test_field_shear_intertwiner import _native_x +from tests.test_joint_lookup_pauli_source import _bands, _inverse +from tests.test_one_band_copy_feasibility import _conjugate, _lift + + +SEED = {86: Q2(Fraction(1, 2)), 80: Q2(Fraction(1, 2)), + 113: Q2(Fraction(-1, 2)), 115: Q2(Fraction(-1, 2))} +ORBIT = [_conjugate(SEED, _fixed_query(j), 4) for j in range(4)] +AXES = ((33, 41), (2, 14), (35, 39)) +TARGET = ({113: Q2(-1)}, {64: Q2(1)}, {89: Q2(-1)}, {96: Q2(1)}) + + +def preparation_word(): + # V*=T(X0 X1) T(Y0 Z1) T(Z0), followed by the fixed field embedding. + u = [('H', 1), ('CX', 1, 0), ('S', 0), ('S', 0), ('S', 0), + ('H', 0), ('H', 1)] + v = [('T', 0)] + _inverse(u) + [('T', 0), ('T', 1)] + u + f = [('S', 1), ('H', 0), ('H', 1), ('CX', 0, 2), ('S', 2), + ('S', 0), ('CX', 1, 0), ('H', 2), ('S', 0), ('CX', 2, 0), + ('H', 2), ('S', 2), ('H', 1)] + return v + f + + +def seed_word(): + v = preparation_word() + return _inverse(v) + _native_x(0) + v + + +def diagonalizers(): + # K maps the listed physical Z axes to each pair in AXES, with + signs. + k1 = [('CX', 0, 3), ('H', 0), ('H', 3), + ('H', 1), ('CX', 0, 1), ('H', 1)] + k2 = [('CX', 1, 2), ('H', 1), ('H', 2), ('CX', 2, 3)] + k3 = [('CX', 1, 2), ('H', 1), ('S', 1), ('CX', 1, 0), ('H', 2)] + return ((k1, (0, 3)), (k2, (1, 2)), (k3, (1, 2))) + + +def decoder_word(): + word = [] + for k, wires in diagonalizers(): + word += _inverse(k) + [('T', j) for j in wires] + k + return word + + +def bank_clifford(): + # Sends the four signed TARGET Paulis to +Z0,+Z1,+Z2,+Z3. + return [('S', 0), ('S', 0), ('S', 0), ('H', 0), + ('CX', 1, 0), ('CX', 2, 0), + ('H', 0), ('S', 0), ('S', 0), ('H', 0), + ('CX', 1, 2), ('CX', 2, 1), ('CX', 1, 2), ('H', 3), + ('CX', 0, 2), ('CX', 3, 2), ('CX', 0, 3), + ('CX', 1, 3), ('CX', 2, 3)] + + +def full_decoder(): + # E is a complete Pauli-bank decoder; its residual query phase is allowed. + return decoder_word() + bank_clifford() + + +def full_intertwiner(): + # The extra diagonal Clifford fixes the complementary Pauli orbit too. + correction = [('S', 1)] * 3 + [('S', 3)] + correction += [('H', 3), ('CX', 0, 3), ('CX', 2, 3), ('H', 3)] + return full_decoder() + correction + + +def copy_word(): + # In the decoded coordinates H_j CX(j;4+j) H_j copies Z_j into X_Yj. + e = full_decoder() + canonical = [] + for j in range(4): + canonical += [('H', j), ('CX', j, 4 + j), ('H', j)] + return e + canonical + _inverse(e) + + +def source_word(): + # Address 0,1; physical output 2..5; arbitrary returned query masks 6..8. + e = [(g[0], *(j + 2 for j in g[1:])) for g in full_decoder()] + query, _ = _three_cube_query() + return _inverse(e) + query + e + + +def indicator_word(): + source = source_word() + wall = [('H', j) for j in range(2, 6)] + return wall + _inverse(source) + [('S', 2), ('S', 2)] + source + wall + + +def copy_indicator_word(): + # Address 0,1; carrier 2..5; output 6..9; returned masks 10..12. + query, _ = _three_cube_query() + query = [(g[0], *(j + 4 if j >= 6 else j for j in g[1:])) for g in query] + seed = [(g[0], *(j + 2 for j in g[1:])) for g in seed_word()] + copy = [(g[0], *(j + 2 for j in g[1:])) for g in copy_word()] + source = _inverse(query) + seed + query + return _inverse(source) + _inverse(copy) + source + copy + + +def ledger(word): + counts = Counter(g[0] for g in word) + return (counts['T'] + counts['TDG'], len(_bands(word)), len(word), + max(j for g in word for j in g[1:]) + 1) + + +def _copy_blocks(): + # Independent Fourier assembly from all sixteen output-X sectors. + # The carrier action in sector s is E^dagger X^s E, including its scalar. + e = native_columns(4, full_decoder()) + ed = adjoint(e) + sectors = [multiply(ed, [e[row ^ s] for row in range(16)]) + for s in range(16)] + return [[[sum((sectors[s][row][col] + * (-1 if (s & difference).bit_count() & 1 else 1) + for s in range(16)), CZ) * Fraction(1, 16) + for col in range(16)] for row in range(16)] + for difference in range(16)] + + +class FlatFieldBankNativeTests(unittest.TestCase): + def test_paid_flat_seed_and_literal_inverse(self): + v = preparation_word() + self.assertEqual(_conjugate({1: Q2(1)}, v, 4), SEED) + expected = [[CZ] * 16 for _ in range(16)] + for label, coefficient in SEED.items(): + self.assertEqual(coefficient.b, 0) + expected = add(expected, scale(_pauli(label & 15, label >> 4), + coefficient.a)) + self.assertEqual(native_columns(4, seed_word()), expected) + self.assertEqual(native_columns(4, _inverse(seed_word())), adjoint(expected)) + self.assertEqual(multiply(expected, expected), eye(16)) + self.assertEqual(native_columns(4, _inverse(v)), + adjoint(native_columns(4, v))) + + def test_three_physical_bands_and_complete_bank_decoding(self): + for (k, wires), axes in zip(diagonalizers(), AXES): + for wire, axis in zip(wires, axes): + self.assertEqual(_conjugate({1 << (4 + wire): Q2(1)}, k, 4), + {axis: Q2(1)}) + d, e = decoder_word(), full_decoder() + for j, (reflection, target) in enumerate(zip(ORBIT, TARGET)): + self.assertEqual(_conjugate(reflection, d, 4), target) + self.assertEqual(_conjugate(target, _inverse(d), 4), reflection) + self.assertEqual(_conjugate(reflection, e, 4), + {1 << (4 + j): Q2(1)}) + for word in (d, e): + self.assertEqual(native_columns(4, _inverse(word)), + adjoint(native_columns(4, word))) + + def test_complete_copy_all_columns_and_actual_inverse(self): + word = copy_word() + for j, reflection in enumerate(ORBIT): + lifted = {_lift(k, 4, 8): v for k, v in reflection.items()} + target = {k ^ (1 << (4 + j)): v for k, v in lifted.items()} + self.assertEqual(_conjugate(lifted, word, 8), target) + self.assertEqual(_conjugate(target, _inverse(word), 8), lifted) + blocks = _copy_blocks() + for actual in (word, _inverse(word)): + gates = [Gate(g[0], tuple(g[1:])) for g in actual] + for column in range(256): + carrier, output = column & 15, column >> 4 + expected = {row | (other << 4): blocks[other ^ output][row][carrier] + for other in range(16) for row in range(16) + if blocks[other ^ output][row][carrier] != CZ} + self.assertEqual(apply_word(gates, {column: CO}), expected) + + def test_direct_indicator_every_input_and_actual_inverse(self): + word = indicator_word() + for actual in (word, _inverse(word)): + gates = [Gate(g[0], tuple(g[1:])) for g in actual] + for column in range(512): + expected = column ^ (1 << (2 + (column & 3))) + self.assertEqual(apply_word(gates, {column: CO}), {expected: CO}) + + def test_native_ledgers_and_common_allocations(self): + rows = ((preparation_word(), (3, 2, 28, 3), (3, 2, 38, 3)), + (seed_word(), (6, 4, 70, 3), (6, 4, 70, 3)), + (decoder_word(), (6, 3, 38, 4), (6, 3, 38, 4)), + (bank_clifford(), (0, 0, 19, 4), (0, 0, 17, 4)), + (full_decoder(), (6, 3, 57, 4), (6, 3, 55, 4)), + (full_intertwiner(), (6, 3, 65, 4), (6, 3, 63, 4)), + (copy_word(), (12, 6, 124, 8), (12, 6, 124, 8)), + (source_word(), (36, 14, 170, 9), (36, 14, 170, 9)), + (indicator_word(), (72, 28, 350, 9), (72, 28, 350, 9)), + (copy_indicator_word(), (132, 52, 620, 13), (132, 52, 620, 13))) + for word, forward, inverse in rows: + self.assertEqual(ledger(word), forward) + self.assertEqual(ledger(_inverse(word)), inverse) + for actual in (word, _inverse(word)): + self.assertLessEqual({g[0] for g in actual}, {'H', 'S', 'CX', 'T', 'TDG'}) + for band in _bands(actual): + self.assertEqual(len({g[1] for g in band}), len(band)) + self.assertEqual(ledger(indicator_word())[3] - 2 - 4, 3) + self.assertEqual(ledger(copy_indicator_word())[3] - 2 - 4, 7) + + def test_encoded_echo_native_wiring_and_return(self): + word = copy_indicator_word() + for actual in (word, _inverse(word)): + gates = [Gate(g[0], tuple(g[1:])) for g in actual] + for address in range(4): + column = address | ((3 + address) << 2) | (10 << 6) | ((7 - address) << 10) + self.assertEqual(apply_word(gates, {column: CO}), + {column ^ (1 << (6 + address)): CO}) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_seed_fingerprint.py b/tests/test_seed_fingerprint.py new file mode 100644 index 0000000..f4ee839 --- /dev/null +++ b/tests/test_seed_fingerprint.py @@ -0,0 +1,174 @@ +"""Exact fixtures for the Clifford-dual seed fingerprint screens. + +The all-size proofs are in NATIVE_COPY_INTERACTION.md, Sections 7--8. +These native and signed-Pauli fixtures do not supply a copy or an emitter. +""" +from collections import Counter +from fractions import Fraction as F +from itertools import permutations +import unittest + +from tests.exact_matrices import CO, CZ, Q2, adjoint, multiply, native_columns, scale +from tests.test_clifford_orbit_query_rank import _one_qubit_cliffords +from tests.test_nonclifford_seed_spread import _pauli, _trace, _conjugate +from tests.test_field_shear_intertwiner import _pencil_columns + + +def q_formula(width, active, label): + answer = F(1) + for bit in range(active): + local = ((label >> bit) & 1) | (((label >> (width + bit)) & 1) << 1) + answer *= (F(1), F(-1, 2), F(0), F(-1, 2))[local] + return answer + + +def symp(width, left, right): + mask = (1 << width) - 1 + return (((left & mask) & (right >> width)).bit_count() + + ((right & mask) & (left >> width)).bit_count()) % 2 + + +def linear(columns, value): + answer = 0 + for bit, image in enumerate(columns): + if value >> bit & 1: + answer ^= image + return answer + + +def sp4(): + basis = [1, 2, 4, 8] + gram = [[symp(2, a, b) for b in basis] for a in basis] + for columns in permutations(range(1, 16), 4): + if all(symp(2, columns[i], columns[j]) == gram[i][j] + for i in range(4) for j in range(i)): + yield columns + + +def field_image(p, address, x, z, phase): + k = 1 << (p - 1) + mask = (1 << k) - 1 + xu, zv = x & mask, (z >> k) & mask + cols = _pencil_columns(p, address) + x ^= linear(cols, xu) << k + z ^= sum(((column & zv).bit_count() & 1) << i + for i, column in enumerate(cols)) + return x, z, phase + + +def normal_product(factors): + x = z = phase = 0 + for xx, zz, pp in factors: + phase += pp + 2 * (z & xx).bit_count() + x ^= xx + z ^= zz + return x, z, phase % 4 + + +class SeedFingerprintTests(unittest.TestCase): + def test_literal_native_fingerprint_with_arbitrary_helper(self): + width = 2 + r = native_columns(width, [('TDG', 0), ('H', 0), ('T', 0)]) + self.assertEqual(adjoint(r), r) + for label in range(1 << (2 * width)): + p = _pauli(width, label) + actual = _trace(multiply(multiply(multiply(r, p), r), p)) / 4 + self.assertEqual(actual, CO * Q2(q_formula(width, 1, label))) + # Every helper input is retained in these complete matrices. + self.assertEqual({label for label in range(16) + if q_formula(2, 1, label) == 1}, {0, 2, 8, 10}) + for active in range(1, 8): + spectrum = {F(0)} | {F(-1, 2) ** k for k in range(active + 1)} + self.assertGreaterEqual(min(abs(v - 1) for v in spectrum if v != 1), + F(3, 4)) + self.assertGreaterEqual(min(abs(v + F(1, 2)) for v in spectrum + if v != F(-1, 2)), F(3, 8)) + + def test_exhaustive_two_wire_symplectic_fingerprint_normalizers(self): + group = list(sp4()) + self.assertEqual(len(group), 720) + for active, expected in ((1, 12), (2, 8)): + q = [q_formula(2, active, label) for label in range(16)] + special = {F(1), F(-1, 2)} + preserving = [cols for cols in group if all( + q[linear(cols, label)] == value + for label, value in enumerate(q) if value in special)] + self.assertEqual(len(preserving), expected) + helper = {label for label in range(16) if q[label] == 1} + active_space = {label for label in range(16) + if all(symp(2, label, h) == 0 for h in helper)} + active_xy = {1 << i for i in range(active)} | { + (1 << i) | (1 << (2 + i)) for i in range(active)} + for columns in preserving: + self.assertEqual({linear(columns, h) for h in helper}, helper) + self.assertEqual({linear(columns, v) for v in active_space}, active_space) + self.assertEqual({linear(columns, v) for v in active_xy}, active_xy) + self.assertTrue(all(q[linear(columns, v)] == q[v] for v in range(16))) + + def test_all_literal_one_cell_cliffords_and_product_overlap_gap(self): + a = native_columns(1, [('TDG', 0), ('H', 0), ('T', 0)]) + cliffords = list(_one_qubit_cliffords().values()) + self.assertEqual(len(cliffords), 24) + normalizer_overlaps = [] + exact_signs = [] + for u in cliffords: + image = _conjugate(u, a) + fingerprint_ok = True + for label in (1, 3): # active X and Y + p = _conjugate(u, _pauli(1, label)) + q = _trace(multiply(multiply(multiply(a, p), a), p)) / 2 + fingerprint_ok &= q == CO * Q2(F(-1, 2)) + if not fingerprint_ok: + continue + overlap = _trace(multiply(a, image)) / 2 + self.assertEqual(overlap.imag, 0) + normalizer_overlaps.append(overlap.real) + for sign in (-1, 1): + if image == scale(a, sign): + exact_signs.append(sign) + # The unique maximal coefficient's Pauli has the same sign. + self.assertEqual(_conjugate(u, _pauli(1, 2)), scale(_pauli(1, 2), sign)) + self.assertEqual(len(normalizer_overlaps), 8) + self.assertEqual(Counter(normalizer_overlaps), Counter({ + Q2(1): 1, Q2(-1): 1, Q2(F(1, 2)): 2, + Q2(F(-1, 2)): 2, Q2(0): 2})) + self.assertEqual(sorted(exact_signs), [-1, 1]) + for count in range(1, 6): + values = {F(1)} + for _ in range(count): + values = {left * right for left in values + for right in (F(-1), F(-1, 2), F(0), F(1, 2), F(1))} + self.assertTrue(all(abs(value) <= F(1, 2) for value in values if abs(value) != 1)) + + def test_affine_field_four_pauli_word_keeps_literal_scalar_phase(self): + totals = Counter() + for p in (2, 3, 4): + width = 1 << p + mask = (1 << width) - 1 + labels = (range(1 << (2 * width)) if p == 2 else + [0, mask, mask << width, mask | (mask << width)] + + [1 << bit for bit in range(2 * width)] + + [(1 << bit) | (1 << ((bit + 3) % (2 * width))) + for bit in range(2 * width)]) + for label in labels: + x, z = label & mask, label >> width + phase = (x & z).bit_count() % 4 + for origin in range(1 << p): + addresses = [origin, origin ^ 1, origin ^ 2, origin ^ 3] + word = [field_image(p, address, x, z, phase) for address in addresses] + xx, zz, pp = normal_product(word) + self.assertEqual((xx, zz), (0, 0)) + totals[pp] += 1 + # Exactly one address equals origin: scalar is negated, never fixed. + requested_phase = (pp + 2 * sum(a == origin for a in addresses)) % 4 + self.assertNotEqual(requested_phase, pp) + self.assertGreater(sum(totals.values()), 2000) + self.assertEqual(set(totals), {0}) + # A Clifford label family of affine degree can still have a -I scalar + # cube; literal phases must not be silently replaced by +I. + word = [(1, 0, 0), (0, 1, 0), (1, 0, 0), (0, 1, 0)] + self.assertEqual(normal_product(word), (0, 0, 2)) + + +if __name__ == '__main__': + unittest.main(verbosity=2) From c07ab3a1d7d0ea6892403689eadff476f45b511c Mon Sep 17 00:00:00 2001 From: Ruge Lin Date: Wed, 28 Oct 2026 21:01:21 +0800 Subject: [PATCH 2/2] Use HTML-safe inline inequalities in the flat-bank proof --- research/depth/FLAT_FIELD_BANK_PILOT.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/research/depth/FLAT_FIELD_BANK_PILOT.md b/research/depth/FLAT_FIELD_BANK_PILOT.md index 3cc389c..efee82e 100644 --- a/research/depth/FLAT_FIELD_BANK_PILOT.md +++ b/research/depth/FLAT_FIELD_BANK_PILOT.md @@ -345,7 +345,7 @@ error eta, an output dual $`J=C^\dagger Z_{Y_j}C`$ obeys \le2\eta. ``` -When J is Clifford and $`2\eta<1/\sqrt2`$, every one of these four +When J is Clifford and $`2\eta\lt1/\sqrt2`$, every one of these four relations must therefore be exact, contradicting the enumeration. Every one-band native copy has Clifford Pauli output duals, so @@ -399,7 +399,7 @@ Pauli rotation axes. The complete error is \eta=\max_x\|EQ_xE^\dagger-W_x\otimes I_h\|. ``` -If $`\eta<1`$, then +If $`\eta\lt1`$, then ```math \mathrm{rank}\bigl(\langle\ ,\ \rangle|_{A\times\mathcal F}\bigr) @@ -415,7 +415,7 @@ An involutive wire permutation sends every Pauli to a commuting Pauli: in binary labels the relevant symplectic pairing vanishes because the permutation matrix is symmetric. Any two unequal commuting Hermitian Paulis have operator distance two, including -opposite signs. Thus the image is fixed exactly when $`\eta<1`$. +opposite signs. Thus the image is fixed exactly when $`\eta\lt1`$. The common target fixed-label space consists of $`X_{\rm all}`$, $`Z_{\rm all}`$ and helper Paulis, of dimension $`2+2h`$.