diff --git a/WORKSPACE.md b/WORKSPACE.md index 1f97d72..a393f0f 100644 --- a/WORKSPACE.md +++ b/WORKSPACE.md @@ -11,12 +11,12 @@ Manuscript drafting and the changed-decoder supplement are separate tasks. ## Current checkpoint -Verified baseline: [PR #268](https://github.com/GoGoKo699/Hopf-Frame-Compilation/pull/268), -`156f2cd4f5bc2e3c3d1f4afec17b31d0627764d3`, 28 October 2026. -Its reviewed tree passed 2,035 tests locally and in both CI versions, plus the full gate and presentation checks. +Verified baseline: [PR #269](https://github.com/GoGoKo699/Hopf-Frame-Compilation/pull/269), +`5867adce7db176dc9983db851df451123ab9d272`, 29 October 2026. +Its reviewed tree passed 2,054 tests locally and in both CI versions, plus the full gate and presentation checks. -Read the [resource frontier](docs/OPEN_PROBLEM.md) for general theorems, -then the [route decisions](research/ROUTE_DECISIONS.md) for the chosen mechanism. +Read the [resource frontier](docs/OPEN_PROBLEM.md) for general theorems and the +[route decisions](research/ROUTE_DECISIONS.md) for the chosen mechanism. Use the [research catalogue](research/README.md) to find its proof dependencies. @@ -81,16 +81,17 @@ they do not construct the source. ### Latest substantive outcomes and resumption question The [tree-probe algebra](research/depth/INTERLEAVED_TREE_PROBE_SOURCE.md), -[Clifford-orbit rank bound](research/depth/CLIFFORD_ORBIT_QUERY_RANK.md) and -[non-Clifford seed-spread bound](research/depth/NONCLIFFORD_SEED_SPREAD.md) -retain their exact query/seed scopes. Target coordinates and support do not pay decoding. - -The [field shear](research/depth/FIELD_SHEAR_INTERTWINER.md) has a paid -eight-band query and an [exact recursive decoder](research/depth/RECURSIVE_FIELD_SHEAR_DECODER.md). -Dense tower queries and multiplication-XOR batches are paid; its nonlinear -in-place maps remain unpaid. Bell-zero-fiber preservation fails even the -weaker lookup probe. For p at least two, a seed diagonal in any query-invariant -stabilizer basis fails, including arbitrary helpers and a non-Clifford decoder. +[Clifford-orbit rank](research/depth/CLIFFORD_ORBIT_QUERY_RANK.md) and +[non-Clifford seed spread](research/depth/NONCLIFFORD_SEED_SPREAD.md) retain their exact query/seed scopes. +Target coordinates and support do not pay decoding. + +The [field shear](research/depth/FIELD_SHEAR_INTERTWINER.md) has a paid eight-band query. +The [augmented recoupler](research/depth/AUGMENTED_FIELD_RECOUPLER.md) replaces the +original decoder's unpaid division maps with two multiplication-XOR batches per level. +A moving Pauli helper query appears on both sides; the complete indicator echo returns every helper. +The paid decoder has at most $`16(p-1)`$ bands, and the indicator has at most $`64(p-1)+16`$. +Its $`O(mp^3)`$ T count, $`O(mp^2)`$ dirty width and $`O(m^2p^2)`$ gates fit the relaxed fusion budgets; +its linear depth does not. Invariant-stabilizer-diagonal seeds and Bell-zero-fiber preservation still fail. The [three-band source theorem](research/depth/THREE_BAND_LOOKUP_SOURCE_OBSTRUCTION.md) excludes every zero-clean native source of depth at most three for p at least @@ -122,36 +123,38 @@ 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 [flat four-address pilot](research/depth/FLAT_FIELD_BANK_PILOT.md) retains its six-T decoder and complete 72-T indicator. -The [projective recoupler](research/depth/PROJECTIVE_FIELD_RECOUPLER.md) now pays an exact eight-address full decoder: -172 T gates, at most 83 bands, eight arbitrary wires and no extra helpers. Selected reflection phases cancel jointly. -Projective-line enumeration grows exponentially in field degree; this is a finite calibration. +The [projective recoupler](research/depth/PROJECTIVE_FIELD_RECOUPLER.md) retains two exact eight-address allocations: +172 T gates and at most 83 bands without extra helpers, or 148 T gates and at most 39 bands with six returned dirty helpers. +Common reflection selection and private quartic batching pay the second word. Exponential line enumeration remains a finite-size limit. [Pauli-domain rigidity](research/depth/FIELD_DECODER_PAULI_DOMAIN.md) requires absorbed-axis rank at least $`2m-2`$, including moving Clifford helpers. Independent finite cells fail even with joint outer Clifford walls. +The [weak-probe domain](research/depth/WEAK_PROBE_PAULI_DOMAIN.md) also excludes independent four-wire cells: +complete-probe error is at least $`1/12`$ for p at least three, and $`1/4`$ for p at least five. +It permits arbitrary joint Clifford walls and moving decoded helpers; extensive axis rank alone is not a depth bound. The [two-band screen](research/depth/TWO_BAND_FIELD_DECODER_OBSTRUCTION.md) excludes disjoint absorbed spans at fixed error; shared-span collisions and coupled three-band words remain open. The [scalar-field radical model](research/depth/SCALAR_FIELD_RADICAL_COPY_SCREEN.md) has a four-address identity for every address embedding; changing its address space does not repair it. -These restrictions do not exclude the weaker complete-probe decoder contract. +The [sector-degree barrier](research/depth/FIELD_SECTOR_DEGREE_BARRIER.md) requires helper-tableau degree at least +$`p-1`$ for Clifford-sector field intertwiners. The augmented construction attains it. +Fixed-frame helper-affine stage words need at least $`p-1`$ stages; this does not bound unrestricted native T-depth. -The [Clifford-seed bounds](research/depth/CLIFFORD_SEED_COPY_STRUCTURE.md) retain their -commuting-orbit and one-band-copy scopes. The [seed fingerprint](research/depth/NATIVE_COPY_INTERACTION.md#seed-coefficient-rigidity) -excludes product THT-dagger seeds below 3/32 for one-band field copies at p at least two. +The [Clifford-seed bounds](research/depth/CLIFFORD_SEED_COPY_STRUCTURE.md) retain their commuting-orbit and one-band-copy scopes. +The [seed fingerprint](research/depth/NATIVE_COPY_INTERACTION.md#seed-coefficient-rigidity) excludes product THT-dagger seeds below 3/32 for one-band field copies at p at least two. [Complete copy feasibility](research/depth/ONE_BAND_COPY_FEASIBILITY.md) still requires the carrier equation; triple-axis joint walls have zero full seed space. [Clifford-dual grading](research/depth/CLIFFORD_DUAL_COPY_GRADING.md) requires binary abelianization rank at least $`m-p-1`$; explicit relation words give robust floors. -**Next question:** jointly resynthesize the projective corrections and recursive levels, -using zero-sector and complete-probe freedom, within sublogarithmic depth and polynomial budgets. -The joint seed/copy alternative remains open; no uniform decoder or improved R96 bound is supplied. +**Next question:** compress the complete source while leaving the fixed-frame helper-affine stage grammar, +allowing helper-basis motion or non-Clifford sector intermediates, with a complete native return ledger. +The weaker complete-probe and joint seed/copy alternatives remain open. R96 is unchanged. -The [four-band Clifford front end](research/depth/CLIFFORD_INVOLUTION_SOURCE.md), +The [four-band Clifford front end](research/depth/CLIFFORD_INVOLUTION_SOURCE.md) and [weighted outer-phase route](research/depth/JOINT_ADDRESS_HELPER_SOURCE.md), -[reduced central gauge](research/depth/COHERENT_CENTRAL_TRANSPORT.md#reduced-carrier-gauge) -and [minimal-tree probe](research/depth/ORDERED_MATCHING_PROBE_SOURCE.md#minimal-tree-source) -remain component alternatives under their separate screens. In the separate -[precision route](research/depth/JOINT_PRECISION_ROTATION.md), joint recovery -beyond the separately paid two-path pilots remains open. +[reduced central gauge](research/depth/COHERENT_CENTRAL_TRANSPORT.md#reduced-carrier-gauge) and +[minimal-tree probe](research/depth/ORDERED_MATCHING_PROBE_SOURCE.md#minimal-tree-source) remain component alternatives under their separate screens. +In the [precision route](research/depth/JOINT_PRECISION_ROTATION.md), joint recovery beyond the separately paid two-path pilots remains open. A finite-size identity needs a uniform all-size rule; serial grade computations retain the old cost. Any gain needs a fresh complete-circuit ledger, including transfer, precision words, @@ -159,10 +162,9 @@ actual inverses, leakage and work return. ## Stopped routes, reopening conditions and superseded instructions -The [route decisions](research/ROUTE_DECISIONS.md) own each failed mechanism -and its reopening condition. Detailed proofs and unique counterexamples stay -in their linked homes. Old instructions to add another mixer, improve a scalar -filter, or pay the rank-one phase do not override those complete-action screens. +The [route decisions](research/ROUTE_DECISIONS.md) own each failed mechanism and its reopening condition. +Detailed proofs and unique counterexamples stay in their linked homes. Old instructions to add another mixer, +improve a scalar filter, or pay the rank-one phase do not override those complete-action screens. A scoped failure does not retire the unrestricted destination. @@ -171,10 +173,9 @@ A scoped failure does not retire the unrestricted destination. ## Working contract and reading map -Prefer analytic identities and a few exact fixtures. Preserve literal phases, -every logical column, coherent address and arbitrary dirty/reference inputs, -actual native adjoints, and all clean leakage and work return. No QRAM, free -loading or precision states, unpriced clean history, resets or postselection. +Prefer analytic identities and a few exact fixtures. Preserve literal phases, every logical column, +coherent address and arbitrary dirty/reference inputs, actual native adjoints, and all clean leakage and work return. +No QRAM, free loading or precision states, unpriced clean history, resets or postselection. A suffix is clean only on its active sector; inactive action needs its own proof. Separate general theorems, conditional interfaces, useful components and representation limits. Internal audits and finite checks do not replace @@ -190,8 +191,7 @@ analytic proof or external technical review. -Each claim has one proof home. Preserve unique attempts, stable identifiers, inbound anchors, tests and receipt hashes. -Change mechanisms when complete synthesis restores the old cost. +Each claim has one proof home. Preserve unique attempts, stable identifiers, inbound anchors, tests and receipt hashes; change mechanisms when complete synthesis restores the old cost. ## Restore and verify diff --git a/docs/reference/VERIFICATION_CATALOGUE.md b/docs/reference/VERIFICATION_CATALOGUE.md index 5e10d8a..103d91e 100644 --- a/docs/reference/VERIFICATION_CATALOGUE.md +++ b/docs/reference/VERIFICATION_CATALOGUE.md @@ -272,7 +272,9 @@ without an extra native fixture. | Two-address interleaved pilot | [Proof](../../research/depth/TWO_ADDRESS_INTERLEAVED_PILOT.md), [native fixtures](../../tests/test_two_address_interleaved_pilot.py) | Complete controlled-Hadamard family, signed fixed Clifford decoder, actual native source and inverse and returned dirty work. This is a finite complete benchmark; no uniform depth improvement is inferred | | Non-Clifford seed spread | [Proof](../../research/depth/NONCLIFFORD_SEED_SPREAD.md), [finite fixtures](../../tests/test_nonclifford_seed_spread.py) | Native seed phases and inverse, affine-query label growth, Pauli-algebra compression and squared error, signed-Pauli symmetry gap for the plain local inverse, and dominant-coefficient collisions. The all-size spread and information bounds are analytic; the paid extensive seed does not supply its complete decoder | | Field-shear intertwiner | [Proof](../../research/depth/FIELD_SHEAR_INTERTWINER.md), [exact fixtures](../../tests/test_field_shear_intertwiner.py) | Complete native query and two-bit decoder, actual inverses, characters and exact joint eigenbases. Three-bit fixtures check punctured coordinates, spectator multiplicities, Bell-fiber redistribution and the weak-probe witness; helper-valued cocycle reconstruction checks exact probe freedom. A complete four-wire stabilizer-basis fixture has no common affine fixed label, guarding the zero-or-coset alternative in the analytic invariant-diagonal-seed exclusion | -| Recursive field-shear decoder | [Proof](../../research/depth/RECURSIVE_FIELD_SHEAR_DECODER.md), [exact fixtures](../../tests/test_recursive_field_shear_decoder.py) | Tower-field arithmetic, complete recursive intertwining and reversed algebraic words, plus native linear-form cubic batches with arbitrary returned helpers. The uniform identity does not pay its nonlinear in-place maps or improve R96; native depth must be assessed for the jointly compiled decoder | +| Recursive field-shear decoder | [Proof](../../research/depth/RECURSIVE_FIELD_SHEAR_DECODER.md), [exact fixtures](../../tests/test_recursive_field_shear_decoder.py) | Tower-field arithmetic, complete recursive intertwining and reversed algebraic words, plus native linear-form cubic batches with arbitrary returned helpers. The identity-helper construction retains unpaid in-place maps; the separate augmented source below changes and explicitly pays its helper query | +| Augmented field recoupler | [Proof](../../research/depth/AUGMENTED_FIELD_RECOUPLER.md), [exact fixtures](../../tests/test_augmented_field_recoupler.py) | Two-product identities, native shared-target batches with overlapping forms and returned private masks, every seven-wire native four-address decoder column, and complete computational-helper columns at two and three address bits check the all-size composition. The moving Pauli query is essential; only the complete probe echo returns it. The paid depth remains linear in p | +| Clifford-sector degree barrier | [Proof](../../research/depth/FIELD_SECTOR_DEGREE_BARRIER.md), [degree and scope fixtures](../../tests/test_field_sector_degree.py), [signed tableau fixtures](../../tests/test_field_sector_tableaux.py) | Exact signed helper-sector tableaux, actual inverses and cocycles, group-algebra norms and helper-frame scope witnesses support the uniform degree and stage bounds. The construction attains degree $`p-1`$; a nonlinear helper-motion example guards the fixed-frame assumption. No unrestricted native T-depth lower bound follows | | Encoded dirty copy | [Proof](../../research/depth/ENCODED_DIRTY_COPY_INTERFACE.md), [complete fixtures](../../tests/test_encoded_dirty_copy_interface.py) | Native finite carrier/copy words and actual inverses check physical output and returned arbitrary work. The exact echo, full-error ledger, degree-sensitive Clifford-copy gap and Pauli-companion affine-table restriction are analytic. A globally cancelling dirty encoding does not supply a native copy interaction or a faster general compiler | | Exact dirty-copy grading | [Proof](../../research/depth/DIRTY_COPY_GRADING.md), [exact fixtures](../../tests/test_dirty_copy_grading.py) | Noncommuting native copies and actual inverses, weighted-flip covariance and nonscalar commutators, complete copied columns, spectral multiplicities with tiny normalized trace, and the sharp pairwise anticommuting-target gap. The all-word criterion and all-size ledgers are analytic; the wire-coordinate example retains linear query depth and its field-coordinate seed/copy remain unpaid | | Native copy interaction | [Proof](../../research/depth/NATIVE_COPY_INTERACTION.md), [exact fixtures](../../tests/test_native_copy_interaction.py) | Native one-band copy components and actual inverses, dual-support and translation-rank identities, and a coded two-band pilot check the scoped interaction analysis. The extensive T-count floor and all-size product/coded-family exclusions are analytic; they do not exclude a general one-band field copy or improve the frame frontier | @@ -282,8 +284,9 @@ without an extra native fixture. | 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 | -| Projective field recoupler | [Proof](../../research/depth/PROJECTIVE_FIELD_RECOUPLER.md), [native fixtures](../../tests/test_projective_field_recoupler.py) | Exact field Fourier walls, all projective fibers, literal paired-reflection tables, borrowed-wire quartic phases, all 240 nonzero-U recoupler columns, every actual-inverse column and all eight full-query intertwinings retain scalar phases and arbitrary inputs. The 172-T, 83-band finite full decoder uses eight wires and no extra helpers; exponential line enumeration gives no uniform compiler | -| Complete field decoder Pauli domain | [Proof](../../research/depth/FIELD_DECODER_PAULI_DOMAIN.md), [exact fixtures](../../tests/test_field_decoder_pauli_domain.py) | Literal field derivatives, second-difference masks, the moving-helper quotient, its essential boundary example, and the finite decoder domain check the robust all-size proof. The absorbed-axis and T-count floor is $`2m-2`$, including arbitrary Clifford target-helper motion; it is not a depth bound or a restriction on the weaker probe contract | +| Projective field recoupler | [Proof](../../research/depth/PROJECTIVE_FIELD_RECOUPLER.md), [original native fixtures](../../tests/test_projective_field_recoupler.py), [coupled native fixtures](../../tests/test_coupled_projective_recoupler.py) | Exact field Fourier walls, paired reflections, all nonzero and zero cells, complete actual inverses and all eight addresses retain literal phases. The coupled fixture adds affine private-mask constants and all 3,072 helper-sector comparisons. The separate full-decoder allocations are 172 T / 83 bands / zero extra helpers and 148 T / 39 bands / six returned dirty helpers; neither line enumeration nor the finite selector gives a uniform depth gain | +| Complete field decoder Pauli domain | [Proof](../../research/depth/FIELD_DECODER_PAULI_DOMAIN.md), [exact fixtures](../../tests/test_field_decoder_pauli_domain.py) | Literal field derivatives, second-difference masks, the moving-helper quotient, its essential boundary example, and the finite decoder domain check the robust all-size proof. The absorbed-axis and T-count floor is $`2m-2`$, including arbitrary Clifford target-helper motion; the separate weak-probe theorem below needs no full endpoint | +| Weak complete-probe Pauli domain | [Proof](../../research/depth/WEAK_PROBE_PAULI_DOMAIN.md), [exact fixtures](../../tests/test_weak_probe_pauli_domain.py) | Scalar cube phases, Reed--Muller dimensions and radicals, joint Clifford invariance, the native four-address domain, the weight-four code boundary and Pauli-helper signs support the analytic domain and count bounds. The $`1/12`$ and $`1/4`$ error floors apply to independent cells; coupled non-Clifford words remain open | | Disjoint-span two-band field decoder | [Proof](../../research/depth/TWO_BAND_FIELD_DECODER_OBSTRUCTION.md), [exact fixtures](../../tests/test_disjoint_two_band_decoder.py) | Exact collision-free Pauli supports, the sharp two-term fingerprint gap, partial-band normalization, moving residual-query deviations and actual shared-span collisions test the scope. The analytic fixed error floor permits arbitrary Clifford helper motion; overlapping bands remain open | | Scalar-field radical copy screen | [Proof](../../research/depth/SCALAR_FIELD_RADICAL_COPY_SCREEN.md), [exact fixtures](../../tests/test_scalar_field_radical_copy.py) | Complete small equivariant bilinear-product kernels, multiple banks, fixed helpers and changed address scalars support the square-zero image lemma. A one-address counterexample guards the threshold, and all-column regular affine words check the four-address relation. Direct-copy and output-dual floors concern the stated associative-algebra model only | | 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 | diff --git a/research/README.md b/research/README.md index d2ba23a..ca7c1f6 100644 --- a/research/README.md +++ b/research/README.md @@ -199,8 +199,9 @@ These are complete interfaces and conditional transfers, not constructions of th - [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 -- [Projective field recoupler](depth/PROJECTIVE_FIELD_RECOUPLER.md) — projective homogeneity, an allowed emitted zero fiber, and joint selected-reflection phases give a complete eight-address native decoder with 172 T gates, at most 83 bands, eight arbitrary wires and no extra helpers; line enumeration is not a uniform polynomial-budget construction -- [Complete field decoder Pauli domain](depth/FIELD_DECODER_PAULI_DOMAIN.md) — a robust $`2m-2`$ absorbed-axis and T-count requirement, including arbitrary Clifford motion of decoded helpers; independent finite cells fail even with joint outer Clifford walls +- [Projective field recoupler](depth/PROJECTIVE_FIELD_RECOUPLER.md) — complete eight-address native decoders: 172 T gates and at most 83 bands without extra helpers, or 148 T gates and at most 39 bands with six returned dirty helpers; shared reflection phases and private quartic batching retain every zero-fiber column, while line enumeration remains exponential +- [Complete field decoder Pauli domain](depth/FIELD_DECODER_PAULI_DOMAIN.md) — robust absorbed-axis rank and T-count floor $`2m-2`$ for complete field intertwiners, including moving Clifford target helpers; independent finite cells fail after arbitrary joint outer Clifford walls +- [Weak complete-probe Pauli domain](depth/WEAK_PROBE_PAULI_DOMAIN.md) — degree-sensitive Reed--Muller domain and axis bounds for the transported probe alone; a low-weight field-kernel argument yields independent-cell error floor $`1/12`$ from three address bits, improved to $`1/4`$ from five bits, including linear Pauli helper queries and moving decoded helpers - [Disjoint-span two-band field decoders](depth/TWO_BAND_FIELD_DECODER_OBSTRUCTION.md) — a uniform error floor for partial or full bands with zero span intersection, including arbitrary source identity helpers and Clifford target-helper motion; shared-span cancellation remains outside the theorem - [Scalar-field radical copy screen](depth/SCALAR_FIELD_RADICAL_COPY_SCREEN.md) — algebra-automorphism equivariance forces a square-zero shear image and a four-address relation for every address embedding, giving direct-copy error at least one half and output-dual copy error at least one quarter - [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 @@ -270,7 +271,9 @@ Use these only with their stated actual-boundary, fiber, normalization or source - [Two-address interleaved pilot](depth/TWO_ADDRESS_INTERLEAVED_PILOT.md) — a complete controlled-Hadamard family with a paid fixed Clifford decoder, native source and actual inverse; a finite benchmark, not an asymptotic gain - [Non-Clifford seed spread](depth/NONCLIFFORD_SEED_SPREAD.md) — exact Pauli-algebra and robust quantum random-access bounds force a broad seed for bounded affine queries; a paid extensive seed and its local-decoder limit separate seed count from native depth - [Field-shear intertwiner](depth/FIELD_SHEAR_INTERTWINER.md) — paid query and native two-bit decoder, spectator count, Bell-fiber redistribution, helper-valued probe freedom, and exclusion of exact seeds diagonal in any query-invariant stabilizer basis -- [Recursive field-shear decoder](depth/RECURSIVE_FIELD_SHEAR_DECODER.md) — an explicit all-size intertwiner with complete zero-sector action; dense queries and multiplication-XOR batches have eight paid bands, while in-place coordinate maps and joint native synthesis remain unpaid +- [Recursive field-shear decoder](depth/RECURSIVE_FIELD_SHEAR_DECODER.md) — all-size identity-helper algebraic intertwiner with full zero sectors, dense native queries and paid multiplication-XOR batches; the original in-place maps remain uncompiled, while the augmented helper-query construction pays a different complete decoder +- [Augmented field recoupler](depth/AUGMENTED_FIELD_RECOUPLER.md) — uniform native field-plus-Pauli-helper intertwiner with shared moving helpers and complete indicator return; two multiplication-XOR batches per level give $`16(p-1)`$ decoder bands and the specific relaxed fusion count/width/gate budgets, but depth still fails the discovery target +- [Clifford-sector degree barrier](depth/FIELD_SECTOR_DEGREE_BARRIER.md) — helper shift rank and helper-tableau degree at least $`p-1`$ for full field intertwiners with Clifford sectors; the augmented construction attains the degree, so fixed-frame helper-affine stages cannot compress to a bounded number, while unrestricted native words remain outside the screen - [Dirty Choi teleportation and a sufficient residual probe](depth/DIRTY_CHOI_OBSERVABLE_SOURCE.md) — complete standard/group Bell diagnostics and four-phase/eight-source extraction, with one-bank polarization and safe output/carrier aliases reducing dirty width - [Coupled final encoders](depth/COUPLED_FINAL_ENCODER.md) — paid address/tag and bank-motion sources, scoped three-layer boundaries, the corrected relative involution, and complete-transition failures of retained repairs - [Coupled order interference](depth/COUPLED_ORDER_GRAM_SOURCE.md) — actual joint word, robust direct square readout for balanced two-unitary sources, paid anchors and two distinct finite failed bank-moving trials diff --git a/research/ROUTE_DECISIONS.md b/research/ROUTE_DECISIONS.md index 7797199..5e9c40e 100644 --- a/research/ROUTE_DECISIONS.md +++ b/research/ROUTE_DECISIONS.md @@ -26,8 +26,9 @@ Start with a complete interface; consult component families only when the propos | [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 direct indicator with 72 T gates, at most 28 bands, 350 total gates and three returned dirty wires. A separate Clifford completion makes it a full field intertwiner. The same seed has one-band copy error at least $`1/(2\sqrt2)`$. | Extend the decoder uniformly within polynomial discovery budgets and sublogarithmic depth, allowing the complete probe's commutant freedom. The finite words establish no asymptotic bound or minimum cost; full-intertwiner restrictions are separated below from the weaker probe contract. | -| [Projective field recoupler](depth/PROJECTIVE_FIELD_RECOUPLER.md) | Projective homogeneity reduces each nonzero conditional cell to one Clifford per field line and a linear displacement. A common baseline and paired-reflection phase cancellation give a complete eight-address decoder with 172 T gates, at most 83 bands, eight arbitrary wires and no extra helpers. Its emitted zero fiber needs no separate detector. | Jointly synthesize the projective action or change its representation. Enumerating the lines costs exponentially many factors in bank width, and separate recursive levels retain depth contributions. This is a finite native calibration, not an improved general indicator or frame-depth bound. | -| [Full decoder Pauli domain](depth/FIELD_DECODER_PAULI_DOMAIN.md) | At p at least three, absorbed axes must span at least $`2m-2`$ directions below error $`\sqrt2/6`$ with arbitrary Clifford target-helper motion, or below one-third for identity and residual-field helpers. Independent finite cells fail even after joint outer Clifford mixing. | Couple the non-Clifford bands themselves or use the weaker complete-probe contract. The required extensive T count fits the discovery budget and gives no growing depth lower bound. Enlarging the active field and moving Clifford helpers do not remove this rank requirement. | +| [Projective field recoupler](depth/PROJECTIVE_FIELD_RECOUPLER.md) | Exact eight-address decoders retain two allocations: 172 T gates and at most 83 bands without extra helpers, or 148 T gates and at most 39 bands with six returned dirty helpers. A common reflection selector and a private quartic batch pay the latter word, including its zero fiber and actual inverse. | The finite OR selector becomes a growing-degree nonzero predicate, and projective-line enumeration is exponential in bank width. Use the coupled word as a finite calibration; a uniform route must change that enumeration and pay the full return ledger. | +| [Full decoder Pauli domain](depth/FIELD_DECODER_PAULI_DOMAIN.md) | At p at least three, absorbed axes must span at least $`2m-2`$ directions below error $`\sqrt2/6`$ with arbitrary Clifford target-helper motion, or below one-third for identity and residual-field helpers. Independent finite cells fail even after joint outer Clifford mixing. | Extensive T count fits the discovery budget and is not a depth obstruction. The weaker probe contract has its own domain screen below; merely replacing the full endpoint by that contract does not rescue independent cells. | +| [Weak complete-probe domain](depth/WEAK_PROBE_PAULI_DOMAIN.md) | Degree-d Clifford queries restrict image-domain X masks to a Reed--Muller code below error $`2^{-d-1}`$. Full-rank field queries, including Pauli helper queries, force pure-Z kernel masks to be constant below $`1/(3m)`$. Independent four-wire cells have probe-error floor $`1/12`$ for p at least three and $`1/4`$ for p at least five. | Couple the non-Clifford operations or change the domain; arbitrary joint outer Clifford walls and moving decoded helpers do not repair tensor cells. The domain and absorbed-axis bounds do not lower-bound unrestricted native depth. | | [Disjoint-span two-band decoder](depth/TWO_BAND_FIELD_DECODER_OBSTRUCTION.md) | Partial or full bands whose absorbed spans have zero intersection have full-intertwining error at least $`\frac12\sqrt{1-1/\sqrt2}`$ for p at least two, including enlarged sources and arbitrary Clifford target-helper action. Intrinsic two-term Pauli images recover the outer axis list. | An eligible two-band word must exploit actual shared-span collisions; general overlapping bands remain open. A coupled three-band word or a non-Clifford endpoint satisfying only the complete-probe equation also leaves this screen. | | [Scalar-field radical algebra](depth/SCALAR_FIELD_RADICAL_COPY_SCREEN.md) | Algebra-automorphism equivariance forces the shear image to be square-zero for every address embedding at p at least two. The resulting four-address identity gives direct-copy error at least one half or selected-output-dual copy error at least one quarter, with arbitrary identical field banks and fixed helpers. | Leave the associative-algebra realization or the scalar-shear automorphism assumptions. Changed address embeddings, including collision-free product spaces, do not repair this model. Arbitrary Clifford duals, general regular affine groups and non-scalar dressings remain outside the theorem. | | [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. | @@ -85,7 +86,9 @@ Start with a complete interface; consult component families only when the propos | [Two-address interleaved pilot](depth/TWO_ADDRESS_INTERLEAVED_PILOT.md) | Controlled Hadamards realize the complete four-member target algebra with a fixed Clifford decoder and a paid native source and inverse. | Find a uniform complete rule with a better total ledger. Serial controlled-Clifford extension retains the old cost; a finite exact family alone supplies no asymptotic improvement. | | [Non-Clifford seed spread](depth/NONCLIFFORD_SEED_SPREAD.md) | A bounded number of affine Clifford queries requires an exponentially broad seed Pauli-label span at fixed error, even with arbitrary fixed decoding. Native seed T count bounds that span. The extensive two-band tensor seed survives, while its plain local inverse decoder fails for the tree family. | Use extensive nonlinear structure and a jointly designed nonlocal decoder, or leave the orbit grammar. Neither seed count nor query count alone bounds native depth. | | [Field-shear intertwiner](depth/FIELD_SHEAR_INTERTWINER.md) | The paid query has the full lookup character. Monomial/Clifford decoders and a preserved physical Bell zero fiber fail. An exact seed diagonal in any query-invariant stabilizer basis fails at p at least two, even with arbitrary helpers and a non-Clifford decoder. | Jointly design a seed outside those preserved diagonal algebras and its physical decoder or encoded copy companion. Exact output-probe gauge freedom cancels from the seed; source-centralizer freedom and a changed pencil remain possible. A zero-branch basis repair alone cannot work. | -| [Recursive field-shear decoder](depth/RECURSIVE_FIELD_SHEAR_DECODER.md) | An exact all-size recursive intertwiner includes every zero sector, with paid dense queries and multiplication-XOR batches. Literal level-by-level synthesis requires at least p minus one T bands; read-only affine-query factoring of a recoupling cell also has growing degree. | Jointly compile across levels or change the decoder/source mechanism. Faster isolated cells do not meet the discovery depth target; in-place nonlinear maps and returned work remain unpaid. These are scoped implementation limits, not general native-depth bounds. | +| [Recursive field-shear decoder](depth/RECURSIVE_FIELD_SHEAR_DECODER.md) | The identity-helper algebraic decoder includes every zero sector, with paid dense queries and multiplication-XOR batches but unpaid uniform in-place coordinate maps. Separately implemented levels retain a depth contribution. | The augmented source below changes the helper query and pays a different uniform decoder. Neither its linear stage count nor a faster isolated arithmetic call meets the sublogarithmic-depth target. | +| [Augmented field recoupler](depth/AUGMENTED_FIELD_RECOUPLER.md) | An explicit moving Pauli helper query permits two native multiplication-XOR batches per level, shared helpers, and complete readout return. The decoder uses at most $`16(p-1)`$ bands; the direct indicator uses at most $`64(p-1)+16`$, with $`O(mp^3)`$ T count, $`O(mp^2)`$ dirty width and $`O(m^2p^2)`$ gates. | The specific relaxed fusion budgets are paid, but depth remains linear in p. Compress the complete source across levels while retaining the source helper query and every actual inverse; omitting that query breaks the identity. | +| [Clifford-sector degree barrier](depth/FIELD_SECTOR_DEGREE_BARRIER.md) | A linear Pauli helper query needs shift rank at least $`p-1`$ for a Clifford-sector field intertwiner. Its helper-dependent symplectic matrix has degree at least $`p-1`$, including moving Clifford core spectators. The augmented construction attains that degree. | A fixed helper frame with helper-affine symplectic stages needs at least $`p-1`$ stages. Leave that grammar through paid helper motion or non-Clifford sector intermediates, or use only the weaker complete-probe endpoint. This is not a native T-depth lower bound for unrestricted circuits. | | [Clique polarization and joint integration](depth/COHERENT_CENTRAL_TRANSPORT.md#clique-polarization-integration) | Desired and cheap transports have the same 32-band polarization; their ratio is the unpaid coherent zeta homomorphism. Direct and central half-Gram query costs are sharply floor(p/2) and ceiling(floor(p/2)/2), even with orbit-diagonal phases and controlled work. Fixed-first-argument queries lose the quadratic refinement under character-independent interlayers. | Use nonmonomial native bank dynamics or joint synthesis outside completed polarization queries, or meet only the weaker root-probe interface. These are oracle-query statements, not native-depth bounds; the central half-Gram is not the lookup projector. | | [Joint precision rotation](depth/JOINT_PRECISION_ROTATION.md) | A Clifford image of the actual signal forces unit acceptance below error 2sin(π/16). Separately paid balanced branches admit a direct alternating-word bypass; the paid 3:1 pilot admits a direct branch within 3√ε of the recovered unitary. Cheap joint completion need not supply those branches. | Seek joint synthesis or another accepted-source family with sublinear precision depth and linear count, then pay coherent chart selection and every remaining R96 serial word. The actual-signal premise and branch-resource premise have separate scopes. | | [Parallel weighted-cubic phases](depth/DIRTY_CUBIC_PHASE_COMPILER.md) | An exact thirteen-band compiler pays shared logical controls, arbitrary dirty helpers and actual inverses. It supplies the coefficient-cube parity layers with polynomial overhead and zero clean work. | Use this component inside a separately proved complete source. Its paid schedule does not repair the uniform-angle bipartite sector collision or establish complete lookup. | diff --git a/research/depth/AUGMENTED_FIELD_RECOUPLER.md b/research/depth/AUGMENTED_FIELD_RECOUPLER.md new file mode 100644 index 0000000..8402713 --- /dev/null +++ b/research/depth/AUGMENTED_FIELD_RECOUPLER.md @@ -0,0 +1,313 @@ +# A paid field recoupler with a moving Pauli helper query + +[Recursive tower and multiplication compiler](RECURSIVE_FIELD_SHEAR_DECODER.md) · +[Complete probe readout](BANK_MIXING_AND_LOOKUP_PHASE.md#rank-one-indicator-equivalence) · +[Finite projective allocation](PROJECTIVE_FIELD_RECOUPLER.md) + +An additional, explicitly queried arbitrary helper removes norm division from +the recursive field recoupler. Two multiplication-XOR batches and fixed +Clifford walls give a complete native cell at every field degree, including +the zero sector. All cells at the same recursion level can share one moving +helper register. The complete probe echo returns that register and every +private multiplication mask. + +This constructs the augmented query equivalence stated below. Its current +compiler pays sixteen T bands at each recursive level. The resulting depth +is linear in the number of address bits and does not improve R96 or meet the +sublogarithmic-depth source target. The earlier identity-helper decoder and +its unpaid uniform coordinate maps retain their separate scope. + +## 1. Complete augmented contract and resource statement + +Use the tower, address coefficients and field shear from +[the recursive proof](RECURSIVE_FIELD_SHEAR_DECODER.md#1-a-compatible-tower-and-address-pencil). +For $`p\ge2`$, write $`m=2^p`$, $`k=m/2`$, and + +```math +Q^{(p)}_x|U,V\rangle=|U,V+\beta_p(x)U\rangle, +\qquad U,V\in K_p,\qquad [K_p:\mathbb F_2]=k. +``` + +For every level $`2\le j\le p`$, allocate one arbitrary register +$`T_j\in K_{j-1}`$ of $`\ell_j=2^{j-2}`$ qubits. It is shared by +all cells at that level. Let $`x_{\lt j-1}`$ denote the lowest +$`j-1`$ address bits, and define the literal helper Pauli query + +```math +P_p(x)=\prod_{j=2}^p Z_{T_j}^{\beta_{j-1}(x_{\lt j-1})}, +\qquad +Z_{T_j}^{\lambda}|t\rangle + =(-1)^{\mathrm{Tr}_{K_{j-1}/\mathbb F_2}(\lambda t)}|t\rangle. + \qquad(1) +``` + +There is an exact native decoder $`\widehat E_p`$, acting on the +principal bank and these helpers, such that + +```math +\widehat E_p\bigl(Q^{(p)}_x\otimes P_p(x)\bigr)\widehat E_p^\dagger + =W_x\otimes P_p(x) \qquad(2) +``` + +for every address, with literal phase one. Here $`W_x`$ translates the +physical bank-wire indices by x. Any additional private masks used by the +native word have identity action in (2). All inputs, including the address, +moving helpers, masks and external references, may be arbitrary. + +Put $`c_j=2^{p-j}`$ and + +```math +e_j=\max\{1,\lceil\log_2(2\ell_j-1)\rceil\}=j-1, +\qquad s_j=(2\ell_j-1)e_j^2, +\qquad A_p=\sum_{j=2}^p c_js_j. +``` + +The forward and actual reversed native words obey + +```math +T(\widehat E_p)\le32A_p=O(mp^3),\qquad +D_T(\widehat E_p)\le16(p-1), \qquad(3) +``` +```math +h_{\rm moving}=m/2-1,\qquad +h_{\rm private}\le\max_{2\le j\le p}2c_js_j=O(mp^2), +\qquad G_{\rm all}=O(m^2p^2),\qquad w_{\rm clean}=0. \qquad(4) +``` + +Private masks return after each complete multiplication-XOR batch. The +moving registers need not return under the decoder or the augmented query +alone. Their return in the complete indicator is proved in Section 5. + +## 2. The complete cell without a nonzero promise + +At one level let $`F=K_{j-1}`$, $`K=F[\theta]`$ with +$`\theta^2+\theta+\delta=0`$. Write + +```math +U=d_0+d_1\theta,\qquad +q_0(U)=d_0d_1,\qquad +B(U,a)=d_0a_1+d_1a_0,\qquad a=a_0+a_1\theta. +``` + +For a binary field J write +$`\chi_J(z)=(-1)^{\mathrm{Tr}_{J/\mathbb F_2}(z)}`$. +Introduce one arbitrary $`T\in F`$. For a function f of the principal +coordinates, $`A_f`$ adds f into T and preserves those coordinates. +Use the fixed trace-pairing Fourier transform + +```math +H_{K,\theta}|v\rangle + =|K|^{-1/2}\sum_{a\in K}\chi_K(\theta av)|a\rangle. + \qquad(5) +``` + +This is a literal self-adjoint Clifford involution: multiplication by +$`\theta\ne0`$ preserves nondegeneracy of the symmetric trace pairing. +It acts on arbitrary inputs and requires no prepared Fourier state. + +In Fourier coordinates for V, the field query is the diagonal operator +$`D_{\lambda,b}(U,V)=\chi_K((\lambda+b\theta)UV)`$, where +$`\lambda=\beta_{j-1}(x_{\lt j-1})`$ and $`b\in\mathbb F_2`$. +The chronological cell is + +```math +A_{\mathrm{Tr}_{K/F}(UV)+q_0(U)},\quad +H_{K,\theta},\quad A_{B(U,a)}. +``` + +Its matrix $`C=A_BH_{K,\theta}A_{\mathrm{Tr}(UV)+q_0}`$ +satisfies the complete identity + +```math +C(D_{\lambda,b}\otimes Z_T^\lambda)C^\dagger + =\chi_F\bigl(\lambda[B(U,a)+q_0(U)]\bigr) + X_a^{bU}\otimes Z_T^\lambda. \qquad(6) +``` + +Conjugating the helper Pauli through the first addition contributes +$`\chi_F(\lambda[\mathrm{Tr}_{K/F}(UV)+q_0(U)])`$. +The relative-trace term cancels the lower-address phase of the source. +The remaining $`\chi_K(b\theta UV)`$ becomes the translation +$`X_a^{bU}`$ under (5). Conjugating the helper Pauli through the final +addition contributes $`\chi_F(\lambda B(U,a))`$. This addition +commutes with the translation because + +```math +B(U,a+bU)+B(U,a)=bB(U,U)=0. +``` + +Thus there is no extra helper translation or scalar phase. For $`U=0`$, +both additions are identity and the cell is the specified Fourier transform +on the whole V fiber. Equation (6) still holds, including the helper Pauli. +No zero flag, inverse, division, postselection or discarded column is used. + +Prepend the original $`H_K`$ wall on V. After the cell, replace +$`(U,a)`$ by $`(a,c)=(a,a+U)`$ and apply the original two +$`H_F`$ walls on the second coordinates of a and c. Indeed, + +```math +q_0(a)+q_0(a+U)=B(U,a)+q_0(U), +``` + +so the phase in (6) becomes the two lower field queries. The translation +$`a\mapsto a+U`$ swaps a and c. The resulting recoupler obeys + +```math +\widehat R_j(Q^{(j)}_{(x',b)}\otimes Z_{T_j}^{\beta_{j-1}(x')}) + \widehat R_j^\dagger + = (Q^{(j-1)}_{x'}\otimes Q^{(j-1)}_{x'})S^b + \otimes Z_{T_j}^{\beta_{j-1}(x')}. \qquad(7) +``` + +The base decoder is the retained Clifford $`\widehat E_1=\mathrm{CX}(V;U)`$. +All primitive additions and Fourier transforms are self-inverse; the actual +inverse reverses them and the fixed coordinate walls in their literal order. + +## 3. Sharing the same helper query through every child + +Every recoupler uses its moving helper only through translations. It therefore +commutes with every X on that helper. In the common helper-X basis it is block +diagonal, with a Clifford on its own principal core in each sector: each +addition becomes a Boolean quadratic phase there. + +Two decoders on disjoint principal cores that share the same moving helpers +commute. Their sector blocks act on disjoint cores. The core-only half swap +exchanges two identical child decoders, so their product commutes with that +swap. This reasoning applies to complete ideal blocks; it does not license +rearranging overlapping individual native gates. + +In particular the shared Pauli query is not duplicated. If L and R are the +two child decoders and $`P=P_{j-1}(x')`$, their identities give the successive +conjugations + +```math +Q_LQ_RP\ \xrightarrow{\ R\ }\ Q_LW_RP + \ \xrightarrow{\ L\ }\ W_LW_RP. \qquad(8) +``` + +Each child commutes with the other core's query or translated target. +Equation (8) carries the same single P through both conjugations. The new +$`T_j`$ query commutes with the children, which use only lower-level helpers. +Together with (7) and swap invariance, this proves (2) inductively. +The number of persistent moving helper qubits is +$`\sum_{j=2}^p\ell_j=m/2-1`$. + +## 4. Two simultaneous native batches per level + +The first addition factors into two field products: + +```math +\mathrm{Tr}_{K/F}(UV)+q_0(U) + =d_0(v_1+d_1)+d_1(v_0+v_1). +``` + +The second is $`B(U,a)=d_0a_1+d_1a_0`$. The +[interpolation multiplication-XOR compiler](RECURSIVE_FIELD_SHEAR_DECODER.md#5-a-paid-multiplication-xor-component) +expresses one product over F using at most $`s_j`$ cubic products of +binary linear forms. Each cubic sign has an eight-phase Gray word on one +arbitrary private mask, returning it exactly. All private T targets are +distinct, so an entire batch occupies eight native T bands. + +The first addition's multiplicands may share principal inputs. The parity-cube +identity remains valid for arbitrary Boolean linear forms, including dependent +or overlapping forms: evaluate the same scalar identity at their three bits. +Incorporate the sums $`v_1+d_1`$ and $`v_0+v_1`$ directly into +the mask parity updates. No clean multiplicand or product is loaded. Their +support is at most $`2\ell_j`$, which only changes the Clifford gate bound +by a constant factor. + +At a fixed level all first additions from its $`c_j`$ cells combine +into one XOR into the shared $`T_j`$. Perform every disjoint core Fourier +wall, then combine all second additions. A cell's core Fourier commutes with +the other cells' additions, so this reordered aggregate equals the product +of the complete recouplers. The shared target's Hadamard walls are emitted +once around each aggregate phase batch. + +Each batch has at most $`2c_js_j`$ private masks and $`16c_js_j`$ T gates. +Two batches give sixteen bands and $`32c_js_j`$ T gates per level. +The mask pool can be reused only after the preceding complete batch returns +it. Summing proves (3)--(4). A term's eight parity updates touch at most +$`2\ell_j`$ principal controls each. Their total Clifford cost is +$`O(\sum_j c_js_j\ell_j)=O(m^2p^2)`$. The fixed field-basis, +Fourier and coordinate walls cost $`O(\sum_jc_j\ell_j^2+m)`$ and +are included. Reversing the emitted native word preserves these budgets. + +## 5. Complete readout, precision and the remaining depth obligation + +The coherent helper query (1) is Clifford. Each coefficient is binary-linear +in the address, so its phase is a fixed bilinear form between the address +and helper bits, implementable with CZ gates. It costs no T gates and +$`O(mp)`$ elementary gates. It must be emitted together with the +[eight-band coherent field query](RECURSIVE_FIELD_SHEAR_DECODER.md#an-eight-band-query-for-any-binary-multiplication-matrices), +whose T count and returned-mask requirement are $`8kp`$ and $`kp`$. + +Let $`S_x=\widehat E_p(Q^{(p)}_x\otimes P_p(x))\widehat E_p^\dagger`$. +Then + +```math +S_x(Z_{Y_0}\otimes I)S_x^\dagger=Z_{Y_x}\otimes I. \qquad(9) +``` + +Conjugating (9) by ordinary Hadamards on the bank gives the complete dirty +indicator $`|x,Y,w\rangle\mapsto|x,Y\oplus e_x,w\rangle`$. +The helper query cancels in this actual source/probe/adjoint echo. Every +moving helper, every private mask and every external reference is included; +the assertion is an operator identity, not a check on initialized work. + +The direct indicator uses four decoder or actual-adjoint words and two field +queries. Reusing returned private masks between complete calls gives + +```math +T(I_p)\le128A_p+16kp,\qquad +D_T(I_p)\le64(p-1)+16, \qquad(10) +``` +```math +h(I_p)\le m/2-1+\max\{kp,\max_j2c_js_j\},\qquad +G_{\rm all}(I_p)=O(m^2p^2),\qquad w_{\rm clean}=0. \qquad(11) +``` + +The query's private-mask pool is included even when it exceeds the decoder's +pool. All identities and primitives are exact; no tolerance allocation or +precision-state preparation is hidden in these budgets. + +The counts have the specific relaxed discovery form +$`T,h=m\mathrm{poly}(p)`$ and +$`G=m^2\mathrm{poly}(p)`$ used by +[polynomial-overhead fusion](POLYNOMIAL_OVERHEAD_INDICATOR_FUSION.md). +That transfer reduces the source address by $`O(\log p)`$ bits; it does +not turn the present $`O(p)`$ source depth into the required +$`o(\log(p+2))`$. These resource statements make the uniform construction +explicit without supplying a new frame-depth theorem. + +In helper-X coordinates the decoder sectors satisfy the Clifford cocycle +$`E_{r+\Lambda x}Q_x=W_xE_r`$. A generic formula using controlled wire +translations can hide the barrel-shift cost. The present word pays every +recursive stage explicitly; sharing helpers reduces width without removing +the principal-core dependency between levels. The [sector-degree theorem](FIELD_SECTOR_DEGREE_BARRIER.md) +requires helper-tableau degree at least $`p-1`$ and proves that this construction +attains it. A bounded number of helper-affine stages in one fixed helper frame +cannot implement the full decoder. A faster joint native word must leave that +stage grammar while preserving the complete return contract. + +The source is $`Q_p\otimes P_p`$, not $`Q_p\otimes I`$. Its helper +Paulis can acquire signs under conjugation even when their binary labels +are fixed. Results requiring a literally fixed source Pauli space need their +hypotheses checked before application to this augmented family. +The [weak-probe domain theorem](WEAK_PROBE_PAULI_DOMAIN.md#field-query-and-pauli-helpers) +explicitly includes these Pauli helper phases and keeps the label/sign distinction. + +## 6. Exact finite evidence + +`tests/test_augmented_field_recoupler.py` verifies the two-product identity, +the full zero fiber, and a native eight-band aggregate with overlapping forms, +a shared target and arbitrary returned private masks. A complete four-address +native decoder is checked on every one of its seven-wire columns, including +all four private-mask basis values and the actual native inverse. + +The independent computational-helper-basis evaluator checks every column of +the algebraic decoder for two and three address bits, all addresses and all +reversed algebraic-word columns. This includes all 2,080 principal/helper +columns and 16,512 address-column comparisons. A negative calibration shows +that omitting the moving Pauli query changes the action; the complete probe +echo cancels it exactly. The finite fixture does not replace the all-size +native composition proof above or claim an improved general depth frontier. diff --git a/research/depth/ENCODED_DIRTY_COPY_INTERFACE.md b/research/depth/ENCODED_DIRTY_COPY_INTERFACE.md index 0fa12f9..70a3e26 100644 --- a/research/depth/ENCODED_DIRTY_COPY_INTERFACE.md +++ b/research/depth/ENCODED_DIRTY_COPY_INTERFACE.md @@ -174,6 +174,13 @@ the seed. Right multiplication by a unitary commuting with every $`Q_x`$ can change that source family. Neither freedom supplies the native copy in (2). +The [weak-probe domain theorem](WEAK_PROBE_PAULI_DOMAIN.md) restricts a +decoder used only for the complete one-probe relation, including Pauli +source-helper queries. Independent finite cells cannot be repaired by outer +Clifford mixing alone. The [augmented recoupler](AUGMENTED_FIELD_RECOUPLER.md) +does pay a different all-size source and complete probe echo, but retains +linear depth; it does not supply a shallow jointly encoded copy interaction. + ## 4. A Clifford copy has a uniform error floor Let R be any Hermitian involution on the full carrier, including any diff --git a/research/depth/FIELD_DECODER_PAULI_DOMAIN.md b/research/depth/FIELD_DECODER_PAULI_DOMAIN.md index 39272ea..29fcfe9 100644 --- a/research/depth/FIELD_DECODER_PAULI_DOMAIN.md +++ b/research/depth/FIELD_DECODER_PAULI_DOMAIN.md @@ -12,6 +12,10 @@ decoded helper register has an arbitrary Clifford action. The conclusion concerns axis rank and T count. It gives no growing T-depth bound and does not apply to a decoder constrained only on one physical probe. +That weaker contract has a separate [Pauli-domain theorem](WEAK_PROBE_PAULI_DOMAIN.md): +independent four-wire cells still fail at fixed error after arbitrary joint +outer Clifford walls. Its proof also permits projectively additive Pauli +source-helper queries, including the augmented recoupler's moving helpers. In particular it does not improve R96 or pay an all-size decoder. diff --git a/research/depth/FIELD_SECTOR_DEGREE_BARRIER.md b/research/depth/FIELD_SECTOR_DEGREE_BARRIER.md new file mode 100644 index 0000000..eea0da7 --- /dev/null +++ b/research/depth/FIELD_SECTOR_DEGREE_BARRIER.md @@ -0,0 +1,283 @@ +# A degree barrier for Clifford sectors of augmented field decoders + +The [moving-helper recoupler](AUGMENTED_FIELD_RECOUPLER.md) makes every recursive stage a Clifford in a +fixed helper-X sector. This gives a useful compilation interface, but does +not allow all stages to be collected into a bounded number of batches whose +sector symplectic matrices depend affinely on the helper characters. Their +required degree grows with the address length. + +The result concerns the complete query-intertwining equation and a specified +helper-sector model. It is not a lower bound on unrestricted native T depth, +on the weaker complete-probe contract, or on a compiler whose intermediate +operations leave that model. + +## 1. Complete contract and conclusions + +Let $`G=\mathbb F_2^p`$, $`p\ge2`$, and $`m=2^p`$. The principal core consists +of an m-wire bank and q further arbitrary qubits. Let $`Q_x`$ be Clifford +queries on this whole core whose binary symplectic matrices have the form + +```math +F_x=I+N_x,\qquad N_{x+y}=N_x+N_y,\qquad N_xN_y=0 +\quad(x,y\in G). +``` + +The field shear, with any additional identity or Pauli-dressed core helpers, +has this square-zero label action. Literal query phases do not enter the +argument. In particular $`F_x^{-1}=F_x`$. + +Let $`W_x`$ translate the bank wires by x. The target core query is +$`T_x=W_x\otimes R_x`$, where each $`R_x`$ is any fixed Clifford on the q +remaining core qubits, independent of helper-sector coordinates. Its +symplectic matrix is $`V_x`$. Write $`\Pi_x e_z=e_{z+x}`$ for the binary +wire-index permutation, so its bank block is $`\Pi_x\oplus\Pi_x`$. No restriction to identity decoded core helpers +is needed. + +There is also an h-qubit sector-helper register. In its common X basis, +indexed by $`r\in\mathbb F_2^h`$, the helper query acts as + +```math +P_x|r_X\rangle=\gamma_x(r)|(r+\Lambda x)_X\rangle, +\qquad |\gamma_x(r)|=1, +``` + +for one fixed binary linear map $`\Lambda:G\to\mathbb F_2^h`$. The retained +augmented construction uses a Pauli Z query, so $`\gamma_x(r)=1`$; the proof +also allows the scalar phases of a general Pauli query. + +Assume the candidate decoder fixes every helper-X sector and has +Clifford core blocks: + +```math +E=\sum_r |r_X\rangle\langle r_X|\otimes E_r, +``` + +where each $`E_r`$ is a Clifford up to an arbitrary scalar phase. Let $`M(r)`$ +be its binary symplectic matrix. Suppose the complete operator error obeys + +```math +\eta=\max_x\left\| + E(Q_x\otimes P_x)E^\dagger-T_x\otimes P_x +\right\|_{\rm op}\lt \frac1{\sqrt2}. +``` + +All inputs, including the sector helpers and reference systems, are arbitrary. +Then: + +1. $`\mathrm{rank}\Lambda\ge p-1`$, so at least p-1 independent helper + shift coordinates are necessary in this model. +2. The maximum Boolean algebraic degree among the entries of $`M(r)`$ is at + least p-1. +3. If $`\mathrm{rank}\Lambda=p-1`$, the restriction to **every** active + helper coset has degree exactly p-1. Arbitrary dependence on the invariant + helper coordinates is allowed. +4. A factorization into k stages with helper-affine core symplectic matrices, + with arbitrary constant core Clifford walls, requires $`k\ge p-1`$. + +Here degree means the unique square-free algebraic normal form over +$`\mathbb F_2`$. It concerns symplectic labels, not the scalar or Pauli-sign +functions of a Clifford tableau. The radius is sufficient and is not claimed +to be optimal. + +## 2. Constant-error rounding gives an exact symplectic cocycle + +At helper input r, both sides of the comparison shift the helper to +$`r+\Lambda x`$ with the same scalar $`\gamma_x(r)`$. Thus the full operator +norm is the maximum norm over these blocks, and + +```math +\|E_{r+\Lambda x}Q_xE_r^\dagger-T_x\|_{\rm op}\le\eta. +``` + +Both unitaries in this comparison are Cliffords up to scalar phase. For any +Hermitian Pauli A, their conjugated Pauli images differ by at most +$`2\eta\lt \sqrt2`$. Distinct signed Hermitian Paulis have operator distance +at least $`\sqrt2`$. Their Pauli actions therefore agree exactly. The scalar +phases of the sector blocks need not agree, and are not discarded from the +operator-error premise; they simply cancel in this conjugation argument. + +Taking binary labels gives the exact identity + +```math +M(r+\Lambda x)F_x=V_xM(r),\qquad +M(r+\Lambda x)=V_xM(r)F_x. \qquad(1) +``` + +No approximate invariance or continuity of the discrete Clifford labels is +assumed. The discrete Pauli gap supplies it. + +## 3. The helper shift needs rank at least p-1 + +If $`\ker\Lambda`$ contained independent b,c, equation (1) in any fixed +sector would imply + +```math +M(r)N_b=(V_b-I)M(r),\qquad +M(r)N_c=(V_c-I)M(r). +``` + +Since $`N_bN_c=0`$ and $`M(r)`$ is invertible, it would follow that +$`(V_b-I)(V_c-I)=0`$. Its bank block is nonzero: on a coordinate vector +it produces the sum of the four distinct coordinates indexed by +$`z,z+b,z+c,z+b+c`$. Thus $`\dim\ker\Lambda\le1`$, proving the rank bound. +Any decoded residual Clifford block is irrelevant to this nonzero bank block. + +## 4. A one-dimensional kernel forces a top-degree coefficient + +First suppose $`\mathrm{rank}\Lambda=p-1`$. Let b span its kernel, +and choose a complementary subspace $`H\subset G`$ of dimension p-1. For +arbitrary base sector r, use coordinates on H to parametrize the active +helper coset $`r+\Lambda H`$. Its top algebraic-normal-form coefficient is + +```math +C_r=\sum_{t\in H}M(r+\Lambda t). +``` + +All sums and products in this section are binary. The square-zero source +action gives $`F_tN_b=N_b`$, and equation (1) for b gives +$`M(r)N_b=(V_b-I)M(r)`$. Therefore + +```math +C_rN_b + =\sum_{t\in H}V_tM(r)F_tN_b + =\left[\sum_{t\in H}V_t(V_b-I)\right]M(r). \qquad(2) +``` + +The bank block inside brackets is + +```math +\sum_{t\in H}\Pi_t(\Pi_b-I)=\sum_{x\in G}\Pi_x=J_m, +``` + +on both X and Z labels, where $`J_m`$ is the nonzero all-ones matrix. Hence +the bracketed matrix is nonzero, even with arbitrary decoded residual core +helpers. Right multiplication by the invertible $`M(r)`$ cannot make it zero. +Thus $`C_rN_b\ne0`$, and in particular $`C_r\ne0`$. + +There are p-1 active variables, so this proves degree exactly p-1 on every +active coset. It is a nonzero matrix coefficient, not a conclusion drawn +from a few entries or a sampled set of helper characters. + +For the identity-residual target, (2) is the particularly simple witness + +```math +C_rN_b=(J_m\oplus J_m\oplus0)M(r). \qquad(3) +``` + +## 5. Giving every address bit a helper shift does not remove the floor + +The only other possible rank is $`\mathrm{rank}\Lambda=p`$. Restrict +to a full p-dimensional active helper coset. Rearranging (1) gives + +```math +V_x=M(r+\Lambda x)F_xM(r)^{-1}. \qquad(4) +``` + +An entry of the regular bank-translation matrix is the indicator of one +address value, whose Boolean degree is exactly p. Consequently +$`\deg V_x=p`$. The source matrix is affine in x and the rightmost matrix +in (4) is constant. If the restricted degree of M were d, the right side +would have degree at most d+1. Thus $`d\ge p-1`$. + +This case supplies a lower bound, not an assertion that every such decoder +has degree exactly p-1. Extra invariant helper coordinates and arbitrary +commutant choices cannot evade either case of the argument. + +## 6. Consequence for jointly compiled affine stages + +Suppose a proposed compilation factors its sector symplectic matrices as + +```math +M(r)=C_k A_k(r)C_{k-1}\cdots A_1(r)C_0, +\qquad \deg A_j\le1, +``` + +with constant invertible symplectic matrices $`C_j`$. Every entry of the +product has degree at most k. The preceding theorem therefore forces +$`k\ge p-1`$. + +Fixed affine reparametrizations of helper characters preserve Boolean degree. +They can also be inserted between stages: pull the fixed helper permutations +through the factorization and substitute the corresponding affine coordinates +in the following stages. Constant invertible core Clifford walls preserve +the maximum matrix degree as well. Arbitrary joint core/helper Clifford walls +need not preserve the chosen helper-sector algebra and are outside this model. + +For example, one batch of phases that are helper-linear and quadratic in +core bits, in one fixed Clifford frame, has a helper-affine sector symplectic +matrix. It cannot implement this complete decoder from p=3 onward. A bounded +number of such stages cannot implement the family at growing p. + +This is a stage-count statement for this compilation interface. A native +T band need not preserve the helper-X algebra or be a Clifford in every +sector. Conversely, a stage with a high-degree helper predicate need not +have an affine symplectic matrix. Neither possibility is excluded here. +The theorem gives no unrestricted native T-depth lower bound. + +An explicit escape from an overbroad stage count is a reversible helper +Toffoli $`(r_0,r_1,r_2)\mapsto(r_0,r_1,r_2+r_0r_1)`$, followed by one core +Clifford shear controlled by the current third helper bit, followed by the +same helper Toffoli. The helpers return, but the completed sector matrix is +$`I+(r_2+r_0r_1)N`$, of degree two, despite only one affine core stage. +The nonlinear helper motion carries the additional degree and must be paid. +This does not construct a decoder for the present query family. + +More generally, if the current helper coordinates at core stage i have +Boolean degree at most $`\Delta_i`$ and that stage has matrix degree at most +$`a_i`$ in those coordinates, then the final matrix degree is at most +$`\sum_i a_i\Delta_i`$. The coordinate degree is bounded by the product of +the degrees of preceding helper permutations. Thus bounded-degree nonlinear +helper stages can change the stage-count law, but cannot be counted as free +fixed Clifford walls. This bookkeeping remains within a classical helper +permutation and Clifford-core-stage model. + +## 7. The augmented construction reaches the degree floor + +In one recursion cell, let its helper character be $`\rho\in F`$. The +complete cell identity holds for every lower field parameter, not just the +chosen address subspace. At upper address bit zero it gives + +```math +R_\rho=A_\rho R_0Q_\rho, +\qquad A_\rho=Q_{p-1}(\rho)\otimes Q_{p-1}(\rho). \qquad(5) +``` + +Use trace-F coordinates for both X and Z labels. The two field shears have +symplectic matrices $`I+\rho A`$ and $`I+\rho B`$ for constant F-linear +matrices A,B. The zero-character recoupler has an F-linear symplectic matrix +$`M_0`$: its coordinate changes and fixed trace-Fourier transforms are all +F-linear on these Pauli coordinates. Thus + +```math +M_\rho + =M_0+\rho(AM_0+M_0B)+\rho^2 AM_0B. \qquad(6) +``` + +Both $`\rho\mapsto\rho`$ and $`\rho\mapsto\rho^2`$ are binary-linear. +Therefore this complete cell's binary symplectic matrix is helper-affine. +Parallel cells sharing the same level helper give a block-diagonal affine +matrix. There are p-1 levels, so the whole augmented decoder has degree at +most p-1. Its helper-shift rank is p-1; the lower bound proves degree exactly +p-1, uniformly. + +Equation (6) concerns Pauli labels. Literal Pauli signs and overall sector +phases remain owned by the full augmented operator identity and its actual +inverse proof. The positive native ledger still pays sixteen T bands per +level; the degree theorem does not prove that this constant is optimal. + +## 8. Verification and next operation + +The [degree fixtures](../../tests/test_field_sector_degree.py) check the square-zero source against regular +translation derivatives, the robust signed-Pauli gap and scalar-phase caveat, +the active-coset coefficient identity, and the helper-affine local stages. +The [symbolic tableau fixtures](../../tests/test_field_sector_tableaux.py) separately retain signed conjugations, +actual inverses and cocycles at bounded sizes. + +A successful improvement must change the compilation interface: for example, +use higher-degree sector stages with a genuinely cheaper complete native +implementation, move the helper algebra during synthesis, or allow non-Clifford +intermediate sectors. Each remains an open operation, with the entire native +word, actual adjoint and arbitrary-helper return still to be paid. The allowed +fusion overhead remains $`T,w=2^p\mathrm{poly}(p)`$ and +$`G=4^p\mathrm{poly}(p)`$, rather than arbitrary higher powers of $`2^p`$. +No improved general frame bound follows from this representation barrier. diff --git a/research/depth/FLAT_FIELD_BANK_PILOT.md b/research/depth/FLAT_FIELD_BANK_PILOT.md index 9d6c75c..f69429d 100644 --- a/research/depth/FLAT_FIELD_BANK_PILOT.md +++ b/research/depth/FLAT_FIELD_BANK_PILOT.md @@ -452,3 +452,9 @@ even after arbitrary joint outer Clifford walls. The separate error floor when the two absorbed spans have zero intersection, including partial bands. Neither statement excludes a coupled three-band decoder or the weaker complete-probe contract. + +For that weaker contract, the separate [probe-domain theorem](WEAK_PROBE_PAULI_DOMAIN.md) +now gives independent four-wire cells an error floor of $`1/12`$ for +$`p\ge3`$ and $`1/4`$ for $`p\ge5`$, even with arbitrary joint outer +Clifford walls. The positive four-address cell saturates its exact domain +bound; the failure concerns its uncoupled extension, not this finite word. diff --git a/research/depth/PROJECTIVE_FIELD_RECOUPLER.md b/research/depth/PROJECTIVE_FIELD_RECOUPLER.md index a77627a..e85f856 100644 --- a/research/depth/PROJECTIVE_FIELD_RECOUPLER.md +++ b/research/depth/PROJECTIVE_FIELD_RECOUPLER.md @@ -15,6 +15,11 @@ calibration of the recursive construction. Enumerating the projective lines is exponential in bank width, so the construction does not improve R96 or supply the uniform depth bound required by the frame transfer. +[Section 6](#coupled-six-helper-allocation) gives a second complete allocation: +148 T gates in at most 39 bands, with six additional returned arbitrary helpers. +It preserves the zero-extra-helper allocation below as a distinct width/depth +tradeoff; neither finite construction is a uniform source-depth improvement. + ## 1. Homogeneity of the complete conditional cell @@ -260,3 +265,202 @@ at each level. The useful new target is the joint projective-line action in must compress these factors or change their representation while retaining the full operator identity and paid work return. Neither a constant-depth source nor a new frame-depth theorem is established here. + + + +## 6. Coupled reflections and a six-helper allocation + +The four projective corrections can share one reflection selector. Their six +displacement terms can also occupy one private-helper phase batch. Both changes +retain the complete literal operator, with a newly specified zero fiber. + +### 6.1 One common reflection, with its selector phase paid + +Use the same Hermitian Pauli labels and reflection (8), and abbreviate + +```math +\begin{aligned} +J_A&=J(19,50;32),\\ +J_{B,64}&=J(156,228;64),& J_{B,112}&=J(156,228;112),\\ +J_{C,44}&=J(89,247;44),& J_{C,87}&=J(89,247;87). +\end{aligned} +``` + +The following signed identities are exact: + +```math +\begin{aligned} +C_4C_1^\dagger&=J_{B,112}J_A,& +C_5C_1^\dagger&=J_AJ_{B,64},\\ +C_6C_1^\dagger&=J_AJ_{C,44},& +C_7C_1^\dagger&=-J_{C,87}J_A. \qquad(10) +\end{aligned} +``` + +In the third identity, changing the earlier C-reflection probe to 44 permits +the same A-reflection with probe 32 in every row. These identities follow by +multiplying the signed Pauli matrices; the fixture independently compares them +with the field trace-Fourier matrices. Every J is a Hermitian Clifford +involution, with the same independent commuting-axis premises as in Section 4. + +Let $`f_D(U)`$ indicate the line represented by D, including its zero point. +Write the four binary U coordinates as $`u_0,u_1,u_2,u_3`$. Their common selector is + +```math +g(U)=\bigoplus_{D=4}^7 f_D(U)=u_2\lor u_3. \qquad(11) +``` + +For nonzero U exactly one nonbaseline line is selected, or none on the baseline +line. At zero all four line predicates are one, and g is zero. Emit the line-5 +B reflection and line-6 C reflection first, the common A reflection next, then +the line-4 B and line-7 C reflections. On every nonzero line this chronological +order selects exactly the required pair in (10). + +The common A selector needs its literal relative phase. For $`P=P_{32}`$, +which is the single physical $`Z_{V_1}`$, one has + +```math +(iP)^{u_2}(iP)^{u_3}(-iP)^{u_2u_3} + =i^{u_2\lor u_3}P^{u_2\lor u_3}. \qquad(12) +``` + +The first two factors are Clifford controlled-iP words. The last is a +Clifford-conjugated four-T relative Toffoli. Conjugation by the common two-T +preparation from Section 4 produces $`i^gJ_A^g`$, at eight T gates in four +bands. Each of the four remaining selected reflections costs the same eight +T gates and four bands and contributes $`(-i)^{f_D}`$. A CZ in the line-7 +coordinates supplies its required $`(-1)^{f_7}`$ sign. Thus, on nonzero U, + +```math +i^g(-i)^{\sum_{D=4}^7f_D}=1. \qquad(13) +``` + +The linear corrections therefore cost **40 T gates in 20 bands**. All line +coordinate changes and their actual inverses are included. On the entire +zero fiber the chosen linear cell is the fixed Clifford + +```math +-J_{C,87}J_{B,112}J_{C,44}J_{B,64}C_1. \qquad(14) +``` + +The four relative phases multiply to one there; the minus sign in (14) comes +from the line-7 CZ. Section 2 proves that this full zero-sector action is +permitted. No zero column or scalar sign is discarded. + + + +### 6.2 Sixteen-band quartic batching with arbitrary private helpers + +The [R91 private-mask word](DIRTY_CUBIC_PHASE_COMPILER.md) gives +$`F(a,b;h)=(-i)^{ab}Z_h^{ab}`$ using four T gates on an arbitrary private +helper h. Its affine version is useful here. Write +$`a=\ell_a\oplus\kappa_a`$, $`b=\ell_b\oplus\kappa_b`$, with binary +linear forms $`\ell_a,\ell_b`$ that do not involve h. Visit helper parity +vertices $`0,\ell_a,\ell_a\oplus\ell_b,\ell_b`$ and return to zero. +At the vertex indexed by a subset J of the two forms, use T with orientation +$`(-1)^{|J|+\sum_{j\in J}\kappa_j}`$. The resulting literal operator is + +```math +\widetilde F(a,b;h) + =i^{\kappa_a\kappa_b}(-i)^{ab}Z_h^{ab}. \qquad(15) +``` + +The scalar factor in (15) is essential: it is the constant term of the affine +finite difference. Equivalently, the T-phase exponent is +$`2\kappa_a\kappa_b-2ab+4hab`$ modulo eight. This identity permits repeated, +dependent, overlapping and constant affine forms, without a clean assumption. + +Set $`U=\widetilde F(a,b;h)`$ and +$`V=H_h\widetilde F(c,d;h)H_h`$. The same chronological commutator as in (7) +gives + +```math +V^\dagger U^\dagger VU=(-1)^{abcd}I_h. \qquad(16) +``` + +Both affine scalar factors cancel against their actual inverses. Assign a +distinct private helper to each of Q quartic terms and run corresponding +Gray-vertex T gates in parallel. All T targets in a band are distinct; +principal-to-helper parity CNOTs leave the principal inputs unchanged. +Shared principal controls therefore cause no interference between helper +actions. For L equal to the sum of the four linear support sizes over all +terms, the forward and actual-inverse bounds are + +```math +T=16Q,\qquad D_T\le16,\qquad G=20Q+4L, +\qquad b_{\rm dirty}=Q,\qquad b_{\rm clean}=0. \qquad(17) +``` + +The gate count includes sixteen T gates and four Hadamards per helper, plus +four visits to each linear support. Both values of every helper have scalar +identity action in (16), so the return identity also holds for arbitrary +helper entanglement and external references. This parallel allocation uses +private masks instead of the compact eight-band logical borrow in Section 3. + +For the p=3 displacement, encode an affine form by its binary mask and constant. +U occupies bits 0 through 3, and Fourier-V occupies bits 4 through 7. The six +quartic products are specified by the following four-form rows: + +| Term | First form | Second form | Third form | Fourth form | +| --- | --- | --- | --- | --- | +| 1 | (15, 1) | (5, 1) | (4, 0) | (16, 0) | +| 2 | (15, 1) | (5, 1) | (8, 0) | (32, 0) | +| 3 | (14, 1) | (7, 1) | (13, 0) | (144, 0) | +| 4 | (14, 1) | (7, 1) | (6, 0) | (224, 0) | +| 5 | (6, 1) | (11, 1) | (15, 0) | (160, 0) | +| 6 | (6, 1) | (11, 1) | (5, 0) | (240, 0) | + +These are the two binary zero predicates for each of the three nonzero-shift +lines, its scalar coordinate, and its Fourier-V displacement pairing. Their +linear supports sum to L=60. The phase batch has 96 T gates, 16 bands and +360 total gates. Hadamard walls on all four V coordinates convert it into +the complete XOR displacement, giving **368 total gates** in either direction. + +All displacements can be moved after the coupled linear word: at nonzero U +only one line is active, while at U=0 every displacement vanishes. Thus this +reordering also retains the specified zero fiber. Six arbitrary helpers at +physical wires 8 through 13 suffice and return literally. + +### 6.3 Complete allocation and its verification + +Including the original Fourier/coordinate walls and the two parallel full +four-address intertwiners gives the following second allocation: + +| Complete native word | T count | T bands | Forward total gates | Actual inverse gates | Physical wires | Extra helpers | +| --- | ---: | ---: | ---: | ---: | ---: | ---: | +| Coupled $`\widehat R_3`$ | 136 | 36 | 980 | 984 | 14 | 6 | +| Coupled $`\widehat E_3`$ | 148 | 39 | 1,110 | 1,166 | 14 | 6 | + +Both words have zero approximation error and zero clean inputs. The actual +inverse reverses the entire word, including the zero-cell Clifford and private +helper batches. Its elementary-gate count is kept distinct because the native +alphabet emits S-dagger with positive S powers. The complete identity is + +```math +\widehat E_3(Q_x^{(3)}\otimes I_6)\widehat E_3^\dagger + =W_x\otimes I_6. \qquad(18) +``` + +The [coupled native fixture](../../tests/test_coupled_projective_recoupler.py) +checks the literal affine constant in (15), all five-wire quartic columns and +actual inverses with affine shifts, and all 3,072 private-helper sector matrices +for the six-term batch. The latter checks both columns of each helper for every +principal input and both actual orientations; tensor independence proves the +complete fourteen-wire identity without constructing a dense matrix of that +size. Independent field and signed-Pauli formulas check (10), all 240 nonzero +linear-cell columns, and every zero-cell column in (14). Integer arithmetic in +$`\mathbb Z[\omega]/2^d`$ then checks every complete logical column, both actual +inverses, all eight addresses in (18), and every physical T-band target list. + +This does not replace the 172-T, 83-band zero-extra-helper allocation. At a +general field size the common selector is the nonzero predicate on +$`\dim_{\mathbb F_2}F=m/4`$ binary coordinates, with that growing Boolean degree. +The finite two-bit OR in (11) does not pay it at bounded depth, and the line +list remains exponential. Coupling the recursive levels still requires a +separate uniform construction within the stated budgets. + +The [augmented recoupler](AUGMENTED_FIELD_RECOUPLER.md) supplies such an +all-size native cell after explicitly changing the helper query. It retains +linear depth across levels; the [sector-degree theorem](FIELD_SECTOR_DEGREE_BARRIER.md) +limits compression by fixed-frame helper-affine stages. Neither result +changes the two identity-helper finite allocations established here. diff --git a/research/depth/RECURSIVE_FIELD_SHEAR_DECODER.md b/research/depth/RECURSIVE_FIELD_SHEAR_DECODER.md index b8c1512..038bfa8 100644 --- a/research/depth/RECURSIVE_FIELD_SHEAR_DECODER.md +++ b/research/depth/RECURSIVE_FIELD_SHEAR_DECODER.md @@ -20,9 +20,17 @@ dense multiplication matrices of a field tower. R96 is unchanged. The later [projective recoupler](PROJECTIVE_FIELD_RECOUPLER.md) jointly compiles the two conditional coordinate maps at p equal to three, with a different allowed zero fiber. Its full eight-wire decoder costs 172 T gates in at most -83 bands and has no extra helper. The projective identity is general, but -enumerating its fibers grows exponentially in bank width; the uniform native -obligation and the separate-level depth limitation below remain. +83 bands without extra helpers, or 148 T gates in at most 39 bands with six +returned dirty helpers. Projective-fiber enumeration remains exponential. + +The [augmented recoupler](AUGMENTED_FIELD_RECOUPLER.md) instead includes a +moving Pauli helper query on both sides. It pays a uniform native decoder +with two multiplication-XOR batches per level and a complete returned-helper +indicator echo. Its depth remains linear in p. This changes the query +representation; it does not pay the identity-helper coordinate maps below. +The [sector-degree barrier](FIELD_SECTOR_DEGREE_BARRIER.md) explains why +helper-affine stages in a fixed helper frame cannot compress to a bounded +number, while leaving unrestricted joint native words outside that screen. ## 1. A compatible tower and address pencil diff --git a/research/depth/WEAK_PROBE_PAULI_DOMAIN.md b/research/depth/WEAK_PROBE_PAULI_DOMAIN.md new file mode 100644 index 0000000..3033481 --- /dev/null +++ b/research/depth/WEAK_PROBE_PAULI_DOMAIN.md @@ -0,0 +1,386 @@ +# Pauli-domain bounds for a weak complete-probe decoder + +[Full-decoder restriction](FIELD_DECODER_PAULI_DOMAIN.md) · +[Four-address native cell](FLAT_FIELD_BANK_PILOT.md) · +[Recursive field query](RECURSIVE_FIELD_SHEAR_DECODER.md) + +A decoder that transports just one physical probe already has a restricted +Pauli domain. For affine Clifford queries, its image-domain bank X masks +must be affine functions of the address below complete probe error +one-quarter. A full-rank field query gives a stronger restriction on pure +bank Z masks. Together these facts give independent copies of the retained +four-wire cell an error floor of one-twelfth from three address bits onward, +even after arbitrary joint input and output Clifford walls. + +These are Pauli-domain, axis-rank and count restrictions. They do not require +the complete query endpoint to be a wire permutation, and do not give a +growing native T-depth lower bound or change R96. Coupling the non-Clifford +operations remains outside the independent-cell screen. + + + +## 1. The weaker complete-space contract + +Let $`x\in\mathbb F_2^p`$, $`m=2^p`$, and $`n=m+q`$. The target consists +of an m-qubit bank indexed by x and q other arbitrary qubits. Write +$`Z_x=Z_{Y_x}\otimes I_q`$. Let $`Q_x`$ be a Clifford family on all n +physical qubits, and let its binary symplectic matrix $`F_x`$ have entrywise +Boolean degree at most d. This first theorem needs neither additivity nor +an identity action on any source helpers. + +For an arbitrary unitary E put + +```math +R=E^\dagger Z_0E,\qquad R_x=Q_xRQ_x^\dagger,\qquad +\epsilon=\max_x\|ER_xE^\dagger-Z_x\|_{\rm op}. +``` + +This is a complete operator comparison, including every dirty input and +reference entanglement. It constrains the transported probe only; it does +not require $`EQ_xE^\dagger`$ to be Clifford or to equal a specified +wire-translation query on the whole space. + +Use the [binary Pauli domain](BOUNDED_DEFICIENCY_TRANSPORT.md#2-signed-localization-of-a-possibly-degenerate-domain) +and its conjugated image: + +```math +H_E=\{v:EP(v)E^\dagger\text{ is a signed Hermitian Pauli}\}, +\qquad \mathcal U_E=\text{the image-label space of }H_E. +``` + +Both are linear spaces, and conjugation gives an injective symplectic map +between them. Let $`\mathrm{RM}(d,p)`$ be the Boolean functions of degree +at most d, evaluated on all addresses, and set + +```math +M_d(p)=\sum_{j=0}^{\min(d,p)}\binom pj. +``` + +**Degree-sensitive theorem.** If $`\epsilon\lt2^{-d-1}`$, every bank X +mask in $`\mathcal U_E`$ belongs to $`\mathrm{RM}(d,p)`$. Consequently + +```math +\dim H_E\le m+M_d(p)+2q,\qquad +\mathrm{rank}_{\rm symp}H_E\le2M_d(p)+2q. +``` + +If A is the binary span of the absorbed T axes in any native word for E, +then + +```math +\dim A\ge m-M_d(p),\qquad T(E)\ge m-M_d(p). +``` + +For affine queries, $`d=1`$, $`M_1(p)=p+1`$, and the threshold is +one-quarter. No degree bound on the Clifford conjugation signs is assumed. + +## 2. Scalar Pauli cubes retain every phase + +Fix a Hermitian Pauli $`P\in H_E`$, put $`S=EPE^\dagger`$, and denote +its bank X mask by $`a(x)`$. Since +$`Z_xSZ_x=(-1)^{a(x)}S`$, two-factor telescoping gives + +```math +\|R P_xR-(-1)^{a(x)}P_x\|\le2\epsilon, +\qquad P_x=Q_x^\dagger P Q_x. +``` + +The inverse-query orientation matters. Its label is $`F_x^{-1}v`$, +whose degree is still at most d because +$`F_x^{-1}=JF_x^TJ`$ for the fixed binary symplectic form J. + +For $`d\lt p`$, fix any affine cube with $`d+1`$ independent directions +and an order of its $`2^{d+1}`$ vertices. The sum of the $`P_x`$ labels +on the cube is zero. Their ordered product is therefore + +```math +\Omega=\prod_{x\text{ in the cube}}P_x=\lambda I, +\qquad \lambda\in\{1,-1,i,-i\}. +``` + +The factors need not commute, and the scalar need not be positive. +Conjugation by R fixes this scalar product exactly. Applying the preceding +approximate conjugations in the same order costs at most +$`2^{d+2}\epsilon`$. An odd cube parity of a would change the desired +product to $`-\Omega`$, at distance two. Hence + +```math +\text{odd cube parity of }a +\quad\Longrightarrow\quad +2\le2^{d+2}\epsilon. +``` + +Below the theorem's threshold, every such derivative vanishes, so a is in +$`\mathrm{RM}(d,p)`$. If $`d\ge p`$, that code is the whole bank mask +space and the conclusion is automatic. This proof uses the degree of the +labels only; arbitrary literal Pauli signs remain inside $`\Omega`$. + +## 3. Domain dimension, symplectic rank and absorbed axes + +The image domain lies in + +```math +V_{d,p,q}=\{(a,b,c):a\in\mathrm{RM}(d,p),\quad + b\in\mathbb F_2^m,\quad c\in\mathbb F_2^{2q}\}. +``` + +Its dimension is $`m+M_d(p)+2q`$. Its radical consists of pure bank Z +masks orthogonal to every Reed--Muller X mask; it has dimension +$`m-M_d(p)`$. Thus the alternating form has rank $`2M_d(p)+2q`$. +Restriction to a subspace cannot increase that rank, proving both bounds. + +Every Pauli commuting with all absorbed rotation axes stays Pauli under E, +so $`A^\perp\subseteq H_E`$. Nondegeneracy of the n-qubit pairing gives +$`2n-\dim A\le\dim H_E`$. The T count is at least the span rank of +its individual axes, giving the asserted count bound. + + + +## 4. Exact additive queries also restrict the pure-Z kernel + +Assume now $`\epsilon=0`$ and that the queries are additive up to scalar +phase: $`Q_yQ_x`$ is proportional to $`Q_{x+y}`$. For a bank mask v define + +```math +Z^v=\prod_x Z_x^{v_x},\qquad +K_Z=\{v:E^\dagger Z^vE\text{ is a Pauli}\}. +``` + +Let $`\Pi_y`$ translate bank masks by y. Exact orbit covariance gives + +```math +Q_yE^\dagger Z^vEQ_y^\dagger=E^\dagger Z^{\Pi_yv}E. +``` + +Thus $`K_Z`$ is translation-invariant. The map $`\phi`$ taking a mask +to its pulled-back Pauli label is linear and injective: a nonzero positive +Z word cannot be conjugated to a scalar. At the label level, + +```math +\phi(\Pi_yv)=F_y\phi(v). +``` + +For any $`d+1`$ independent directions, additivity and the degree bound give + +```math +\prod_{j=1}^{d+1}(F_{y_j}-I) +=\sum_{x\in\mathrm{span}\{y_1,\ldots,y_{d+1}\}}F_x=0. +``` + +Injectivity transfers the same translation-difference identity to +$`K_Z`$, so $`K_Z\subseteq\mathrm{RM}(d,p)`$ and +$`\dim K_Z\le M_d(p)`$. Project $`\mathcal U_E`$ onto its bank X +mask and all helper labels. Its kernel is precisely the pure-bank Z +space $`K_Z`$, and its image has dimension at most $`M_d(p)+2q`$. +Therefore exact additive queries satisfy the stronger bounds + +```math +\dim H_E\le2M_d(p)+2q,\qquad +\dim A\ge2m-2M_d(p),\qquad T(E)\ge2m-2M_d(p). +``` + +No approximate invariance of $`H_E`$ or $`K_Z`$ is asserted. The robust +field argument below explicitly pays the weight of the Z word being moved. + + + +## 5. Full-rank field queries, including Pauli helper motion + +Let $`p\ge2`$. On $`2k`$ core qubits take the additive field shear + +```math +Q_x^{\rm fld}|u,v\rangle=|u,v+M_xu\rangle,\qquad +M_x=\sum_{j=0}^{p-1}x_jM_j, +``` + +where every nonzero $`M_x`$ is invertible. This permits any injective +address subspace of the field. On h further source qubits allow a Pauli +query $`B_x`$ whose binary label is linear in x, and put + +```math +Q_x=Q_x^{\rm fld}\otimes B_x,\qquad n=2k+h=m+q. +``` + +Identity source helpers are the case $`B_x=I`$. Arbitrary scalar phases +of $`B_x`$ are irrelevant to conjugation; its linear labels make the +joint query a projective additive representation. The Pauli factors need +not commute literally. This includes the moving Pauli helper query in an +augmented recoupling construction. + +The symplectic action is still $`F_x=I+N_x`$, with +$`N_xN_y=0`$. Every nonzero $`N_x`$ has the same kernel + +```math +F_{\rm fix}=\mathrm{span}\{Z_u,X_v\}\oplus V_h. +``` + +This is a common fixed-**label** space. With Pauli helpers, a fixed label +can acquire an address-dependent sign and need not be fixed literally. +The proof below retains that distinction. + +For any Hermitian Pauli P with label v, the source orbit +$`P_y=Q_yPQ_y^\dagger`$ is pairwise commuting. Indeed, +$`\langle v,N_yv\rangle=0`$, and the derivative labels lie in the +isotropic core space $`\mathrm{span}\{Z_u,X_v\}`$, with zero helper +component. Every four-address plane product +$`P_0P_yP_zP_{y+z}`$ consequently has zero label and is a Hermitian +scalar $`\pm I`$. The helper signs do not change these facts. + +At exact error, Section 4 puts $`K_Z`$ in $`\mathrm{RM}(1,p)`$. +Every affine mask has a nonzero translating stabilizer because $`p\ge2`$. +For such a stabilizer y, $`\phi(v)`$ is fixed by $`F_y`$ and hence by +every $`F_x`$. Injectivity of $`\phi`$ forces v to be translation-fixed, +so + +```math +K_Z\subseteq\mathrm{span}\{\boldsymbol1\},\qquad +\dim H_E\le p+2+2q,\qquad +\dim A\ge2m-p-2,\qquad T(E)\ge2m-p-2. +``` + +Here q counts all physical coordinates outside the target bank. It need not +equal h or describe query-fixed wires. The theorem does not prescribe any +decoded helper action and does not require E itself to return helpers. + + + +## 6. A robust low-weight kernel lemma + +Keep the field and Pauli-helper hypotheses of Section 5, but allow +nonzero $`\epsilon`$. Define $`K_Z`$ by exact Pauli pullback as before; +it is linear even when it is not translation-invariant. + +**Low-weight lemma.** If $`0\ne v\in K_Z`$ has weight w, then + +```math +\epsilon\lt\frac1{3w}\quad\Longrightarrow\quad +v=\boldsymbol1. +``` + +Put $`P=E^\dagger Z^vE`$ and form $`C_v`$ as a fixed ordered product +of the w operators $`R_x`$ at occupied addresses. The probe comparison +gives $`\|C_v-P\|\le w\epsilon`$. Query covariance translates that +same ordered product. Comparing its factors with the commuting target Z +words gives, for every y, + +```math +\|Q_yPQ_y^\dagger-E^\dagger Z^{\Pi_yv}E\| +\le2w\epsilon. +``` + +No approximate factors are reordered. At $`y=0`$ the comparison is exact. +Compare the four translated Paulis on the plane through $`0,y,z,y+z`$ +with the corresponding target Z words. The source product is $`\pm I`$; +the zero vertex has no error and the other three cost at most +$`2w\epsilon`$ each. If $`(I+\Pi_y)(I+\Pi_z)v`$ is nonzero, the +target product is a conjugate of a nontrivial Z word, at distance two from +either scalar. Thus $`6w\epsilon\lt2`$ forces every second difference +to vanish, making v affine. + +Choose a nonzero translating stabilizer y of that affine mask. The same +comparison puts $`Q_yPQ_y^\dagger`$ within $`2w\epsilon\lt2`$ of P. +These commuting Hermitian Paulis have distance either zero or two, so +their labels agree. The common fixed-label kernel then gives +$`Q_xPQ_x^\dagger=\sigma_xP`$ for every x, with +$`\sigma_x\in\{1,-1\}`$. After conjugating the comparison by E, + +```math +\|\sigma_x Z^v-Z^{\Pi_xv}\|\le2w\epsilon\lt2. +``` + +Two canonical positive Z words, with the indicated possible sign on the +first, have distance zero only when their masks agree and $`\sigma_x=1`$; +otherwise the distance is two. Hence every translation fixes v and every +sign is positive. This proves the lemma without incorrectly promoting a +fixed helper label to a literally fixed helper Pauli. + +Since $`w\le m`$, the stronger field domain and axis bounds of Section 5 +also hold under the width-dependent robust threshold + +```math +\epsilon\lt\frac1{3m}. +``` + +This threshold is below one-quarter at $`p\ge2`$, so the bank X-mask +bound used in the domain projection applies simultaneously. + + + +## 7. Independent four-wire cells have a uniform error floor + +The retained [six-T cell D](FLAT_FIELD_BANK_PILOT.md) has Pauli domain + +```math +H_D=\mathrm{span}\{X_0,X_2,X_3,X_1Z_0\},\qquad +\dim H_D=4,\qquad\mathrm{rank}_{\rm symp}H_D=2. +``` + +Let $`m=4r=2^p`$ and consider + +```math +E=L(D^{\otimes r}\otimes I_q)K, +``` + +where K and L are arbitrary fixed joint Cliffords, allowed to mix every +cell and helper. Its domain has dimension at least $`m+2q`$ and +symplectic rank at least $`2r+2q`$. These invariants survive both walls. +The factor $`I_q`$ describes the candidate E; it does not require the +source query to be identity on those physical coordinates. + +For any degree-d Clifford source, the first theorem already excludes this +class below $`2^{-d-1}`$ whenever + +```math +m\gt4M_d(p). +``` + +In particular, affine queries have an error floor of one-quarter for +$`p\ge5`$. The field structure strengthens the statement at smaller sizes. + +Suppose $`p\ge3`$ and $`\epsilon\lt1/12`$. Projection onto bank X +masks and all helper labels has dimension at most $`p+1+2q`$, while +the domain has dimension at least $`m+2q`$. Its pure-Z kernel therefore +satisfies + +```math +\dim K_Z\ge m-p-1,\qquad +[\mathbb F_2^m:K_Z]\le2^{p+1}=2m. +``` + +There are $`1+m+\binom m2`$ masks of weight at most two, more than +$`2m`$ because their difference is $`(m-1)(m-2)/2\gt0`$. Two distinct +such masks lie in the same coset of $`K_Z`$; their difference is a +nonzero kernel word of weight at most four. Since $`m\ge8`$, that word +is not all-ones. But $`\epsilon\lt1/12\le1/(3w)`$ contradicts the +low-weight lemma. Thus + +```math +\epsilon\ge\frac1{12}\quad(p\ge3),\qquad +\epsilon\ge\frac14\quad(p\ge5). +``` + +These floors include the Pauli-helper sources of Section 5 and arbitrary +joint outer Clifford walls. They do not exclude coupled non-Clifford bands, +non-Clifford spectator factors, or a different query family. + +At $`p=2`$ the actual four-address native decoder saturates the exact +field bound: its image domain has dimension four, its X-mask projection is +all of $`\mathrm{RM}(1,2)`$ with dimension three, and its pure-Z kernel +is exactly $`\{0,\boldsymbol1\}`$. Identity spectators add $`2q`$ +to the domain dimension. The permitted weight-four kernel word is then +all-ones, so the uniform-error contradiction correctly starts at $`p=3`$. + +## 8. Exact fixtures and scope + +The [bounded exact fixture](../../tests/test_weak_probe_pauli_domain.py) +checks literal scalar cube phases, including a noncommuting negative cube; +Reed--Muller derivative and radical dimensions; joint Clifford invariance; +the actual native four-address domain; the weight-four code boundary; and +the signed helper-label distinction in Section 6. The analytic arguments +supply the all-size conclusions. The fixture is neither a uniform native +emitter nor a proof of a growing depth lower bound. + +The complete-probe freedom remains useful, but it cannot rescue a tensor +product of the finite cells by adding only outer Clifford mixing. A new +construction must alter the non-Clifford coupling or its Pauli domain while +still paying the complete probe, actual inverse and helper-return contract. diff --git a/tests/field_sector_tableaux.py b/tests/field_sector_tableaux.py new file mode 100644 index 0000000..3e6cbf4 --- /dev/null +++ b/tests/field_sector_tableaux.py @@ -0,0 +1,200 @@ +"""Exact bit-sliced Clifford tableaux for every augmented-helper character. + +A bit position denotes a complete helper-X character. This bounded evaluator +is not a native emitter or a scalable synthesis algorithm. +Signed Hermitian Pauli images are exact; tableau equality alone quotients a +unitary's global scalar, so literal scalar claims use the analytic cell proof +and independent bounded matrix calibrations. +""" +from functools import lru_cache, reduce +from tests.test_recursive_field_shear_decoder import (_tower_product as mul, + _tower_trace as trace,_address_field) +from tests.test_projective_field_recoupler import fourier_word,linear_word + +@lru_cache(None) +def phase_coefficients(level,kind): + ell=1<<(level-2); k=2*ell; width=2*k + def field_value(basis): + mask=(1<>k + d0,d1=u&mask,u>>ell;a0,a1=v&mask,v>>ell + if kind=='before':return (mul(level,u,v)>>ell)^mul(level-1,d0,d1) + return mul(level-1,d0,a1)^mul(level-1,d1,a0) + linear=[field_value(1<= 1 and 0 <= helper bits <= 15") + self.n,self.h=n,h;self.sectors=1<>bit&1:value^=self.variables[bit] + self.masks[mask]=value + return self.masks[mask] ^ (self.ones if (mask&shift).bit_count()%2 else 0) + def apply(self,word,shift=0): + cols=range(2*self.n) + for gate in word: + kind=gate[0] + if kind=='H': + q=gate[1];x,z=self.x[q],self.z[q] + for c in cols:self.sign[c]^=x[c]&z[c] + self.x[q],self.z[q]=z,x + elif kind=='CX': + a,b=gate[1:];xa,xb,za,zb=self.x[a],self.x[b],self.z[a],self.z[b] + for c in cols: + self.sign[c]^=xa[c]&zb[c]&(xb[c]^za[c]^self.ones) + xb[c]^=xa[c];za[c]^=zb[c] + elif kind=='CZC': + a,b,mask=gate[1:];cond=self.condition(mask,shift) + xa,xb,za,zb=self.x[a],self.x[b],self.z[a],self.z[b] + for c in cols: + self.sign[c]^=cond&xa[c]&xb[c]&(za[c]^zb[c]) + za[c]^=cond&xb[c];zb[c]^=cond&xa[c] + elif kind=='ZC': + q,mask=gate[1:];cond=self.condition(mask,shift) + for c in cols:self.sign[c]^=cond&self.x[q][c] + else:raise ValueError(gate) + return self + def same(self,other):return self.x==other.x and self.z==other.z and self.sign==other.sign + def at(self,r): + return tuple((sum(((self.x[q][c]>>r)&1)<>r)&1)<>r)&1) for c in range(2*self.n)) + def anf(self,value): + for b,mask in enumerate(self.variables):value^=(value<<(1<witness[kind]['degree']: + monomial=(a°ree_masks[degree]) if degree>=0 else 0 + low=monomial&-monomial + witness[kind]={'degree':degree,'row':row,'column':col,'monomial_helper_mask':low.bit_length()-1 if low else None} + return {'histograms':profile,'witnesses':witness} + +def query_parameter_word(level, alpha, offset=0): + """Full-field shear parameter; the address subspace is a separate restriction.""" + degree = 1 << (level-1) + return [('CX', offset+j, offset+degree+i) + for j in range(degree) for i in range(degree) + if mul(level, alpha, 1 << j) >> i & 1] + +def query_word(level,addr): + return query_parameter_word(level, _address_field(level,addr)) + +def target_word(level,addr): + n=1< f(r+shift), without enumerating r.""" + for bit,ones in enumerate(table.variables): + if shift >> bit & 1: + zeros=table.ones ^ ones; step=1 << bit + value=((value & zeros) << step) | ((value & ones) >> step) + return value + +def active_derivative(table, value, level): + for bit in range(level-1): + value ^= xor_translate(table,value,helper_shift(level,1 << bit)) + return value + +def top_derivative_identity(level): + """Verify C_r N_top=(J directsum J)M_r in every helper coset, with signs separate. + + C_r is the (p-1)-fold active-helper derivative of the symplectic tableau. + This exact binary identity witnesses degree >=p-1; it makes no T-depth claim. + """ + t=sector_tableau(level); n=t.n; rows=t.x+t.z + derivative=[[active_derivative(t,v,level) for v in row] for row in rows] + q=BitslicedTableau(n,0).apply(query_word(level,1 << (level-1))) + qrows=q.x+q.z + nx=[[qrows[i][j] ^ (i==j) for j in range(2*n)] for i in range(2*n)] + sums=[] + for block in (t.x,t.z): + v=[] + for col in range(2*n): + value=0 + for row in block:value ^= row[col] + v.append(value) + sums.append(v) + for row in range(2*n): + expected=sums[row//n] + for col in range(2*n): + actual=0 + for k in range(2*n): + if nx[k][col]:actual ^= derivative[row][k] + assert actual == expected[col],(level,row,col) + # Each all-ones output block remains nonzero in every helper character. + assert all(reduce(int.__or__,row,0)==t.ones for row in sums) + return True diff --git a/tests/test_augmented_field_recoupler.py b/tests/test_augmented_field_recoupler.py new file mode 100644 index 0000000..2adaeac --- /dev/null +++ b/tests/test_augmented_field_recoupler.py @@ -0,0 +1,269 @@ +"""Exact augmented field recoupling, with arbitrary moving helpers. + +Full computational-basis columns check the algebraic primitive word at p=2,3. +A separately emitted p=2 native word and an overlapping shared-target phase +batch verify the native composition point. No all-size depth improvement is +inferred from the bounded matrices; the proof owns the uniform ledger. +""" +from functools import lru_cache +import unittest + +import numpy as np + +from tests.test_dirty_indicator_depth import _exact_phase_action +from tests.test_field_shear_intertwiner import _translation +from tests.test_joint_lookup_pauli_source import _bands, _inverse +from tests.test_projective_field_recoupler import ( + fourier_word, linear_word, ring_matrix, equal_ring, adjoint_ring) +from tests.test_recursive_field_shear_decoder import ( + _tower_product as mul, _tower_trace as trace, _address_field, _tower_shear) + + +@lru_cache(None) +def _addition_value(level, u, v, which): + ell = 1 << (level - 2) + low = (1 << ell) - 1 + u0, u1, v0, v1 = u & low, u >> ell, v & low, v >> ell + if which == 'before': + return (mul(level, u, v) >> ell) ^ mul(level - 1, u0, u1) + assert which == 'after' + return mul(level - 1, u0, v1) ^ mul(level - 1, u1, v0) + + +@lru_cache(None) +def _fourier_signs(level, multiplier, source): + return tuple(-1 if trace(level, mul(level, multiplier, mul(level, source, target))) + else 1 for target in range(1 << (1 << (level - 1)))) + + +def _algebraic_word(level, top, offset=0): + if level == 1: + return [('CX', offset + 1, offset)] + ell, degree = 1 << (level - 2), 1 << (level - 1) + helper = (1 << top) + ell - 1 + recoupler = [('F', level, offset + degree, 1), + ('ADD', level, offset, helper, 'before'), + ('F', level, offset + degree, 1 << ell), + ('ADD', level, offset, helper, 'after')] + recoupler += [gate for j in range(degree) + for gate in [('CX', offset + j, offset + degree + j), + ('CX', offset + degree + j, offset + j)]] + recoupler += [('F', level - 1, offset + ell, 1), + ('F', level - 1, offset + degree + ell, 1)] + return (recoupler + _algebraic_word(level - 1, top, offset) + + _algebraic_word(level - 1, top, offset + degree)) + + +def _apply_algebraic(operations, column): + state = {column: 1} + normalization = 0 + for kind, *args in operations: + if kind == 'CX': + control, target = args + state = {row ^ (((row >> control) & 1) << target): value + for row, value in state.items()} + elif kind == 'ADD': + level, offset, helper, which = args + ell, degree = 1 << (level - 2), 1 << (level - 1) + mask = (1 << degree) - 1 + changed = {} + for row, value in state.items(): + u, v = (row >> offset) & mask, (row >> (offset + degree)) & mask + delta = _addition_value(level, u, v, which) + target = row ^ (delta << helper) + assert target not in changed # The whole add is a permutation. + changed[target] = value + state = changed + else: + assert kind == 'F' + level, offset, multiplier = args + degree = 1 << (level - 1) + mask = ((1 << degree) - 1) << offset + normalization += degree + changed = {} + for row, value in state.items(): + source = (row & mask) >> offset + for target, sign in enumerate(_fourier_signs(level, multiplier, source)): + out = (row & ~mask) | (target << offset) + changed[out] = changed.get(out, 0) + sign * value + state = {row: value for row, value in changed.items() if value} + return state, normalization + + +def _helper_phase(top, address, basis): + exponent = 0 + for level in range(2, top + 1): + ell = 1 << (level - 2) + helper = (1 << top) + ell - 1 + value = (basis >> helper) & ((1 << ell) - 1) + coefficient = _address_field(level - 1, address & ((1 << (level - 1)) - 1)) + exponent ^= trace(level - 1, mul(level - 1, coefficient, value)) + return -1 if exponent else 1 + + +def _parity_phase_batch(forms, helpers): + """Returned eight-phase masks for arbitrary overlapping linear forms.""" + assert len(forms) == len(helpers) and len(set(helpers)) == len(helpers) + assert all(not (mask >> h) & 1 + for row in forms for mask in row for h in helpers) + emitted, previous = [], 0 + for step in range(8): + vertex = step ^ (step >> 1) + difference = previous ^ vertex + if difference: + index = difference.bit_length() - 1 + emitted += [('CX', bit, h) + for row, h in zip(forms, helpers) + for bit in range(row[index].bit_length()) + if (row[index] >> bit) & 1] + emitted += [('TDG' if vertex.bit_count() & 1 else 'T', h) + for h in helpers] + previous = vertex + emitted += [('CX', bit, h) + for row, h in zip(forms, helpers) + for bit in range(row[2].bit_length()) + if (row[2] >> bit) & 1] + return emitted + + +def _p2_forms(offset, helper, which): + u0, u1, v0, v1 = [1 << (offset + j) for j in range(4)] + h = 1 << helper + if which == 'before': + return [(u0, v1 ^ u1, h), (u1, v0 ^ v1, h)] + assert which == 'after' + return [(u0, v1, h), (u1, v0, h)] + + +def _native_p2_word(): + """32 T / 16 bands; four core, one moving, two returned private wires.""" + emitted = [] + for kind, *args in _algebraic_word(2, 2): + if kind == 'CX': + emitted.append((kind, *args)) + elif kind == 'ADD': + level, offset, helper, which = args + assert level == 2 + emitted += ([('H', helper)] + + _parity_phase_batch(_p2_forms(offset, helper, which), [5, 6]) + + [('H', helper)]) + else: + level, offset, multiplier = args + degree = 1 << (level - 1) + if multiplier != 1: + emitted += linear_word( + [mul(level, multiplier, 1 << j) for j in range(degree)], + range(offset, offset + degree)) + emitted += fourier_word(level, offset) + return emitted + + +@lru_cache(None) +def _complete_algebraic_columns(top): + width = (1 << top) + (1 << (top - 1)) - 1 + operations = _algebraic_word(top, top) + columns, normalization = [], None + for column in range(1 << width): + state, exponent = _apply_algebraic(operations, column) + assert sum(value * value for value in state.values()) == 1 << exponent + assert normalization is None or normalization == exponent + normalization = exponent + columns.append(state) + return columns, normalization + + +class AugmentedFieldRecouplerTests(unittest.TestCase): + def test_relative_trace_two_product_formula_and_zero_cell(self): + for level in (2, 3): + ell = 1 << (level - 2) + low = (1 << ell) - 1 + size = 1 << (2 * ell) + for u in range(size): + for v in range(size): + u0, u1, v0, v1 = u & low, u >> ell, v & low, v >> ell + self.assertEqual(_addition_value(level, u, v, 'before'), + mul(level - 1, u0, v1 ^ u1) + ^ mul(level - 1, u1, v0 ^ v1)) + self.assertEqual(_addition_value(level, u, v, 'after'), + _addition_value(level, u, v ^ u, 'after')) + for which in ('before', 'after'): + self.assertTrue(all(_addition_value(level, 0, v, which) == 0 + for v in range(size))) + + def test_native_shared_target_batch_and_arbitrary_private_return(self): + # Two disjoint four-wire cells share one target and four private masks. + forms = _p2_forms(0, 8, 'before') + _p2_forms(4, 8, 'before') + emitted = _parity_phase_batch(forms, [9, 10, 11, 12]) + self.assertEqual(sum(g[0] in ('T', 'TDG') for g in emitted), 32) + self.assertEqual(len(_bands(emitted)), 8) + for native in (emitted, _inverse(emitted)): + for basis in range(1 << 13): + phase = 4 * (sum(all((basis & mask).bit_count() & 1 for mask in row) + for row in forms) & 1) + self.assertEqual(_exact_phase_action(basis, native), (basis, phase)) + + def test_complete_p2_native_word_and_actual_inverse(self): + emitted = _native_p2_word() + self.assertEqual(sum(g[0] in ('T', 'TDG') for g in emitted), 32) + self.assertEqual(len(_bands(emitted)), 16) + columns, exponent = _complete_algebraic_columns(2) + self.assertEqual(exponent % 2, 0) + expected = np.zeros((4, 128, 128), dtype=np.int64) + for private in range(4): + for column, entries in enumerate(columns): + for row, value in entries.items(): + expected[0, row | (private << 5), column | (private << 5)] = value + actual = ring_matrix(emitted, 7) + self.assertTrue(equal_ring(actual, (expected, exponent // 2))) + self.assertTrue(equal_ring(ring_matrix(_inverse(emitted), 7), adjoint_ring(actual))) + + def test_all_computational_helper_columns_and_reversed_word(self): + for top in (2, 3): + columns, exponent = _complete_algebraic_columns(top) + expected_inverse = [{} for _ in columns] + for column, entries in enumerate(columns): + for row, value in entries.items(): + expected_inverse[row][column] = value + reversed_word = list(reversed(_algebraic_word(top, top))) + for column in range(len(columns)): + inverse, inverse_exponent = _apply_algebraic(reversed_word, column) + self.assertEqual(inverse_exponent, exponent) + self.assertEqual(inverse, expected_inverse[column], (top, column)) + + def test_augmented_intertwining_every_address_and_full_column(self): + for top in (2, 3): + columns, _ = _complete_algebraic_columns(top) + core_mask = (1 << (1 << top)) - 1 + for address in range(1 << top): + for column in range(len(columns)): + source = ((column & ~core_mask) + | _tower_shear(top, address, column & core_mask)) + sign = _helper_phase(top, address, column) + left = {row: sign * value for row, value in columns[source].items()} + right = {((row & ~core_mask) + | _translation(top, address, row & core_mask)): + _helper_phase(top, address, row) * value + for row, value in columns[column].items()} + self.assertEqual(left, right, (top, address, column)) + + def test_helper_query_is_essential_and_echo_cancels_it(self): + columns, _ = _complete_algebraic_columns(2) + without_query_fails = False + for address in range(4): + for column in range(32): + source = (column & 16) | _tower_shear(2, address, column & 15) + moved = {(row & 16) | _translation(2, address, row & 15): value + for row, value in columns[column].items()} + without_query_fails |= columns[source] != moved + # The target augmented query is a signed involution; its + # actual Z0 echo has exactly Z_address and no helper phase. + middle = (column & 16) | _translation(2, address, column & 15) + phase = (_helper_phase(2, address, column) + * (-1 if middle & 1 else 1) + * _helper_phase(2, address, middle)) + self.assertEqual(phase, -1 if (column >> address) & 1 else 1) + self.assertTrue(without_query_fails) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_coupled_projective_recoupler.py b/tests/test_coupled_projective_recoupler.py new file mode 100644 index 0000000..bbe1d10 --- /dev/null +++ b/tests/test_coupled_projective_recoupler.py @@ -0,0 +1,380 @@ +"""Coupled eight-address decoder with six returned arbitrary phase helpers. + +The native word, literal phases, both actual inverses and every field address +are checked exactly. The projective predicate is finite; no uniform decoder +depth claim follows from this fixture. +""" +from functools import lru_cache +from itertools import product +import unittest + +import numpy as np + +from tests.test_projective_field_recoupler import ( + paired_t, pauli_diagonalizer, linear_word, _baseline_word, _raw_linear_cell, + fourier_word, ring_matrix, equal_ring, adjoint_ring, ledger, mul, inv, trace, + _inverse, _native_x, _relative_toffoli, _tower_shear, _translation) +from tests.test_joint_lookup_pauli_source import _bands +from tests.test_flat_field_bank_native import full_intertwiner + + +def affine_r91_batch(pairs, helpers): + """Ftilde(a,b;h): four T targets h, only logical parity CNOT controls. + + A form is (linear_mask, constant). Ftilde differs from (-i)^(ab)Z_h^(ab) + by scalar i iff both constants are one; these cancel in the commutator. + """ + word=[] + # Parity vertices 0, a, a+b, b, then return to zero. + vertices=((0,0),(1,0),(1,1),(0,1)) + changes=(0,1,0,1) + for step,(ia,ib) in enumerate(vertices): + for (a,b),h in zip(pairs,helpers): + parity=(ia+ib+ia*a[1]+ib*b[1])&1 + word.append(('TDG' if parity else 'T',h)) + for pair,h in zip(pairs,helpers): + mask=pair[changes[step]][0] + word += [('CX',j,h) for j in range(mask.bit_length()) if mask>>j&1] + return word + + +def quartic_batch(forms, helpers): + assert len(forms)==len(helpers) and len(set(helpers))==len(helpers) + for row in forms: + assert all((mask>>h)&1==0 for mask,const in row for h in helpers) + u=affine_r91_batch([(r[0],r[1]) for r in forms],helpers) + h=[('H',j) for j in helpers] + v=h+affine_r91_batch([(r[2],r[3]) for r in forms],helpers)+h + return u+v+_inverse(u)+_inverse(v) + + +def displacement_forms(): + out=[] + for direction in (4,5,6,7): + columns=[mul(3,inv(3,direction),1<>i)&1)<=8 + if t==helper and logical>>c&1: + # Native X as HSSH. + local += [('H',0),('S',0),('S',0),('H',0)] + else: + assert len(wires)==1 and wires[0]>=8 + if wires[0]==helper:local.append((name,0)) + return ring_matrix(local,1) + + +def relative_pair(left, right, probe, controls=(2, 3)): + tau=paired_t(left,right) + k,pivot=pauli_diagonalizer(probe) + pword=(_inverse(k)+[('H',pivot)] + +_relative_toffoli(*controls,pivot)+[('H',pivot)]+k) + return _inverse(tau)+pword+tau + + +def selected_pair(direction, pair, negative_phase=False): + coords=linear_word([mul(3,inv(3,direction),1<=4 else 1)*(a[i]@b[j]) + den=da+db + while den and not np.any(out&1):out//=2;den-=1 + return out,den + + +def _field_cell(direction): + """Independent trace-Fourier formula; entries are integer halves.""" + d0, d1 = direction & 3, direction >> 2 + norm = mul(2, d0, d0) ^ mul(2, d0, d1) ^ mul(2, 2, mul(2, d1, d1)) + out = np.zeros((4, 16, 16), dtype=np.int64) + for v in range(16): + uv = mul(3, direction, v) + rhat = mul(3, 4, uv) >> 2 + s = mul(2, uv >> 2, inv(2, norm)) + for r in range(4): + a = mul(3, direction, r | (s << 2)) + out[0, a, v] = (-1) ** trace(2, mul(2, rhat, r)) + return out, 1 + + +def _field_shift(u): + if not u: + return 0 + d0, d1 = u & 3, u >> 2 + norm = mul(2, d0, d0) ^ mul(2, d0, d1) ^ mul(2, 2, mul(2, d1, d1)) + s = mul(2, mul(2, d0, d1), inv(2, norm)) + return mul(3, u, s << 2) + + +def _pauli_ring(label): + x, z = label & 15, label >> 4 + out = np.zeros((4, 16, 16), dtype=np.int64) + power = 2 * ((x & z).bit_count() % 4) + for col in range(16): + out[power % 4, col ^ x, col] = (-1) ** ( + power // 4 + (z & col).bit_count()) + return out, 0 + + +def _times_i(value): + a, d = value + return np.array([-a[2], -a[3], a[0], a[1]]), d + + +def _reflection(left, right, probe): + """Independent J=(P-iAP-iBP-ABP)/2 with integer coefficients.""" + a, b, p = _pauli_ring(left), _pauli_ring(right), _pauli_ring(probe) + ap, bp = multiply_ring(a, p), multiply_ring(b, p) + abp = multiply_ring(a, bp) + assert ap[1] == bp[1] == abp[1] == 0 + return p[0] - _times_i(ap)[0] - _times_i(bp)[0] - abp[0], 1 + + +def _identity(size): + out = np.zeros((4, size, size), dtype=np.int64) + out[0] = np.eye(size, dtype=np.int64) + return out, 0 + + +def _displacement_permutation(): + """Effective permutation derived from the emitted quartic forms.""" + rows = displacement_forms() + permutation = [] + for basis in range(256): + u, v = basis & 15, basis >> 4 + shift = 0 + for row in rows: + assert all(mask < 16 for mask, _ in row[:3]) + assert row[3][0] & 15 == 0 and row[3][1] == 0 + if all(evalform(form, u) for form in row[:3]): + shift ^= row[3][0] >> 4 + permutation.append(u | ((v ^ shift) << 4)) + return permutation + + +@lru_cache(None) +def logical_ring(decoder=False, inverse=False): + """Compose the verified tensor-identity batch with actual native walls. + + Inverse=True evaluates each actual reversed native wall separately; it + does not manufacture the answer by taking the forward matrix's adjoint. + The private batch is self-inverse as a complete XOR operator, proved below + for both actual native orientations on every private-helper sector. + """ + prefix = fourier_word(3, 4) + coupled_linear_word() + suffix = exterior_after() + if decoder: + suffix += [g for gate in full_intertwiner() + for g in [gate, (gate[0], *(j + 4 for j in gate[1:]))]] + first, last = (prefix, suffix) if not inverse else ( + _inverse(suffix), _inverse(prefix)) + matrix, den = ring_matrix(first) + moved = matrix[:, _displacement_permutation(), :] + return multiply_ring(ring_matrix(last), (moved, den)) + + +class CoupledProjectiveRecouplerTests(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.linear = ring_matrix(coupled_linear_word()) + cls.linear_inverse = ring_matrix(_inverse(coupled_linear_word())) + cls.recoupler = logical_ring() + cls.recoupler_inverse = logical_ring(inverse=True) + cls.decoder = logical_ring(decoder=True) + cls.decoder_inverse = logical_ring(decoder=True, inverse=True) + + def test_affine_private_phase_keeps_its_literal_constant(self): + forms = [(mask, constant) for mask in range(4) for constant in (0, 1)] + for a, b in product(forms, repeat=2): + word = affine_r91_batch([(a, b)], [2]) + wanted = np.zeros((4, 8, 8), dtype=np.int64) + for col in range(8): + ab = evalform(a, col) * evalform(b, col) + # i^(ka kb) (-i)^(ab) (-1)^(ab h), including scalar i. + power = (2*a[1]*b[1] - 2*ab + 4*ab*((col >> 2) & 1)) % 8 + wanted[power % 4, col, col] = (-1) ** (power // 4) + expected = wanted, 0 + self.assertTrue(equal_ring(ring_matrix(word, 3), expected)) + self.assertTrue(equal_ring(ring_matrix(_inverse(word), 3), + adjoint_ring(expected))) + + def test_quartic_affine_commutator_all_columns_and_actual_inverse(self): + rows = [tuple((1 << j, c) for j, c in enumerate(constants)) + for constants in product((0, 1), repeat=4)] + # Dependent, repeated, overlapping and constant affine forms are allowed. + rows += [((3, 1), (3, 1), (5, 0), (0, 1)), + ((0, 0), (7, 1), (3, 0), (15, 1))] + for row in rows: + word = quartic_batch([row], [4]) + wanted = np.zeros((4, 32, 32), dtype=np.int64) + for col in range(32): + wanted[0, col, col] = -1 if all(evalform(f, col) for f in row) else 1 + for emitted in (word, _inverse(word)): + self.assertTrue(equal_ring(ring_matrix(emitted, 5), (wanted, 0))) + + def test_private_batch_every_helper_sector_and_displacement(self): + forms, helpers = displacement_forms(), list(range(8, 14)) + batch = quartic_batch(forms, helpers) + actual_inverse = _inverse(batch) + for logical in range(256): + for row, helper in zip(forms, helpers): + wanted = _identity(2) + if all(evalform(f, logical) for f in row): + wanted = -wanted[0], wanted[1] + for emitted in (batch, actual_inverse): + self.assertTrue(equal_ring(helper_matrix(emitted, logical, helper), + wanted)) + u, v = logical & 15, logical >> 4 + actual = sum(all(evalform(f, logical) for f in row) for row in forms) % 2 + self.assertEqual(actual, (_field_shift(u) & v).bit_count() % 2) + self.assertEqual(ledger(batch)['T'], 96) + self.assertEqual(ledger(batch)['bands'], 16) + self.assertEqual(len(batch), 360) + for emitted in (batch, actual_inverse): + for band in _bands(emitted): + self.assertEqual(len({g[1] for g in band}), len(band)) + self.assertTrue(all(g[1] in helpers for g in band)) + + def test_independent_paired_reflections_and_common_or_phase(self): + ja = _reflection(19, 50, 32) + jb64, jb112 = _reflection(156, 228, 64), _reflection(156, 228, 112) + jc44, jc87 = _reflection(89, 247, 44), _reflection(89, 247, 87) + for j in (ja, jb64, jb112, jc44, jc87): + self.assertTrue(equal_ring(j, adjoint_ring(j))) + self.assertTrue(equal_ring(multiply_ring(j, j), _identity(16))) + for direction, first, last, sign in ( + (4, ja, jb112, 1), (5, jb64, ja, 1), + (6, jc44, ja, 1), (7, ja, jc87, -1)): + actual, den = multiply_ring(last, first) + expected = multiply_ring(_field_cell(direction), + adjoint_ring(_field_cell(1))) + self.assertTrue(equal_ring((sign * actual, den), expected)) + common = ring_matrix(common_a()) + for u in range(16): + selected = int(bool(u & 12)) + predicates = [int(mul(3, inv(3, d), u) >> 2 == 0) for d in (4,5,6,7)] + self.assertEqual(sum(predicates) % 2, selected) + if u: + self.assertEqual((1j**selected)*((-1j)**sum(predicates)), 1) + block = _times_i(ja) if selected else _identity(16) + indices = np.arange(16)*16 + u + actual = common[0][:, indices, :][:, :, indices], common[1] + self.assertTrue(equal_ring(actual, block)) + + def test_complete_linear_word_and_literal_zero_fiber(self): + # The independent nonzero field formula also fixes every literal sign. + for u in range(1, 16): + indices = np.arange(16)*16 + u + actual = self.linear[0][:, indices, :][:, :, indices], self.linear[1] + self.assertTrue(equal_ring(actual, _field_cell(u))) + zero = _field_cell(1) + for triple in ((156,228,64), (89,247,44), (156,228,112), (89,247,87)): + zero = multiply_ring(_reflection(*triple), zero) + zero = -zero[0], zero[1] + indices = np.arange(16)*16 + actual = self.linear[0][:, indices, :][:, :, indices], self.linear[1] + self.assertTrue(equal_ring(actual, zero)) + self.assertTrue(equal_ring(self.linear_inverse, adjoint_ring(self.linear))) + + def test_complete_intertwining_all_columns_and_actual_inverses(self): + for forward, inverse in ((self.recoupler, self.recoupler_inverse), + (self.decoder, self.decoder_inverse)): + self.assertTrue(equal_ring(inverse, adjoint_ring(forward))) + self.assertTrue(equal_ring(multiply_ring(inverse, forward), _identity(256))) + for address in range(8): + source = [_tower_shear(3, address, col) for col in range(256)] + target = [_translation(3, address, col) for col in range(256)] + self.assertTrue(np.array_equal(self.decoder[0][:, :, source], + self.decoder[0][:, target, :])) + + def test_native_ledgers_and_distinct_physical_t_targets(self): + rows = ((coupled_linear_word(), 40, 20, 577, None, 8), + (recoupler_word(), 136, 36, 980, 984, 14), + (decoder_word(), 148, 39, 1110, 1166, 14)) + for word, t, bands, forward_gates, inverse_gates, width in rows: + for emitted, gates in ((word, forward_gates), (_inverse(word), inverse_gates)): + counted = ledger(emitted) + self.assertEqual((counted['T'], counted['bands'], counted['width']), + (t, bands, width)) + if gates is not None: + self.assertEqual(counted['gates'], gates) + self.assertLessEqual({g[0] for g in emitted}, {'H','S','CX','T','TDG'}) + for band in _bands(emitted): + self.assertEqual(len({g[1] for g in band}), len(band)) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_field_sector_degree.py b/tests/test_field_sector_degree.py new file mode 100644 index 0000000..0183117 --- /dev/null +++ b/tests/test_field_sector_degree.py @@ -0,0 +1,216 @@ +"""Independent finite checks of the sector-degree barrier and its scope. + +The independent group-algebra and escape checks are supplemented by exact +active-coset and local-affinity identities in the retained sector tableaux. +""" +import unittest +from fractions import Fraction + +from tests.exact_matrices import CQ2, CO, CZ, adjoint, eye, multiply as exact_multiply, scale +from tests.field_sector_tableaux import (BitslicedTableau, recoupler_word, + sector_tableau, top_derivative_identity) + + +def identity(n): + return [1 << i for i in range(n)] + + +def add(a, b): + return [x ^ y for x, y in zip(a, b)] + + +def multiply(a, b): + out = [] + for row in a: + value = 0 + while row: + low = row & -row + value ^= b[low.bit_length() - 1] + row ^= low + out.append(value) + return out + + +def 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 translation(p, x): + return [1 << (row ^ x) for row in range(1 << p)] + + +def span(basis): + values = [0] + for vector in basis: + values += [value ^ vector for value in values] + return values + + +def complement(p, vector): + basis = [vector] + rest = [] + for bit in range(p): + value = 1 << bit + if rank(basis + [value]) > len(basis): + basis.append(value) + rest.append(value) + assert len(basis) == p + return rest + + +def anf_degree(values): + coefficients = list(values) + variables = (len(values) - 1).bit_length() + assert len(values) == 1 << variables + for bit in range(variables): + for mask in range(1 << variables): + if mask >> bit & 1: + coefficients[mask] ^= coefficients[mask ^ (1 << bit)] + return max((mask.bit_count() for mask, value in enumerate(coefficients) + if value), default=-1) + + +class FieldSectorDegreeTests(unittest.TestCase): + def test_regular_group_norm_and_independent_deviations(self): + for p in range(1, 7): + n = 1 << p + unit = identity(n) + total = [0] * n + for x in range(n): + total = add(total, translation(p, x)) + self.assertEqual(total, [(1 << n) - 1] * n) + self.assertEqual(rank(total), 1) + if p >= 2: + product = multiply(add(translation(p, 1), unit), + add(translation(p, 2), unit)) + self.assertEqual(rank(product), n // 4) + self.assertTrue(any(product)) + + def test_every_nonzero_kernel_direction_and_complement(self): + for p in range(1, 6): + n = 1 << p + unit = identity(n) + wanted = [(1 << n) - 1] * n + for b in range(1, n): + directions = complement(p, b) + coefficient = [0] * n + deviation = add(translation(p, b), unit) + for t in span(directions): + coefficient = add(coefficient, + multiply(translation(p, t), deviation)) + self.assertEqual(coefficient, wanted, (p, b)) + # Multiplication by a nontrivial invertible core change cannot + # annihilate the top-degree coefficient. Elementary row/column + # operations suffice for a direct independent finite check. + change = identity(n) + if n > 1: + change[0] ^= change[1] + self.assertTrue(any(multiply(coefficient, change))) + + def test_full_rank_helper_case_needs_degree_p(self): + for p in range(1, 7): + n = 1 << p + # Every entry of the regular translation family is one address + # indicator, of degree p in the p active helper-shift variables. + for output in (0, n - 1): + for source in (0, n - 1): + self.assertEqual(anf_degree([ + int((source ^ x) == output) for x in range(n)]), p) + + def test_square_zero_source_assumption_is_essential(self): + # If the source itself is the regular bank, E=I and Lambda=0 is a + # constant Clifford-sector solution. Its deviations violate N_b N_c=0. + p = 3 + n = 1 << p + unit = identity(n) + source = {x: translation(p, x) for x in range(n)} + for x in range(n): + self.assertEqual(multiply(unit, source[x]), + multiply(translation(p, x), unit)) + self.assertTrue(any(multiply(add(source[1], unit), + add(source[2], unit)))) + + def test_nonlinear_helper_motion_invalidates_affine_stage_count(self): + # Reversible helper Toffoli: r2 -> r2 + r0*r1. It is its own inverse. + # Between its two occurrences, a single core Clifford shear is + # controlled AFFINELY by the current r2. In the original helper frame + # the completed block has a quadratic coefficient, despite containing + # only one affine core stage. The helper motion must be charged and is + # outside the fixed-helper-frame stage hypothesis. + values = [] + permutation = [] + for r in range(8): + shifted = r ^ (((r & 1) * ((r >> 1) & 1)) << 2) + permutation.append(shifted) + values.append((shifted >> 2) & 1) + self.assertEqual(sorted(permutation), list(range(8))) + self.assertTrue(all(permutation[permutation[r]] == r for r in range(8))) + self.assertEqual(anf_degree([(r >> 2) & 1 for r in range(8)]), 1) + self.assertEqual(anf_degree(values), 2) + + def test_extra_target_spectators_cannot_cancel_the_bank_block(self): + p = 3 + n = 1 << p + dimension = n + 2 + unit = identity(dimension) + queries = {} + for x in range(n): + # A moving residual 2-wire swap, on an arbitrary address character. + residual_bit = (x & 3).bit_count() & 1 + queries[x] = (translation(p, x) + + [1 << (n + (j ^ residual_bit)) for j in range(2)]) + b = 4 + deviation = add(queries[b], unit) + total = [0] * dimension + for t in span([1, 2]): + total = add(total, multiply(queries[t], deviation)) + self.assertEqual(total[:n], [(1 << n) - 1] * n) + self.assertTrue(any(total)) + + + def test_active_coset_top_coefficient_and_local_affinity(self): + for p in (2, 3, 4): + self.assertTrue(top_derivative_identity(p)) + table = sector_tableau(p) + self.assertEqual(max(table.degree_profile()['histograms']['symplectic']), p - 1) + ell = 1 << (p - 2) + offset = ell - 1 + local_word = [((*gate[:-1], gate[-1] >> offset) + if gate[0] in ('ZC', 'CZC') else gate) + for gate in recoupler_word(p)] + local = BitslicedTableau(1 << p, ell).apply(local_word) + self.assertEqual(max(local.degree_profile()['histograms']['symplectic']), 1) + + def test_signed_pauli_gap_does_not_fix_scalar_sector_phase(self): + # Orthogonal Pauli directions attain the sqrt(2) gap exactly. + x = [[CZ, CO], [CO, CZ]] + z = [[CO, CZ], [CZ, -CO]] + difference = [[a - b for a, b in zip(row, other)] + for row, other in zip(x, z)] + self.assertEqual(exact_multiply(difference, difference), scale(eye(2), CQ2(2))) + self.assertEqual(exact_multiply(scale(x, CQ2(2)), scale(x, CQ2(2))), + scale(eye(2), CQ2(4))) + # A nontrivial rational unit scalar is closer than 1/sqrt(2), but its + # Pauli action is exactly identical. Robust rounding therefore gives + # the symplectic cocycle; it cannot set sector scalars to +1. + phase = CQ2(Fraction(15, 17), Fraction(8, 17)) + self.assertEqual(phase.abs2(), 1) + delta = phase - 1 + self.assertEqual(delta.abs2(), Fraction(4, 17)) + self.assertLess(delta.abs2(), Fraction(1, 2)) + unitary = scale(eye(2), phase) + self.assertNotEqual(unitary, eye(2)) + self.assertEqual(exact_multiply(exact_multiply(unitary, x), adjoint(unitary)), x) + self.assertEqual(exact_multiply(exact_multiply(unitary, z), adjoint(unitary)), z) + + +if __name__ == '__main__': + unittest.main() diff --git a/tests/test_field_sector_tableaux.py b/tests/test_field_sector_tableaux.py new file mode 100644 index 0000000..489b562 --- /dev/null +++ b/tests/test_field_sector_tableaux.py @@ -0,0 +1,89 @@ +"""Exact signed-Pauli sector fixtures; no dense high-dimensional unitary claim.""" +import unittest +from tests.exact_matrices import Q2 +from tests.test_one_band_copy_feasibility import _conjugate +from tests.field_sector_tableaux import ( + BitslicedTableau, decoder_word, recoupler_word, phase_coefficients, + sector_tableau, materialize_word, query_word, query_parameter_word, + target_word, helper_shift, mul, trace) + + +class FieldSectorTableauTests(unittest.TestCase): + def test_signed_conditional_gate_updates_against_exact_paulis(self): + # Every two-qubit Hermitian Pauli, in every helper sector. Noncanonical + # input batches exercise intermediate Y phases, not only X/Z supports. + word=(('H',0),('CZC',0,1,1),('CX',1,0),('ZC',1,2), + ('H',1),('CZC',0,1,3),('H',0),('CX',0,1)) + for start in range(0,16,4): + table=BitslicedTableau(2,2) + for q in range(2): + table.x[q]=[table.ones if (label>>q)&1 else 0 + for label in range(start,start+4)] + table.z[q]=[table.ones if (label>>(q+2))&1 else 0 + for label in range(start,start+4)] + table.apply(word) + for character in range(4): + concrete=materialize_word(word,character) + for column,label in enumerate(range(start,start+4)): + x,z,sign=table.at(character)[column] + self.assertEqual(_conjugate({label:Q2(1)},concrete,2), + {x|(z<<2):Q2(-1 if sign else 1)}) + + def test_quadratic_phase_expansion_on_every_bounded_column(self): + for level in (2,3): + ell=1<<(level-2);k=2*ell;mask=(1<>k + d0,d1=u&mask,u>>ell;a0,a1=v&mask,v>>ell + if kind=='before': + f=(mul(level,u,v)>>ell)^mul(level-1,d0,d1) + else: + f=mul(level-1,d0,a1)^mul(level-1,d1,a0) + expected=trace(level-1,mul(level-1,eta,f)) + actual=0 + for gate in terms: + selected=(eta&gate[-1]).bit_count()&1 + value=1 + for q in gate[1:-1]:value&=(basis>>q)&1 + actual^=selected&value + self.assertEqual(actual,expected) + + def test_complete_signed_cocycle_and_actual_inverse(self): + for p in (2,3,4): + n=1<>start) + if g[0] in ('CZC','ZC') else g + for g in recoupler_word(p)] + for lam in (1<> j) & 1 for j in subset)) << x + for x in range(1 << p)) + for size in range(min(p, degree) + 1) + for subset in combinations(range(p), size)] + + +def _gram_rank(basis, width): + return _rank([sum(_pairing(v, w, width) << j for j, w in enumerate(basis)) + for v in basis]) + + +def _clifford_label(label, word, width): + mask = (1 << width) - 1 + a, b = label & mask, label >> width + for name, *wires in word: + if name == 'H': + j, = wires + difference = ((a ^ b) >> j) & 1 + a ^= difference << j + b ^= difference << j + elif name == 'S': + j, = wires + b ^= ((a >> j) & 1) << j + else: + assert name == 'CX' + control, target = wires + a ^= ((a >> control) & 1) << target + b ^= ((b >> target) & 1) << control + return a | (b << width) + + +def _pauli_helper_image(label, address): + degree, width = 2, 5 + image = _field_image(label, address, degree, 0b111, 1) + helper_query = ((address & 1) << 4) | (((address >> 1) & 1) << 9) + phase = (_hermitian_phase(label, width) + - _hermitian_phase(image, width) + + 2 * _pairing(helper_query, label, width)) % 4 + return image, phase + + +class WeakProbePauliDomainTests(unittest.TestCase): + def test_field_four_cubes_are_literal_scalars_with_helpers(self): + degree, polynomial, helpers = 4, 0b10011, 1 + width = 2 * degree + helpers + basis = [1 << j for j in range(2 * width)] + probes = set(basis) | {a ^ b for a, b in combinations(basis, 2)} + probes.add((1 << (2 * width)) - 1) + cubes = {} + for origin in range(8): + for a, b in combinations(range(1, 8), 2): + order = (origin, origin ^ a, origin ^ b, origin ^ a ^ b) + cubes.setdefault(frozenset(order), order) + self.assertEqual(len(cubes), 14) + for label in probes: + orbit = [_field_image(label, x, degree, polynomial, helpers) + for x in range(8)] + self.assertTrue(all(_pairing(a, b, width) == 0 + for a, b in combinations(orbit, 2))) + for label, cube in product(probes, cubes.values()): + word_label, word_phase = 0, 0 + for address in cube: + image = _field_image(label, address, degree, polynomial, helpers) + sign = (_hermitian_phase(label, width) + - _hermitian_phase(image, width)) % 4 + word_phase = (word_phase + sign + + _product_phase(word_label, image, width)) % 4 + word_label ^= image + self.assertEqual(word_label, 0) + self.assertIn(word_phase, (0, 2)) + + def test_noncommuting_cube_can_have_negative_scalar(self): + # Q_x=H^(x0), P=X, on p=2 addresses. Its symplectic entries have + # degree one and P_x=(X,Z,X,Z) in this fixed cube order. + # The scalar product is -I, not +I; the proof must retain phases. + label, phase = 0, 0 + for value in (1, 2, 1, 2): + phase = (phase + _product_phase(label, value, 1)) % 4 + label ^= value + self.assertEqual((label, phase), (0, 2)) + self.assertEqual(_pairing(1, 2, 1), 1) + nonlinear_character = (0, 0, 0, 1) + requested_phase = (phase + 2 * sum(nonlinear_character)) % 4 + self.assertEqual(requested_phase, 0) + # The exact products differ by sign despite the negative source word. + self.assertEqual((requested_phase - phase) % 4, 2) + + def test_derivative_characterization_and_symplectic_radical(self): + # Exhaust every p=3 Boolean mask, rather than sampling polynomials. + for degree in (0, 1, 2, 3): + code = _span(_rm_basis(3, degree)) + permitted = set() + directions = list(range(1, 8)) + for mask in range(256): + good = True + for ds in combinations(directions, degree + 1): + if _rank(ds) != degree + 1: + continue + cube = _span(ds) + for origin in range(8): + if sum((mask >> (origin ^ x)) & 1 for x in cube) % 2: + good = False + break + if not good: + break + if good: + permitted.add(mask) + self.assertEqual(permitted, code) + for p, degree, helpers in ((3, 1, 0), (4, 1, 3), (5, 1, 3), (5, 2, 1)): + size, width = 1 << p, (1 << p) + helpers + code_basis = _rm_basis(p, degree) + dimension = len(code_basis) + self.assertEqual(_rank(code_basis), dimension) + allowed = code_basis + [1 << (width + j) for j in range(size)] + allowed += [1 << j for j in range(size, width)] + allowed += [1 << (width + j) for j in range(size, width)] + self.assertEqual(_rank(allowed), size + dimension + 2 * helpers) + self.assertEqual(_gram_rank(allowed, width), 2 * dimension + 2 * helpers) + self.assertEqual(len(allowed) - _gram_rank(allowed, width), size - dimension) + + def test_independent_cell_rank_survives_joint_clifford_walls(self): + for p, helpers in product(range(2, 7), (0, 3)): + size, cells = 1 << p, 1 << (p - 2) + width = size + helpers + generators = [] + for cell in range(cells): + for label in (1, 4, 8, 18): + a, b = label & 15, label >> 4 + generators.append((a << (4 * cell)) + | (b << (width + 4 * cell))) + generators += [1 << j for j in range(size, width)] + generators += [1 << (width + j) for j in range(size, width)] + original_rank = _gram_rank(generators, width) + self.assertEqual(original_rank, 2 * cells + 2 * helpers) + wall = [('H', 0), ('S', 1), ('CX', 0, size - 1), ('CX', size - 1, 2)] + if helpers: + wall += [('H', width - 1), ('CX', 1, width - 1), + ('CX', width - 1, 3), ('S', width - 2)] + changed = [_clifford_label(v, wall, width) for v in generators] + self.assertEqual(_rank(changed), 4 * cells + 2 * helpers) + self.assertEqual(_gram_rank(changed, width), original_rank) + allowed_rank = 2 * (p + 1) + 2 * helpers + self.assertEqual(original_rank > allowed_rank, p >= 5) + if p >= 5: + # The weak-probe T-count bound alone would not reject these + # cells; their excessive domain symplectic rank does. + self.assertGreaterEqual(6 * cells, size - (p + 1)) + + def test_exact_field_z_kernel_can_only_contain_constant_affine_masks(self): + for p in range(2, 7): + size = 1 << p + constant = {0, (1 << size) - 1} + for mask in _span(_rm_basis(p, 1)): + orbit = {_translate(mask, x, size) for x in range(size)} + self.assertEqual(len(orbit), 1 if mask in constant else 2) + self.assertTrue(any(_translate(mask, x, size) == mask + for x in range(1, size))) + # Tensor-cell domain dimension exceeds the exact bound from p=3, + # while the four-address cell saturates its permitted dimension. + self.assertEqual(size > p + 2, p >= 3) + self.assertFalse(any(_translate(0b10, x, 2) == 0b10 + for x in range(1, 2))) + for p, degree, polynomial in ((2, 2, 0b111), (3, 4, 0b10011)): + width, addresses = 2 * degree, 1 << p + for label in [1 << j for j in range(2 * width)]: + orbit = {_field_image(label, x, degree, polynomial) + for x in range(addresses)} + self.assertIn(len(orbit), (1, addresses)) + # An affine mask's nonconstant two-point orbit therefore + # cannot inject into a field Pauli orbit at p>=2. + self.assertNotEqual(len(orbit), 2) + + def test_actual_p2_decoder_saturates_exact_dimension_and_z_kernel(self): + word = full_intertwiner() + image_domain = {} + for label in range(256): + row = _conjugate({label: Q2(1)}, word, 4) + if len(row) == 1: + target, coefficient = next(iter(row.items())) + self.assertIn(coefficient, (Q2(1), Q2(-1))) + image_domain[label] = target + self.assertEqual(len(image_domain), 16) + self.assertEqual(_rank(image_domain), 4) + images = set(image_domain.values()) + self.assertEqual({v & 15 for v in images}, _span(_rm_basis(2, 1))) + self.assertEqual({v for v in images if (v & 15) == 0}, {0, 240}) + # Pure target Z pullbacks have exactly the one-dimensional all-Z + # kernel. Three independent affine X masks plus that kernel give + # the saturated dimension p+2=4. + self.assertEqual(_rank(images), 2 + 2) + for helpers in (1, 3): + width = 4 + helpers + lifted = [(v & 15) | ((v >> 4) << width) for v in images] + lifted += [1 << j for j in range(4, width)] + lifted += [1 << (width + j) for j in range(4, width)] + self.assertEqual(_rank(lifted), 2 + 2 + 2 * helpers) + + def test_radius_two_code_bound_and_weight_four_boundary(self): + for p in range(2, 21): + size = 1 << p + sphere_size = 1 + size + size * (size - 1) // 2 + self.assertEqual(sphere_size - 2 * size, + (size - 1) * (size - 2) // 2) + self.assertGreater(sphere_size, 2 * size) + if p >= 3: + self.assertLess(4, size) + # The dual of RM(1,p) supplies the limiting code dimensions used + # in the argument. Exhaust the small p=3,4 masks and find an actual + # minimum of four; the packing step cannot generically promise less. + for p in (3, 4): + size = 1 << p + checks = _rm_basis(p, 1) + code = [mask for mask in range(1 << size) + if all((mask & row).bit_count() % 2 == 0 for row in checks)] + self.assertEqual(len(code), 1 << (size - p - 1)) + self.assertEqual(min(mask.bit_count() for mask in code if mask), 4) + + + def test_projective_pauli_helpers_preserve_labels_but_not_literal_fixing(self): + width = 5 + fixed_labels = [] + for label in range(1 << (2 * width)): + orbit = [_pauli_helper_image(label, address) for address in range(4)] + self.assertTrue(all(_pairing(a[0], b[0], width) == 0 + for a, b in combinations(orbit, 2))) + for x, y in product(range(4), repeat=2): + first, first_phase = _pauli_helper_image(label, y) + second, second_phase = _pauli_helper_image(first, x) + combined, combined_phase = _pauli_helper_image(label, x ^ y) + self.assertEqual((second, (first_phase + second_phase) % 4), + (combined, combined_phase)) + word_label, word_phase = 0, 0 + for image, phase in orbit: + word_phase = (word_phase + phase + + _product_phase(word_label, image, width)) % 4 + word_label ^= image + self.assertEqual(word_label, 0) + self.assertIn(word_phase, (0, 2)) + fixed_labels.append(tuple(image == label for image, _ in orbit[1:])) + self.assertTrue(all(flags in ((False, False, False), (True, True, True)) + for flags in fixed_labels)) + self.assertEqual(sum(all(flags) for flags in fixed_labels), 64) + # X on the helper is literally fixed by the nonzero x=1 query, + # yet negated by x=2. A common fixed LABEL kernel is all we may use. + helper_x = 1 << 4 + self.assertEqual(_pauli_helper_image(helper_x, 1), (helper_x, 0)) + self.assertEqual(_pauli_helper_image(helper_x, 2), (helper_x, 2)) + # A positive canonical Z word never equals the negative of another. + # This gap removes all residual signs after the common-label step. + for left, right, sign in product(range(16), range(16), (1, -1)): + distance = max(abs(sign * (-1) ** ((left & basis).bit_count() % 2) + - (-1) ** ((right & basis).bit_count() % 2)) + for basis in range(16)) + self.assertEqual(distance, 0 if sign == 1 and left == right else 2) + + +if __name__ == '__main__': + unittest.main()