QReg
A quantum register: a named, contiguous block of qubits.Register kind.
"sys" for user-declared registers, "anc" for ancilla registers allocated by ancilla(...).Methods and indexing
Wire
A reference to a single qubit within a register. Wires are frozen dataclass instances and are used everywhere gates accept qubit arguments.Wire objects by indexing a QReg rather than constructing them directly.
ExactProgram
The result of calling.build_exact() on a @coherent or @primitive function. Represents a certified exact program.
All registers in the program, including any ancilla registers allocated during the build. System registers appear first.
The compiled op sequence. Contains
ExactGateOp, ExactAncillaBlock, or ExactParOp instances.Certification.SAFE for @coherent programs; Certification.PRIMITIVE for @primitive programs.IRProgram
The result of calling.build() on a @parametric or @adaptive function, or of calling lower_exact_program() on an ExactProgram.
The compiled op sequence. Contains
GateOp, MeasureOp, MeasureAllOp, IfOp, AncillaBlockOp, or ParOp instances.True if the program passed the safety checker (coherent effect + well-formed ancilla blocks with exact-safe gates only). Always False for adaptive programs.Certification
Enum marking the safety level of anExactProgram.
Effect
Enum describing the computational effect of anIRProgram.
DSLValidationError
Raised whenever a b01t rule is violated. Inherits fromRuntimeError.
Common causes:
- Using a forbidden gate in a context (e.g.,
rxin@coherent) - Calling a gate outside a build context
- Ancilla discipline violations (missing
uncompute, nested blocks) - Duplicate register names
- Measurement in a
@coherentfunction if_thenin a non-adaptive function- Calling
.build_exact()or.build()with wrong argument types
is_safe_program
bool — True if all ops satisfy the safety conditions.
dump_ir
IRProgram as a human-readable text string. Useful for debugging and inspecting compiled programs.
Returns: a multi-line string with the program name, effect, safety flag, register declarations, and indented op listing.