Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Structured Codes Improve the Bennett-Brassard-84 Quantum Key Rate

Definition
QAlgorithms_Papers_Independent_Advance50_P15

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

prove2quantum

The objects the formalized statements of Structured Codes Improve the Bennett-Brassard-84 Quantum Key Rate (arXiv:quant-ph/0607018) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • repetitionSyndrome: PDF p.2, Lemma 2: the syndrome of the Z_1 Z_j checks; source wire 1 is wire 0.
  • repetitionCoordinates: PDF p.2, Lemma 2: the bijective coherent decoder, retaining wire 0 and all check outcomes. It does not perform majority correction or discard syndromes.
  • repetitionEncode: PDF p.2: the repetition-code embedding of a logical vector in the span of |0...0> and |1...1>.
  • repetitionDecode: PDF pp.2--3: coherent decoding is a permutation of the computational basis.
  • phaseSign: PDF p.2, Eq.(4): the phase (-1)^(v dot x), using the frozen modulo-two dot product.
  • physicalPauli: PDF p.2, Lemma 2: the ordered Pauli X^u Z^v (Z acts first). The input coordinate at output y is y xor u.
  • logicalPauli: PDF p.2, Lemma 2: the logical operator X^u Z^v, in the same order as the physical Pauli.
  • bernoulliWord: PDF p.2, Eq.(3): an independent Bernoulli(p) word, including the endpoints. The empty word has mass one.
  • logicalSyndromeProb: PDF p.2, Lemma 2: the actual pushforward of independent physical bit errors under the decoder, for one specific syndrome string.
  • bellWeight: PDF p.2, definition of Gamma_p and Eq.(4): Bell/Pauli weights, indexed by (bit error, phase error). On 0 <= p <= 1/2, exactly 0 <= t <= p is allowed.
  • pauliWordProb: PDF p.2, Eq.(4): the m-fold product distribution of the single-pair law. This is not an arbitrary correlated distribution with the same marginals.
  • EveRegister: PDF pp.2--3, Eq.(5)--(8): Eve's register includes Alice's PUBLIC syndrome, then the entire channel-purifying registers E1 and E2. Alice's private noise register is excluded.
  • eveGivenBit: PDF pp.2--3, Eq.(5)--(8), with the public V explicitly retained: Eve's normalized conditional density given Alice's noisy first bit a. For the public syndrome s, z = decoder^(-1)(a,s) is the noisy word, and x = z xor f was the original uniform word. Summing the independent private f incoherently traces out Alice's noise register. The uniform syndrome contributes 2^(-k). No conditional distribution at a zero-probability error word is used.
  • eveInformation: PDF p.3, Eq.(8): I(A;E V), the Holevo information of the uniform retained bit in Eve's full system, including all public syndrome information.
  • phaseRay: PDF p.2, Theorem 1: the two normalized rays phi_+ and phi_-.
  • phaseDensity: PDF p.2, Theorem 1: rho_(p,q) = (1-q)|phi_+><phi_+| + q|phi_-><phi_-|.
  • repetitionPhaseMixture: PDF p.2, Eq.(2): the equal mixture of rho^tensor m and its conjugate by Z^tensor m. Both signs are real, so the right factor is its own adjoint.
  • logicalConditionalEntropy: PDF pp.2--3, Eq.(2): H(logical bit | syndrome) as H(joint)-H(syndrome). This equals the weighted sum over every individual syndrome, including its multiplicity; it never divides by the mass of an impossible syndrome.
  • repetitionExpression: PDF p.2, Eq.(2): the displayed entropic expression per sifted signal. It can be negative and is not defined to be an operational capacity.
Definition code
import Mathlib
import Definitions.Def_QAlgorithms_Defs_Ensemble
import Definitions.Def_QAlgorithms_Defs_BinaryStabilizer
import Definitions.Def_QAlgorithms_Papers_Independent_Support50_P40

/-!
Smith--Renes--Smolin, arXiv:quant-ph/0607018v2, PDF pp.2--4.
The finite decoder, adversary-information maximum, and numerical positivity are
stated here. The operational Theorem 1 and the full single-letter comparison
are deferred in the unit's HARD.md, rather than replaced by entropic surrogates.
New paper-specific definitions are local; finite Shannon entropy is reused
directly from the pinned accepted Support50.P40 module. The parameter k denotes m - 1,
so that every repetition block has the positive length m = k + 1.
-/

noncomputable section

namespace QAlgorithms.Papers.Independent.Advance50.P15

open QAlgorithms
open scoped ComplexConjugate

attribute [local instance] Classical.propDecidable Classical.decEq

/-- PDF p.2, Lemma 2: the syndrome of the Z_1 Z_j checks; source wire 1 is wire 0. -/
def repetitionSyndrome {k : ℕ} (x : Qubits (k + 1)) : Qubits k :=
  fun j => Bool.xor (x 0) (x j.succ)

