Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The virtual circuit computes the same key and cleans its ancilla

Open
QAlgorithms.Papers.Independent.Intakenext100.P04.virtualCircuit_keyAndCleaning

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

prove2quantum

Let N>0N>0N>0, and let G:F2r→F2NG:\mathbb F_2^r\to\mathbb F_2^NG:F2r​→F2N​ be an injective linear encoder with decoder fff and correctable set E\mathcal EE, meaning f(G(y)+x)=yf(G(y)+x)=yf(G(y)+x)=y for all yyy and all x∈Ex\in\mathcal Ex∈E. Form the actual Z-basis permutation unitaries

U1∣x,y⟩Z=∣x+G(y),y⟩Z,U2∣x,y⟩Z=∣x,y+f(x)⟩Z,U=U2U1.U_1|x,y\rangle_Z=|x+G(y),y\rangle_Z,\qquad U_2|x,y\rangle_Z=|x,y+f(x)\rangle_Z,\qquad U=U_2U_1.U1​∣x,y⟩Z​=∣x+G(y),y⟩Z​,U2​∣x,y⟩Z​=∣x,y+f(x)⟩Z​,U=U2​U1​.

Append ∣0⟩X|0\rangle_X∣0⟩X​ on QQQ. The Heisenberg effect of measuring QQQ in the X basis with output yyy after UUU equals the effect of directly measuring SSS in the X basis and applying GTG^TGT. Consequently the key channel, including its joint law with Eve, is the same. On each correctable basis state,

U(∣x⟩Z⊗∣0⟩X)=2−r/2∑y∣x+G(y)⟩Z⊗∣0⟩Z(x∈E).U(|x\rangle_Z\otimes|0\rangle_X)=2^{-r/2}\sum_y|x+G(y)\rangle_Z\otimes|0\rangle_Z\quad(x\in\mathcal E).U(∣x⟩Z​⊗∣0⟩X​)=2−r/2y∑​∣x+G(y)⟩Z​⊗∣0⟩Z​(x∈E).

For any positive trace-one joint state ρSE\rho_{SE}ρSE​ with arbitrary Eve dimension, put P=PE⊗IEP=P_{\mathcal E}\otimes I_EP=PE​⊗IE​ and q=Tr⁡(PρSE)q=\operatorname{Tr}(P\rho_{SE})q=Tr(PρSE​). The actual ancilla marginal satisfies

⟨0∣ρQ∣0⟩Z≥q.\langle0|\rho_Q|0\rangle_Z\ge q.⟨0∣ρQ​∣0⟩Z​≥q.

If q>0q>0q>0, the constructed normalized projected state ρ′=PρSEP/q\rho'=P\rho_{SE}P/qρ′=PρSE​P/q is positive trace class and its squared fidelity with ρSE\rho_{SE}ρSE​ equals qqq. If q=1q=1q=1, then ρQ=∣0⟩Z⟨0∣\rho_Q=|0\rangle_Z\langle0|ρQ​=∣0⟩Z​⟨0∣ and every Eve measurement has joint key law Pr⁡(Y=y,Z=z)=2−rPr⁡(Z=z)\Pr(Y=y,Z=z)=2^{-r}\Pr(Z=z)Pr(Y=y,Z=z)=2−rPr(Z=z). This is the circuit-level decoupling mechanism; no probability of protocol acceptance is assumed.

Formalization Note Arbitrary joint extensions are represented by a finite matrix factor on a general Hilbert space. Eve measurements lie in its commutant. The equality of effects retains all public registers in Eve's data.

Preamble
import Definitions.Def_QAlgorithms_Papers_Independent_Intakenext100_P04
Formal statement
noncomputable section

universe u v w

namespace QAlgorithms.Papers.Independent.Intakenext100.P04

open QAlgorithms

open QAlgorithms.Papers.Independent.Dependency50.P13
  (State IsTraceClass IsPositive operatorTrace)

open QAlgorithms.Papers.Independent.Advance50.P18 (keyEntropy)

open scoped ComplexConjugate

attribute [local instance] Classical.propDecidable Classical.decEq

variable {H : Type u} [NormedAddCommGroup H] [InnerProductSpace ℂ H] [CompleteSpace H]

/-- Koashi–Preskill PDF pp.3–4, Eqs.(6)–(12): the circuit computes the same
key channel, cleans Q on the correctable support, and transfers the full joint
projected-state fidelity to the actual Q marginal. Printed Eq.(10) labels the
residual state inconsistently with Eq.(9); changed to the directly constructed
key effects, because U2 preserves Q's X label G-transpose(kappa_sif).
The normalization in Eq.(11) is (1/sqrt(2))^r, not an unspecified scalar. -/
theorem virtualCircuit_keyAndCleaning {N r : ℕ} (hN : 0 < N)
    (C : CorrectableEncoder N r) {I : Type v} (b : HilbertBasis I ℂ H)
    (rho : State b) (A : QubitFactor N H) :
    virtualCircuit C ∈ Matrix.unitaryGroup (Qubits N × Qubits r) ℂ ∧
    (∀ y, virtualKeyEffect C y = directKeyEffect C y) ∧
    (∀ x, x ∈ C.errors →
      act (virtualCircuit C) (tensorVec (ket x) (xBasisVector r 0)) =
        tensorVec
          ((((Real.sqrt 2)⁻¹ ^ r : ℝ) : ℂ) •
            ∑ y : Qubits r, ket (x + C.encoder y)) (ket (0 : Qubits r))) ∧
    (let sigma := qubitMarginal b rho A
     let P := A (correctableProjector C)
     let q := (operatorTrace b (P.comp rho.val.val)).re
     q ≤ (virtualOutput C sigma 0 0).re ∧
     (0 < q →
       IsTraceClass (projectedJointState b rho P) ∧
       IsPositive (projectedJointState b rho P) ∧
       operatorTrace b (projectedJointState b rho P) = 1 ∧
       squaredHilbertFidelity b (projectedJointState b rho P) rho.val.val = q) ∧
     (q = 1 → virtualOutput C sigma = zProjector r 0 ∧
       ∀ (n : ℕ) (M : EveMeasurement A n) (y : Qubits r) (z : Fin n),
         (operatorTrace b ((A (directKeyEffect C y)).comp
           ((M.effect z).comp rho.val.val))).re =
         ((2 : ℝ) ^ r)⁻¹ * (operatorTrace b ((M.effect z).comp rho.val.val)).re)) := by sorry

end QAlgorithms.Papers.Independent.Intakenext100.P04

end
Source
Secure quantum key distribution with an uncharacterized source, arXiv:quant-ph/0208155v2, PDF p. 3, Eqs. (2), (6)–(12), PDF pp.2–4
Read-back

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

For every pair of natural numbers N,rN,rN,r with N>0N>0N>0, let CCC provide an injective binary linear encoder e:{0,1}r→{0,1}Ne:\{0,1\}^r\to\{0,1\}^Ne:{0,1}r→{0,1}N, a decoder d:{0,1}N→{0,1}rd:\{0,1\}^N\to\{0,1\}^rd:{0,1}N→{0,1}r, and an error set E\mathcal EE such that d(e(y)+x)=yd(e(y)+x)=yd(e(y)+x)=y whenever x∈Ex\in\mathcal Ex∈E. Let HHH be any complete complex inner-product space, b=(bi)i∈Ib=(b_i)_{i\in I}b=(bi​)i∈I​ any Hilbert basis, and τb(T)=∑i′⟨bi,Tbi⟩\tau_b(T)=\sum'_i\langle b_i,Tb_i\rangleτb​(T)=∑i′​⟨bi​,Tbi​⟩. Let ρ\rhoρ admit a representation ρx=∑j′⟨vj,x⟩uj\rho x=\sum'_j\langle v_j,x\rangle u_jρx=∑j′​⟨vj​,x⟩uj​ with ∑j∥uj∥∥vj∥<∞\sum_j\|u_j\|\|v_j\|<\infty∑j​∥uj​∥∥vj​∥<∞, and satisfy ρ†=ρ\rho^\dagger=\rhoρ†=ρ, Re⁡⟨x,ρx⟩≥0\operatorname{Re}\langle x,\rho x\rangle\ge0Re⟨x,ρx⟩≥0, and τb(ρ)=1\tau_b(\rho)=1τb​(ρ)=1. Let AAA be a unital complex algebra homomorphism from NNN-qubit matrices to bounded operators on HHH that preserves adjoints. All binary additions below are XOR. Set hy(s)(z)=2−s/2(−1)∑iyizih_y^{(s)}(z)=2^{-s/2}(-1)^{\sum_i y_i z_i}hy(s)​(z)=2−s/2(−1)∑i​yi​zi​, define U1∣x,y⟩=∣x+e(y),y⟩U_1|x,y\rangle=|x+e(y),y\rangleU1​∣x,y⟩=∣x+e(y),y⟩, U2∣x,y⟩=∣x,y+d(x)⟩U_2|x,y\rangle=|x,y+d(x)\rangleU2​∣x,y⟩=∣x,y+d(x)⟩, U=U2U1U=U_2U_1U=U2​U1​, and Wv=U(v⊗h0(r))Wv=U(v\otimes h_0^{(r)})Wv=U(v⊗h0(r)​). Define (eTx)i=∑jxje(ei)j(mod2)(e^{\mathsf T}x)_i=\sum_jx_je(\mathbf e_i)_j\pmod2(eTx)i​=∑j​xj​e(ei​)j​(mod2), Dy=∑x:eTx=yhx(N)(hx(N))†D_y=\sum_{x:e^{\mathsf T}x=y}h_x^{(N)}(h_x^{(N)})^\daggerDy​=∑x:eTx=y​hx(N)​(hx(N)​)†, σi,j=τb(A(Ej,i)ρ)\sigma_{i,j}=\tau_b(A(E_{j,i})\rho)σi,j​=τb​(A(Ej,i​)ρ), BE=diag⁡(1E)B_{\mathcal E}=\operatorname{diag}(\mathbf1_{\mathcal E})BE​=diag(1E​), P=A(BE)P=A(B_{\mathcal E})P=A(BE​), q=Re⁡τb(Pρ)q=\operatorname{Re}\tau_b(P\rho)q=Reτb​(Pρ), and VC(σ)=Tr⁡N[U(σ⊗h0(r)(h0(r))†)U†]V_C(\sigma)=\operatorname{Tr}_{N}[U(\sigma\otimes h_0^{(r)}(h_0^{(r)})^\dagger)U^\dagger]VC​(σ)=TrN​[U(σ⊗h0(r)​(h0(r)​)†)U†], where Ej,iE_{j,i}Ej,i​ is the matrix unit and (Tr⁡NX)a,b=∑sX(s,a),(s,b)(\operatorname{Tr}_N X)_{a,b}=\sum_sX_{(s,a),(s,b)}(TrN​X)a,b​=∑s​X(s,a),(s,b)​. The assertion is that UUU is unitary, that

W†(I⊗hy(r)(hy(r))†)W=Dyfor every y,W^\dagger\bigl(I\otimes h_y^{(r)}(h_y^{(r)})^\dagger\bigr)W=D_y \quad\text{for every }y,W†(I⊗hy(r)​(hy(r)​)†)W=Dy​for every y,

and that, for every x∈Ex\in\mathcal Ex∈E,

U(∣x⟩⊗h0(r))=(2−r/2∑y∈{0,1}r∣x+e(y)⟩)⊗∣0⟩.U(|x\rangle\otimes h_0^{(r)}) = \left(2^{-r/2}\sum_{y\in\{0,1\}^r}|x+e(y)\rangle\right)\otimes|0\rangle.U(∣x⟩⊗h0(r)​)=​2−r/2y∈{0,1}r∑​∣x+e(y)⟩​⊗∣0⟩.

It also asserts q≤Re⁡VC(σ)0,0q\le\operatorname{Re}V_C(\sigma)_{0,0}q≤ReVC​(σ)0,0​; if q>0q>0q>0, then R=q−1PρPR=q^{-1}P\rho PR=q−1PρP has a representation of the same summable rank-one form, is self-adjoint with nonnegative quadratic form, satisfies τb(R)=1\tau_b(R)=1τb​(R)=1, and obeys

[Re⁡τb ⁣(R ρ R)]2=q,\left[\operatorname{Re}\tau_b\!\left(\sqrt{\sqrt R\,\rho\,\sqrt R}\right)\right]^2=q,[Reτb​(R​ρR​​)]2=q,

with square roots taken by continuous functional calculus. Finally, if q=1q=1q=1, then VC(σ)=∣0⟩⟨0∣V_C(\sigma)=|0\rangle\langle0|VC​(σ)=∣0⟩⟨0∣, and for every natural number nnn, every family of positive bounded operators MzM_zMz​, z∈Fin⁡(n)z\in\operatorname{Fin}(n)z∈Fin(n), satisfying ∑zMz=I\sum_zM_z=I∑z​Mz​=I and MzA(B)=A(B)MzM_zA(B)=A(B)M_zMz​A(B)=A(B)Mz​ for every NNN-qubit matrix BBB, and every rrr-bit string yyy and z∈Fin⁡(n)z\in\operatorname{Fin}(n)z∈Fin(n),

Re⁡τb(A(Dy)Mzρ)=2−rRe⁡τb(Mzρ).\operatorname{Re}\tau_b(A(D_y)M_z\rho) =2^{-r}\operatorname{Re}\tau_b(M_z\rho).Reτb​(A(Dy​)Mz​ρ)=2−rReτb​(Mz​ρ).

Here r=0r=0r=0 is allowed, the zero label means the all-false string, and membership in an empty error set makes the corresponding conditional assertions vacuous.

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

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Oct 31, 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