Circuit Examples and Explanations

Version-aligned Bell, GHZ, teleportation, Deutsch–Jozsa, Grover, phase and parity-check demonstrations.

Documentation version: 2.0 · Compatible with: current AutomationGlance simulator · Last reviewed: 2026-10-05

All examples use the current DSL, zero-based indices and terminal measurement. Each is executed in documentation regression tests.

Bell state

qubits 2
H 0
CX 0 1
MEASURE 0
MEASURE 1

Measurements of the two qubits exhibit correlated outcomes in the computational basis: 00 and 11 each have probability ½. The known ideal circuit prepares (|00⟩+|11⟩)/√2; correlation alone is not an entanglement witness.

GHZ state

qubits 3
H 0
CX 0 1
CX 0 2
MEASURE 0
MEASURE 1
MEASURE 2

Computational-basis measurements yield correlated outcomes 000 and 111, each with ideal probability ½. No faster-than-light communication follows.

Teleportation preparation and Bell measurement

qubits 3
H 1
CX 1 2
H 0
CX 0 1
H 0
MEASURE 0
MEASURE 1

q0 contains |+⟩; q1 and q2 form the resource pair. The final CX and H implement the Bell-basis change. Alice’s two output bits are uniformly distributed. This is a partial protocol: the DSL has no measurement-conditioned X/Z corrections and cannot complete arbitrary-state teleportation through classical feedback. Adding unconditional X/Z gates is not a replacement.

Deutsch–Jozsa: one-input-bit balanced oracle

qubits 2
X 1
H 0
H 1
CX 0 1
H 0
MEASURE 0

The oracle f(x)=x is balanced. Phase kickback and the final H make the measured input bit 1 with probability 1. A constant oracle would produce 0. This demonstrates a query-model distinction; a tiny classical simulation is not a practical quantum speedup.

Two-qubit Grover search

qubits 2
H 0
H 1
CZ 0 1
H 0
H 1
X 0
X 1
H 1
CX 0 1
H 1
X 0
X 1
H 0
H 1
MEASURE 0
MEASURE 1

CZ marks |11⟩ with a minus sign; the remaining gates implement diffusion up to a global phase. One iteration yields 11 with ideal probability 1.

Superposition sampler

qubits 2
H 0
H 1
MEASURE 0
MEASURE 1

The product state |++⟩ has probability ¼ for each of 00, 01, 10 and 11. Counts approach those probabilities over many shots.

A fixed random-style circuit

qubits 2
H 0
CX 0 1
RZ 1 1.234
X 0
H 1
MEASURE 0
MEASURE 1

A fixed example for exploring phase and interference. This particular circuit has uniform computational-basis probabilities despite nontrivial phases. Random circuit generation and shot-sampling seed are separate controls; random circuits do not establish a hardware benchmark.

Phase kickback

qubits 2
H 0
X 1
CZ 0 1
H 0
MEASURE 0

With target q1 in |1⟩, CZ applies a Z phase to the control. The final H converts that phase into a deterministic q0=1 result.

QFT context: phase intuition

qubits 1
H 0
S 0
T 0
H 0
MEASURE 0

This is a phase-interference demonstration, not a full quantum Fourier transform: P(0)=(2−√2)/4 and P(1)=(2+√2)/4. QFT uses controlled phase rotations and final wire ordering. Those rotations can be decomposed into supported gates, but there is no native QFT or controlled-phase DSL instruction. The v1 guide’s CZ/RZ/SWAP listing was not a valid implementation of QFT; it has been replaced by this explicitly limited demonstration.

Repetition-code parity checks

qubits 5
H 0
CX 0 1
CX 0 2
# Inject X on the first encoded data qubit
X 0
# Ancillas record adjacent parity checks
CX 0 3
CX 1 3
CX 1 4
CX 2 4
MEASURE 3
MEASURE 4

The first three qubits encode a repetition state. After the deliberate X0 error, ancillas q3,q4 give syndrome 10 with probability 1. With no injected error the syndrome is 00; X1 yields 11 and X2 yields 01. This illustrates detection under a single-bit-flip assumption, not protection from arbitrary quantum errors or implemented conditional correction.

Reading results

Gate count and greedy depth describe structure, not physical execution time. The interaction graph indicates controlled-gate pairs; it is not a state-based entanglement test. Amplitudes carry complex phase; squared magnitudes give probabilities. A reduced Bloch vector can lie inside the sphere for an entangled pure joint state. See analysis limitations and Complexity Score.

Using the simulator

Run sends a request to the API. Reset and sample loaders prepare editor contents. Random circuit generation provides exploratory examples. Share stores encoded circuit/settings in a link. Copy QASM exports a supported OpenQASM 2.0 subset. SVG/PNG downloads require a current rendered diagram. Performance mode reduces UI effects, not simulation memory requirements. API Playground exercises the same endpoint.