/-- PDF p.2, Lemma 2: the bijective coherent decoder, retaining wire 0 and all
check outcomes. It does not perform majority correction or discard syndromes. -/
def repetitionCoordinates (k : ℕ) : Qubits (k + 1) ≃ Bool × Qubits k where
  toFun x := (x 0, repetitionSyndrome x)
  invFun z := Fin.cases z.1 (fun j => Bool.xor z.1 (z.2 j))
  left_inv x := by
    funext i
    refine Fin.cases ?_ (fun j => ?_) i
    · rfl
    · change Bool.xor (x 0) (Bool.xor (x 0) (x j.succ)) = x j.succ
      rw [← Bool.xor_assoc, Bool.xor_self]
      simp
  right_inv z := by
    apply Prod.ext
    · rfl
    · funext j
      change Bool.xor z.1 (Bool.xor z.1 (z.2 j)) = z.2 j
      rw [← Bool.xor_assoc, Bool.xor_self]
      simp

/-- PDF p.2: the repetition-code embedding of a logical vector in the span of
|0...0> and |1...1>. -/
def repetitionEncode (k : ℕ) (psi : EuclideanSpace ℂ Bool) :
    EuclideanSpace ℂ (Qubits (k + 1)) :=
  WithLp.toLp 2 fun x => if ∀ i, x i = x 0 then psi (x 0) else 0

/-- PDF pp.2--3: coherent decoding is a permutation of the computational basis. -/
def repetitionDecode {k : ℕ} (psi : EuclideanSpace ℂ (Qubits (k + 1))) :
    EuclideanSpace ℂ (Bool × Qubits k) :=
  WithLp.toLp 2 fun z => psi ((repetitionCoordinates k).symm z)

/-- PDF p.2, Eq.(4): the phase (-1)^(v dot x), using the frozen modulo-two dot product. -/
def phaseSign {m : ℕ} (v x : Qubits m) : ℂ :=
  if dotBits v x then -1 else 1

/-- PDF p.2, Lemma 2: the ordered Pauli X^u Z^v (Z acts first).
The input coordinate at output y is y xor u. -/
def physicalPauli {m : ℕ} (u v : Qubits m)
    (psi : EuclideanSpace ℂ (Qubits m)) : EuclideanSpace ℂ (Qubits m) :=
  WithLp.toLp 2 fun y => phaseSign v (y + u) * psi (y + u)

/-- PDF p.2, Lemma 2: the logical operator X^u Z^v, in the same order as the
physical Pauli. -/
def logicalPauli (u v : Bool) (psi : EuclideanSpace ℂ Bool) :
    EuclideanSpace ℂ Bool :=
  WithLp.toLp 2 fun y =>
    (if v && Bool.xor y u then (-1 : ℂ) else 1) * psi (Bool.xor y u)

/-- PDF p.2, Eq.(3): an independent Bernoulli(p) word, including the endpoints.
The empty word has mass one. -/
def bernoulliWord {m : ℕ} (p : ℝ) (u : Qubits m) : ℝ :=
  ∏ i, if u i then p else 1 - p

/-- PDF p.2, Lemma 2: the actual pushforward of independent physical bit errors
under the decoder, for one specific syndrome string. -/
def logicalSyndromeProb (k : ℕ) (p : ℝ) (a : Bool) (s : Qubits k) : ℝ :=
  ∑ u : Qubits (k + 1), if u 0 = a ∧ repetitionSyndrome u = s then bernoulliWord p u else 0

/-- PDF p.2, definition of Gamma_p and Eq.(4): Bell/Pauli weights, indexed by
(bit error, phase error). On 0 <= p <= 1/2, exactly 0 <= t <= p is allowed. -/
def bellWeight (p t : ℝ) (u v : Bool) : ℝ :=
  if u then (if v then t else p - t)
  else (if v then p - t else 1 + t - 2 * p)

/-- PDF p.2, Eq.(4): the m-fold product distribution of the single-pair law.
This is not an arbitrary correlated distribution with the same marginals. -/
def pauliWordProb {m : ℕ} (p t : ℝ) (u v : Qubits m) : ℝ :=
  ∏ i, bellWeight p t (u i) (v i)

/-- PDF pp.2--3, Eq.(5)--(8): Eve's register includes Alice's PUBLIC syndrome,
then the entire channel-purifying registers E1 and E2. Alice's private noise
register is excluded. -/
abbrev EveRegister (k : ℕ) := Qubits k × (Qubits (k + 1) × Qubits (k + 1))

/-- PDF pp.2--3, Eq.(5)--(8), with the public V explicitly retained: Eve's
normalized conditional density given Alice's noisy first bit a. For the public
syndrome s, z = decoder^(-1)(a,s) is the noisy word, and x = z xor f was the
original uniform word. Summing the independent private f incoherently traces
out Alice's noise register. The uniform syndrome contributes 2^(-k).
No conditional distribution at a zero-probability error word is used. -/
def eveGivenBit (k : ℕ) (p q t : ℝ) (a : Bool) :
    Matrix (EveRegister k) (EveRegister k) ℂ :=
  fun e d => if e.1 = d.1 ∧ e.2.1 = d.2.1 then
    ((2 : ℂ) ^ k)⁻¹ * ∑ f : Qubits (k + 1),
      let x := ((repetitionCoordinates k).symm (a, e.1) + f)
      (bernoulliWord q f : ℂ) *
        (Real.sqrt (pauliWordProb p t e.2.1 e.2.2) : ℂ) *
        (Real.sqrt (pauliWordProb p t e.2.1 d.2.2) : ℂ) *
        phaseSign e.2.2 x * conj (phaseSign d.2.2 x)
  else 0

