Skip to main content
b01t’s gates are ordinary Python functions. You call them inside a decorated function body, and the build system intercepts the calls to construct a typed AST rather than executing them directly. The gate set is split in two: the exact gate set for @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 single Wire argument. You get a Wire by indexing a QReg: sys[0], anc[1], etc.

Two-qubit gates

Two-qubit gates take two Wire 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. “Parametric” here means the gate is available at the top level of @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-level b01t package: