Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Definitions for Proof of security of quantum key distribution with two-way classical communications

Definition
QAlgorithms_Papers_Independent_Intakenext100_P80

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

prove2quantum

The objects the formalized statements of Proof of security of quantum key distribution with two-way classical communications (arXiv:quant-ph/0105121) are stated in. Each was checked against the paper by a blind read-back and a moderator.

  • PauliRates: PDF p.9, Definition 5: three nonidentity Pauli error probabilities. Validity is separately required by IsPauliRates.
  • IsPauliRates: PDF p.9, Definition 5: exactly the probability-simplex conditions.
  • identityRate: PDF pp.9,22, Eq.(22): probability of no Pauli error.
  • BellError: PDF pp.10--11: Bell labels (bit,phase); no scalar Pauli phase is retained.
  • errorMass: PDF pp.9--11: the normalized Bell-diagonal mixture's four weights.
  • eprBellAmplitude: PDF pp.5,10: amplitude of (I tensor X^x Z^z)|Psi+>. The frozen Hadamard supplies the factor 1/sqrt(2) and the phase (-1)^(za).
  • eprBellProjectionWeight: PDF p.22: Born weight of a (possibly subnormalized) surviving pair in the Bell state specified by e. Branches remain subnormalized.
  • bBranchAmplitude: PDF pp.13,16: B-step branch on two independent input Bell states. Bilateral CNOT uses pair 1 as control; s,t are the two Z measurement outcomes on pair 2. The surviving pair has computational coordinates a,b.
  • bOutputMass: PDF pp.16,22: joint probability of B acceptance and output Bell label. Only equal local target outcomes are retained; no polynomial update is used.
  • bSurvival: PDF p.22, Eq.(18): survival probability per two-pair candidate block, computed by summing its accepted output probabilities.
  • pCorrection: PDF pp.16,18, Figure 6: both relative X syndromes disagree exactly when Bob applies the phase correction to the surviving pair.
  • pBranchAmplitude: PDF pp.16,18--19, Figure 6: P-step branch amplitude on three independent Bell states. The two CNOT controls are pairs 2,3 and their common target is pair 1; pairs 2,3 are then measured in X. The four Hadamard entries implement those measurements. Bob's conditional Z is included. There is no rejection based on either phase syndrome.
  • pOutputMass: PDF pp.16,22: P-step output probability, summing every pair of local phase syndromes. The product of three weights enforces independent input pairs. The syndrome is discarded after correction, as on p.17.
  • bStep: PDF pp.16,22: actual conditional B-step Pauli rates. On the probability simplex, survival is (1-b)^2+b^2 >= 1/2, where b=qX+qY.
  • pStep: PDF pp.16,22: P-step rates. One pair survives each triple, with no phase-syndrome postselection or conditional normalization.
  • bitError: PDF p.22, Eq.(23): measured bit-error probability pZ.
  • phaseError: PDF p.22, Eq.(24): phase-error probability pX.
  • pauliErrorDifference: PDF p.22, Eq.(25): Delta=qZ-qY.
  • PurificationStep: PDF pp.16--17,22: the two possible purification rounds.
  • runSteps: PDF pp.22--23: chronological finite step word, evaluated on the conditional Pauli distribution after each round; the empty word does nothing.
  • bb84Rates: PDF pp.17,22: the full BB84-compatible IID family, with qY=a.
Definition code
import Definitions.Def_QAlgorithms_Defs_Gates

/-!
Gottesman--Lo, arXiv:quant-ph/0105121v2, PDF pp.16,18,22--23.
Only the two statements listed in items.json are drafted here. Operational
QKD/security and asymmetric-CSS completion nodes are explicitly deferred.

The B/P maps below are evaluated from circuit amplitudes and the Born rule;
the closed error-rate polynomials are conclusions, not definitions. The Bell
label is (bit flip, phase flip), so I=(0,0), X=(1,0), Y=(1,1), Z=(0,1).
The Y representative differs from Y by an irrelevant scalar phase.
-/

noncomputable section

namespace QAlgorithms.Papers.Independent.Intakenext100.P80

open scoped ComplexConjugate

/-- PDF p.9, Definition 5: three nonidentity Pauli error probabilities.
Validity is separately required by `IsPauliRates`. -/
structure PauliRates where
  qX : ℝ
  qY : ℝ
  qZ : ℝ

/-- PDF p.9, Definition 5: exactly the probability-simplex conditions. -/
def IsPauliRates (q : PauliRates) : Prop :=
  0 ≤ q.qX ∧ 0 ≤ q.qY ∧ 0 ≤ q.qZ ∧ q.qX + q.qY + q.qZ ≤ 1

/-- PDF pp.9,22, Eq.(22): probability of no Pauli error. -/
def identityRate (q : PauliRates) : ℝ :=
  1 - q.qX - q.qY - q.qZ

/-- PDF pp.10--11: Bell labels (bit,phase); no scalar Pauli phase is retained. -/
abbrev BellError := Bool × Bool

/-- PDF pp.9--11: the normalized Bell-diagonal mixture's four weights. -/
def errorMass (q : PauliRates) (e : BellError) : ℝ :=
  if e.1 then (if e.2 then q.qY else q.qX)
  else (if e.2 then q.qZ else identityRate q)

