Definitions for Proof of security of quantum key distribution with two-way classical communications
DefinitionQAlgorithms_Papers_Independent_Intakenext100_P80The 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 byIsPauliRates.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 bye. 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.
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
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 , , , and .
QAlgorithms.Papers.Independent.Intakenext100.P80.IsPauliRates
For a record of three real numbers, IsPauliRates is the proposition
All inequalities are non-strict, so zero components and a total equal to are permitted.
QAlgorithms.Papers.Independent.Intakenext100.P80.PauliRates
A value of PauliRates is a record containing three arbitrary real numbers, denoted . 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, and , 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 , and Boolean values , identify the Boolean values with , with denoting exclusive-or. Then bBranchAmplitude is the complex number
No relation between and is assumed.
QAlgorithms.Papers.Independent.Intakenext100.P80.bOutputMass
For any real triple and any Boolean pair , let represent the Boolean values and let denote exclusive-or. Define , , , and ; for any pair , define if , and otherwise. Then bOutputMass is the real number
Every sum ranges over all values of its indicated Boolean variables. No nonnegativity or normalization condition is imposed on , so the definition does not require this real number to be nonnegative.
QAlgorithms.Papers.Independent.Intakenext100.P80.bStep
For any triple of real numbers, this defines another real triple without assuming that are nonnegative or that their sum is at most . Identify Booleans with , write for exclusive-or, and define , , , , , and . For each , let
The output, in coordinate order, is
Division is total real division: if , all three output coordinates are .
QAlgorithms.Papers.Independent.Intakenext100.P80.bSurvival
For any real triple , let represent the Boolean values and let denote exclusive-or. Define , , , and ; for , define when , and otherwise. Then bSurvival is the real number
All Boolean values and all Boolean pairs are included in the indicated sums, and no validity condition is assumed for .
QAlgorithms.Papers.Independent.Intakenext100.P80.bb84Rates
For every pair of real numbers , this defines a triple of real coordinates by
There are no hypotheses on or , so the coordinates are not required to be nonnegative or to have sum at most .
QAlgorithms.Papers.Independent.Intakenext100.P80.bitError
For every triple of real numbers, this defines its bit error to be , the sum of its and coordinates. No restrictions on the coordinates are imposed, so the defined real number need not lie in .
QAlgorithms.Papers.Independent.Intakenext100.P80.eprBellAmplitude
For a Boolean pair and Boolean values , identify with and with , and let denote exclusive-or. Then eprBellAmplitude is the complex number
The displayed real values are regarded as complex numbers.
QAlgorithms.Papers.Independent.Intakenext100.P80.eprBellProjectionWeight
For any function and any pair , where represents the Boolean values and is exclusive-or, define when , and otherwise. Then eprBellProjectionWeight is the real number
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 .
QAlgorithms.Papers.Independent.Intakenext100.P80.errorMass
For any record of three real numbers and any Boolean pair , errorMass is the real number
No nonnegativity or normalization hypothesis is required, so these values may be negative.
QAlgorithms.Papers.Independent.Intakenext100.P80.identityRate
For any record of three real numbers, its identityRate is the real number
There is no assumption on , so this number need not lie in .
QAlgorithms.Papers.Independent.Intakenext100.P80.pBranchAmplitude
For arbitrary Boolean pairs and Boolean values , identify the Boolean values with , and let denote exclusive-or. Define the complex-valued function , and, for each , define when , and otherwise. Then pBranchAmplitude is the complex number
The factor preceding the sum is exactly when , , and ; otherwise it is . 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 and , pCorrection is the Boolean value
where denotes exclusive-or. Thus it is true exactly when and , and false otherwise.
QAlgorithms.Papers.Independent.Intakenext100.P80.pOutputMass
For any triple of real numbers and any pair , this defines a real number as follows; no nonnegativity or normalization hypothesis is imposed on . Identify false and true with and , write for exclusive-or, and set , , , and . Define and the complex amplitudes . For and , put
The defined value is
QAlgorithms.Papers.Independent.Intakenext100.P80.pStep
For any triple of real numbers, this defines a real triple without any nonnegativity or normalization assumption. Identify Booleans with , write for exclusive-or, and set , , , , , and . Define
for and , and put
The defined output, in coordinate order, is , with no division by a total mass.
QAlgorithms.Papers.Independent.Intakenext100.P80.pauliErrorDifference
For every triple of real numbers, this defines its Pauli error difference to be , its coordinate minus its coordinate. There are no restrictions on , and this difference may be negative, zero, or positive.
QAlgorithms.Papers.Independent.Intakenext100.P80.phaseError
For every triple of real numbers, this defines its phase error to be , the sum of its and coordinates. No restrictions on the coordinates are imposed, so the defined real number need not lie in .
QAlgorithms.Papers.Independent.Intakenext100.P80.runSteps
For any finite list of labels , each equal to or , and any initial real triple , 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 , write for exclusive-or, and define and . For any current triple , set , , , and , and put
Define and . Starting with , set for ; the defined result is . The empty list returns . No coordinate restrictions are imposed at any stage, and division by zero in gives zero in each coordinate.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.