/-- PDF p.3, Eq.(8): I(A;E V), the Holevo information of the uniform retained
bit in Eve's full system, including all public syndrome information. -/
def eveInformation (k : ℕ) (p q t : ℝ) : ℝ :=
  let r0 := eveGivenBit k p q t false
  let r1 := eveGivenBit k p q t true
  vnEntropy (((1 / 2 : ℂ) • r0) + ((1 / 2 : ℂ) • r1)) -
    (vnEntropy r0 + vnEntropy r1) / 2

/-- PDF p.2, Theorem 1: the two normalized rays phi_+ and phi_-. -/
def phaseRay (p : ℝ) (minus : Bool) : EuclideanSpace ℂ Bool :=
  WithLp.toLp 2 fun b => if b then
    (if minus then (-1 : ℂ) else 1) * (Real.sqrt p : ℂ)
  else (Real.sqrt (1 - p) : ℂ)

/-- PDF p.2, Theorem 1: rho_(p,q) = (1-q)|phi_+><phi_+| + q|phi_-><phi_-|. -/
def phaseDensity (p q : ℝ) : Matrix Bool Bool ℂ :=
  ((1 - q : ℝ) : ℂ) • pureDensity (phaseRay p false) +
    (q : ℂ) • pureDensity (phaseRay p true)

/-- PDF p.2, Eq.(2): the equal mixture of rho^tensor m and its conjugate by
Z^tensor m. Both signs are real, so the right factor is its own adjoint. -/
def repetitionPhaseMixture (m : ℕ) (p q : ℝ) : Matrix (Qubits m) (Qubits m) ℂ :=
  fun x y => (1 / 2 : ℂ) * kronAll (fun _ : Fin m => phaseDensity p q) x y +
    (1 / 2 : ℂ) * (-1 : ℂ) ^ hammingWeight x *
      kronAll (fun _ : Fin m => phaseDensity p q) x y * (-1 : ℂ) ^ hammingWeight y

/-- PDF pp.2--3, Eq.(2): H(logical bit | syndrome) as H(joint)-H(syndrome).
This equals the weighted sum over every individual syndrome, including its
multiplicity; it never divides by the mass of an impossible syndrome. -/
def logicalConditionalEntropy (k : ℕ) (p : ℝ) : ℝ :=
  QAlgorithms.Papers.Independent.Support50.P40.finiteEntropyBits (fun z : Bool × Qubits k => logicalSyndromeProb k p z.1 z.2) -
    QAlgorithms.Papers.Independent.Support50.P40.finiteEntropyBits (fun s : Qubits k => ∑ a : Bool, logicalSyndromeProb k p a s)

/-- PDF p.2, Eq.(2): the displayed entropic expression per sifted signal.
It can be negative and is not defined to be an operational capacity. -/
def repetitionExpression (k : ℕ) (p q : ℝ) : ℝ :=
  (1 - logicalConditionalEntropy k (p * (1 - q) + q * (1 - p)) +
    ((k + 1 : ℕ) : ℝ) * vnEntropy (phaseDensity p q) -
    vnEntropy (repetitionPhaseMixture (k + 1) p q)) / ((k + 1 : ℕ) : ℝ)

/-! Sanity examples for the new interfaces. -/

example (k : ℕ) (a : Bool) (s : Qubits k) :
    (repetitionCoordinates k).symm (a, s) 0 = a := rfl

example (k : ℕ) : repetitionSyndrome (fun _ : Fin (k + 1) => false) =
    (fun _ : Fin k => false) := by
  funext j
  rfl

example (x : Qubits 0) : hammingWeight x = 0 := by
  simp [hammingWeight]

example (p : ℝ) (x : Qubits 0) : bernoulliWord p x = 1 := by
  simp [bernoulliWord]

example (v x : Qubits 0) : phaseSign v x = 1 := by
  simp [phaseSign, dotBits]

example (p : ℝ) : bellWeight p (p ^ 2) true true = p ^ 2 := rfl

example (k : ℕ) (p q t : ℝ) (a : Bool) (e d : EveRegister k)
    (h : e.1 ≠ d.1) : eveGivenBit k p q t a e d = 0 := by
  simp [eveGivenBit, h]

example (p : ℝ) : phaseDensity p 0 = pureDensity (phaseRay p false) := by
  simp [phaseDensity]

example (rho : Matrix Bool Bool ℂ) (x y : Qubits 0) :
    kronAll (fun _ : Fin 0 => rho) x y = 1 := by
  simp [kronAll]

example {I : Type*} [Fintype I] : QAlgorithms.Papers.Independent.Support50.P40.finiteEntropyBits (fun _ : I => 0) = 0 := by
  simp [QAlgorithms.Papers.Independent.Support50.P40.finiteEntropyBits]

