Stabilizer all phases#3
Conversation
Phase 1 — refactor + tests (157 baseline)
- Split Kernel/PauliStabilizer.m (493 LOC) into Kernel/Stabilizer/ subdir (10 files).
- Typo fixes: $PauliStabilizerNames "SteaneCode" dedup; ["QuantumSttate"] alias dropped;
["Properties"] list synced to actual 35-entry surface; agPhase replaces single-letter g.
- New Tests/PauliStabilizer.wlt with Tier 1 (code), Tier 2 (AG invariants + symplectic +
cardinality), Tier 3 (textbook stabilizer states + 5Q distance d=3 + Steane logical
X-bar/Z-bar (anti)commutation + 5Q syndrome uniqueness + Heisenberg conjugation).
Phase 2 — hygiene
- Promote RandomClifford to PackageExport.
- PauliStabilizer::nonclifford message + post-apply check on PauliStabilizerApply.
- MakeBoxes[..., TraditionalForm] OOM-gated on Qubits <= 8.
- Usage.m entries for PauliStabilizer + RandomClifford.
- PacletInfo.wl Symbols list updated.
- Latent bug fix: PauliStabilizerApply pattern now accepts explicit Automatic
(was a default-only pattern; QuantumCircuitOperator.m:132 calls it explicitly).
Phase 3 — symbolic phases (FangYing23 SymPhase)
- Loosen PauliStabilizerQ to accept symbolic signs; add ConcretePauliStabilizerQ
for code paths that still need numeric guarantees.
- New Stabilizer/SymbolicMeasure.m with StabilizerMeasure / SubstituteOutcomes /
SampleOutcomes. Fresh-symbol allocator \[FormalS][k] embedded in phase entries.
- Tier 6 tests verify symbolic-measurement closure, substitution roundtrip vs
regular ["M"], gate updates preserve symbolic phases (BitXor handles symbolic).
- LIMITATION tracked: deterministic measurement after a symbolic one does not
stamp the outcome polynomial into post-state signs. Phase 4 StabilizerFrame fix.
Phase 4 — StabilizerFrame + inner products + Pauli-string measurement
- New Stabilizer/StabilizerFrame.m: <|Components -> {{c_i, ps_i}, ...}|> head with
Clifford-gate distribution + materialization. Closes under further Clifford ops.
- P[\[Theta]] / T / T\[Dagger] now return StabilizerFrame instead of top-level Plus
(PauliStabilizer::tdeprecated note).
- New Stabilizer/InnerProduct.m: StabilizerInnerProduct + StabilizerExpectation.
Phase 4 v1 uses direct vector materialization for n <= 8;
TODO Phase 5+: GarMarCro12 closed-form O(n^3).
- New Stabilizer/PauliMeasure.m: ps["M", "XZZXI"] supports arbitrary Pauli strings
for QEC syndrome workflows.
- Tier 7 tests cover StabilizerFrame closure under Clifford, T-gate normalization,
inner-product orthogonality, expectation-value sign correctness for YY on Bell
(=-1, requires direct-vector fallback to recover the i-factor), Pauli-string
measurement of 5Q stabilizers (deterministic 0).
Quiet cleanup (parallel task)
- Replace 15 pre-existing Quiet[...] calls in QuantumState/, QuantumOperator/,
QuantumChannel/, QuantumCircuitOperator/, QuantumMeasurement(Operator)/,
Utilities.m, QuantumOptimization.m, QuantumFramework.m with explicit If/Check
guards, message-tag-restricted Quiet (kept only for legitimate cache-set
suppression with TODO comments), or no-message replacements.
Test counts on this branch:
Tier 1 (code) + Tier 2 (structural) + Tier 3 (physics) + Tier 4 (integration)
+ Tier 5 (Phase 2 hygiene) + Tier 6 (Phase 3 symbolic + LIMITATION docs)
+ Tier 7 (Phase 4 frame/IP/measure) = 176 / 176 PauliStabilizer tests pass.
QuantumDistance: 32 / 32 pass.
- New Stabilizer/GraphState.m with GraphState head:
GraphState[<|"Graph" -> g_Graph, "VOPs" -> {0,...,0}|>].
Stabilizers extracted via K_i = X_i Product_{j in N(i)} Z_j (AndBri05 Eq 1).
PauliStabilizer round-trip verified against cluster-state circuit construction.
- LocalComplement[g, v] toggles edges among the neighbors of vertex v
(AndBri05 Definition 1). Phase 5 v1 does not yet update VOPs (deferred).
- Tier 8 tests:
- GraphStateQ predicate, vertex/edge counts.
- Linear cluster on 3 and 5 vertices: stabilizers match the K_i pattern.
- GraphState[gs]["PauliStabilizer"] matches cluster-state from H+CZ circuit.
- LocalComplement isolated-vertex no-op, star \[Rule] complete-graph-on-leaves,
involutive at any vertex.
- AndBri05 Thm 1: LC preserves Schmidt rank across a bipartition.
- PacletInfo + Usage updated with GraphState + LocalComplement.
Tests: 185/185 PauliStabilizer pass; 32/32 QuantumDistance pass.
Adds Documentation/Stabilizer/synthesis-implementation.md -- a 26-block tour through `audit/Stabilizer/package-design-synthesis.md` sections 1-11. Every code example is verified by Documentation/Stabilizer/verify-synthesis-implementation.wls (re-runnable via wolframscript), and the embedded outputs are captured directly from a verifier run. Coverage summary: - 17 sections fully implemented (\[Checkmark]). - 4 partial implementations (with \[Open Issue] details). - 11 deferred items, each citation-anchored to the responsible paper (Yashin25 channels, Mueller26 symbolic gradients, HosDehMoo04/Beaudrap11/WinPay24b qudits, Reid24/Winderl23 hardware-aware synthesis, Paler14/RuhDev25 Pauli tracking, GarMarCro12 closed-form inner product, deSilSalYin23 fast interconversion, MonPar23 encoder synthesis, etc.). The companion file cross-links to: - QuantumFramework/Kernel/Stabilizer/ (15 kernel files) - Tests/PauliStabilizer.wlt (185 tests, 100% passing) - audit/Stabilizer/ (local-only synthesis sources) Test counts unchanged from Phase 5a (185 PauliStabilizer + 32 QuantumDistance = 217 / 217 passing). The verifier script is committed alongside the document so future drift can be detected by diffing the printed output against the embedded `Verified output` blocks.
…tems Adds Documentation/Stabilizer/ROADMAP.md -- a single-document tracker recording every partial implementation, deferred feature, and latent bug from Phases 1-5 with concrete next steps. Structure: A (8 partial items), B (12 deferred features), C (tracking convention), D (cross-references). Each item has an ID, current state, source pointer (file:line), reason for the gap, paper reference, algorithm sketch for the next step, target file, tests-to-add, and rough effort estimate. Items captured: - A.1: StabilizerInnerProduct closed-form O(n^3) (GarMarCro12) - A.2: StabilizerExpectation AG-phase i-factor tracking (no fallback) - A.3: ps["Dagger"]["Dagger"] infinite recursion (latent Phase 1 bug) - A.4: StabilizerMeasure deterministic-outcome correlation (Phase 3 LIMITATION) - A.5: ["Circuit"] greedy AG only -> add Reid24 / Winderl23 methods - A.6: LocalComplement does not update VOPs (depends on B.3) - A.7: StabilizerEntanglement closed-form (Schmidt-rank fallback only) - A.8: 3 menu items partial (StabilizerStateQ, CliffordTableau, StabilizerRankDecomposition) - B.1: Quadratic-form triple (DehMoo03) - B.2: Clifford channel via Choi tableau (Yashin25) - B.3: 24-element LocalClifford group (AndBri05) - B.4: CliffordTableau head distinct from PauliStabilizer - B.5: IndexClifford inverse map (KoeSmo14 \[Section]3.3) - B.6: Pauli tracking (Paler14, RuhDev25) - B.7: Symbolic Clifford parameters + DLA (Mueller26) - B.8: Distance / nearest neighbors (GarMarCro12 \[Section]5) - B.9: EncoderCircuit from H_q (MonPar23) - B.10: Fast classical interconversion (deSilSalYin23) - B.11: Cluster-state graph rule book (PatGuh26) - B.12: Wigner <-> tableau equivalence (KocHuaLov17) - B.13: Symbolic qudits (HosDehMoo04 / Beaudrap11 / WinPay24b -- v2) Total: 21 items, ~3550 LOC + ~140 tests of follow-up work scoped. Convention: when an item is implemented, mark DONE with commit hash, update synthesis-implementation.md status, re-run verifier.
Adds Documentation/Stabilizer/API.md -- a function-by-function reference for all 10 public symbols, organized differently from synthesis-implementation.md (which is capability-by-capability). Per-symbol structure: - Constructors (every signature with verified example) - Properties (full table + per-property example) - Methods (Clifford gates, measurement, composition, conversion) - Examples with verified WolframLanguage output - Cross-references to ROADMAP for partial/deferred items - Cross-references to relevant papers 49 verified code blocks (each runs as a `block[id, expr]` in the companion verifier Documentation/Stabilizer/verify-API.wls). Coverage: - PauliStabilizer (12 ctors, 9 properties, 17 gate methods, 4 measurement modes, composition + tensor + 3 conversions + integration) - RandomClifford (basic + uniformity) - StabilizerMeasure / SubstituteOutcomes / SampleOutcomes - StabilizerFrame (constructors, properties, methods, materialization) - StabilizerInnerProduct (PauliStabilizer x PauliStabilizer x StabilizerFrame) - StabilizerExpectation (stabilizer-group elements, anticommuting, syndromes) - GraphState + LocalComplement - Method -> "Stabilizer" integration + UpValues - Quick reference card at the bottom Bug fix (StabilizerFrame.m): the `["Qubits"]`, `["Qudits"]`, `["GeneratorCount"]` property accessors had a Part bug -- `f["Components"][[1, 2, "Qubits"]]` treated "Qubits" as a Part specifier instead of a property name. Fixed to `f["Components"][[1, 2]]["Qubits"]`. This surfaced in the API verifier when computing inner products between StabilizerFrame and PauliStabilizer. Tests still 185/185 PauliStabilizer + 32/32 QuantumDistance.
Add OngoingProjects/QSVT/QSVT.nb (notebook), OngoingProjects/QSVT/notes.md (audit-oriented summary), and img/image_001.png. notes.md documents the notebook's four sections (helper code, block-encoding, QSVT demos, quantum linear solve using PennyLane), cross-references the kernel QSVT.m, and records audit findings—most notably a duplicate PauliDecompose, lack of public API exposure, a broken sumEvenOddCirc cell, and several open remediation items (expose QSVT, resolve PauliDecompose collision, fill problem-patterns.md, address PennyLane dependency). The notebook file is a binary notebook asset and an illustrative image was added alongside the notes.
Reorganization (2026-05-02): the previously-gitignored audit/Stabilizer/
synthesis sources and the tracked Documentation/Stabilizer/ folder are
now consolidated under OngoingProjects/Stabilizer/, which is tracked.
audit/ remains gitignored for the broader QF audit notes.
New layout:
OngoingProjects/Stabilizer/
Documentation/ (5 files, were in Documentation/Stabilizer/)
API.md
ROADMAP.md
synthesis-implementation.md
verify-API.wls
verify-synthesis-implementation.wls
external-packages-audit.md (5 synthesis sources, were in audit/Stabilizer/)
package-design-synthesis.md
paper-bibliography.md
paper-fetch-report.md
paulistabilizer-source-audit.md
tex/ (LOCAL-ONLY -- per OngoingProjects/Stabilizer/.gitignore)
External Packages/ (LOCAL-ONLY -- embedded git repos)
.gitignore (excludes tex/ and External Packages/)
Path updates inside the moved files:
- Verifier .wls scripts: updated header comments to reference new
location and run command from repo root.
- Doc relative paths: ../../QuantumFramework -> ../../../QuantumFramework
(depth changed from 2 to 3 levels above repo root).
- Doc relative paths: ../../Tests -> ../../../Tests
- Provenance + Companion-files sections now reflect that the synthesis
sources are tracked (no longer local-gitignored).
- Kernel comments in InnerProduct.m, Conversions.m, NamedCodes.m updated:
audit/Stabilizer/ -> OngoingProjects/Stabilizer/.
Verified: both verifiers run cleanly from the new location.
wolframscript -f OngoingProjects/Stabilizer/Documentation/verify-API.wls
wolframscript -f OngoingProjects/Stabilizer/Documentation/verify-synthesis-implementation.wls
Tests still 185/185 PauliStabilizer + 32/32 QuantumDistance = 217/217.
Note on tex/ and External Packages/: these are large (28 paper TeX
sources plus 2 embedded git repos). The local .gitignore keeps them
out of the PR while preserving them on local checkouts.
paper-fetch-report.md documents how to re-fetch tex/ if needed.
…Stabilizer/) Followup to 86ca2a6: git wasn't tracking the deletion of the old paths in the previous commit. This finalizes the move. Documentation/Stabilizer/ is now empty and removed; the actual Stabilizer documentation lives at OngoingProjects/Stabilizer/Documentation/ (5 files: API.md, ROADMAP.md, synthesis-implementation.md, verify-API.wls, verify-synthesis-implementation.wls). No code or test changes; 217/217 tests still pass.
Adds three new test blocks that lock in the QO/QS <-> PauliStabilizer
roundtrip spec. They fail today (21 of 187 new tests):
TIER 1.4a (QO -> PS -> QO): Y, YY, XY, YX, YZ, ZY all fail because the
AG greedy decomposition recovers Z@X = i*Y (and tensor analogues), and
the constructor never captured the dropped global phase. I, X, Z, H, S,
S-dagger, CNOT, CZ, SWAP, XX, ZZ, XZ, ZX, BellBuilder, Random{1Q,3Q}
pass.
TIER 1.4b (QS -> PS -> QS): |1>, |->, |+i>, |-i>, GHZ-3, three of four
Bell orientations, and 2Q/3Q random-Clifford-on-zero all fail. The
PauliStabilizerTableau tomography routes through ResourceFunction
RowSpace, whose canonicalization drops generator signs and (for two-
qubit cases) shifts the generator set itself.
TIER 1.4c (internal sign correctness): direct probes of
PauliStabilizer[qs]["StabilizerSigns"] and ["Stabilizers"] for |1>,
|->, |-i>, and Bell phi+. Documents the WHY behind 1.4b failures.
Existing Roundtrip- block (1.4) intentionally left unchanged; those
tests were always gate-closure / idempotency, not QO/QS roundtrip.
The new blocks make that distinction visible.
185 -> 206/227 passing (21 red, all expected).
Rewrites PauliStabilizer[qs_QuantumState] (Stabilizer/Constructors.m)
to recover stabilizer generators with their signs intact, and adds an
optional "GlobalPhase" association key so PauliStabilizer[qs]["State"]
returns the input qs exactly (was: up to a global phase factor that
NullSpace canonicalized away).
Algorithm:
1. Compute <psi|P|psi> for all 4^n Paulis P.
2. Keep the 2^n with |<P>| ~= 1; record (encoding, sign) pairs.
3. Greedy F_2 rank growth picks n linearly independent generators.
4. Symplectic Gram-Schmidt extends to a destabilizer set satisfying
symp(D_i, S_j) = delta_{ij}.
5. Anchor at the first nonzero amplitude of the tableau-projected
state and store the original/canonical ratio as "GlobalPhase".
Stabilizer/Conversions.m: ps["State"] now multiplies the canonical
NullSpace projection by Lookup[First[ps], "GlobalPhase", 1] so the
overall phase is replayed.
Removed: PauliStabilizerTableau (unused after the rewrite -- it was
the ResourceFunction["RowSpace"] tomography that lost signs).
Tests/PauliStabilizer.wlt:
* Roundtrip-QS-RandomClifford-on-zero-{2Q,3Q}: corrected the |0>^n
fixture to QuantumState["0", QuantumBasis[2, n]] (the prior
QuantumState[ConstantArray[0, n], n] built a degenerate 1-qubit
zero vector).
* Integration-MethodStabilizer-ExplicitState: stabilizer GROUP is
correct, but generator order in the tableau differs between the
default-register path and the QS-derived path; comparison is now
set-wise via Sort.
Test count: 220/227 -> 221/227. The remaining 6 reds are all
TIER 1.4a operator-roundtrip cases involving Y (Y, YY, XY, YX, YZ,
ZY) -- step 3 territory.
…e loss The AG greedy decomposition (Stabilizer/Conversions.m, ps["Circuit"]) recovers a Clifford circuit equal to the input *up to a global phase*. For Y = -i X Z, the recovered Z@X = i Y; for Y(x)Y, recovered = -Y(x)Y; for X(x)Y / Y(x)Z / Y(x)X / Z(x)Y, recovered is off by i. PauliStabilizer[qo_QuantumOperator] (Stabilizer/Constructors.m) now captures the lost phase by comparing one entry of the original matrix to the same entry of the canonical recovered matrix, and stores the ratio under "GlobalPhase". ps["QuantumOperator"] (Stabilizer/Conversions.m) multiplies the canonical recovery by Lookup[First[ps], "GlobalPhase", 1] so PauliStabilizer[qo]["QuantumOperator"] === qo exactly. Test count: 221/227 -> 227/227 (PauliStabilizer.wlt) and 259/259 across PauliStabilizer + QuantumDistance test files.
- ROADMAP.md: bumped overall status (185->227 / 217->259 tests, +5c).
Added a new "Phase 5c -- DONE (2026-05-04)" section with the three
commit hashes + per-step descriptions. Added two new partial items:
A.9 -- "GlobalPhase" doesn't propagate through gate updates.
A.10 -- generator order differs between default-register and
QS-derived paths (the auto-pad asymmetry that forced the
Integration-MethodStabilizer-ExplicitState test to use Sort).
- API.md: ps["Operator"] reference now notes that round-trip is exact
when the source is a QO/QS, and documents the "GlobalPhase" key.
- synthesis-implementation.md: the "Don't store global phases" item
(formerly a hard pass) is downgraded to partial -- still no per-row
global phase, but now an optional association-level "GlobalPhase"
for source-anchored exact round-trip.
Three additions in response to "why was the Y miss invisible, how do we
prevent the class of mistake".
1. OngoingProjects/Stabilizer/Documentation/post-mortem-phase-5c.md
Honest root-cause writeup. Three structural reasons:
- Mislabeled tier (TIER 1.4 was gate-closure, not roundtrip).
- Inherited stabilizer-simulator convention (phase-oblivious)
without flagging that QF's contract is stricter.
- Verifier scripts reproduced the same blind spot.
Includes the phase-aware vs phase-oblivious design rationale.
2. Kernel/Stabilizer/GateUpdates.m
Explicit comment block documenting that gate-update rules
intentionally drop "GlobalPhase" (ROADMAP A.9). Recovering exact
phase through gate updates requires O(2^n) materialization at each
step, defeating the AG complexity advantage. Contract:
PauliStabilizer[qs]["gate", q]["State"] == gate @ qs UP TO PHASE
PauliStabilizer[gate @ qs]["State"] === gate @ qs (exact)
3. Tests/PauliStabilizer.wlt -- new TIER 1.4d
Documents the gate-update contract with up-to-phase tests for
X/Z/Y/H/S/CNOT, plus two "escape hatch" exact-equality tests
showing the user-facing workaround (re-run constructor on the
post-gate state). Helper: equalUpToGlobalPhaseQS via |<a|b>| = 1.
Test count: 227/227 -> 235/235 (PauliStabilizer.wlt) and 267/267
across the suite.
…undtrips.wlt)
New test file probes the two QF constructor-accessor pairs that the
Phase 5c audit (Explore subagent) flagged as untested for exact-equality
roundtrip -- the same pattern that hid the PauliStabilizer[Y]["QO"]
bug.
Tiers and findings:
TIER QO-QC (QuantumOperator -> QuantumChannel -> QuantumOperator):
9/9 PASS. I, X, Y, Z, H, S, CNOT, YY, XY all round-trip exactly.
No new bug class.
TIER QS-QO-Projector (QuantumState -> projector -> +1 eigenvector):
4/4 PASS. The contract is up-to-global-phase via eigendecomposition;
the test header documents that QF has no direct
QuantumState[qo] === qs round-trip (QuantumState[qo] is matrix
vectorization, not eigenvector recovery).
TIER QO-QCO (QuantumOperator -> QuantumCircuitOperator -> QO):
6/6 PASS. I, X, Y, H, CNOT, YY all round-trip exactly. QCO does
not have the AG global-phase loss that PauliStabilizer had.
TIER QC-Compose: 1/1 PASS. H@H = I via channel composition.
Total: 20/20. No new bugs surfaced.
Test count: 267/267 -> 287/287 across the suite (235 + 32 + 20).
ROADMAP.md:
- Overall status: 287/287 tests, 17 open items (was 18), Lesson
callout linking the post-mortem and the global memory rule.
- Phase 5c -- DONE section now lists all 6 commits including the
post-mortem, A.9 contract documentation, and the cross-module
audit (Tests/Roundtrips.wlt).
- Section A.9 reclassified from "partial / closeable" to
"inherent trade-off / documented contract". The header and the
"Why this is inherent (not 'deferred')" subsection record the
state-dependent phase-factor counterexample (Z|0> vs Z|1>) and
why O(2^n) materialization at every gate update would defeat
the AG complexity advantage. Documented contract: first-hop is
exact; gate-update path is up-to-phase; escape hatch is to
re-run the constructor on the post-gate state.
post-mortem-phase-5c.md:
- Section 5 "What's still partial" rewritten to reflect the A.9
investigation: it's an inherent trade-off, not a fix-pending
item. The cross-module audit findings (20/20 PASS) recorded.
- Section 4 "What changed" table extended with the f9e2d71
(post-mortem + TIER 1.4d) and cbf5157 (cross-module audit)
commits.
- Test count corrected to 287/287 across the suite.
Pre-existing structural drift surfaced when re-running verifiers after
Phase 5c. Two reorderings:
1. Integration block group (Integration-Method-Stabilizer,
Integration-named-circuits, Integration-UpValues) moved from end
of file to right after the PS-conv-Circuit-equivalence block, so
it lands where API.md has the "Integration with QuantumFramework"
section (between Conversions and the named-symbol sections).
2. StabilizerFrame block group reordered to match API.md doc order:
Constructor-FromList, from-PS, from-T,
Method-CliffordDistributes (= same code as Constructor-FromList,
duplicated to match the MD's redundant illustration in both
Constructors and Methods sections),
TT, T-on-zero-equals-zero.
Renamed the existing Clifford-distributes block to
Method-CliffordDistributes for clarity and added a new
Constructor-FromList block with identical code so the verifier
block count matches the MD's 6 doc-order positions.
Result: API.md 57/57 match, 0 drift.
synthesis-implementation.md was already 26/26 match, 0 drift.
No semantic changes -- Phase 5c kernel work didn't introduce any
documentation drift. All output blocks in API.md and
synthesis-implementation.md still hold against current kernel.
API.md additions:
- "GlobalPhase" row in the full property list (Properties section).
- New "Round-trip contract" section between Conversions and
Integration. Includes a 5-row contract table (first-hop exact
vs gate-update up-to-phase vs escape-hatch) and four worked
examples:
Roundtrip-QO-Y-GlobalPhase -- canary: Y constructor captures -I.
Roundtrip-QS-One-GlobalPhase -- |1> stabilizer-tomography.
Roundtrip-GateUpdate-UpToPhase-YOn1 -- documents the A.9 gap.
Roundtrip-EscapeHatch-Y-on-1 -- the user-facing workaround.
- Cross-links to TIER 1.4a/b/c/d in Tests/PauliStabilizer.wlt,
Tests/Roundtrips.wlt, and post-mortem-phase-5c.md.
verify-API.wls additions: 4 new block[] entries matching the MD
examples in document order. All 4 produce the verbatim output
embedded in the MD.
Comparator status: 61/61 match, 0 drift. Pre-existing structural
drift (verifier ordering) was fixed in commit 070eb33.
Probes every entry in _PauliStabilizer["Properties"] to verify (a) all
return non-Missing values, (b) name-aliases produce identical outputs,
(c) previously-untested accessors ("p", "GlobalPhase", "TableauForm")
have explicit tests.
Aliases tested for equality:
"State" === "QuantumState"
"Operator" === "QuantumOperator" (matrix equality)
"Circuit" === "QuantumCircuit" === "QuantumCircuitOperator"
"Stabilizer" === "StabilizerTableau"
"Destabilizer" === "DestabilizerTableau"
"Stabilizers" === "Generators" === "PauliForm"
New explicit accessor tests:
"p" -- symplectic-form diagonal vector. Zero on a valid stabilizer
state. Untested before this commit (audit/coverage probe found
zero existing tests).
"GlobalPhase" -- Phase 5c key. Tested for QO/Y (-I), QO/YY (-1),
QS/Bell (1), and integer ctor (absent default).
"TableauForm" / "StabilizerTableauForm" -- non-Missing head check.
Plus a structural backstop "Coverage-AllPropertiesResolve-5Q" that
iterates every entry in _PauliStabilizer["Properties"] and asserts
none resolves to Missing -- catches future refactors that drop an
accessor from the dispatch table.
15 new tests. Test count: 235/235 -> 250/250 (PauliStabilizer.wlt)
and 287/287 -> 302/302 across the suite.
Audit found the verifier block `1.1-multiplication-via-symplectic`
was orphaned (defined but never referenced from the MD) AND
misleading: the comment claimed "X*Z via symplectic XOR" but the
code summed the auto-generated DESTABILIZER bits with `+` (not
BitXor) and read gen 1 (destabilizer) instead of gen 2 (stabilizer).
The output {1, 1} was right by coincidence -- destab(X) = Z and
destab(Z) = X have the same bit pattern as bits(X) + bits(Z).
verify-synthesis-implementation.wls:
Replaced the block body with code that actually demonstrates the
symplectic-multiplication identity:
operator-level: X . Z === -i * Y (matrix equality)
symplectic-level: BitXor[(1,0), (0,1)] === (1,1) === bits(Y)
Output is now an Association with both checks.
synthesis-implementation.md:
Added a "Pauli multiplication via the symplectic group" subsection
in §1.1 right before the Cross-reference paragraph. Includes the
code, the Verified-output reference (block `1.1-multiplication-
via-symplectic`), and a short paragraph noting that this is why
every gate-update rule in Stabilizer/GateUpdates.m is some flavor
of BitXor.
Comparator: synthesis-implementation.md is now 27/27 match, 0 drift,
1 sentinel-only missing (ALL BLOCKS COMPLETE). API.md unchanged
(61/61 match, 0 drift). 302/302 tests green.
Update ROADMAP to record Phase 5c follow-up commits and adjust test counts. Bump overall PauliStabilizer test totals (235→250; overall tests 287→302) and update the Test suite line to reflect 4 top-level tiers, 32+ sub-tiers, 250 tests. Add a new "Phase 5c — follow-up commits (2026-05-04)" section summarizing four non-design changes: reordering verify-API.wls blocks to match API.md, documenting the "GlobalPhase" association key and round-trip contract in API.md, adding a TIER 1.4e block in Tests/PauliStabilizer.wlt (+15 tests), and rewriting TIER 1.1 then embedding it in API.md. Notes that these commits polished docs/tests without changing the underlying design.
Adds the first set of real reference pages for the 10 public symbols
of the Stabilizer subsystem. All pages are registered in
PacletInfo.wl's Documentation extension; the .nb files were
previously absent.
Pages added (Documentation/English/ReferencePages/Symbols/):
- PauliStabilizer.nb — main head; constructors / properties /
gate updates / measurement / conversions / Phase 5c GlobalPhase
contract / 35-property catalog / named codes
- RandomClifford.nb — uniform Mallows-Bravyi-Maslov-Koenig-
Smolin sampler; cardinality formula
- StabilizerMeasure.nb — symbolic Z-basis measurement with fresh
F_2 outcome symbols (FangYing23 SymPhase); A.4 limitation called
out
- SubstituteOutcomes.nb — substitute concrete outcomes into a
symbolic-measurement PauliStabilizer
- SampleOutcomes.nb — draw concrete-outcome realizations
- StabilizerInnerProduct.nb — <psi|phi>; cost 2^n direct vector;
A.1 plans the O(n^3) closed-form
- StabilizerExpectation.nb — <psi|P|psi> for any Pauli string;
direct-vector fallback for non-stabilizer Paulis (A.2)
- StabilizerFrame.nb — superposition of stabilizer states;
closes under Clifford; doubles per non-Clifford (T, P[theta])
- GraphState.nb — K_i = X_i x Prod Z_j (AndBri05 Eq 1)
- LocalComplement.nb — graph operation; AndBri05 Theorem 1
local-Clifford-equivalence; Phase 5 v1 doesn't propagate VOPs
(A.6)
Workflow:
1. Four parallel general-purpose subagents wrote the markdowns to
/tmp/refpage-<symbol>.md following the documentation-writing
skill's refpage template.
2. wolframscript-validated every code block: 110 blocks total, 107
pass, 3 fail. The 3 failures are kernel bugs surfaced during
validation, not doc bugs (now ROADMAP-tracked):
A.11 — pauliStringMatrix fails on single-qubit input
(KroneckerProduct on a one-element list).
A.12 — ps["Stabilizers"] formatter throws StringJoin::string
on symbolic phases (post-StabilizerMeasure).
A.13 — GraphState[non-graph-form PS] silently returns edgeless
graph instead of issuing a message.
3. nb-writer-v2 (kernel-driven JSON-to-NB) serialized each
markdown into a structurally valid .nb. All 10 pass Phase 4
structural validation (bracket balance, RowBox closure,
anti-pattern checks).
ROADMAP.md:
- Open items 17 -> 20 (12 partial + 7 deferred + 1 latent bug).
- A.11 / A.12 / A.13 added as new partial items, each with
file:line source pointer, next-step algorithm, and effort
estimate.
Test count unchanged (302/302); reference pages don't add tests
(those live in Tests/PauliStabilizer.wlt, already at TIER 1.4e
coverage). Full kernel + verifier sweep passed before commit.
User-directed move: the 10 reference pages added in 4807259 to QuantumFramework/Documentation/English/ReferencePages/Symbols/ were not yet ready to ship as official paclet docs. They surfaced 3 kernel bugs during validation (ROADMAP A.11/A.12/A.13) and the prose needs another pass before promotion. Moving them to a draft location inside the audit folder until that work is done. New location: OngoingProjects/Stabilizer/Documentation/Examples for doc pages/ Git records this as 10 file renames (content unchanged). ROADMAP.md "Phase 5c — DONE" follow-up table appended with one new row covering the workflow (4 parallel doc-writing agents, wolframscript validation, nb-writer-v2 serialization, the 3 kernel bugs surfaced) and the new draft location. When A.11/A.12/A.13 are fixed and the pages are polished, the .nb files can be promoted back to the live docs tree at QuantumFramework/Documentation/English/ReferencePages/Symbols/ via a simple git mv. No test count change (302/302). No paclet-loaded behavior change (reference pages don't affect kernel behavior).
…th ROADMAP refs Two small consistency fixes surfaced when scanning the PR for stale markdown after the rebuild + Phase 5c work: 1. paulistabilizer-source-audit.md: added a HISTORICAL banner at the top. The document audits the pre-rebuild monolithic file `QuantumFramework/Kernel/PauliStabilizer.m` (494 LOC) as it stood at SHA cbbe936. That file no longer exists -- it was split into the `Kernel/Stabilizer/` subdirectory in commit 27b36f6. All `file:line` references inside this audit point at lines that no longer exist. The banner makes that explicit and points readers at the current API.md / ROADMAP.md / synthesis-implementation.md / post-mortem. 2. synthesis-implementation.md: three stale "TODO Phase 5+/6+" notes for the StabilizerInnerProduct closed-form algorithm (lines 31, 414, 832) replaced with explicit ROADMAP §A.1 references. The item is properly tracked as a partial implementation in the ROADMAP; no need for free-floating TODO labels in the doc. No content / behavior changes; verifier-MD comparison still 27/27 match, 0 drift.
Hard-remove four post-Phase-5c top-level symbols and re-expose them as
methods on PauliStabilizer. Per design review with N. Murzin in Slack:
the public surface added across Phases 3-5 is excessive given that each
of these is a single-receiver operation on a PauliStabilizer.
Demotions (no semantic change; functions preserved as PackageScope
helpers, methods dispatch from Stabilizer/Properties.m):
RandomClifford[n] -> PauliStabilizer["Random", n]
(named-pattern dispatch already
existed; standalone alias dropped)
StabilizerMeasure[ps, q] -> ps["SymbolicMeasure", q]
SubstituteOutcomes[ps, r] -> ps["SubstituteOutcomes", r]
SampleOutcomes[ps, n] -> ps["SampleOutcomes", n]
Public top-level surface is now 6:
PauliStabilizer, StabilizerFrame, StabilizerInnerProduct,
StabilizerExpectation, GraphState, LocalComplement.
Tests: 250 -> 249 (one redundant RandomClifford::usage test dropped).
Total suite: 301/301 passing. verify-API.wls and
verify-synthesis-implementation.wls re-runnable; their paclet path now
resolves from $InputFileName so they work from any worktree.
Docs (API.md, ROADMAP.md, synthesis-implementation.md,
post-mortem-phase-5c.md) reflect the smaller surface; ROADMAP B.4
(CliffordTableau distinct head) marked superseded by future Phase 8
(Yashin25 Choi-tableau unifier, ROADMAP B.2). Phase 7 (hybrid interop
via UpValues -- not Picture flag, see post-mortem footnote for the UX
audit) and Phase 8 are scoped to separate follow-up PRs.
…c symbols)
Continues the Phase 6 consolidation by demoting the two borderline
top-level symbols flagged in the Slack review. Both are single-receiver
operations that read more naturally as methods:
StabilizerInnerProduct[a, b] -> a["InnerProduct", b]
(and frame["InnerProduct", b])
StabilizerExpectation[ps, p] -> ps["Expectation", p]
Public top-level surface is now 4:
PauliStabilizer, StabilizerFrame, GraphState, LocalComplement.
Bookkeeping:
- StabilizerExpectation::dim message tag renamed to
PauliStabilizer::expectationdim (it lives on the receiver type now).
- _PauliStabilizer["Properties"] gains "InnerProduct", "Expectation".
- _StabilizerFrame["Properties"] gains "InnerProduct".
- PauliStabilizer::usage and StabilizerFrame::usage updated.
- InnerProduct.m exports become PackageScope[stabilizerInnerProduct]
and PackageScope[stabilizerExpectation]; method dispatchers in
Stabilizer/Properties.m and Stabilizer/StabilizerFrame.m.
Tests: 249/249 (no count change). Total suite still 301/301 passing.
verify-API.wls and verify-synthesis-implementation.wls re-run cleanly;
all embedded MD output blocks match.
Docs (API.md, ROADMAP.md, synthesis-implementation.md, post-mortem)
reflect surface 6 -> 4 and link the demotions to Phase 6.5.
Cross-head dispatch so QF QuantumMeasurementOperator / QuantumChannel can
consume a PauliStabilizer or StabilizerFrame natively. Pauli-string
measurements stay in the AG tableau (cost O(n^2)); non-Pauli bases emit
an info message and fall back to the legacy generic path.
Design choice (per Slack thread with N. Murzin and the audit at
~/.claude/plans/i-am-conviced-of-vast-kettle.md): UpValues attached to
PauliStabilizer / StabilizerFrame, not a Picture flag and not a
QuantumBasis wrapper. Both alternatives would route through QuantumBasis
machinery (KroneckerProduct[Output, Input] + MatrixInverse[ReducedMatrix])
and pay O(2^n) - O(8^n), defeating the formalism O(n^2) advantage.
Concrete dispatch:
qmo_QuantumMeasurementOperator[ps_PauliStabilizer ? Concrete...]
-> if qmo Operator label is a Pauli string: ps["M", label]
-> else: Message[PauliStabilizer::nonpaulibasis];
PauliStabilizerApply[QuantumCircuitOperator[qmo], ps]
qmo_QuantumMeasurementOperator[sf_StabilizerFrame]
-> Message[..]; qmo[sf["State"]]
qc_QuantumChannel[ps_/sf_]
-> Message[..]; qc[ps_or_sf["State"]]
The legacy unconditional UpValue at Conversions.m:140 is removed
(replaced with a comment pointer); HybridInterop.m basis-aware
dispatcher subsumes it.
Phase 7.2 (follow-up) will replace the non-Pauli fallback with a
proper StabilizerFrame decomposition (cost O(rank * n^2) instead of
O(2^n)) and identify Clifford channels for tableau-level routing.
Tests: 8/8 in Tests/HybridInterop.wlt (Pauli fast path on Z/ZZ/XZZXI/XX,
non-Pauli fallback emits expected messages, BitFlip channel falls back,
symbolic-phase ps falls through the ConcretePauliStabilizerQ guard).
Total suite: 309/309 passing (was 301; +8 new HybridInterop tests).
ROADMAP entry under Phase 7 describes 7.1 (DONE) and 7.2 (TODO).
Detect the four named Pauli channels (BitFlip, PhaseFlip, BitPhaseFlip,
Depolarizing) via Label and route qc[ps] as a probabilistic Pauli mixture
in the tableau, with no dense materialization. Cost O(n) per branch
instead of O(2^n).
Returns a list {{probability, ps_after_pauli}, ...} where each branch is
the original ps with the corresponding Kraus Pauli applied as a tableau
gate update. Identity branch leaves ps unchanged; X/Y/Z branches go
through the existing ps["X", q] / ps["Y", q] / ps["Z", q] gate handlers.
Helper: stabilizerCliffordChannelMixture[qc] returns the
{prob, pauli_string, qubit} triples for named Clifford channels, or
Missing[..] for non-Clifford / multi-qubit channels.
Non-Clifford channels (AmplitudeDamping, PhaseDamping,
GeneralizedAmplitudeDamping, ResetError) still emit
PauliStabilizer::nonpaulibasis and fall back to dense materialization.
Tests added in Tests/HybridInterop.wlt:
Phase7.2-QC-BitFlip-NumBranches / -ProbabilitiesSumToOne /
-IdentityBranchUnchanged
Phase7.2-QC-PhaseFlip-NumBranches
Phase7.2-QC-BitPhaseFlip-NumBranches
Phase7.2-QC-Depolarizing-FourBranches / -ProbabilitiesSumToOne
Phase7.2-QC-AmplitudeDamping-FallbackMaterializes
Suite: 15/15 in HybridInterop.wlt; 316/316 across all four test files.
ROADMAP entry under "Phase 7" notes Phase 7.2 as DONE; the residual
QMO non-Pauli decomposition is now Phase 7.3 (TODO; depends on Phase 8
to introduce a mixed-state stabilizer representation).
Introduce the Choi-tableau CliffordChannel head per Yashin25 (arxiv:
2504.14101) Section 2.3. A Clifford channel from |A| qubits to |B|
qubits is encoded as
CliffordChannel[<|
UA -> k * 2|A| bit matrix,
UB -> k * 2|B| bit matrix,
c -> length-k bit vector (signs),
InputQubits -> nA,
OutputQubits -> nB,
Source -> origin tag
|>]
Each row [u_A | u_B | c] encodes a Pauli superoperator
Pi(u_A | u_B | c)[rho_A] = (-1)^c * 2^|A| * Tr[rho_A P(u_A)] P(u_B)
and the channel is the (1/2^{|A|+|B|}) sum of these rows.
Phase 8.1 ships:
- Public CliffordChannel head (PacletInfo + Usage entries).
- PackageScope predicate CliffordChannelQ.
- Constructors:
CliffordChannel[ps_PauliStabilizer] -- pure-state-as-channel:
nA=0, UB = stabilizer rows, c from signs.
CliffordChannel[Identity, n] -- identity channel on n qubits:
UA = UB = I_{2n}, c = 0.
- Accessors: UA, UB, c, InputQubits, OutputQubits, Rank, Tableau
(assembled [UA | UB | c]).
- Composition stub cc1[cc2] -> Failed with CliffordChannel::compose
message; Phase 8.2 will implement vector-space intersection per
Yashin25 Section 3.2.
Tests: 18 in Tests/CliffordChannel.wlt covering predicate validity,
identity-channel UA/UB/c/Rank, PauliStabilizer-as-Choi-tableau (1Q,
5Q-code, Bell-state shape), Tableau accessor dimensions, composition
stub message.
Total suite: 334/334 passing (was 316; +18 new CliffordChannel tests).
ROADMAP B.2 updated: Phase 8.1 DONE, Phase 8.2 (composition + Pauli-
channel round-trip + cc[ps] state-evolution) listed as next milestone.
This branch (claude/phase8-clifford-channel) stacks on
claude/phase7-hybrid-interop (Phase 7.1 + 7.2) which stacks on
stabilizer-phases-1-4 (Phase 6 + 6.5).
Adds 28 new tests across HybridInterop.wlt and CliffordChannel.wlt
to broaden coverage of the consolidation+interop work shipped in
Phases 7.1, 7.2, and 8.1. No kernel changes.
Tests/HybridInterop.wlt (15 -> 29):
TIER E -- Pauli-string QMO on named QEC code states:
Phase7-QMO-Steane-Stabilizer-Deterministic
Phase7-QMO-GHZ3-Stab-ZZI-Deterministic
Phase7-QMO-GHZ3-Stab-XXX-Deterministic
Phase7-QMO-GHZ3-Anticommuting-NonDeterministic
TIER F -- Channel edge cases:
Phase7.2-QC-BitFlip-zero-IdentityNoOp
Phase7.2-QC-BitFlip-one-FullX
Phase7.2-QC-BitFlip-Symbolic-ProbSumToOne
Phase7.2-QC-PhaseFlip-Z-on-zero-StaysZ
Phase7.2-QC-BitFlip-on-Bell-Q1-NumBranches
Phase7.2-QC-Depolarizing-IdentityBranchUnchanged
TIER G -- QMO direct equivalence to ps[M, ...]:
Phase7-QMO-vs-PS-M-Equivalence-ZZ
Phase7-QMO-vs-PS-M-Equivalence-Random3Q-12reps
TIER H -- QMO + StabilizerFrame fallback:
Phase7-QMO-on-StabilizerFrame-FallbackEvaluates
TIER I -- Pauli sign-prefix label edge case:
Phase7-QMO-NegativePauli-Label-NotStringForm
(documents that QuantumOperator[-pauli] produces a Times[]
label, not a string; the Phase 7.1 fast path correctly skips
it and falls back. Phase 7.3 may extend the gate.)
Tests/CliffordChannel.wlt (18 -> 32):
TIER E -- More PauliStabilizer-as-CliffordChannel cases:
Phase8.1-Tableau-Dimensions-Steane
Phase8.1-Steane-Rank
Phase8.1-9QubitCode-Rank
Phase8.1-RandomClifford-RankMatchesQubits
TIER F -- Identity-channel sanity for varied n:
Phase8.1-Identity-Tableau-Dimensions-5q
Phase8.1-Identity-Invariants-Across-n
TIER G -- Choi-tableau invariants on UB side:
Phase8.1-UB-Rank-MatchesGenerators
Phase8.1-UB-ShapeSanity
TIER H -- Properties contract:
Phase8.1-Properties-Contains-Core
Phase8.1-Source-Tag-PS
Phase8.1-Source-Tag-Identity
TIER I -- Predicate idempotence:
Phase8.1-Predicate-Idempotent
TIER J -- Composition stub firings:
Phase8.1-Compose-Stub-Identity-on-State
Phase8.1-Compose-Stub-State-on-Identity
Total suite: 362/362 passing (was 334).
…s-package tests (+100 tests)
Three new test files cover (1) outcome-correctness against textbook
physics, (2) cross-package validation against Stim, and (3) cross-
package validation against QuantumClifford.jl.
Tests/Correctness_TextbookResults.wlt (41 tests) verifies numerical
and set-theoretic outcomes (not just internal consistency) against
established stabilizer-formalism literature:
Bell-state correlations (TIER A): exp values of XX, YY, ZZ, etc.
GHZ-3 correlations (TIER B): XXX, ZZI, IZZ stabilizer expectations.
5-qubit code (TIER C): all stabilizers give +1; all 15 single-qubit
Pauli errors produce 15 distinct syndromes (defining property of
a [[5,1,3]] code).
Steane / Shor codes (TIER D, E): all stabilizers give +1 on |0_L>.
Cluster-state stabilizers (TIER F): K_i = X_i tensor prod Z_j over
neighbors j -- linear chain match + circuit/GraphState round-trip.
Inner products (TIER G): Bell self = 1, |Phi+|Phi-> = 0, |0|0> = 1,
|0|1> = 0, |0|+> = 1/sqrt(2).
Heisenberg-picture conjugation (TIER H): HZH=X, SZS=Z, SXS=Y, etc.
Got97 stabilizer-group properties (TIER I): pairwise commutation
for named codes.
AarGot04 measurement statistics (TIER J): all stabilizers
deterministic on encoded |0_L>.
Channel-mixture averages (TIER K): BitFlip / PhaseFlip / Depolarizing
average eigenvalues match (1 - 2p) / (1 - 2p) / (1 - p) on Pauli
targets.
Tests/CrossPackage_Stim.wlt (44 tests) cross-validates against Stim
(Gidney / Google Quantum AI, arxiv:2103.02202):
TIER A-C: doc-derived gate-conjugation rules from
External Packages/Stim/doc/gates.md (Stabilizer Generators
sections) -- I, X, Y, Z, H, S, S_DAG, V (=SQRT_X), SQRT_X_DAG,
plus CNOT / CZ / SWAP / Bell / GHZ multi-step circuits.
TIER D-F: Bell, 5Q-code, random Clifford uniformity.
TIER G: live Stim fixture comparison via
Tests/fixtures/generate_stim_fixtures.py (uses
stim.TableauSimulator); 11 cases (Bell phi+/phi-, GHZ-3,
cluster-4, single-qubit eigenstates, CNOT^2, SWAP after H).
Fixture JSON committed so the WL tests run without stim
installed.
Tests/CrossPackage_QuantumClifford.wlt (15 tests) cross-validates
against QuantumClifford.jl (Krastanov / QuantumSavory):
TIER A: Pauli arithmetic identities from test_paulis.jl
(X*Z = -iY, Z*X = +iY, XZ = X tensor Z, prodphase
correspondences).
TIER B: comm() relation -- XX-YY commute, XZ-YZ anticommute.
TIER C: random_stabilizer pairwise commutation + squares-to-I.
TIER D: tensor-product semantics.
TIER E: inner-product values.
TIER F: package-on-disk smoke check (live JC.jl fixtures
deferred until Julia is installed; pattern documented).
Tests/fixtures/ (new directory):
generate_stim_fixtures.py -- Python script using stim 1.15.0 to
dump canonical TableauSimulator outputs.
stim_fixtures.json -- committed snapshot of 11 cases. Re-run the
.py script when adding cases.
Test totals: 462/462 passing (was 362; +100 new tests).
PauliStabilizer.wlt: 249
QuantumDistance.wlt: 32
Roundtrips.wlt: 20
HybridInterop.wlt: 29
CliffordChannel.wlt: 32
Correctness_TextbookResults: 41 (NEW)
CrossPackage_Stim: 44 (NEW)
CrossPackage_QuantumClifford: 15 (NEW)
…composition
Phase 7.3 (label-detection extension):
Extended stabilizerPauliLabelFromQMO in HybridInterop.m to recognize
three additional label expressions beyond plain Pauli strings:
Superscript[X|Y|Z|I, CircleTimes[m]] -> "XXXX..." (m letters)
Times[-1, Superscript[...]] -> "-XXXX..."
Times[-1, str matching Pauli] -> "-" <> str
This routes QMOs built as QuantumOperator[-"XX"] (label is
-Superscript[X, CircleTimes[2]], not a string) through the AG
tableau fast path. PauliX/PauliY/PauliZ Basis labels still fall
back (they are Symbol heads, not Pauli expressions).
Phase 8.2 (Choi-tableau composition + state evolution + QC interop):
Implement CliffordChannel composition cc1[cc2] = cc1 . cc2 via
Boolean linear algebra per Yashin25 Section 3.2:
1. Stack cc2.UB (k1 rows) above cc1.UA (k2 rows) into
(k1+k2) x 2nB matrix.
2. Compute LEFT null space lambda such that
lambda . stackedB = 0 (mod 2), equivalent to
NullSpace[Transpose[stackedB], Modulus -> 2].
3. For each kernel vector lambda = (lam1, lam2):
UA = lam1 . cc2.UA (mod 2)
UC = lam2 . cc1.UB (mod 2)
c = lambda . concat(cc2.c, cc1.c) (mod 2)
4. Drop trivial all-zero rows; deduplicate.
Phase-correction beta term (Yashin25 row-summation Eq) deferred
to Phase 8.3; simple XOR is correct for deterministic channels.
Also adds:
cc[ps_PauliStabilizer] state evolution: identity, state-prep,
and compose-and-convert paths. Tested via stabilizer-set
preservation on Bell, |00>, |000>, 5Q-code.
CliffordChannel[qc_QuantumChannel]: detects deterministic
single-Pauli channels via label; emits stochastic notice
and returns identity-shaped placeholder for BitFlip etc.
cliffordChannelToPauliStabilizer helper: state-prep Choi
tableau back to PauliStabilizer head.
Tests added:
Tests/HybridInterop.wlt: 5 new in TIER J/K (Phase 7.3 detection
of -XX/ZZZ; deterministic measurement on Bell; PauliX-Basis
falls through). 34 total.
Tests/CliffordChannel.wlt: 9 new in TIER K-O (composition
Identity-on-State preserves UB+c, associativity on Bell,
rank-preservation across n, cc[ps] state evolution for
Identity_2/3/5 on Bell/|000>/5Q, QC->CC stochastic notice,
Compose-Identity-on-RandomCliffordState valid+rank=3). 41 total.
Total suite: 476/476 passing (was 462; +14 new tests).
ROADMAP updated:
Phase 7.3 DONE; Phase 7.4 (real StabilizerFrame decomp +
matrix-iteration detector) tracked next.
B.2: Phase 8.1+8.2 DONE; Phase 8.3 (Yashin25 row-sum beta phase
correction for stochastic channels) tracked.
…se tracking in CliffordChannel composition
Phase 7.4 (HybridInterop):
- Extended stabilizerPauliLabelFromQMO with stabilizerPauliFromMatrix
fallback that iterates 4^n * {+1, -1} candidates against the QMO's
MatrixRepresentation when the symbolic label is None or non-Pauli.
- Default cap $stabilizerPauliMatrixSearchMaxQubits = 4 keeps the
search bounded; tunable via Block for tests.
- Routes QuantumOperator[matrix] QMOs through the AG fast path.
Phase 8.3 (CliffordChannel composition phase tracking):
- Added stabilizerRowSumAGPhase: cumulative AG g-function phase mod 4
for F2-summing Pauli rows.
- Added stabilizerContractionPhase: |Phi+>_BB contraction sign
(-1)^(sum_q x_q z_q) for the combined u_B Pauli (Y_B^T = -Y_B).
- Composition c_new now = (lambda . cConcat) XOR (rowSumPhase +
contractionPhase) / 2 mod 2.
- This makes S^2 = Z (X-row picks up sign), S^3 = S-inverse (X to -Y)
flow correctly through cc[ps] state evolution.
- Rewrote cliffordChannelToPauliStabilizer using the string-list
PauliStabilizer constructor (handles single-qubit case correctly).
Tests:
- CliffordChannel.wlt: 41 to 76 tests (TIER P/Q/R/S/T: row-sum AG
phase helper, contraction phase helper, S/H/X compositions with
state evolution physics, random-circuit cross-validation against
PauliStabilizer evolution).
- HybridInterop.wlt: 37 to 52 tests (TIER L: matrix-iteration
detector on Pauli matrices, multi-qubit XZ/YY, Hadamard/projector
rejection, fast-path verification on Bell, max-qubit cap test).
- Path-resolution fixes for CrossPackage_Stim.wlt and
CrossPackage_QuantumClifford.wlt (use Directory[] fallback when
$InputFileName isn't set under TestReport.
529/529 tests passing.
EOF
)
…Tests/Stabilizer/
WL-idiom audit (per /Users/mohammadb/.claude/skills/wl-native-style/SKILL.md):
- Constructors.m
- agPickIndependent: replaced AppendTo + Break with Internal`Bag +
Catch/Throw. Removed hanging Module variables i, candidate, augmented.
- agExtendToSymplecticBasis: converted Do + AppendTo into Fold over
Range[n]. Removed hanging Module variables.
- Conversions.m
- ps["Circuit"] AG-canonical synthesis: replaced gates = {} +
AppendTo[gates, gate] with Internal`Bag + StuffBag. Genuinely sequential
state-machine algorithm so Do remains; only the gate-accumulation
pattern changes.
- CliffordChannel.m
- stabilizerRowSumAGPhase: replaced nested Do over selected rows / qubits
with Fold + vectorized MapThread per qubit.
- Measurement.m
- rowsum: replaced Total @ Table[..., {j, n}] with Total @ MapThread over
the X / Z bit axes.
- PauliMeasure.m
- ps["M", pauliString]: removed unused Module variables (recoverable,
groupSign, postPs, newRowSign, newGensArr) flagged by audit. Refactored
the anticommuting-row sign update from imperative Do + Module mutation
to a vectorized MapAt + Thread + ReplacePart pattern.
No Do / For / While / AppendTo remains except for genuine state-machine
algorithms (AG circuit synthesis, AG measurement, RandomClifford Mallows
sampler) where the wl-native-style skill explicitly endorses the pattern.
Tests reorganized:
- Created Tests/Stabilizer/ subdirectory.
- Moved 7 stabilizer-related test files via git mv (preserves history):
PauliStabilizer.wlt, CliffordChannel.wlt, HybridInterop.wlt,
Roundtrips.wlt, Correctness_TextbookResults.wlt, CrossPackage_*.wlt.
- Moved Tests/fixtures/ to Tests/Stabilizer/fixtures/ (Stim JSON).
- Tests/QuantumDistance.wlt remains at top level (general QF, not
stabilizer-specific).
- Tests/RunTests.wls now recurses (FileNames *.wlt with Infinity).
- Path-resolution fix in CrossPackage_*.wlt for the new layout.
New comprehensive coverage matrix:
- Tests/Stabilizer/AuditMatrix.wlt -- 155 tests across 15 TIERs:
TIER 1 every PauliStabilizer constructor input form (string list,
sign-prefixed, stab+destab halves, integer register, named codes,
Random named pattern, QCO, QO, QS, association forms);
TIER 2 every property in ps["Properties"] (all 30+);
TIER 3 every Clifford gate method (H, S, S-dag, X, Y, Z, V, V-dag,
CNOT/CX, CZ, SWAP, Permute, PadRight/Left, Dagger/Inverse, op->order);
TIER 4 non-Clifford P[theta] / T / T-dag returning StabilizerFrame;
TIER 5 measurement (Z-basis, Pauli-string, multi-qubit, SymbolicMeasure,
SubstituteOutcomes, SampleOutcomes);
TIER 6 InnerProduct + Expectation (Phase 6.5 demoted ops);
TIER 7 composition + tensor product;
TIER 8 StabilizerFrame constructors / properties / methods;
TIER 9 GraphState constructors / properties / conversion;
TIER 10 LocalComplement involutivity + graph / GraphState dispatch;
TIER 11 CliffordChannel head / predicate / accessors / composition /
cc[ps] state evolution;
TIER 12 hybrid interop (qmo[ps] Pauli fast path, Phase 7.4 matrix
detector, named Pauli channels);
TIER 13 AG symplectic invariant on circuit-built fixtures;
TIER 14 cross-package comparison vs live Stim fixtures + QC.jl
canonical agPhase ZZZ * XXX = -i YYY pattern;
TIER 15 round-trip exact-equality matrix per Phase 5c contract.
Test counts:
- Pre-audit: 529 / 529.
- Post-audit: 684 / 684 (155 new audit-matrix tests, plus the existing
529 unchanged).
…ation + verify-*.wls Rewrite API.md from scratch (~1100 lines -> ~750 lines) with the current public surface after Phases 1-8.3 + WL-idiom audit: - 5 top-level public symbols: PauliStabilizer, StabilizerFrame, GraphState, LocalComplement, CliffordChannel (was 4 -- CliffordChannel was missing). - Every constructor input form documented with a code example. - Every property in Properties.m grouped (Shape / Signs / Bit views / Stabilizer-Destabilizer slices / Pauli-string lists / Display / Materialization). - Every Clifford and non-Clifford gate method documented. - Symbolic measurement (Phase 3 demoted, Phase 6 method-grade). - Inner product + Expectation (Phase 6.5 method-grade). - StabilizerFrame full surface. - GraphState + LocalComplement. - CliffordChannel (Phase 8.1 / 8.2 / 8.3): constructors, properties, composition algorithm with phase tracking + contraction sign, state evolution, helpers. - Hybrid interop (Phase 7): qmo[ps], qmo[sf], qc[ps], qc[sf]; the four Pauli-label detection paths (string, Times[-1, ...], Superscript, matrix-iteration Phase 7.4); named Pauli channels. - Cross-package fixtures (Stim live JSON + QC.jl hand-coded canonical). - Updated quick-reference card. - References: 9 paper anchors with arxiv IDs. Delete: - synthesis-implementation.md (931 lines): the section-by-section capability tour from the original 28-paper synthesis. Now redundant with ROADMAP.md (status tracker) + Tests/Stabilizer/AuditMatrix.wlt (executable verification). - verify-API.wls (546 lines): re-ran 49 code blocks from API.md with Print-output diff. Superseded by Tests/Stabilizer/*.wlt files which use VerificationTest with proper assertions and run under TestReport. - verify-synthesis-implementation.wls (378 lines): same justification, for the now-deleted synthesis-implementation.md. Net: 1855 lines of stale content removed. Documentation/ now contains exactly 3 markdown files: API.md (per-function reference), ROADMAP.md (deferred items), post-mortem-phase-5c.md (Phase 5c learning record). ROADMAP.md and post-mortem-phase-5c.md updated to remove dangling references to the deleted files. Tests: 684 / 684 passing.
Renames (lowercase + drop redundant qualifier):
- OngoingProjects/Stabilizer/Documentation/API.md -> api.md
- OngoingProjects/Stabilizer/Documentation/ROADMAP.md -> roadmap.md
- OngoingProjects/Stabilizer/Documentation/post-mortem-phase-5c.md -> postmortem.md
All cross-references updated repo-wide (api.md, roadmap.md, postmortem.md,
paulistabilizer-source-audit.md). Inline mentions normalized to lowercase.
api.md audit -- additions to ensure complete coverage of the public
surface, after a kernel-source inventory:
- PauliStabilizer constructor entries:
- PauliStabilizer[qo, n] -- the optional pad-to-n second arg.
- PauliStabilizer[t_?PauliTableauQ] / [sign, t] / [signs, t] -- the
tableau-only positional forms.
- PauliStabilizer[basis] -- the rank-3 array-of-{0,1,-1} form.
- PauliStabilizer[shortcut] -- documented the full
String | Rule | List shortcut argument set.
- PauliStabilizer method entries:
- ps[] / ps[q__Integer] / ps[{q...}] -- the implicit measurement
shortcut shortcuts.
- ps["RowSum", h, i] -- the AG row-multiplication primitive (low-level
but exposed).
- New "Connections to other QuantumFramework heads" section under
PauliStabilizer with the 9-row dispatch matrix:
QuantumState[ps], QuantumOperator[ps], QuantumCircuitOperator[ps],
qo[ps], qmo[ps], qc[ps], cc[ps], QuantumTensorProduct[ps_a, ps_b],
Method -> "Stabilizer".
- New "Internals (PackageScope)" section listing the predicates and
helpers a contributor needs to know:
PauliStabilizerQ, ConcretePauliStabilizerQ, PauliTableauQ,
PauliStabilizerApply, FromFullTableau, PauliRow, QuantumOperatorTableau,
agPhase, rowsum.
- One-line predicate notes added at the top of each StabilizerFrame /
GraphState / CliffordChannel section (StabilizerFrameQ, GraphStateQ,
CliffordChannelQ).
- StabilizerFrame Association-form constructor documented.
- CliffordChannel idempotent constructor (CliffordChannel[cc]) documented.
- Hybrid interop: new "Helpers (PackageScope)" subsection covering
stabilizerPauliLabelFromQMO, stabilizerPauliFromMatrix,
stabilizerPauliMatrixFromString, stabilizerCliffordChannelMixture,
$stabilizerPauliMatrixSearchMaxQubits.
- Removed the stale "ps['Properties'] returns short list" warning -- that
was a paclet-cache pollution issue, not a real bug; the test suite
passes the full 40-key list.
Net diff: api.md grew by ~120 lines covering ~25 newly-documented entries
that were dispatchable in the kernel but not surfaced in the previous
draft.
Tests: 684 / 684 passing.
…patch table
Tests/Stabilizer/Connections.wlt -- 52 tests explicitly exercising every
cross-head connection point in api.md, both single-hop and multi-hop:
CONNECTION 1 -- QuantumState[ps] (UpValue)
CONNECTION 2 -- ps[Operator] (working accessor)
CONNECTION 3 -- ps[Circuit] (working accessor)
CONNECTION 4 -- qo @ ps (UpValue)
CONNECTION 5 -- qmo[ps] (UpValue, hybrid interop)
CONNECTION 6 -- qc[ps] (UpValue, hybrid interop)
CONNECTION 7 -- cc[ps] (DownValue, Phase 8)
CONNECTION 8 -- QuantumTensorProduct[ps_a, ps_b] (DownValue)
CONNECTION 9 -- QuantumCircuitOperator[..][Method -> Stabilizer]
CONNECTION 10 -- StabilizerFrame cross-head: qmo[sf], qc[sf]
CONNECTION 11 -- GraphState <-> PauliStabilizer round-trip
CHAIN 1 -- ps -> QuantumState -> Tr[ZZ rho] vs ps[Expectation, ZZ]
CHAIN 2 -- ps -> Circuit -> apply on QuantumState -> matches ps[State]
CHAIN 3 -- qo UpValue chain matches direct method-chain
CHAIN 4 -- QF circuit -> Method Stabilizer -> CC composition -> back to PS
CHAIN 5 -- ps[M, ZZ] keys vs qmoZZ[ps] keys
CHAIN 6 -- Bell via two paths (QCO + QS tomography) agree
CHAIN 7 -- 5Q code: all stabilizers measured deterministically via qmo[ps]
CHAIN 8 -- Bell -> qcBitFlip -> branch probabilities sum to 1
CHAIN 9 -- Random Clifford via Method Stabilizer matches direct apply (6 reps)
CHAIN 10 -- ps -> QuantumState -> DensityMatrix -> rank 1, trace 1 (pure)
CHAIN 11 -- QuantumTensorProduct: PS-path vs QS-path agree on materialization
api.md correction surfaced by the audit:
- The kernel declares
QuantumOperator[ps_PauliStabilizer] := ps[Circuit][QuantumOperator]
QuantumCircuitOperator[ps_PauliStabilizer] := ps[Circuit]
at Conversions.m:146-147. These are DownValues against the host paclet protected
QuantumOperator / QuantumCircuitOperator symbols and SILENTLY fail to attach.
QuantumOperator[ps] and QuantumCircuitOperator[ps] do not behave as documented.
api.md updated: the connections table now has a Status column marking
the two as silently inactive (protected symbol) with the working
accessor (ps[Operator] / ps[Circuit]) called out. Two regression tests
document the gotcha (intentional False expectations -- promote to True
if/when the kernel uses Unprotect to fix the dispatch).
Tests: 684 -> 736 (+52). All passing.
…uantumOperator[ps] and QuantumCircuitOperator[ps] dispatch fires Fix the audit finding from Tests/Stabilizer/Connections.wlt: QuantumCircuitOperator[ps_PauliStabilizer] := ps[Circuit] QuantumOperator[ps_PauliStabilizer] := ps[Circuit][QuantumOperator] declared at Conversions.m:146-147 were DownValues against the host-paclet Protected QuantumOperator / QuantumCircuitOperator symbols. They silently failed to attach so the rules never fired -- callers got back a malformed QuantumOperator wrapping the PauliStabilizers tableau as a value, not the materialized operator. Fix: convert both `:=` to `^:=` so the rules attach as UpValues on _PauliStabilizer (the inner-head pattern). UpValues live in the inner heads UpValues table, bypassing the outer symbols Protected restriction. Verification: QuantumOperator[psBell] === ps[Circuit][QuantumOperator] -> True QuantumCircuitOperator[psBell] === ps[Circuit] -> True QuantumState[psBell] === ps[State] -> True (already worked) Updated: - QuantumFramework/Kernel/Stabilizer/Conversions.m: both := -> ^:= with a comment block citing this fix. - Tests/Stabilizer/Connections.wlt: the two regression tests that intentionally documented the bug (Conn2-DownValue-Inactive, Conn3-DownValue-Inactive) flipped to assert True under new IDs Conn2-QuantumOperatorOfPS-UpValue-Active and Conn3-QuantumCircuitOperatorOfPS-UpValue-Active. - OngoingProjects/Stabilizer/Documentation/api.md: connections matrix updated. Both rows now ✅ active. Status column collapsed since all 9 dispatch points are active. Implementation note records the fix date. Tests: 736 / 736 passing.
Batch 1 (quick bug fixes):
A.3 -- ps[Dagger][Dagger] no longer cascades on non-canonical inputs.
GateUpdates.m:106-118: switch the inner inverse-matrix PauliStabilizer
to use all-+1 signs (was ps[Signs], which propagated phase asymmetry into
the recursive composition step). Also detect a singular symplectic matrix
(Det == 0 mod 2) and emit PauliStabilizer::singular with $Failed instead
of letting the cascade run. Result: dag^2 === ps for AG-canonical
fixtures (Bell, GHZ-3, HSH, integer registers); singular-matrix inputs
produce a clean error message.
A.11 -- pauliStringMatrix on 1-qubit input.
InnerProduct.m:113-125: wrap KroneckerProduct @@ mats with
If[Length[mats] == 1, First[mats], ...] so the n=1 case doesn't trigger
KroneckerProduct::argmu and produce an unevaluated expression that
breaks downstream Re[<v|P|v>].
A.12 -- ps[Stabilizers] formatter on symbolic phases.
Formatting.m: PauliForm now routes signs through pauliFormSignString[s]
which handles {1, -1, otherwise -> ToString[s, InputForm] <> "*"} so
symbolic phases (FormalS[k] from SymbolicMeasure) format as readable
prefixes instead of throwing StringJoin::string.
A.13 -- GraphState[ps_PauliStabilizer] non-graph-form input.
GraphState.m: now emits GraphState::nongraph and returns $Failed when the
input PauliStabilizer is not in graph-state form (each row must be X at
one position and I or Z elsewhere; Y or off-diagonal X are rejected).
Linear cluster, Bell stabilizers continue to convert correctly.
Batch 2 (closed-form algorithms):
A.1 -- ps[InnerProduct, other, Method -> "ClosedForm"] now available.
InnerProduct.m: O(n^3) closed-form magnitude per GarMarCro12 §3, gated
on ConcretePauliStabilizerQ. Returns 0 if S_psi and S_phi disagree on
any sign in their intersection; returns 2^(-s/2) where s = n -
dim(intersection) otherwise. Default method remains "Direct" (full
complex inner product via vector materialization, n <= 8). The complex
phase under "ClosedForm" is deferred -- magnitude only.
A.2 -- ps[Expectation, pauli] closed-form, no fallback.
InnerProduct.m: replace direct-vector fallback with AG-cumulative-i-power
tracking via stabilizerRowSumAGPhase. Algorithm:
1. P anticommutes with any stabilizer => 0.
2. Decompose pVec = sum c_i g_i over F_2 via LinearSolve.
3. If LinearSolve fails (P in N(S) \ S), return 0.
4. Compute cumulative AG phase mod 4 via stabilizerRowSumAGPhase;
odd phase asserts P not in S (defensive); even phase / 2 gives the
sign bit.
5. Final <P> = targetSign * (-1)^agSignBit * prod_i signs[i]^c_i.
Correctly handles <Bell|YY|Bell> = -1 (Y = i*X*Z; previously needed
direct-vector fallback). Verified against direct-vector for n in
{1, 2, 3} on 24 random Cliffords.
Tests added (TIER 16, 17, 18 in AuditMatrix.wlt):
- 21 new tests covering all six fixes:
- 3 tests for A.11 (Expectation on 1-qubit cleanly).
- 1 test for A.12 (symbolic-phase format doesn't error).
- 2 tests for A.13 (nongraph emits, valid graph still works).
- 5 tests for A.3 (Dagger involution + singular detection).
- 6 tests for A.1 (closed-form magnitude, opt-in Method).
- 4 tests for A.2 (closed-form Expectation across canonical and
edge cases).
Tests: 736 -> 757 (+21). All passing.
….7 (closed-form entropy)
A.4 -- SymbolicMeasure now records deterministic-outcome polynomials.
Stabilizer/SymbolicMeasure.m: introduce an "Outcomes" association key on
the PauliStabilizer Association. Each deterministic measurement whose
outcome involves prior symbols allocates a fresh symbol m_k and stores
{m_k -> polynomial} in the Outcomes map. The non-deterministic case
forwards the existing Outcomes map to the post-state.
substituteOutcomes now applies the user rules and the Outcomes map
iteratively to a fixed point so derived outcomes resolve correctly.
sampleOutcomes only picks random values for FREE symbols (those not
already constrained by the Outcomes map) and lets substituteOutcomes
propagate the rest.
Bell-state ZZ-correlation test in PauliStabilizer.wlt is updated:
Phase3-LIMITATION-DeterministicOutcomeNotStamped renamed to
Phase3-A4-DeterministicOutcomeStamped-via-OutcomesMap. The test now
verifies (a) m_1 outcomes vary, (b) the Outcomes map is populated, and
(c) the stab signs after substitution mirror the user-supplied m_1
value: signs go from {1, 1} (m_1=0, |00>) to {-1, 1} (m_1=1, |11>;
ZI flips sign while ZZ stays +1, since the 5Q-style AG-derived
generating set uses {ZI, ZZ}).
A.7 -- Closed-form polynomial-time stabilizer entropy.
Stabilizer/Entropy.m (new file): implements stabilizerEntropy[ps,
partition] per Fattal-Cubitt-Yamamoto-Bravyi-Chuang 2004 Theorem 1:
S(A) = rank_{F_2}(stabilizer generators restricted to A) - |A|
Cost: O(n^3) (rank computation), independent of |A|. Closed-form
works at any qubit count -- verified at n = 12 where Schmidt-rank
materialization would OOM. Method-grade dispatch:
ps["Entropy", q] -- single-qubit partition
ps["Entropy", {q1, q2, ...}] -- multi-qubit partition
Sanity tests cover Bell, |00>, GHZ-3, Cluster-4, 5Q code, and a
GHZ-12 scaling test. All entropy units are in log_2 (so 1 means
one bit of bipartite entanglement entropy).
Tests added (TIER 19, 20 in AuditMatrix.wlt):
- 2 tests for A.4 (Outcomes map populated; substitute mirrors m_1).
- 6 tests for A.7 (separable, Bell, GHZ-3, Cluster-4, 5Q, GHZ-12).
Tests: 757 -> 766 (+9). All passing.
….10 (generator-order canonicalization)
A.10 -- generator-order canonicalization across constructor paths.
Constructors.m: after agPickIndependent picks linearly-independent rows
during PauliStabilizer[qs_QuantumState] tomography, sort the resulting
stabilizer rows by `Ordering[FirstPosition[#, 1] & /@ stabBits]` so the
canonical order matches the integer-constructor convention
(PauliStabilizer[n] = {Z_1, Z_2, ..., Z_n}).
Result:
- PauliStabilizer[QuantumState["00"]]["Stabilizers"]
=== PauliStabilizer[2]["Stabilizers"] (* True *)
- QCO[Method -> "Stabilizer"]["Stabilizers"]
=== QCO[QS["00"], Method -> "Stabilizer"]["Stabilizers"] (* True *)
The Integration-MethodStabilizer-ExplicitState test in
PauliStabilizer.wlt previously had to use Sort[] on both sides; the
ordered comparison now passes too.
A.8 -- StabilizerStateQ public symbol (the small subitem).
PauliStabilizer.m: PackageExport StabilizerStateQ. Returns True when:
- expr is a structurally-valid PauliStabilizer
- expr is a single-component StabilizerFrame
Returns False otherwise (including QuantumState; for state-vector
stabilizer detection, use PauliStabilizer[qs] explicitly which runs
4^n tomography).
PacletInfo.wl: register the new public symbol.
Usage.m: add usage message.
The other two A.8 sub-items (CliffordTableau distinct head;
StabilizerRankDecomposition automatic decomposition) remain deferred
-- they are 100+ LOC each and warrant separate phases.
Tests added (TIER 21, 22 in AuditMatrix.wlt):
- 3 tests for A.10 (QS-vs-Int order, 2-qubit + 3-qubit, Method-Stabilizer
default vs explicit-QS).
- 6 tests for A.8 (StabilizerStateQ on PS, named-code, Frame, Integer,
QuantumState, multi-component Frame).
Tests: 766 -> 775 (+9). All passing.
…or follow-up)
Updates the roadmap to reflect the A-series resolution sweep on 2026-05-07:
DONE this session (10 items):
- A.1 ps[InnerProduct, ..., Method -> ClosedForm] -- O(n^3) magnitude per GarMarCro12
- A.2 ps[Expectation] AG-i-factor tracking (no direct-vector fallback for in-S Paulis)
- A.3 Dagger involution + singular-matrix detection
- A.4 SymbolicMeasure deterministic-outcome stamping via Outcomes Association
- A.7 StabilizerEntropy closed-form O(n^3) per FCYBC04 Theorem 1
- A.8 (sub) StabilizerStateQ public symbol (other A.8 sub-items deferred)
- A.10 Generator order canonicalization across QS / Int / Method-Stabilizer paths
- A.11 pauliStringMatrix single-qubit KroneckerProduct guard
- A.12 PauliForm symbolic-phase formatter
- A.13 GraphState[ps] non-graph-form ::nongraph + $Failed
REMAINING (3 items):
- A.5 Reid24 / Winderl23 optimal Clifford circuit synthesis (research-grade,
~250 LOC + 8 tests). AG synthesis remains correct, just non-optimal.
Scoped for follow-up PR.
- A.6 LocalComplement VOP tracking. Depends on B.3 (24-element LocalClifford
table). Scoped for follow-up alongside B.3.
- A.8 (sub) CliffordTableau distinct head + StabilizerRankDecomposition
Bravyi-2016 path. ~300 LOC + 12 tests; warrants a separate phase.
CLOSED (inherent):
- A.9 GlobalPhase non-propagation through gate updates (documented contract).
Test count: 684 -> 775 (+91 tests across batches 1+2, 3, 4 and Connections.wlt).
Adds an A-series-sweep lesson at the top of the roadmap recording the
process insight: most "deferred for v1" items had clean polynomial-time
implementations once the v1 phase shipped; re-audit yearly to retire stale
"deferred" labels.
Introduce a self-contained verification audit for the QuantumFramework stabilizer subsystem. Adds a 132-test wolframscript harness (stabilizer-formulas-test.wls), the formula reference (stabilizer-formulas.md), a README with run instructions and quick status (126 pass / 6 fail), and a findings report (findings-report.md) documenting three confirmed issues (F1–F3) with reproductions and suggested fixes. Run with: wolframscript -f OngoingProjects/Stabilizer/Formula_Test/stabilizer-formulas-test.wls.
PauliStabilizer["5QubitCode" | "SteaneCode" | "9QubitCode"] previously listed logical X-bar (XXXXX, XXXXXXX, XXXXXXXXX) as the n-th generator, which made the prepared state |+_L> -- the +1 eigenstate of X-bar in the codespace -- rather than the |0_L> the api docstring promises. Replace the n-th generator with logical Z-bar (ZZZZZ, ZZZZZZZ, ZZZZZZZZZ) on the unsigned variants and -Z-bar on the *Code1 variants so the constructors return |0_L> and |1_L> respectively, matching Got97 §3.5, Got00 §4, and Nielsen-Chuang §10.5. Also update existing tests that hardcoded the old (buggy) stabilizer set: - Tests/Stabilizer/PauliStabilizer.wlt: 5 tests touching 5Q stabilizers, including re-derived sign updates for the X1 / Z3 measurement tests (gen 5 is now Z-bar = ZZZZZ, so X1 anti-commutes with both gens 4 and 5, while Z3 commutes with both -- the hardcoded sign vectors changed accordingly). - Tests/Stabilizer/AuditMatrix.wlt: 2 tests hardcoding 5Q / Steane n-th generator strings. - Tests/Stabilizer/CliffordChannel.wlt: Phase8.2-cc-ps-Identity5-On-5QubitCode expected sorted stabilizer list. - Tests/Stabilizer/Correctness_TextbookResults.wlt: rename Steane-Logical-X-Expectation-Plus1-on-Logical-Zero (which was only true for the buggy |+_L> state) to Steane-Logical-Z-Expectation-Plus1-on-Logical-Zero (the correct physical assertion for |0_L>), and add Steane-Logical-X-Expectation-Zero-on-Logical-Zero documenting that X-bar flips |0_L> to the orthogonal |1_L>. Refs: OngoingProjects/Stabilizer/Formula_Test/findings-report.md F1 + P1.
…s (P2, F2) ps["M", pauli_string] previously updated only the SIGNS of the stabilizer group on the random-outcome branch (when P anti-commutes with at least one stabilizer); the tableau itself was left intact. Result: the post-state was NOT a +-P eigenstate of the measured Pauli, contradicting AG section 3 Case I. Single-qubit ps["M", q_integer] was already correct -- this only affected multi-qubit Pauli-string measurements. Aaronson-Gottesman section 3 Case I says: pick the first stabilizer row that anti-commutes with P (call it k), replace row k with (-1)^b * P, and use that k row to row-multiply every OTHER anti-commuting generator so they all commute with the new k. The sign update was already correct; this patch adds the row update by writing pVec symplectic bits into newTableau[[1, All, gen+kIdx]] (X block) and newTableau[[2, All, gen+kIdx]] (Z block). After the patch, pVec is the new k-th stabilizer (up to plus/minus) and the expectation of P on the post-state equals plus or minus 1 as expected. Verified by S5-F2-PostMeas-State-IsEigenstate-STRICT in Tests/Stabilizer/Formulas.wlt. Refs: OngoingProjects/Stabilizer/Formula_Test/findings-report.md F2 + P2.
…bleau path (P3, F3) CliffordChannel[ps_state][ps_state'] (state-prep channel applied to a same-dim PauliStabilizer) previously emitted CliffordChannel::stateevol and fell through to dense materialization via QuantumChannel[cc][ps["State"]]. The api.md doc specifies that nA == 0 (zero input qubits, the state-prep case) should return the state encoded by cc -- the input ps is meaningless for a state-prep channel. The tableau-only conversion already exists as cliffordChannelToPauliStabilizer (PackageScope helper). This patch swaps the dense fallback for that helper, so the dispatch returns a PauliStabilizer matching the prepared state at O(n^2) instead of O(2^n). Verified by S16-F3-CliffordChannel-StatePrep-Yields-Zeros-STRICT in Tests/Stabilizer/Formulas.wlt. Refs: OngoingProjects/Stabilizer/Formula_Test/findings-report.md F3 + P3.
…P1/P2/P3 fixes
Tests/Stabilizer/Formulas.wlt (new) -- 132 top-level VerificationTests, a
.wlt mirror of OngoingProjects/Stabilizer/Formula_Test/stabilizer-formulas-test.wls
generated by stripping the s0..s25 section-list wrappers and the standalone
.wls driver so TestReport[file] discovers every test. The .wls remains the
canonical authoring location and provides per-section reporting; this .wlt
mirror runs as part of the regular Tests/RunTests.wls battery.
Full battery now reports 908/908 passing (132 from Formulas.wlt + 776 from
the prior Tests/Stabilizer/* and Tests/QuantumDistance.wlt suites).
OngoingProjects/Stabilizer/Formula_Test/findings-report.md: rewrite the
"Verification status" and "Patches" sections to record that all three
findings (F1 / F2 / F3) are resolved by Patches P1 / P2 / P3 on this
branch. The patch text itself is preserved as historical documentation.
OngoingProjects/Stabilizer/Formula_Test/README.md: status block flips to
"132/132 passing (post-fix)" and the TestID-to-finding table now also
links each F-tag to the patch that resolved it.
OngoingProjects/Stabilizer/Formula_Test/stabilizer-formulas-test.wls:
the six previously-failing TestIDs carry permanent F1/F2/F3 infixes
(e.g. S3-F1-..., S5-F2-..., S16-F3-...) so a future regression on any of
them surfaces directly under the corresponding finding tag.
Refs: OngoingProjects/Stabilizer/Formula_Test/findings-report.md
OngoingProjects/Stabilizer/Formula_Test/README.md
Introduce a pure WL standalone Suzuki–Trotter package (OngoingProjects/Trotterization/Trotterization.wl) implementing TrotterizationMatrices, TrotterizationCoefficients and TrotterizationOrdering. The package encodes Suzuki's recursion for coefficient sequences and operator expansion and supports output forms ("Flat", "Steps", "Unitary").
Add a comprehensive wolframscript test runner (OngoingProjects/Trotterization/test-trotterization.wls) that compares the standalone implementation against QuantumFramework (per-gate and full-unitary equality), verifies coefficient parity, convergence behavior, form-option shapes, notebook replication (trace and spectral norms), a 4-qubit transverse-Ising case, symbolic-time handling, and gate-count formulas (tests T1..T10).
Brings the v2.0 named-constructor refactor (fa0d011) and 12 other post-divergence commits on main into the stabilizer subsystem branch so PR #3 stops reporting merge conflicts. Conflict resolution: - QuantumFramework/Kernel/PauliStabilizer.m (modify/delete) -- this branch removed the legacy single-file kernel in commit 27b36f6 (Phase 1-4 rebuild) and split it across QuantumFramework/Kernel/Stabilizer/*.m. Kept the deletion. Ported the two v2.0 changes from fa0d011 into the new home: - Stabilizer/Conversions.m: QuantumOperatorTableau now uses QuantumOperator["X"[d] -> #] / "Z"[d] -> # form (was {"X", d} / {"Z", d}). - Stabilizer/PauliStabilizer.m: PauliStabilizerApply gate-rewrite pattern uses "C"[g -> t_, c_, _] (was {"C", g -> t_, c_, _}). Test fix: - Tests/Stabilizer/PauliStabilizer.wlt: Phase2-NonClifford-Message used "FooBarUnknownGate" as the trigger. Under v2.0 unknown names short- circuit at the QuantumOperator construction with QuantumOperator::invalidName before PauliStabilizerApply ever runs, so the Head check no longer matches PauliStabilizer. Switched to a single "T" gate -- v2.0 accepts the name, PauliStabilizer dispatch returns a StabilizerFrame which falls through to the True branch in PauliStabilizerApply, emitting exactly one PauliStabilizer::nonclifford message and returning the prior PauliStabilizer unchanged. All other changes auto-merged. Stabilizer-affected test surface (11 files, 908 tests) verified green after the merge: Tests/QuantumDistance.wlt: 32/32 Tests/Stabilizer/AuditMatrix.wlt: 194/194 Tests/Stabilizer/CliffordChannel.wlt: 76/76 Tests/Stabilizer/Connections.wlt: 52/52 Tests/Stabilizer/Correctness_TextbookResults.wlt: 42/42 Tests/Stabilizer/CrossPackage_QuantumClifford.wlt: 15/15 Tests/Stabilizer/CrossPackage_Stim.wlt: 44/44 Tests/Stabilizer/Formulas.wlt: 132/132 Tests/Stabilizer/HybridInterop.wlt: 52/52 Tests/Stabilizer/PauliStabilizer.wlt: 249/249 Tests/Stabilizer/Roundtrips.wlt: 20/20 Total: 908 / 908 passed.
minor bugs in standalone function, nothing to do with QF
more tests based on papers
There was a problem hiding this comment.
this is automatically generated file from docs, new usages will be removed once the script (from QuantumFramework-Dev.nb) is rerun, better add a separate file for manual usage messages
There was a problem hiding this comment.
I removed usage and added some minimal doc pages.
| QuantumState[qs["State"], newBasis], | ||
| qs["VectorQ"], | ||
| QuantumState[ | ||
| (* TODO: ConfirmQuiet hides Dot::dotsh from shape mismatches; precompute shapes via Dimensions and assert before Dot *) |
There was a problem hiding this comment.
what's up with all the Quite hate?
There was a problem hiding this comment.
side effect of trying to eliminate Quite as much as possible everywhere
There was a problem hiding this comment.
the AI documenting internal dev phases/stages annoys me too much
There was a problem hiding this comment.
I cleaned them and pushed. Check and let me know
| @@ -0,0 +1,355 @@ | |||
| # Stabilizer formalism papers for SDK building | |||
|
|
|||
| ##### [**Undermind**](https://undermind.ai) | |||
There was a problem hiding this comment.
undermind is fun and I found it useful, I have not benchmarked it though. https://katinamagazine.org/content/article/main-section/2024/undermind-ai-shows-the-power-of-successive-search
Update Stabilizer API reference and add symbol notebooks; small but wide-ranging kernel edits across stabilizer modules. Key changes: - Revise OngoingProjects/Stabilizer/Documentation/api.md: rewording to remove phase-status noise, clarify global-phase contract and limitations, simplify method tables and verification notes, and update examples and citations. - Add new documentation notebooks for top-level symbols (CliffordChannel, GraphState, LocalComplement, PauliStabilizer, StabilizerFrame, StabilizerStateQ). - CliffordChannel.m: rework comments and messages to reflect current support (composition with Boolean nullspace + AG phase tracking, contraction-sign correction), tighten handling of stochastic channels (emit notice and fallback), clarify state-evolution dispatch and messages. - Compose.m, Constructors.m, Conversions.m, Entropy.m, Formatting.m, GateUpdates.m and other kernel files: comment cleanups, clarifications of contracts/limits (e.g. global-phase handling, performance notes), formatting improvements (symbolic sign rendering), and reliability fixes (use of UpValues for circuit/operator conversions). These edits are primarily documentation clarifications, API contract wording, and developer-facing comments plus modest behavioral fixes (message wording, UpValue attachment, and documented fallbacks) to align implementation with the current roadmap and tests.
Add a new wolframscript (build_paulistabilizer_doc.wl) that programmatically generates the PauliStabilizer reference notebook (Documentation/English/ReferencePages/Symbols/PauliStabilizer.nb). The script loads the QuantumFramework paclet, sets deterministic CellIDs, and includes helpers to construct styled notebook cells (usage, notes, examples, options, see-also, metadata) and safe Input/Output example rendering via the front-end parser. Also update the existing PauliStabilizer.nb reference page to reflect the generated content.
Add several wolframscript doc-builders under OngoingProjects/Stabilizer (CliffordChannel, GraphState, LocalComplement, StabilizerFrame, StabilizerStateQ) and update the existing build_paulistabilizer_doc.wl. Update multiple reference notebooks in Documentation/English/ReferencePages/Symbols (CliffordChannel.nb, GraphState.nb, LocalComplement.nb, PauliStabilizer.nb, QuantumState.nb, StabilizerFrame.nb, StabilizerStateQ.nb) and add a backup QuantumState.nb.bak. Also modify the CliffordChannel kernel implementation (QuantumFramework/Kernel/Stabilizer/CliffordChannel.m) to align with the documentation changes.
- Property and Named-states tables converted to canonical 2ColumnTableMod format (ModInfo + TableText cells, no TagBox wrapper), matching the structure used by QuantumOperator.nb and other QF reference pages. - 17 ExampleText cells converted from plain named-char text (e.g. \[VerticalBar]0\[RightAngleBracket], \[Psi]\[Psi]\[Dagger]) to TextData with InlineFormula cells. Math typography: TemplateBox Kets/Bras, SuperscriptBox for rho^2 / psi-dagger, SqrtBox for Sqrt[qs], SubscriptBox for r_x / u_i / p_i. - Schmidt-basis math corrected: was using BraKet template (inner product); now uses two Ket templates for the product state. - Fix 5 over-escaped backslash-quote bugs in PureStateQ, MixedStateQ, Bend, Purify, Unpurify property descriptions.
Add a project-local cheat-sheet describing how to use paclet-doc-rewrite-template for QuantumFramework documentation rewrites. The new file includes a QF-specific invocation snippet (the "QF shortcut"), symbol status table, quick references (paclet root, docs dir, tests, conventions), guidance on when to update the canonical template, and links to related files and backups.
Refine error and boundary handling across the stabilizer kernel and docs: - CliffordChannel.m: For stochastic channels emit a clean CliffordChannel::stochastic message and return $Failed instead of returning a misleading "Identity" placeholder; callers that need tableau-level stochastic application should use the qc[ps] form (see HybridInterop). - HybridInterop.m: When a QuantumMeasurementOperator maps to a non-Pauli basis, emit a single PauliStabilizer::nonpaulibasis notice and route through the dense state-vector path (qmo[ps["State"]]) to avoid duplicate ::nonclifford messages and cascading handling. - Measurement.m: Add bounds checks for single-index and index-list measurements; emit PauliStabilizer::partition for out-of-range indices and return $Failed (consistent with stabilizerEntropy behavior). - PauliStabilizer.m: Short-circuit PauliStabilizerApply to propagate $Failed without re-emitting messages, accept StabilizerFrame results from modern non-Clifford boundaries, and convert unknown-gate results into a single PauliStabilizer::nonclifford message followed by $Failed to stop the fold. Also update corresponding documentation notebooks (CliffordChannel.nb, PauliStabilizer.nb) to reflect these changes.
Clean up and clarify comments across the Stabilizer kernel and remove an obsolete deprecation message. Changes include: clarify stochastic-channel behavior in CliffordChannel, note basis-aware measurement routing in Conversions/HybridInterop, simplify AG phase/rowsum comments in Measurement, tighten descriptions in PauliStabilizer/Properties, and update PauliStabilizerApply comments to better distinguish Clifford vs non-Clifford outcomes. Also remove the PauliStabilizer::tdeprecated message string in GateUpdates.m. No algorithmic changes were introduced aside from removing the deprecated message; these edits improve readability and reduce misleading documentation.
Summary
Rebuilds the Stabilizer subsystem under
QuantumFramework/Kernel/Stabilizer/across Phases 1 → 8.4, plus a WL-idiom audit, an A-series partial-implementation sweep, and a 132-test formula audit (Formula_Test) that surfaced and resolved 3 kernel bugs (P1 / P2 / P3). Adds 5 public top-level heads (PauliStabilizer,StabilizerFrame,GraphState,LocalComplement,CliffordChannel) + 1 predicate (StabilizerStateQ) + 7 method-grade operations onPauliStabilizer. Test suite underTests/Stabilizer/grew to 908 / 908 passing. Documentation collapsed to 3 files:api.md,roadmap.md,postmortem.md. A standalone Suzuki–Trotter package + tests is included underOngoingProjects/Trotterization/.What's in the public surface (after API consolidation)
PauliStabilizerStabilizerFrameΣᵢ cᵢ |sᵢ⟩superposition (non-Clifford boundary)GraphStateLocalComplementCliffordChannelStabilizerStateQMethod-grade operations (Phase 6/6.5 demoted from top-level):
ps["Random", n]·ps["SymbolicMeasure", q]·ps["SubstituteOutcomes", rules]·ps["SampleOutcomes", n]·ps["InnerProduct", other]·ps["Expectation", pauli]·ps["Entropy", partition](A.7).Phase log
Phases 1–5 — initial subsystem
"GlobalPhase"capture (Phase 5c canary:PauliStabilizer[QuantumOperator["Y"]]["QuantumOperator"] === Yexactly). Post-mortem atpostmortem.md.Phase 6 + 6.5 — API consolidation (10 → 4 + 1 predicate)
RandomClifford,StabilizerMeasure,SubstituteOutcomes,SampleOutcomes,StabilizerInnerProduct,StabilizerExpectationto method-grade ops onPauliStabilizer/StabilizerFrame. No semantic change.Phase 7 — Hybrid interop (UpValues, not Picture flag)
qmo[ps]/qmo[sf]/qc[ps]/qc[sf]UpValues. Pauli-basis fast path stays in tableau (O(n²)); non-Pauli falls back to legacy circuit conversion with::nonpaulibasisinfo.BitFlip,PhaseFlip,BitPhaseFlip,Depolarizing) routed via tableau, returning{{prob, ps_branch}, …}.Times[-1, Superscript[X\|Y\|Z\|I, CircleTimes[m]]], etc.) soQuantumOperator[-"XX"]-style QMOs route through the AG fast path.n ≤ 4qubits (cap is PackageScope-tunable). RecognizesQuantumOperator[matrix]QMOs whose symbolic Label isNone.Phase 8 — Yashin25 Choi-tableau unifier (
CliffordChannel)"Identity",[ps]state-prep, association form) + accessors (UA,UB,c,InputQubits,OutputQubits,Rank,Tableau,Source).cc1[cc2]via Boolean-null-space row matching (Yashin25 §3.2).cc[ps]state evolution (identity / state-prep / dim-matched compose-and-project).CliffordChannel[qc_QuantumChannel]for deterministic-Pauli channels.(-1)^{Σ_q x_q z_q}). Without these, the simple c-bit XOR gives the wrong sign for Y-bearing combinedu_B(e.g.,cc_S² = cc_Zrequires the contraction sign).QuantumOperator[ps]andQuantumCircuitOperator[ps]from:=(DownValues against Protected host symbols, silently inactive) to^:=(UpValues on_PauliStabilizer, fire reliably). Surfaced byTests/Stabilizer/Connections.wltand recorded inapi.md.WL-idiom audit (2026-05-06)
Replaced
Do+AppendTowithInternal``Bag,Fold,MapThreadacrossConstructors.m,Conversions.m,CliffordChannel.m,Measurement.m. Removed unused Module variables inPauliMeasure.m. Per thewl-native-styleskill rules. Genuinely sequential algorithms (AG circuit synthesis, Mallows sampler) keepDo.A-series partial-implementation sweep (2026-05-07)
10 of 13 closed:
Method -> "ClosedForm"opt-in:O(n³)magnitude per GarMarCro12 §3agPhasehelper; no direct-vector fallback for in-S PaulisPauliStabilizer::singular)ps["Entropy", partition]via FCYBC04 Theorem 1 (O(n³)rank computation; works at n=12 where Schmidt-rank OOMs)StabilizerStateQpublic symbolpauliStringMatrixKroneckerProduct::argmuguardPauliFormsymbolic-phase formatter (no moreStringJoin::stringafterSymbolicMeasure)GraphState[ps]emits::nongraph+$Failedfor non-graph-form inputScoped for follow-up PRs:
LocalComplementVOP tracking — depends on B.3 (24-elementLocalCliffordtable).CliffordTableaudistinct head +StabilizerRankDecompositionBravyi-2016 path (~300 LOC; warrants separate phase).A.9 is closed as an inherent trade-off (gate-update phase propagation would defeat AG
O(n²)advantage).Formula_Test audit + P1/P2/P3 (2026-05-07)
A 132-test strict-
VerificationTestbattery mapped 1:1 to formulas extracted from 28 stabilizer papers underOngoingProjects/Stabilizer/tex/. Surfaced 3 distinct kernel bugs (F1 / F2 / F3, 6 failing tests collapsed into 3 root causes), all confirmed in fresh-kernel probes that bypass the test harness, all resolved on this branch:PauliStabilizer["5QubitCode" | "SteaneCode" | "9QubitCode"]returned|+_L⟩, not|0_L⟩(n-th generator was logical X̄ instead of Z̄)NamedCodes.mps["M", pauli_string]did not collapse the state on the random branch (only signs were updated; the AG §3 Case I row replacement was missing)PauliMeasure.mCliffordChannel[ps][ps'](state-prep,nA == 0) emitted::stateevoland fell back to dense; documented dispatch was missingCliffordChannel.mThe same battery now also runs as part of the regular
Tests/RunTests.wlsrunner viaTests/Stabilizer/Formulas.wlt(132 top-levelVerificationTests, generated as a.wltmirror of the canonical.wlssoTestReport[file]discovers every test). The 6 historically-failingTestIDs carry permanentF1/F2/F3infixes (e.g.S3-F1-…,S5-F2-…,S16-F3-…) so future regressions surface directly under the corresponding finding tag. Patches and reproductions are documented inOngoingProjects/Stabilizer/Formula_Test/findings-report.md.Suzuki–Trotter standalone (separate scope, included for convenience)
Adds a pure WL standalone Suzuki–Trotter package under
OngoingProjects/Trotterization/implementingTrotterizationMatrices,TrotterizationCoefficients, andTrotterizationOrdering, with a comprehensivewolframscript-based test runner that compares against QuantumFramework per-gate and full-unitary, verifies coefficient parity, convergence, form-option shapes, notebook replication, a 4-qubit transverse-Ising case, symbolic-time handling, and gate-count formulas (T1..T10).Test suite — 908 / 908 passing
Reorganized into
Tests/Stabilizer/(plusTests/QuantumDistance.wltat the top level):Tests/QuantumDistance.wltTests/Stabilizer/PauliStabilizer.wltTests/Stabilizer/Roundtrips.wltTests/Stabilizer/HybridInterop.wltqmo[ps],qc[ps], matrix detector)Tests/Stabilizer/CliffordChannel.wltTests/Stabilizer/Correctness_TextbookResults.wltTests/Stabilizer/CrossPackage_Stim.wltTests/Stabilizer/CrossPackage_QuantumClifford.wltTests/Stabilizer/Connections.wltTests/Stabilizer/AuditMatrix.wltTests/Stabilizer/Formulas.wltRun with:
wolframscript -f Tests/RunTests.wls(or… Stabilizerto filter).Documentation
api.md— fresh per-function API reference (~750 lines): every constructor input form, every property, every Clifford / non-Clifford method, every measurement form, every cross-head dispatch point (with status column for the 8.4-fixed UpValues), Phase 7 hybrid interop, Phase 8 CliffordChannel, internals (PackageScope predicates + helpers), 9-paper reference table.roadmap.md— status tracker. A-series sweep closes 10/13; A.5 / A.6 / A.8 (rest) explicitly scoped for follow-up PRs.postmortem.md— Phase 5c Y-roundtrip lesson + global-phase contract.OngoingProjects/Stabilizer/Formula_Test/— 25-section formula reference distilled from 28 papers, the strict-VerificationTestbattery, and the findings report (F1 / F2 / F3 + Patches P1 / P2 / P3 with full reproductions).synthesis-implementation.md(931 lines) +verify-API.wls+verify-synthesis-implementation.wls. Their function is replaced by the executableVerificationTest-based test suite underTests/Stabilizer/.Test plan
wolframscriptkernel (macOS, Wolfram 15.0).Tests/Stabilizer/AuditMatrix.wltcovers every TIER 1–22 entry (constructors, properties, gates, measurement, frame, graph state, CliffordChannel, hybrid interop, AG invariant, cross-package, exact-equality round-trips, A-series fixes).Tests/Stabilizer/Connections.wltexercises every cross-head dispatch entry in the api.md matrix, including multi-hop chains (ps → QS → Tr[P·ρ]vsps["Expectation"];ps → Circuit → apply on QS → matches ps["State"]up to phase;Random Clifford via Method -> "Stabilizer"matches direct apply).Tests/Stabilizer/Formulas.wlt(132 tests) audits the formal stabilizer-formalism formulas against the kernel: GF(4) encoding, Heisenberg gate table, named codes, Pauli-string measurement, density-matrix recovery, MacWilliams, sum-of-stabilizers projection, CSS structure, magic states / Clifford hierarchy, symplectic ↔ Clifford, BSM / teleportation / fusion, local complementation, canonical forms, CliffordChannel composition, Pauli tracking, Stim-style round-trips, and the 13-item "Stabilizer Olympics" conformance set.stim_fixtures.json) and QuantumClifford.jl (15 tests; hand-coded canonical results).wolframscriptkernel (no testrunner harness):PauliStabilizer["5QubitCode"]["Stabilizers"]returns the Z̄-bearing canonical 5Q set; Phase 7 hybrid interop fires; Phase 8 CliffordChannel composes; Phase 8.4 cross-head dispatch fires; A-series new methods (StabilizerStateQ,Entropy, closed-formExpectation/InnerProduct,Daggerinvolution,GraphStatenon-graph rejection) all return expected values.Follow-ups (not in this PR)
LocalComplementVOP tracking + 24-elementLocalCliffordgroup.CliffordTableaudistinct head +StabilizerRankDecompositionBravyi-2016 automatic decomposition.qmo[sf]/qc[sf](currently materializes;O(rank · n²)decomposition deferred).