State preparation · exact d=3 target + two exact typed same-target circuits
Sparse state preparation: prune the zero branches
Prepare a three-qubit state with only d=3 nonzero amplitudes, (3|000>+4|010>+12|100>)/13, and make the savings from a known-zero amplitude layer explicit.
Source paper · paper-derived sparse finite benchmark
Where this example comes from
Nearly Optimal Circuit Size for Sparse Quantum State Preparation
Lvzhou Li, Jingquan Luo · 2025
Source anchor. Li–Luo Eq. (1)–(2)
Eq. (1) Eq. (2)
What the paper says. Eq. (1) represents a d-sparse state by its nonzero amplitudes and basis labels. Eq. (2) is the exact unitary preparation contract, including clean ancillary qubits.
What ASPBE does here. ASPBE sets n=3 and d=3 and proves one exact finite witness of Eq. (2). The 5-vs-15 zero-branch pruning comparison is a finite ASPBE benchmark and is not presented as a reproduction of the paper's asymptotic Theorem 1.
Read this before the proof dashboard
See sparsity as a missing amplitude subtree that can be removed from an exact typed circuit.
Only basis indices 0,2,4 carry amplitude. A structure-blind amplitude tree can spend gates compiling a final q0 layer even though q0 is known to remain zero on all support points.
Li–Luo studies sparse-state circuit complexity asymptotically. ASPBE starts with an exact n=3,d=3 witness of Eq. (2), then makes one finite pruning mechanism machine-checkable without claiming Theorem 1.
Read the circuit
What the wires and stages are doing
Only 0,2,4 are nonzero; q0 is zero on every supported basis state.
RY on q2 creates masses 5/13 and 12/13.
One-control UCRY on q1 produces 3/13 and 4/13; the q2=1 branch uses zero angle.
Append a two-control zero-angle UCRY on q0; Lean proves its exact matrix is identity.
Remove that identity subtree and compare the circuit-derived tuples.
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
Sparse finite theorem
The n=3,d=3 Li–Luo Eq. (2) witness has an exact typed preparation route
Lean checks exact normalization, full-unitary completion, the pruned typed circuit state action, and the same-target dense baseline.
Proof story
- Normalize3^2+4^2+12^2=13^2.
- Prepare rootUse the 5-12-13 split on q2.
- Prepare nonzero branchUse the 3-4-5 split on q1 when q2=0.
- Prove zero-fill identityA two-control UCRY with every angle zero evaluates exactly to identity.
- Package both routesBoth circuits therefore prepare the same target.
Show the Lean proof checkpoints
The mathematical explanation above is the reading layer. These compiled declarations are the proof authority.
QuantumBlockEncoding.StatePreparationBenchmarks.sparseThreeTarget_normalizedQuantumBlockEncoding.StatePreparationBenchmarks.sparseThreeMatrix_unitaryQuantumBlockEncoding.StatePreparationBenchmarks.sparsePruned_prepares_targetQuantumBlockEncoding.StatePreparationBenchmarks.sparseDenseTree_prepares_target
What ASPBE improves
Prune the provably identity zero-amplitude layer
The dense reference compiler spends ten extra gates on a two-control zero-angle UCRY whose semantics is exactly identity. Removing it preserves the state and strictly improves the resource tuple.
Why the proof is allowed to say “better”
- Freeze the sparse targetBoth circuits are already exact state-preparation routes.
- Count dense baselinePruned route plus the identity UCRY yields (15,13,0,0).
- Count pruned routeRoot plus one-control UCRY yields (5,4,0,0).
- Apply betterThan5<15 proves strict lexicographic improvement.
Show the Lean winner/comparison theorems
The mathematical explanation above is the reading layer. These compiled declarations are the proof authority.
Mathematical target
The equation being studied
Lean proves exact normalization and a full 8 by 8 unitary completion. The pruned typed circuit uses a q2 root RY followed by a q2-controlled UCRY on q1 and has cost (5,4,0,0). The same-target dense baseline appends a two-control zero-angle UCRY on q0; Lean proves that appended block is exactly identity but its reference compiler still costs ten gates, yielding (15,13,0,0).
d-sparse- only d computational-basis amplitudes are nonzero
Eq. (2)- Li–Luo's exact preparation-unitary contract, specialized here to n=3,d=3
zero-fill baseline- a semantic identity circuit that deliberately pays for the amplitude subtree known to be zero
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.
Dense zero-fill baseline
prepare the sparse target correctly, then compile a two-control zero-angle UCRY on q0
Prune zero support
q0 remains zero; only root q2 split and q2-controlled q1 split are needed
Auditable evolution
Candidate and proof progression
Both candidates are exact typed circuits preparing the same d=3 target. The asymptotic Li–Luo Theorem 1 remains outside this finite comparison.
Dense three-qubit tree
Lean certifiedSame-target baseline retains an exact-identity zero-angle amplitude layer.
QuantumBlockEncoding.StatePreparationBenchmarks.sparseDenseTreeVerified_cost
Edit and preview this stage →
Copy this stage as quantikz
\begin{quantikz}[row sep=.35cm,column sep=.45cm]
\lstick{$q_2$} & \gate{R_y} & \ctrl{1} & \qw & \qw \\
\lstick{$q_1$} & \qw & \gate{\mathrm{UCRY}_1} & \qw & \ctrl{1} \\
\lstick{$q_0$} & \qw & \qw & \qw & \gate{\mathrm{UCRY}_2(0)}
\end{quantikz}
Sparse pruned tree
Strictly better · Lean certifiedThe known-zero q0 amplitude layer is removed without changing the prepared state.
QuantumBlockEncoding.StatePreparationBenchmarks.sparsePruned_betterThan_denseTree
Edit and preview this stage →
Copy this stage as quantikz
\begin{quantikz}[row sep=.35cm,column sep=.55cm]
\lstick{$q_2:\ket0$} & \gate{R_y(2\arccos(5/13))} & \ctrl{1} & \qw & \ctrl{1} & \qw \\
\lstick{$q_1:\ket0$} & \qw & \gate{R_y} & \targ{} & \gate{R_y} & \targ{} \\
\lstick{$q_0:\ket0$} & \qw & \qw & \qw & \qw & \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.}
\[
|\psi_{\mathrm{sparse}}\rangle=\frac{3|000\rangle+4|010\rangle+12|100\rangle}{13},\qquad d=3.
\]
% Dense three-qubit tree
\begin{quantikz}[row sep=.35cm,column sep=.45cm]
\lstick{$q_2$} & \gate{R_y} & \ctrl{1} & \qw & \qw \\
\lstick{$q_1$} & \qw & \gate{\mathrm{UCRY}_1} & \qw & \ctrl{1} \\
\lstick{$q_0$} & \qw & \qw & \qw & \gate{\mathrm{UCRY}_2(0)}
\end{quantikz}
% Sparse pruned tree
\begin{quantikz}[row sep=.35cm,column sep=.55cm]
\lstick{$q_2:\ket0$} & \gate{R_y(2\arccos(5/13))} & \ctrl{1} & \qw & \ctrl{1} & \qw \\
\lstick{$q_1:\ket0$} & \qw & \gate{R_y} & \targ{} & \gate{R_y} & \targ{} \\
\lstick{$q_0:\ket0$} & \qw & \qw & \qw & \qw & \qw
\end{quantikz}
English proof LaTeX
\paragraph{Proof.}
Lean proves exact normalization and a full 8 by 8 unitary completion. The pruned typed circuit uses a q2 root RY followed by a q2-controlled UCRY on q1 and has cost (5,4,0,0). The same-target dense baseline appends a two-control zero-angle UCRY on q0; Lean proves that appended block is exactly identity but its reference compiler still costs ten gates, yielding (15,13,0,0).
\begin{enumerate}
\item Same-target baseline retains an exact-identity zero-angle amplitude layer.
\item The known-zero q0 amplitude layer is removed without changing the prepared state.
\end{enumerate}
Each advertised certificate is the named Lean declaration linked on this page.
Lean declaration retrieval block
import QuantumBlockEncoding
#check QuantumBlockEncoding.StatePreparationBenchmarks.sparseThreeTarget_normalized
#check QuantumBlockEncoding.StatePreparationBenchmarks.sparseThreeMatrix_unitary
#check QuantumBlockEncoding.StatePreparationBenchmarks.sparsePruned_prepares_target
#check QuantumBlockEncoding.StatePreparationBenchmarks.sparseDenseTree_prepares_target
#check QuantumBlockEncoding.StatePreparationBenchmarks.sparseDenseTreeVerified_cost
#check QuantumBlockEncoding.StatePreparationBenchmarks.sparsePrunedVerified_cost
#check QuantumBlockEncoding.StatePreparationBenchmarks.sparsePruned_betterThan_denseTree
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.StatePreparationBenchmarks.sparseThreeTarget_normalizedQuantumBlockEncoding/StatePreparationBenchmarksCoreFixed.lean:245QuantumBlockEncoding.StatePreparationBenchmarks.sparseThreeMatrix_unitaryQuantumBlockEncoding/StatePreparationBenchmarksCoreFixed.lean:271QuantumBlockEncoding.StatePreparationBenchmarks.sparsePruned_prepares_targetQuantumBlockEncoding/StatePreparationPaperRoutesCompact.lean:577QuantumBlockEncoding.StatePreparationBenchmarks.sparseDenseTree_prepares_targetQuantumBlockEncoding/StatePreparationPaperRoutesCompact.lean:633QuantumBlockEncoding.StatePreparationBenchmarks.sparseDenseTreeVerified_costQuantumBlockEncoding/StatePreparationPaperRoutesCompact.lean:650QuantumBlockEncoding.StatePreparationBenchmarks.sparsePrunedVerified_costQuantumBlockEncoding/StatePreparationPaperRoutesCompact.lean:645QuantumBlockEncoding.StatePreparationBenchmarks.sparsePruned_betterThan_denseTreeQuantumBlockEncoding/StatePreparationPaperRoutesCompact.lean:655
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 replay | Gate-by-gate numerical screening | artifact available | executable-exports/SP-PAPERS-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 | 7 named root(s) |
Numerically mirrors the pruned exact route; Lean proves the exact target and same-target resource comparison.
- Current runnable artifact
executable-exports/SP-PAPERS-001/qiskit/export.py- Command
python3 executable-exports/SP-PAPERS-001/qiskit/export.py --case sparse
- Source
- Li–Luo Eq. (1)–(2), arXiv:2406.16142
- Contributor
- ASPBE authors
- Current boundary
- Fixed n=3,d=3 witness only. The asymptotic sparse constructions, ancilla tradeoffs, and Theorem 1 lower/upper bounds remain in Papers.