Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§2.3: PREP/UNPREP block encoding (28)–(32)

Open
QAlgorithms.Papers.Independent.Extend50.P44.prepConstruction

by Gohan · Oct 29, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

Fix a padded row/column scheme whose full arithmetic maps preserve the data label. Assume the physical sparsity register factors compatibly into a data register and a residual register on each side, with supports of cardinalities Sc=DRcS_c=D R_cSc​=DRc​ and Sr=DRrS_r=D R_rSr​=DRr​. The D>0D>0D>0 active real values aja_jaj​ are nonzero and all other table slots are fixed zero. For p∈[0,1]p\in[0,1]p∈[0,1], normalized PREP and UNPREP completions with amplitudes (29)-(30) exist. Circuit (31) is unitary and block encodes AAA with

αp=ScSrD(∑j∣aj∣2p)(∑j∣aj∣2−2p).\alpha_p=\frac{\sqrt{S_cS_r}}{D}\sqrt{\left(\sum_j|a_j|^{2p}\right)\left(\sum_j|a_j|^{2-2p}\right)}.αp​=DSc​Sr​​​(j∑​∣aj​∣2p)(j∑​∣aj​∣2−2p)​.

It loads 2D2D2D items and uses one deletion flag plus the physical preparation/sparsity bit width. This is the complete normalization from (32), including its prefactor.

Preamble
import Definitions.Def_QAlgorithms_Papers_Independent_Extend50_P44
Formal statement
noncomputable section

namespace QAlgorithms.Papers.Independent.Extend50.P44

open scoped BigOperators ComplexConjugate Matrix

open QAlgorithms.Papers.Independent.Frontier18.P11 (complexMatrix)

open QAlgorithms.Papers.Independent.Information100.P34 (permutationMatrix)

open QAlgorithms.Papers.Independent.Next46.P21 (tCount)

variable {n s d m : ℕ}

/-- PDF pp.10-11, (28)-(32): exact PREP/UNPREP construction for compatible
register factors and commuting arithmetic oracles; two independent preparations
load 2D items. No repeated amplification is included. -/
theorem prepConstruction (B : Scheme n s d m) (L : PrepLayout B)
    (a : Fin (2 ^ d) → ℝ) (p : ℝ) (hp : 0 ≤ p ∧ p ≤ 1)
    (hnz : ∀ j ∈ L.active, a j ≠ 0)
    (hzero : ∀ j, j ∉ L.active → a j = 0) :
    ∃ P : PreparationPair L a p, QAlgorithms.IsBlockEncoding (false, 0) (L.circuit P) (L.alpha a p) 0 (B.matrix a) ∧
    loadingCost (doubleLoadingSchedule L.active.card) = 2 * L.active.card ∧
    Fintype.card (Bool × Fin (2 ^ s)) = 2 ^ (s + 1) := by sorry

end QAlgorithms.Papers.Independent.Extend50.P44

end
Source
Block-encoding structured matrices for data input in quantum computing, arXiv:2302.10949v2, PDF p. 10, §2.3: PREP/UNPREP block encoding (28)–(32)
Read-back

What the Lean code literally says, in plain math · gpt-6.1-sol

Let n,s,d,mn,s,d,mn,s,d,m be natural numbers and [r]={0,…,r−1}[r]=\{0,\ldots,r-1\}[r]={0,…,r−1}. Let BBB consist of d+m=s+nd+m=s+nd+m=s+n, bijections C,R:[2d]×[2m]→[2s]×[2n]C,R:[2^d]\times[2^m]\to[2^s]\times[2^n]C,R:[2d]×[2m]→[2s]×[2n], Boolean validity data vvv, nonempty sets Jc,Jr⊆[2s]J_c,J_r\subseteq[2^s]Jc​,Jr​⊆[2s], and unitary matrices Hc,HrH_c,H_rHc​,Hr​ with zeroth columns uniform on the respective slot sets and zero elsewhere; valid labels map into those sets, and two valid labels with equal C(ℓ)2C(\ell)_2C(ℓ)2​ and equal R(ℓ)2R(\ell)_2R(ℓ)2​ are equal. Let LLL consist of a nonempty active set S⊆[2d]S\subseteq[2^d]S⊆[2d], natural numbers kc,krk_c,k_rkc​,kr​, zero-preserving bijections fc:[2s]→[2d]×[2kc]f_c:[2^s]\to[2^d]\times[2^{k_c}]fc​:[2s]→[2d]×[2kc​], fr:[2s]→[2d]×[2kr]f_r:[2^s]\to[2^d]\times[2^{k_r}]fr​:[2s]→[2d]×[2kr​], nonempty residual sets Tc,TrT_c,T_rTc​,Tr​, and unitary matrices Kc,KrK_c,K_rKc​,Kr​ whose zeroth columns are uniform on those sets and zero elsewhere, satisfying Jc=fc−1(S×Tc)J_c=f_c^{-1}(S\times T_c)Jc​=fc−1​(S×Tc​), Jr=fr−1(S×Tr)J_r=f_r^{-1}(S\times T_r)Jr​=fr−1​(S×Tr​), and fc(C(ℓ)1)1=fr(R(ℓ)1)1=ℓ1f_c(C(\ell)_1)_1=f_r(R(\ell)_1)_1=\ell_1fc​(C(ℓ)1​)1​=fr​(R(ℓ)1​)1​=ℓ1​ for every label. For every real table a:[2d]→Ra:[2^d]\to\mathbb Ra:[2d]→R and p∈[0,1]p\in[0,1]p∈[0,1], assume aj≠0a_j\ne0aj​=0 for every j∈Sj\in Sj∈S and aj=0a_j=0aj​=0 for every j∉Sj\notin Sj∈/S. Put rt(0)=0r_t(0)=0rt​(0)=0, rt(x)=∣x∣tr_t(x)=|x|^trt​(x)=∣x∣t for x≠0x\ne0x=0, and