end QAlgorithms.Papers.Independent.Advance50.P15
Source
Structured Codes Improve the Bennett-Brassard-84 Quantum Key Rate, arXiv:quant-ph/0607018v2, https://arxiv.org/abs/quant-ph/0607018v2
Read-back

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

QAlgorithms.Papers.Independent.Advance50.P15.EveRegister

For every natural number kkk, this abbreviates the type of triples (s,(u,v))(s,(u,v))(s,(u,v)), where sss is a Boolean string of length kkk and u,vu,vu,v are Boolean strings of length k+1k+1k+1. For k=0k=0k=0, sss is the unique empty string and each of u,vu,vu,v has one bit.

QAlgorithms.Papers.Independent.Advance50.P15.bellWeight

For every pair of real numbers p,tp,tp,t and Boolean values u,vu,vu,v, this defines a real number: it is ttt when (u,v)=(true,true)(u,v)=(\mathrm{true},\mathrm{true})(u,v)=(true,true), p−tp-tp−t when (u,v)(u,v)(u,v) is either (true,false)(\mathrm{true},\mathrm{false})(true,false) or (false,true)(\mathrm{false},\mathrm{true})(false,true), and 1+t−2p1+t-2p1+t−2p when (u,v)=(false,false)(u,v)=(\mathrm{false},\mathrm{false})(u,v)=(false,false). No restrictions on p,tp,tp,t or nonnegativity of these values are assumed.

QAlgorithms.Papers.Independent.Advance50.P15.bernoulliWord

For every natural number mmm, real number ppp, and Boolean string uuu of length mmm, this defines the real number ∏i=0m−1wi\prod_{i=0}^{m-1}w_i∏i=0m−1​wi​, where wi=pw_i=pwi​=p when uiu_iui​ is true and wi=1−pw_i=1-pwi​=1−p when uiu_iui​ is false. There is no assumption that ppp lies in [0,1][0,1][0,1]. For m=0m=0m=0, the empty product is 111.

QAlgorithms.Papers.Independent.Advance50.P15.eveGivenBit

For every natural number kkk, real numbers p,q,tp,q,tp,q,t, and bit aaa, this defines a complex matrix RaR_aRa​ whose rows and columns are indexed by triples (s,u,v)(s,u,v)(s,u,v), where sss is a kkk-bit string and u,vu,vu,v are (k+1)(k+1)(k+1)-bit strings. Write ⊕\oplus⊕ for bitwise exclusive-or, v⋅xv\cdot xv⋅x for the parity of ∑ivixi\sum_i v_i x_i∑i​vi​xi​, and X(a,s)X(a,s)X(a,s) for the (k+1)(k+1)(k+1)-bit string with X(a,s)0=aX(a,s)_0=aX(a,s)0​=a and X(a,s)j+1=a⊕sjX(a,s)_{j+1}=a\oplus s_jX(a,s)j+1​=a⊕sj​. Define

