Skip to main content
b01t is a Python DSL for safe quantum programming that compiles to Qiskit. Unlike other quantum frameworks, b01t enforces ancilla cleanliness and unitary correctness at build time through its type system — every well-typed @coherent program is a proven unitary channel, no simulation required.

Quick Start

Write your first safe quantum program in minutes

Installation

Install b01t and set up your environment

Core Concepts

Understand the safety model and how b01t catches quantum bugs

API Reference

Complete reference for decorators, gates, and kit utilities

Why b01t?

Every quantum programmer eventually writes a circuit with a dirty ancilla — a helper qubit that gets entangled with the system instead of returning to |0⟩. Qiskit, Cirq, and Q# all accept these programs. They compile, they run, and they look fine. But they silently compute the wrong thing. b01t rejects them at build time:
from b01t import coherent, QReg, cx, h, z
from b01t.kit import ancilla, compute, phase, uncompute

@coherent
def broken(sys: QReg):
    with ancilla(1) as anc:
        compute(lambda: h(anc[0]))  # "just put it in superposition"
        phase(lambda: z(anc[0]))
        uncompute()

# DSLValidationError: gate 'h' is not allowed in exact compute blocks
The compute block accepts only permutation gates. The phase block accepts only diagonal gates. If your program passes these rules, it is a unitary channel — by construction.

Get started

1

Install b01t

Install with pip or uv:
pip install b01t
2

Write a coherent program

Use @coherent and ancilla discipline to write a certified-safe quantum circuit.
3

Build and certify

Call .build_exact() to compile your program. Check prog.certification == Certification.SAFE.
4

Compile to Qiskit

Use QiskitBackend().emit(ir) to get a QuantumCircuit ready to run.