Checked on this commit4,524 public declarationscommit 4e2c5b2c0be5Build record
Foundation lesson · do not skip this if you are new
Before the cases: how a quantum algorithm gets access to data and matrices
A quantum algorithm is not given a NumPy array for free. Before discussing speedups, we must say how classical data, matrix entries, or a linear operator become quantum operations. State preparation, query oracles, and block encodings are three different access contracts.
State preparation
\[P|0^n\rangle=|\psi\rangle\]
Contract. Build a circuit P that creates the input quantum state you actually want to use.
Why it matters. Algorithms that start from amplitude-encoded data need this state before any later quantum subroutine can help. Preparation cost is therefore part of the end-to-end algorithm, not decorative preprocessing.
The Pauli-X and Hadamard cases show the smallest exact examples.
Contract. Ask a reversible black box for a matrix entry encoded in a work register.
Why it matters. Query-complexity theorems often count how many times the oracle is called, but a real fault-tolerant implementation must also build the arithmetic and memory circuit hidden inside that call.
The GHL Robin paper explicitly contrasts this model with its gate-level construction.
Contract. Embed a possibly non-unitary matrix A as the clean ancilla block of a larger unitary U_A.
Why it matters. Quantum hardware applies unitary gates. Block encoding is the interface that lets algorithms such as QSVT and Hamiltonian simulation manipulate a general structured matrix through a unitary circuit.
BE Case 1, the cubic diagonal family, and the Robin case all certify this contract.
How to read a quantum circuit
Follow the state from left to right
q0: |0>H●measurement
q1: |0>⊕measurement
wireA horizontal wire is one qubit/register. Time flows from left to right.
|0>A ket at the left fixes the input state of that wire.
H, X, RYA box is a gate. Its matrix acts when the state reaches that box.
controlA control dot means another gate acts only when the control condition is satisfied.
daggerU† means the inverse/conjugate-transpose circuit; it often uncomputes temporary information.
ancillaAn ancilla is workspace. A clean block-encoding proof normally requires selected ancillas to start and end in |0>.
measurementMeasurement converts quantum amplitudes into classical outcomes; it is different from the coherent unitary part of the circuit.
The H-plus-CNOT circuit above prepares the Bell state \((|00\rangle+|11\rangle)/\sqrt2\). The same visual grammar is used in the case studies; larger diagrams only add named registers and uncomputation.
Reading mode
Start visually; reveal formalism only when you want it.
Beginner layer · second ASPBE problem
A general matrix is not a quantum gate — block encoding hides it inside one
Quantum gates must be unitary, but the matrix A you want to use may be non-unitary. The trick is to build a larger unitary U whose clean ancilla corner equals A up to a known scale.
The ancilla is prepared and projected in |0⟩; the system sees the clean block A/α.
anc|0⟩U_Aproject 0|0⟩
sys|ψ⟩U_AA|ψ⟩/α
ProblemA may shrink, amplify, or otherwise fail the unitary condition.
Add roomIntroduce ancilla qubits so a larger matrix can remain unitary.
Hide AArrange for the ancilla-zero block to be A/α.
Use itLater algorithms can manipulate the encoded matrix while only implementing the unitary U_A.
András Gilyén, Yuan Su, Guang Hao Low, Nathan Wiebe
Research anchor for block encoding and singular-value transformation.
Learn Lean while learning quantum computing
Lean idea: projection equality is the acceptance test
candidate.blockContainsTarget : ∀ i j, U (clean i) (clean j) = A i j / α
The library does not accept a circuit because a simulator looks close. The selected matrix entries are an explicit proposition.
The full proof-backed declarations for this chapter are shown immediately below.
Part II · encompassing block-encoding layer
Block encoding
Given an operator \(A\), place the scaled operator inside a
larger unitary. The contract says exactly which ancilla block is selected and
how normalization and approximation are interpreted.
Extra qubits make room for the larger unitary and are projected onto a declared clean state.
Register order
The index convention identifies which matrix rows and columns form the signal block.
Normalization \(\alpha\)
The selected block represents \(A/\alpha\), so the scale is part of correctness.
Error \(\varepsilon\)
Exact encoding has zero error; approximate routes must name both a norm and a tolerance.
Encompassing construction certificate
What ASPBE has to establish
A candidate is not accepted because one small matrix looks right. The layout,
unitarity, projected block, scale, and declared resource record are checked as
separate obligations.
flowchart LR
T["Target operator A<br/>and scale α"] --> R["Fix ancillas, norm,<br/>and register order"]
R --> C["Choose a construction<br/>family and unitary U"]
C --> U["Prove U is unitary"]
C --> B["Prove the clean block<br/>‖A − α Π U Π†‖ ≤ ε"]
U --> L["Lean block-encoding<br/>certificate"]
B --> L
L --> E["Export and check one<br/>certified finite instance"]
classDef target fill:#ffffff,stroke:#49677d,color:#1f2e39,stroke-width:1.5px;
classDef work fill:#ffffff,stroke:#64747a,color:#222222,stroke-width:1.25px;
classDef proof fill:#ffffff,stroke:#2f7355,color:#18382b,stroke-width:1.5px;
class T,R target;
class C,U,B work;
class L,E proof;
Source-audited additions · not yet compiled roots
Diagonal operators and structured Fourier suppliers
Separate phase operators from dilated filters and prove matched space–time–accuracy contracts, including cleanup and error-scale adapters.
PlannedInspect pinned upstream memory (1 routes)
OpenAI Math snapshot adc7f1241b42 · upstream Lean 4.34.1 · local migration target 4.33.0.
Source placement does not certify an adapter, the whole chapter, or an SP/BE construction.
oracle-assisted unitary synthesis frontier directly relevant to ASPBE synthesis semantics
Upstream evidence: manuscript-only-in-current-audit. benchmark-only. Not local admission.
Next boundary: compare target/operator/oracle/resource contract with the ASPBE synthesis API before formal route creation
be-fourier-suppliers
Fourier and structured linear-operator suppliers
Connect exact Fourier circuit resources and structured operator descriptions to the shared circuit and block interfaces without treating either as an automatic block encoding.
PlannedInspect pinned upstream memory (1 routes)
OpenAI Math snapshot adc7f1241b42 · upstream Lean 4.34.1 · local migration target 4.33.0.
Source placement does not certify an adapter, the whole chapter, or an SP/BE construction.
exact Fourier-circuit construction and resource theorem; supplier to Fourier/QPE chapters after circuit-model adaptation
Upstream evidence: comparator-backed. source-route. Not local admission.
Next boundary: compare circuit ordering, gate set and cost tuple with the local circuit/resource API; do not present the Fourier result as a block encoding or QPE certificate
The main inclusion-like connection
State Preparation supplies a nested PREPARE subproblem
A certified state-preparation circuit can supply a PREPARE oracle for an LCU,
Gram, or purification-based construction. Its first-column theorem becomes a
dependency; it does not by itself prove the clean-block identity.