Bq(f)=∏i=0k{q,fi=1,1−q,fi=0,Wp,t(u,v)=∏i=0kwp,t(ui,vi),B_q(f)=\prod_{i=0}^{k}\begin{cases}q,&f_i=1,\\1-q,&f_i=0,\end{cases} \qquad W_{p,t}(u,v)=\prod_{i=0}^{k}w_{p,t}(u_i,v_i),Bq​(f)=i=0∏k​{q,1−q,​fi​=1,fi​=0,​Wp,t​(u,v)=i=0∏k​wp,t​(ui​,vi​),

where

wp,t(0,0)=1+t−2p,wp,t(0,1)=p−t,wp,t(1,0)=p−t,wp,t(1,1)=t.w_{p,t}(0,0)=1+t-2p,\quad w_{p,t}(0,1)=p-t,\quad w_{p,t}(1,0)=p-t,\quad w_{p,t}(1,1)=t.wp,t​(0,0)=1+t−2p,wp,t​(0,1)=p−t,wp,t​(1,0)=p−t,wp,t​(1,1)=t.

The matrix entry is

Ra[(s,u,v),(s′,u′,v′)]={2−k∑f∈{0,1}k+1Bq(f)Wp,t(u,v)Wp,t(u,v′)(−1)v⋅(X(a,s)⊕f)(−1)v′⋅(X(a,s)⊕f),s=s′ and u=u′,0,otherwise.R_a[(s,u,v),(s',u',v')] = \begin{cases} \displaystyle 2^{-k}\sum_{f\in\{0,1\}^{k+1}} B_q(f)\sqrt{W_{p,t}(u,v)}\sqrt{W_{p,t}(u,v')} (-1)^{v\cdot(X(a,s)\oplus f)} (-1)^{v'\cdot(X(a,s)\oplus f)}, &s=s'\ \text{and }u=u',\\ 0,&\text{otherwise}. \end{cases}Ra​[(s,u,v),(s′,u′,v′)]=⎩⎨⎧​2−kf∈{0,1}k+1∑​Bq​(f)Wp,t​(u,v)​Wp,t​(u,v′)​(−1)v⋅(X(a,s)⊕f)(−1)v′⋅(X(a,s)⊕f),0,​s=s′ and u=u′,otherwise.​

All real factors are regarded as complex numbers. There are no restrictions on p,q,tp,q,tp,q,t; real square roots of negative arguments are defined to be zero. The definition includes k=0k=0k=0, when the syndrome string sss is empty.

QAlgorithms.Papers.Independent.Advance50.P15.eveInformation

For every natural number kkk and real numbers p,q,tp,q,tp,q,t, this defines

Ik(p,q,t)=H ⁣(R0+R12)−H(R0)+H(R1)2,H(A)=−Re⁡tr⁡ ⁣(h(A)),h(x)=xlog⁡2x,I_k(p,q,t) = H\!\left(\frac{R_0+R_1}{2}\right) -\frac{H(R_0)+H(R_1)}{2}, \qquad H(A)=-\operatorname{Re}\operatorname{tr}\!\left(h(A)\right), \quad h(x)=x\log_2 x,Ik​(p,q,t)=H(2R0​+R1​​)−2H(R0​)+H(R1​)​,H(A)=−Retr(h(A)),h(x)=xlog2​x,

where h(A)h(A)h(A) is formed using the real continuous functional calculus. Here RaR_aRa​, for a∈{0,1}a\in\{0,1\}a∈{0,1}, is indexed by triples (s,u,v)∈{0,1}k×{0,1}k+1×{0,1}k+1(s,u,v)\in\{0,1\}^{k}\times\{0,1\}^{k+1}\times\{0,1\}^{k+1}(s,u,v)∈{0,1}k×{0,1}k+1×{0,1}k+1, with entries zero unless the two indices have the same sss and uuu, and otherwise

Ra[(s,u,v),(s,u,v′)]=2−k∑f∈{0,1}k+1(∏i=0kqfi(1−q)1−fi)∏i=0kwp,t(ui,vi)∏i=0kwp,t(ui,vi′)(−1)v⋅(X(a,s)⊕f)+v′⋅(X(a,s)⊕f).R_a[(s,u,v),(s,u,v')] = 2^{-k}\sum_{f\in\{0,1\}^{k+1}} \left(\prod_{i=0}^{k}q^{f_i}(1-q)^{1-f_i}\right) \sqrt{\prod_{i=0}^{k}w_{p,t}(u_i,v_i)} \sqrt{\prod_{i=0}^{k}w_{p,t}(u_i,v'_i)} (-1)^{v\cdot(X(a,s)\oplus f)+v'\cdot(X(a,s)\oplus f)}.Ra​[(s,u,v),(s,u,v′)]=2−kf∈{0,1}k+1∑​(i=0∏k​qfi​(1−q)1−fi​)i=0∏k​wp,t​(ui​,vi​)​i=0∏k​wp,t​(ui​,vi′​)​(−1)v⋅(X(a,s)⊕f)+v′⋅(X(a,s)⊕f).

Bits in exponents are identified with 0,10,10,1, each dot product denotes parity, X(a,s)0=aX(a,s)_0=aX(a,s)0​=a, X(a,s)j+1=a⊕sjX(a,s)_{j+1}=a\oplus s_jX(a,s)j+1​=a⊕sj​, and the four values of wp,tw_{p,t}wp,t​, in the order (0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1)(0,0),(0,1),(1,0),(1,1), are 1+t−2p,p−t,p−t,t1+t-2p,p-t,p-t,t1+t−2p,p−t,p−t,t. No parameter bounds or density-matrix assumptions are imposed, and k=0k=0k=0 is included. Real square roots of negative numbers are zero; the real logarithm used here has log⁡0=0\log 0=0log0=0 and log⁡x=log⁡∣x∣\log x=\log|x|logx=log∣x∣ for negative xxx, so in particular h(0)=0h(0)=0h(0)=0.

QAlgorithms.Papers.Independent.Advance50.P15.logicalConditionalEntropy

For every natural number kkk and real number ppp, this defines

Ck(p)=−∑a∈{0,1}∑s∈{0,1}kLk,p(a,s)log⁡2Lk,p(a,s)+∑s∈{0,1}kPk,p(s)log⁡2Pk,p(s),C_k(p) = -\sum_{a\in\{0,1\}}\sum_{s\in\{0,1\}^{k}} L_{k,p}(a,s)\log_2 L_{k,p}(a,s) +\sum_{s\in\{0,1\}^{k}} P_{k,p}(s)\log_2 P_{k,p}(s),Ck​(p)=−a∈{0,1}∑​s∈{0,1}k∑​Lk,p​(a,s)log2​Lk,p​(a,s)+s∈{0,1}k∑​Pk,p​(s)log2​Pk,p​(s),

where

Lk,p(a,s)=∑u∈{0,1}k+1u0=a, u0⊕uj+1=sj ∀j<k∏i=0k{p,ui=1,1−p,ui=0,Pk,p(s)=∑a∈{0,1}Lk,p(a,s).L_{k,p}(a,s)= \sum_{\substack{u\in\{0,1\}^{k+1}\\ u_0=a,\ u_0\oplus u_{j+1}=s_j\ \forall j<k}} \prod_{i=0}^{k} \begin{cases} p,&u_i=1,\\ 1-p,&u_i=0, \end{cases} \qquad P_{k,p}(s)=\sum_{a\in\{0,1\}}L_{k,p}(a,s).Lk,p​(a,s)=u∈{0,1}k+1u0​=a, u0​⊕uj+1​=sj​ ∀j<k​∑​i=0∏k​{p,1−p,​ui​=1,ui​=0,​Pk,p​(s)=a∈{0,1}∑​Lk,p​(a,s).

Thus the definition subtracts the finite entropy expression of the syndrome marginal from that of the joint bit-and-syndrome array. No restriction on ppp is imposed. The real logarithm has value zero at zero and uses log⁡∣x∣\log|x|log∣x∣ for negative arguments, so zero summands contribute zero even without nonnegativity assumptions. The definition includes k=0k=0k=0, when there is one empty syndrome.

QAlgorithms.Papers.Independent.Advance50.P15.logicalPauli

For every pair of Boolean values u,vu,vu,v and every vector ψ∈C{false,true}\psi\in\mathbb C^{\{\mathrm{false},\mathrm{true}\}}ψ∈C{false,true}, this defines a vector whose amplitude at a Boolean value yyy is ψ(y⊕u)\psi(y\oplus u)ψ(y⊕u) multiplied by −1-1−1 if both vvv and y⊕uy\oplus uy⊕u are true, and by 111 otherwise, where ⊕\oplus⊕ denotes exclusive OR. No normalization of ψ\psiψ is assumed.

QAlgorithms.Papers.Independent.Advance50.P15.logicalSyndromeProb

For every natural number kkk, real number ppp, Boolean value aaa, and Boolean string sss of length kkk, this defines the sum, over all Boolean strings uuu of length k+1k+1k+1 satisfying u0=au_0=au0​=a and u0⊕uj+1=sju_0\oplus u_{j+1}=s_ju0​⊕uj+1​=sj​ for every 0≤j<k0\le j<k0≤j<k, of ∏i=0kwi\prod_{i=0}^{k}w_i∏i=0k​wi​, where wi=pw_i=pwi​=p if uiu_iui​ is true and wi=1−pw_i=1-pwi​=1−p otherwise; ⊕\oplus⊕ denotes exclusive OR. Strings failing either condition contribute zero. No restriction on ppp is imposed. For k=0k=0k=0, sss is empty and the value is ppp if aaa is true and 1−p1-p1−p if aaa is false.

QAlgorithms.Papers.Independent.Advance50.P15.pauliWordProb

For every natural number mmm, real numbers p,tp,tp,t, and Boolean strings u,vu,vu,v of length mmm, this defines the real number ∏i=0m−1wi\prod_{i=0}^{m-1}w_i∏i=0m−1​wi​, where wi=tw_i=twi​=t if (ui,vi)=(true,true)(u_i,v_i)=(\mathrm{true},\mathrm{true})(ui​,vi​)=(true,true), wi=p−tw_i=p-twi​=p−t if exactly one of ui,viu_i,v_iui​,vi​ is true, and wi=1+t−2pw_i=1+t-2pwi​=1+t−2p if both are false. No restrictions on p,tp,tp,t or nonnegativity are assumed. For m=0m=0m=0, the empty product is 111.

QAlgorithms.Papers.Independent.Advance50.P15.phaseDensity

For every pair of real numbers p,qp,qp,q, this defines the complex matrix

Dp,q=(1−q)ϕ+ϕ+∗+qϕ−ϕ−∗=(r2(1−2q)rs(1−2q)rss2),r=1−p,s=p,D_{p,q} =(1-q)\phi_+\phi_+^{*}+q\phi_-\phi_-^{*} = \begin{pmatrix} r^2&(1-2q)rs\\ (1-2q)rs&s^2 \end{pmatrix}, \qquad r=\sqrt{1-p},\quad s=\sqrt p,Dp,q​=(1−q)ϕ+​ϕ+∗​+qϕ−​ϕ−∗​=(r2(1−2q)rs​(1−2q)rss2​),r=1−p​,s=p​,

in the coordinate order 0,10,10,1, where ϕ+=(r,s)\phi_+=(r,s)ϕ+​=(r,s), ϕ−=(r,−s)\phi_-=(r,-s)ϕ−​=(r,−s), and the outer product ϕϕ∗\phi\phi^{*}ϕϕ∗ has entry ϕaϕb‾\phi_a\overline{\phi_b}ϕa​ϕb​​. Both parameters are unrestricted real numbers; square roots of negative arguments are zero. The definition itself imposes no positivity, trace, or normalization conditions.

QAlgorithms.Papers.Independent.Advance50.P15.phaseRay

For every real number ppp and bit minus\mathit{minus}minus, this defines a vector in the complex Euclidean space indexed by the two bits, with coordinates

ϕp,minus(0)=1−p,ϕp,minus(1)={−p,minus=1,p,minus=0.\phi_{p,\mathit{minus}}(0)=\sqrt{1-p}, \qquad \phi_{p,\mathit{minus}}(1)= \begin{cases} -\sqrt p,&\mathit{minus}=1,\\ \sqrt p,&\mathit{minus}=0. \end{cases}ϕp,minus​(0)=1−p​,ϕp,minus​(1)={−p​,p​,​minus=1,minus=0.​

The square roots are real and then embedded in C\mathbb CC. There is no assumption that 0≤p≤10\le p\le10≤p≤1 and no normalization hypothesis; a real square root with negative argument is zero.

QAlgorithms.Papers.Independent.Advance50.P15.phaseSign

For every natural number mmm and Boolean strings v,xv,xv,x of length mmm, this defines a complex number equal to −1-1−1 if the number of indices iii with both viv_ivi​ and xix_ixi​ true is odd, and equal to 111 if that number is even. In particular, for m=0m=0m=0 it equals 111.

QAlgorithms.Papers.Independent.Advance50.P15.physicalPauli

For every natural number mmm, Boolean strings u,vu,vu,v of length mmm, and complex Euclidean vector ψ\psiψ indexed by Boolean strings of length mmm, this defines the vector whose amplitude at a Boolean string yyy is (−1)N(v,y⊕u)ψ(y⊕u)(-1)^{N(v,y\oplus u)}\psi(y\oplus u)(−1)N(v,y⊕u)ψ(y⊕u), where ⊕\oplus⊕ denotes coordinatewise exclusive OR and N(v,z)N(v,z)N(v,z) is the number of indices iii for which both viv_ivi​ and ziz_izi​ are true. No normalization of ψ\psiψ is assumed. For m=0m=0m=0, the empty sum determining the sign is zero, and the resulting vector equals ψ\psiψ.

QAlgorithms.Papers.Independent.Advance50.P15.repetitionCoordinates

For every natural number kkk, this defines a bijection from Boolean strings of length k+1k+1k+1 to pairs consisting of a Boolean value and a Boolean string of length kkk. It sends xxx to (a,s)(a,s)(a,s) with a=x0a=x_0a=x0​ and sj=x0⊕xj+1s_j=x_0\oplus x_{j+1}sj​=x0​⊕xj+1​ for 0≤j<k0\le j<k0≤j<k, where ⊕\oplus⊕ is exclusive OR. Its inverse sends (a,s)(a,s)(a,s) to the string xxx satisfying x0=ax_0=ax0​=a and xj+1=a⊕sjx_{j+1}=a\oplus s_jxj+1​=a⊕sj​. The two maps are inverse in both directions. For k=0k=0k=0, this bijection pairs the sole bit with the empty string.

QAlgorithms.Papers.Independent.Advance50.P15.repetitionDecode

For every natural number kkk and every complex Euclidean vector ψ\psiψ indexed by Boolean strings of length k+1k+1k+1, this defines a vector indexed by pairs (a,s)(a,s)(a,s), where aaa is Boolean and sss is a Boolean string of length kkk. Its amplitude at (a,s)(a,s)(a,s) is ψ(x)\psi(x)ψ(x), where x0=ax_0=ax0​=a and xj+1=a⊕sjx_{j+1}=a\oplus s_jxj+1​=a⊕sj​ for every 0≤j<k0\le j<k0≤j<k, with ⊕\oplus⊕ denoting exclusive OR. No normalization of ψ\psiψ is assumed. For k=0k=0k=0, the amplitude at (a,∅)(a,\varnothing)(a,∅) is ψ\psiψ evaluated at the one-bit string whose bit is aaa.

QAlgorithms.Papers.Independent.Advance50.P15.repetitionEncode

For every natural number kkk and every vector ψ∈C{false,true}\psi\in\mathbb C^{\{\mathrm{false},\mathrm{true}\}}ψ∈C{false,true}, this defines a vector indexed by Boolean strings xxx of length k+1k+1k+1: its amplitude at xxx is ψ(x0)\psi(x_0)ψ(x0​) if xi=x0x_i=x_0xi​=x0​ for every 0≤i<k+10\le i<k+10≤i<k+1, and is 000 otherwise. No normalization of ψ\psiψ is assumed. For k=0k=0k=0, every one-bit string satisfies the condition, so its amplitude is ψ(x0)\psi(x_0)ψ(x0​).

QAlgorithms.Papers.Independent.Advance50.P15.repetitionExpression

For every natural number kkk and real numbers p,qp,qp,q, this defines

1−Ck ⁣(p(1−q)+q(1−p))+(k+1)H(Dp,q)−H(Mk+1,p,q)k+1.\frac{ 1-C_k\!\bigl(p(1-q)+q(1-p)\bigr) +(k+1)H(D_{p,q})-H(M_{k+1,p,q}) }{k+1}.k+11−Ck​(p(1−q)+q(1−p))+(k+1)H(Dp,q​)−H(Mk+1,p,q​)​.

Here

Dp,q=(r2(1−2q)rs(1−2q)rss2),r=1−p,s=p,Mℓ,p,q[x,y]=1+(−1)∣x∣+∣y∣2∏i=0ℓ−1Dp,q[xi,yi],D_{p,q}= \begin{pmatrix} r^2&(1-2q)rs\\ (1-2q)rs&s^2 \end{pmatrix}, \quad r=\sqrt{1-p},\quad s=\sqrt p, \qquad M_{\ell,p,q}[x,y] =\frac{1+(-1)^{|x|+|y|}}2 \prod_{i=0}^{\ell-1}D_{p,q}[x_i,y_i],Dp,q​=(r2(1−2q)rs​(1−2q)rss2​),r=1−p​,s=p​,Mℓ,p,q​[x,y]=21+(−1)∣x∣+∣y∣​i=0∏ℓ−1​Dp,q​[xi​,yi​],

for ℓ\ellℓ-bit strings x,yx,yx,y, with ∣x∣|x|∣x∣ counting the 111-bits. For any real zzz, set

Lk,z(a,s)=∑u∈{0,1}k+1u0=a, u0⊕uj+1=sj ∀j<k∏i=0kzui(1−z)1−ui,Pk,z(s)=∑aLk,z(a,s),L_{k,z}(a,s)= \sum_{\substack{u\in\{0,1\}^{k+1}\\ u_0=a,\ u_0\oplus u_{j+1}=s_j\ \forall j<k}} \prod_{i=0}^{k}z^{u_i}(1-z)^{1-u_i}, \quad P_{k,z}(s)=\sum_aL_{k,z}(a,s),Lk,z​(a,s)=u∈{0,1}k+1u0​=a, u0​⊕uj+1​=sj​ ∀j<k​∑​i=0∏k​zui​(1−z)1−ui​,Pk,z​(s)=a∑​Lk,z​(a,s),

and

Ck(z)=−∑a,sLk,z(a,s)log⁡2Lk,z(a,s)+∑sPk,z(s)log⁡2Pk,z(s).C_k(z)=-\sum_{a,s}L_{k,z}(a,s)\log_2L_{k,z}(a,s) +\sum_sP_{k,z}(s)\log_2P_{k,z}(s).Ck​(z)=−a,s∑​Lk,z​(a,s)log2​Lk,z​(a,s)+s∑​Pk,z​(s)log2​Pk,z​(s).

Finally, H(A)=−Re⁡tr⁡(h(A))H(A)=-\operatorname{Re}\operatorname{tr}(h(A))H(A)=−Retr(h(A)), where h(x)=xlog⁡2xh(x)=x\log_2xh(x)=xlog2​x is applied by real continuous functional calculus. Bits in exponents mean 0,10,10,1. There are no parameter bounds: negative square-root arguments give zero, the real logarithm is zero at zero and uses the absolute value on negative arguments, and k=0k=0k=0 is included. The denominator k+1k+1k+1 is always positive.

QAlgorithms.Papers.Independent.Advance50.P15.repetitionPhaseMixture

For every natural number mmm and real numbers p,qp,qp,q, this defines a complex matrix Mm,p,qM_{m,p,q}Mm,p,q​ indexed by mmm-bit strings x,yx,yx,y, with entries

Mm,p,q[x,y]=1+(−1)∣x∣+∣y∣2∏i=0m−1Dp,q[xi,yi],Dp,q=(r2(1−2q)rs(1−2q)rss2),r=1−p, s=p,M_{m,p,q}[x,y] = \frac{1+(-1)^{|x|+|y|}}{2} \prod_{i=0}^{m-1}D_{p,q}[x_i,y_i], \qquad D_{p,q}= \begin{pmatrix} r^2&(1-2q)rs\\ (1-2q)rs&s^2 \end{pmatrix}, \quad r=\sqrt{1-p},\ s=\sqrt p,Mm,p,q​[x,y]=21+(−1)∣x∣+∣y∣​i=0∏m−1​Dp,q​[xi​,yi​],Dp,q​=(r2(1−2q)rs​(1−2q)rss2​),r=1−p​, s=p​,

where ∣x∣|x|∣x∣ and ∣y∣|y|∣y∣ count the entries equal to 111, and the rows and columns of Dp,qD_{p,q}Dp,q​ are ordered 0,10,10,1. There are no restrictions on p,qp,qp,q; negative square-root arguments give zero. The case m=0m=0m=0 is included: the empty product is 111, and the matrix has its single entry equal to 111.

QAlgorithms.Papers.Independent.Advance50.P15.repetitionSyndrome

For every natural number kkk and Boolean string x=(x0,…,xk)x=(x_0,\ldots,x_k)x=(x0​,…,xk​) of length k+1k+1k+1, this defines the Boolean string sss of length kkk by sj=x0⊕xj+1s_j=x_0\oplus x_{j+1}sj​=x0​⊕xj+1​ for 0≤j<k0\le j<k0≤j<k, where ⊕\oplus⊕ denotes exclusive OR. For k=0k=0k=0, the result is the unique empty Boolean string.

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

    Confirmed by the moderator at approval.

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