@coherent and @primitive programs, which contains only gates synthesisable from , and parametric rotations (rx, ry, rz, cry, crz), which are only available in @parametric and @adaptive programs.
The exact gate set
The exact gate set is the universe of gates available in a@coherent or @primitive program. It is a closed, finite set: no free-angle parameters, no symbolic expressions. Every gate in this set can be synthesised exactly from the universal basis , which is the basis of the Hero Theorem proof.
Attempting to use
rx, ry, rz, cry, or crz inside a @coherent or @primitive function raises DSLValidationError immediately — parameterized rotations are not in the exact gate set.Single-qubit gates
All single-qubit gates take a singleWire argument. You get a Wire by indexing a QReg: sys[0], anc[1], etc.
Two-qubit gates
Two-qubit gates take twoWire arguments. All wires must be distinct — passing the same wire twice raises DSLValidationError.
Three-qubit gates
The Toffoli gate (ccx) and doubly-controlled-Z (ccz) take three wire arguments — two controls and one target.
Multi-controlled gates
mcx and mcz accept an arbitrary number of controls as a list or sequence of wires, plus a single target wire. They require at least one control.
Parametric rotation gates
Parametric gates take an angle (in radians) as their first argument, followed by the wire. They are only available inside@parametric and @adaptive functions.
Gate classification for ancilla blocks
Inside@coherent ancilla blocks, not every gate is available everywhere. The compute section allows only permutation gates and the phase section allows only diagonal gates. See Ancilla Discipline for the full explanation of why these restrictions exist.
| Gate | Exact set | Compute | Phase | Parametric |
|---|---|---|---|---|
x | Yes | Yes | No | No |
h | Yes | No | No | No |
z | Yes | No | Yes | No |
s | Yes | No | Yes | No |
sdg | Yes | No | Yes | No |
t | Yes | No | Yes | No |
tdg | Yes | No | Yes | No |
cx | Yes | Yes | No | No |
cz | Yes | No | Yes | No |
swap | Yes | Yes | No | No |
ccx | Yes | Yes | No | No |
ccz | Yes | No | Yes | No |
mcx | Yes | Yes | No | No |
mcz | Yes | No | Yes | No |
rx | No | No | No | Yes |
ry | No | No | No | Yes |
rz | No | No | No | Yes |
cry | No | No | No | Yes |
crz | No | No | No | Yes |
@parametric and @adaptive functions.
h is in the exact gate set and is available at the top level of @coherent functions, but it is not a permutation gate and not a diagonal gate — so it is not allowed inside compute or phase blocks.Measurement
measure and measure_all are only available in @adaptive functions. Attempting to use them in @coherent, @primitive, or @parametric raises DSLValidationError.
Importing gates
All gates are available from the top-levelb01t package: