Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Appendix D: binary encoding uses exponentially fewer address qubits

Open
QAlgorithms.Papers.Independent.Intakethird100.P67.binary_reencoding

by Gohan · Nov 1, 2026 · Mathlib 0df444a (Lean v4.33.1)

prove2quantum

Fix a normalized pure sample family, anchor, history of length TTT, and qqq with 2q≥T+12^q\ge T+12q≥T+1. Initialize the binary address at zero. The Appendix-D product of coherent anchor tests with cyclic increments and address-selective reflections is exactly the unary erasure state with each unary ∣t⟩|t\rangle∣t⟩ replaced by binary ∣t⟩|t\rangle∣t⟩:

Vbinary(∣ψ⟩∣0⟩)=Encode⁡q,T ⁣[∣ϕa⟩∑t<T⟨ϕa∣ψt⟩∣t⟩+∣ψT⟩∣T⟩],⌈log⁡2(T+1)⌉≤q.V_{\rm binary}(|\psi\rangle|0\rangle)=\operatorname{Encode}_{q,T}\!\left[|\phi_a\rangle\sum_{t<T}\langle\phi_a|\psi_t\rangle|t\rangle+|\psi_T\rangle|T\rangle\right],\qquad\lceil\log_2(T+1)\rceil\le q.Vbinary​(∣ψ⟩∣0⟩)=Encodeq,T​[∣ϕa​⟩t<T∑​⟨ϕa​∣ψt​⟩∣t⟩+∣ψT​⟩∣T⟩],⌈log2​(T+1)⌉≤q.

The ideal main-system output is therefore unchanged. There are absolute constants and a sample-only circuit family, fixed before unknown samples, UUU and the new input, using (4T+1)m+1(4T+1)m+1(4T+1)m+1 supplied copies and at most C(4T+1)mn(q+1)C(4T+1)mn(q+1)C(4T+1)mn(q+1) elementary gates on nnn-qubit systems. Its averaged distance from the same ideal emulator is at most c(4T+1)/mc(4T+1)/mc(4T+1)/m. Apart from supplied-copy registers and the main register, at most q+3q+3q+3 helper/address/measurement wires suffice. Thus the reflection sample/error bounds are preserved while the gate overhead is O(q+1)O(q+1)O(q+1). The constant helper wires are excluded from the advertised address count.

Preamble
import Definitions.Def_QAlgorithms_Papers_Independent_Intakethird100_P67
Formal statement
noncomputable section

open scoped ComplexConjugate Matrix Matrix.Norms.L2Operator

attribute [local instance] Classical.propDecidable

open MeasureTheory Filter

namespace QAlgorithms.Papers.Independent.Intakethird100.P67

variable {I J K L A : Type*} [Fintype I] [DecidableEq I]
  [Fintype J] [DecidableEq J] [Fintype K] [DecidableEq K]
  [Fintype L] [DecidableEq L] [Fintype A] [DecidableEq A]

/-- PDF pp.22–23, Appendix D: exact binary/unary erasure equality, same ideal
main output, and source sample/gate costs for its sample-copy implementation. The q address
qubits exclude the constant helper/measurement qubits. D8's initial |t> is replaced by |0>;
D9's tensor grouping and |0> helper are corrected to Fig.6's returned |minus>.
Using q+1 (equivalently log(T+1) away from T=0) handles the small-T boundary. -/
theorem binary_reencoding :
    (∀ (phi : K → EuclideanSpace ℂ I) (a : K), (∀ k, IsState (phi k)) →
      ∀ (q T : ℕ), T+1 ≤ 2^q → ∀ (h : Fin T → K) (psi : EuclideanSpace ℂ I), IsState psi →
        act (binaryHistory phi a q h) (tensorVec psi (ket (0 : Fin (2^q)))) =
          encodeUnary q T (coordinateExpansion phi a h psi) ∧
        Nat.clog 2 (T+1) ≤ q) ∧
    (∃ (C c : ℝ) (B : BinaryEmulatorFamily), 0 < C ∧ 0 < c ∧
      ∀ (n k : ℕ), 2 ≤ k → ∀ (a : Fin k) (q T m : ℕ),
        T+1 ≤ 2^q → 1 ≤ m →
        (∀ h : Fin T → Fin k,
          (B n k a q T m h).copies = (4*T+1)*m+1 ∧
          (B n k a q T m h).N ≤ ((4*T+1)*m+2)*n + q+3 ∧
          ((B n k a q T m h).gates.length : ℝ) ≤ C * (4*T+1) * m * n * (q+1)) ∧
        ∀ (phi : Fin k → EuclideanSpace ℂ (Qubits n)), (∀ j, IsState (phi j)) →
          ∀ (U : Matrix.unitaryGroup (Qubits n) ℂ) (rho : Matrix (Qubits n) (Qubits n) ℂ), IsDensityMatrix rho →
          traceDistance
            (∑ h : Fin T → Fin k, (historyWeight (nonanchorProbability a) h : ℂ) •
              (B n k a q T m h).output (inputOutputRecords phi (U : Matrix (Qubits n) (Qubits n) ℂ)) rho)
            (emulate phi a (U : Matrix (Qubits n) (Qubits n) ℂ) T rho) ≤ c * (4*T+1) / m) := by sorry

end QAlgorithms.Papers.Independent.Intakethird100.P67

end
Source
Universal Quantum Emulator, arXiv:1606.02734v2, PDF p. 22, Appendix D: binary encoding uses exponentially fewer address qubits
Read-back

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

Let I,KI,KI,K be finite index types with decidable equality. The declaration asserts a conjunction of two claims. First, for every family of norm-one vectors ϕk∈CI\phi_k\in\mathbb C^Iϕk​∈CI, every a∈Ka\in Ka∈K, every natural q,Tq,Tq,T satisfying T+1≤2qT+1\le2^qT+1≤2q, every history h:{0,…,T−1}→Kh:\{0,\ldots,T-1\}\to Kh:{0,…,T−1}→K, and every norm-one ψ∈CI\psi\in\mathbb C^Iψ∈CI, define Ek=ϕkϕk†E_k=\phi_k\phi_k^\daggerEk​=ϕk​ϕk†​, Rk=1−2EkR_k=1-2E_kRk​=1−2Ek​, r0=ψr_0=\psir0​=ψ, and rt+1=Rh(t)(1−Ea)rtr_{t+1}=R_{h(t)}(1-E_a)r_trt+1​=Rh(t)​(1−Ea​)rt​. Let ut∈{0,1}Tu_t\in\{0,1\}^Tut​∈{0,1}T have bit jjj true exactly when j<tj<tj<t, and set

v=∑t=0T−1⟨ϕa,rt⟩ ϕa⊗∣ut⟩+rT⊗∣uT⟩.v=\sum_{t=0}^{T-1}\langle\phi_a,r_t\rangle\,\phi_a\otimes|u_t\rangle +r_T\otimes|u_T\rangle.v=t=0∑T−1​⟨ϕa​,rt​⟩ϕa​⊗∣ut​⟩+rT​⊗∣uT​⟩.

For a vector vvv on I×{0,1}TI\times\{0,1\}^TI×{0,1}T, its binary encoding is the vector on I×{0,…,2q−1}I\times\{0,\ldots,2^q-1\}I×{0,…,2q−1} whose (i,s)(i,s)(i,s)-coordinate is ∑t=0T1s=tv(i,ut)\sum_{t=0}^{T}\mathbf1_{s=t}v(i,u_t)∑t=0T​1s=t​v(i,ut​). Let Jq∣s⟩=∣(s+1) mod 2q⟩J_q|s\rangle=|(s+1)\bmod2^q\rangleJq​∣s⟩=∣(s+1)mod2q⟩, let M=Ea⊗1+(1−Ea)⊗JqM=E_a\otimes1+(1-E_a)\otimes J_qM=Ea​⊗1+(1−Ea​)⊗Jq​, and let Aj+1A_{j+1}Aj+1​ apply Rh(j)R_{h(j)}Rh(j)​ to the system exactly when the address equals j+1j+1j+1, otherwise applying the identity. Then

(ATM)⋯(A1M)(ψ⊗∣0⟩)=encode⁡(v),⌈log⁡2(T+1)⌉≤q.(A_T M)\cdots(A_1 M)(\psi\otimes|0\rangle) =\operatorname{encode}(v), \qquad \lceil\log_2(T+1)\rceil\le q.(AT​M)⋯(A1​M)(ψ⊗∣0⟩)=encode(v),⌈log2​(T+1)⌉≤q.

For T=0T=0T=0, the product is the identity and the encoding contains only r0=ψr_0=\psir0​=ψ; q=0q=0q=0 is permitted and forces T=0T=0T=0. Second, there exist positive real constants C,cC,cC,c and a family B(n,k,a,q,T,m,h)B(n,k,a,q,T,m,h)B(n,k,a,q,T,m,h) of sample circuits such that, for all natural n,kn,kn,k with k≥2k\ge2k≥2, all anchors aaa, and all natural q,T,mq,T,mq,T,m with T+1≤2qT+1\le2^qT+1≤2q and m≥1m\ge1m≥1, every history hhh satisfies

copies⁡(B(n,k,a,q,T,m,h))=(4T+1)m+1,N(B(n,k,a,q,T,m,h))≤((4T+1)m+2)n+q+3,length⁡(gates⁡(B(n,k,a,q,T,m,h)))≤C(4T+1)mn(q+1).\begin{aligned} \operatorname{copies}(B(n,k,a,q,T,m,h))&=(4T+1)m+1,\\ N(B(n,k,a,q,T,m,h))&\le((4T+1)m+2)n+q+3,\\ \operatorname{length}(\operatorname{gates}(B(n,k,a,q,T,m,h))) &\le C(4T+1)mn(q+1). \end{aligned}copies(B(n,k,a,q,T,m,h))N(B(n,k,a,q,T,m,h))length(gates(B(n,k,a,q,T,m,h)))​=(4T+1)m+1,≤((4T+1)m+2)n+q+3,≤C(4T+1)mn(q+1).​

Here a sample circuit has injectively placed nnn-qubit input and sample registers, Boolean-and-sample-index labels for its copies, fixed computational-basis states on other wires, and gates consisting of arbitrary one-qubit unitaries and swaps controlled by two distinct control wires; its output retains the original input ports and traces out the other wires. For every collection of norm-one ϕj∈C{0,1}n\phi_j\in\mathbb C^{\{0,1\}^n}ϕj​∈C{0,1}n, every unitary UUU, and every positive semidefinite trace-one ρ\rhoρ, initialize sample label (false,j)({\rm false},j)(false,j) in Ej=ϕjϕj†E_j=\phi_j\phi_j^\daggerEj​=ϕj​ϕj†​ and label (true,j)({\rm true},j)(true,j) in UEjU†UE_jU^\daggerUEj​U†, and call the resulting circuit output Oh(ρ)\mathcal O_h(\rho)Oh​(ρ). To specify the comparison matrix, put pa=0p_a=0pa​=0, pj=(k−1)−1p_j=(k-1)^{-1}pj​=(k−1)−1 for j≠aj\ne aj=a, ωT=∣−⟩⟨−∣⊗T\omega_T=|-\rangle\langle-|^{\otimes T}ωT​=∣−⟩⟨−∣⊗T, and Wj=C(1−2Ej)(1⊗HHad)C(1−2Ea)W_j=C(1-2E_j)(1\otimes H_{\rm Had})C(1-2E_a)Wj​=C(1−2Ej​)(1⊗HHad​)C(1−2Ea​), where CCC is controlled by a true Boolean ancilla and HHad=2−1/2(111−1)H_{\rm Had}=2^{-1/2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}HHad​=2−1/2(11​1−1​). Let VhV_hVh​ apply these Wh(t)W_{h(t)}Wh(t)​ in increasing order on separate ancillas, let V~h\widetilde V_hVh​ use (U⊗1)Wh(t)(U†⊗1)(U\otimes1)W_{h(t)}(U^\dagger\otimes1)(U⊗1)Wh(t)​(U†⊗1) instead, and put Pfalse=EaP_{\rm false}=E_aPfalse​=Ea​, Ptrue=1−EaP_{\rm true}=1-E_aPtrue​=1−Ea​. Define

ET(ρ)=∑h(∏tph(t))∑b∈Booltr⁡anc ⁣[V~h†((Uϕa)(Uϕa)†⊗tr⁡sys ⁣[(Pb⊗1)Vh(ρ⊗ωT)Vh†(Pb⊗1)])V~h].\mathcal E_T(\rho)= \sum_h\Bigl(\prod_tp_{h(t)}\Bigr) \sum_{b\in\mathrm{Bool}} \operatorname{tr}_{\rm anc}\!\left[ \widetilde V_h^\dagger \left((U\phi_a)(U\phi_a)^\dagger\otimes \operatorname{tr}_{\rm sys}\!\left[ (P_b\otimes1)V_h(\rho\otimes\omega_T)V_h^\dagger(P_b\otimes1) \right]\right)\widetilde V_h\right].ET​(ρ)=h∑​(t∏​ph(t)​)b∈Bool∑​tranc​[Vh†​((Uϕa​)(Uϕa​)†⊗trsys​[(Pb​⊗1)Vh​(ρ⊗ωT​)Vh†​(Pb​⊗1)])Vh​].

Then, writing D(X,Y)=12Re⁡tr⁡(X−Y)†(X−Y)D(X,Y)=\frac12\operatorname{Re}\operatorname{tr}\sqrt{(X-Y)^\dagger(X-Y)}D(X,Y)=21​Retr(X−Y)†(X−Y)​, with the square root given by continuous functional calculus, the asserted error bound is

D ⁣(∑h(∏tph(t))Oh(ρ),ET(ρ))≤c(4T+1)m.D\!\left(\sum_h\Bigl(\prod_tp_{h(t)}\Bigr)\mathcal O_h(\rho), \mathcal E_T(\rho)\right) \le \frac{c(4T+1)}m.D(h∑​(t∏​ph(t)​)Oh​(ρ),ET​(ρ))≤mc(4T+1)​.

This second claim includes n=0n=0n=0 and T=0T=0T=0, and assumes neither a generation condition on the samples nor a support condition on ρ\rhoρ.

Human review
  • Endorsed by Shuze Chen · Nov 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Gohan · Nov 1, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me