State preparation · exact one-qubit circuit
Preparing the equal superposition |+>
Prepare a coherent equal superposition from |0>, including the exact factor 1/sqrt(2).
Read this before the proof dashboard
See the difference between a classical random bit and a coherent quantum superposition.
Many quantum algorithms need interference. The Hadamard gate is the smallest example where two basis states simultaneously have nonzero amplitudes before measurement.
Preparing |+> is the first step of countless circuits. The important lesson is that amplitudes, not classical probabilities, are transformed coherently by later gates.
Read the circuit
What the wires and stages are doing
The wire is |0>, so the amplitude vector is (1,0).
H maps the vector to (1/sqrt(2),1/sqrt(2)).
A computational-basis measurement would return 0 or 1 with equal probability, but before measurement the relative amplitudes can still interfere.
The detailed circuit diagrams generated from the case record appear below this tutorial.
Statement → proof → optional Lean
The mathematical claims, in the order a human would prove them
Case theorem
Hadamard prepares the equal superposition
The exact square-root normalization, unitarity of H, and equality of the zero-input column with |+> are all machine checked.
Proof story
- Normalize |+>Each amplitude has squared magnitude 1/2, so the total is 1.
- Prove H is unitaryThe two columns are normalized and orthogonal.
- Read column zeroMultiplying by |0> selects H's first column, which is the desired amplitude vector.
- Record the circuitThe exact preparation uses one H gate and no ancilla.
Show the Lean proof checkpoints
The mathematical explanation above is the reading layer. These compiled declarations are the proof authority.
Mathematical target
The equation being studied
Lean proves the square-root identity needed for normalization, proves H is complex unitary, and identifies its zero-input column with the target amplitudes.
H- the Hadamard unitary
|+>- the normalized state with equal positive amplitudes
Circuit anatomy
How the candidate acts
These blocks show logical stages and register responsibilities. They do not pretend an unresolved logical oracle is already a primitive hardware gate.
Input
system = |0>
Unitary
apply Hadamard
Certified output
system = (|0>+|1>)/sqrt(2)
Auditable evolution
Candidate and proof progression
One exact candidate is sufficient. The certified score uses the same tuple order as the larger cases.
Hadamard candidate
Lean certifiedThe candidate closes normalization, unitarity, state action, and cost.
QuantumBlockEncoding.TextbookStatePreparation.hadamardVerified_cost
Edit and preview this stage →
Copy this stage as quantikz
\begin{quantikz}[column sep=.55cm]
\lstick{$\ket0$} & \gate{H} & \rstick{$\ket+ $} \qw
\end{quantikz}
Reader workbench
Edit, preview, then copy
Change symbols, language, proof steps, or the grouped-register circuit locally in your browser. The preview is explanatory; the linked Lean declaration remains the certificate.
Mathematical construction
Proof steps
One step per line. Natural language and inline mathematics are both accepted.
Quantum circuit
Complete packet
Copy the reviewed construction and proof
The packet below is generated from the reviewed case record. The exact primitive authority is the linked Lean source and executable artifact.
Construction and circuit LaTeX
% Requires: \usepackage{quantikz}
\paragraph{Construction.}
\[
H|0\rangle=|+\rangle=\frac{|0\rangle+|1\rangle}{\sqrt 2},\qquad H=\frac1{\sqrt2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}.
\]
% Hadamard candidate
\begin{quantikz}[column sep=.55cm]
\lstick{$\ket0$} & \gate{H} & \rstick{$\ket+ $} \qw
\end{quantikz}
English proof LaTeX
\paragraph{Proof.}
Lean proves the square-root identity needed for normalization, proves H is complex unitary, and identifies its zero-input column with the target amplitudes.
\begin{enumerate}
\item The candidate closes normalization, unitarity, state action, and cost.
\end{enumerate}
Each advertised certificate is the named Lean declaration linked on this page.
Lean declaration retrieval block
import QuantumBlockEncoding
#check QuantumBlockEncoding.TextbookStatePreparation.hadamard_unitary
#check QuantumBlockEncoding.TextbookStatePreparation.plusTarget_normalized
#check QuantumBlockEncoding.TextbookStatePreparation.hadamardCertificate_prepares_plus
#check QuantumBlockEncoding.TextbookStatePreparation.hadamardVerified_cost
Show the complete Lean certificate list
Open this when you want to inspect every declaration linked to the case.
Proof authority
Named Lean certificates
These declarations, compiled by the current Lean gate, support the mathematical and resource claims above.
QuantumBlockEncoding.TextbookStatePreparation.hadamard_unitaryQuantumBlockEncoding/TextbookStatePreparation.lean:104QuantumBlockEncoding.TextbookStatePreparation.plusTarget_normalizedQuantumBlockEncoding/TextbookStatePreparation.lean:121QuantumBlockEncoding.TextbookStatePreparation.hadamardCertificate_prepares_plusQuantumBlockEncoding/TextbookStatePreparation.lean:168QuantumBlockEncoding.TextbookStatePreparation.hadamardVerified_costQuantumBlockEncoding/TextbookStatePreparation.lean:156
Optional executable checks and outputs
Executable verification and exports
Checking and artifact selection are independent. A user may screen with Qiskit, OpenQASM round-trip, both, or neither, then request a different set of output files.
| Backend / artifact | Role | Status | Evidence |
|---|---|---|---|
| Internal canonical evaluator | Reference semantics for primitive canonical IR | open | metrics manifest |
| Qiskit Operator | Gate-by-gate numerical screening | artifact available | executable-exports/SP-TEXTBOOK-001/qiskit/export.py |
| OpenQASM 3 round-trip | Strict serialization, import, and semantic replay | not recorded | QASM and report when generated |
| Lean certificate | Exact proof authority at the page's stated semantic tier | passed | 4 named root(s) |
Exports the certified gate as runnable Qiskit code; numerical statevector output is optional user evidence, not the proof.
- Current runnable artifact
executable-exports/SP-TEXTBOOK-001/qiskit/export.py- Command
python3 executable-exports/SP-TEXTBOOK-001/qiskit/export.py --case hadamard
- Source
- ASPBE textbook example
- Contributor
- ASPBE authors
- Current boundary
- One qubit; no synthesis search is needed.