/-- PDF pp.5,10: amplitude of (I tensor X^x Z^z)|Psi+>.
The frozen Hadamard supplies the factor 1/sqrt(2) and the phase (-1)^(za). -/
def eprBellAmplitude (e : BellError) (a b : Bool) : ℂ :=
  if b = xor a e.1 then hadamard e.2 a else 0

/-- PDF p.22: Born weight of a (possibly subnormalized) surviving pair
in the Bell state specified by `e`. Branches remain subnormalized. -/
def eprBellProjectionWeight (v : Bool → Bool → ℂ) (e : BellError) : ℝ :=
  Complex.normSq (∑ a : Bool, ∑ b : Bool,
    conj (eprBellAmplitude e a b) * v a b)

/-- PDF pp.13,16: B-step branch on two independent input Bell states.
Bilateral CNOT uses pair 1 as control; s,t are the two Z measurement
outcomes on pair 2. The surviving pair has computational coordinates a,b. -/
def bBranchAmplitude (e f : BellError) (s t a b : Bool) : ℂ :=
  eprBellAmplitude e a b * eprBellAmplitude f (xor s a) (xor t b)

/-- PDF pp.16,22: joint probability of B acceptance and output Bell label.
Only equal local target outcomes are retained; no polynomial update is used. -/
def bOutputMass (q : PauliRates) (o : BellError) : ℝ :=
  ∑ e : BellError, ∑ f : BellError,
    errorMass q e * errorMass q f *
      ∑ s : Bool, eprBellProjectionWeight (fun a b => bBranchAmplitude e f s s a b) o

/-- PDF p.22, Eq.(18): survival probability per two-pair candidate block,
computed by summing its accepted output probabilities. -/
def bSurvival (q : PauliRates) : ℝ :=
  ∑ o : BellError, bOutputMass q o

/-- PDF pp.16,18, Figure 6: both relative X syndromes disagree exactly
when Bob applies the phase correction to the surviving pair. -/
def pCorrection (s t : Bool × Bool) : Bool :=
  xor s.1 t.1 && xor s.2 t.2

/-- PDF pp.16,18--19, Figure 6: P-step branch amplitude on three independent
Bell states. The two CNOT controls are pairs 2,3 and their common target
is pair 1; pairs 2,3 are then measured in X. The four Hadamard entries
implement those measurements. Bob's conditional Z is included. There is
no rejection based on either phase syndrome. -/
def pBranchAmplitude (e f g : BellError) (s t : Bool × Bool) (a b : Bool) : ℂ :=
  (if pCorrection s t && b then (-1 : ℂ) else 1) *
    ∑ a2 : Bool, ∑ a3 : Bool, ∑ b2 : Bool, ∑ b3 : Bool,
      hadamard s.1 a2 * hadamard s.2 a3 *
        hadamard t.1 b2 * hadamard t.2 b3 *
        eprBellAmplitude e (xor (xor a a2) a3) (xor (xor b b2) b3) *
        eprBellAmplitude f a2 b2 * eprBellAmplitude g a3 b3

/-- PDF pp.16,22: P-step output probability, summing every pair of local
phase syndromes. The product of three weights enforces independent input
pairs. The syndrome is discarded after correction, as on p.17. -/
def pOutputMass (q : PauliRates) (o : BellError) : ℝ :=
  ∑ e : BellError, ∑ f : BellError, ∑ g : BellError,
    errorMass q e * errorMass q f * errorMass q g *
      ∑ s : Bool × Bool, ∑ t : Bool × Bool,
        eprBellProjectionWeight (pBranchAmplitude e f g s t) o

/-- PDF pp.16,22: actual conditional B-step Pauli rates. On the probability
simplex, survival is (1-b)^2+b^2 >= 1/2, where b=qX+qY. -/
def bStep (q : PauliRates) : PauliRates :=
  ⟨bOutputMass q (true, false) / bSurvival q,
   bOutputMass q (true, true) / bSurvival q,
   bOutputMass q (false, true) / bSurvival q⟩

/-- PDF pp.16,22: P-step rates. One pair survives each triple, with no
phase-syndrome postselection or conditional normalization. -/
def pStep (q : PauliRates) : PauliRates :=
  ⟨pOutputMass q (true, false), pOutputMass q (true, true),
   pOutputMass q (false, true)⟩

/-- PDF p.22, Eq.(23): measured bit-error probability pZ. -/
def bitError (q : PauliRates) : ℝ :=
  q.qX + q.qY

/-- PDF p.22, Eq.(24): phase-error probability pX. -/
def phaseError (q : PauliRates) : ℝ :=
  q.qY + q.qZ

/-- PDF p.22, Eq.(25): Delta=qZ-qY. -/
def pauliErrorDifference (q : PauliRates) : ℝ :=
  q.qZ - q.qY

/-- PDF pp.16--17,22: the two possible purification rounds. -/
inductive PurificationStep where
  | B
  | P
  deriving DecidableEq

/-- PDF pp.22--23: chronological finite step word, evaluated on the
conditional Pauli distribution after each round; the empty word does nothing. -/
def runSteps (steps : List PurificationStep) (q : PauliRates) : PauliRates :=
  steps.foldl (fun r s => match s with
    | .B => bStep r
    | .P => pStep r) q

/-- PDF pp.17,22: the full BB84-compatible IID family, with qY=a. -/
def bb84Rates (p a : ℝ) : PauliRates :=
  ⟨p - a, a, p - a⟩

/-- Sanity: no-error Bell state has zero amplitude on |01>. -/
example : eprBellAmplitude (false, false) false true = 0 := by
  simp [eprBellAmplitude]

