Skip to content

Add minimum-length Clifford transvection decomposition - #119

Open
Marcus P S (marcusps) wants to merge 18 commits into
microsoft:mainfrom
marcusps:masilv/clifford-to-transvections-minimal
Open

Marcus P S (marcusps) wants to merge 18 commits into
microsoft:mainfrom
marcusps:masilv/clifford-to-transvections-minimal

Conversation

@marcusps

@marcusps Marcus P S (marcusps) commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a strict-minimum transvection decomposition with r or r + 1 factors.
  • Uses complete memoized congruence triangularization with lazy residue-space candidate generation.
  • Adds exact small-system minimality oracles, randomized reconstruction tests, documentation, and a worked notebook.

Correctness and published reference

Builds on Decomposition of Clifford Gates (arXiv:2102.11380). Theorem 3’s existence conclusion is correct, but its construction incorrectly assumes every non-hyperbolic map has a congruence-triangularizable residue core and therefore a length-r decomposition.

This PR implements the exact criterion: the minimum is r precisely when the full nonsymmetric residue core is congruence triangularizable, and r + 1 otherwise. The correction note identifies Callan’s class-A exceptions and retains a deterministic two-qubit regression with residue rank three and minimum length four.

The corrected proof was checked independently with an interactive theorem prover. The check establishes the residue-rank lower bound, exact length-r criterion, universal r + 1 upper bound, strict minimality, and the residue-fix theorem used by the fallback.

Review series

This is the second of two dependent PRs and is stacked on #118. Review and merge #118 first. Until it merges and this branch is rebased, GitHub shows its commits cumulatively; this PR’s new review scope is the strict-minimum algorithm, correction note, tests, and examples.

Marcus P S (marcusps) and others added 8 commits June 14, 2026 04:21
Implement a linear-size decomposition of a Clifford into Clifford
transvections (pi/4 Pauli exponents) reproducing its symplectic
(conjugation) action, plus the centralizer generators (the paper's
headline application), in the paulimer crate.

- paulimer::clifford::clifford_to_transvections: greedy O'Meara-style
  reduction producing O(n) factors that reproduce the symplectic action
  (signs and global phase are not tracked; contrast the sign-exact,
  O(n^2) clifford_to_pauli_exponents). Not guaranteed strictly minimal;
  exact r/r+1 minimality via congruence triangulation is a follow-up.
- paulimer::clifford::clifford_centralizer: generators of Paulis fixed up
  to sign under conjugation (kernel of the residue map over GF(2), via
  binar).
- Python bindings CliffordUnitary.to_transvections() / .centralizer()
  with .pyi stubs.
- Extensive Rust (unit + proptest) and Python (hypothesis) tests:
  symplectic round trip, linear factor bound, no-shorter-than-minimum,
  and centralizer conjugation-fixedness.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Implement `clifford_to_transvections_minimal`, decomposing a Clifford into a
minimal-length ordered product of Clifford transvections (pi/4 Pauli exponents)
reproducing its symplectic action with r or r+1 factors (r = residue rank).

The core is an exact, complete congruence-triangularization of the residue form
E via memoized backtracking: the paper's forward-greedy pivot search is
incomplete at rank >= 5 (it can dead-end on a bad non-isotropic pivot even when
a triangularization exists), and its line-411 claim that every non-hyperbolic
form is triangularizable is incorrect. The r+1 branch appends a fix vector that
restores triangularizability at the same rank. Subspaces proven unsolvable are
memoized by canonical RREF key to keep the search tractable.

Add Python binding `CliffordUnitary.to_transvections_minimal`, .pyi stub, and
Rust + hypothesis tests (symplectic-action roundtrip, minimality bound r/r+1,
minimal <= greedy length). Track the regression seed for the previously-failing
n=4 case.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Document two issues found while implementing clifford_to_transvections_minimal:

1. The paper's claim that a non-hyperbolic symplectic map's residue matrix is
   always congruence-triangularizable (hence decomposes into exactly r
   transvections) is false over F2. The clean r/(r+1) dichotomy is Dieudonne's
   theorem (O'Meara, Symplectic Groups, Thm 2.1.11), stated only for F != F2;
   O'Meara's Sec 2.3 explicitly notes it fails over F2. We give a machine-checked
   2-qubit counterexample (residue rank 3, minimal length 4) and a census showing
   210 non-hyperbolic maps in Sp(4,2) require r+1.
2. Even when a triangularization exists, the forward-greedy pivot search is
   incomplete for r >= 5; fixed by complete memoized backtracking.

States the adopted criterion (min = r iff the residue core is
congruence-lower-triangularizable, else r+1) with honest caveats about exact
minimality for large m. All references verified against the sources.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Ensure the Clifford -> transvection decomposition (arXiv:2102.11380) is
referenced across docs, READMEs, and examples:

- Add a runnable Jupyter example
  (bindings/python/examples/clifford-transvection-decomposition.ipynb) showing
  greedy vs minimal decomposition, rebuild + symplectic-action verification, the
  r / r+1 factor count, and the non-hyperbolic r+1 case from the correction note.
- Reference the decomposition in paulimer/README.md (Clifford features +
  documentation list) and in the Python bindings README (feature bullet +
  quick-start snippet).
- Make this branch self-contained: rephrase the intra-doc links to
  clifford_to_pauli_exponents / to_pauli_exponents (which live on a separate
  branch) into plain text, so cargo doc builds standalone.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Generate residue-space candidates lazily without fixed-width masks, preventing eager exponential allocation and rank-64 shift overflow while preserving exhaustive search order. Document the exact search's remaining exponential time and memoization costs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: GPT-5.6 Sol <noreply@openai.com>
Marcus P S (marcusps) and others added 10 commits July 18, 2026 15:15
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply the conventions established while addressing @jmbr's review on the
phased-outcome / decomposition stack (PRs microsoft#115/microsoft#116) to the transvection
decomposition, anticipating the same feedback here:

- Replace the seed + internal-RNG proptests (`seed in any::<u64>()` feeding
  `CliffordUnitary::random`) with a `Gate`-sequence `Strategy`, mirroring
  phased_clifford_dense.rs and measure_with_hint_sign_test.rs, so a failing
  input shrinks to a minimal gate sequence instead of an opaque seed. The
  deterministic sweep (which needs no shrinking) keeps using a seeded RNG.
- Derive `qubit_count` inside `next_transvection` from `working.num_qubits()`
  instead of threading it as a parameter, matching the earlier "derive qubit
  count" tidy on the Gaussian-elimination decomposition.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16f923fe-a72a-4430-97b0-b7677f48dfb7
…inimal

Update the minimal-decomposition rung with the latest from the lower rung
clifford-to-pauli-exp-unphased (79c66e3): the Gate-strategy proptests and the
param-less next_transvection tidy, applying the @jmbr review conventions from
PRs microsoft#115/microsoft#116/microsoft#117 to this branch too.

Also align the branch's own minimal-decomposition tests with those conventions:
convert the remaining seed + internal-RNG proptests (minimal_reproduces_symplectic_action,
minimal_is_r_or_r_plus_one_and_at_most_greedy) to the shared Gate strategy so they
shrink to a minimal gate sequence, and drop the committed
transvection_test.proptest-regressions seed file. The deterministic seeded sweeps
(which need no shrinking) keep using random_clifford.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16f923fe-a72a-4430-97b0-b7677f48dfb7
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant