Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

§2.4: Hermitian PREP/UNPREP construction (38)

Open
QAlgorithms.Papers.Independent.Extend50.P44.hermitianPrepConstruction

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

prove2quantum

Use the symmetric commuting-data layout of (31), with an involutive transpose oracle preserving the data and range predicates. Let p=1/2p=1/2p=1/2, with nonzero active real data and zero padding. Write FFF for the full initial preparation on the physical sparsity register: PREP on the column data factor together with its residual preparation. Write GGG for the full final unpreparation: UNPREP on the row data factor together with the adjoint residual preparation. Require the full operator identity (38), including the actual residual-register embeddings:

F=ScG∗,F=S_c G^*,F=Sc​G∗,

where ScS_cSc​ is the sign oracle on the column data factor, tensored with residual identity, and ∗*∗ means adjoint. The sign oracle uses +1 on zero slots. Then circuit (31) is unitary and Hermitian, and its selected block is A/α1/2A/α_{1/2}A/α1/2​ with the normalization (32). It has two preparation loads and s+1s+1s+1 flags. Matching only the data-register matrices, their prepared states, or the residual diagonal blocks does not imply this full-unitary conclusion.

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 p.12, (38): matching full physical preparation operators at p=1/2
give Hermiticity of the entire circuit, retaining PREP resources. The identity
includes the residual-register preparations and their actual tensor embeddings;
matching only the data matrices or the residual diagonal blocks is insufficient. -/
theorem hermitianPrepConstruction (B : Scheme n s d m) (T : TransposeOracle B)
    (L : PrepLayout B) (a : Fin (2 ^ d) → ℝ)
    (hnz : ∀ j ∈ L.active, a j ≠ 0)
    (hzero : ∀ j, j ∉ L.active → a j = 0)
    (P : PreparationPair L a (1 / 2))
    (hmatching : tensorPreparation L.factorColumn P.prep L.Hcolumn =
      tensorPreparation L.factorColumn (signOracle a)
        (1 : Matrix (Fin (2 ^ L.kc)) (Fin (2 ^ L.kc)) ℂ) *
      (tensorPreparation L.factorRow P.unprep L.Hrowᴴ)ᴴ) :
    QAlgorithms.IsBlockEncoding (false, 0) (L.circuit P) (L.alpha a (1 / 2)) 0 (B.matrix a) ∧
    (L.circuit P)ᴴ = L.circuit P ∧
    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. 12, §2.4: Hermitian PREP/UNPREP construction (38)
Read-back

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

For all natural numbers n,s,d,mn,s,d,mn,s,d,m, including zero, put D={0,…,2d−1}D=\{0,\ldots,2^d-1\}D={0,…,2d−1}, M={0,…,2m−1}M=\{0,\ldots,2^m-1\}M={0,…,2m−1}, S={0,…,2s−1}S=\{0,\ldots,2^s-1\}S={0,…,2s−1}, and N={0,…,2n−1}N=\{0,\ldots,2^n-1\}N={0,…,2n−1}. Let BBB consist of the equality d+m=s+nd+m=s+nd+m=s+n, bijections c,r:D×M→S×Nc,r:D\times M\to S\times Nc,r:D×M→S×N, a Boolean function v:D×M→{false,true}v:D\times M\to\{\mathrm{false},\mathrm{true}\}v:D×M→{false,true}, nonempty subsets C,R⊆SC,R\subseteq SC,R⊆S, and unitary complex matrices Hc,HrH_c,H_rHc​,Hr​ indexed by SSS. Assume that whenever v(ℓ)=truev(\ell)=\mathrm{true}v(ℓ)=true, the first coordinates of c(ℓ)c(\ell)c(ℓ) and r(ℓ)r(\ell)r(ℓ) belong to CCC and RRR, respectively; that two valid labels with the same second column coordinate and the same second row coordinate are equal; and that