/-- Sanity: its |00> amplitude is the normalized 1/sqrt(2). -/
example : eprBellAmplitude (false, false) false false = ((Real.sqrt 2)⁻¹ : ℂ) := by
  rfl

/-- Sanity: noiseless B inputs cannot give unequal target outcomes when
the surviving computational coordinates are 00. -/
example : bBranchAmplitude (false, false) (false, false) false true false false = 0 := by
  simp [bBranchAmplitude, eprBellAmplitude]

/-- Sanity: a single phase syndrome disagreement never triggers correction. -/
example : pCorrection (false, false) (true, false) = false := by
  rfl

/-- Sanity: two phase syndrome disagreements trigger the surviving-pair Z. -/
example : pCorrection (false, false) (true, true) = true := by
  rfl

/-- Sanity: a word with zero rounds leaves every input distribution unchanged. -/
example (q : PauliRates) : runSteps [] q = q := by
  rfl

end QAlgorithms.Papers.Independent.Intakenext100.P80
Source
Proof of security of quantum key distribution with two-way classical communications, arXiv:quant-ph/0105121v2, https://arxiv.org/abs/quant-ph/0105121v2
Read-back

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

QAlgorithms.Papers.Independent.Intakenext100.P80.BellError

BellError is an abbreviation for the type of ordered pairs of Boolean values. Thus its elements are exactly (false,false)(\mathrm{false},\mathrm{false})(false,false), (false,true)(\mathrm{false},\mathrm{true})(false,true), (true,false)(\mathrm{true},\mathrm{false})(true,false), and (true,true)(\mathrm{true},\mathrm{true})(true,true).

QAlgorithms.Papers.Independent.Intakenext100.P80.IsPauliRates

For a record q=(qX,qY,qZ)q=(q_X,q_Y,q_Z)q=(qX​,qY​,qZ​) of three real numbers, IsPauliRates is the proposition

0≤qX ∧ 0≤qY ∧ 0≤qZ ∧ qX+qY+qZ≤1.0\le q_X\ \land\ 0\le q_Y\ \land\ 0\le q_Z\ \land\ q_X+q_Y+q_Z\le1.0≤qX​ ∧ 0≤qY​ ∧ 0≤qZ​ ∧ qX​+qY​+qZ​≤1.

All inequalities are non-strict, so zero components and a total equal to 111 are permitted.

QAlgorithms.Papers.Independent.Intakenext100.P80.PauliRates

A value of PauliRates is a record containing three arbitrary real numbers, denoted qX,qY,qZq_X,q_Y,q_ZqX​,qY​,qZ​. The record itself imposes no nonnegativity, upper-bound, or normalization conditions.

QAlgorithms.Papers.Independent.Intakenext100.P80.PurificationStep

This declares a type with exactly two distinct values, BBB and PPP, neither carrying any additional data, and supplies a procedure deciding whether any two values of this type are equal.

QAlgorithms.Papers.Independent.Intakenext100.P80.bBranchAmplitude

For arbitrary Boolean pairs e=(e1,e2)e=(e_1,e_2)e=(e1​,e2​), f=(f1,f2)f=(f_1,f_2)f=(f1​,f2​) and Boolean values s,t,a,bs,t,a,bs,t,a,b, identify the Boolean values with B={0,1}\mathbb B=\{0,1\}B={0,1}, with ⊕\oplus⊕ denoting exclusive-or. Then bBranchAmplitude is the complex number

{(−1)e2a+f2(s⊕a)2,b=a⊕e1 and t⊕b=(s⊕a)⊕f1,0,otherwise.\begin{cases} \dfrac{(-1)^{e_2a+f_2(s\oplus a)}}{2}, & b=a\oplus e_1\ \text{and}\ t\oplus b=(s\oplus a)\oplus f_1,\\ 0,&\text{otherwise}. \end{cases}⎩⎨⎧​2(−1)e2​a+f2​(s⊕a)​,0,​b=a⊕e1​ and t⊕b=(s⊕a)⊕f1​,otherwise.​

No relation between sss and ttt is assumed.

QAlgorithms.Papers.Independent.Intakenext100.P80.bOutputMass

For any real triple q=(qX,qY,qZ)q=(q_X,q_Y,q_Z)q=(qX​,qY​,qZ​) and any Boolean pair ooo, let B={0,1}\mathbb B=\{0,1\}B={0,1} represent the Boolean values and let ⊕\oplus⊕ denote exclusive-or. Define mq(0,0)=1−qX−qY−qZm_q(0,0)=1-q_X-q_Y-q_Zmq​(0,0)=1−qX​−qY​−qZ​, mq(0,1)=qZm_q(0,1)=q_Zmq​(0,1)=qZ​, mq(1,0)=qXm_q(1,0)=q_Xmq​(1,0)=qX​, and mq(1,1)=qYm_q(1,1)=q_Ymq​(1,1)=qY​; for any pair r=(r1,r2)r=(r_1,r_2)r=(r1​,r2​), define Ar(a,b)=(−1)r2a/2A_r(a,b)=(-1)^{r_2a}/\sqrt2Ar​(a,b)=(−1)r2​a/2​ if b=a⊕r1b=a\oplus r_1b=a⊕r1​, and 000 otherwise. Then bOutputMass is the real number

∑e∈B2∑f∈B2mq(e)mq(f)∑s∈B∣∑a∈B∑b∈BAo(a,b)‾ Ae(a,b) Af(s⊕a,s⊕b)∣2.\sum_{e\in\mathbb B^2}\sum_{f\in\mathbb B^2} m_q(e)m_q(f) \sum_{s\in\mathbb B} \left| \sum_{a\in\mathbb B}\sum_{b\in\mathbb B} \overline{A_o(a,b)}\,A_e(a,b)\, A_f(s\oplus a,s\oplus b) \right|^2.e∈B2∑​f∈B2∑​mq​(e)mq​(f)s∈B∑​​a∈B∑​b∈B∑​Ao​(a,b)​Ae​(a,b)Af​(s⊕a,s⊕b)​2.

Every sum ranges over all values of its indicated Boolean variables. No nonnegativity or normalization condition is imposed on qqq, so the definition does not require this real number to be nonnegative.

QAlgorithms.Papers.Independent.Intakenext100.P80.bStep

For any triple q=(x,y,z)q=(x,y,z)q=(x,y,z) of real numbers, this defines another real triple without assuming that x,y,zx,y,zx,y,z are nonnegative or that their sum is at most 111. Identify Booleans with {0,1}\{0,1\}{0,1}, write ⊕\oplus⊕ for exclusive-or, and define wq(0,0)=1−x−y−zw_q(0,0)=1-x-y-zwq​(0,0)=1−x−y−z, wq(1,0)=xw_q(1,0)=xwq​(1,0)=x, wq(1,1)=yw_q(1,1)=ywq​(1,1)=y, wq(0,1)=zw_q(0,1)=zwq​(0,1)=z, Hu,v=(−1)uv/2H_{u,v}=(-1)^{uv}/\sqrt2Hu,v​=(−1)uv/2​, and E(u,v)(a,b)=1{b=a⊕u}Hv,aE_{(u,v)}(a,b)=\mathbf1_{\{b=a\oplus u\}}H_{v,a}E(u,v)​(a,b)=1{b=a⊕u}​Hv,a​. For each o∈{0,1}2o\in\{0,1\}^2o∈{0,1}2, let

Bq(o)=∑e,f∈{0,1}2wq(e)wq(f)∑s∈{0,1}∣∑a,b∈{0,1}Eo(a,b)‾Ee(a,b)Ef(s⊕a,s⊕b)∣2,Sq=∑o∈{0,1}2Bq(o).B_q(o)= \sum_{e,f\in\{0,1\}^2}w_q(e)w_q(f) \sum_{s\in\{0,1\}} \left| \sum_{a,b\in\{0,1\}} \overline{E_o(a,b)}E_e(a,b)E_f(s\oplus a,s\oplus b) \right|^2, \qquad S_q=\sum_{o\in\{0,1\}^2}B_q(o).Bq​(o)=e,f∈{0,1}2∑​wq​(e)wq​(f)s∈{0,1}∑​​a,b∈{0,1}∑​Eo​(a,b)​Ee​(a,b)Ef​(s⊕a,s⊕b)​2,Sq​=o∈{0,1}2∑​Bq​(o).

The output, in X,Y,ZX,Y,ZX,Y,Z coordinate order, is

(Bq(1,0)Sq,Bq(1,1)Sq,Bq(0,1)Sq).\left(\frac{B_q(1,0)}{S_q},\frac{B_q(1,1)}{S_q},\frac{B_q(0,1)}{S_q}\right).(Sq​Bq​(1,0)​,Sq​Bq​(1,1)​,Sq​Bq​(0,1)​).

Division is total real division: if Sq=0S_q=0Sq​=0, all three output coordinates are 000.

QAlgorithms.Papers.Independent.Intakenext100.P80.bSurvival

For any real triple q=(qX,qY,qZ)q=(q_X,q_Y,q_Z)q=(qX​,qY​,qZ​), let B={0,1}\mathbb B=\{0,1\}B={0,1} represent the Boolean values and let ⊕\oplus⊕ denote exclusive-or. Define mq(0,0)=1−qX−qY−qZm_q(0,0)=1-q_X-q_Y-q_Zmq​(0,0)=1−qX​−qY​−qZ​, mq(0,1)=qZm_q(0,1)=q_Zmq​(0,1)=qZ​, mq(1,0)=qXm_q(1,0)=q_Xmq​(1,0)=qX​, and mq(1,1)=qYm_q(1,1)=q_Ymq​(1,1)=qY​; for r=(r1,r2)∈B2r=(r_1,r_2)\in\mathbb B^2r=(r1​,r2​)∈B2, define Ar(a,b)=(−1)r2a/2A_r(a,b)=(-1)^{r_2a}/\sqrt2Ar​(a,b)=(−1)r2​a/2​ when b=a⊕r1b=a\oplus r_1b=a⊕r1​, and 000 otherwise. Then bSurvival is the real number

∑o∈B2∑e∈B2∑f∈B2mq(e)mq(f)∑s∈B∣∑a∈B∑b∈BAo(a,b)‾ Ae(a,b) Af(s⊕a,s⊕b)∣2.\sum_{o\in\mathbb B^2} \sum_{e\in\mathbb B^2}\sum_{f\in\mathbb B^2} m_q(e)m_q(f) \sum_{s\in\mathbb B} \left| \sum_{a\in\mathbb B}\sum_{b\in\mathbb B} \overline{A_o(a,b)}\,A_e(a,b)\, A_f(s\oplus a,s\oplus b) \right|^2.o∈B2∑​e∈B2∑​f∈B2∑​mq​(e)mq​(f)s∈B∑​​a∈B∑​b∈B∑​Ao​(a,b)​Ae​(a,b)Af​(s⊕a,s⊕b)​2.

All Boolean values and all Boolean pairs are included in the indicated sums, and no validity condition is assumed for qqq.

QAlgorithms.Papers.Independent.Intakenext100.P80.bb84Rates

For every pair of real numbers p,ap,ap,a, this defines a triple of real coordinates by

(qX,qY,qZ)=(p−a, a, p−a).(q_X,q_Y,q_Z)=(p-a,\ a,\ p-a).(qX​,qY​,qZ​)=(p−a, a, p−a).

There are no hypotheses on ppp or aaa, so the coordinates are not required to be nonnegative or to have sum at most 111.

QAlgorithms.Papers.Independent.Intakenext100.P80.bitError

For every triple q=(x,y,z)q=(x,y,z)q=(x,y,z) of real numbers, this defines its bit error to be x+yx+yx+y, the sum of its XXX and YYY coordinates. No restrictions on the coordinates are imposed, so the defined real number need not lie in [0,1][0,1][0,1].

QAlgorithms.Papers.Independent.Intakenext100.P80.eprBellAmplitude

For a Boolean pair e=(e1,e2)e=(e_1,e_2)e=(e1​,e2​) and Boolean values a,ba,ba,b, identify false\mathrm{false}false with 000 and true\mathrm{true}true with 111, and let ⊕\oplus⊕ denote exclusive-or. Then eprBellAmplitude is the complex number

Ae(a,b)={(−1)e2a2,b=a⊕e1,0,b≠a⊕e1.A_e(a,b)= \begin{cases} \dfrac{(-1)^{e_2a}}{\sqrt2},&b=a\oplus e_1,\\ 0,&b\ne a\oplus e_1. \end{cases}Ae​(a,b)=⎩⎨⎧​2​(−1)e2​a​,0,​b=a⊕e1​,b=a⊕e1​.​

The displayed real values are regarded as complex numbers.

QAlgorithms.Papers.Independent.Intakenext100.P80.eprBellProjectionWeight

For any function v:B×B→Cv:\mathbb B\times\mathbb B\to\mathbb Cv:B×B→C and any pair e=(e1,e2)∈B2e=(e_1,e_2)\in\mathbb B^2e=(e1​,e2​)∈B2, where B={0,1}\mathbb B=\{0,1\}B={0,1} represents the Boolean values and ⊕\oplus⊕ is exclusive-or, define Ae(a,b)=(−1)e2a/2A_e(a,b)=(-1)^{e_2a}/\sqrt2Ae​(a,b)=(−1)e2​a/2​ when b=a⊕e1b=a\oplus e_1b=a⊕e1​, and Ae(a,b)=0A_e(a,b)=0Ae​(a,b)=0 otherwise. Then eprBellProjectionWeight is the real number

∣∑a∈B∑b∈BAe(a,b)‾ v(a,b)∣2.\left|\sum_{a\in\mathbb B}\sum_{b\in\mathbb B} \overline{A_e(a,b)}\,v(a,b)\right|^2.​a∈B∑​b∈B∑​Ae​(a,b)​v(a,b)​2.

Here the bar denotes complex conjugation and the squared modulus is the sum of the squares of the real and imaginary parts. No norm or normalization condition is imposed on vvv.

QAlgorithms.Papers.Independent.Intakenext100.P80.errorMass

For any record q=(qX,qY,qZ)q=(q_X,q_Y,q_Z)q=(qX​,qY​,qZ​) of three real numbers and any Boolean pair eee, errorMass is the real number

mq(e)={1−qX−qY−qZ,e=(false,false),qZ,e=(false,true),qX,e=(true,false),qY,e=(true,true).m_q(e)= \begin{cases} 1-q_X-q_Y-q_Z,&e=(\mathrm{false},\mathrm{false}),\\ q_Z,&e=(\mathrm{false},\mathrm{true}),\\ q_X,&e=(\mathrm{true},\mathrm{false}),\\ q_Y,&e=(\mathrm{true},\mathrm{true}). \end{cases}mq​(e)=⎩⎨⎧​1−qX​−qY​−qZ​,qZ​,qX​,qY​,​e=(false,false),e=(false,true),e=(true,false),e=(true,true).​

No nonnegativity or normalization hypothesis is required, so these values may be negative.

QAlgorithms.Papers.Independent.Intakenext100.P80.identityRate

For any record q=(qX,qY,qZ)q=(q_X,q_Y,q_Z)q=(qX​,qY​,qZ​) of three real numbers, its identityRate is the real number

1−qX−qY−qZ.1-q_X-q_Y-q_Z.1−qX​−qY​−qZ​.

There is no assumption on qqq, so this number need not lie in [0,1][0,1][0,1].

QAlgorithms.Papers.Independent.Intakenext100.P80.pBranchAmplitude

For arbitrary Boolean pairs e,f,g,s=(s1,s2),t=(t1,t2)e,f,g,s=(s_1,s_2),t=(t_1,t_2)e,f,g,s=(s1​,s2​),t=(t1​,t2​) and Boolean values a,ba,ba,b, identify the Boolean values with B={0,1}\mathbb B=\{0,1\}B={0,1}, and let ⊕\oplus⊕ denote exclusive-or. Define the complex-valued function H(x,y)=(−1)xy/2H(x,y)=(-1)^{xy}/\sqrt2H(x,y)=(−1)xy/2​, and, for each r=(r1,r2)∈B2r=(r_1,r_2)\in\mathbb B^2r=(r1​,r2​)∈B2, define Ar(x,y)=(−1)r2x/2A_r(x,y)=(-1)^{r_2x}/\sqrt2Ar​(x,y)=(−1)r2​x/2​ when y=x⊕r1y=x\oplus r_1y=x⊕r1​, and 000 otherwise. Then pBranchAmplitude is the complex number

(−1)b(s1⊕t1)(s2⊕t2)∑a2∈B∑a3∈B∑b2∈B∑b3∈BH(s1,a2)H(s2,a3)H(t1,b2)H(t2,b3)Ae((a⊕a2)⊕a3,(b⊕b2)⊕b3)Af(a2,b2)Ag(a3,b3).(-1)^{b(s_1\oplus t_1)(s_2\oplus t_2)} \sum_{a_2\in\mathbb B}\sum_{a_3\in\mathbb B} \sum_{b_2\in\mathbb B}\sum_{b_3\in\mathbb B} H(s_1,a_2)H(s_2,a_3)H(t_1,b_2)H(t_2,b_3) A_e\bigl((a\oplus a_2)\oplus a_3,(b\oplus b_2)\oplus b_3\bigr) A_f(a_2,b_2)A_g(a_3,b_3).(−1)b(s1​⊕t1​)(s2​⊕t2​)a2​∈B∑​a3​∈B∑​b2​∈B∑​b3​∈B∑​H(s1​,a2​)H(s2​,a3​)H(t1​,b2​)H(t2​,b3​)Ae​((a⊕a2​)⊕a3​,(b⊕b2​)⊕b3​)Af​(a2​,b2​)Ag​(a3​,b3​).

The factor preceding the sum is −1-1−1 exactly when b=1b=1b=1, s1≠t1s_1\ne t_1s1​=t1​, and s2≠t2s_2\ne t_2s2​=t2​; otherwise it is 111. All four summation variables range independently over both Boolean values, and there are no further hypotheses on the arguments.

QAlgorithms.Papers.Independent.Intakenext100.P80.pCorrection

For any two Boolean pairs s=(s1,s2)s=(s_1,s_2)s=(s1​,s2​) and t=(t1,t2)t=(t_1,t_2)t=(t1​,t2​), pCorrection is the Boolean value

(s1⊕t1)∧(s2⊕t2),(s_1\oplus t_1)\land(s_2\oplus t_2),(s1​⊕t1​)∧(s2​⊕t2​),

where ⊕\oplus⊕ denotes exclusive-or. Thus it is true exactly when s1≠t1s_1\ne t_1s1​=t1​ and s2≠t2s_2\ne t_2s2​=t2​, and false otherwise.

QAlgorithms.Papers.Independent.Intakenext100.P80.pOutputMass

For any triple q=(x,y,z)q=(x,y,z)q=(x,y,z) of real numbers and any pair o∈{0,1}2o\in\{0,1\}^2o∈{0,1}2, this defines a real number Pq(o)P_q(o)Pq​(o) as follows; no nonnegativity or normalization hypothesis is imposed on qqq. Identify false and true with 000 and 111, write ⊕\oplus⊕ for exclusive-or, and set wq(0,0)=1−x−y−zw_q(0,0)=1-x-y-zwq​(0,0)=1−x−y−z, wq(1,0)=xw_q(1,0)=xwq​(1,0)=x, wq(1,1)=yw_q(1,1)=ywq​(1,1)=y, and wq(0,1)=zw_q(0,1)=zwq​(0,1)=z. Define Hu,v=(−1)uv/2H_{u,v}=(-1)^{uv}/\sqrt2Hu,v​=(−1)uv/2​ and the complex amplitudes E(u,v)(a,b)=1{b=a⊕u}Hv,aE_{(u,v)}(a,b)=\mathbf1_{\{b=a\oplus u\}}H_{v,a}E(u,v)​(a,b)=1{b=a⊕u}​Hv,a​. For e,f,g,s,t∈{0,1}2e,f,g,s,t\in\{0,1\}^2e,f,g,s,t∈{0,1}2 and a,b∈{0,1}a,b\in\{0,1\}a,b∈{0,1}, put

Ae,f,g;s,t(a,b)=(−1)b(s1⊕t1)(s2⊕t2)∑a2,a3,b2,b3∈{0,1}Hs1,a2Hs2,a3Ht1,b2Ht2,b3Ee(a⊕a2⊕a3,b⊕b2⊕b3)Ef(a2,b2)Eg(a3,b3).A_{e,f,g;s,t}(a,b)= (-1)^{b(s_1\oplus t_1)(s_2\oplus t_2)} \sum_{a_2,a_3,b_2,b_3\in\{0,1\}} H_{s_1,a_2}H_{s_2,a_3}H_{t_1,b_2}H_{t_2,b_3} E_e(a\oplus a_2\oplus a_3,b\oplus b_2\oplus b_3) E_f(a_2,b_2)E_g(a_3,b_3).Ae,f,g;s,t​(a,b)=(−1)b(s1​⊕t1​)(s2​⊕t2​)a2​,a3​,b2​,b3​∈{0,1}∑​Hs1​,a2​​Hs2​,a3​​Ht1​,b2​​Ht2​,b3​​Ee​(a⊕a2​⊕a3​,b⊕b2​⊕b3​)Ef​(a2​,b2​)Eg​(a3​,b3​).

The defined value is

Pq(o)=∑e,f,g∈{0,1}2wq(e)wq(f)wq(g)∑s,t∈{0,1}2∣∑a,b∈{0,1}Eo(a,b)‾Ae,f,g;s,t(a,b)∣2.P_q(o)= \sum_{e,f,g\in\{0,1\}^2}w_q(e)w_q(f)w_q(g) \sum_{s,t\in\{0,1\}^2} \left| \sum_{a,b\in\{0,1\}}\overline{E_o(a,b)}A_{e,f,g;s,t}(a,b) \right|^2.Pq​(o)=e,f,g∈{0,1}2∑​wq​(e)wq​(f)wq​(g)s,t∈{0,1}2∑​​a,b∈{0,1}∑​Eo​(a,b)​Ae,f,g;s,t​(a,b)​2.

QAlgorithms.Papers.Independent.Intakenext100.P80.pStep

For any triple q=(x,y,z)q=(x,y,z)q=(x,y,z) of real numbers, this defines a real triple without any nonnegativity or normalization assumption. Identify Booleans with {0,1}\{0,1\}{0,1}, write ⊕\oplus⊕ for exclusive-or, and set wq(0,0)=1−x−y−zw_q(0,0)=1-x-y-zwq​(0,0)=1−x−y−z, wq(1,0)=xw_q(1,0)=xwq​(1,0)=x, wq(1,1)=yw_q(1,1)=ywq​(1,1)=y, wq(0,1)=zw_q(0,1)=zwq​(0,1)=z, Hu,v=(−1)uv/2H_{u,v}=(-1)^{uv}/\sqrt2Hu,v​=(−1)uv/2​, and E(u,v)(a,b)=1{b=a⊕u}Hv,aE_{(u,v)}(a,b)=\mathbf1_{\{b=a\oplus u\}}H_{v,a}E(u,v)​(a,b)=1{b=a⊕u}​Hv,a​. Define

Ae,f,g;s,t(a,b)=(−1)b(s1⊕t1)(s2⊕t2)∑a2,a3,b2,b3∈{0,1}Hs1,a2Hs2,a3Ht1,b2Ht2,b3Ee(a⊕a2⊕a3,b⊕b2⊕b3)Ef(a2,b2)Eg(a3,b3)A_{e,f,g;s,t}(a,b)= (-1)^{b(s_1\oplus t_1)(s_2\oplus t_2)} \sum_{a_2,a_3,b_2,b_3\in\{0,1\}} H_{s_1,a_2}H_{s_2,a_3}H_{t_1,b_2}H_{t_2,b_3} E_e(a\oplus a_2\oplus a_3,b\oplus b_2\oplus b_3) E_f(a_2,b_2)E_g(a_3,b_3)Ae,f,g;s,t​(a,b)=(−1)b(s1​⊕t1​)(s2​⊕t2​)a2​,a3​,b2​,b3​∈{0,1}∑​Hs1​,a2​​Hs2​,a3​​Ht1​,b2​​Ht2​,b3​​Ee​(a⊕a2​⊕a3​,b⊕b2​⊕b3​)Ef​(a2​,b2​)Eg​(a3​,b3​)

for e,f,g,s,t∈{0,1}2e,f,g,s,t\in\{0,1\}^2e,f,g,s,t∈{0,1}2 and a,b∈{0,1}a,b\in\{0,1\}a,b∈{0,1}, and put

Pq(o)=∑e,f,g∈{0,1}2wq(e)wq(f)wq(g)∑s,t∈{0,1}2∣∑a,b∈{0,1}Eo(a,b)‾Ae,f,g;s,t(a,b)∣2.P_q(o)= \sum_{e,f,g\in\{0,1\}^2}w_q(e)w_q(f)w_q(g) \sum_{s,t\in\{0,1\}^2} \left| \sum_{a,b\in\{0,1\}}\overline{E_o(a,b)}A_{e,f,g;s,t}(a,b) \right|^2.Pq​(o)=e,f,g∈{0,1}2∑​wq​(e)wq​(f)wq​(g)s,t∈{0,1}2∑​​a,b∈{0,1}∑​Eo​(a,b)​Ae,f,g;s,t​(a,b)​2.

The defined output, in X,Y,ZX,Y,ZX,Y,Z coordinate order, is (Pq(1,0),Pq(1,1),Pq(0,1))\bigl(P_q(1,0),P_q(1,1),P_q(0,1)\bigr)(Pq​(1,0),Pq​(1,1),Pq​(0,1)), with no division by a total mass.

QAlgorithms.Papers.Independent.Intakenext100.P80.pauliErrorDifference

For every triple q=(x,y,z)q=(x,y,z)q=(x,y,z) of real numbers, this defines its Pauli error difference to be z−yz-yz−y, its ZZZ coordinate minus its YYY coordinate. There are no restrictions on qqq, and this difference may be negative, zero, or positive.

QAlgorithms.Papers.Independent.Intakenext100.P80.phaseError

For every triple q=(x,y,z)q=(x,y,z)q=(x,y,z) of real numbers, this defines its phase error to be y+zy+zy+z, the sum of its YYY and ZZZ coordinates. No restrictions on the coordinates are imposed, so the defined real number need not lie in [0,1][0,1][0,1].

QAlgorithms.Papers.Independent.Intakenext100.P80.runSteps

For any finite list of labels s1,…,sms_1,\ldots,s_ms1​,…,sm​, each equal to BBB or PPP, and any initial real triple qqq, this defines the result of applying the corresponding transformations in list order, with the first label applied first. The transformations are specified by the following finite sums. Identify Booleans with {0,1}\{0,1\}{0,1}, write ⊕\oplus⊕ for exclusive-or, and define Hu,v=(−1)uv/2H_{u,v}=(-1)^{uv}/\sqrt2Hu,v​=(−1)uv/2​ and E(u,v)(a,b)=1{b=a⊕u}Hv,aE_{(u,v)}(a,b)=\mathbf1_{\{b=a\oplus u\}}H_{v,a}E(u,v)​(a,b)=1{b=a⊕u}​Hv,a​. For any current triple r=(x,y,z)r=(x,y,z)r=(x,y,z), set wr(0,0)=1−x−y−zw_r(0,0)=1-x-y-zwr​(0,0)=1−x−y−z, wr(1,0)=xw_r(1,0)=xwr​(1,0)=x, wr(1,1)=yw_r(1,1)=ywr​(1,1)=y, and wr(0,1)=zw_r(0,1)=zwr​(0,1)=z, and put

Br(o)=∑e,f∈{0,1}2wr(e)wr(f)∑u∈{0,1}∣∑a,b∈{0,1}Eo(a,b)‾Ee(a,b)Ef(u⊕a,u⊕b)∣2,Sr=∑o∈{0,1}2Br(o),Ae,f,g;u,v(a,b)=(−1)b(u1⊕v1)(u2⊕v2)∑a2,a3,b2,b3∈{0,1}Hu1,a2Hu2,a3Hv1,b2Hv2,b3⋅Ee(a⊕a2⊕a3,b⊕b2⊕b3)Ef(a2,b2)Eg(a3,b3),Pr(o)=∑e,f,g∈{0,1}2wr(e)wr(f)wr(g)∑u,v∈{0,1}2∣∑a,b∈{0,1}Eo(a,b)‾Ae,f,g;u,v(a,b)∣2.\begin{aligned} B_r(o)&= \sum_{e,f\in\{0,1\}^2}w_r(e)w_r(f) \sum_{u\in\{0,1\}} \left| \sum_{a,b\in\{0,1\}} \overline{E_o(a,b)}E_e(a,b)E_f(u\oplus a,u\oplus b) \right|^2,\\ S_r&=\sum_{o\in\{0,1\}^2}B_r(o),\\ A_{e,f,g;u,v}(a,b)&= (-1)^{b(u_1\oplus v_1)(u_2\oplus v_2)} \sum_{a_2,a_3,b_2,b_3\in\{0,1\}} H_{u_1,a_2}H_{u_2,a_3}H_{v_1,b_2}H_{v_2,b_3}\\ &\hspace{2em}\cdot E_e(a\oplus a_2\oplus a_3,b\oplus b_2\oplus b_3) E_f(a_2,b_2)E_g(a_3,b_3),\\ P_r(o)&= \sum_{e,f,g\in\{0,1\}^2}w_r(e)w_r(f)w_r(g) \sum_{u,v\in\{0,1\}^2} \left| \sum_{a,b\in\{0,1\}}\overline{E_o(a,b)}A_{e,f,g;u,v}(a,b) \right|^2. \end{aligned}Br​(o)Sr​Ae,f,g;u,v​(a,b)Pr​(o)​=e,f∈{0,1}2∑​wr​(e)wr​(f)u∈{0,1}∑​​a,b∈{0,1}∑​Eo​(a,b)​Ee​(a,b)Ef​(u⊕a,u⊕b)​2,=o∈{0,1}2∑​Br​(o),=(−1)b(u1​⊕v1​)(u2​⊕v2​)a2​,a3​,b2​,b3​∈{0,1}∑​Hu1​,a2​​Hu2​,a3​​Hv1​,b2​​Hv2​,b3​​⋅Ee​(a⊕a2​⊕a3​,b⊕b2​⊕b3​)Ef​(a2​,b2​)Eg​(a3​,b3​),=e,f,g∈{0,1}2∑​wr​(e)wr​(f)wr​(g)u,v∈{0,1}2∑​​a,b∈{0,1}∑​Eo​(a,b)​Ae,f,g;u,v​(a,b)​2.​

Define TB(r)=(Br(1,0)/Sr,Br(1,1)/Sr,Br(0,1)/Sr)T_B(r)=\bigl(B_r(1,0)/S_r,B_r(1,1)/S_r,B_r(0,1)/S_r\bigr)TB​(r)=(Br​(1,0)/Sr​,Br​(1,1)/Sr​,Br​(0,1)/Sr​) and TP(r)=(Pr(1,0),Pr(1,1),Pr(0,1))T_P(r)=\bigl(P_r(1,0),P_r(1,1),P_r(0,1)\bigr)TP​(r)=(Pr​(1,0),Pr​(1,1),Pr​(0,1)). Starting with r0=qr_0=qr0​=q, set rj=Tsj(rj−1)r_j=T_{s_j}(r_{j-1})rj​=Tsj​​(rj−1​) for 1≤j≤m1\le j\le m1≤j≤m; the defined result is rmr_mrm​. The empty list returns qqq. No coordinate restrictions are imposed at any stage, and division by zero in TBT_BTB​ gives zero in each coordinate.

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