Gate 0.4.6d · G21
ADAPT-GQE composition: canonicalising a generated H2 ansatz
ADAPT-GQE generates circuits with a transformer and refines them with RL. The rule-(N/M/P) rewriter is syntax-driven and exact. Composition makes the rewriter a verifier: before spending hardware shots on a generated ansatz, canonicalise it and confirm the canonical form carries the same unitary.
The surrogate
exp(-i theta (X0 Y1 - Y0 X1) / 2)
- Angle
- pi/4
- Initial state
- |01> (Hartree-Fock)
- Backend
- Quest (ideal)
The H2 / STO-3G single-excitation UCCSD operator restricted to the two-qubit active space: the smallest non-trivial chemistry ansatz, and the same active space used by the ethylene QPDE work in G16.
1 — Matrix oracle: the two forms are the same unitary
| Form | Gate sequence | 2q gates | |Δ| vs exact |
|---|---|---|---|
| original | CNOT(q1->q0) · CRy(2theta)(q0->q1) · CNOT(q1->q0) | 3 | 0 |
| alternate | CNOT(q1->q0) · Ry(theta) q1 · CNOT(q0->q1) · Ry(-theta) q1 · CNOT(q0->q1) · CNOT(q1->q0) | 4 | 1.1e-16 |
Both 4×4 matrices reproduce the target Givens rotation to 1.1e-16, well inside the 1.0e-9 tolerance. An earlier draft of the design used a conjugated-Rz sandwich; that realises exp(-i θ Z₀Z₁), not the excitation, and the numeric driver caught it.
2 — Rule (M): canonicalising the Clifford frame
| Segment | Source | Rule-(M) residue |
|---|---|---|
| CNOT(q1->q0) | H0 CZ H0 | H0 CZ H0 |
| CNOT(q0->q1) | H1 CZ H1 | H1 CZ H1 |
| CNOT(q0->q1) . CNOT(q1->q0) | H1 CZ H1 H0 CZ H0 | H1 CZ H0 H1 CZ H0 |
Ry(theta) is outside the Clifford alphabet, so only the CNOT frame is canonicalised; the rotation core is verified by the 4x4 matrix oracle. Entry point: src/lib/zx/conjecture-synth-2q.ts normalise2qWithMatrix (rule M). The residues are already minimal here — the frame is three CNOTs, each irreducible in the H0/H1/CZ/S0/S1 alphabet — so composition costs nothing and buys an exactness check. See the 2-qubit conjectures for the oracle itself.
3 — Selene: 512 shots per form on Quest
| Form | |00⟩ | |01⟩ | |10⟩ | |11⟩ | |Δ| vs exact | Verdict |
|---|---|---|---|---|---|---|
| exact | 0.000 | 0.500 | 0.500 | 0.000 | — | — |
| original (6 gates) | 0.000 | 0.500 | 0.500 | 0.000 | 0.0000 | PASS |
| alternate (14 gates) | 0.000 | 0.518 | 0.482 | 0.000 | 0.0176 | PASS |
Threshold is the project-standard 4σ binomial envelope, 4·√(0.5/512) = 0.125. Worst deviation across both forms is 0.0176; the two forms agree with each other to 0.0176.
What this does and does not show
- It shows a generated chemistry ansatz can be run through the existing rewriter and checked exactly before it reaches hardware.
- It does not show a gate-count win. At two qubits the Clifford frame is already minimal; a saving would only appear on deeper generated circuits.
- The canonicalisation is TypeScript and the execution is Python. There is no Python port of the 2-qubit oracle yet, so the two halves are joined by the static dump rather than by a single process.
- Ry sits outside the Clifford alphabet. Canonicalisation is only safe on the Clifford frame; parameterised rotations must be verified by the matrix oracle or left untouched.