Ai,j=∑ℓ∈[2d]×[2m]1{v(ℓ)=true, R(ℓ)2=i, C(ℓ)2=j} aℓ1,α=∣Jc∣∣Jr∣∣S∣(∑j∈Sr2p(aj))(∑j∈Sr2−2p(aj)).\begin{aligned} A_{i,j}&=\sum_{\ell\in[2^d]\times[2^m]} \mathbf1_{\{v(\ell)=\mathrm{true},\,R(\ell)_2=i,\,C(\ell)_2=j\}}\,a_{\ell_1},\\ \alpha&=\frac{\sqrt{|J_c||J_r|}}{|S|} \sqrt{\left(\sum_{j\in S}r_{2p}(a_j)\right) \left(\sum_{j\in S}r_{2-2p}(a_j)\right)}. \end{aligned}Ai,j​α​=ℓ∈[2d]×[2m]∑​1{v(ℓ)=true,R(ℓ)2​=i,C(ℓ)2​=j}​aℓ1​​,=∣S∣∣Jc​∣∣Jr​∣​​​j∈S∑​r2p​(aj​)​​j∈S∑​r2−2p​(aj​)​​.​

Then there exist unitary matrices P,QP,QP,Q on [2d][2^d][2d] whose zeroth column and zeroth row are, on SSS,

Pj,0=sign⁡(aj)rp(aj)∑h∈Sr2p(ah),Q0,j=r1−p(aj)∑h∈Sr2−2p(ah),P_{j,0}=\frac{\operatorname{sign}(a_j)r_p(a_j)} {\sqrt{\sum_{h\in S}r_{2p}(a_h)}}, \qquad Q_{0,j}=\frac{r_{1-p}(a_j)} {\sqrt{\sum_{h\in S}r_{2-2p}(a_h)}},Pj,0​=∑h∈S​r2p​(ah​)​sign(aj​)rp​(aj​)​,Q0,j​=∑h∈S​r2−2p​(ah​)​r1−p​(aj​)​,

and zero outside SSS, with the following properties. Define Tf(X,H)t,u=Xf(t)1,f(u)1Hf(t)2,f(u)2T_f(X,H)_{t,u}=X_{f(t)_1,f(u)_1}H_{f(t)_2,f(u)_2}Tf​(X,H)t,u​=Xf(t)1​,f(u)1​​Hf(t)2​,f(u)2​​, let D(H)D(H)D(H) act as HHH on the slot index and as the identity on the Boolean flag and system index, let WC,WRW_C,W_RWC​,WR​ be the flag-preserving permutation matrices for C,RC,RC,R, and let GGG preserve the label and flip the flag exactly when that label is invalid. Reassociate the flag, slot, and system indices of

C=D ⁣(Tfr(Q,Kr†))WRGWC†D ⁣(Tfc(P,Kc))\mathcal C= D\!\left(T_{f_r}(Q,K_r^\dagger)\right) W_R G W_C^\dagger D\!\left(T_{f_c}(P,K_c)\right)C=D(Tfr​​(Q,Kr†​))WR​GWC†​D(Tfc​​(P,Kc​))

so that the ancillary index is (b,t)∈{false,true}×[2s](b,t)\in\{\mathrm{false},\mathrm{true}\}\times[2^s](b,t)∈{false,true}×[2s]. This matrix is unitary and

∥α(C((false,0),i),((false,0),j))i,j−A∥op≤0.\left\|\alpha\bigl(\mathcal C_{((\mathrm{false},0),i),((\mathrm{false},0),j)}\bigr)_{i,j}-A\right\|_{\mathrm{op}}\le0.​α(C((false,0),i),((false,0),j)​)i,j​−A​op​≤0.

Moreover, the sum of the two-entry loading list [∣S∣,∣S∣][|S|,|S|][∣S∣,∣S∣] equals 2∣S∣2|S|2∣S∣, and the ancillary index set has cardinality 2s+12^{s+1}2s+1. The endpoints p=0,1p=0,1p=0,1 and zero values of the natural-number parameters are included; the nonempty active set and its nonzero entries ensure that both displayed normalization denominators are positive.

Human review
  • Endorsed by Shuze Chen · Oct 30, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 30, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me