State preparation · exact one-qubit circuit
Preparing the basis state |1>
Starting from the computational-basis zero state, construct a one-qubit unitary whose output is exactly |1>.
Read this before the proof dashboard
Learn what state preparation means before seeing a complicated data-loading circuit.
A quantum algorithm must begin in a quantum state. This one-qubit example isolates that input-access problem: can a circuit take the easy state |0> to the requested target |1>?
This is not claiming a speedup. It is the smallest possible instance of the same contract used when a larger algorithm asks for an input state |psi>.
Read the circuit
What the wires and stages are doing
The wire begins in |0>.
The X box swaps the amplitudes of |0> and |1>.
The output is exactly |1>; there is no ancilla and no measurement in the certificate.
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
Pauli X prepares the basis state |1>
The target vector is normalized, X is unitary, and applying X to the zero basis state returns the target exactly.
Proof story
- Normalize the targetThe target has one amplitude equal to 1 and all others 0, so its norm is 1.
- Prove unitarityX is a permutation matrix and therefore preserves the computational basis and inner products.
- Check the zero inputThe first column of X is exactly the vector |1>.
- Package the certificateThe target, circuit, semantic proof, and one-gate resource record are stored together.
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 normalization of the target, unitarity of X, and the exact matrix-vector equation. No sampled amplitudes or floating-point tolerance enters the certificate.
|0>, |1>- the two computational-basis states
X- the Pauli X unitary, which exchanges the two basis states
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 Pauli X
Certified output
system = |1>
Auditable evolution
Candidate and proof progression
This textbook case closes in one candidate; the plot is a proof-and-resource trace, not a search claim.
X candidate
Lean certifiedThe first and only candidate satisfies the exact state-action contract.
QuantumBlockEncoding.TextbookStatePreparation.pauliXVerified_cost
Edit and preview this stage →
Copy this stage as quantikz
\begin{quantikz}[column sep=.55cm]
\lstick{$\ket0$} & \gate{X} & \rstick{$\ket1$} \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.}
\[
X|0\rangle=|1\rangle,\qquad X=\begin{pmatrix}0&1\\1&0\end{pmatrix}.
\]
% X candidate
\begin{quantikz}[column sep=.55cm]
\lstick{$\ket0$} & \gate{X} & \rstick{$\ket1$} \qw
\end{quantikz}
English proof LaTeX
\paragraph{Proof.}
Lean proves normalization of the target, unitarity of X, and the exact matrix-vector equation. No sampled amplitudes or floating-point tolerance enters the certificate.
\begin{enumerate}
\item The first and only candidate satisfies the exact state-action contract.
\end{enumerate}
Each advertised certificate is the named Lean declaration linked on this page.
Lean declaration retrieval block
import QuantumBlockEncoding
#check QuantumBlockEncoding.TextbookStatePreparation.pauliX_unitary
#check QuantumBlockEncoding.TextbookStatePreparation.oneTarget_normalized
#check QuantumBlockEncoding.TextbookStatePreparation.pauliXCertificate_prepares_one
#check QuantumBlockEncoding.TextbookStatePreparation.pauliXVerified_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.pauliX_unitaryQuantumBlockEncoding/TextbookStatePreparation.lean:28QuantumBlockEncoding.TextbookStatePreparation.oneTarget_normalizedQuantumBlockEncoding/TextbookStatePreparation.lean:43QuantumBlockEncoding.TextbookStatePreparation.pauliXCertificate_prepares_oneQuantumBlockEncoding/TextbookStatePreparation.lean:162QuantumBlockEncoding.TextbookStatePreparation.pauliXVerified_costQuantumBlockEncoding/TextbookStatePreparation.lean:78
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; it is not used to decide the theorem.
- Current runnable artifact
executable-exports/SP-TEXTBOOK-001/qiskit/export.py- Command
python3 executable-exports/SP-TEXTBOOK-001/qiskit/export.py --case pauli-x
- Source
- ASPBE textbook example
- Contributor
- ASPBE authors
- Current boundary
- One qubit; no synthesis search is needed.