Engine 1 of 2
Exact quantum circuit verifier
Everything below runs in your browser. Circuit matrices are built by exact multiplication over the ring Z[omega][1/sqrt(2)] with omega = e^(i*pi/4), using BigInt coefficients throughout. There is no tolerance parameter in this page because there is nowhere to put one: two matrix entries are either the same canonical quadruple of integers or they are not.
If the vocabulary here is unfamiliar, Start Here explains what a circuit and a proof are in plain language first. For the ring theory, see the documentation.
Presets
Five of these are correct and three fail on purpose. Load a failing one to see what rejection looks like.
- [verified] A Hadamard then a CNOT entangles two qubits into (|00> + |11>) / sqrt(2).
- [verified] Spreading one Hadamard across a CNOT chain gives (|000> + |111>) / sqrt(2).
- [verified] The textbook Clifford+T implementation of CCX. Fifteen gates, seven of them T or T-dagger, compared against the Toffoli gate itself.
- [verified] The classic identity: alternating CNOTs exchange two qubits.
- [verified] Conjugating a phase flip by Hadamards turns it into a bit flip.
- [verified] Eight pi/8 rotations come back to where they started.
- [refuted] S after Z then S again is -X, which no measurement can distinguish from X. Asked for strict equality, the verifier refuses it anyway.
- [refuted] The same 7-T circuit with a single T-dagger flipped to a T. It still looks plausible. It is not correct.
- [refuted] Order matters for Pauli operators, and the verifier says so.
This is the headline result. Fifteen gates reduce to the same 8x8 permutation matrix as a single CCX, entry for entry, with no tolerance anywhere. Seven T gates is also known to be optimal for Toffoli over Clifford+T.
Circuit source
Declare the width with qubits N (N up to 8), then one gate per line. Qubit 0 is the most significant bit of a basis index. # starts a comment.
Gate palette
Clicking appends the gate on qubits 0, 1, 2 as needed. Edit the indices afterwards.
Claims to decide
| On | Proposition | Meaning |
|---|---|---|
| the circuit is norm preserving | ||
| the circuit is semantically a no-op | ||
| running it twice is the identity | ||
| the gate-by-gate adjoint undoes it | ||
| no superposition, no phase | ||
| equal to the comparison circuit below | ||
| commutes with the comparison circuit | ||
| equal superposition over the listed states |
Comparison circuit V
Used by the equality and commutation claims. Ignored otherwise.
Target basis states
Whitespace separated binary strings for the uniform superposition claim, e.g. 00 11.
Result
Claim by claim
| Result | Proposition | Detail |
|---|---|---|
| [PASS] | U†U = I | The 8x8 matrix is exactly unitary: every inner product of columns evaluates to a ring element equal to 0 or 1 with no rounding. |
| [PASS] | U is a permutation matrix | The circuit permutes computational basis states, so it denotes a classical reversible Boolean function. |
| [PASS] | U = V (V = V) | The two circuits denote the identical unitary, entry for entry, on the nose. |
State vector of C|0...0>
Amplitudes are exact ring elements. The floating point columns are rendered for reading only; nothing in the verdict above depends on them.
| basis | index | amplitude (exact) | re | im | probability |
|---|---|---|---|---|---|
| |000> | 0 | 1 | 1.000000 | 0.000000 | 1.000000 |
| |001> | 1 | 0 | 0.000000 | 0.000000 | 0.000000 |
| |010> | 2 | 0 | 0.000000 | 0.000000 | 0.000000 |
| |011> | 3 | 0 | 0.000000 | 0.000000 | 0.000000 |
| |100> | 4 | 0 | 0.000000 | 0.000000 | 0.000000 |
| |101> | 5 | 0 | 0.000000 | 0.000000 | 0.000000 |
| |110> | 6 | 0 | 0.000000 | 0.000000 | 0.000000 |
| |111> | 7 | 0 | 0.000000 | 0.000000 | 0.000000 |
Unitary matrix
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | |
|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
| 2 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
| 3 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
| 4 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
| 5 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 |
| 6 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 7 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
Artifact digest
SHA-256 of the canonical JSON of the circuit, the claim outcomes, the verdict and every exact matrix entry. Reword the prose and the digest is unchanged; change one gate and it is completely different. These 32 bytes are what the Solana program would store.
Take this digest to the registry
What this verifier cannot do
- Circuits wider than 8 qubits. The unitary has 4^n entries, so 8 qubits is already 65536 exact ring elements per matrix.
- Gates outside Clifford+T. An arbitrary rotation
Rz(theta)has entries that are not in the ring, so it cannot be represented here at all, let alone compared exactly. This is a hard boundary, not a missing feature. - Measurement, classical control, and noise. The object being checked is a unitary, which is the full semantics of a measurement-free circuit and nothing more.
- Uniform superpositions over a number of basis states that is not a power of two, since
1/sqrt(3)is not an element of the ring.