Textbook / teaching anchor
Basics of quantum information
Beginner-friendly state-vector, measurement, multi-system, and circuit explanations.
Beginner layer · why the first column matters
This is the bridge between circuit language and matrix language. Physicists write U|0⟩; Lean can check the same statement one output amplitude at a time.
Textbook / teaching anchor
Beginner-friendly state-vector, measurement, multi-system, and circuit explanations.
Strict mathematics, after the picture
Every symbol used here is connected below to a compiled declaration or a clearly marked research-source formula.
Textbook / teaching anchor
Beginner-friendly state-vector, measurement, multi-system, and circuit explanations.
Learn Lean while learning quantum computing
firstColumnMatches_iff_applyVec_zeroKet
The theorem is deliberately bidirectional: a column proof can become a state-action proof and vice versa.
The full proof-backed declarations for this chapter are shown immediately below.
State preparation · Chapter 4 of 9
Connect the ket equation to a matrix column, package the proof, and reuse exact preparation where an approximate interface is expected.
QuantumBlockEncoding/StatePreparation.leanQuantumBlockEncoding/ConcreteSemantics.leanQuantumBlockEncoding/TextbookStatePreparation.leanTextbook lesson
A certificate is useful because later code can consume one trusted object instead of repeating the matrix calculation.
The zero ket has one nonzero amplitude at index zero. Matrix-vector multiplication therefore discards every column except the first.
Each field has a different failure mode. Keeping them separate prevents a correct first column from hiding a nonunitary completion.
An exact certificate can enter an approximate search unchanged. Positive error needs a declared metric and a new bound.
Explain why matching column zero alone does not prove that a candidate is physically implementable.
Mathematical order and conventions adapted from Lin, Lecture Notes on Quantum Algorithms for Scientific Computation. The formal checkpoints and ASPBE status distinctions are specific to this library.
Route at a glance
flowchart LR T["Target state<br/>|ψ⟩"] --> N["Check normalization<br/>⟨ψ|ψ⟩ = 1"] N --> C["Choose a circuit<br/>or unitary completion"] C --> U["Prove U is unitary"] C --> A["Prove the state action<br/>U|0ⁿ⟩ = |ψ⟩"] U --> L["Lean state-preparation<br/>certificate"] A --> L L --> E["Export one certified<br/>finite instance"] classDef target fill:#ffffff,stroke:#6b6045,color:#222222,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,N target; class C,U,A work; class L,E proof;
Selected declarations
A compiled route means that the reusable theorem or constructor and at least one finite witness compile. Hardware- and problem-specific downstream instantiations are out of scope, not universal claims made by these cards.
Lean result
QuantumBlockEncoding.ConcreteSemantics.firstColumnMatches_iff_applyVec_zeroKet
Matrix action on the all-zero ket selects exactly the first column of the unitary.
There are two common ways to say the same fact: physicists write a ket equation, while the finite Lean model compares indexed amplitudes. This bridge keeps proofs and circuit explanations in the same convention.
Acting on a basis vector selects one matrix column; function extensionality then turns vector equality into entrywise equality.
QuantumBlockEncoding.FirstColumnMatches; QuantumBlockEncoding.ConcreteSemantics.applyVec_zeroKetQuantumBlockEncoding.ConcreteSemantics.ComplexStatePreparationCertificate.ofFirstColumnQuantumBlockEncoding.ConcreteSemantics.ComplexStatePreparationCertificate.verifiedOfFirstColumnQuantumBlockEncoding.ConcreteSemantics.ComplexStatePreparationCertificate.verifiedOfFirstColumn_preparesTarget| Mathematical step | Lean object or step |
|---|---|
| Apply the matrix to the zero basis ket. | applyVec_zeroKet |
| Compare every output amplitude. | funext / congrFun |
theorem firstColumnMatches_iff_applyVec_zeroKet
{α : Type u} [NonAssocSemiring α] {qubits : Nat}
(operator : Matrix (gridSize qubits) (gridSize qubits) α)
(target : StatePreparationTarget α qubits) :
FirstColumnMatches operator target ↔
applyVec operator (zeroKet qubits) = target.amplitudes := by
Local declaration · Verso Blueprint · commit-pinned GitHub source
Lean result
QuantumBlockEncoding.VerifiedStatePreparation.firstColumn
Once the certificate is built, downstream proofs can read its first-column identity directly.
The certificate hides the packaging work but does not weaken the statement. Prepared amplitudes are often the input to later LCU or oracle constructions.
Project the stored preparation proof from the verified record.
QuantumBlockEncoding.VerifiedStatePreparation| Mathematical step | Lean object or step |
|---|---|
| Read the certified state-action field. | verified.preparationProof |
| Expose it through the public theorem. | verified.firstColumn |
theorem firstColumn
(verified : VerifiedStatePreparation α qubits) :
verified.candidate.preparesTarget :=
verified.preparationProof
Local declaration · Verso Blueprint · commit-pinned GitHub source
Lean result
QuantumBlockEncoding.VerifiedStatePreparation.asZeroErrorApprox
An exact certificate is also an approximate certificate with error zero.
The tolerance ladder can reuse exact work instead of changing certificate formats. Exact and approximate searches need one stable consumer boundary.
Reuse normalization, unitarity, and preparation proofs while setting the approximation field to the exact predicate.
QuantumBlockEncoding.VerifiedStatePreparation| Mathematical step | Lean object or step |
|---|---|
| Keep the same candidate and proofs. | verified.candidate / normalizationProof / unitaryProof |
| Set the error to zero. | epsilon := 0 |
def asZeroErrorApprox [OfNat α 0]
(verified : VerifiedStatePreparation α qubits) :
VerifiedApproximateStatePreparation α qubits where
approxCandidate := {
candidate := verified.candidate
epsilon := 0
approximationBound := verified.candidate.preparesTarget
}
normalizationProof := verified.normalizationProof
unitaryProof := verified.unitaryProof
approximationProof := verified.preparationProof
Local declaration · Verso Blueprint · commit-pinned GitHub source