Hc(t,0)={∣C∣−1/2t∈C,0t∉C,Hr(t,0)={∣R∣−1/2t∈R,0t∉R.H_c(t,0)= \begin{cases}|C|^{-1/2}&t\in C,\\0&t\notin C,\end{cases} \qquad H_r(t,0)= \begin{cases}|R|^{-1/2}&t\in R,\\0&t\notin R.\end{cases}Hc​(t,0)={∣C∣−1/20​t∈C,t∈/C,​Hr​(t,0)={∣R∣−1/20​t∈R,t∈/R.​

Let TTT supply a permutation τ\tauτ of D×MD\times MD×M satisfying τ2=id\tau^2=\mathrm{id}τ2=id, (τℓ)1=ℓ1(\tau\ell)_1=\ell_1(τℓ)1​=ℓ1​, v(τℓ)=v(ℓ)v(\tau\ell)=v(\ell)v(τℓ)=v(ℓ), r(ℓ)=c(τℓ)r(\ell)=c(\tau\ell)r(ℓ)=c(τℓ), and Hr=HcH_r=H_cHr​=Hc​. Let LLL supply a nonempty subset A⊆DA\subseteq DA⊆D, natural numbers kc,krk_c,k_rkc​,kr​, bijections fc:S→D×{0,…,2kc−1}f_c:S\to D\times\{0,\ldots,2^{k_c}-1\}fc​:S→D×{0,…,2kc​−1} and fr:S→D×{0,…,2kr−1}f_r:S\to D\times\{0,\ldots,2^{k_r}-1\}fr​:S→D×{0,…,2kr​−1}, both taking 000 to (0,0)(0,0)(0,0), and nonempty residual subsets C0,R0C_0,R_0C0​,R0​ of their respective second-coordinate sets. Require

t∈C  ⟺  (fc(t))1∈A and (fc(t))2∈C0,t∈R  ⟺  (fr(t))1∈A and (fr(t))2∈R0,t\in C\iff (f_c(t))_1\in A\ \text{and}\ (f_c(t))_2\in C_0,\qquad t\in R\iff (f_r(t))_1\in A\ \text{and}\ (f_r(t))_2\in R_0,t∈C⟺(fc​(t))1​∈A and (fc​(t))2​∈C0​,t∈R⟺(fr​(t))1​∈A and (fr​(t))2​∈R0​,

and, for every label ℓ\ellℓ, require (fc(c(ℓ)1))1=(fr(r(ℓ)1))1=ℓ1(f_c(c(\ell)_1))_1=(f_r(r(\ell)_1))_1=\ell_1(fc​(c(ℓ)1​))1​=(fr​(r(ℓ)1​))1​=ℓ1​. Also let LLL supply unitary matrices Jc,JrJ_c,J_rJc​,Jr​ on the respective residual index sets whose zeroth columns equal ∣C0∣−1/2|C_0|^{-1/2}∣C0​∣−1/2 on C0C_0C0​ and zero elsewhere, and ∣R0∣−1/2|R_0|^{-1/2}∣R0​∣−1/2 on R0R_0R0​ and zero elsewhere. Let a:D→Ra:D\to\mathbb Ra:D→R satisfy aj≠0a_j\ne0aj​=0 for every j∈Aj\in Aj∈A and aj=0a_j=0aj​=0 for every j∉Aj\notin Aj∈/A. Write Z=∑j∈A∣aj∣>0Z=\sum_{j\in A}|a_j|>0Z=∑j∈A​∣aj​∣>0. Let PPP consist of unitary matrices Pprep,PunprepP_{\mathrm{prep}},P_{\mathrm{unprep}}Pprep​,Punprep​ indexed by DDD satisfying

Pprep(j,0)={sign⁡(aj)∣aj∣/Zj∈A,0j∉A,Punprep(0,j)={∣aj∣/Zj∈A,0j∉A.P_{\mathrm{prep}}(j,0)= \begin{cases}\operatorname{sign}(a_j)\sqrt{|a_j|}/\sqrt Z&j\in A,\\0&j\notin A,\end{cases} \quad P_{\mathrm{unprep}}(0,j)= \begin{cases}\sqrt{|a_j|}/\sqrt Z&j\in A,\\0&j\notin A.\end{cases}Pprep​(j,0)={sign(aj​)∣aj​∣​/Z​0​j∈A,j∈/A,​Punprep​(0,j)={∣aj​∣​/Z​0​j∈A,j∈/A.​

Here these formulas expand the stipulated preparation pair at parameter 1/21/21/2; its supported power is zero at a zero argument and otherwise is the indicated real power of its absolute value. Define

Tf(Q,H)x,y=Q(f(x))1,(f(y))1H(f(x))2,(f(y))2,Sa=diag⁡(j↦{−1aj<0,1aj≥0.).\mathcal T_f(Q,H)_{x,y} =Q_{(f(x))_1,(f(y))_1}H_{(f(x))_2,(f(y))_2}, \qquad S_a=\operatorname{diag}\bigl(j\mapsto \begin{cases}-1&a_j<0,\\1&a_j\ge0.\end{cases}\bigr).Tf​(Q,H)x,y​=Q(f(x))1​,(f(y))1​​H(f(x))2​,(f(y))2​​,Sa​=diag(j↦{−11​aj​<0,aj​≥0.​).

Assume additionally the exact matrix identity

Tfc(Pprep,Jc)=Tfc(Sa,I) Tfr(Punprep,Jr†)†.\mathcal T_{f_c}(P_{\mathrm{prep}},J_c) = \mathcal T_{f_c}(S_a,I)\, \mathcal T_{f_r}(P_{\mathrm{unprep}},J_r^\dagger)^\dagger.Tfc​​(Pprep​,Jc​)=Tfc​​(Sa​,I)Tfr​​(Punprep​,Jr†​)†.

For a matrix HHH on SSS, define its extension by D(H)(b,t,i),(b′,t′,i′)=Ht,t′\mathcal D(H)_{(b,t,i),(b',t',i')}=H_{t,t'}D(H)(b,t,i),(b′,t′,i′)​=Ht,t′​ when b=b′b=b'b=b′ and i=i′i=i'i=i′, and zero otherwise. For e=c,re=c,re=c,r, let WeW_eWe​ have entry 111 from (b,ℓ)(b,\ell)(b,ℓ) to (b,e(ℓ))(b,e(\ell))(b,e(ℓ)), and zero elsewhere. Let GGG have entry 111 from (b,ℓ)(b,\ell)(b,ℓ) to (b,ℓ)(b,\ell)(b,ℓ) if v(ℓ)v(\ell)v(ℓ) is true and to (¬b,ℓ)(\neg b,\ell)(¬b,ℓ) otherwise, and zero elsewhere. Form, with indices regrouped as ((b,t),i)((b,t),i)((b,t),i),

U=D ⁣(Tfr(Punprep,Jr†))WrGWc†D ⁣(Tfc(Pprep,Jc)),Ki,j=∑ℓ∈D×Mv(ℓ)=true, r(ℓ)2=i, c(ℓ)2=jaℓ1,α=∣C∣∣R∣∣A∣Z.U=\mathcal D\!\left(\mathcal T_{f_r}(P_{\mathrm{unprep}},J_r^\dagger)\right) W_rG W_c^\dagger \mathcal D\!\left(\mathcal T_{f_c}(P_{\mathrm{prep}},J_c)\right), \qquad K_{i,j}=\sum_{\substack{\ell\in D\times M\\ v(\ell)=\mathrm{true},\ r(\ell)_2=i,\ c(\ell)_2=j}}a_{\ell_1}, \qquad \alpha=\frac{\sqrt{|C||R|}}{|A|}Z.U=D(Tfr​​(Punprep​,Jr†​))Wr​GWc†​D(Tfc​​(Pprep​,Jc​)),Ki,j​=ℓ∈D×Mv(ℓ)=true, r(ℓ)2​=i, c(ℓ)2​=j​∑​aℓ1​​,α=∣A∣∣C∣∣R∣​​Z.

Then UUU is unitary and its block with both ancillary indices fixed to (false,0)(\mathrm{false},0)(false,0) satisfies the exact error bound

∥α(U((false,0),i),((false,0),j))i,j∈N−K∥op≤0.\left\|\alpha\bigl(U_{((\mathrm{false},0),i),((\mathrm{false},0),j)}\bigr)_{i,j\in N}-K\right\|_{\mathrm{op}}\le0.​α(U((false,0),i),((false,0),j)​)i,j∈N​−K​op​≤0.

Moreover U†=UU^\dagger=UU†=U, the loading cost—defined as the sum of a schedule—of the two-entry schedule [∣A∣,∣A∣][|A|,|A|][∣A∣,∣A∣] is 2∣A∣2|A|2∣A∣, and the ancillary index set {false,true}×S\{\mathrm{false},\mathrm{true}\}\times S{false,true}×S has cardinality 2s+12^{s+1}2s+1.

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