Manuscript Offprint
arXiv:2610.30645FVQKD: A Formal Verification of Quantum Key Distribution Security in Rocq
Ruixuan Deng , Zhengfeng Ji , Jiayu Zhang , and Li Zhou
Tsinghua University
Zhongguancun Laboratory
Institute of Software, Chinese Academy of Sciences
Abstract—Quantum key distribution (QKD), whose security is derived from quantum mechanics rather than computational assumptions, is moving into standardization and commercial deployment. Yet its security guarantees rest on technically delicate proofs checked by hand. Formal verification closes this gap, establishing a two-factor assurance: unconditional security from physical principles, and machine-checked proofs against reasoning errors. We present FVQKD, a Rocq library for machine-checking QKD security proofs. Its first result is a complete, end-to-end machine-checked proof of composable, finite-key security for BB84. The mechanization reconstructs the complete proof infrastructure from first principles, including the smooth entropy framework, the entropic uncertainty relation, and the Quantum Leftover Hash Lemma. It uncovers necessary side conditions that the published argument leaves unstated, one of which reveals a missing proof branch, and it grounds the information-theoretic bound in a formal semantics of protocol execution, which the pen-and-paper analysis lacks. The proof is entirely admit-free, relying only on the Rocq kernel and standard foundational axioms. To our knowledge, this is the first end-to-end formal verification of a QKD security proof. Built on MATHCOMP, MATHCOMP-ANALYSIS, and COQQ, the development provides quantum-information infrastructure designed for reuse across broader QKD variants and quantum cryptography applications.
I. INTRODUCTION
Quantum key distribution (QKD) offers a distinctive approach to secure key establishment for the quantum era. Unlike conventional public-key exchange protocols such as Diffie-Hellman, QKD derives the secrecy of a shared key from physical measurements governed by quantum mechanics rather than from computational hardness. Under suitable device model and authentication assumptions, it provides information-theoretic security against adversaries with unbounded computational resources, including a full-scale quantum computer. BB84 [1], proposed in 1984 by Bennett and Brassard, is the founding QKD protocol. Its inventors received the 2025 ACM A.M. Turing Award for their role in establishing the foundations of quantum information science [2]. QKD is also technologically distinctive: it uses quantum mechanics but requires only the ability to prepare, transmit, and measure single-qubit states, making it one of the earliest commercially mature quantum-information technologies. In the past four decades since its invention, QKD has advanced from a theoretical proposal to satellite-to-ground demonstrations [3] and active standardization [4], [5].
Although BB84 has a compelling security intuition, a rigorous proof that an eavesdropper cannot learn the key without causing detectable disturbance took more than a decade to establish. Lo and Chau [6] and Mayers [7] established the unconditional security of QKD in the asymptotic limit of infinitely many transmitted qubits. Shor and Preskill [8] simplified the argument by reducing it to the theory of quantum error correction. Subsequent work strengthened QKD security proofs in two complementary directions. Finite-key analysis makes the guarantee quantitative for a single protocol run at realistic block sizes that can be as few as quantum signals. Composable security specifies that the generated key remains safe when used as a component of a larger protocol. For the proof line formalized in this paper, these newer advances rely on the smooth-entropy framework of Renner [9] and the tight finite-key analysis of Tomamichel et al. [10].
These security proofs combine deep results from quantum information theory and cryptography, including an entropic uncertainty relation that bounds an eavesdropper's knowledge, a sampling inequality that bounds the unobserved error rate, and a hashing lemma that converts residual uncertainty into secret key. The mathematical sophistication of these ingredients makes the resulting proofs difficult to understand and verify. This concern is not merely theoretical. Important results in quantum information theory have been found to contain serious gaps years after publication [11], [12]. The QKD community has also recognized such challenges. A recent survey identifies gaps and limitations in published decoy-state BB84 security proofs [13], while a new pen-and-paper proof explicitly aims for completeness and certification-grade rigor [14]. These developments raise a fundamental question: can QKD security proofs be placed on a more trustworthy foundation, one that systematically consolidates and verifies the results drawn from quantum information theory, cryptography, and physics?
Formal verification provides a systematic way to answer this question as it has already proved effective in classical security. Notable examples include verified cryptographic libraries such as HACL* [15] and EverCrypt [16], verified OS kernels such as seL4 [17], and certified compilers such as CompCert [18]. For cryptographic proofs, frameworks such as SSProve [19], CryptHOL [20], EasyCrypt [21], and CryptoVerif [22] support machine-checked reasoning about computational-security reductions [23]. Protocol-level frameworks such as Squirrel [24] and DY* [25], [26] support machine-checked security analyses of practical protocols. These cryptographic proof and protocol frameworks work well for classical cryptography, but QKD falls outside their scope. Its security is information-theoretic, resting on smooth-entropy bounds against an unbounded quantum adversary. It also requires mathematical foundations such as density operators, quantum channels, and smooth min- and max-entropy that these classical tools do not provide.
Proof assistants have also been applied to quantum computing and quantum information. Several foundational libraries and program verification frameworks have been established: in Rocq, CoQQ [27] provides a finite-dimensional quantum mechanics library and program logics [28], QWIRE [29], [30] and VOQC [31] target quantum circuit verification, with a certified end-to-end implementation of Shor's factoring algorithm [32] as one result, and VyZX [33] mechanizes reasoning about the ZX-calculus [34], [35], while ViCAR [36] supports automated rewriting and visualization for monoidal categories. Isabelle/HOL hosts a quantum computing library [37], [38] and a mechanized quantum Hoare logic [39]; Qbricks [40] embeds a circuit-building quantum language in Why3 to support high automation based on path-sum representations [41]. Recent Lean work develops kernel-checked infrastructure for finite-dimensional quantum information theory and applies it to quantum coding theorems [42]. For (post-)quantum cryptographic protocols, qRHL [43] has machine-checked the post-quantum security of the Fujisaki–Okamoto transform [44]. EasyPQC [45] and a computational post-quantum protocol logic [46] verify classical cryptographic schemes and protocols against quantum adversaries.
Closer to the focus of this paper are several works applying formal methods directly to QKD. Kubota et al. [47], [48] give a semi-automated verification of the Shor–Preskill-style BB84 proof route, different from the composable finite-key analysis formalized here. Boender et al. [49] develop Coq infrastructure for modeling quantum protocols, while Kammüller [50] formalizes a Bayesian/probabilistic BB84 argument in Isabelle. The Lean formal-qkd project [51] mechanizes secret-key-length computation equations and partial post-processing code, without the underlying composable security proof. Model-checking tools such as PRISM, QCTL, and QMC [52]–[54] and symbolic analyses [55]–[57] analyze protocol-level behavior, intruder models, or ETSI protocol-layer properties rather than mechanizing the finite-key security proof itself. Adjacent formalization efforts include the generalized quantum Stein's lemma in Lean [58] and classical Shannon information theory in Rocq [59].
As Table I summarizes, the closest existing formal developments each satisfy only a subset of these five properties; none achieves all of them. The central challenge of placing QKD security proofs on a trusted foundation therefore remains open. In this work, we fill this gap by presenting FVQKD, to our knowledge the first complete end-to-end machine-checked proof of composable finite-key security for a QKD protocol. By complementing security from quantum mechanics with machine-checked verification in Rocq,
TABLE I A COMPARISON OF FVQKD WITH PRIOR WORK.
| Development | Framework | UQA | Comp. | FK | Model | E2E |
|---|---|---|---|---|---|---|
| Kubota et al. [47], [48] | qCCS* | ✓ | — | — | ✓ | — |
| Boender et al./Kammüller [49], [50] | Coq/Isabelle | — | — | — | ✓† | — |
| Lean project [51] | Lean | — | — | —‡ | — | — |
| CryptHOL constr. crypto [20], [60] | Isabelle/HOL | — | ✓ | — | ✓§ | — |
| CHSH rigidity/Tsirelson [61], [62] | Lean/Isabelle | — | — | — | — | — |
| FVQKD (this work) | Rocq | ✓ | ✓ | ✓ | ✓ | ✓ |
UQA: unbounded quantum adversary; Comp.: composable security; FK: finite-key bound; Model: explicit protocol model; E2E: end-to-end QKD security proof. A checkmark marks each criterion met; — marks an unmet criterion. *Custom semi-automated quantum-process-calculus verifier, not a proof-assistant kernel. †Individual components only. §Finite-key key-length equations without security derivation. §Composable framework for classical, not quantum, protocols.
FVQKD provides an additional assurance layer for QKD systems. Built with Rocq [63], it uses MATHCOMP for algebra, MATHCOMP-ANALYSIS for real analysis, and CoQQ [27] for finite-dimensional quantum theory. As a major case study, FVQKD formalizes the tight composable finite-key security analysis of BB84 by Tomamichel et al. [10]. To this end, the mechanization reconciles the conventions of the six theoretical works underlying the BB84 security proof and supplies the side conditions that the published argument leaves implicit (Section VII). Figure 3 presents the overall structure of the development.
Contributions. Our contributions are twofold. First, FVQKD provides a reusable, modular formal-verification framework for QKD security proofs. It brings together machine-checked Rocq formalizations of Uhlmann's fidelity theorem, generalized (sub-normalized) fidelity, purified distance as a metric with monotonicity under completely positive trace-nonincreasing (CPTN) maps, the smooth-entropy calculus (smooth conditional min- and max-entropy, their duality and classical chain rules), the POVM-general smooth entropic uncertainty relation, the Quantum Leftover Hash Lemma, Serfling's sampling bound [64], and semidefinite-programming (SDP) strong duality. The SDP result establishes the primal direction of Tomamichel's Theorem 2.6 [65], proved from first principles. The majority of the project is protocol-agnostic, with no dependence on BB84 or any particular QKD protocol, and serves as a general framework that future QKD variants can instantiate without re-deriving the underlying mathematical machinery.
Second, FVQKD establishes an end-to-end machine-checked QKD security proof, instantiated for BB84: an unbroken, kernel-checked chain from a formal protocol program to a composable finite-key -security statement at the tight bound of Tomamichel et al. [10]. The proof contains no incomplete lemmas; developed from first principles, it relies solely on the Rocq kernel and three standard axioms inherited from MATHCOMP-ANALYSIS.
It is worth emphasizing that existing formal verification efforts in protocol security usually focus on protocol-level modeling: message flows, adversary capabilities, and reachability properties. For QKD, the mathematical security bound, not the protocol model, carries the main proof burden. Finite-key QKD proofs in the smooth-entropy tradition (BB84 [10], decoy-state variants [66], and measurement-device-independent protocols [67]) use the same chain of entropic uncertainty relation, Quantum Leftover Hash Lemma, and sampling bounds. Formalizing this chain once provides a reusable foundation for their mechanization in the future.
Outline. The paper is organized as follows. Section II introduces the quantum-mechanical foundations, the common structure of QKD protocols, and BB84. Section III fixes the composable security model and derives the finite-key bound from the chain of entropy inequalities. Section IV describes the protocol model and connects the mathematical proof to a concrete protocol specification. Section V details the proof architecture: the module decomposition and its design for reuse. Section VI discusses proof engineering: the backend libraries, the trusted computing base, and the representation layers. Section VII presents the verification findings: a missing proof branch and competing conventions across the literature. Section VIII discusses scope and future work. Section IX concludes.
A. Quantum Foundations
Quantum states. A qubit is the quantum analog of a classical bit: a two-level quantum system that, unlike its classical counterpart, can exist in a superposition of both values simultaneously. In Dirac notation, a pure quantum state is written (a column vector), with conjugate transpose ; together they form the outer product , a rank-one matrix describing the state. The standard computational basis (also called the Z-basis) consists of the states and , corresponding to the two classical bit values. The X-basis (Hadamard basis), whose states and are superpositions of the computational-basis states, is equally important for QKD. When there is classical uncertainty about the prepared state, or when a qubit is part of a larger entangled system, the state is described by a density matrix —a positive-semidefinite matrix with unit trace ( , where denotes the matrix trace), generalizing probability distributions to the quantum setting. Composite systems of multiple parties are modeled by tensor products: a joint state describes the combined quantum system shared among Alice, Bob, and an eavesdropper [68].
Measurement and bases. Extracting classical information from a qubit requires a measurement, which produces a definite outcome but, in general, irreversibly disturbs the quantum state. The Z-basis and X-basis are conjugate: a state prepared in one basis yields a uniformly random outcome when measured in the other. For example, a qubit prepared as (a definite Z-basis state) produces the outcomes + or - with equal probability when measured in the X-basis, and the original state is destroyed in the process. This conjugacy is the physical mechanism that makes QKD possible. An eavesdropper who intercepts a qubit and measures it in the wrong basis gains no useful information and causes detectable errors in the legitimate parties' data [69].
Fidelity and distance. A security proof must give precise meaning to “the key is approximately secret,” which requires a notion of closeness between quantum states. Fidelity quantifies the overlap between two states: a fidelity of 1 means the states are identical, while 0 means they are perfectly distinguishable. The purified distance converts fidelity into a proper metric, and the -ball around a state collects all states within purified distance . The smooth entropy measures used in the security proof optimize over this neighborhood [65], [70]. The mathematical definitions of fidelity, purified distance, and smoothing appear in Definitions 12 and 15 of Appendix C, alongside their formal definitions in Rocq.
B. Components and Variants
What QKD achieves. A QKD protocol lets Alice and Bob distill a shared secret key from quantum signals exchanged over a public channel, with security derived from quantum mechanics under explicit modeling assumptions (Section III-B). The guarantee is information-theoretic: no computational assumption is needed, and the key remains secure even against a future quantum computer. The no-cloning theorem [71] (an unknown quantum state cannot be perfectly copied) prevents an eavesdropper from silently duplicating the quantum signals and forces any information-gaining interception to leave a detectable trace.
The common pipeline. Despite their differences in quantum hardware, QKD protocols share a common high-level structure: (i) source preparation, in which quantum states encoding random key material are generated; (ii) quantum transmission through an optical channel; (iii) measurement of the transmitted signals; (iv) sifting, which discards rounds where incompatible settings were used; (v) parameter estimation, which tests a random sample for evidence of eavesdropping; (vi) error correction, which reconciles the remaining raw keys; and (vii) privacy amplification, which compresses the corrected key to remove any information the eavesdropper may have gained. The differences among protocols lie in what is prepared (single photons, entangled pairs, or coherent states) and how it is measured; the classical post-processing steps are largely similar.
Variants. BB84 [1], the first QKD protocol, uses a prepare-and-measure scheme in which Alice sends individually prepared qubits to Bob. E91 [72] is an entanglement-based protocol whose security is certified by the violation of a Bell inequality. BBM92 [73] is an entanglement-based variant of BB84 that shares its post-processing structure. Subsequent extensions address practical deployment challenges: the six-state protocol [74] uses three mutually unbiased bases to tolerate a higher error rate; decoy-state methods [75] defeat photon-number-splitting attacks [76] in implementations with weak coherent pulses; and measurement-device-independent (MDI) protocols [67], [77] and twin-field protocols [78] remove the need to trust the detectors. QKD has moved beyond the laboratory to real-world deployment, including satellite-to-ground key exchange demonstrated by the Micius satellite [3], and is undergoing active standardization [4], [5].
C. BB84
Protocol steps. BB84 proceeds in five stages, applied to a block of quantum signals transmitted from Alice to Bob:
-
Preparation and measurement. Alice encodes each random key bit by preparing a qubit in one of two randomly chosen conjugate bases (Z or X) and sends it to Bob through the quantum channel. Bob measures each arriving qubit in a randomly chosen basis.
-
Sifting. Alice and Bob publicly announce their basis choices (but not the bit values) and keep only the detected rounds where both chose the same basis, yielding matching positions (n in the X basis and k in the Z basis).
-
Parameter estimation. The k Z-basis positions form the test set: Alice and Bob compare outcomes and abort if the observed bit-error rate exceeds a threshold .
-
Error correction. On the n X-basis positions, Alice sends correction information (at most leak bits) so that Bob can reconcile his key with hers; a hash-based tag confirms agreement.
-
Privacy amplification. A two-universal hash function [79] compresses the corrected n-bit string to a final key of length , removing essentially all residual information the eavesdropper may hold.
Figure 1 traces the key material through these five stages and renders the key-length bound (1) of Section III as a bit budget. Notation. We denote a protocol run by , where is the raw-key length, the number of test positions, the final key length, the error-rate threshold, the correctness parameter, and the error-correction leakage. A successful run outputs a pair of keys held by Alice and Bob; an aborted run outputs . BB84 admits two source models that differ only in the preparation step: in the prepare-and-measure (PM) variant, Alice prepares individual qubits in randomly chosen states; in the entanglement-based (EB) variant, she prepares entangled pairs and measures her half locally. The standard security analysis relates these source models, and their subsequent post-processing steps are identical. Our verified protocol result treats the source-box EB interpretation as a BB84 source choice. Section III presents the security criterion and the proof that the final key is composably secure.
III. SECURITY ANALYSIS
This section develops the mathematical backbone of the formalization. We trace the proof route from asymptotic unconditional security to the finite-key setting (Section III-A), fix a rigorous security model with composable definitions (Section III-B), and instantiate the finite-key analysis for BB84 (Section III-C).
A. Proof Routes
Historical development. Unconditional security of QKD was first established in the asymptotic limit by Lo and Chau [6] and Mayers [7], showing that information-theoretic key distribution is possible in principle. Shor and Preskill [8] simplified the argument by reducing it to quantum error correction, making the asymptotic proof accessible but leaving practical finite-size effects unaddressed. Renner [9] introduced smooth entropies to handle finite block sizes, and Tomamichel et al. [10] obtained tight composable bounds without asymptotic or de Finetti penalties. More recently, entropy accumulation theorems [80], [81] have extended finite-key techniques to broader settings, including device-independent ones, where no assumptions are made about the internal workings of Alice's and Bob's devices. Our route. FVQKD formally proves security along the smooth-entropy route of Tomamichel et al. [10], the most established route for prepare-and-measure protocols and one yielding finite-key bounds among the tightest known. Its modular proof composes three independent, separately machine-checkable components—a smooth entropic uncertainty relation, a Serfling sampling bound [64], and the Quantum Leftover Hash Lemma—into the final key-length theorem (Section III-C).
B. Security Model
Parties. Three parties participate. Alice (sender) prepares and transmits quantum states. Bob (receiver) measures them. Eve (adversary) controls the quantum channel and observes the classical channel. Alice and Bob are honest: they follow the protocol faithfully and their internal computations are private. Adversary capabilities. Eve is an unbounded quantum adversary. She exercises full control over the quantum channel: she may intercept, store, modify, or replace every quantum signal in transit, so the joint post-sifted state is entirely unrestricted. She observes all messages on the authenticated classical channel (basis announcements, error-correction data, hash choices) but cannot forge or modify them. She has unlimited computational power and unlimited quantum memory, and may perform coherent attacks across all rounds simultaneously. No restriction beyond the stated model is placed on her attack strategy; the security guarantee holds for every such strategy.
Trust assumptions. The paper’s security claims involve six conditions, surfaced at different layers of the machine-checked development:

Fig. 1. BB84 finite-key budget (schematic; bar lengths are illustrative). Sifting leaves matching-basis rounds: Z-basis rounds estimate the QBER , and X-basis rounds form the raw keys . Error correction reveals bits; privacy amplification produces the -bit -secret key . Hatching denotes terms deducted in (1), not literal key substrings.
(T1) Side-channel freedom. Alice’s and Bob’s devices are free of side channels (e.g., detector blinding [82], Trojan-horse attacks [83]). The bound models the source through the single parameter q; imperfections not captured by the declared source and measurement sets and q are outside the model.
(T2) Authenticated classical channel. An authenticated classical channel is assumed; without it, QKD is vulnerable to man-in-the-middle attacks [84]. In the information-theoretic setting, this channel can be realized from a pre-shared secret using Wegman–Carter authentication [85]. The proof treats authentication as a primitive and does not model the key consumed by it; Portmann [86] bounds the key consumed by authentication in the composable setting, and Cederlöf and Larsson [87] analyze the security loss when the authentication key is partially known to the adversary.
(T3) Source characterization. The source emits states characterized by preparation quality q, which measures basis separation. Weak-coherent-pulse sources require additional decoy-state techniques [66], [75] and are outside the current scope.
(T4) Delayed measurement. The mathematical theorem assumes that Bob’s X-basis measurements can be postponed until after parameter estimation without changing their statistics, as in the memoryless-device model of [10]. For the calibrated class in T6, the artifact proves that the state to which the uncertainty relation is applied equals the state that the protocol program produces when parameter estimation passes. The min-entropy bound therefore holds for the executed protocol.
(T5) Basis-independent detection. The no-click POVM element, and hence the detection probability, is independent of the basis choice [10]; this places the detection-efficiency loophole [88] outside the model.
(T6) Calibrated projective X/Z class. The executable endpoint is restricted to coherent pure X/Z preparations, a standard source pointer and source X-measurement, and projective Z readout.
The source and measurement characterization and q enter as theorem parameters: no security conclusion can be drawn without supplying them; T1 is the condition under which they faithfully summarize the devices. T2 is fixed by the channel model, under which Eve reads but cannot modify classical messages.
Composable security. A QKD protocol must satisfy two properties: correctness and secrecy. “Composable” means these guarantees survive when the extracted key is used as input to another protocol [89], [90], for instance as a one-time pad for encrypted communication. Both definitions quantify over all adversaries and attack strategies, regardless of computational resources.
Definition 1 ( -Correctness): The protocol is -correct if, for every adversary strategy,
where S and are Alice's and Bob's final keys.
Definition 2 ( -Secrecy): The protocol is -secret if, for every adversary,
where is the abort probability, is the joint state of the final key and the adversary conditioned on non-abort, is the maximally mixed state on the key space, and the minimum ranges over states of Eve's system.
Here denotes trace distance. The protocol is -secure if it is -correct and -secret with [10], [91]; this trace-distance criterion is universally composable [90], [92].
We write for the abort probability, for the mismatch probability, and for the probability that parameter estimation (PE) passes; all probabilities are over the protocol's randomness for a fixed adversary strategy.
Protocol inputs. The formalization exposes the following as explicit theorem inputs in Section IV:
• Certified device: the source-state family , Bob's measurement-operator family , and the preparation-quality bound .
• Sizes: n (key-generation bits), k (test bits), and M (finite round budget).
• Error tolerance: (parameter-estimation threshold).
• Error correction: leak (public leakage), (failure probability).
• Privacy amplification: (target key length).
• Security budget: (secrecy), (total); the smoothing parameter is optimized inside the key-length bound.
Verification boundary. FVQKD makes the verification boundary across T1–T6 explicit. T3 becomes an explicit device-characterization obligation; T1 is the condition under which that characterization describes the physical devices; and T2 is fixed by the modeled read-only classical channel. At the executable endpoint, T5 and T6 are device obligations, while the entropy comparison corresponding to T4 is proved within that class.
C. Finite-Key Bound
Proof setup. The security proof works in the post-sifted model: the sifted positions are modeled as a single joint quantum state across three registers (A: Alice's signal, B: Bob's quantum register, E: Eve's system). A uniform random permutation designates k positions as the test block and the remaining n as the key block. Measurements on the key block produce the n-bit raw keys X, for Alice and Bob.
Smooth entropies. The conditional min-entropy measures randomness in A hidden from E; for classical A, is the adversary's optimal guessing probability [93]. The conditional max-entropy measures the information needed to reconstruct A from B [94]. Their smoothed forms and optimize over states within purified distance of and require ; this domain condition surfaces a mechanization finding in Section VII.
Entropic uncertainty. The central tool linking Alice’s raw key to Eve’s information is the smooth entropic uncertainty relation.
If two quantum states have trace distance at most , no physical experiment can distinguish them with probability better than .
Theorem 3 (Entropic Uncertainty Relation): Let be a tripartite quantum state whose register A comprises n signal rounds, and let be two per-round measurements. The strings X and Z obtained by measuring each round of A with or , respectively, satisfy, for any ,
Here is the preparation quality.
The EUR [95] states that the total uncertainty across two complementary measurements is at least n times the preparation quality. In operational terms: the more Eve knows about the raw key X (small ), the less predictable the conjugate string Z is given Bob's quantum register (large ), and vice versa. Parameter estimation bounds via the observed error rate; the EUR then yields a lower bound on —the input to privacy amplification.
Privacy amplification. The classical Leftover Hash Lemma [85], [96] guarantees that hashing a source with sufficient min-entropy through a two-universal family [79] produces a nearly uniform key. The Quantum LHL extends this guarantee to an adversary holding quantum side information: the smooth min-entropy determines the extractable key length.
Definition 4 (Two-Universal Hash Family): A family of functions from to is two-universal if, for any two distinct inputs and a uniformly chosen ,
Theorem 5 (Quantum Leftover Hash Lemma): Let be a classical–quantum state with for some , and let be a finite two-universal family with range . For a uniformly chosen , the extracted key satisfies
where the register F records the hash choice and the minimum ranges over states .
The LHL [97] converts min-entropy into secrecy: any key shorter than (up to logarithmic corrections) is indistinguishable from uniform up to the bound above, even against a quantum adversary who learns which hash was chosen.
Preparation quality. The preparation quality measures the overlap between the two bases, as defined for general POVMs in Theorem 3; for pure states it reduces to . The mathematical theorem remains parametric in , whereas the executable endpoint specializes to the ideal-overlap projective class of T6. Main theorem. Combining the EUR, the Serfling sampling bound, and the LHL yields the composable finite-key security bound for BB84; Table II collects the notation.
Theorem 6 (BB84 Finite-Key Bound): Let be the BB84 protocol of
TABLE II NOTATION FOR THE BB84 FINITE-KEY SECURITY BOUND
| Symbol | Description |
|---|---|
| protocol | |
| raw-key (key-round) and test (PE-round) sizes; total sifted size | |
| final-key length; tolerated bit-error rate | |
| smoothing-ball radius; correctness and secrecy parameters | |
| error-correction leakage (bits); preparation quality ( for ideal BB84) | |
| Alice's/Bob's -bit raw-key strings (X-basis key rounds); boldface denotes strings | |
| conjugate-basis (Z-basis) outcomes on key rounds | |
| adversary's quantum side information; final keys ( on abort) | |
| post-sifted Alice-Bob-Eve joint state | |
| Serfling sampling correction; truncated binary entropy |
Section II-C with preparation quality . Assume , , , and .
(i) is -correct.
(ii) is -secret if
where is the Serfling correction and is the binary entropy, truncated to for (clamping ensures more errors never yield more key).
The bound [10] subtracts sampling-corrected noise , error-correction leakage , and privacy-amplification and verification costs from quantum uncertainty ; (1) specializes the optimized bound in Theorem 10 to .
Proof sketch. The EUR gives . Serfling's sampling bound yields ; data processing gives , hence . The LHL turns this lower bound into secrecy, while the chain rule charges the disclosed bits and verification bits. Verification hashing proves correctness because differing corrected keys have matching tags with probability at most . Apart from logarithmic security terms, the bound's only finite-size loss is , which Tomamichel et al. argue any finite-sample error-rate estimate must pay [10]. Working directly with smooth entropies and sampling without replacement avoids asymptotic-equipartition and de Finetti penalties; Section IV gives the corresponding protocol-level obligations.
IV. PROTOCOL MODEL
Section II described QKD as five stages (preparation and measurement, sifting, parameter estimation, error correction, and privacy amplification), and Section III proved security bounds on the quantum state that passes through them. But a security proof in isolation certifies only that a quantum state satisfies a secrecy bound; it does not specify which protocol produces that state. This section introduces a programming language that captures the behavior of each phase. Precise semantics let us state and verify properties (correctness, secrecy, abort) as formal theorems. The protocol layer connects what a QKD protocol does (Section II) to what a security proof certifies (Section III). The resulting theorem quantifies over every initial state and every transcript-dependent adversary channel.
A. Syntax
We assume a finite quantum variable set and a finite classical variable set . Quantum registers are lists of distinct quantum variables, so a command can act on a whole register block. The core language is deliberately small: it separates classical computation, random sampling, quantum initialization, quantum measurement, and the adversarial quantum-channel action. The syntax can also express the control flow of prepare-and-measure and entanglement-based protocols. Appendix A gives paper-level pseudocode schemas inspired by six-state, B92, BBM92, and E91.
Definition 7 (Syntax): A finite quantum program is generated by the following syntax:
Atomic constructs include: skip is the empty command; is the classical assignment, samples a classical value from the distribution , initializes the quantum register to the state , performs quantum measurement on and stores the outcome in , and Attack[] applies an arbitrary adversarial channel to together with Eve's memory. Two structural constructs are for sequential composition, and if then else for conditionals. For convenience, we use the following syntactic sugar for fixed-round loops, which is sufficient for describing QKD protocols:
The leading skip makes the empty loop a well-formed identity map rather than an empty sequence. Protocol listings number rounds from one and write FOR , for the relabeled unrolling .
B. Semantics
Classical-quantum state (cq-state). We follow [45], [98] and represent cq-states as functions from classical memories to quantum states. Let Val be a finite set of values, and let be a classical memory, and let be a partial (i.e., sub-normalized) density operator on . A normalized cq-state is a function with ; we write for the set of these states. We write for the possibly sub-normalized singleton cq-state concentrated at , i.e., and if . Any cq-state can be decomposed as a sum of singleton states: .
Semantics of the adversary. We assume a designated classical variable that collects the public transcript, and a sufficiently large quantum system that models both the environment and the adversary's local quantum memory. Adversary action is modeled by a function , where is the set of quantum channels, that is, completely positive trace-preserving maps, on for the attacked registers . For every Attack command, the adversary applies to : the adversary may choose its action depending on the public transcript , but the action cannot depend on any other classical variable or act on any quantum variable outside and . The adversary reads but cannot rewrite , which is T2 in operational form. The security of the protocol is then established over all adversary actions .
Definition 8 (Denotational Semantics): Given an adversary action , the denotational semantics of a well-formed finite program is . The semantics extends linearly to sub-normalized cq-states. Its auxiliary action on a singleton state is and returns a sub-normalized cq-state of total mass :
•
•
• \left[\left[x \xleftarrow{\}\mu\right]\right]^{\mathrm{aux}}(\sigma, \rho) = \sum_v (\sigma[x \mapsto v], \left[\mu\right]_{\sigma}(v) \cdot \rho);
•
where is a quantum measurement, i.e., a family of measurement operators with ;
•
• ;
•
• so that
Distribution, state, and measurement arguments are expressions, evaluated in the current classical memory . Classical value expressions are functions , and guards are functions . A program is well-formed when, in every classical memory, each sampling distribution is a probability distribution on Val, each initial state is a density operator of trace one, each measurement satisfies , and every initialized, measured, or attacked register set is disjoint from ; for well-formed programs, maps into . For every well-formed command and positive cq-state, the semantics preserves total mass, so maps well-formed cq-states to well-formed cq-states.
C. QKD and BB84
We now specialize the QKD phases of Section II to the [10] BB84 protocol and write each phase as syntactic sugar using the primitive language in Definition 7. Let , , let be the distribution on with these probabilities, and let be uniform on . Unif(S) denotes the uniform distribution on a nonempty finite set , so . Write . The protocol's symbol is the realized stopping counter, defined as the least round after which and . The formal protocol language represents iteration by finite unrolling, so in the program below denotes a fixed round budget (an explicit model parameter); a run whose budget ends with or aborts at the parameter-estimation test. Because the budget is fixed, the loop needs no per-round announcements to decide termination, so the program publishes all sifting announcements in one Announce step after the loop; announcing bases while quantum rounds are in flight is also known to invalidate the random-sampling step of finite-key proofs [99].
Definition 9 (QKD component sugar): For round i, write for Bob's detection flag. We abbreviate parameter estimation, error correction, and privacy amplification by ParamEst, ErrCorr, and PrivAmp . The per-round components expand as follows:
\mathrm{P r e p}_{i}(\rho)\triangleq a_{i}\xleftarrow{\}~\mu_{\mathbb{B}}~;;y_{i}\xleftarrow{\}~\mu_{2}~;;q_{i}\leftarrow\rho_{a_{i},y_{i}}, \mathrm{M e a s}_{i}(\mathcal{M})\triangleq b_{i}\xleftarrow{\}~\mu_{\mathbb{B}}~;;y_{i}^{\prime}:=\mathcal{M}_{b_{i}}[q_{i}],After the loop terminates, the announcement and classical post-processing components are
\mathrm{P a r a m E s t}\triangleq K\xleftarrow{\}~\begin{cases}{\mathsf{U n i f}(\mathcal{K}_{n}(\mathcal{X}))}&{\mathrm{i f}|\mathcal{X}|\geq n}\\ {\delta_{\perp}}&{\mathrm{o t h e r w i s e}}\\ \end{cases}; g\xleftarrow{\}Unif(\mathcal{G}_{\varepsilon_{c}});;t_{A}:=g(X_{A});;t_{B}:=g(\widehat{X});; \mathrm{P r i v A m p}_{\ell}\triangleq f\xleftarrow{\}~\mathrm{U n i f}(\mathcal{F}_{\ell});Here is the BB84 source expression, and is Bob's measurement expression. In ParamEst, is the point distribution at : when the budget leaves , the raw-key sample defaults to , making the sampling command total on every branch. The estimate is carried as the numerator-denominator pair shown, and the test
in Figure 2 denotes the cross-multiplied comparison , well defined even when . The expression denotes the fixed information-reconciliation scheme, chosen before the protocol run. Applied to the realized raw-key pair, it produces a public transcript of length at most and Bob's estimate . The family is the two-universal verification hash family with output length , and is the two-universal privacy-amplification family. The transcript records the authenticated public data used by this abstraction: basis and detection announcements needed for sifting, the raw-key subset and test bits used for parameter estimation, error-correction data, the verification hash seed and Alice's tag, and the privacy-amplification seed. The bit values in the raw-key subset are never appended to .
BB84( ) :=
1 ; ; ; abort := false
2 FOR ,
3
4 Announce
5 ParamEst
6 if
then Abort else
7 ErrCorr
8 if then Abort else
9 PrivAmp
Fig. 2. BB84 written with the QKD component sugar of Definition 9. The loop is the finite unrolling through the round budget M. The abort test on line 6 subsumes the sifting condition of [10]: a run whose budget ends with or aborts, so post-processing continues only when that condition holds. The raw key comes from a uniformly chosen size-n subset of , while the parameter-estimation error rate is computed from all detected matching Z-basis rounds in , as in the original protocol definition.
D. Security Theorem
Let be the program source expression, and let be Bob's measurement expression. We write for the program of Figure 2 with these expressions, and subscript the semantics of Definition 8 with the adversary strategy it is taken under. For any initial cq-state and adversary strategy , let
be the terminal state of Figure 2, and its abort probability. When , let be the normalized verification-accepted output state. Here is the public privacy-amplification seed, shown separately, and comprises Eve's final quantum memory and the remaining public transcript. The abort probability is . The state retains the key, seed, Eve's quantum memory, and public transcript, conditioned on abort = false.
Theorem 10 (Protocol Security): Assume Src and M are certified with preparation quality q. The executable endpoint is restricted to the calibrated projective X/Z device class T6 and assumes basis-independent detection T5. Within this class, the artifact proves the entropy comparison corresponding to T4. Assume , , , , and . Assume error correction leaks at most bits, verification is two-universal with tag length , and privacy amplification is two-universal. For the constants of Tomamichel et al. [10], if
where
and is the truncated binary entropy, then for every initial cq-state and every adversary strategy :
-
the output is either on the abort branch (abort = true and ) or on the amplified-key branch (abort = false and );
-
the protocol is -correct,
- if , the normalized verification-accepted output is -secret:
If , this secrecy clause holds because its prefactor vanishes.
Consequently BB84 is -secure in the sense of Definitions 1 and 2.
Sifting, parameter estimation, and verification are program branches, not external theorem premises: a run that ends undersifted ( or ), fails the tolerance test, or fails verification produces .
Theorem 11 (BB84 Instance): For the concrete calibrated projective X/Z instance with the ideal Hadamard source , round budget , , , , , and , this BB84 instance is -secure with and key length .
In this instance, the key length is positive, all numeric side conditions are concrete, and an identity-adversary run has positive success probability in either source mode. At these parameters, the artifact proves that the right-hand side of the key-length condition in Theorem 10 is at least 2625, which certifies the chosen key length .
V. PROOF ARCHITECTURE
The security analysis of Section III decomposes the finite-key bound into three independent proof ingredients (the smooth entropic uncertainty relation, the Serfling sampling bound, and the Quantum Leftover Hash Lemma), composed by a single algebraic chain. The module structure of FVQKD formalizes this decomposition: each proof ingredient becomes a self-contained, verified component, and the top-level module composes them into the security theorems.
A. Overview
Five modules sit in dependency order (Figure 3; size counts in Table III):
utils supplies quantum primitives missing from the foundation libraries: matrix and operator-norm extensions, the set-labeled CoQQ layer, bit-string and probability infrastructure, purification and Stinespring dilation [100], fidelity, purified distance, and the Serfling sampling bound. entropy formalizes the smooth-entropy calculus of [65] on top of these primitives, including the smooth conditional entropies and and their duality; eur formally proves an uncertainty relation linking and , while lhl bounds the key's distance from uniform in terms of . entropy also contains a self-contained proof of SDP strong duality (the primal direction of Tomamichel's Theorem 2.6: value equality plus primal-optimizer attainment), built from first principles and used in the LHL proof. To our knowledge, it is the first explicit machine-checked strong-duality theorem specialized to semidefinite programs. eur and lhl formalize the two main theorems of the proof sketch: the smooth entropic uncertainty relation [95] and the Quantum Leftover Hash Lemma [97], respectively. qkd composes them with the Serfling bound from utils to close the algebraic chain into the main theorems for correctness, secrecy, and combined -security.
The first four modules are protocol-independent: no definition or theorem in them assumes BB84 or any specific protocol. The four lower modules are reusable by other QKD variants as well as other applications in quantum information and cryptography.
The protocol-specific top layer. The qkd module has three submodules, two independent and one that ties them together. bb84/ formalizes the main theorem of Tomamichel et al. [10] by combining the results from the four lower modules into the security theorems (Figure 4 in Appendix B). protocol/ defines the language for QKD protocols. example/ instantiates the protocol language for BB84 and formally proves its security using the theorems in bb84/, closing the chain from protocol definition to machine-checked security proof. It further instantiates the protocol with concrete, physically meaningful parameters, demonstrating that the security theorem yields a positive key length at realistic finite block sizes.
B. Design Features
Two features matter for the rest of the development. First, modular reusable theorem interfaces keep the BB84 layer from absorbing the protocol-independent mathematics below it. Each lower module exports a small set of statement-matched theorems for smooth min-/max-entropy and purified-distance reasoning, the smooth EUR, the Quantum LHL, and

Foundation libraries
Fig. 3. Module dependency graph. The structure mirrors the proof sketch of Section III-C: eur and lhl are mutually independent; inside qkd, bb84 depends on the lower proof modules, and example depends on both the protocol language in protocol and the BB84 theorem layer in bb84.
the Serfling finite-sampling bound, with side conditions stated in the formal signatures rather than left to context. The qkd layer imports these results as sealed theorems; its composition proof uses them as established facts rather than unfolding their derivations. Because the lower layers quantify over abstract states, systems, measurements, channels, hash families, and sampling distributions, they contain no BB84-specific theorem content. They form verified infrastructure that QKD variants following the same smooth-entropy proof route can instantiate rather than re-derive.
Decoy-state BB84 [75], for instance, is widely used in deployed weak-coherent-pulse systems. Wiesemann et al. [101] give a finite-size one-/two-decoy proof in the smooth-EUR framework of Tomamichel and Renner, so FVQKD's smooth-entropy, purified-distance, EUR, and LHL interfaces should carry over. What is not present is the decoy layer itself: weak-coherent-source and intensity semantics, photon-number and detection statistics, multi-intensity parameter estimation, and the resulting key-length calculation. We expect closely related variants (six-state [74], qudit BB84) to reuse the entropy chain; SARG04 [102] would additionally require modified sifting statistics, and MDI-QKD [67], [77] admits a smooth-EUR-based proof but brings additional structural requirements.
Second, certification-ready protocol extraction turns the informal protocol specification in the published analysis into a checked formal specification. Finite-key QKD analyses often specify the protocol at the level needed for the proof, not at the level needed to certify an implementation. Notation can blur distinct roles: for instance, the symbol M in the BB84 paper [10] reads like a protocol parameter but is actually a loop counter determined at run time. FVQKD instead gives BB84 a command language with separate classical and quantum variables and the semantics of Section IV-B, specifying each stage's inputs, outputs, and continuation checks. The protocol-security theorem takes a certified device and model assumptions that expose the source model, measurement family, preparation quality, leakage bound, and verification and privacy-amplification hash requirements. Certifying that a device satisfies these hypotheses suffices to instantiate the composable security guarantee for that device (Theorem 10).
VI. PROOF ENGINEERING
The previous section described what the mechanization proves; this section turns to how it is built.
A. Backend and Trusted Computing Base
FVQKD is built on three Rocq libraries that together supply the mathematical and quantum-mechanical substrate. MATHCOMP [103] provides the algebraic backbone: finite types, big operators, rings, fields, matrices, and the SSReflect proof style. MATHCOMP-ANALYSIS [104] extends it with the analytic machinery the entropy arguments require: real and extended-real numbers, suprema and infima, topology, limits, continuity, exponentials, logarithms, and convexity. CoQQ [27] contributes the finite-dimensional quantum layer: Hilbert spaces, tensor products, quantum operators, density and positivity predicates, channels, traces, norms, spectral decompositions, the partial trace, and labeled Dirac notation for multi-system management. All three libraries use canonical structures for notation overloading and hierarchy navigation, a pattern FVQKD inherits throughout.
FVQKD develops the smooth-entropy, purified-distance, smooth-EUR, and Quantum-LHL infrastructure needed by the finite-key BB84 proof. FVQKD builds this entire layer from scratch: 102 302 lines of new, fully verified code.
Trusted computing base. Our TCB comprises solely the Rocq kernel and three standard MATHCOMP-ANALYSIS axioms (propositional extensionality, functional extensionality, and constructive indefinite description). Continuous integration rebuilds the 151K-line codebase and mechanically verifies via Print Assumptions that no additional axioms or admitted obligations enter the development.
B. Representation Choices
The mechanization operates at three representation levels: bare matrices (full computational access), typed linear maps (operator algebra with domain/codomain tracking), and label-indexed operators (subsystem selection by name via CoQQ's Dirac notation). Each successive level is closer to textbook notation but further from direct computation. Coercion lemmas, proved once in utils and reused across the development, translate between levels so that each proof step can work at the most convenient abstraction.
C. Artifact Summary
The development builds on Rocq 9.1.1, MATHCOMP 2.5.0, MATHCOMP-ANALYSIS 1.16.0, and CoQQ; CoQQ is pinned to the in-tree vendored snapshot. Table III gives per-module file, source-line, and result counts.
The artifact builds from source with make; make full-check additionally runs a Print Assumptions
TABLE III DEVELOPMENT SIZE AND TRUSTED BASE
| Module | Files | LoC | Results |
|---|---|---|---|
| utils | 21 | 24719 | 542 |
| entropy | 17 | 50427 | 559 |
| eur | 5 | 8461 | 93 |
| lhl | 8 | 18695 | 214 |
| qkd | 16 | 48448 | 1085 |
| Total | 67 | 150750 | 2493 |
LoC counts physical source lines; Results counts non-local top-level Theorem, Lemma, and Corollary declarations. The four upper rows (approximately 68% of the development by LoC) are protocol-independent; the qkd row is the protocol layer (language, BB84 security theorems, and examples). No Admitted occurs anywhere in the tree; the trusted base is the Rocq kernel plus three MATHCOMP-ANALYSIS axioms (Section VI-A).
check confirming that the security theorems depend on exactly the three axioms listed above. The artifact is available at https://github.com/fvqkd/FVQKD.
VII. VERIFICATION FINDINGS
Mechanization forces every side condition to be stated and discharged; published proofs sometimes leave conditions implicit when the intended reading is clear to domain experts. This section catalogues the conditions the formalization exposed, organized into two categories: missing proof branches (Section VII-A) and competing conventions across the literature (Section VII-B).
A. Missing Proof Branches
The smooth entropies and are defined by optimizing over quantum states within purified distance of the input state . This optimization is well-defined only when [65]; for a normalized state the condition reduces to .
The BB84 security proof applies the entropic uncertainty relation (EUR) after conditioning on the parameter-estimation test passing. Conditioning on the pass event renormalizes the state and rescales the smoothing parameter to . The published analysis [10] states “” without checking the upper bound . An active adversary that forces frequent aborts can push to or below. The rescaled parameter then exceeds unity: with and , one obtains , and the EUR is applied outside its domain.
This does not compromise the security guarantee: in the offending regime the protocol aborts with overwhelming probability, so the prefactor of Theorem 2 already bounds the secrecy term. The issue is that the published argument invokes a theorem in a regime where its hypotheses are not satisfied. The formalization resolves this by introducing an explicit domain predicate and splitting the secrecy proof into two branches: one where the EUR applies and one where the high abort probability makes the bound trivial. This case split is absent from the pen-and-paper argument; formal verification catches it because every side condition must be discharged before the proof is accepted.
TABLE IV SMOOTH-ENTROPY DEFINITIONS ACROSS THE BB84 PROOF CHAIN
| Paper | Ball | Entropy | Smooth | ||
|---|---|---|---|---|---|
| Finite-key [10] | = | = | P | eq/eq | eq/eq |
| EUR [95] | ≤ | ≤ | P | id/eq | id/eq |
| LHL [97] | = | = | P | eq/eq | eq/eq |
| Duality [105] | = | = | P | eq/eq | eq/eq |
| Renner [9] | = | = | D | eq/neq | eq/neq |
| Chain rules [106] | ≤ | ≤ | P | id/eq | id/eq |
= normalized only; sub-normalized allowed; P purified-distance ball; D generalized trace-distance ball. Finite-key imports definitions by citing Duality. Entropy and smoothing entries give min-/max-entropy verdicts: “id” = identical to the FVQKD definition; “eq” = equivalent but not identical; “neq” = not equivalent.
Separately, the published proof [10] derives its entropy bound after parameter estimation passes, whereas the final key is conditioned on error verification also accepting. FVQKD makes this second conditioning explicit: it transfers the entropy bound to the accepted branch, or, when acceptance is too unlikely, closes the secrecy argument directly from the protocol's abort probability. Both cases retain the published key-length formula.
B. Competing Conventions
The BB84 security proof chains theorems from six theoretical treatments, each of which makes its own definitional choices for smooth entropies. Table IV compares these choices along two axes: the smoothing-ball metric and the witness domain for conditional entropies.
Smoothing-ball metric. Five of the six treatments define smoothing balls using purified distance; Renner [9] instead uses a relative trace-distance ball on sub-normalized operators. Because the balls differ, using a result from one convention in the other requires a separate comparison argument. The formalization follows Tomamichel's purified-distance convention, matching the BB84 paper [10]. The exact smooth min/max duality used here,
relies on the purification-lifting property of purified-distance balls, which Renner's trace-distance convention does not satisfy. This duality relates Eve's uncertainty to Bob's error rate. Optimization domain. Conditional min-entropy is sensitive to the domain chosen for the conditioning witness ; FVQKD uses the equivalent SDP witness form. The EUR [95] and chain rules [106] allow sub-normalized , and FVQKD corresponds to this convention through its SDP form; the remaining four restrict to normalized states. The entropy value is the same either way—the optimum over the larger set is attained at a normalized witness—but the distinction matters for formal composition: a lemma proved for normalized does not apply directly to a statement that quantifies over sub-normalized ones. The mechanization therefore fixes one definition per concept and bridges convention differences with coercion lemmas at theorem boundaries. The checked definitions and their mathematical readings appear in Table VI of Appendix C. The literature has responded to this definitional scatter: a monograph consolidates the conventions [70], and a largely self-contained proof assembles the QKD security argument in one place [107]; both remain pen-and-paper.
VIII. DISCUSSION
Scope. The proof certifies the information-theoretic security argument: the chain from smooth entropies through the EUR and the Quantum Leftover Hash Lemma to a composable finite-key bound. Device-level vulnerabilities (detector blinding, photon-number splitting, Trojan-horse attacks) and implementation-level side channels are out of scope under the published model [10]; the theorem applies only once a device model justifies the supplied source and measurement parameters (Section III-B). The entropy infrastructure is protocol-independent, and BB84 is verified end to end; proving security for another protocol on the same smooth-entropy route requires a new top layer over the existing core.
Future work. Three concrete extensions lie beyond the current scope, each requiring substantial new libraries. Entropy accumulation [80] (the standard framework for device-independent proofs, also underlying recent prepare-and-measure proofs [108]) would reuse FVQKD's LHL but needs a Rényi chain-rule library. Numerical security frameworks [109], [110] need a verified convex-optimization layer, of which FVQKD's SDP strong duality theorem provides a core ingredient. Continuous-variable QKD [111] operates in infinite-dimensional Hilbert spaces and requires an extension with no analog in the current development. Beyond these, connecting FVQKD's explicit source and measurement obligations (Section III-B) to a verified device model would narrow the remaining gap between the information-theoretic bound and a deployed system.
IX. CONCLUSION
FVQKD provides, to our knowledge, the first end-to-end, machine-checked QKD security proof: composable finite-key BB84 security at Tomamichel et al.'s tight bound [10], with zero incomplete proofs and only three standard axioms inherited from MATHCOMP-ANALYSIS for classical logic. The result connects the quantum-information-theoretic bound to a formal model of protocol execution through a complete, kernel-checked proof chain. Establishing it required reconstructing the proof chain from first principles and supplying side conditions that the published argument leaves implicit, one of which revealed a missing proof branch in an analysis on which later finite-key proofs build. The resulting verified, reusable smooth-entropy framework, EUR, Quantum LHL, and Serfling bound expose every source and measurement assumption as an explicit theorem parameter and provide the foundation for decoy-state, measurement-device-independent, and other QKD protocols that follow the same proof route. Physics-based security and machine-checked proofs together strengthen the basis for QKD deployment amid standardization.
ACKNOWLEDGMENT
Generative AI tools (mainly GPT-5.4, GPT-5.5, and Claude Opus 4.6) were employed under human direction to assist with Rocq proof engineering, manuscript improvement and grammar enhancement, and the preparation of figures, charts, and Appendix C. All formal artifacts were mechanically verified by the Rocq type checker, and the authors retain sole responsibility for the work.
REFERENCES
[1] C. H. Bennett and G. Brassard, “Quantum cryptography: Public key distribution and coin tossing,” in Proceedings of the International Conference on Computers, Systems and Signal Processing, 1984, pp. 175–179.
[2] Association for Computing Machinery, “2025 ACM A.M. Turing Award: Charles H. Bennett and Gilles Brassard recognized for their essential role in establishing the foundations of quantum information science and transforming secure communication and computing,” https://awards.acm.org/about/2025-turing, Mar. 2026, accessed: 2026-05-28.
[3] S.-K. Liao, W.-Q. Cai, W.-Y. Liu, L. Zhang, Y. Li, J.-G. Ren, J. Yin, Q. Shen, Y. Cao, Z.-P. Li, F.-Z. Li, X.-W. Chen, L.-H. Sun, J.-J. Jia, J.-C. Wu, X.-J. Jiang, J.-F. Wang, Y.-M. Huang, Q. Wang, Y.-L. Zhou, L. Deng, T. Xi, L. Ma, T. Hu, Q. Zhang, Y.-A. Chen, N.-L. Liu, X.-B. Wang, Z.-C. Zhu, C.-Y. Lu, R. Shu, C.-Z. Peng, J.-Y. Wang, and J.-W. Pan, “Satellite-to-ground quantum key distribution,” Nature, vol. 549, no. 7670, pp. 43–47, Sep 2017. [Online]. Available: https://doi.org/10.1038/nature23655
[4] ETSI Industry Specification Group Quantum Key Distribution, "Quantum Key Distribution (QKD); Security Proofs," European Telecommunications Standards Institute, ETSI Group Specification ETSI GS QKD 005 V1.1.1, Dec. 2010. [Online]. Available: https://www.etsi.org/deliver/etsi_gs/QKD/001_099/005/01.01.01_60/gs_qkd005v010101p.pdf
[5] ISO/IEC JTC 1/SC 27, “Information security – Security requirements, test and evaluation methods for quantum key distribution – Part 1: Requirements,” International Organization for Standardization and International Electrotechnical Commission, International Standard ISO/IEC 23837-1:2023, Aug. 2023. [Online]. Available: https://www.iso.org/standard/77097.html
[6] H.-K. Lo and H. F. Chau, “Unconditional security of quantum key distribution over arbitrarily long distances,” Science, vol. 283, no. 5410, pp. 2050–2056, 1999. [Online]. Available: https://www.science.org/doi/abs/10.1126/science.283.5410.2050
[7] D. Mayers, “Unconditional security in quantum cryptography,” J. ACM, vol. 48, no. 3, p. 351–406, May 2001. [Online]. Available: https://doi.org/10.1145/382780.382781
[8] P. W. Shor and J. Preskill, “Simple proof of security of the BB84 quantum key distribution protocol,” Phys. Rev. Lett., vol. 85, pp. 441–444, Jul 2000. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.85.441
[9] R. Renner, “Security of quantum key distribution,” International Journal of Quantum Information, vol. 06, no. 01, pp. 1–127, 2008. [Online]. Available: https://doi.org/10.1142/S0219749908003256
[10] M. Tomamichel, C. C. W. Lim, N. Gisin, and R. Renner, “Tight finite-key analysis for quantum cryptography,” Nature Communications, vol. 3, no. 1, p. 634, Jan 2012. [Online]. Available: https://doi.org/10.1038/ncomms1631
[11] M. Berta, F. G. S. L. Brandão, G. Gour, L. Lami, M. B. Plenio, B. Regula, and M. Tomamichel, “On a gap in the proof of the generalised quantum Stein’s lemma and its consequences for the reversibility of quantum resources,” Quantum, vol. 7, p. 1103, Sep. 2023. [Online]. Available: https://doi.org/10.22331/q-2023-09-07-1103
[12] T. Vidick, “Erratum: Three-player entangled XOR games are NP-hard to approximate,” SIAM Journal on Computing, vol. 49, no. 6, pp. 1423–1427, 2020. [Online]. Available: https://doi.org/10.1137/20M1368598
[13] D. Tupkary, E. Y.-Z. Tan, S. Nahar, L. Kamin, and N. Lütkenhaus, "Security proofs for practical QKD: Variations, techniques, gaps, and limitations," Rev. Mod. Phys., vol. 98, p. 035003, Sep 2026. [Online]. Available: https://link.aps.org/doi/10.1103/28rs-frmw
[14] D. Tupkary, S. Nahar, A. Arqand, E. Y. Z. Tan, and N. Lütkenhaus, "A rigorous and complete security proof of decoy-state BB84 quantum key distribution," 2026. [Online]. Available: https://arxiv.org/abs/2601.18035
[15] J.-K. Zinzindohoué, K. Bhargavan, J. Protzenko, and B. Beurdouche, "HACL*: A verified modern cryptographic library," in Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, ser. CCS '17. New York, NY, USA: Association for Computing Machinery, 2017, p. 1789–1806. [Online]. Available: https://doi.org/10.1145/3133956.3134043
[16] J. Protzenko, B. Parno, A. Fromherz, C. Hawblitzel, M. Polubelova, K. Bhargavan, B. Beurdouche, J. Choi, A. Delignat-Lavaud, C. Fournet, N. Kulatova, T. Ramananandro, A. Rastogi, N. Swamy, C. M. Wintersteiger, and S. Zanella-Beguelin, "EverCrypt: A fast, verified, cross-platform cryptographic provider," in 2020 IEEE Symposium on Security and Privacy (SP), 2020, pp. 983–1002.
[17] G. Klein, K. Elphinstone, G. Heiser, J. Andronick, D. Cock, P. Derrin, D. Elkaduwe, K. Engelhardt, R. Kolanski, M. Norrish, T. Sewell, H. Tuch, and S. Winwood, “seL4: formal verification of an OS kernel,” in Proceedings of the ACM SIGOPS 22nd Symposium on Operating Systems Principles, ser. SOSP '09. New York, NY, USA: Association for Computing Machinery, 2009, p. 207–220. [Online]. Available: https://doi.org/10.1145/1629575.1629596
[18] X. Leroy, “Formal verification of a realistic compiler,” Commun. ACM, vol. 52, no. 7, p. 107–115, Jul. 2009. [Online]. Available: https://doi.org/10.1145/1538788.1538814
[19] P. G. Haselwarter, E. Rivas, A. Van Muylder, T. Winterhalter, C. Abate, N. Sidorenco, C. Hriću, K. Maillard, and B. Spitters, “SSProve: A foundational framework for modular cryptographic proofs in Coq,” ACM Trans. Program. Lang. Syst., vol. 45, no. 3, Jul. 2023. [Online]. Available: https://doi.org/10.1145/3594735
[20] D. A. Basin, A. Lochbihler, and S. R. Sefidgar, “CryptHOL: Game-based proofs in higher-order logic,” Journal of Cryptology, vol. 33, no. 2, pp. 494–566, Apr 2020. [Online]. Available: https://doi.org/10.1007/s00145-019-09341-z
[21] G. Barthe, B. Grégoire, S. Heraud, and S. Z. Béguelin, “Computer-aided security proofs for the working cryptographer,” in Advances in Cryptology – CRYPTO 2011, P. Rogaway, Ed. Berlin, Heidelberg: Springer Berlin Heidelberg, 2011, pp. 71–90.
[22] B. Blanchet, “A computationally sound mechanized prover for security protocols,” IEEE Trans. Dependable Secur. Comput., vol. 5, no. 4, p. 193–207, Oct. 2008. [Online]. Available: https://doi.org/10.1109/TDSC.2007.1005
[23] M. Barbosa, G. Barthe, K. Bhargavan, B. Blanchet, C. Cremers, K. Liao, and B. Parno, “SoK: Computer-Aided Cryptography,” in 2021 IEEE Symposium on Security and Privacy (SP), 2021, pp. 777–795.
[24] D. Baelde, S. Delaune, C. Jacomme, A. Koutsos, and S. Moreau, “An interactive prover for protocol verification in the computational model,” in 2021 IEEE Symposium on Security and Privacy (SP), 2021, pp. 537–554.
[25] K. Bhargavan, A. Bichhawat, Q. H. Do, P. Hosseyni, R. Küsters, G. Schmitz, and T. Würtele, “DY*: A modular symbolic verification framework for executable cryptographic protocol code,” in 2021 IEEE European Symposium on Security and Privacy (EuroS&P), 2021, pp. 523–542.
[26] T. Wallez, J. Protzenko, and K. Bhargavan, “TreeKEM: A modular machine-checked symbolic security analysis of group key agreement in Messaging Layer Security,” in 2025 IEEE Symposium on Security and Privacy (SP), 2025, pp. 4375–4390.
[27] L. Zhou, G. Barthe, P.-Y. Strub, J. Liu, and M. Ying, “CoqQ: Foundational verification of quantum programs,” Proc. ACM Program. Lang., vol. 7, no. POPL, Jan. 2023. [Online]. Available: https://doi.org/10.1145/3571222
[28] M. Ying, “Chapter 3 - syntax and semantics of quantum programs,” in Foundations of Quantum Programming. Boston: Morgan Kaufmann, 2016, pp. 61–102. [Online]. Available: https://www.sciencedirect.com/science/article/pii/B9780128023068000033
[29] J. Paykin, R. Rand, and S. Zdancewic, “QWIRE: a core language for quantum circuits,” in Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, ser. POPL '17. New York, NY, USA: Association for Computing Machinery, 2017, p. 846–858. [Online]. Available: https://doi.org/10.1145/3009837.3009894
[30] R. Rand, J. Paykin, D. Lee, and S. Zdancewic, “ReQWIRE: Reasoning about reversible quantum circuits,” in Proceedings 15th International Conference on Quantum Physics and Logic, QPL 2018, Halifax, Canada, 3-7th June 2018, ser. EPTCS, P. Selinger and G. Chiribella, Eds., vol. 287, 2018, pp. 299–312. [Online]. Available: https://doi.org/10.4204/EPTCS.287.17
[31] K. Hietala, R. Rand, S.-H. Hung, X. Wu, and M. Hicks, “A verified optimizer for quantum circuits,” Proc. ACM Program. Lang., vol. 5, no. POPL, Jan. 2021. [Online]. Available: https://doi.org/10.1145/3434318
[32] Y. Peng, K. Hietala, R. Tao, L. Li, R. Rand, M. Hicks, and X. Wu, “A formally certified end-to-end implementation of Shor’s factorization algorithm,” Proceedings of the National Academy of Sciences, vol. 120, no. 21, p. e2218775120, 2023. [Online]. Available: https://www.pnas.org/doi/abs/10.1073/pnas.2218775120
[33] A. Lehmann, B. Caldwell, B. Shah, W. Spencer, and R. Rand, “VyZX: Formal verification of a graphical quantum language,” ACM Trans. Program. Lang. Syst., vol. 48, no. 3, Jul. 2026. [Online]. Available: https://doi.org/10.1145/3807780
[34] B. Coecke and R. Duncan, “Interacting quantum observables: categorical algebra and diagrammatics,” New Journal of Physics, vol. 13, no. 4, p. 043016, Apr 2011. [Online]. Available: https://dx.doi.org/10.1088/1367-2630/13/4/043016
[35] A. Kissinger and J. van de Wetering, “PyZX: Large scale automated diagrammatic reasoning,” in Proceedings 16th International Conference on Quantum Physics and Logic, QPL 2019, Chapman University, Orange, CA, USA, June 10-14, 2019, ser. EPTCS, B. Coecke and M. Leifer, Eds., vol. 318, 2019, pp. 229–241. [Online]. Available: https://doi.org/10.4204/EPTCS.318.14
[36] B. Shah, W. Spencer, L. Zielinski, B. Caldwell, A. Lehmann, and R. Rand, “ViCAR: Visualizing categories with automated rewriting in Coq,” Electronic Proceedings in Theoretical Computer Science, vol. 429, pp. 234–248, Sep. 2025. [Online]. Available: http://dx.doi.org/10.4204/EPTCS.429.13
[37] A. Bordg, H. Lachnitt, and Y. He, “Certified quantum computation in Isabelle/HOL,” Journal of Automated Reasoning, vol. 65, no. 5, pp. 691–709, Jun 2021. [Online]. Available: https://doi.org/10.1007/s10817-020-09584-7
[38] —, “Isabelle marries Dirac: a library for quantum computation and quantum information,” Archive of Formal Proofs, November 2020, https://isa-afp.org/entries/Isabelle_Marries_Dirac.html, Formal proof development.
[39] J. Liu, B. Zhan, S. Wang, S. Ying, T. Liu, Y. Li, M. Ying, and N. Zhan, “Formal verification of quantum algorithms using quantum Hoare logic,” in Computer Aided Verification, I. Dillig and S. Tasiran, Eds. Cham: Springer International Publishing, 2019, pp. 187–207.
[40] C. Chareton, S. Bardin, F. Bobot, V. Perrelle, and B. Valiron, “An automated deductive verification framework for circuit-building quantum programs,” in Programming Languages and Systems, N. Yoshida, Ed. Cham: Springer International Publishing, 2021, pp. 148–177.
[41] M. Amy, “Towards large-scale functional verification of universal quantum circuits,” in Proceedings 15th International Conference on Quantum Physics and Logic, QPL 2018, Halifax, Canada, 3-7th June 2018, ser. EPTCS, P. Selinger and G. Chiribella, Eds., vol. 287, 2018, pp. 1–21. [Online]. Available: https://doi.org/10.4204/EPTCS.287.1
[42] C. Zhu, Z. Tang, G. Zhen, Y. Cao, Y. Zhao, R. Chen, X. Zhao, L. Zhang, and X. Wang, “Lean-QIT: Towards a formal infrastructure for quantum information theory,” 2026. [Online]. Available: https://arxiv.org/abs/2607.09632
[43] D. Unruh, “Quantum relational Hoare logic,” Proc. ACM Program. Lang., vol. 3, no. POPL, Jan. 2019. [Online]. Available: https://doi.org/10.1145/3290346
[44] —, “Post-quantum verification of Fujisaki-Okamoto,” in Advances in Cryptology – ASIACRYPT 2020, S. Moriai and H. Wang, Eds. Cham: Springer International Publishing, 2020, pp. 321–352.
[45] M. Barbosa, G. Barthe, X. Fan, B. Grégoire, S.-H. Hung, J. Katz, P.-Y. Strub, X. Wu, and L. Zhou, “EasyPQC: Verifying post-quantum cryptography,” in Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security, ser. CCS ’21. New York, NY, USA: Association for Computing Machinery, 2021, p. 2564–2586. [Online]. Available: https://doi.org/10.1145/3460120.3484567
[46] C. Cremers, C. Fontaine, and C. Jacomme, “A logic and an interactive prover for the computational post-quantum security of protocols,” in 2022 IEEE Symposium on Security and Privacy (SP), 2022, pp. 125–141.
[47] T. Kubota, Y. Kakutani, G. Kato, and Y. Kawano, “A formal approach to unconditional security proofs for quantum key distribution,” in Unconventional Computation, C. S. Calude, J. Kari, I. Petre, and G. Rozenberg, Eds. Berlin, Heidelberg: Springer Berlin Heidelberg, 2011, pp. 125–137.
[48] T. Kubota, Y. Kakutani, G. Kato, Y. Kawano, and H. Sakurada, “Semi-automated verification of security proofs of quantum cryptographic protocols,” Journal of Symbolic Computation, vol. 73, pp. 192–220, 2016. [Online]. Available: https://www.sciencedirect.com/science/article/pii/S0747717115000462
[49] J. Boender, F. Kammüller, and R. Nagarajan, “Formalization of quantum protocols using Coq,” in Proceedings of the 12th International Workshop on Quantum Physics and Logic, Oxford, U.K., July 15-17, 2015, ser. Electronic Proceedings in Theoretical Computer Science, C. Heunen, P. Selinger, and J. Vicary, Eds., vol. 195. Open Publishing Association, 2015, pp. 71–83.
[50] F. Kammüller, “QKD in Isabelle – Bayesian calculation,” 2019. [Online]. Available: https://arxiv.org/abs/1905.00325
[51] A. Baliuka, “formal-qkd: Formal proofs about quantum key distribution using the Lean proof assistant,” 2026, github repository, accessed 2026-05-29. [Online]. Available: https://github.com/adomasbaliuka/formal-qkd
[52] R. Nagarajan, N. Papanikolaou, G. Bowen, and S. Gay, “An automated analysis of the security of quantum key distribution,” 2005. [Online]. Available: https://arxiv.org/abs/cs/0502048
[53] P. Baltazar, R. Chadha, and P. Mateus, “Quantum computation tree logic - model checking and complete calculus,” International Journal of Quantum Information, vol. 6, no. 2, pp. 219–236, Apr. 2008.
[54] S. J. Gay, R. Nagarajan, and N. Papanikolaou, “QMC: A model checker for quantum systems,” in Computer Aided Verification, A. Gupta and S. Malik, Eds. Berlin, Heidelberg: Springer Berlin Heidelberg, 2008, pp. 543–547.
[55] L. Hirschi, “Symbolic abstractions for quantum protocol verification,” CoRR, vol. abs/1904.04186, 2019. [Online]. Available: http://arxiv.org/abs/1904.04186
[56] T. Prévost, B. Martin, and O. Alibart, “Formal verification of the ETSI proposal on a standard QKD protocol,” in GTMFS 2024, Saint-Pierre-d’Oléron, France, Apr. 2024. [Online]. Available: https://univ-cotedazur.hal.science/hal-04624766
[57] A. H. Malik, R. H. Anwar, and M. T. Raza, “Beyond the quantum promise: A security analysis of classical control in quantum key distribution,” 2026. [Online]. Available: https://arxiv.org/abs/2608.07626
[58] A. Meiburg, L. A. Lessa, and R. R. Soldati, “A formalization of the generalized quantum Stein’s lemma in Lean,” 2025. [Online]. Available: https://arxiv.org/abs/2510.08672
[59] R. Affeldt, M. Hagiwara, and J. Sénizergues, “Formalization of Shannon’s theorems,” Journal of Automated Reasoning, vol. 53, no. 1, pp. 63–103, Jun 2014. [Online]. Available: https://doi.org/10.1007/s10817-013-9298-1
[60] A. Lochbihler, S. R. Sefidgar, D. Basin, and U. Maurer, “Formalizing constructive cryptography using CryptHOL,” in 2019 IEEE 32nd Computer Security Foundations Symposium (CSF), 2019, pp. 152–166.
[61] T. Zhao and N. Yu, “Formalizing CHSH rigidity in Lean 4,” 2026. [Online]. Available: https://arxiv.org/abs/2604.03884
[62] M. Echenim and M. Mhalla, “A formalization of the CHSH inequality and Tsirelson’s upper-bound in Isabelle/HOL,” Journal of Automated Reasoning, vol. 68, no. 1, p. 2, Dec 2023. [Online]. Available: https://doi.org/10.1007/s10817-023-09689-9
[63] The Rocq Development Team, “rocq-prover/rocq: Rocq 9.1.1,” Feb. 2026. [Online]. Available: https://doi.org/10.5281/zenodo.18554917
[64] R. J. Serfling, “Probability Inequalities for the Sum in Sampling without Replacement,” The Annals of Statistics, vol. 2, no. 1, pp. 39–48, 1974. [Online]. Available: https://doi.org/10.1214/aos/1176342611
[65] M. Tomamichel, “A framework for non-asymptotic quantum information theory,” 2013. [Online]. Available: https://arxiv.org/abs/1203.2142
[66] C. C. W. Lim, M. Curty, N. Walenta, F. Xu, and H. Zbinden, “Concise security bounds for practical decoy-state quantum key distribution,” Phys. Rev. A, vol. 89, p. 022307, Feb 2014. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevA.89.022307
[67] M. Curty, F. Xu, W. Cui, C. C. W. Lim, K. Tamaki, and H.-K. Lo, “Finite-key analysis for measurement-device-independent quantum key distribution,” Nature Communications, vol. 5, no. 1, p. 3732, Apr 2014. [Online]. Available: https://doi.org/10.1038/ncomms4732
[68] M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information: 10th Anniversary Edition. Cambridge University Press, 2010.
[69] S. Wiesner, “Conjugate coding,” SIGACT News, vol. 15, no. 1, p. 78–88, Jan. 1983. [Online]. Available: https://doi.org/10.1145/1008908.1008920
[70] M. Tomamichel, Quantum Information Processing with Finite Resources. Springer International Publishing, 2016. [Online]. Available: http://dx.doi.org/10.1007/978-3-319-21891-5
[71] W. K. Wootters and W. H. Zurek, “A single quantum cannot be cloned,” Nature, vol. 299, no. 5886, pp. 802–803, Oct 1982. [Online]. Available: https://doi.org/10.1038/299802a0
[72] A. K. Ekert, “Quantum cryptography based on Bell’s theorem,” Phys. Rev. Lett., vol. 67, pp. 661–663, Aug 1991. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.67.661
[73] C. H. Bennett, G. Brassard, and N. D. Mermin, “Quantum cryptography without Bell’s theorem,” Phys. Rev. Lett., vol. 68, pp. 557–559, Feb 1992. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.68.557
[74] D. Bruß, “Optimal eavesdropping in quantum cryptography with six states,” Phys. Rev. Lett., vol. 81, pp. 3018–3021, Oct 1998. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.81.3018
[75] H.-K. Lo, X. Ma, and K. Chen, “Decoy state quantum key distribution,” Phys. Rev. Lett., vol. 94, p. 230504, Jun 2005. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.94.230504
[76] G. Brassard, N. Lütkenhaus, T. Mor, and B. C. Sanders, “Limitations on practical quantum cryptography,” Phys. Rev. Lett., vol. 85, pp. 1330–1333, Aug 2000. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.85.1330
[77] H.-K. Lo, M. Curty, and B. Qi, “Measurement-device-independent quantum key distribution,” Phys. Rev. Lett., vol. 108, p. 130503, Mar 2012. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.108.130503
[78] M. Lucamarini, Z. L. Yuan, J. F. Dynes, and A. J. Shields, “Overcoming the rate-distance limit of quantum key distribution without quantum repeaters,” Nature, vol. 557, no. 7705, pp. 400–403, May 2018. [Online]. Available: https://doi.org/10.1038/s41586-018-0066-6
[79] J. L. Carter and M. N. Wegman, “Universal classes of hash functions,” Journal of Computer and System Sciences, vol. 18, no. 2, pp. 143–154, 1979. [Online]. Available: https://www.sciencedirect.com/science/article/pii/0022000079900448
[80] F. Dupuis, O. Fawzi, and R. Renner, “Entropy accumulation,” Communications in Mathematical Physics, vol. 379, no. 3, pp. 867–913, Nov 2020. [Online]. Available: https://doi.org/10.1007/s00220-020-03839-5
[81] T. Metger and R. Renner, “Security of quantum key distribution from generalised entropy accumulation,” Nature Communications, vol. 14, no. 1, p. 5272, Aug 2023. [Online]. Available: https://doi.org/10.1038/s41467-023-40920-8
[82] L. Lydersen, C. Wiechers, C. Wittmann, D. Elser, J. Skaar, and V. Makarov, “Hacking commercial quantum cryptography systems by tailored bright illumination,” Nature Photonics, vol. 4, no. 10, pp. 686–689, Oct 2010. [Online]. Available: https://doi.org/10.1038/nphoton.2010.214
[83] N. Gisin, S. Fasel, B. Kraus, H. Zbinden, and G. Ribordy, "Trojan-horse attacks on quantum-key-distribution systems," Phys. Rev. A, vol. 73, p. 022320, Feb 2006. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevA.73.022320
[84] K. G. Paterson, F. C. Piper, and R. Schack, “Quantum cryptography: A practical information security perspective,” in Quantum Communication and Security, M. Zukowski, S. Kilin, and J. Kowalik, Eds. IOS Press, 2007, pp. 175–180. [Online]. Available: https://eprint.iacr.org/2004/156
[85] M. N. Wegman and J. L. Carter, “New hash functions and their use in authentication and set equality,” Journal of Computer and System Sciences, vol. 22, no. 3, pp. 265–279, 1981. [Online]. Available: https://www.sciencedirect.com/science/article/pii/0022000081900337
[86] C. Portmann, “Key recycling in authentication,” IEEE Transactions on Information Theory, vol. 60, no. 7, pp. 4383–4396, 2014.
[87] J. Cederlöf and J.-Å. Larsson, “Security aspects of the authentication used in quantum cryptography,” IEEE Transactions on Information Theory, vol. 54, no. 4, pp. 1735–1741, 2008.
[88] V. Makarov, A. Anisimov, and J. Skaar, “Effects of detector efficiency mismatch on security of quantum cryptosystems,” Phys.
Rev. A, vol. 74, p. 022313, Aug 2006. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevA.74.022313
[89] R. Canetti, “Universally composable security: a new paradigm for cryptographic protocols,” in Proceedings 42nd IEEE Symposium on Foundations of Computer Science, 2001, pp. 136–145.
[90] C. Portmann and R. Renner, “Security in quantum cryptography,” Rev. Mod. Phys., vol. 94, p. 025008, Jun 2022. [Online]. Available: https://link.aps.org/doi/10.1103/RevModPhys.94.025008
[91] C. Ferradini, M. Sandfuchs, R. Wolf, and R. Renner, “Defining security in quantum key distribution,” 2025. [Online]. Available: https://arxiv.org/abs/2509.13405
[92] R. Renner and R. König, “Universally composable privacy amplification against quantum adversaries,” in Theory of Cryptography, J. Kilian, Ed. Berlin, Heidelberg: Springer Berlin Heidelberg, 2005, pp. 407–425.
[93] R. König, R. Renner, and C. Schaffner, “The operational meaning of min- and max-entropy,” IEEE Trans. Inf. Theor., vol. 55, no. 9, p. 4337–4347, Sep. 2009. [Online]. Available: https://doi.org/10.1109/TIT.2009.2025545
[94] J. M. Renes and R. Renner, “One-shot classical data compression with quantum side information and the distillation of common randomness or secret keys,” IEEE Transactions on Information Theory, vol. 58, no. 3, pp. 1985–1991, 2012.
[95] M. Tomamichel and R. Renner, “Uncertainty relation for smooth entropies,” Phys. Rev. Lett., vol. 106, p. 110506, Mar 2011. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.106.110506
[96] R. Impagliazzo and D. Zuckerman, “How to recycle random bits,” in 30th Annual Symposium on Foundations of Computer Science, 1989, pp. 248–253.
[97] M. Tomamichel, C. Schaffner, A. Smith, and R. Renner, “Leftover hashing against quantum side information,” IEEE Transactions on Information Theory, vol. 57, no. 8, pp. 5524–5535, 2011.
[98] Y. Feng and M. Ying, “Quantum Hoare logic with classical variables,” ACM Transactions on Quantum Computing, vol. 2, no. 4, Dec. 2021. [Online]. Available: https://doi.org/10.1145/3456877
[99] C. Pfister, N. Lütkenhaus, S. Wehner, and P. J. Coles, “Sifting attacks in finite-size quantum key distribution,” New Journal of Physics, vol. 18, no. 5, p. 053001, apr 2016. [Online]. Available: https://doi.org/10.1088/1367-2630/18/5/053001
[100] W. F. Stinespring, “Positive functions on -algebras,” Proceedings of the American Mathematical Society, vol. 6, no. 2, p. 211–216, Apr. 1955. [Online]. Available: http://dx.doi.org/10.1090/S0002-9939-1955-0069403-4
[101] J. Wiesemann, J. Krause, D. Tupkary, N. Lütkenhaus, D. Rusca, and N. Walenta, “A consolidated and accessible security proof for finite-size decoy-state quantum key distribution,” Quantum, vol. 10, p. 2037, Mar. 2026. [Online]. Available: https://doi.org/10.22331/q-2026-03-23-2037
[102] V. Scarani, A. Acín, G. Ribordy, and N. Gisin, “Quantum cryptography protocols robust against photon number splitting attacks for weak laser pulse implementations,” Phys. Rev. Lett., vol. 92, p. 057901, Feb 2004. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.92.057901
[103] A. Mahboubi and E. Tassi, Mathematical Components. Zenodo, Sep. 2022. [Online]. Available: https://doi.org/10.5281/zenodo.7118596
[104] R. Affeldt, C. Cohen, M. Kerjean, A. Mahboubi, D. Rouhling, and K. Sakaguchi, “Competing inheritance paths in dependent type theory: A case study in functional analysis,” in Automated Reasoning, N. Peltier and V. Sofronie-Stokkermans, Eds. Cham: Springer International Publishing, 2020, pp. 3–20.
[105] M. Tomamichel, R. Colbeck, and R. Renner, “Duality between smooth min- and max-entropies,” IEEE Transactions on Information Theory, vol. 56, no. 9, pp. 4674–4681, 2010.
[106] A. Vitanov, F. Dupuis, M. Tomamichel, and R. Renner, “Chain rules for smooth min- and max-entropies,” IEEE Transactions on Information Theory, vol. 59, no. 5, pp. 2603–2612, May 2013.
[107] M. Tomamichel and A. Leverrier, “A largely self-contained and complete security proof for quantum key distribution,” Quantum, vol. 1, p. 14, Jul. 2017. [Online]. Available: https://doi.org/10.22331/q-2017-07-14-14
[108] L. Kamin, A. Arqand, I. George, N. Lütkenhaus, and E. Y.-Z. Tan, “Finite-size analysis of prepare-and-measure and decoy-state quantum key distribution via entropy accumulation,” PRX Quantum, vol. 6, p. 020342, Jun 2025. [Online]. Available: https://link.aps.org/doi/10.1103/PRXQuantum.6.020342
[109] A. Winick, N. Lütkenhaus, and P. J. Coles, “Reliable numerical key rates for quantum key distribution,” Quantum, vol. 2, p. 77, Jul. 2018. [Online]. Available: https://doi.org/10.22331/q-2018-07-26-77
[110] I. George, J. Lin, and N. Lütkenhaus, “Numerical calculations of the finite key rate for general quantum key distribution protocols,” Phys. Rev. Res., vol. 3, p. 013274, Mar 2021. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevResearch.3.013274
[111] A. Leverrier, “Composable security proof for continuous-variable quantum key distribution with coherent states,” Phys. Rev. Lett., vol. 114, p. 070501, Feb 2015. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.114.070501
[112] C. H. Bennett, “Quantum cryptography using any two nonorthogonal states,” Phys. Rev. Lett., vol. 68, pp. 3121–3124, May 1992. [Online]. Available: https://link.aps.org/doi/10.1103/PhysRevLett.68.3121
APPENDIX A QKD VARIANT PROGRAM SCHEMAS
To illustrate the protocol language beyond BB84, we give pseudocode schemas inspired by six-state [74], B92 [112], BBM92 [73], and E91 [72]. They show how prepare-and-measure and entanglement-based control patterns can be written using the same command forms. The protocol-specific states, measurements, and classical routines remain parameters.
The first three schemas share the following control flow; only their round bodies, announcements, sifting rules, and optional extra tests vary. E91 replaces parameter estimation with the Bell-test tail shown below.
Variant(round, announce, sift, extra_fail := false): P := {}; X := {}; Z := {}; abort := false for i = 1, ..., M: round(i) announce; sift; ParamEst fail := |X| < n or |Z| < k or lambda > Q_tol if fail or extra_fail then Abort else: ErrCorr if t_A != t_B then Abort else PrivAmp_l
Six-state-style schema. The three-setting state and measurement families are parameters.
round(i): a_i <- Unif({0,1}) q_i <- source[a_i,y_i]; Attack[q_i] b_i <- Unif({T subset W | |T| = min(k, |W|)}) X := W \ Z; Announce(Z)
B92-style schema. The two distinct nonorthogonal source states and a three-outcome unambiguous-discrimination interface are parameters.
round(i): r_i <- Unif({0,1}) q_i <- source[y_i]; Attack[q_i] y'_i := meas[q_i] d_i := (y'_i != inconclusive) announce := Announce((r_i,d_i)_i) sift: X := {j in {1,...,M} | d_j and r_j = key} Z := {j in {1,...,M} | d_j and r_j = test}
BBM92-style schema. The pair state and the common two-setting measurement family are parameters.
round(i): (q_i^A, q_i^B) <- pair[i]; Attack[q_i^A, q_i^B] a_i <- Unif({0,1}) y_i := meas[a_i][q_i^A]; y'_i := meas[b_i][q_i^B] d_i := (y_i != empty and y'_i != empty) announce := Announce((a_i,b_i,d_i)_i) sift: W := {j in {1,...,M} | d_j and a_j = b_j} Z <- $Unif({T subset W | |T| = min(k, |W|)}) X := W \ Z; Announce(Z)
E91-style schema. The pair state, the two three-setting measurement families, and a threshold are parameters. Round indices are one-based, but setting labels remain zero-based: denotes Alice's angles , whereas denotes Bob's angles . Detected outcomes are encoded as bits in , with empty denoting nondetection.
E91: P := {}; X := {}; R := {}; abort := false for i = 1, ..., M: (q_i^A, q_i^B) <- pair[i]; Attack[q_i^B] a_i <- Unif({0,1,2}) y_i := meas_A[a_i][q_i^A]; y'_i := → meas_B[b_i][q_i^B] d_i := (y_i != empty and y'_i != empty) X := {j <= i | d_j and (a_j,b_j) in → {(1,0), (2,1)} R := {j <= i | d_j and (a_j,b_j) not in → {(1,0), (2,1)} Announce((a_i,b_i,d_i)_i, (y_j,y'_j)_j in R}) derive A_uw, N_uw from the revealed R rounds for (u,w) in {(0,0), (0,2), (2,0), (2,2)} if |X| < n or some N_uw = 0 then Abort else: E_uw := (2*A_uw-N_uw)/N_uw for each CHSH class S_CHSH := E_00 - E_02 + E_20 + E_22 if |S_CHSH| < beta_CHSH then Abort else: K <- $Unif({T subset X | |T| = n}); → Announce(K) X_A := (y_j)_j in K); X_B := (1-y'_j)_j in → K} ErrCorr if t_A != t_B then Abort else PrivAmp_l
After the nonempty-class guard, for the agreement count and detected total . The sketch omits a finite-statistics correction for this test.
APPENDIX B
MECHANIZATION OF THE BB84 SECURITY CRITERION
This appendix records the proof-structure map, its correspondence with the supplementary notes of [10], and the paper-to-Rocq correspondence table. The smooth-entropy convention comparison appears in Section VII-B.
A. Proof structure and correspondence
bb84_secret establishes Supplementary Theorem 2: it derives the smooth min-entropy bound from the source model's POVM and overlap fields, the EUR, delayed measurement, and the aggregate sampling witness, then proves secrecy of the normalized accepted output through leakage, postselection, and privacy amplification. bb84_secure combines this result with -correctness from bb84_correct and applies . The secrecy proof follows Supplementary Note 1 of [10], presented here in eight steps:
Claim
By 1 definition 2 EUR 3 smooth DPI 4 statistical 5 2-4, chain rule 6 PA 7 6, key length (Thm. 10) 8 rescale
Secrecy derivation inside bb84_secret (Supplementary Note 1). X: Alice's raw key; Z, Z': hypothetical ,

Fig. 4. Proof-dependency graph for the BB84 security proof. Each box names a source-paper theorem, lemma, or proof topic together with the corresponding Rocq declaration name(s). Node prefixes identify the source literature: bb84 is Tomamichel–Lim–Gisin–Renner's finite-key BB84 proof [10], eur is Tomamichel–Renner's smooth entropic uncertainty relation [95], and ent is Tomamichel's entropy framework/thesis [65]; the source-paper prefix and TeX label are separated by a slash. An arrow means supports the proof of . Every arrow is a dependency in the Rocq proofs; lighter arrows cross between branches of the proof tree. The top layer identifies bb84_secure as the combined theorem of Tomamichel et al. and shows its reusable correctness and full secrecy boundaries; the lower layers expand the EUR, smooth-entropy, purified-distance/fidelity, data-processing-inequality (DPI), and convex-analysis support used by bb84/thm:sec.
(EUR conjugate basis); : Bob's quantum register on key rounds; : adversary pre-EC; : adversary post-EC. Row 5 abbreviates . In Rocq, step 2 is entropic_uncertainty_relation_bb84, and step 6 is privacy_amplification.
The remaining components correspond as follows: Supplementary Theorem 1 (correctness) is the reusable bb84_correct; Supplementary Lemma 3 (statistical) is stat in qkd/bb84/prop.v; and the classical-leakage chain rule is chain_rule_class. Supplementary Theorem 2 corresponds to bb84_secret; bb84_secure combines it with bb84_correct under , and bb84_secure_protocol is the independent protocol-layer culmination. The culminating theorem depends only on the standard MATHCOMP-ANALYSIS foundations (Section VI-A).
B. Paper-to-Rocq correspondence
Table V maps each numbered security and protocol statement in the body to the Rocq declaration that establishes it or to the model premise that represents it.
TABLE V PAPER-TO-ROCQ CORRESPONDENCE
| Paper | Statement | Rocq name |
|---|---|---|
| Def. 1 | -correctness | eps_correct |
| Def. 2 | -secrecy | eps_secret |
| Defs. 1, 2 | -security | eps_secure |
| Thm. 3 | Smooth EUR | entropic_uncertainty_relation |
| Def. 4 | Two-universal hash | two_univ |
| Thm. 5 | Quantum LHL | two_universal_hashing |
| Thm. 6 | BB84 security | bb84_secure |
| Def. 7 | Protocol cmds | qkd_cmd |
| Fig. 2 | BB84 program | bb84_program |
| Def. 8 | Protocol sem. | bb84_eval |
| Thm. 10 | Protocol security | bb84_secure_protocol |
| Thm. 11 | Non-vacuous instance | bb84_secure_example |
APPENDIX C TRUSTED SPECIFICATION
Because the Rocq kernel checks every proof, a reader needs to trust only the definitions and theorem statements on which the security results depend. This appendix lists them, each as a declaration from the artifact beside its mathematical reading.
A. Main Theorems
We begin with bb84_secure and bb84_secure_protocol, followed by every project-defined object used transitively in their statements.
- Endpoints: Mathematical Security.
TABLE VI
TRUSTED SPECIFICATION OF THE SECURITY RESULTS.
Main theorem: combined finite-key composition interface.
Formal statement
src/qkd/bb84/bb84.v: bb84_secure Variable R : realType. Variable (L : finType) (HL : L -> chsType). Variable (S E Zkey Bq Zp F1 Zl : {set L}). Hypothesis disSE : [disjoint S & E]. Hypothesis disSF : [disjoint S & F1]. Hypothesis disSZl : [disjoint S & Zl]. Hypothesis disZBq : [disjoint Zkey & Bq]. Hypothesis disZZp : [disjoint Zkey & Zp]. Hypothesis disFZl : [disjoint F1 & Zl]. Variable Aux : @bb84_aux_regs R L HL Zkey Bq Zp. Theorem bb84_secure (P : bb84_protocol) (q eps_s eps_tot : R) (Gsrc : bb84_zsource P) (src : bb84_source_model P q) (dim_S : bb84_src_nx src = dim ('H[HL]S)) (dim_E : bb84_src_nb src = dim ('H[HL]E)) (dim_Zk : bb84_src_nz src = dim ('H[HL]Zkey)) (dim_Bq : bb84_src_nc src = dim ('H[HL]Bq)) (dim_Zp_key : (2 ^ bb84_n P) % N = dim ('H[HL]Zp)) (BobZ : 'QC[HL](Bq, Zp)) (p_abort mismatch_prob : R) (seed_count tag_count : nat) (verify_hash : 'I_seed_count -> 'I(2 ^ bb84_n P) -> 'I_tag_count) (corr_prob : 'I(2 ^ bb84_n P) -> 'I(2 ^ bb84_n P) -> R) (p_mismatchE : mismatch_prob = @p_mismatch R (2 ^ bb84_n P) seed_count tag_count → verify_hash corr_prob) (verify_tag_count_pos : (0 < tag_count) % N) (verify_two_univ : @two_univ R __ __ verify_hash) (corr_nonneg : forall x x', 0 <= corr_prob x x') (corr_mass : \sum_x \sum(x' | x != x') corr_prob x x' <= 1) (verify_tag_inv_le_epsc : ((tag_count% : R : R) ^ -1 <= bb84_eps_c P) % R) (Fh : 'Idx[HL]_F1 -> 'Idx[HL]_S -> 'Idx[HL]_Zl) (Fh_two_univ : @two_univ R __ __ Fh) (Fh_key_dim : dim ('H[HL]_Zl) = (2 ^ bb84_1 P) % N)
The source, two hash-family predicates, mismatch probability, and register dimensions are expanded in the statement-definition rows below. The auxiliary-register record is expanded in Table VI.
Mathematical reading
Main finite-key theorem (Theorem 6): interface. The statement fixes a full-string source and a source model with
, \quad \dim , , \quad \dim , , , \quad , , \quad , , \quad .
It takes the auxiliary registers of Table VI, Bob's delayed Z channel, nonnegative correlation weights with total off-diagonal mass at most one, a nonempty two-universal verification family satisfying , and a nonempty two-universal privacy-amplification family with .
Main theorem: accepted state, premises, and conclusion.
Formal statement
src/qkd/bb84/bb84.v: bb84_secure (continued) (Epub : {set L}) (pub : bb84_public_leakage Epub (eur_rho_XB disSE (bb84_src_rho src) (@bb84_src_M R P q → src) (bb84_register_pair_dim disSE dim_S dim_E)) (bb84_leak_EC P + log2 (2% : R / bb84_eps_c P))) (disSEpub : [disjoint S & E : |: Epub]) (disEpubF : [disjoint E : |: Epub & F1]) (disEpubZl : [disjoint E : |: Epub & Zl]) (disZl_FEpub : [disjoint Zl & (F1 : |: (E : |: Epub))]) (accept reject : 'F[HL](S : |: (E : |: Epub))) (rho_out : 'F[HL](Zl : |: (F1 : |: (E : |: Epub)))) (Haccept_psd : accept \is psdlf) (Hreject_psd : reject \is psdlf) (Haccept_cq : @is_cq_state R L HL S (E : |: Epub) accept) (Hsplit : accept + reject = castlf (bb84_public_assoc S E Epub, bb84_public_assoc S E → Epub)
Mathematical reading
Main finite-key theorem (Theorem 6): conclusion. Let be the certified public-leakage state and let be its accepted and rejected blocks. The output registers satisfy
, , .
The state premises are
and, whenever ,
If positive source-pass mass implies the delayed-measurement condition and
(bb84_public_state pub))
(Hout_psd : rho_out \is psdlf)
(Hout_tr : @complex.Re R (\Tr rho_out) <= 1)
(Hout :
0 < @complex.Re R (\Tr accept) ->
rho_out =
((@complex.Re R (\Tr accept))^(-1)%:C * :
post_hash_state disSEpub Fh accept)
(Hnum : bb84_numeric_side P) :
(0 < bb84_p_pass_tot Gsrc ->
bb84_delayed_measurement_condition BobZ
(eur_rho_ZC disZBq (bb84_src_rho src) (@bb84_src_N R P q
-> src)
(bb84_register_pair_dim disZBq dim_Zk dim_Bq))
(@bb84_rhoZZ_pass_mixH R L HL Zkey Zp disZZp
P Gsrc
(bb84_source_zkey_dim dim_Zk)
dim_Zp_key)) ->
bb84_pass_prob_le p_abort
(bb84_p_pass_tot Gsrc * @complex.Re R (\Tr accept)) ->
(0 < bb84_n P) %N -> (0 < bb84_k P) %N ->
bb84_eps_c P + eps_s <= eps_tot ->
(0 < eps_s) && (eps_s <= 1) ->
(bb84_l P) %:R <=
sup (fun m : R =>
exists eps ebar : R,
0 < eps / \ eps < 1 / \ 0 < ebar / \ eps + ebar <= eps_s /
m = ((floor (bb84_key_length_ub (bb84_n P) (bb84_k P) q
(bb84_Qtol P) eps ebar (bb84_leak_EC P)
(bb84_eps_c P)) %:~R : R)) ->
eps_secure mismatch_prob (bb84_eps_c P) rho_out eps_s p_abort
-> eps_tot.
Remark. The theorem is stated directly in terms of the verification distribution and the secrecy state. The component theorems appear in the next subsection.
then the numeric, error-budget, and optimized key-length premises yield Secure.
Protocol Security
Protocol endpoint: ambient model and device context.
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/example/example.v: BB84SecureProtocol section contextVariable R : realType.Variable P : @bb84_protocol R.Variable q : R.Variable dev : bb84_certified_device P q.Variable LE : finType.Variable HE : LE -> chsType.Notation M := (bb84_round_limit P).Notation L := (bb84_label M LE bb84_register_index).Notation HL := (@bb84_label_space R M LEbb84_register_index HE (@bb84_register_space R P q dev)).Notation V := (bb84_val M (bb84_n P) (bb84_l P)(cd_ir_bits dev) (cd_vseed_count dev)(cd_tag_count dev) (cd_paseed_count dev).Notation Eve := (@bb84_Eve R P LE).Notation Ereg := (@bb84_E R P LE).Notation Zl := (@bb84_Zl R P LE).Notation Fl := (@bb84_Fl R P LE).Notation Ppub := (@bb84_Ppub R P LE).Hypothesis Hclass : @bb84_projective_xz_device R P q dev.Hypothesis Hn : (0 < bb84_n P) %N.Hypothesis Hk : (0 < bb84_k P) %N.Hypothesis Hround_pos : (0 < M) %N.Every notation above is expanded in the statement-definition rows below. | Protocol Security: ambient context. The endpoint fixes a protocol P, overlap parameter q, certified device, external register space, and round budget M = round_limit(P). Its concrete classical values and labelled quantum registers are determined from these objects, and the device satisfies the projective X/Z class with n, k, M > 0. |
Protocol endpoint: conditional end-to-end security.
Formal statement
src/qkd/example/example.v: bb84_secure_protocol
Corollary bb84_secure_protocol (entangled : bool) (eps_s eps_tot
→ : R)
(Hec_pos : 0 < bb84_eps_c P) (Hec_lel : bb84_eps_c P <= 1) :
bb84_eps_c P + eps_s <= eps_tot ->
(0 < eps_s) && (eps_s <= 1) ->
(bb84_l P) % : R <=
sup (fun m : R =>
exists eps ebar : R,
0 < eps / \ eps < 1 / \ 0 < ebar / \ eps + ebar <= eps_s /
m = ((floor (bb84_key_length_ub (bb84_n P) (bb84_k P) q
(bb84_Qtol P) eps ebar (bb84_leak_EC P)
(bb84_eps_c P)) % : ~R : R) ->
forall (EA : @adversary R L HL V Eve)
(xi_init : @cq_state R L HL (bb84_cvar M) V),
cq_wf xi_init ->
let xi_out := bb84_eval_mode entangled EA xi_init in
let p_abort :=
@run_abort_prob R L HL (bb84_cvar M) V (@BVabort M)
bb84_bool_val xi_out in
let p_pass :=
@run_pass_prob R L HL (bb84_cvar M) V (@BVabort M)
bb84_bool_val xi_out in
let p_mismatch :=
@run_output_mismatch_prob R L HL (bb84_cvar M) V
(@BVS M) (@BVSh M) (@BVabort M) bb84_bool_val xi_out in
[/ \ (forall (h : @run_history V M) (s : @store (bb84_cvar M)
→ V),
bb84_branch_shape h s),
p_abort + p_pass = 1
& @eps_secure R L HL Z1 (Fl : |: (Ereg : |: Ppub))
p_mismatch (bb84_eps_c P)
(rhoZFEpub_eval_mode entangled EA xi_init)
eps_s p_abort eps_tot].
Remark. The conclusion packages branch shape, abort/pass partition, and eps_secure. The certified-device fields cd_tag_le and cd_tag_bits, expanded in Table VI, discharge both tag inequalities internally at the canonical target bb84_eps_c P. Its device-class premise, evaluator, terminal-store predicate, run probabilities, and normalized output are expanded in Table VI; the key-length functional is expanded in Table VI.
Mathematical reading
Protocol Security (Theorem 10). The formal endpoint assumes
PXZ(dev), n, k, M > 0, 0 < ε_c ≤ 1, 0 < ε_s ≤ 1, ε_c + ε_s ≤ ε_tot, ℓ ≤ , wf(ξ_init). ε +
Under these premises, every adversary and well-formed run satisfies
p_abort + p_pass = 1, Pr[S ≠ ] ≤ ε_c, (1 - p_abort) d_u(ρ_SF_PA_E+) ≤ ε_s, ε_c + ε_s ≤ ε_tot,
and every terminal store has either the abort shape S = or the non-abort equalities recorded by branch_shape.
- Mathematical Closure: Auxiliary Registers.
Auxiliary registers of the mathematical theorem.
Formal statement
src/qkd/bb84/def.v: bb84_aux_regs
Record bb84_aux_regs := BB84AuxRegs { bb84_aux_app : {set L}; bb84_aux_bpp : {set L}; bb84_aux_ciso : {set L}; bb84_aux_cp_src : {set L}; bb84_aux_cpp_src : {set L}; bb84_aux_cp_tgt : {set L}; bb84_aux_cpp_tgt : {set L}; bb84_aux_disZ_app : [disjoint Zkey & bb84_aux_app]; bb84_aux_disZp_bpp : [disjoint Zp & bb84_aux_bpp]; bb84_aux_disZ_bpp : [disjoint Zkey & bb84_aux_bpp]; bb84_aux_disApp_Zp : [disjoint bb84_aux_app & Zp]; bb84_aux_disApp_bpp : [disjoint bb84_aux_app & bb84_aux_bpp]; bb84_aux_dim_app : (dim 'H[HL]_Zkey * dim 'H[HL]_Zkey <= dim → 'H[HL]_bb84_aux_app) %N; bb84_aux_dim_bpp : (dim 'H[HL]_Bq * dim 'H[HL]_Zp <= dim 'H[HL]_bb84_aux_bpp) %N; bb84_aux_disZ_ciso : [disjoint Zkey & bb84_aux_ciso]; bb84_aux_disBq_ciso : [disjoint Bq & bb84_aux_ciso]; bb84_aux_disZApp_ciso :
Mathematical reading
Auxiliary registers. Seven registers A'', B'', C_iso, C_s', C_s'', C_t', C_t'' serve the Stinespring dilation, the purification, and the copies of the data-processing steps. They satisfy
Z_key ⊥ A'', Z_key' ⊥ B'', Z_key ⊥ B'', A'' ⊥ Z_key', A'' ⊥ B'', (dim Z_key)^2 ≤ dim A'', dim B_q dim Z_key' ≤ dim B'', Z_key ⊥ C_iso, B_q ⊥ C_iso, Z_key ∪ A'' ⊥ C_iso, Z_key' ⊥ B'' ⊥ C_iso, dim(Z_key ∪ B_q) ≤ dim C_iso, dim(Z_key ∪ A'' ⊥ Z_key' ⊥ B'') ≤ dim C_iso.
[disjoint Zkey :|: bb84_aux_app & bb84_aux_ciso]; bb84_aux_disZpBpp_ciso : [disjoint Zp :|: bb84_aux_bpp & bb84_aux_ciso]; bb84_aux_dim_ZB_ciso : (dim 'H[HL]_(Zkey :|: Bq) <= dim 'H[HL]bb84_aux_ciso) %N; bb84_aux_dim_ZAppBBpp_ciso : (dim 'H[HL](Zkey :|: bb84_aux_app) :|: (Zp :|: bb84_aux_bpp)) <= dim 'H[HL]_bb84_aux_ciso) %N;
Auxiliary registers: source and target copies.
Formal statement
src/qkd/bb84/def.v: bb84_aux_regs bb84_aux_disZ_cp_src : [disjoint Zkey & bb84_aux_cp_src]; bb84_aux_disZ_cpp_src : [disjoint Zkey & bb84_aux_cpp_src]; bb84_aux_disBq_cp_src : [disjoint Bq & bb84_aux_cp_src]; bb84_aux_disBq_cpp_src : [disjoint Bq & bb84_aux_cpp_src]; bb84_aux_disCiso_cp_src : [disjoint bb84_aux_ciso & bb84_aux_cp_src]; bb84_aux_disCiso_cpp_src : [disjoint bb84_aux_ciso & bb84_aux_cpp_src]; bb84_aux_disCp_cpp_src : [disjoint bb84_aux_cp_src & bb84_aux_cpp_src]; bb84_aux_dim_Z_cp_src : dim 'H[HL]_Zkey = dim 'H[HL]_bb84_aux_cp_src; bb84_aux_dim_CisoCp_cpp_src : (dim 'H[HL]_bb84_aux_ciso * dim 'H[HL]_bb84_aux_cp_src <= dim 'H[HL]_bb84_aux_cpp_src) %N; bb84_aux_dim_Bq_cpp_src : (dim 'H[HL]_Bq <= dim 'H[HL]bb84_aux_cpp_src) %N; bb84_aux_disZApp_cp_tgt : [disjoint Zkey :|: bb84_aux_app & bb84_aux_cp_tgt]; bb84_aux_disZApp_cpp_tgt : [disjoint Zkey :|: bb84_aux_app & bb84_aux_cpp_tgt]; bb84_aux_disZpBpp_cp_tgt : [disjoint Zp :|: bb84_aux_bpp & bb84_aux_cp_tgt]; bb84_aux_disZpBpp_cpp_tgt : [disjoint Zp :|: bb84_aux_bpp & bb84_aux_cpp_tgt]; bb84_aux_disCiso_cp_tgt : [disjoint bb84_aux_ciso & bb84_aux_cp_tgt]; bb84_aux_disCiso_cpp_tgt : [disjoint bb84_aux_ciso & bb84_aux_cpp_tgt]; bb84_aux_disCp_cpp_tgt : [disjoint bb84_aux_cp_tgt & bb84_aux_cpp_tgt]; bb84_aux_dim_ZApp_cp_tgt : dim 'H[HL](Zkey :|: bb84_aux_app) = dim 'H[HL]_bb84_aux_cp_tgt; bb84_aux_dim_CisoCp_cpp_tgt : (dim 'H[HL]_bb84_aux_ciso * dim 'H[HL]_bb84_aux_cp_tgt <= dim 'H[HL]bb84_aux_cpp_tgt) %N; bb84_aux_dim_ZpBpp_cpp_tgt : (dim 'H[HL](Zp :|: bb84_aux_bpp) <= dim 'H[HL]_bb84_aux_cpp_tgt) %N }.
Mathematical reading
Copy registers. The source copies and are disjoint from , , , and each other, with
,
,
.
The target copies and are disjoint from , , , and each other, with
,
,
.
Security.
Protocol and key-length function.
| Formal statement | Mathematical reading |
|---|---|
| src/utils/arith.v: h_bin; src/qkd/bb84/def.v: bb84_protocol, bb84_mu, bb84_h_trunc, bb84_key_length_ubRecord bb84_protocol := BB84Protocol {bb84_n : nat; bb84_k : nat; bb84_round_limit : nat; bb84_l : nat; bb84_Qtol : R; bb84_eps_c : R; bb84_leak_EC : R}.Definition h_bin (p : R) : R := if p <= 0 then 0 | Statistical correction and key-length function (Equation (1)). |
else if p >= 1 then 0 else -(p * log2 p) - ((1 - p) * log2 (1 - p)). Definition bb84_mu (n k : nat) (eps : R) : R := Num.sqrt ((((n + k) % : R / (n * k) % : R) * ((k.+1) % : R / k % : R)) * ln (eps^-1)). Definition bb84_h_trunc (x : R) : R := if x <= 0 then 0 else if 1 / 2 <= x then 1 else h_bin x. Definition bb84_key_length_ub (n k : nat) (q Qtol eps ebar leak_EC eps_c : R) : R := n% : R * (q - bb84_h_trunc (Qtol + bb84_mu n k eps)) - 2% : R * log2 ((2% : R * ebar)^-1) - leak_EC - log2 (2% : R / eps_c).
The entropy function is
Writing
the theorem assumes
.
Composable security predicates.
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/bb84/def.v: eps_correct | Correctness (Definition 1). For every adversary, . |
| Definition eps_correct (p_mismatch eps_c : R) : Prop := p_mismatch <= eps_c. | Secrecy and trace distance (Definition 2). The optimized distance is |
| src/utils/labelled/def.v: trnormH; src/lhl/def.v: dist_uniform_feasible, dist_from_uniform; src/qkd/bb84/def.v: delta_secret, eps_secret | |
| Definition trnormH (f : 'F[H]_S) : R := @complex.Re R (trnorm (h2mx f)). | and secrecy multiplies it by . |
| Definition dist_uniform_feasible (rhoAB : 'F[H]_(A : |: B)) (v : R) : Prop := exists sigmaB : 'F[H]_B, sigmaB \is psdlf /\Tr sigmaB = \Tr (\Tr_(A) rhoAB) /\v = (2% : R)^-1 * trnormH | |
| . | |
| Definition dist_from_uniform (rhoAB : 'F[H]_(A : |: B)) : R := inf [set v : R | dist_uniform_feasible rhoAB v]. | |
| Definition delta_secret (rhoAB : 'F[HL]_S_AB) (Delta : R) : Prop := dist_from_uniform rhoAB <= Delta. | |
| Definition eps_secret (rhoAB : 'F[HL]_S_AB) (eps_s p_abort : R) := Prop := exists Delta : R, delta_secret rhoAB Delta /\ (1 - p_abort) * Delta <= eps_s. | |
| src/qkd/bb84/def.v: eps_secure | |
| Definition eps_secure (p_mismatch eps_c : R) (rhoAB : 'F[HL]_S_AB) | Combined security (following Definitions 1 and 2). The protocol is -secure when it is -correct and -secret with . |
| . | |
| These three conjuncts define the combined criterion; eps_correct and eps_secret are expanded immediately above in this table. |
Arithmetic closure.
| Formal statement | Mathematical reading |
|---|---|
| src/utils/arith.v: log2 | Base-two logarithm. Throughout the appendix, |
| Definition log2 (x : R) : R := ln x / ln 2% : R. | |
| Every use of the project-local log2 refers to this expansion; ln is the MathComp real logarithm. |
Two-universal hashing.
Formal statement
src/lhl/def.v: collision_probability, delta_almost_two_univ, two_univ
Definition collision_probability (F : Fidx -> X -> Z) (x x' : X) ← : R := (# | [set f : Fidx | F f x == F f x'] | %: R / # | Fidx | %: R) % R.
Definition delta_almost_two_univ (F : Fidx -> X -> Z) (delta : R)
← : Prop :=
(0 < # | Fidx | ) % N /
forall x x' : X, x != x' -> collision_probability F x x' <=
← delta.
Definition two_univ (F : Fidx -> X -> Z) : Prop := delta_almost_two_univ F (# | Z | %: R^−1) % R.
For a finite range of cardinality , .
Mathematical reading
Two-universal hashing (Definition 4). For a nonempty seed family and , a uniform seed satisfies .
Mismatch and numeric side conditions.
Formal statement
src/qkd/bb84/def.v: verification_collision_prob, p_mismatch
Definition verification_collision_prob (x x' : 'I_key_count) : R ← := # | [set f : 'I_seed_count | hash f x == hash f x'] | %: R / seed_count %: R.
Definition p_mismatch : R := \sum_x \sum_(x' | x != x') corr_prob x x' * verification_collision_prob x x'.
The two-universal bound on is the predicate expanded in Table VI.
src/qkd/bb84/model.v: bb84_pass_prob_le, bb84_numeric_side
Definition bb84_pass_prob_le (p_abort p_pass : R) : Prop := 0 <= p_abort / \ p_abort <= 1 / \ 1 - p_abort <= p_pass.
Record bb84_numeric_side (P : bb84_protocol) := BB84NumericSide { bb84_epsc_pos : 0 < bb84_eps_c P; bb84_epsc_le1 : bb84_eps_c P <= 1; bb84_leak_nonneg : 0 <= bb84_leak_EC P }.
Mathematical reading
Verification-weighted mismatch probability. For a uniform verification seed,
Abort/pass relation and numeric domain.
with and .
CQ and post-hash states.
Formal statement
src/lhl/def.v: is_cq_state, cq_block, post_hash_state
Definition is_cq_state (rhoXE : 'F[HL]_(X : |: E)) : bool := [forall x, forall x', (x' != x) ==> (([> deltav x ; deltav x <] \O (\1 : 'F_E)) \o rhoXE \o ([> deltav x' ; deltav x' <] \O (\1 : 'F_E))) == 0]).
Definition cq_block x (rhoXE : 'F[HL]_(X : |: E)) : 'F[HL]_E := ptrace_castl disXE
(([> deltav x ; deltav x <] \O (\1 : 'F_E)) \o rhoXE \o ([> deltav x ; deltav x <] \O (\1 : 'F_E))).
Definition post_hash_state Fh rhoXE : 'F[HL]_(Z1 : |: (F1 : |: E)) := let eqZFE := esym (finset.setUA Z1 F1 E) in castlf (eqZFE, eqZFE) ((dim 'H[HL]F1) %: R^−1 * : \sum_f \sum_z [> deltav z ; deltav z <] \O [> deltav f ; deltav f <] \O (\sum(x | Fh f x == z) cq_block disXE x rhoXE)).
These definitions supply the state constructors used by every LHL and privacy-amplification row below.
Mathematical reading
Cq input and extracted joint state. The cq condition and its blocks are
For a uniform seed ,
Public leakage certificate.
Formal statement
src/qkd/bb84/def.v: bb84_public_assoc, bb84_public_leakage, bb84_public_state, bb84_public_leak_bound
Definition bb84_public_assoc (Ppub : {set L}) : Ppub : |: (S : |: E) = S : |: (E : |: Ppub).
Record bb84_public_leakage (Ppub : {set L}) (rhoXE : 'F[HL](S : |: E)) (leak : R) := BB84PublicLeakage { bb84_public_disSP : [disjoint S & Ppub]; bb84_public_disEP : [disjoint E & Ppub]; bb84_public_disP_SE : [disjoint Ppub & (S : |: E)]; bb84_public_state : 'F[HL](Ppub : |: (S : |: E)); bb84_public_state_psd : bb84_public_state \is psdlf; bb84_public_state_tr : @complex.Re R (\Tr bb84_public_state) <= 1; bb84_public_state_classical : forall x x', x' != x -> (([> deltav x ; deltav x <] \O (\1 : 'F_(S : |: E))) \o bb84_public_state \o ([> deltav x' ; deltav x' <] \O (\1 : 'F_(S : |: E)))) = 0; bb84_public_state_marginal : ptrace_castl bb84_public_disP_SE bb84_public_state = rhoXE; bb84_public_state_pa_cq : let eq_pub_assoc := bb84_public_assoc Ppub in @is_cq_state R L HL S (E : |: Ppub) (castlf (eq_pub_assoc, eq_pub_assoc) bb84_public_state); bb84_public_leak_bound : log2 (dim 'H[HL]_Ppub) % : R <= leak }.
The cq predicate used by this record is defined in Table VI; this row closes the semantic dependency used by bb84_secret and the leakage-chain lemmas below.
Mathematical reading
Public classical leakage. A leakage certificate packages a state such that
is classical on ,
is cq on ,
.
Source.
Source certificate.
Formal statement
src/eur/def.v: is_povm.mx; src/qkd/bb84/model.v: bb84_source_model
Definition is_povm.mx (M : 'I_nx -> 'M[C]na) : bool := [forall x, M x \is psdmx] && (\sum(x < nx) M x == 1%:M).
Record bb84_source_model (P : bb84_protocol) (q : R) := BB84SourceModel { bb84_src_na : nat; bb84_src_nb : nat; bb84_src_nc : nat; bb84_src_nx : nat; bb84_src_nz : nat; bb84_src_rho : 'M[C]_(bb84_src_na * bb84_src_nb * bb84_src_nc); bb84_src_M : 'I_bb84_src_nx -> 'M[C]_bb84_src_na; bb84_src_N : 'I_bb84_src_nz -> 'M[C]_bb84_src_na; bb84_src_den1 : bb84_src_rho \is denlmx; bb84_src_M_povm : is_povm.mx bb84_src_M; bb84_src_N_povm : is_povm.mx bb84_src_N; bb84_src_overlap_quality : (bb84_n P) % : R * q <= q_of.mx bb84_src_M bb84_src_N; bb84_src_dim_Z : bb84_src_nz = (2 ^ bb84_n P) % N; bb84_src_dim_X : bb84_src_nx = (2 ^ bb84_n P) % N }.
q_of.mx is expanded in Table VI, and bb84_protocol in Table VI.
Mathematical reading
Finite-dimensional gedanken source. A source certificate supplies
nq \leq -\log_2 \max_{x,z} \|\sqrt{M_x} \sqrt{N_z}\|_^\infty,
.
The side-information dimensions are arbitrary. This source certificate supplies the EUR inputs.
Finite sampling objects.
Formal statement
src/utils/bitstr.v: bitstr, wt_ham, xor_str, d_ham, ord_to_bitstring, bitstring_to_ord; src/utils/prob.v: perm_pair_sample, perm_pair_holdout, perm_pair_sample_count, perm_pair_sample_err, perm_pair_sample_le_event
Definition bitstr (n : nat) := 'I_n -> bool. Definition wt_ham {n : nat} (x : bitstr n) : nat := #|[set i : 'I_n | x i]|. Definition xor_str {n : nat} (x y : bitstr n) : bitstr n := fun i => x i (+) y i. Definition d_ham {n : nat} (x y : bitstr n) : nat := wt_ham (xor_str x y).
Local Definition bitstring_to_tuple {n} (s : bitstr n) : n.-tuple ↔ bool := [tuple s i | i < n].
Local Definition tuple_to_bitstring {n} (t : n.-tuple bool) : ↔ bitstr n := fun i => tnth t i.
Definition ord_to_bitstring {n} (x : 'I_(2 ^ n)) : bitstr n := tuple_to_bitstring (ord2bseq x).
Definition bitstring_to_ord {n} (s : bitstr n) : 'I_(2 ^ n) := bseq2ord (bitstring_to_tuple s).
Definition perm_pair_sample (z : bitstr N) (pi : 'S_N) : bitstr k ↔ := fun i => z (pi (@lshift k n i)).
Definition perm_pair_holdout (z : bitstr N) (pi : 'S_N) : bitstr ↔ n := fun i => z (pi (@rshift k n i)).
Definition perm_pair_sample_count (z z' : bitstr N) (pi : 'S_N) : ↔ nat := d_ham (perm_pair_sample z pi) (perm_pair_sample z' pi).
Definition perm_pair_sample_err (z z' : bitstr N) (pi : 'S_N) : R ↔ := (perm_pair_sample_count z z' pi) % : R / k % : R.
Definition perm_pair_sample_le_event (z z' : bitstr N) (Qtol : R) ↔ := [set pi : 'S_N | perm_pair_sample_err z z' pi <= Qtol].
The dependencies are MathComp finite ordinals, tuples, permutations, shifts, and its binary-sequence codec.
Mathematical reading
Hamming sampling under a random permutation. For z, z' ∈ {0, 1}^{k+n} and π ∈ S_{k+n}, define
z_smp(i) = z_{\pi(i)}, \qquad i < k, z_hold(j) = z_{\pi(k+j)}, \qquad j < n, .
The ordinal/bitstring bijection is the finite basis-index encoding used by the state construction.
Full-string source and pass probability.
Formal statement
src/utils/prob.v: Pr_event, subset_uniform_mu, subset_rep_tuple, subset_sorted_rep, perm_pair_sample_le_event; src/qkd/bb84/model.v: bb84_W, bb84_p_pass_pair, bb84_p_pass_tot
Definition bb84_total_rounds (P : bb84_protocol) : nat := bb84_k P + bb84_n P.
Definition bb84_full_string_count (P : bb84_protocol) : nat := 2 ^ bb84_total_rounds P.
Record bb84_zsource (P : bb84_protocol) := BB84ZSource { bb84_zsrc_nb : nat; bb84_zsrc_rho : 'M[C]_(bb84_full_string_count P * bb84_zsrc_nb * bb84_full_string_count P); bb84_zsrc_den1 : bb84_zsrc_rho \is denlmx }.
Definition Pr_event (mu : T -> R) (A : {set T}) : R := \sum_(t in A) mu t.
Definition subset_uniform_mu (S : {set 'I_N}) : R := (#|S| == k) % : R * (( 'C(N, k) ) % : R ) ^ -1.
Definition subset_rep_tuple (S : {set 'I_N}) : N.-tuple 'I_N := Tuple (subset_rep_seq_size S).
Definition subset_sorted_rep (S : {set 'I_N}) : 'S_N := perm (@subset_rep_tuple_tnth_inj S).
Definition perm_pair_sample_le_event (z z' : bitstr N) (Qtol : R) ↔ :=
Mathematical reading
Probability objects consumed by stat. For a full-string source G,
.
For a subset , the canonical permutation lists in increasing order followed by its complement:
[set pi : 'S_N | perm_pair_sample_err z z' pi <= Qtol]. Definition bb84_W (P : bb84_protocol) (G : bb84_zsource P) z z' : → R := let Pzz := (delta.mx z z * t 1%:M * t delta.mx z' z') in @complex.Re R (\tr (Pzz *m bb84_zsrc_rho G)). Definition bb84_p_pass_pair (P : bb84_protocol) z z' : R := Pr_event (fun S0 => subset_uniform_mu S0) [set S0 | subset_sorted_rep S0 \in perm_pair_sample_le_event (ord_to_bitstring z) (ord_to_bitstring z') (bb84_Qtol P)]. Definition bb84_p_pass_tot (P : bb84_protocol) (G : bb84_zsource → P) : R := \sum_z \sum_z' bb84_W G z z' * bb84_p_pass_pair z z'. The complete definitions of perm_pair_sample_err, its Hamming-distance chain, and the ordinal/bitstring encodings are expanded in Table VI. The bb84_protocol record is expanded in Table VI.
Conditional full-string pass state.
Formal statement
src/qkd/bb84/model.v: bb84_pair_projector, bb84_holdout_pair.mx, bb84_rhoZZ_pass_mix, bb84_rhoZZ_pass_mixH
Definition bb84_pair_projector (n : nat) (x x' : 'I_(2 ^ n)) := (delta.mx x x : 'M[C](2 ^ n)) * t (delta.mx x' x' : 'M[C](2 ^ n)). Definition bb84_holdout_pair.mx (n k : nat) (z z' : bitstr (k + n)) (pi : 'S_(k + n)) := bb84_pair_projector (bitstring_to_ord (perm_pair_holdout z pi)) (bitstring_to_ord (perm_pair_holdout z' pi)). Definition bb84_rhoZZ_pass_mix (P : bb84_protocol) (G : → bb84_zsource P) := \sum_z \sum_z' \sum_(S0 | subset_sorted_rep S0 \in perm_pair_sample_le_event (ord_to_bitstring z) (ord_to_bitstring z') (bb84_Qtol P)) ((bb84_W G z z' * subset_uniform_mu S0 / bb84_p_pass_tot G) %: C) *: bb84_holdout_pair.mx (ord_to_bitstring z) (ord_to_bitstring z') (subset_sorted_rep S0)). Definition bb84_rhoZZ_pass_mixH P G dim_Zk dim_Zp := biprod_of.mx disZZp (castmx (f_equal2 muln dim_Zk dim_Zp, f_equal2 muln dim_Zk dim_Zp) (bb84_rhoZZ_pass_mix G)).
The weights, canonical subset sampler, pass event, and normalization denominator are expanded in Table VI; perm_pair_holdout and the ordinal/bitstring encodings in Table VI.
Mathematical reading
Normalized holdout-pair mixture. The conditional state is
.
Overlap and measured states.
Formal statement
src/utils/mx/def.v: sqrtmx; src/eur/def.v: overlap.mx, q_of.mx, rho_XB, rho_ZC, eur_rho_XB, eur_rho_ZC
Definition sqrtmx {n : nat} (A : 'M[C]_n) : 'M[C]_n := let U := spectralmx A in let eigenvals := spectral_diag A in let sqrt_eigenvals := \row_i (Num.sqrt (@complex.Re R (eigenvals 0 i))) %: C in U^* t *m diag.mx sqrt_eigenvals *m U.
Definition overlap.mx (M : 'I_nx -> 'M[C]na) (N : 'I_nz -> 'M[C]na) : R := \bigg[maxr/0](x < nx) \bigg[maxr/0](z < nz) (@complex.Re R (i2norm (sqrtmx (M x) *m sqrtmx (N z)))) ^ 2.
Definition q_of.mx (M : 'I_nx -> 'M[C]_na)
Mathematical reading
Overlap and post-measurement states. For POVMs and , , , , .
Measuring A in gives ,
and analogously for . The labelled wrappers combine register casts with the matrix states expanded immediately above.
(N : 'I_nz -> 'M[C]_na) : R :=
- log2 (overlap.mx M N).
Definition rho_XB (M : 'I_nx -> 'M[C]na) (rhoABC : 'M[C](na * nb * nc)) : 'M[C](nx * nb) := \sum(x < nx) (delta.mx x x * t ptracel (ptrace2 ((sqrtmx (M x) * t 1%:M * t 1%:M) *m rhoABC *m (sqrtmx (M x) * t 1%:M * t 1%:M))).
Definition rho_ZC (N : 'I_nz -> 'M[C]na) (rhoABC : 'M[C](na * nb * nc)) : 'M[C](nz * nc) := \sum(z < nz) (delta.mx z z * t ptracel ((sqrtmx (N z) * t 1%:M * t 1%:M) *m rhoABC *m (sqrtmx (N z) * t 1%:M * t 1%:M))).
Definition eur_rho_XB (X B : {set L}) (disXB : [disjoint X & B]) (na nb nc nx : nat) (rhoSrc : 'M[C](na * nb * nc)) (M : 'I_nx -> 'M[C]na) (dim_eq : nx * nb = dim ('H[HL](X : |: B))) : 'F[HL](X : |: B) := let Q := castmx (tenv_dim disXB, erefl) (@tenv.mxU R L HL X B) in let eq_prod := etrans dim_eq (tenv_dim disXB) in mx2h (castmx (esym (tenv_dim disXB), esym (tenv_dim disXB)) (Q *m castmx (eq_prod, eq_prod) (rho_XB M rhoSrc) *m Q^*t)).
Definition eur_rho_ZC (Z C0 : {set L}) (disZC : [disjoint Z & C0]) (na nb nc nz : nat) (rhoSrc : 'M[C](na * nb * nc)) (N : 'I_nz -> 'M[C]na) (dim_eq : nz * nc = dim ('H[HL](Z : |: C0))) : 'F[HL](Z : |: C0) := let Q := castmx (tenv_dim disZC, erefl) (@tenv.mxU R L HL Z C0) in let eq_prod := etrans dim_eq (tenv_dim disZC) in mx2h (castmx (esym (tenv_dim disZC), esym (tenv_dim disZC)) (Q *m castmx (eq_prod, eq_prod) (rho_ZC N rhoSrc) *m Q^*t)).
Register-dimension transports.
Formal statement
src/qkd/bb84/bb84.v: bb84_register_pair_dim, bb84_source_zkey_dim
Definition bb84_register_pair_dim (A B : {set L}) (disAB : [disjoint A & B]) (na nb : nat) (dim_A : na = dim ('H[HL]_A)) (dim_B : nb = dim ('H[HL]B)) : na * nb = dim ('H[HL](A : |: B)).
Definition bb84_source_zkey_dim (P : bb84_protocol) (q : R) (src : bb84_source_model P q) (Z : {set L}) (dim_Z : @bb84_src_nz R P q src = dim ('H[HL]_Z)) : (2 ^ bb84_n P) %N = dim ('H[HL]_Z).
These equalities supply the two project-level arguments passed to eur_rho_XB, eur_rho_ZC, and bb84_rhoZZ_pass_mixH.
Mathematical reading
Dimension transports used in measured-state arguments. For disjoint registers A, B, , .
The source certificate also transports and to .
Delayed measurement.
Formal statement
src/qkd/bb84/def.v: bb84_delayed_measurement_condition
Record bb84_delayed_measurement_condition (BobZ : 'QC[HL](Bq, Zp)) (rhoZB : 'F[HL](Zkey : |: Bq)) (rhoZZp : 'F[HL](Zkey : |: Zp)) := { bb84_dmc_full : 'F[HL](Zkey : |: Bq : |: finset.set0); bb84_dmc_full_den1 : bb84_dmc_full \is den1lf; bb84_dmc_source : ptrace_cast3C (disjointX0 Zkey) (disjointX0 Bq) bb84_dmc_full = rhoZB; bb84_dmc_target : ptrace_cast3C (disjointX0 Zkey) (disjointX0 Zp) (((:1 : 'SO[HL]Zkey) : ⊗ (BobZ : 'SO[HL](Bq, Zp))) : ⊗ (:1 : 'SO[HL]_finset.set0)) bb84_dmc_full) = rhoZZp }.
The corresponding theorem appears in Table VI.
Mathematical reading
Delayed-measurement condition. A delayed channel is certified by a normalized common extension such that
.
Labelled partial trace and matrix transport.
Formal statement
src/utils/labelled/def.v: ptrace_cast_gen, ptrace_castl, ptrace_cast3C, biprod_of.mx
Definition ptrace_cast_gen (S T B : {set L}) (eq : S : : B = T) (f : 'F[H]_S) : 'F[H]T := castlf (eq, eq) (\Tr(B) f).
Definition ptrace_castl (A B : {set L}) (disAB : [disjoint A & → B]) (f : 'F[H]_(A : |: B)) : 'F[H]_B := ptrace_cast_gen (setDU_l disAB) f.
Definition ptrace_cast3C (A B C : {set L}) (disAC : [disjoint A & C]) (disBC : [disjoint B & C]) (f : 'F[H](A : |: B : |: C)) : 'F[H](A : |: B) := ptrace_cast_gen (setDU3_C disAC disBC) f.
Definition biprod_of.mx (A B : {set L}) (disAB : [disjoint A & B]) (rhoAB : 'M[C]_(dim ('H[H]A) * dim ('H[H]B))) : 'F[H](A : |: B) := let Q : 'M[C](dim 'H[H]_A * dim 'H[H]_B) := castmx (tenv_dim disAB, erefl) (@tenv.mxU R L H A B) in mx2h (castmx (esym (tenv_dim disAB), esym (tenv_dim disAB)) (Q *m rhoAB *m Q^*t)).
Mathematical reading
Label-preserving transports. For ,
The two convenience forms retain respectively the right component of and the first two components of . The inverse bipartite transport maps a matrix on to the labelled space .
- Protocol Closure: Program.
Command syntax.
Formal statement
src/qkd/protocol/syntax.v: store, store_set, expr, bexpr, dexpr, qexpr, mexpr, qkd_cmd, seq_cmd, for_cmd
Definition store := {ffun Cv -> V}. Definition store_set (s : store) (x : Cv) (v : V) : store := [ffun y => if y == x then v else s y]. Definition expr := store -> V. Definition bexpr := store -> bool. Definition dexpr := store -> V -> R. Definition qexpr (Q : {set L}) := store -> 'F[HL]_Q. Definition mexpr (Q : {set L}) := store -> V -> 'F[HL]_Q.
Inductive qkd_cmd : Type := | Cskip | Cassign (x : Cv) (e : expr) | Csample (x : Cv) (mu : dexpr) | Cinit (Q : {set L}) (rho : qexpr Q) | Cmeasure (x : Cv) (Q : {set L}) (M : mexpr Q) | Cattack (Q : {set L}) | Cif (b : bexpr) (c1 c2 : qkd_cmd)
Mathematical reading
Command syntax (Definition 7). The grammar and fixed-loop expansion are
The classical store is a finite map ; expressions, distributions, states, and measurements are store-indexed functions of the types shown at right.
| Cseq (c1 c2 : qkd_cmd). Fixpoint seq_cmd (c1 c2 : qkd_cmd) : qkd_cmd := match c1 with | Cskip => c2 | Cseq c11 c12 => Cseq c11 (seq_cmd c12 c2) | _ => if c2 is Cskip then c1 else Cseq c1 c2 end.
Definition for_cmd {limit : nat} (body : 'I_limit -> qkd_cmd) : → qkd_cmd := \big[seq_cmd/Cskip]_(i <- enum 'I_limit) body i.
Registers.
Concrete program variables.
Formal statement
src/qkd/example/program.v: bb84_round_cvar, bb84_cvar, and all BV* locations
Definition bb84_round_cvar (M : nat) := ('I_M + ('I_M + ('I_M + ('I_M + 'I_M))) %type.
Definition bb84_cvar (M : nat) := (bb84_round_cvar M + ↪ 'I_18) %type.
Definition BVa {M} (i : 'I_M) : bb84_cvar M := inl (inl i).
Definition BVy {M} (i : 'I_M) : bb84_cvar M := inl (inr (inl i)).
Definition BVb {M} (i : 'I_M) : bb84_cvar M := inl (inr (inr (inl i))).
Definition BVy' {M} (i : 'I_M) : bb84_cvar M := inl (inr (inr (inr (inl i))).
Definition BVd {M} (i : 'I_M) : bb84_cvar M := inl (inr (inr (inr (inr i))).
Definition BVP {M} : bb84_cvar M := inr (inord 0).
Definition BVX {M} : bb84_cvar M := inr (inord 1).
Definition BVZ {M} : bb84_cvar M := inr (inord 2).
Definition BVK {M} : bb84_cvar M := inr (inord 3).
Definition BVXA {M} : bb84_cvar M := inr (inord 4).
Definition BVXB {M} : bb84_cvar M := inr (inord 5).
Definition BVZA {M} : bb84_cvar M := inr (inord 6).
Definition BVZB {M} : bb84_cvar M := inr (inord 7).
Definition BVlam {M} : bb84_cvar M := inr (inord 8).
Definition BVpec {M} : bb84_cvar M := inr (inord 9).
Definition BVXhat {M} : bb84_cvar M := inr (inord 10).
Definition BVg {M} : bb84_cvar M := inr (inord 11).
Definition BVtA {M} : bb84_cvar M := inr (inord 12).
Definition BVtB {M} : bb84_cvar M := inr (inord 13).
Definition BVf {M} : bb84_cvar M := inr (inord 14).
Definition BVS {M} : bb84_cvar M := inr (inord 15).
Definition BVSh {M} : bb84_cvar M := inr (inord 16).
Definition BVabort {M} : bb84_cvar M := inr (inord 17).
The five-way and eighteen-way sums make all locations distinct by construction.
Mathematical reading
Finite classical-variable layout. Each round has locations for Alice's basis and bit, Bob's basis and outcome, and the detection flag. Eighteen global locations hold
.
Finite value universe and constructors.
Formal statement
src/qkd/example/program.v: bb84_val and its value constructors
Definition bb84_partial_bits (M : nat) := {ffun 'I_M -> option ↪ bool}.
Definition bb84_round_transcript (M : nat) := {ffun 'I_M -> option (bool * bool * bool)}.
Definition bb84_transcript (M ec_bits vseed_count tag_count paseed_count : nat) := (bb84_round_transcript M * option ({set 'I_M} * bb84_partial_bits M * bb84_partial_bits ↪ M) * option (option 'I_(2 ^ ec_bits) * option 'I_vseed_count * option 'I_tag_count) * option (option ↪ 'I_paseed_count)) %type.
Definition bb84_eur_public (M vseed_count : nat) := (bb84_round_transcript M * {set 'I_M} * bb84_partial_bits M * bb84_partial_bits M * option 'I_vseed_count)%type.
Definition bb84_error_value (M : nat) := ('I_M.+1 * ↪ 'I_M.+1)%type.
Mathematical reading
Tagged finite values. The store value type is the disjoint sum of abort booleans, bases, bits, detector outcomes, round sets, partial bit strings, error fractions, transcripts, reconciliation data, verification and PA seeds, tags, raw and final keys, and ⊥. The injections at right distinguish values even when their payload types coincide.
Definition bb84_val (M n l ec_bits vseed_count tag_count → paseed_count : nat) := (bool + (bool + (bool + (option bool + ({set 'I_M} + (bb84_partial_bits M + (bb84_error_value M + (bb84_transcript M ec_bits vseed_count tag_count paseed_count + (option 'I_(2 ^ ec_bits) + (option 'I_vseed_count + (option 'I_tag_count + (option 'I_paseed_count + (option 'I_(2 ^ n) + (option 'I_(2 ^ l) + → unit)))))))))%type. Context {M n l ec_bits vseed_count tag_count paseed_count : nat}. Notation V := (bb84_val M n l ec_bits vseed_count tag_count → paseed_count). Definition bb84_bool_val (b : bool) : V := inl b. Definition bb84_basis_bool_val (b : bool) : V := inr (inl b). Definition bb84_bit_val (b : bool) : V := inr (inr (inl b)). Definition bb84_outcome_val (o : option bool) : V := inr (inr (inr (inl o))). Definition bb84_set_val (X : {set 'I_M}) : V := inr (inr (inr (inr (inl X))).). Definition bb84_partial_bits_val (bits : bb84_partial_bits M) : V → := inr (inr (inr (inr (inr (inl bits))))). Definition bb84_error_val (err total : nat) : V := inr (inr (inr (inr (inr (inr (inl (inord err, inord → total))))). Definition bb84_transcript_val (tr : bb84_transcript M ec_bits vseed_count tag_count → paseed_count) : V := inr (inr (inr (inr (inr (inr (inl tr))))). Definition bb84_ec_val (x : option 'I_(2 ^ ec_bits)) : V := inr (inr (inr (inr (inr (inr (inr (inl x)))))). Definition bb84_vseed_val (x : option 'I_vseed_count) : V := inr (inr (inr (inr (inr (inr (inr (inr (inl x)))))). Definition bb84_tag_val (x : option 'I_tag_count) : V := inr (inr (inr (inr (inr (inr (inr (inr (inr (inl → x))))))))). Definition bb84_paseed_val (x : option 'I_paseed_count) : V := inr (inr (inr (inr (inr (inr (inr (inr (inr (inl → x))))))))). Definition bb84_raw_key_val (x : option 'I_(2 ^ n)) : V := inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inl x))))))))). Definition bb84_final_key_val (x : option 'I_(2 ^ l)) : V := inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inl x))))))))). Definition bb84_bot_val : V := inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inr tt))))))))).
Value and transcript decoders.
Formal statement
Mathematical reading
src/qkd/example/program.v: basic bb84_*_of decoders and bb84_transcript_or_empty
Context {M n l ec_bits vseed_count tag_count paseed_count : nat}. Notation V := (bb84_val M n l ec_bits vseed_count tag_count → paseed_count). Definition bb84_bit_of (v : V) : option bool := match v with inr (inr (inl b)) => Some b | _ => None end. Definition bb84_basis_bool_of (v : V) : option bool := match v with inr (inl b) => Some b | _ => None end. Definition bb84_outcome_of (v : V) : option (option bool) := match v with inr (inr (inr (inl o)) => Some o | _ => None end. Definition bb84_read_bit (v : V) : option bool := match bb84_bit_of v with | Some b => Some b | None => match bb84_outcome_of v with | Some (Some b) => Some b | _ => None end end. Definition bb84_set_of (v : V) : {set 'I_M} :=
Tagged-value decoding. The decoders implement the displayed tagged projections.
match v with | inr (inr (inr (inr (inl X)))) => X | _ => set0 end.
Definition bb84_partial_bits_of (v : V) : option ← (bb84_partial_bits M) := match v with | inr (inr (inr (inr (inr (inl bits)))) => Some bits | _ => None end.
Definition bb84_error_of (v : V) : nat := match v with | inr (inr (inr (inr (inr (inl e)))) => nat_of_ord e.1 | _ => 0%N end.
Definition bb84_transcript_of (v : V) : option (bb84_transcript M ec_bits vseed_count tag_count ← paseed_count) := match v with | inr (inr (inr (inr (inr (inr (inl tr)))) => Some tr | _ => None end.
Definition bb84_empty_transcript : bb84_transcript M ec_bits vseed_count tag_count paseed_count ← := ([ffun _ => None], None, None, None).
Definition bb84_empty_transcript_val : V := bb84_transcript_val bb84_empty_transcript.
Definition bb84_transcript_or_empty (v : V) : bb84_transcript M ec_bits vseed_count tag_count paseed_count ← := if bb84_transcript_of v is Some tr then tr else ← bb84_empty_transcript.
Seed, transcript, and key decoders.
Formal statement
src/qkd/example/program.v: typed bb84_*_of decoders
Context {M n l ec_bits vseed_count tag_count paseed_count : nat}.
Notation V := (bb84_val M n l ec_bits vseed_count tag_count ← paseed_count).
Definition bb84_vseed_of (v : V) : option 'I_vseed_count := match v with | inr (inr (inr (inr (inr (inr (inr (inr (inl x)))))))) => x | _ => None end.
Definition bb84_ec_of (v : V) : option 'I_(2 ^ ec_bits) := match v with | inr (inr (inr (inr (inr (inr (inr (inr (inl x)))))))) => x | _ => None end.
Definition bb84_tag_of (v : V) : option 'I_tag_count := match v with | inr (inr (inr (inr (inr (inr (inr (inr (inr (inl x)))))))) => x | _ => None end.
Definition bb84_paseed_of (v : V) : option 'I_paseed_count := match v with | inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inl x)))))))) => x | _ => None end.
Definition bb84_raw_key_of (v : V) : option 'I_(2 ^ n) := match v with | inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inl x)))))))) => x | _ => None end.
Definition bb84_final_key_of (v : V) : option 'I_(2 ^ l) := match v with | inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inr (inl x)))))))) => x
Mathematical reading
Typed projections. Typed value decoders map verification seeds, reconciliation messages, verification tags, PA seeds, raw keys, and final keys to their payload types:
These decoders are used by the transcript adapters in Table VI.
(inr (inl x)))))))))) => x | _ => None end.
The displayed sum tags are the exact inverse positions of the constructors in Table VI.
Labelled register layout
Formal statement
src/qkd/example/program.v: bb84_label, label/register families, bb84_label_space, and matrix transports
Definition bb84_label (M : nat) (LE LB : finType) := ('I_M + ('I_M + (LE + LB)) %type.
Definition bb84_signal_label {M LE LB} (i : 'I_M) : bb84_label M ↪ LE LB := inl i.
Definition bb84_source_label {M LE LB} (i : 'I_M) : bb84_label M ↪ LE LB := inr (inl i).
Definition bb84_bridge_label {M LE LB} (b : LB) : bb84_label M LE ↪ LB := inr (inr (inr b)).
Definition bb84_signal_reg {M LE LB} (i : 'I_M) := [set bb84_signal_label i].
Definition bb84_signal_regs {M LE LB} : 'I_M -> {set bb84_label M ↪ LE LB} := bb84_signal_reg.
Definition bb84_source_reg {M LE LB} (i : 'I_M) := [set bb84_source_label i].
Definition bb84_source_regs {M LE LB} : 'I_M -> {set bb84_label M ↪ LE LB} := bb84_source_reg.
Definition bb84_eve_reg (M : nat) (LE LB : finType) := [set x : bb84_label M LE LB | if x is inr (inr (inl _)) then true else false].
Definition bb84_bridge_reg {M LE LB} (b : LB) := [set bb84_bridge_label b].
Definition bb84_label_space (x : bb84_label M LE LB) : chsType := match x with | inl _ => @ihb_chsType R 'I_2 | inr (inl _) => @ihb_chsType R 'I_4 | inr (inr (inl e)) => HE e | inr (inr (inr b)) => HB b end.
Definition bb84_signal_lfun (i : 'I_M) (rho : 'M[C]_2) := mx2h (castmx (esym (bb84_signal_reg_dim i), esym (bb84_signal_reg_dim i)) ↪ rho).
Definition bb84_source_lfun (i : 'I_M) (rho : 'M[C]_4) := mx2h (castmx (esym (bb84_source_reg_dim i), esym (bb84_source_reg_dim i)) ↪ rho).
Definition bb84_source_signal_lfun (i : 'I_M) (rho : 'M[C]_(4 * ↪ 2)) := let d := f_equal2 muln (bb84_source_reg_dim i) (bb84_signal_reg_dim i) in biprod_of.mx (bb84_source_signal_disjoint i) (castmx (esym d, esym d) rho).
The underlying matrix transport biprod_of.mx is expanded in Table VI.
Mathematical reading
Quantum labels and their Hilbert spaces.
Singleton signal and source labels form the round register families; the matrix transports embed 2-, 4-, and 8-dimensional operands into those labelled spaces.
Bridge registers and dimensions.
Formal statement
src/qkd/example/readout.v: bb84_register_index, bb84_register_dim, bb84_register_space, and bridge sets
Definition fin_hilbert_of_dim (d : nat) (Hd : (0 < d) %N) : ← ihbFinType := FinInhabited.Pack (FinInhabited.Class (Choice.on 'I_d) (Countable.on 'I_d) (Finite.on 'I_d) (isPointed.Build 'I_d (Ordinal Hd))).
Definition bb84_register_index := 'I_8.
Definition bb84_reg_S : bb84_register_index := Ordinal (isT : (0 < 8) %N).
Definition bb84_reg_E : bb84_register_index := Ordinal (isT : (1 < 8) %N).
Definition bb84_reg_Zkey : bb84_register_index := Ordinal (isT : (2 < 8) %N).
Definition bb84_reg_Bq : bb84_register_index := Ordinal (isT : (3 < 8) %N).
Definition bb84_reg_Zp : bb84_register_index := Ordinal (isT : (4 < 8) %N).
Definition bb84_reg_Fl : bb84_register_index := Ordinal (isT : (5 < 8) %N).
Definition bb84_reg_Zl : bb84_register_index := Ordinal (isT : (6 < 8) %N).
Definition bb84_reg_Ppub : bb84_register_index := Ordinal (isT : (7 < 8) %N).
Definition bb84_register_dim (r : bb84_register_index) : nat := match val r with | 0 => 2 ^ bb84_n P | 1 => #|{: bb84_eur_public (bb84_round_limit P) ← (cd_vseed_count dev)}| | 2 => 2 ^ bb84_n P | 3 => 2 ^ bb84_n P | 4 => 2 ^ bb84_n P | 5 => cd_paseed_count dev | 6 => 2 ^ bb84_l P | 7 => (2 ^ cd_ir_bits dev) * cd_tag_count dev | _ => 1 end.
Definition bb84_register_space (r : bb84_register_index) : ← chsType := 'Hs (fin_hilbert_of_dim (bb84_register_dim_pos r)).
Definition bb84_reg (r : bb84_register_index) : {set L} := bb84_bridge_reg r.
Definition bb84_S : {set L} := bb84_reg bb84_reg_S.
Definition bb84_Eve : {set L} := bb84_eve_reg M LE ← bb84_register_index.
Definition bb84_Epub : {set L} := bb84_reg bb84_reg_E.
Definition bb84_E : {set L} := bb84_Eve : |: bb84_Epub.
Definition bb84_Zkey : {set L} := bb84_reg bb84_reg_Zkey.
Definition bb84_Bq : {set L} := bb84_reg bb84_reg_Bq.
Definition bb84_Zp : {set L} := bb84_reg bb84_reg_Zp.
Definition bb84_Fl : {set L} := bb84_reg bb84_reg_Fl.
Definition bb84_Zl : {set L} := bb84_reg bb84_reg_Zl.
Definition bb84_Ppub : {set L} := bb84_reg bb84_reg_Ppub.
Mathematical reading
Eight finite bridge registers. The bridge coordinates are
,
with dimensions respectively
.
Eve's register is the external-label region and
.
Basis and source-pointer roots.
Formal statement
src/qkd/bb84/model.v: bb84_basis; src/qkd/example/stat.v: bb84_basis_value, bb84_basis_of_value, bb84_prep_index; src/qkd/example/deferred.v: bb84_src_ptr_slot
Inductive bb84_basis := BasisX | BasisZ.
Definition bb84_basis_value (basis : bb84_basis) : V := match basis with | BasisX => bb84_basis_bool_val false | BasisZ => bb84_basis_bool_val true end.
Definition bb84_basis_of_value (v : V) : option bb84_basis := match bb84_basis_bool_of v with | Some false => Some BasisX | Some true => Some BasisZ | None => None
Mathematical reading
Basis and pointer encodings. X and Z are distinct basis choices. Their store values are distinct Boolean tags; a source preparation occupies one of four basis states, and the low source-qubit slot carries its coherent pointer.
end.
Definition bb84_prep_index (basis : bb84_basis) (bit : bool) : → 'I_4 := inord (match basis, bit with | BasisX, false => 0 | BasisX, true => 1 | BasisZ, false => 2 | BasisZ, true => 3 end).
Definition bb84_src_ptr_slot : 'I_2 := Ordinal (isT : (1 < 2)%N).
These are executable finite encodings of the mathematical basis labels.
Execution.
CQ-state denotational semantics.
Formal statement
src/qkd/protocol/semantics.v: cq_state, cq_mass, cq_wf, appendso_fun, appendso, replaceso, adversary, denote
Definition cq_state := {ffun store -> 'F[HL]_setT}.
Definition cq_mass (xi : cq_state) : R := \sum_s @complex.Re R (\Tr (xi s)).
Definition cq_wf (xi : cq_state) : Prop := (forall s, xi s \is psdlf) / \ cq_mass xi = 1.
Definition appendso_fun (Q : {set L}) (rho : 'F[HL]Q) (x : 'F[HL](setT : : Q)) : 'F[HL]_setT := castlf (setUD_sub (subsetT Q), setUD_sub (subsetT Q)) (rho \otimes → x).
Definition appendso (Q : {set L}) (rho : 'F[HL]_Q) := Superop (linfun (appendso_fun rho)).
Definition replaceso (Q : {set L}) (rho : 'F[HL]_Q) : → 'SO[HL]_setT := appendso rho :o ptraceso Q.
Definition adversary := forall Q : {set L}, V -> 'QC('H[HL]_(Q : |: qA)).
Fixpoint denote (c : qkd_cmd) (xi : cq_state) : cq_state := match → c with | Cskip => xi | Cassign x e => [ffun t => \sum_(s | store_set s x (e s) == t) → xi s] | Csample x mu => [ffun t => \sum_s \sum_(v | store_set s x v == t) (mu s v) % : C * : xi s] | Cinit Q rho => [ffun s => replaceso (rho s) (xi s)] | Cmeasure x Q M => [ffun t => \sum_s \sum_(v | store_set s x v == t) formso (liftf_lf (M s v)) (xi s)] | Cattack Q => [ffun s => liftfso (EA Q (s Pvar)) (xi s)] | Cif b c1 c2 => denote c1 [ffun s => if b s then xi s else 0] + denote c2 [ffun s => if b s then 0 else xi s] | Cseq c1 c2 => denote c2 (denote c1 xi) end.
Remark. cq_wf packages positivity and unit total mass, matching the paper's state invariant. The adversary family is indexed by the attacked register set Q, and its channel acts on . The initialization dependency replaceso supplies the displayed append/partial-trace construction. The dependencies store, store_set, and qkd_cmd are expanded in Table VI.
Mathematical reading
Cq-states and denotational semantics (Definition 8).
For a singleton , the paper clauses are
The conditional selects its branch, denotation sums over singleton inputs, and .
QKD round components
Formal statement
src/qkd/protocol/qkd_cmd.v: pX, mu_basis, mu_bit, detected, sift_X, sift_Z, rounds_through, Abort_cmd, PrepPM, PrepEB, Prep, Dist, Meas, Sift, Round, Announce
Definition pX : R := (1 + Num.sqrt (k%:R / n%:R))^−1.
Definition mu_basis : dexpr := fun _ v => if v == basisX then pX else if v == basisZ then 1 - pX else 0.
Definition mu_bit : dexpr := fun _ v => if v == vbit false then (2%:R)^−1 else if v == vbit true then (2%:R)^−1 else 0.
Definition detected (s : store) (i : 'I_M) : bool := s (y'_i) != outEmpty.
Mathematical reading
QKD component sugar (Definition 9). With
Definition sift_X (s : store) (i : 'I_M) : bool := (s (a_i) == basisX) && (s (b_i) == basisX) && (s (d_i) == vbool true).
Definition sift_Z (s : store) (i : 'I_M) : bool := (s (a_i) == basisZ) && (s (b_i) == basisZ) && (s (d_i) == vbool true).
Definition rounds_through (i : 'I_M) (p : 'I_M -> bool) := [set j : 'I_M | (nat_of_ord j <= nat_of_ord i) %N && p j].
Definition Abort_cmd : @qkd_cmd R L HL Cv V := (abortv <-c (fun _ => vbool true)) ; (Sv <-c (fun _ => bot)) ; (Shv <-c (fun _ => bot)).
Definition PrepPM (i : 'I_M) : @qkd_cmd R L HL Cv V := (a_i <-^ mu_basis) ; (y_i <-^ mu_bit) ; (Q i <-q (fun s => dev_rho i (s (a_i)) (s (y_i))).
Definition PrepEB (i : 'I_M) : @qkd_cmd R L HL Cv V := ((Qsrc i : |: Q i) <-q (fun _ => dev_pair i)) ; (a_i <-^$ mu_basis) ; (y_i := M[Qsrc i] (fun s v => dev_ptr i (s (a_i)) v)).
Definition Prep (i : 'I_M) : @qkd_cmd R L HL Cv V := if entangled then PrepEB i else PrepPM i.
Definition Dist (i : 'I_M) : @qkd_cmd R L HL Cv V := Attack[Q i].
Definition Meas (i : 'I_M) : @qkd_cmd R L HL Cv V := (b_i <-^$ mu_basis) ; (y'_i := M[Q i] (fun s v => dev_meas i (s (b_i)) v)).
Definition Sift (i : 'I_M) : @qkd_cmd R L HL Cv V := (d_i <-c (fun s => vbool (detected s i))) ; (Xv <-c (fun s => vset (rounds_through i (sift_X s))) ; (Zv <-c (fun s => vset (rounds_through i (sift_Z s))).
Definition Round (i : 'I_M) : @qkd_cmd R L HL Cv V := Prep i ;; Dist i ;; Meas i ;; Sift i.
Definition Announce : @qkd_cmd R L HL Cv V := (Pvar <-c (fun s => tr_app_rounds (fun i => (s (a_i), s (b_i), s (d_i))) (s -> Pvar))).
The paper's Abort is named Abort_cmd, and Prep selects the prepare-and-measure or entanglement-based source mode. The semantic domains store, dexpr, and qkd_cmd are expanded in Table VI.
preparation component has both Box 1 modes:
PrepPM_i := a_i <- μ_2; Q_i ← ρ_{a_i,y_i}, PrepEB_i := Q_i^src Q_i ← ρ_pair; a_i <-$ μ_B; y_i ← M_{a_i}^ptr[Q_i^src], Prep_i(b) := {PrepEB_i, b = true, PrepPM_i, b = false, Round_i := Prep_i; Dist_i; Meas_i; Sift_i.
This row also expands Abort, Meas, Sift, and Announce; the three classical post-processing components follow in the next row.
Classical QKD components.
Formal statement
src/qkd/protocol/qkd_cmd.v: has_key_sample, has_test_sample, sift_ok, paramest_K_mu, alice_bits, bob_bits, ParamEst, pe_error_high, pe_fail, ErrCorr, PrivAmp
Definition has_key_sample (s : store) : bool := (n <= #|vset_of (s Xv) |)%N.
Definition has_test_sample (s : store) : bool := (k <= #|vset_of (s Zv) |)%N.
Definition sift_ok : bexpr := fun s => has_key_sample s && has_test_sample s.
Definition paramest_K_mu : dexpr := fun s v => if has_key_sample s then unif_nsubset_mass n (vset_of (s Xv)) v else (v == bot)%:R.
Definition alice_bits (s : store) : 'I_M -> V := fun i => s (y_ ← i).
Definition bob_bits (s : store) : 'I_M -> V := fun i => s (y'_ ← i).
Definition ParamEst : @qkd_cmd R L HL Cv V := (Kv <-^$ paramest_K_mu) ; (XA <-c (fun s => key_bits_on (vset_of (s Kv)) (alice_bits s))) → ; (XB <-c (fun s => key_bits_on (vset_of (s Kv)) (bob_bits s))) → ; (ZA <-c (fun s => test_bits_on (vset_of (s Zv)) (alice_bits ← s))) ; (ZB <-c (fun s => test_bits_on (vset_of (s Zv)) (bob_bits s))) → ; (Pvar <-c (fun s => tr_app_pe (s Kv) (s ZA) (s ZB) (s Pvar))) → ; (lamv <-c (fun s => vrat (err_count (s ZA) (s ZB)) #|vset_of (s Zv) |)).
Definition pe_error_high : bexpr := fun s =>
Mathematical reading
Parameter estimation, reconciliation, and privacy amplification.
ParamEst : K <-\widehat{X} G; t_A = g(X_A); t_B = g( ); P, PrivAmp : f <-\mathcal{F}_\ell\widehat{S}\widehat{X}$); P.
The program aborts if either sample is too small or the observed error exceeds .
Qtol * (#|vset_of (s Zv) |)%:R < (err_of (s lamv))%:R. Definition pe_fail : bexpr := fun s => ~~ sift_ok s || → pe_error_high s. Definition ErrCorr : @qkd_cmd R L HL Cv V := (pECv <-c (fun s => ir_pub leakEC (s XA) (s XB)) ); (Xhatv <-c (fun s => ir_dec (s pECv) (s XB)) ); (gv <-^ unif_vseed) ; (tAv <-c (fun s => verify_hash (s gv) (s XA)) ); (tBv <-c (fun s => verify_hash (s gv) (s Xhatv)) ); (Pvar <-c (fun s => tr_app_ec (s pECv) (s gv) (s tAv) (s → Pvar))). Definition PrivAmp : @qkd_cmd R L HL Cv V := (fv <-^ unif_pseed) ; (Sv <-c (fun s => privacy_hash l (s fv) (s XA)) ); (Shv <-c (fun s => privacy_hash l (s fv) (s Xhatv)) ); (Pvar <-c (fun s => tr_app_pa (s fv) (s Pvar))). These are the immediate dependencies of the whole-program branch displayed next; protocol-specific encoders and transcript appenders are parameters of the generic component layer. The semantic domains store, dexpr, bexpr, and qkd_cmd are expanded in Table VI.
Source and measurement adapters
Formal statement
src/qkd/example/program.v: bb84_program_basis_value, bb84_program_basis_of_value, bb84_program_device_rho, bb84_program_device_meas, bb84_program_device_pair, bb84_program_device_ptr
Definition bb84_program_basis_value (basis : bb84_basis) : V := match basis with | BasisX => bb84_basis_bool_val false | BasisZ => bb84_basis_bool_val true end.
Definition bb84_program_basis_of_value (v : V) : option → bb84_basis := match bb84_basis_bool_of v with | Some false => Some BasisX | Some true => Some BasisZ | None => None end.
Definition bb84_program_device_rho (i : 'I_M) (basis bit : V) : 'F[HL]_(bb84_signal_reg i) := match bb84_program_basis_of_value basis, bb84_bit_of bit with | Some BasisX, Some b => bb84_signal_lfun HE HB i (cd_rho dev → BasisX b) | Some BasisZ, Some b => bb84_signal_lfun HE HB i (cd_rho dev → BasisZ b) | _, _ => bb84_signal_lfun HE HB i (cd_rho dev BasisX false) end.
Definition bb84_program_device_meas (i : 'I_M) (basis outcome : → V) : 'F[HL]_(bb84_signal_reg i) := match bb84_program_basis_of_value basis, bb84_outcome_of → outcome with | Some BasisX, Some o => bb84_signal_lfun HE HB i (cd_meas dev → BasisX o) | Some BasisZ, Some o => bb84_signal_lfun HE HB i (cd_meas dev → BasisZ o) | None, Some o => bb84_signal_lfun HE HB i (cd_meas dev BasisX → o) | _, None => 0 end.
Definition bb84_program_device_pair (i : 'I_M) := bb84_source_signal_lfun HE HB i (cd_pair dev).
Definition bb84_program_device_ptr (i : 'I_M) (basis bit : V) := match bb84_program_basis_of_value basis, bb84_bit_of bit with | Some BasisX, Some b => bb84_source_lfun HE HB i (cd_ptr dev → BasisX b) | Some BasisZ, Some b => bb84_source_lfun HE HB i (cd_ptr dev → BasisZ b) | None, Some b => bb84_source_lfun HE HB i (cd_ptr dev BasisX → b)
Mathematical reading
Embedding the certified device in each protocol round. The concrete adapters decode the store's basis/bit/outcome values and transport
into the labelled signal and source registers for round i.
| __, None => 0 end.
The fields cd_rho, cd_meas, cd_pair, and cd_ptr are expanded in Table VI. The labelled-register transports and value decoders are expanded in Table VI.
Sampling and bit extraction.
Formal statement
Mathematical reading
src/qkd/example/program.v: bb84_selected_index, bb84_bits_on_val, bb84_partial_bits_on_val, bb84_partial_error_count, bb84_err_count_val, bb84_nsubset_count, bb84_unif_nsubset_mass, bb84_unif_vseed_mass, bb84_unif_pseed_mass
Definition bb84_selected_index {M n : nat} (K : {set 'I_M'} (j : 'I_n) : option 'I_M := nth None [seq Some i | i <- enum K] j.
Definition bb84_bits_on_val (K : {set 'I_M'} (bits : 'I_M -> V) : ← V := if #|K| == n then bb84_raw_key_val (Some (bitstring_to_ord (fun j => match bb84_selected_index K j with | Some i => if bb84_read_bit (bits i) is Some b then b ← else false | None => false end)) else bb84_raw_key_val None.
Definition bb84_partial_bits_on_val (K : {set 'I_M'} (bits : 'I_M -> V) : V := bb84_partial_bits_val [ffun i => if i \in K then bb84_read_bit (bits i) else None].
Definition bb84_partial_error_count (M : nat) (a b : bb84_partial_bits M) : nat := #|[set i : 'I_M | if a i is Some x then if b i is Some y then x != y else false else false|.
Definition bb84_err_count_val (a b : V) : nat := match bb84_partial_bits_of a, bb84_partial_bits_of b with | Some aa, Some bb => bb84_partial_error_count aa bb | _, _ => match bb84_raw_key_of a, bb84_raw_key_of b with | Some x, Some y => d_ham (ord_to_bitstring x) ← (ord_to_bitstring y) | _, _ => 0%N end
end.
Definition bb84_nsubset_count (M m : nat) (X : {set 'I_M'} : nat ← := #|[set K : {set 'I_M'} | (#|K| == m) && (K \subsetset X)]|.
Definition bb84_unif_nsubset_mass (m : nat) (X : {set 'I_M'} (v : ← V) : R := \sum_(K : {set 'I_M'} | (#|K| == m) && (K \subsetset X)) if v == bb84_set_val K then (bb84_nsubset_count m X) %:R^-1 else 0.
Definition bb84_unif_vseed_mass : dexpr := fun _ v => \sum_g if v == bb84_vseed_val (Some g) then (vseed_count%:R)^-1 else 0.
Definition bb84_unif_pseed_mass : dexpr := fun _ v => \sum_f if v == bb84_paseed_val (Some f) then (paseed_count%:R)^-1 else 0.
The Hamming-distance and ordinal/bitstring dependencies are expanded in Table VI; all value constructors and decoders are expanded in Table VI.
Finite sample, key/test strings, and seed distributions. For , the adapter enumerates K in canonical order, forms Alice/Bob's n-bit key strings when , retains partial test strings, and counts disagreements. The sample law is uniform over n-subsets of X; verification and PA seeds are uniform on their finite seed spaces.
Transcript and hash adapters.
Formal statement
src/qkd/example/program.v: bb84_verify_hash_val, bb84_ir_pub_val, bb84_ir_dec_val, bb84_privacy_hash_val, bb84_tr_app_rounds, bb84_tr_app_pe, bb84_tr_app_ec, bb84_tr_app_pa, bb84_eur_public_of_transcript, bb84_eur_public_of_value, bb84_eur_public_of_store
Definition bb84_verify_hash_val (vh : 'I_vseed_count -> 'I_(2 ^ n) -> 'I_tag_count) (seed raw : V) : V := match bb84_vseed_of seed, bb84_raw_key_of raw with | Some g, Some x => bb84_tag_val (Some (vh g x)) | _, _ => bb84_tag_val None end.
Definition bb84_ir_pub_val (ir_pub : 'I_(2 ^ n) -> 'I_(2 ^ n) -> 'I_(2 ^ ec_bits)) (_leakEC : nat) (alice bob : V) : V := match bb84_raw_key_of alice, bb84_raw_key_of bob with | Some x, Some y => bb84_ec_val (Some (ir_pub x y)) | _, _ => bb84_ec_val None end.
Definition bb84_ir_dec_val (ir_dec : 'I_(2 ^ ec_bits) -> 'I_(2 ^ n) -> 'I_(2 ^ n)) (transcript bob : V) : V := match bb84_ec_of transcript, bb84_raw_key_of bob with | Some p, Some y => bb84_raw_key_val (Some (ir_dec p y)) | _, _ => bb84_raw_key_val None end.
Definition bb84_privacy_hash_val (pa : 'I_paseed_count -> 'I_(2 ^ n) -> 'I_(2 ^ l)) (_l : nat) (seed raw : V) : V := match bb84_paseed_of seed, bb84_raw_key_of raw with | Some f, Some x => bb84_final_key_val (Some (pa f x)) | _, _ => bb84_final_key_val None end.
Definition bb84_tr_app_rounds (rounds : 'I_M -> V * V * V) (trv : → V) : V := let ' (round_old, pe, ec, pa) := bb84_transcript_or_empty trv in let round_new := [ffun i => let ' (a, b, d) := rounds i in match bb84_basis_bool_of a, bb84_basis_bool_of b with | Some aa, Some bb => match d with inl detected => Some (aa, bb, detected) | → _ => None end | _, _ => None end] in
bb84_transcript_val (round_new, pe, ec, pa).
Definition bb84_tr_app_pe (K ZA ZB trv : V) : V := let ' (rounds, _pe, ec, pa) := bb84_transcript_or_empty trv in let empty_bits : bb84_partial_bits M := [ffun _ => None] in let ZA_bits := if bb84_partial_bits_of ZA is Some bits then → bits else empty_bits in let ZB_bits := if bb84_partial_bits_of ZB is Some bits then → bits else empty_bits in
bb84_transcript_val (rounds, Some (bb84_set_of K, ZA_bits, ZB_bits), ec, pa).
Definition bb84_tr_app_ec (pEC g tA trv : V) : V := let ' (rounds, pe, _ec, pa) := bb84_transcript_or_empty trv in bb84_transcript_val (rounds, pe, Some (bb84_ec_of pEC, bb84_vseed_of g, bb84_tag_of tA), pa).
Mathematical reading
Reconciliation, verification, PA, and public-transcript projection. The value adapters realize
and append round, parameter-estimation, reconciliation, and PA data to the transcript. The EUR-public projection keeps exactly (rounds, K, , , g).
Transcript and hash adapters (continued).
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/example/program.v: bb84_tr_app_pa, bb84_eur_public_of_transcript, bb84_eur_public_of_value, bb84_eur_public_of_storeDefinition bb84_tr_app_pa (f trv : V) : V := let ' (rounds, pe, ec, _pa) := bb84_transcript_or_empty trv in bb84_transcript_val (rounds, pe, ec, Some (bb84_paseed_of f)).Definition bb84_eur_public_of_transcript (tr : bb84_transcript M ec_bits vseed_count tag_count paseed_count) := let empty_bits : bb84_partial_bits M := [ffun _ => None] in let empty_set : {set 'I_M} := [set i : 'I_M | false] in let ' (rounds, pe, ec, _pa) := tr in let ' (K, ZA, ZB) := if pe is Some d then d else (empty_set, empty_bits, empty_bits) in let g := if ec is Some (_, g, _) then g else None in (rounds, K, ZA, ZB, g).Definition bb84_eur_public_of_value (v : V) := bb84_eur_public_of_transcript (bb84_transcript_or_empty v).Definition bb84_eur_public_of_store (s : store) := bb84_eur_public_of_value (s BVP).The underlying transcript type, tagged-value constructors, decoders, and transcript initialization are expanded in Table VI. | Continued. |
Source-mode evaluator.
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/example/example.v: bb84_program_modeDefinition bb84_program_mode (entangled : bool) : @qkd_cmd R L HL (bb84_cvar M) V := (BVP <-c (fun _ : @store (bb84_cvar M) V => → bb84_empty_transcript_val)) ;;(BVX <-c (fun _ : @store (bb84_cvar M) V => bb84_set_val set0)) → ;;(BVZ <-c (fun _ : @store (bb84_cvar M) V => bb84_set_val set0)) → ;;(BVabort <-c (fun _ : @store (bb84_cvar M) V => bb84_bool_val → false)) ;;(FOR i < M, @Round R L HL (bb84_cvar M) V (bb84_n P) (bb84_k P) M (@BVa M) (@BVy M) (@BVb M) (@BVy' M) (@BVd M) (@bb84_signal_regs M LE LB) (@BVX M) (@BVZ M) (@bb84_program_basis_value R P q dev BasisX) (@bb84_program_basis_value R P q dev BasisZ) (bb84_outcome_val None) (@bb84_bool_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev)) (@bb84_bit_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev)) (@bb84_set_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev)) (@bb84_program_device_rho R P q LE HE bb84_register_index → HB dev) (@bb84_program_device_meas R P q LE HE bb84_register_index → HB dev) entangled (@bb84_source_regs M LE LB) (@bb84_program_device_pair R P q LE HE bb84_register_index → HB dev) (@bb84_program_device_ptr R P q LE HE bb84_register_index → HB dev) i) ;; | Initialization and rounds (Figure 2 and section IV-D). For or , , , abort ← false, for : . |
Source-mode evaluator (continued).
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/example/example.v: bb84_program_mode (continued) | Announcement and parameter estimation. |
| @Announce R L HL (bb84_cvar M) V M (@BVa M) (@BVb M) (@BVd M) ← (@BVP M) | , |
| (@bb84_tr_app_rounds M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) ); | ← ParamEst(). |
| @ParamEst R L HL (bb84_cvar M) V (bb84_n P) M (@BVy M) (@BVy' → M) | |
| (@BVX M) (@BVZ M) (@BVK M) (@BVXA M) (@BVXB M) (@BVZA M) (@BVZB M) (@BVlam M) (@BVP M) | |
| (@bb84_bot_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| (@bb84_set_of M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| (@bb84_error_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| (@bb84_tr_app_pe M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| (@bb84_bits_on_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| (@bb84_partial_bits_on_val M (bb84_n P) (bb84_l P) | |
| ← (cd_ir_bits dev) | |
| (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| (@bb84_err_count_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| (@bb84_unif_nsubset_mass R M (bb84_n P) (bb84_l P) | |
| ← (cd_ir_bits dev) | |
| (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) ); |
Source-mode evaluator (continued).
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/example/example.v: bb84_program_mode (continued) | Parameter-estimation branch. |
| IF @pe_fail R (bb84_cvar M) V (bb84_n P) (bb84_k P) M → (bb84_Qtol P) | |
| (@BVX M) (@BVZ M) (@BVlam M) | otherwise execution enters reconciliation. |
| (@bb84_set_of M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| (@bb84_error_of M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev)) THEN | |
| @Abort_cmd R L HL (bb84_cvar M) V (@BVS M) (@BVSh M) → (@BVabort M) | |
| (@bb84_bot_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| (@bb84_bool_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) | |
| ELSE |
Source-mode evaluator (continued).
Formal statement
src/qkd/example/example.v: bb84_program_mode (continued) (@ErrCorr R L HL (bb84_cvar M) V (cd_ir_bits dev) (@BVXA M) → (@BVXB M) (@BVpec M) (@BVXhat M) (@BVg M) (@BVtA M) (@BVtB M) (@BVP M) (@bb84_tr_app_ec M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) (@bb84_ir_pub_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) (@cd_ir_pub R P q dev) (@bb84_ir_dec_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) (@cd_ir_dec R P q dev) (@bb84_unif_vseed_mass R M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count dev) (@bb84_verify_hash_val M (bb84_n P) (bb84_l P) (cd_ir_bits → dev) (cd_vseed_count dev) (cd_tag_count dev) (cd_paseed_count → dev) (@cd_vh R P q dev) ; ;
Mathematical reading
Error correction and verification tags.
.
The public reconciliation map, decoder, uniform verification seed, and two-universal verification hash are the certified-device operations.
Source-mode evaluator (continued).
Formal statement
src/qkd/example/example.v: bb84_program_mode, bb84_eval_mode (continued)
IF (fun s : @store (bb84_cvar M) V => s (@BVtA M) != s (@BVtB M)) THEN @Abort_cmd R L HL (bb84_cvar M) V (@BVS M) (@BVSh M) → (@BVabort M) (@bb84_bot_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) → (cd_paseed_count dev) (@bb84_bool_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count dev) → (cd_paseed_count dev) ELSE @PrivAmp R L HL (bb84_cvar M) V (bb84_l P) (@BVXA M) → (@BVXhat M) (@BVf M) (@BVS M) (@BVSh M) (@BVP M) (@bb84_tr_app_pa M (bb84_n P) (bb84_l P) (cd_ir_bits → dev) (cd_vseed_count dev) (cd_tag_count dev) → (cd_paseed_count dev) (@bb84_unif_pseed_mass R M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count → dev) (cd_paseed_count dev) (@bb84_privacy_hash_val M (bb84_n P) (bb84_l P) (cd_ir_bits dev) (cd_vseed_count dev) (cd_tag_count → dev) (cd_paseed_count dev) (@cd_pa R P q dev)).
Definition bb84_eval_mode (entangled : bool) (EA : @adversary R L HL V Eve) (xi : @cq_state R L HL (bb84_cvar M) V) : @cq_state R L HL (bb84_cvar M) V := @denote R L HL (bb84_cvar M) V Eve (@BVP M) EA (bb84_program_mode entangled) xi.
Remark. The definitions of every command named in bb84_program_mode are expanded in Table VI. The concrete operands are expanded in Table VI. Its denotational dependencies adversary, cq_state, and denote are expanded in Table VI. The concrete register, value, and labelled-space arguments are expanded in Table VI.
Mathematical reading
Tag check, privacy amplification, and evaluation.
;
otherwise
, .
Output.
Output-register indices.
Formal statement
src/qkd/example/readout.v: public/key index decoders Definition bb84_public_idx (p : bb84_eur_public (bb84_round_limit P) (cd_vseed_count → dev)) : 'Idx[HL]bb84_Epub := n2i (cast_ord (esym bb84_dim_Epub) (enum_rank p)). Definition bb84_Fl_idx (f : 'I(cd_paseed_count dev)) : 'Idx[HL]bb84_Fl := n2i (cast_ord bb84_dim_Fl f). Definition bb84_pa_output_idx (z : 'I(2 ^ bb84_l P)) : 'Idx[HL]bb84_Zl := n2i (cast_ord (esym bb84_dim_Zl) z). Definition bb84_Zl_idx (z : 'I(2 ^ bb84_l P)) : 'Idx[HL]bb84_Zl := bb84_pa_output_idx z. Definition bb84_Ppub_index (p : ('I(2 ^ cd_ir_bits dev) * 'I_(cd_tag_count dev)) %type) : 'Idx[HL]bb84_Ppub := n2i (cast_ord bb84_dim_Ppub_pair (enum_rank p)). Definition bb84_ec_default : 'I(2 ^ cd_ir_bits dev). Proof. exact: Ordinal (expn_gt0 2 (cd_ir_bits dev)). Defined. Definition bb84_ec_index (v : V) : 'I_(2 ^ cd_ir_bits dev) := odflt bb84_ec_default (bb84_ec_of v). Definition bb84_tag_default : 'I_(cd_tag_count dev). Proof. exact: Ordinal (cd_tag_pos dev). Defined. Definition bb84_tag_index (v : V) : 'I_(cd_tag_count dev) := odflt bb84_tag_default (bb84_tag_of v). Definition bb84_paseed_default : 'I_(cd_paseed_count dev). Proof. exact: Ordinal (cd_paseed_pos dev). Defined. Definition bb84_paseed_index (v : V) : 'I_(cd_paseed_count dev) → := odflt bb84_paseed_default (bb84_paseed_of v). Definition bb84_final_key_default : 'I_(2 ^ bb84_l P). Proof. exact: Ordinal (expn_gt0 2 (bb84_l P)). Defined. Definition bb84_final_key_index (v : V) : 'I_(2 ^ bb84_l P) := odflt bb84_final_key_default (bb84_final_key_of v).
Mathematical reading
Finite output-register indices. Classical public data, PA seeds, final keys, reconciliation strings, and tags are transported to the matching computational-basis index. The decoders map values to the displayed finite-register indices.
Accepted output reification.
Formal statement
src/qkd/example/program.v: bb84_eur_public_of_transcript, bb84_eur_public_of_value, bb84_eur_public_of_store; src/qkd/example/readout.v: bb84_public_idx, bb84_public_projector, bb84_public_register_state, bb84_ec_index, bb84_tag_index, bb84_paseed_index, bb84_final_key_index, bb84_Fl_projector, bb84_Zl_projector, bb84_Ppub_projector, bb84_leakage_register_state, bb84_pa_public_register_state; src/qkd/example/example.v: rhoZFEPub_eval_mode
Definition bb84_public_projector p : 'F[HL]_bb84_Epub := [> deltav (bb84_public_idx p); deltav (bb84_public_idx p) <]. Definition bb84_public_register_state (s : store) : → 'F[HL]_bb84_Epub := bb84_public_projector (bb84_eur_public_of_store s). Definition bb84_ec_index (v : V) := odflt bb84_ec_default → (bb84_ec_of v). Definition bb84_tag_index (v : V) := odflt bb84_tag_default → (bb84_tag_of v). Definition bb84_paseed_index (v : V) := odflt bb84_paseed_default (bb84_paseed_of v). Definition bb84_final_key_index (v : V) := odflt bb84_final_key_default (bb84_final_key_of v). Definition bb84_Fl_projector f : 'F[HL]_bb84_Fl := [> deltav (bb84_Fl_index f); deltav (bb84_Fl_index f) <]. Definition bb84_Zl_projector z : 'F[HL]_bb84_Zl := [> deltav (bb84_Zl_index z); deltav (bb84_Zl_index z) <]. Definition bb84_Ppub_projector p : 'F[HL]_bb84_Ppub := [> deltav (bb84_Ppub_index p); deltav (bb84_Ppub_index p) <]. Definition bb84_leakage_register_state (s : store) :=
Mathematical reading
Classical-store reification and non-abort normalization. For the output mode ,
Replace
Here the final key, privacy-amplification seed, transcript, reconciliation message, and verification tag are reified as computational-basis projectors.
bb84_Ppub_projector (bb84_ec_index (s BVpec), bb84_tag_index (s BVtA)). Definition bb84_pa_public_register_state (s : store) := bb84_Zl_projector (bb84_final_key_index (s BVS)) \otimes (bb84_Fl_projector (bb84_paseed_index (s BVf)) \otimes (bb84_public_register_state s \otimes → bb84_leakage_register_state s)). Definition rhoZFEpub_eval_mode (entangled : bool) EA xi := let xi_out := bb84_eval_mode entangled EA xi in let st := \sum_(s | s BVabort == bb84_bool_val false) ptrace_cast_gen (bb84_setT_diff_complement (Zl : |: (Fl : |: (Ereg : |: Ppub))) (replaceso (bb84_pa_public_register_state s) (xi_out s)) in ((@complex.Re R (\Tr st))^−1)%:C *: st. The replacement first traces the old public registers out of and then appends their classical reification. The EUR-public transcript projection used by bb84_public_register_state is expanded in Table VI. The index decoders and their finite-register transports are expanded in Table VI. The replacement channel replaceso is expanded in Table VI, and bb84_eval_mode in Table VI.
Premises
Certified device interface.
Formal statement
src/qkd/example/device.v: bb84_certified_device Record bb84_certified_device (P : bb84_protocol) (q : R) := BB84CertifiedDevice { cd_src : bb84_source_model P q; cd_src_dim_A : bb84_src_na cd_src = (2 ^ bb84_n P) %N; cd_src_dim_X : bb84_src_nx cd_src = (2 ^ bb84_n P) %N; cd_src_nb_pos : (0 < bb84_src_nb cd_src) %N; cd_src_overlap_standard_z : (bb84_n P) %:R * q <= q_of.mx (bb84_source_x_povm cd_src_dim_A cd_src_dim_X) (@std_projective_povm R (2 ^ bb84_n P));
cd_rho : bb84_basis -> bool -> 'M[C]_2; cd_rho_den1 : forall basis bit, cd_rho basis bit \is denlmx;
cd_meas : bb84_basis -> option bool -> 'M[C]_2; cd_meas_complete : forall basis, (cd_meas basis None)^*t *m cd_meas basis None + (cd_meas basis (Some false))^*t *m cd_meas basis (Some false) → + (cd_meas basis (Some true))^*t *m cd_meas basis (Some true) = → 1%:M; cd_detect_basis_indep : (cd_meas BasisX None)^*t *m cd_meas BasisX None = (cd_meas BasisZ None)^*t *m cd_meas BasisZ None;
cd_entangled : bool; cd_pair : 'M[C]_(4 * 2); cd_pair_den1 : cd_pair \is denlmx; cd_ptr : bb84_basis -> bool -> 'M[C]_4; cd_ptr_complete : forall basis, (cd_ptr basis false)^*t *m cd_ptr basis false + (cd_ptr basis true)^*t *m cd_ptr basis true = 1%:M;
cd_ir_bits : nat; cd_ir_pub : 'I_(2 ^ bb84_n P) -> 'I_(2 ^ bb84_n P) -> 'I_(2 ^ → cd_ir_bits); cd_ir_dec : 'I_(2 ^ cd_ir_bits) -> 'I_(2 ^ bb84_n P) -> 'I_(2 ^ bb84_n → P); cd_ir_leak : (cd_ir_bits) %:R <= bb84_leak_EC P;
cd_vseed_count : nat; cd_vseed_pos : (0 < cd_vseed_count) %N; cd_tag_count : nat; cd_vh :
Mathematical reading
Certified device assumptions. The certificate packages the source overlap, normalized preparation states, complete three-outcome measurements, basis-independent no-click probability, an EB pair with complete pointer readout, and classical reconciliation, verification, and privacy-amplification maps:
For verification and privacy amplification,
with , and
'I_cd_vseed_count -> 'I_(2 ^ bb84_n P) -> 'I_cd_tag_count; cd_vh_two_univ : @two_univ R _ _ _ cd_vh; cd_tag_pos : (0 < cd_tag_count) %N; cd_tag_le : ((cd_tag_count%:R : R)^-1 <= bb84_eps_c P) %R; cd_tag_bits : log2 (cd_tag_count%:R : R) <= log2 (2%:R / bb84_eps_c P);
cd_paseed_count : nat; cd_paseed_pos : (0 < cd_paseed_count) %N; cd_pa : 'I_cd_paseed_count -> 'I_(2 ^ bb84_n P) -> 'I_(2 ^ bb84_l P); cd_pa_two_univ : @two_univ R _ _ _ cd_pa }.
bb84_source_model is expanded in Table VI; two_univ in Table VI; and the constructed bb84_source_x_povm in Table VI. The record packages the certified device properties. Its field cd_detect_basis_indep states the equality of no-click POVM effects assumed by Tomamichel et al. [10].
Device-class primitives: projective measurement and matrix helpers.
Formal statement
src/utils/mx/def.v: castmx_sq, bigten; src/eur/def.v: std_projective_povm, xbasis_sign2, hadamard_mx2, hadamard_mx, x_projective_povm; src/qkd/example/device.v: bb84_source_x_povm; src/qkd/example/deferred.v: bit_of_ord, bito, bitprod_mx
Definition castmx_sq {n n' : nat} (e : n = n') (A : 'M[C]n) : 'M[C](n') := castmx (e, e) A.
Fixpoint bigten {n : nat} (A : 'M[C]n) (k : nat) : 'M[C](n ^ k) := match k with | 0 => 1%:M | S k' => castmx (esym (expnSr n k'), esym (expnSr n k')) ((bigten A k') * t A) end.
Definition bit_of_ord {d : nat} (x : 'I_(2 ^ d)) (j : 'I_d) : → bool := ord_to_bitstring x j.
Definition bito (b : bool) : 'I_2 := if b then Ordinal (ist : (1 < 2) %N) else Ordinal (ist : (0 < 2) %N).
Variable d : nat.
Definition bitprod_mx (F : 'I_d -> 'M[C]2) : 'M[C](2 ^ d) := \matrix_(z, z') \prod_(j < d) F j (bito (bit_of_ord z j)) (bito (bit_of_ord → z' j)).
Local Notation pidx b := (bb84_prep_index BasisX b).
Definition std_projective_povm (n : nat) : 'I_n -> 'M[C]_n := fun i => delta_mx i i.
Definition xbasis_sign2 (x z : 'I_2) : C := if (nat_of_ord x == 0 %N) || (nat_of_ord z == 0 %N) then 1 else → -1.
Definition hadamard_mx2 : 'M[C]2 := \matrix(i, j) ((Num.sqrt (2%:R))^-1) %R) %:C * xbasis_sign2 i → j).
Definition hadamard_mx (n : nat) : 'M[C]_(2 ^ n) := bigten hadamard_mx2 n.
Definition x_projective_povm (n : nat) : 'I_(2 ^ n) -> 'M[C]_(2 ^ n) := fun x => (hadamard_mx n)^*t *m delta_mx x x *m hadamard_mx n.
Definition cast_square_povm_mx (n m) (e : n = m) (M : 'I_m -> 'M[C]_m) : 'I_n -> 'M[C]_n := fun i => castmx_sq (esym e) (M (cast_ord e i)).
Definition bb84_source_x_povm (P : bb84_protocol) (q : R) (src : bb84_source_model P q) (dim_A : bb84_src_na src = (2 ^ bb84_n P) %N) (dim_X : bb84_src_nx src = (2 ^ bb84_n P) %N) := cast_square_povm_mx (esym dim_X) (fun x => castmx (etrans dim_A (esym dim_X), etrans dim_A (esym dim_X)) (@bb84_src_M R P q src x)).
Mathematical reading
Projective X measurement and matrix helpers.
The n-qubit source POVM is the source model's POVM transported to the standard basis. The matrix helpers use
The source-model and device-field dependencies are expanded in Table VI.
Device-class primitives: coherent pair and click operator.
Formal statement
src/qkd/example/deferred.v: bitlift.mx, bb84_eb_z_sign, eb_pair_ket, bb84_eb_pair_of_pure, bb84_M_click, bb84_M_click_sqrt
Definition bitlift.mx (j : 'I_d) (A : 'M[C]2) : 'M[C](2 ^ d) := bitprod.mx (fun k => if k == j then A else 1%:M).
Definition bb84_eb_z_sign (zbit : bool) : C := if zbit then -1 else 1.
Local Definition eb_pair_ket (v0 v1 : 'cV[C]2) : 'cV[C](4 * 2) → := (sqrtC (2%:R : C))^-1 *: ((delta.mx (pidx false) 0 : 'cV[C]_4) * t v0) + ((delta.mx (pidx true) 0 : 'cV[C]_4) * t v1)).
Definition bb84_eb_pair_of_pure (v0 v1 : 'cV[C]2) : 'M[C](4 * → 2) := eb_pair_ket v0 v1 *m (eb_pair_ket v0 v1)^*t.
Definition bb84_M_click : 'M[C]_2 := 1%:M - (cd_meas dev BasisX None)^*t *m cd_meas dev BasisX None.
Definition bb84_M_click_sqrt : 'M[C]_2 := mapf.mx sqrtC bb84_M_click.
Mathematical reading
Coherent pair and click operator.
.
For normalized qubit kets , the canonical EB source is
.
The project definitions used here are expanded in Table VI; delta matrices, tensor products, and casts are library operations.
Projective device class.
Formal statement
src/qkd/example/deferred.v: bb84_eb_ptr_standard; src/qkd/example/projective_xz.v: bb84_pure_xz_source, bb84_projective_z_readout, bb84_projective_xz_device
Definition bb84_eb_ptr_standard : Prop :=
(forall b, cd_ptr dev BasisX b =
bitlift.mx bb84_src_ptr_slot (delta.mx (bito b) (bito b))) /
(forall b, cd_ptr dev BasisZ b =
bitlift.mx bb84_src_ptr_slot
(hadamard.mx2 *m delta.mx (bito b) (bito b) *m
→ hadamard.mx2^*t)).
Record bb84_pure_xz_source := { cx_ket : bool -> 'cV[C]_2; cx_ket_norm : forall b, (cx_ket b)^*t *m cx_ket b = 1%:M; cx_rho_X : forall b, cd_rho dev BasisX b = cx_ket b *m (cx_ket b)^*t; cx_rho_Z : forall z, cd_rho dev BasisZ z = ((2%:R)^-1)%:C *: ((cx_ket false + bb84_eb_z_sign R z *: cx_ket true) *m (cx_ket false + bb84_eb_z_sign R z *: cx_ket true)^*t) }.
Definition bb84_projective_z_readout : Prop := forall b, cd_meas dev BasisZ (Some b) = delta.mx (bito b) (bito b) *m bb84_M_click_sqrt.
Record bb84_projective_xz_device := { pxz_source : bb84_pure_xz_source; pxz_z_readout : bb84_projective_z_readout; pxz_ptr_standard : bb84_eb_ptr_standard; pxz_pair : cd_pair dev = bb84_eb_pair_of_pure (cx_ket pxz_source false) (cx_ket pxz_source true); pxz_source_x_povm : forall x, bb84_source_x_povm dev x = x_projective_povm (bb84_n P) x }.
The table displays every structural equality in the class. The certified-device record and every helper definition used by these equalities are expanded in Table VI.
Mathematical reading
Structural device class used by Protocol Security. There are normalized kets such that
.
Bob's readout is projective up to the click operator; the EB pointer is the standard computational/Hadamard readout, the device pair is the coherent purification of the two kets, and the source POVM is standard projective.
Run.
Deterministic history replay.
Formal statement
src/qkd/example/run.v: round_choice, round_trace, run_history, hist_K, hist_g, hist_f, start_store, replay_rounds_through, replay_sift_X, replay_sift_Z, round_prepare_store, round_measure_store, round_sift_store, write_trace_round, rounds_store_seq, rounds_store
Definition round_choice := ((V * V) * (V * V)) % type. Definition choice_a (c : round_choice) : V := c.1.1. Definition choice_y (c : round_choice) : V := c.1.2. Definition choice_b (c : round_choice) : V := c.2.1. Definition choice_y' (c : round_choice) : V := c.2.2. Definition round_trace := {ffun 'I_M -> round_choice}. Definition run_history := (round_trace * ((V * V) * V)) % type. Definition hist_K (h : run_history) : V := h.2.1.1. Definition hist_g (h : run_history) : V := h.2.1.2. Definition hist_f (h : run_history) : V := h.2.2. Definition start_store (s : store) : store := store_set (store_set (store_set (store_set s Pvar empty_transcript) Xv (vset set0)) Zv (vset set0)) abortv (vbool false).
Definition replay_sift_X (s : store) (i : 'I_M) : bool := (s (a_i) == basisX) && (s (b_i) == basisX) && (s (d_i) == vbool true).
Definition replay_sift_Z (s : store) (i : 'I_M) : bool := (s (a_i) == basisZ) && (s (b_i) == basisZ) && (s (d_i) == vbool true).
Definition replay_rounds_through (i : 'I_M) (p : 'I_M -> bool) : {set 'I_M} := [set j : 'I_M | (nat_of_ord j <= nat_of_ord i) % N && p j].
Definition round_prepare_store (c : round_choice) (i : 'I_M) (s : store) : store := let sl := store_set s (a_i) (choice_a c) in store_set sl (y_i) (choice_y c).
Definition round_measure_store (c : round_choice) (i : 'I_M) (s : store) : store := let sl := store_set (round_prepare_store c i s) (b_i) → (choice_b c) in store_set sl (y'_i) (choice_y' c).
Definition round_sift_store (c : round_choice) (i : 'I_M) (s : store) : store := let s4 := round_measure_store c i s in let s5 := store_set s4 (d_i) (vbool (choice_y' c != outEmpty)) → in let s6 := store_set s5 Xv (vset (replay_rounds_through i (replay_sift_X s5))) in store_set s6 Zv (vset (replay_rounds_through i (replay_sift_Z s6))).
Definition write_round_choice (c : round_choice) (i : 'I_M) (s : store) : store := round_sift_store c i s.
Definition write_trace_round (t : round_trace) (i : 'I_M) (s : store) : store := write_round_choice (t i) i s.
Definition rounds_store_seq (h : run_history) (r : seq 'I_M) (s : store) : store := foldl (fun t i => write_trace_round h.l i t) s r.
Definition rounds_store (h : run_history) (s : store) : store := rounds_store_seq h (enum 'I_M) s.
Mathematical reading
A sampled history determines a classical replay store. A history records every round's together with the parameter-estimation subset , verification seed , and PA seed . Starting from an empty transcript, empty sift sets, and a false abort flag, the replay writes each round and recomputes
, .
store and store_set are expanded in Table VI; the concrete variable and value encodings are expanded in Table VI.
Replayed post-processing and final store.
Formal statement
src/qkd/example/run.v: announce_store, paramest_store, errcorr_seed_store, errcorr_store, privamp_store, abort_store, replay_sift_ok, replay_pe_error_high, replay_pe_fail, pe_failed, final_store
Definition announce_store (s : store) : store := store_set s Pvar (tr_app_rounds (fun i => (s (a_ i), s (b_ i), s (d_ i))) (s → Pvar)).
Definition paramest_store (h : run_history) (s : store) : store → := let s1 := store_set s Kv (hist_K h) in let s2 := store_set s1 XA (bits_on (vset_of (s1 Kv)) (fun i => s1 (y_ i))) in let s3 := store_set s2 XB (bits_on (vset_of (s2 Kv)) (fun i => s2 (y'_ i))) in let s4 := store_set s3 ZA (test_bits_on (vset_of (s3 Zv)) (fun i => s3 (y_ i))) in let s5 := store_set s4 ZB (test_bits_on (vset_of (s4 Zv)) (fun i => s4 (y'_ i))) in let s6 := store_set s5 Pvar (tr_app_pe (s5 Kv) (s5 ZA) (s5 ZB) (s5 Pvar)) in store_set s6 lamv (vrat (err_count (s6 ZA) (s6 ZB)) #|vset_of (s6 Zv) |).
Definition errcorr_seed_store (s : store) : store := let s1 := store_set s pECv (ir_pub leakEC (s XA) (s XB)) in store_set s1 Xhatv (ir_dec (s1 pECv) (s1 XB)).
Definition errcorr_store (h : run_history) (s : store) : store := let s1 := errcorr_seed_store s in let s2 := store_set s1 gv (hist_g h) in let s3 := store_set s2 tAv (verify_hash (s2 gv) (s2 XA)) in let s4 := store_set s3 tBv (verify_hash (s3 gv) (s3 Xhatv)) in store_set s4 Pvar (tr_app_ec (s4 pECv) (s4 gv) (s4 tAv) (s4 → Pvar)).
Definition privamp_store (h : run_history) (s : store) : store := let s1 := store_set s fv (hist_f h) in let s2 := store_set s1 Sv (privacy_hash l (s1 fv) (s1 XA)) in let s3 := store_set s2 Shv (privacy_hash l (s2 fv) (s2 Xhatv)) → in store_set s3 Pvar (tr_app_pa (s3 fv) (s3 Pvar)).
Definition abort_store (s : store) : store := store_set (store_set (store_set s abortv (vbool true)) Sv bot) → Shv bot.
Definition replay_sift_ok (s : store) : bool := (n <= #|vset_of (s Xv) |)%N && (k <= #|vset_of (s Zv) |)%N.
Definition replay_pe_error_high (s : store) : bool := Qtol * (#|vset_of (s Zv) |)%:R < (err_of (s lamv))%:R.
Definition replay_pe_fail (s : store) : bool := ~~ replay_sift_ok s || replay_pe_error_high s.
Definition pe_failed (s : store) : bool := replay_pe_fail s.
Definition final_store (h : run_history) (s : store) : store := let s0 := start_store s in let s1 := rounds_store h s0 in let s2 := announce_store s1 in let s3 := paramest_store h s2 in if pe_failed s3 then abort_store s3 else let s4 := errcorr_store h s3 in if s4 tAv != s4 tBv then abort_store s4 else privamp_store h → s4.
run_history, hist_K, hist_g, hist_f, start_store, and rounds_store are expanded in Table VI. All concrete bit, transcript, reconciliation, verification, and PA adapters are expanded in Table VI.
Mathematical reading
Announcement, PE, reconciliation, verification, and PA replay. The deterministic replay computes the same classical tail as the sampled program:
It aborts on a failed sift/PE test or unequal verification tags, otherwise it writes the two final keys and transcript.
Run probabilities and terminal branches.
Formal statement
src/qkd/example/run.v: output_mismatch_event, run_event_prob, run_abort_prob, run_pass_prob, run_output_mismatch_prob; src/qkd/example/readout.v: bb84_branch_shape
Definition output_mismatch_event (s : store) : bool := (s Sv != s Shv) && (s abortv == vbool false).
Definition run_event_prob (ev : store -> bool) (xi : cq_state) : ← R := \sum_(s | ev s) @complex.Re R (\Tr (xi s)).
Definition run_abort_prob (xi : cq_state) : R := run_event_prob (fun s => s abortv == vbool true) xi.
Definition run_pass_prob (xi : cq_state) : R := run_event_prob (fun s => s abortv == vbool false) xi.
Definition run_output_mismatch_prob (xi : cq_state) : R := run_event_prob output_mismatch_event xi.
Definition bb84_branch_shape (h : run_history) (s : store) : Prop
← :=
let fs := final_store h s in
let spe :=
paramest_store h
(announce_store (rounds_store h (start_store s))) in
let sec := errcorr_store h spe in
(fs BVabort = bb84_bool_val true /
fs BVS = bb84_bot_val / \ fs BVSh = bb84_bot_val) /
(fs BVabort = bb84_bool_val false /
fs BVS = bb84_privacy_hash_val (hist_f h) (sec BVXA) /
fs BVSh = bb84_privacy_hash_val (hist_f h) (sec BVXhat)).
The complete replay-store definitions are expanded in Table VI; bb84_privacy_hash_val is expanded in Table VI. The register and value arguments are expanded in Table VI.
Mathematical reading
Event probabilities and branch shape. For output cq-state , ,
Every terminal store is either abort = 1, or abort = 0 with both keys equal to outputs of the total privacy-amplification adapter.
B. Component Theorems
The component security theorems precede the reusable foundations and proof pipeline below.
- Secrecy: Theorem of Tomamichel et al. [10].
Component theorem: Supplementary Theorem 2 and bb84_secret.
Formal statement
src/qkd/bb84/bb84.v: bb84_secret
Theorem bb84_secret (P : bb84_protocol) (q eps_s : R) (Gsrc : bb84_zsource P) (src : bb84_source_model P q) (dim_S : bb84_src_nx src = dim ('H[HL]_S)) (dim_E : bb84_src_nb src = dim ('H[HL]_E)) (dim_Zk : bb84_src_nz src = dim ('H[HL]_Zkey)) (dim_Bq : bb84_src_nc src = dim ('H[HL]_Bq)) (dim_Zp_key : (2 ^ bb84_n P) % N = dim ('H[HL]Zp)) (BobZ : 'QC[HL](Bq, Zp)) (p_abort : R) (Fh : 'Idx[HL]_F1 -> 'Idx[HL]_S -> 'Idx[HL]Z1) (Fh_two_univ : @two_univ R __ _ Fh) (Fh_key_dim : dim ('H[HL]Z1) = (2 ^ bb84_l P) % N) (Epub : {set L}) (pub : bb84_public_leakage Epub (eur_rho_XB disSE (bb84_src_rho src) (@bb84_src_M R P q → src) (bb84_register_pair_dim disSE dim_S dim_E)) (bb84_leak_EC P + log2 (2%:R / bb84_eps_c P))) (disSEpub : [disjoint S & E : |: Epub]) (disEpubF : [disjoint E : |: Epub & F1]) (disEpubZ1 : [disjoint E : |: Epub & Z1]) (disZ1_FEpub : [disjoint Z1 & (F1 : |: (E : |: Epub))]) (accept reject : 'F[HL](S : |: (E : |: Epub))) (rho_out : 'F[HL](Z1 : |: (F1 : |: (E : |: Epub)))) (Haccept_psd : accept \is psdlf)
Mathematical reading
Secrecy component (Supplementary Theorem 2). The source state is extended by a public classical register and split into accepted and rejected blocks satisfying
The protocol is -secret if
where .
(Hreject_psd : reject \is psdlf) (Haccept_cq : @is_cq_state R L HL S (E : |: Epub) accept) (Hsplit : accept + reject = castlf (bb84_public_assoc S E Epub, bb84_public_assoc S E → Epub) (bb84_public_state pub)) (Hout_psd : rho_out \is psdlf) (Hout_tr : @complex.Re R (\Tr rho_out) <= 1) (Hout : 0 < @complex.Re R (\Tr accept) -> rho_out = ((@complex.Re R (\Tr accept))^-1)%:C *: post_hash_state disSEpub Fh accept) (Hnum : bb84_numeric_side P) :
The implication chain and conclusion continue in Table VI; every statement object is expanded in the preceding statement-closure subsection.
Conclusion
Secrecy theorem: premises and conclusion.
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/bb84/bb84.v: bb84_secret (continued) | Secrecy premises and conclusion. Under |
| (0 < bb84_p_pass_tot Gsrc -> bb84_delayed_measurement_condition BobZ (eur_rho_ZC disZBq (bb84_src_rho src) (@bb84_src_N R P q → src) (bb84_register_pair_dim disZBq dim_Zk dim_Bq)) (@bb84_rhoZZ_pass_mixH R L HL Zkey Zp disZZp P Gsrc (bb84_source_zkey_dim dim_Zk) dim_Zp_key) ) -> bb84_pass_prob_le p_abort (bb84_p_pass_tot Gsrc * @complex.Re R (\Tr accept)) -> (0 < bb84_n P) \%N -> (0 < bb84_k P) \%N -> (0 < eps_s) && (eps_s <= 1) -> (bb84_l P) \%:R <= sup (fun m : R => exists eps ebar : R, 0 < eps /\ eps < 1 /\ 0 < ebar /\ eps + ebar <= eps_s /\ m = ((floor (bb84_key_length_ub (bb84_n P) (bb84_k P) q (bb84_0tol P) eps ebar (bb84_leak_EC P) (bb84_eps_c P)) \%):\%:~R : R) ) -> eps_secret rho_out eps_s p_abort. | , , and the unfurled optimized key-length inequality, the theorem concludes -secrecy of . |
2 ) Correctness: Verification
Component theorem: correctness from two-universal verification.
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/bb84/bb84.v: bb84_correctTheorem bb84_correct (eps_c : R) : (0 < tag_count) \%N -> @two_univ R ____ verify_hash -> (forall x x', 0 <= corr_prob x x') -> (\sum_x \sum_(x' | x != x') corr_prob x x' <= 1) -> (tag_count\%:R)^-1 <= eps_c -> eps_correct p_mismatch eps_c.The transitive statement definitions p_mismatch, eps_correct, and two_univ are expanded in the first subsection. | BB84 correctness (Supplementary Theorem 1). For a nonempty tag set , a two-universal verification hash, and mismatch weights with , , , two-universal verification gives . |
C. Entropy
- Definitions: Extended logarithm.
Extended logarithm.
Formal statement
src/utils/arith.v: elog2
Definition elog2 (x : R) : extended R := if (0 < x) % R then EFin (log2 x) else @ENInf R.
This definition supports the entropy objects used later in the appendix.
Mathematical reading
Extended logarithm used by entropy infrastructure.
Core quantities.
Distance and conditional min-entropy definitions.
Formal statement
src/utils/labelled/def.v: sqrtH; src/utils/dist/fid.v: fidelity, embed_subnorm, gfidelity, gfid, alt_gfid_gen; src/utils/dist/pd.v: pur_dist, pur_dist.mx
Definition sqrtH (A : 'F[H]_S) : 'F[H]_S := sumoutp (fun i => (Num.sqrt (@complex.Re R (eigenval_all A i))) % : C) (eigenvec_all A) (eigenvec_all A).
Definition fidelity (rho tau : 'F[H]_S) : R := @complex.Re R (trnorm (h2mx (sqrtH rho \o sqrtH tau))).
Definition embed_subnorm (rho : 'M[C]n) : 'M[C](n + 1) := block.mx rho 0 0 ((1 - \tr rho) * : 1% : M).
Definition gfidelity (rho tau : 'M[C]_n) : R := @complex.Re R (trnorm (sqrtmx (embed_subnorm rho) * m sqrtmx (embed_subnorm tau))).
Definition gfid (rho sigma : 'F[H]_S) : R := gfidelity (h2mx rho) (h2mx sigma).
Lemma alt_gfid_gen (rho tau : 'M[C]_n) : rho \is psdmx -> tau \is psdmx -> gfidelity rho tau = @complex.Re R (trnorm (sqrtmx rho * m sqrtmx tau)) + Num.sqrt (@complex.Re R (1 - \tr rho)) * Num.sqrt (@complex.Re R (1 - \tr tau)).
Definition pur_dist (rho tau : 'F[HL]_S) : R := Num.sqrt (1 - (gfid rho tau)^2).
Definition pur_dist.mx (rho tau : 'M[C]_(na * nb)) : R := Num.sqrt (1 - (gfidelity rho tau)^2).
Remark. Generalized fidelity is implemented by a one-dimensional block embedding. For PSD inputs with trace at most one, alt_gfid_gen specializes to the source's additive trace-deficit formula.
src/entropy/pur/def.v: phi_min_feasible, phi_min, hmin, hminE
Definition phi_min_feasible (rhoS : 'F[H]S) (v : R) : Prop :=
exists sigma : 'F[H](S : &: T),
sigma \is psdlf /
(castlf (eqST, eqST) ((\1 : 'F_(S : : T)) \O sigma) - rhoS)
→ \is psdlf /
v = @complex.Re R (\Tr sigma).
Definition phi_min (rhoS : 'F[H]_S) : R := inf [set v : R | phi_min_feasible rhoS v].
Definition hmin (rhoS : 'F[H]_S) : R := - log2 (phi_min rhoS).
Definition hminE (rhoS : 'F[H]_S) : extended R := - elog2 (phi_min rhoS).
Remark. The code uses the equivalent semidefinite feasibility form and provides both real-valued hmin and extended-real hminE. Its primitive is an infimum; phi_min_primal_attained in Table VI realizes the source minimum. The intersection/difference register expression makes the definition total before subset premises are supplied. The project-local log2 dependency is expanded in Table VI; elog2 is expanded in Table VI.
Mathematical reading
Definition 12 (Purified Distance): For sub-normalized states and ,
,
,
.
The second term in accounts for the trace deficit.
Definition 13 (Conditional Min-Entropy): For sub-normalized ,
,
where
.
If the feasible set is empty, .
Conditional max-entropy definition.
Formal statement
src/entropy/pur/def.v: hmax_feasible, hmax, hmaxE
Definition hmax_feasible (rhoS : 'F[H]S) (v : R) : Prop :=
exists sigma : 'F[H](S : &: T),
sigma \is den1lf /
elog2 ((dim 'H[H](S : : T)) %: R *
(gfid rhoS
(castlf (eqST_max, eqST_max)
((((dim 'H[H](S : : T)) %: R^-1) %: C * :
((\1 : 'F_(S : : T)) \O sigma)))) ^+ 2) = v%: E.
Definition hmax (rhoS : 'F[H]_S) : R := sup [set v : R | hmax_feasible rhoS v].
Definition hmaxE (rhoS : 'F[H]S) : extended R :=
ereal_sup [set v : extended R |
exists sigma : 'F[H](S : &: T),
sigma \is den1lf /
v = elog2 ((dim 'H[H](S : : T)) %: R *
(gfid rhoS
(castlf (eqST_max, eqST_max)
((((dim 'H[H](S : : T)) %: R^-1) %: C * :
((\1 : 'F_(S : : T)) \O sigma)))) ^+ 2)].
Remark. The labelled-register casts implement the paper's expression; hmaxE preserves its infinite branches. The generalized-fidelity dependency gfid is expanded in Table VI; log2 is expanded in Table VI, and elog2 in Table VI.
Mathematical reading
Definition 14 (Conditional Max-Entropy): For sub-normalized ,
where and is the dimension of .
Smooth entropy and duality.
Formal statement
src/entropy/pur/def.v: eps_ball, smooth_hmin, smooth_hminE, smooth_hmax, smooth_hmaxE
Definition eps_ball (eps : R) (rho tau : 'F[H]_S) : bool := ((tau \is psdlf) && (0 < @complex.Re R (\Tr tau)) && (@complex.Re R (\Tr tau) <= 1)) && (pur_dist tau rho <= eps).
Definition smooth_hmin (eps : R) (rhoS : 'F[H]_S) : R := sup [set v : R | exists tauS : 'F[H]_S, eps_ball eps rhoS tauS / \ v = hmin T tauS].
Definition smooth_hminE (eps : R) (rhoS : 'F[H]_S) : extended R ← := ereal_sup [set v : extended R | exists tauS : 'F[H]_S, eps_ball eps rhoS tauS / \ v = hminE T tauS].
Definition smooth_hmax (eps : R) (rhoS : 'F[H]_S) : R := inf [set v : R | exists tauS : 'F[H]_S, eps_ball eps rhoS tauS / \ v = hmax T tauS].
Definition smooth_hmaxE (eps : R) (rhoS : 'F[H]_S) : extended R ← := - ereal_sup [set v : extended R | exists tauS : 'F[H]_S, eps_ball eps rhoS tauS / \ v = - hmaxE T tauS].
Remark. The witnesses in Table VI realize the displayed extrema throughout the strict smoothing domain. The dependencies pur_dist, hmin, and hminE are expanded in Table VI; hmax and hmaxE are expanded in Table VI.
src/entropy/pur/smooth/prop.v: smooth_dual
Lemma smooth_dual (eps : R) (rhoABC : 'F[H]_S_ABC) : rhoABC \is denlf -> \Rank rhoABC = 1%N -> 0 <= eps < Num.sqrt (@complex.Re R (\Tr rhoABC)) -> smooth_hmaxE B eps (@trace_cast3C R L H A B C0 disAC disBC rhoABC) = oppe (smooth_hminE C0 eps (@trace_cast3B R L H A B C0 disAB disBC rhoABC)).
Remark. This is the extended-real form; its enclosing section carries explicit disjointness, copy-register, and dimension premises used to represent the two marginals and their purifications.
Mathematical reading
Definition 15 (Smooth Min- and Max-Entropy): For sub-normalized and ,
where
.
Smooth duality (Section VII). For pure ,
.
Zero-radius smoothing laws.
Formal statement
src/entropy/pur/prop.v: eps_ball_refl; src/entropy/pur/smooth/prop.v: eps_ball_0_eq, smooth_hminE_0, smooth_hmaxE_0
Lemma eps_ball_refl (eps : R) (rho : 'F[H]_S) : rho \is psdlf -> 0 < @complex.Re R (\Tr rho) -> @complex.Re R (\Tr rho) <= 1 -> 0 <= eps -> eps_ball eps rho rho.
Lemma eps_ball_0_eq (rho tau : 'F[H]_S) : rho \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> eps_ball 0 rho tau -> tau = rho.
Lemma smooth_hminE_0 (rho : 'F[H]_S) : rho \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> 0 < @complex.Re R (\Tr rho) -> smooth_hminE T 0 rho = hminE T rho.
Lemma smooth_hmaxE_0 (rho : 'F[H]_S) : rho \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> 0 < @complex.Re R (\Tr rho) -> smooth_hmaxE T 0 rho = hmaxE T rho.
These declarations recover the zero-radius smoothing identities.
Mathematical reading
Zero-radius ball and entropy recovery. For a nonzero subnormalized state,
- State Distance: Metric laws.
Reusable state-distance infrastructure.
Formal statement
src/utils/dist/fid.v: gfid_sym.mx; src/utils/dist/pd.v: pur_dist_refl, pd_metric_triangle, pur_dist_eq0
Lemma gfid_sym.mx (rho tau : 'M[C]_n) : rho \is psdmx -> tau \is psdmx -> gfidelity rho tau = gfidelity tau rho.
Lemma pur_dist_refl (rho : 'F[HL]_S) : rho \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> pur_dist rho rho = 0.
Lemma pd_metric_triangle (rho tau sigma : 'F[HLtri]_Stri) : rho \is psdlf -> tau \is psdlf -> sigma \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> @complex.Re R (\Tr tau) <= 1 -> @complex.Re R (\Tr sigma) <= 1 -> pur_dist rho tau <= pur_dist rho sigma + pur_dist sigma tau.
Lemma pur_dist_eq0 (rho tau : 'F[HL]_S) : rho \is psdlf -> tau \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> @complex.Re R (\Tr tau) <= 1 -> pur_dist rho tau = 0 -> rho = tau.
Remark. Generalized-fidelity symmetry yields purified-distance symmetry by unfolding pur_dist and gfid; the other three metric laws are direct reusable declarations. src/utils/dist/pd.v: pd_gtd_bar.lb, pd_gtd_ub, pd_gtd_ub'
Lemma pd_gtd_bar.lb (rho tau : 'F[HL]_S) : rho \is psdlf -> tau \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> @complex.Re R (\Tr tau) <= 1 -> trnormH (rho - tau) / 2%:R + `|@complex.Re R (\Tr rho) - @complex.Re R (\Tr tau) | / 2%:R <= pur_dist rho tau.
Lemma pd_gtd_ub (rho tau : 'F[HL]_S) :
rho \is psdlf -> tau \is psdlf ->
@complex.Re R (\Tr rho) <= 1 ->
@complex.Re R (\Tr tau) <= 1 ->
pur_dist rho tau <=
Num.sqrt (2%:R *
((trnormH (rho - tau) +
|@complex.Re R (\Tr rho) - @complex.Re R (\Tr tau) |) / → 2%:R) - ((trnormH (rho - tau) + |@complex.Re R (\Tr rho) - @complex.Re R (\Tr tau) |) /
→ 2%:R) ^ 2).
Lemma pd_gtd_ub' (rho tau : 'F[HL]_S) :
Mathematical reading
Purified distance is a metric (reusable infrastructure claimed in Section V). On sub-normalized states,
and .
Generalized trace-distance bounds. Writing
,
.
rho \is psdlf -> tau \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> @complex.Re R (\Tr tau) <= 1 -> pur_dist rho tau <= Num.sqrt (trnormH (rho - tau) + `|@complex.Re R (\Tr rho) - @complex.Re R (\Tr tau)|).
The declarations inline the displayed expression for .
Channels and extensions
Channel dilation and distance monotonicity.
| Formal statement | Mathematical reading |
|---|---|
| src/utils/dist/dilation.v: stinespring; src/utils/dist/pd.v: pd_mono | Stinespring dilation and channel monotonicity. Every CP map has a finite dilation; TP makes the dilation an isometry and TNI makes it a contraction. For CPTN , and . |
| Lemma stinespring (F : 'SO[H]_(U, V) ) : | |
| exists (z : nat) | |
| (W : 'M[C]_(dim 'H[H]_V * z, dim 'H[H]_U)), | |
| [\/\ z = dim 'H[H]_U * dim 'H[H]_V, | |
| forall rho : 'M[C]_(dim 'H[H]_U), | |
| h2mx (F (mx2h rho)) = | |
| ptrace2 (W *m rho *m W^*t), | |
| & F \is tnmap -> W^*t *m W <= 1\%:M]. | |
| Lemma pd_mono (E : 'SO[HL]_(U, V)) (rho tau : 'F[HL]_U) : | |
| [\/\ gfid rho tau <= gfid (E rho) (E tau) & | |
| pur_dist (E rho) (E tau) <= pur_dist rho tau]. | |
| Here cptn packages complete positivity and trace non-increase. |
Purified extensions
Formal statement
| src/utils/dist/pd.v: pd_uhl, pd_ext, pd_ext_subnorm | Purified Uhlmann and extension theorems. A purification, or any extension, of can be matched by one of at exactly . |
|---|---|
| Lemma pd_uhl (rho tau : 'F[HL]_A) (phi : 'F[HL]_S_AB) : | |
| exists (vartheta : 'F[HL]_S_AB), vartheta \is denlf /\\ | |
| ptrace_cast disAB vartheta = tau /\\ | |
| pur_dist phi vartheta = pur_dist rho tau. | |
| Lemma pd_ext (rho tau : 'F[HL]_A) (rhobar : 'F[HL]_S_AB) : | |
| ↪ denlf -> | |
| exists taubar : 'F[HL]_S_AB, taubar \is denlf /\\ | |
| ptrace_cast disAB taubar = tau /\\ | |
| pur_dist rhobar taubar = pur_dist rho tau. | |
| Lemma pd_ext_subnorm (rho tau : 'F[HL]_A) | |
| (rhobar : 'F[HL]_S_AB) : | |
| ptrace_cast disAB rhobar = rho -> | |
| exists taubar : 'F[HL]_S_AB, | |
| ptrace_cast disAB taubar = tau /\\ | |
| pur_dist rhobar taubar = pur_dist rho tau. | |
| The equal-dimension and labelled-register disjointness hypotheses encode the paper's auxiliary purification space. |
Fidelity and purification.
Reusable fidelity and purification laws.
| Formal statement | Mathematical reading |
|---|---|
| src/utils/dist/dilation.v: fid_ii_cptp_bounds; src/utils/dist/fid.v: fid_i_sym.mx, fid_iii_uhl, fid_iv_proj.mx, fid_v_mono_r_psd.mx, fid_vi_block_diag.mxLemma fid_i_sym.mx (rho tau : 'M[C]_n) : rho \is psdmx -> tau \is psdmx -> @complex.Re R (trnorm (sqrttx rho *m sqrttx tau)) = @complex.Re R (trnorm (sqrttx tau *m sqrttx rho)).Lemma fid_ii_cptp_bounds (rho tau : 'F[H]_U) (E : 'SO[H]_(U, V)) : rho \is psdlf -> tau \is psdlf -> E \is cptp -> fidelity rho tau <= fidelity (E rho) (E tau) /\\ fidelity (E rho) (E tau) <= Num.sqrt (@complex.Re R (\Tr rho)) * Num.sqrt (@complex.Re R (\Tr tau)).Lemma fid_iii_uhl (phi : 'F[HL]_S_AB) (tau : 'F[HL]_A) : phi \is denllf -> \Rank phi = 1\%N -> tau \is denlrf -> h2mx tau != 0 -> (\Rank tau <= dim 'H[HL]_B) \%N -> exists psi : 'F[HL]_S_AB, psi \is denlf /\\ \Rank psi = 1\%N /\\ ptrace_cast disAB psi = tau /\\ fidelity phi psi = fidelity (trace_cast disAB phi) tau.Lemma fid_iv_proj.mx (P rho tau : 'M[C]_n) : P \is projmx -> rho \is psdmx -> tau \is psdmx -> let rhoP := P *m rho *m P in let tauP := P *m tau *m P in [/\\ @complex.Re R (trnorm (sqrttx rhoP *m sqrttx tau)) = @complex.Re R (trnorm (sqrttx rhoP *m sqrttx tauP)) & @complex.Re R (trnorm (sqrttx rhoP *m sqrttx tauP)) = @complex.Re R (trnorm (sqrttx rho *m sqrttx tauP))].Lemma fid_v_mono_r_psd.mx (rho sigma tau : 'M[C]_n) : rho \is psdmx -> sigma \is psdmx -> tau \is psdmx -> sigma <= tau -> @complex.Re R (trnorm (sqrttx rho *m sqrttx sigma)) <= @complex.Re R (trnorm (sqrttx rho *m sqrttx tau)).Lemma fid_vi_block_diag.mx (rho1 tau1 : 'M[C]_m) (rho2 tau2 : 'M[C]_k) : rho1 \is psdmx -> tau1 \is psdmx -> rho2 \is psdmx -> tau2 \is psdmx -> @complex.Re R (trnorm (sqrttx rho1 0 0 rho2) *m sqrttx (block.mx tau1 0 0 tau2)) = @complex.Re R (trnorm (sqrttx rho1 *m sqrttx tau1)) + @complex.Re R (trnorm (sqrttx rho2 *m sqrttx tau2)).The matrix-level declarations provide the reusable symmetry, projector, order, and direct-sum laws; fid_iii_uhl provides the labelled purification witness used by purified-distance lifting. | Raw-fidelity laws (the ent/tb: fid dependency node). The reusable laws are symmetry; CPTP monotonicity with upper bound ; a finite-dimensional Uhlmann purification witness; the projector identity ; Loewner monotonicity; and direct-sum additivity, . |
Finite-dimensional purification.
| Formal statement | Mathematical reading |
|---|---|
| Purification in a fixed finite environment. If is a nonzero subnormalized state with rank , it has a rank-one subnormalized purification on . |
- Entropy Calculus: Optimization.
Convex optimization and non-smooth entropy infrastructure.
Formal statement
src/entropy/pur/def.v: sdp_primal_set, sdp_dual_set; src/entropy/pur/pre.v: sdp_strong_primal
Definition sdp_primal_set : set R := [set x : R | exists X : 'M[C]_(dim U), [/ \ X \is psdmx, h2mx (Psi (mx2h X)) >= B & x = @complex.Re R (\tr (A *m X))]].
Definition sdp_dual_set : set R := [set x : R | exists Y : 'M[C]_(dim V), [/ \ Y \is psdmx, h2mx (Psi^*o (mx2h Y)) <= A & x = @complex.Re R (\tr (B *m Y))]].
Lemma sdp_strong_primal (alpha beta : R) :
A \is hermmx -> B \is hermmx ->
(forall X, X \is hermmx -> h2mx (Psi (mx2h X)) \is hermmx) ->
has_inf sdp_primal_set ->
alpha = ExtNumTopology.etinf sdp_primal_set ->
beta = ExtNumTopology.etsup sdp_dual_set ->
(exists Y, Y \is pdmx /
(A - h2mx (Psi^*o (mx2h Y))) \is pdmx) ->
alpha = beta /
exists X : 'M[C]_(dim U),
[/ \ X \is psdmx,
h2mx (Psi (mx2h X)) >= B &
@complex.Re R (\tr (A *m X)) = alpha].
Remark. This yields equality and primal attainment. src/entropy/pur/prop.v: phi_min_sdp_strong, phi_min_dual, phi_min_primal_attained, phi_min_dual_feasible_ub
Lemma phi_min_sdp_strong (rhoAB : 'F[H]_S_AB) :
rhoAB \is psdlf ->
phi_min B rhoAB =
sup [set v : R | exists Y : 'F[H]_S_AB, [/ \ Y \is psdlf,
ptrace_castl disAB Y <= (\1 : 'F[H]_B) &
v = @complex.Re R (\Tr (rhoAB \o Y))]] /
phi_min_feasible B rhoAB (phi_min B rhoAB).
Lemma phi_min_dual_feasible_ub (rhoAB Y : 'F[H]_S_AB) : rhoAB \is psdlf -> Y \is psdlf -> ptrace_castl disAB Y <= (\1 : 'F[H]_B) -> @complex.Re R (\Tr (rhoAB \o Y)) <= phi_min B rhoAB.
The declarations give the dual supremum, primal attainment, and pointwise weak duality.
Mathematical reading
SDP strong duality (Section V). For the primal and dual SDPs induced by A, B, Ψ, finite primal value and a strict dual Slater witness imply α = β and attainment of the primal optimum.
Min-entropy SDP specialization and weak duality. For
strong duality gives the dual supremum and primal attainment. Every dual-feasible also satisfies
Operational laws.
Entropy algebra and operational duality.
Formal statement
src/entropy/pur/conv/prop.v: phi_min_i_scale, phi_min_ii_mono, phi_min_iii_subadd, phi_min_iv_convex, phi_min_v_iso_inv, phi_min_data_proc_A, phi_min_data_proc_B, phi_min_vi_data_proc, phi_min_vii_data_proc_ext, phi_min_viii_tens
Lemma phi_min_i_scale rhoS lambda : rhoS \is psdlf -> 0 <= lambda -> phi_min T (lambda%:C *: rhoS) = lambda * phi_min T rhoS.
Lemma phi_min_ii_mono rhoS tauS : rhoS \is psdlf -> tauS \is psdlf -> rhoS <= tauS -> phi_min T rhoS <= phi_min T tauS.
Lemma phi_min_iii_subadd rhoS tauS : rhoS \is psdlf -> tauS \is psdlf -> phi_min T (rhoS + tauS) <= phi_min T rhoS + phi_min T tauS.
Lemma phi_min_iv_convex rhoS tauS lambda : rhoS \is psdlf -> tauS \is psdlf -> 0 <= lambda <= 1 -> phi_min T (lambda%:C *: rhoS + (1 - lambda)%:C *: tauS) <= lambda * phi_min T rhoS +
Mathematical reading
Algebra of Φ. For positive K, L, M, the declarations establish
Local isometries preserve Φ, processing either subsystem cannot increase it under the displayed map hypotheses, and
(1 - lambda) * phi_min T tauS.
Lemma phi_min_v_iso_inv rhoAB U V :
rhoAB \is psdlf ->
phi_min B' ((U \otimes V) \o rhoAB \o (U \otimes V)^A) =
phi_min B rhoAB.
Lemma phi_min_data_proc_B rhoAB (E : 'QO[H]_(B, B')) :
rhoAB \is psdlf ->
phi_min B' ((:1 : 'SO[H]A) :⊗ E) rhoAB) <=
phi_min B rhoAB.
Lemma phi_min_data_proc_A rhoAB (E : 'SO[H](A, A')) :
rhoAB \is psdlf -> E \is cpmap -> E^*o \is tnmap ->
phi_min B ((E :⊗ (:1 : 'SO[H]_B)) rhoAB) <=
phi_min B rhoAB.
Lemma phi_min_vi_data_proc rhoAB E_B E_A :
rhoAB \is psdlf -> E_A \is cpmap ->
E_A^*o \is tnmap ->
phi_min B' ((:1 : 'SO[H]_A) :⊗ E_B) rhoAB) <=
phi_min B rhoAB /
phi_min B ((E_A :⊗ (:1 : 'SO[H]_B)) rhoAB) <=
phi_min B rhoAB.
Lemma phi_min_vii_data_proc_ext rhoABC E :
rhoABC \is psdlf -> E \is cpmap -> E^*o \is tnmap ->
phi_min C
(((:1 : 'SO[H]_A) :⊗ E) :⊗
(:1 : 'SO[H]_C)) rhoABC) <=
phi_min C rhoABC.
Lemma phi_min_viii_tens rho1 rho2 :
rho1 \is psdlf -> rho2 \is psdlf ->
phi_min (B1 : |: B2) (rho1 \otimes rho2) =
phi_min B1 rho1 * phi_min B2 rho2.
Remark. The one-sided declarations phi_min_data_proc_A and
phi_min_data_proc_B are packaged by phi_min_vi_data_proc;
phi_min_vii_data_proc_ext states the three-register data-processing law.
Operational entropy characterizations
Formal statement
src/utils/pur.v: pur_vec, purification, max_entangled, gamma_state; src/entropy/pur/conv/minmax.v: gamma_ABp, min_koenig, min_omni; src/entropy/pur/conv/minmax_dual.v: minmax_dual
Local Definition pur_vec (rho : 'F[HL]A) : 'H[HL]S_AB := \sum(i : 'I(dim 'H[HL]_A)) tenv ((sqrtH rho) (eb i)) (eb (cast_ord dim_HA_HB i)). Definition purification (rho : 'F[HL]_A) : 'F[HL]_S_AB := [> pur_vec rho ; pur_vec rho <]. Definition max_entangled : 'F[HL]_S_AB := purification (\1 : 'F[HL]_A). Definition gamma_state : 'F[HL]_S_AB := ((dim 'H[HL]_A) %:R^-1) %:C *: max_entangled. Local Definition gamma_ABp : 'F[H]_S_ABp := @gamma_state R L H A Bp dimABp_set. Lemma min_koenig (rhoAB : 'F[H]_S_AB) : rhoAB \is denlf -> hminE B rhoAB = oppe (elog2 ((dim 'H[H]A) %:R * sup [set v : R | exists E : 'SO[H](B, Bp), [/\ E \is cptp & v = (gfid (((:1 : 'SO[H]_A) :⊗ E) rhoAB) gamma_ABp)^+2]))). Lemma min_omni (rhoAB : 'F[H]_S_AB) : rhoAB \is denlf -> hminE B rhoAB = oppe (elog2 ((dim 'H[H]A) %:R * sup [set v : R | exists V : 'FI[H](B, S_BpBpp), exists tau : 'F[H]_Bpp, [/\ tau \is denllf & v = (gfid (((:1 : 'F[H]_A) \otimes V) \o rhoAB \o
Mathematical reading
Operational min-entropy and min/max duality. With maximally entangled,
Equivalently, dilating the channel gives
where . For pure ,
.
((\1 : 'F[H]_A) \otimes V)^A) (castlf (esym eqABpBpp, esym eqABpBpp) ((gamma_ABp \O tau) : 'F[H]_S_ABpBpp)) ^+2]) ). Lemma minmax_dual (rhoABC : 'F[H]_S_ABC) : rhoABC \is denlf -> \Rank rhoABC = 1%N -> hmaxE B (@ptrace_cast3C R L H A B C0 disAC disBC rhoABC) = oppe (hminE C0 (@ptrace_cast3B R L H A B C0 disAB disBC rhoABC)). These are extended-real statements over labelled channel-output and purification spaces.
Smoothing.
Reusable smooth-entropy calculus.
| Formal statement | Mathematical reading |
|---|---|
| src/entropy/pur/smooth/sm.v: smoothing_support_hmin, smoothing_support_hmax; src/entropy/pur/prop.v: smooth_hmax_attained | Smoothing witnesses and attainment. For the displayed smoothing radius, optimal min/max witnesses exist and may be chosen in the product of the two marginal supports. |
| Lemma smoothing_support_hmin (eps : R) (rhoAB : 'F[H]_S_AB) : rhoAB \is denlf ->0 <= eps < Num.sqrt (@complex.Re R (\Tr rhoAB)) -> exists tauAB : 'F[H]_S_AB, eps_ball eps rhoAB tauAB /\\ smooth_hminE B eps rhoAB = hminE B tauAB /\\ (supplf (ptrace_cast disAB rhoAB) \O supplf (ptrace_castl disAB rhoAB)) \o tauAB = tauAB /\\ tauAB \o (supplf (ptrace_cast disAB rhoAB) \O supplf (ptrace_castl disAB rhoAB)) = tauAB. | |
| Lemma smoothing_support_hmax (eps : R) (rhoAB : 'F[H]_S_AB) : rhoAB \is denlf ->0 <= eps < Num.sqrt (@complex.Re R (\Tr rhoAB)) -> exists tauAB : 'F[H]_S_AB, eps_ball eps rhoAB tauAB /\\ smooth_hmaxE B eps rhoAB = hmaxE B tauAB /\\ (supplf (ptrace_cast disAB rhoAB) \O supplf (ptrace_castl disAB rhoAB)) \o tauAB = tauAB /\\ tauAB \o (supplf (ptrace_cast disAB rhoAB) \O supplf (ptrace_castl disAB rhoAB)) = tauAB. | |
| Fresh purifier and copy-register dimensions instantiate the max-entropy witness construction. |
Smooth invariance, data processing, and classical side information.
| Formal statement | Mathematical reading |
|---|---|
| src/entropy/pur/smooth/prop.v: smooth_iso_hmin, smooth_iso_hmax | Smooth isometry invariance. For isometries and , both smooth conditional entropies are unchanged by . |
| Lemma smooth_iso_hmin (eps : R) (rhoAB : 'F[H]_S_AB) (U : 'FI[H]_(A, A')) (V : 'FI[H]_(B, B')) : rhoAB \is denlf ->0 <= eps < Num.sqrt (@complex.Re R (\Tr rhoAB)) -> smooth_hminE B' eps ((U \otimes V) \o rhoAB \o (U \otimes V)^A) = smooth_hminE B eps rhoAB. | |
| Lemma smooth_iso_hmax (eps : R) (rhoAB : 'F[H]_S_AB) (U : 'FI[H]_(A, A')) (V : 'FI[H]_(B, B')) : rhoAB \is denlf ->0 <= eps < Num.sqrt (@complex.Re R (\Tr rhoAB)) -> smooth_hmaxE B' eps ((U \otimes V) \o rhoAB \o (U \otimes V)^A) = smooth_hmaxE B eps rhoAB. | |
| The declaration is parameterized by its purification-space layout.src/entropy/pur/smooth/dpi.v: entropy_data_proc_map, entropy_data_proc_tau, entropy_data_proc | Generalized smooth data processing. A sub-unital CPTN map on together with CPTN maps on gives the smooth-min inequality. For smooth max-entropy, all three |
| Local Definition entropy_data_proc_map |
(E : 'SO[H](A, A') ) (F : 'SO[H](B, B') ) (G : 'SO[H](C0, C0') ) : 'SO[H](S_ABC, S_A'B'C') := (E : ⊠ F) : ⊠ G.
Local Definition entropy_data_proc_tau (rhoABC : 'F[H]S_ABC) (E : 'SO[H](A, A') ) (F : 'SO[H](B, B') ) (G : 'SO[H](C0, C0') ) : 'F[H]_S_A'B'C' := entropy_data_proc_map E F G rhoABC.
Theorem entropy_data_proc (eps : R) (rhoABC : 'F[H]S_ABC)
(E : 'SO[H](A, A') ) (F : 'SO[H](B, B') )
(G : 'SO[H](C0, C0') ) :
rhoABC \is denlf -> 0 <= eps ->
let tauA'B'C' := entropy_data_proc_tau rhoABC E F G in
(E \is cptn -> E^*o \is tnmap -> F \is cptn -> G \is cptn ->
eps < Num.sqrt (@complex.Re R
(\Tr (ptrace_cast3C disA'C' disB'C' tauA'B'C')) ->
smooth_hminE B eps (ptrace_cast3C disAC disBC rhoABC) <=
smooth_hminE B' eps
(ptrace_cast3C disA'C' disB'C' tauA'B'C')) /
(E \is cptp -> E^*o \is tnmap -> F \is cptp -> G \is cptp ->
eps < Num.sqrt (@complex.Re R
(\Tr (ptrace_cast3C disAC disBC rhoABC)) ->
smooth_hmaxE B eps (ptrace_cast3C disAC disBC rhoABC) <=
smooth_hmaxE B' eps
(ptrace_cast3C disA'C' disB'C' tauA'B'C') ).
The theorem is parameterized by labelled disjointness, purification-space dimensions, the state, the maps, the trace, and the smoothing radius.
maps are CPTP and the map on A is sub-unital.
Classical side information.
Formal statement
src/entropy/pur/smooth/class.v: class_bounds_1_min_upper, class_bounds_2_min_lower
Local Notation classical_on_X rho := (forall (x x' : 'Idx[H]_X), x' != x -> ((> deltav x ; deltav x <] \O (\1 : 'F_S_AB)) \o rho \o ([> deltav x' ; deltav x' <] \O (\1 : 'F_S_AB))) = 0).
Lemma class_bounds_1_min_upper (eps : R) (rhoXAB : 'F[H]_S_XAB) : rhoXAB \is denlf -> classical_on_X rhoXAB -> 0 <= eps < Num.sqrt (@complex.Re R (\Tr rhoXAB)) -> (smooth_hminE B eps (ptrace_castl disXAB rhoXAB) <= smooth_hminE B eps rhoXAB)%E.
Lemma class_bounds_2_min_lower (eps : R) (rhoXAB : 'F[H]_S_XAB) : rhoXAB \is denlf -> classical_on_X rhoXAB -> 0 <= eps < Num.sqrt (@complex.Re R (\Tr rhoXAB)) -> (smooth_hminE B eps (ptrace_castl disXAB rhoXAB) - (log2 (dim 'H[H]_X)%:R)%:E <= smooth_hminE (B : |: X) eps rhoXAB)%E.
Remark. These declarations provide the two min-entropy inequalities used by the proof graph on the displayed smoothing domain.
Mathematical reading
Classical side-information min-entropy bounds. For a state classical on X, meaning
(|x\rangle\otimes I)\rho(|x'\rangle\langle x'|\otimes I)=0 (x \neq x'),
the reusable bounds are
Coherent-classical max entropy.
Formal statement
src/entropy/pur/util.v: cc_idx, cc_pair, cc_proj_xx, class_entangled_max
Let cc_idx (x : 'Idx[H]X) : 'Idx[H](X') := n2i (cast_ord eqXX' (i2n x)).
Let cc_pair (x : 'Idx[H]_X) : 'H[H]_S_XX' := deltav x ⊗v deltav (cc_idx x).
Let cc_proj_xx : 'F[H]_S_XX' := sumoutp (fun=>1) cc_pair cc_pair.
Lemma class_entangled_max (rhoXX'AB : 'F[H]_S_XX'AB) : rhoXX'AB \is denlf -> 0 < @complex.Re R (\Tr rhoXX'AB) -> rhoXX'AB = lift_lf (@finset.subsetUl _ S_XX' S_AB) cc_proj_xx \o rhoXX'AB \o
Mathematical reading
Coherent-classical max-entropy bound. For a state supported on the coherent copy subspace of XX',
,
and
lift_lf (@finset.subsetUl _ S_XX' S_AB) cc_proj_xx -> (hmaxE S_X'B rhoXX'AB <= hmaxE S_XX'B rhoXX'AB)%E.
This declaration gives the coherent-copy max-entropy inequality under the displayed support and trace hypotheses.
- Trace Entropy: Definitions.
Trace-distance balls and state-conditioned entropies.
Formal statement
src/entropy/tr/def.v: ereal_set, etsupR, ball_tr, hmin_state_tr, hmax_state_trE, hmax_state_trR, hmax0_trE, hmax0_trR; src/entropy/tr/conv.v: hmax_state_trE_zero, hmax0_trE_zero
Definition ereal_set (S : set R) : set (\bar{R} ) := [set y : \bar{R} | exists x : R, S x /\ y = x%:E].
Definition etsupR (S : set R) : \bar{R} := ereal_sup (ereal_set ↔ S).
Definition ball_tr {n} (eps : {nonneg R}) (rho : 'M[C]_n) := [set rho' | (rho' \is psdmx) && ((@complex.Re R (\tr rho') <= @complex.Re R (\tr rho)) && (@complex.Re R (\tr rho' - rho |) <= @complex.Re R (\tr rho) * eps%:num)]].
Definition hmin_state_tr {m n : nat} (rho : 'M[C]_(m * n)) (sigma : 'M[C]_n) : \bar{R} := etsupR [set lambda : R | rho ⊆ (2 ^ (-lambda))%:C * : (1%:M : 'M[C]_m) * t sigma].
Definition hmax_state_trE {m n : nat} (rho : 'M[C]_(m * n)) (sigma : 'M[C]_n) : \bar{R} := elog2 (@complex.Re R (\tr ((1%:M : 'M[C]_m) * t sigma) * m → suppmx rho))).
Definition hmax_state_trR {m n : nat} (rho : 'M[C]_(m * n)) (sigma : 'M[C]_n) : R := log2 (@complex.Re R (\tr ((1%:M : 'M[C]_m) * t sigma) * m suppmx → rho))).
Definition hmax0_trE (n : nat) (rho : 'M[C]_n) : \bar{R} := elog2 (\rank rho)%:R.
Definition hmax0_trR (n : nat) (rho : 'M[C]_n) : R := log2 (\rank rho)%:R.
Lemma hmax_state_trE_zero {m n : nat} (sigma : 'M[C]n) : Htr_maxE((0 : 'M[C](m * n)) | sigma) = -oo%E.
Lemma hmax0_trE_zero {n : nat} : Htr_maxE((0 : 'M[C]_n)) = -oo%E.
The extended-real variants use elog2; the real variants apply log2 on positive support.
Mathematical reading
Trace smoothing and state-conditioned entropy.
Renner's trace ball and state-conditioned quantities are
At zero support, .
Conditional and smooth trace entropies.
Formal statement
src/entropy/tr/def.v: hmin_tr, hmax_trE, hmax_trR, smooth_hmin_state_tr, smooth_hmax_state_trE, smooth_hmax_state_trR, smooth_hmin_tr, smooth_hmax_trE, smooth_hmax_trR
Definition hmin_tr {a b : nat} (rho : 'M[C]_(a * b) ) : \bar{R} :=
etsupR [set lambda : R | exists sigma_B : 'M[C]_b,
sigma_B \is denlmx /
rho <= (2 ^ (-lambda))%:C * : (1%:M : 'M[C]_a) * t sigma_B].
Definition hmax_trE {a b : nat} (rho : 'M[C]_(a * b) ) : \bar{R} := ereal_sup [set h : \bar{R} | exists sigma_B : 'M[C]_b, sigma_B \is denlmx / \ h = hmax_state_trE rho sigma_B].
Definition hmax_trR {a b : nat} (rho : 'M[C]_(a * b) ) : R := ExtNumTopology.etsup [set h : R | exists sigma_B : 'M[C]_b, sigma_B \is denlmx / \ h = hmax_state_trR rho sigma_B].
Definition smooth_hmin_state_tr {m n : nat} (eps : {nonneg R}) (rho : 'M[C]_(m * n)) (sigma : 'M[C]_n) : \bar{R} := ereal_sup [set x | exists rho', rho' \in Btr^eps(rho) / \ x = hmin_state_tr rho' sigma].
Definition smooth_hmax_state_trE {m n : nat} (eps : {nonneg R}) (rho : 'M[C]_(m * n)) (sigma : 'M[C]_n) : \bar{R} := ereal_inf [set x : \bar{R} | exists rho', rho' \in Btr^eps(rho) / \ x = hmax_state_trE rho' sigma].
Mathematical reading
Optimization over conditioning states and trace balls.
and the smooth forms optimize additionally over
Definition smooth_hmax_state_trR {m n : nat} (eps : {nonneg R}) (rho : 'M[C]_(m * n)) (sigma : 'M[C]n) : R := ExtNumTopology.etinf [set x : R | exists rho', rho' \in Btr^eps(rho) / \ x = hmax_state_trR rho' sigma]. Definition smooth_hmin_tr {a b : nat} (eps : {nonneg R}) (rho : 'M[C](a * b)) : \bar{R} := ereal_sup [set x | exists sigma_B : 'M[C]b, sigma_B \is denlmx / \ x = smooth_hmin_state_tr eps rho → sigma_B]. Definition smooth_hmax_trE {a b : nat} (eps : {nonneg R}) (rho : 'M[C](a * b)) : \bar{R} := ereal_sup [set x : \bar{R} | exists sigma_B : 'M[C]b, sigma_B \is denlmx / \ x = smooth_hmax_state_trE eps rho → sigma_B]. Definition smooth_hmax_trR {a b : nat} (eps : {nonneg R}) (rho : 'M[C](a * b)) : R := ExtNumTopology.etsup [set x : R | exists sigma_B : 'M[C]_b, sigma_B \is denlmx / \ x = smooth_hmax_state_trR eps rho → sigma_B]. The state-conditioned operands and zero-support laws are displayed above.
Attainment.
Trace-entropy attainment and superposition.
Formal statement
src/entropy/tr/smooth.v: epst_card, smooth_hmin_superposition_vs_mixture, smooth_hmin_state_tr_attained, smooth_hmax_state_tr_attained, smooth_hmin_tr_attained, smooth_hmax_tr_attained
Definition epst_card (eps : {nonneg R}) (x : nat) : {nonneg R} := ((eps%:num ^+ 2 / (6 * x) %:R) %:nng : {nonneg R}). Lemma smooth_hmin_superposition_vs_mixture {a b e x : nat} (eps : {nonneg R}) (psi_x : 'I_x -> 'M[C](a * b * e, 1)) (sigma_BX : 'M[C](b * x)) : (0 < x) %N -> (a * b <= e) %N -> (forall i j, i != j -> (psi_x i)^*t *m psi_x j = 0) -> sigma_BX \is psdmx -> let psi := \sum_i psi_x i in let rho_ABE := psi *m psi^*t in let rhot_ABX := \sum_i ((ptrace2 (psi_x i *m (psi_x i)^*t)) *t delta_mx i i) in let rho_AB := ptrace2 rho_ABE in let rhot_X := ptrace1 rhot_ABX in let sigma_B := ptrace2 sigma_BX in (Htr_min^eps(rho_AB | sigma_B) >= Htr_min^ (epst_card eps x) (castmx (esym (mulnA a b x), esym (mulnA a b x)) rhot_ABX | sigma_BX) - Htr_maxE(rhot_X)) %E. Lemma smooth_hmin_state_tr_attained eps rho sigma : rho \is psdmx -> sigma \is psdmx -> exists2 rhob, rhob \in Btr^eps(rho) & Htr_min(rhob | sigma) = Htr_min^eps(rho | sigma). Lemma smooth_hmax_state_tr_attained eps rho sigma : rho \is psdmx -> sigma \is psdmx -> exists2 rhob, rhob \in Btr^eps(rho) & Htr_maxE(rhob | sigma) = Htr_maxE^eps(rho | sigma). Lemma smooth_hmin_tr_attained {a b} eps (rho : 'M[C](a * b)) : (0 < b) %N -> rho \is psdmx -> exists2 sigma, sigma \is denlmx & Htr_min^eps(rho | sigma) = Htr_min^eps(rho | ^ b). Lemma smooth_hmax_tr_attained {a b} eps (rho : 'M[C](a * b)) : (0 < b) %N -> rho \is psdmx -> exists2 sigma, sigma \is denlmx & Htr_maxE^eps(rho | sigma) = Htr_maxE^eps(rho | ^ b). The purifier premise ab ≤ e is explicit, and zero summands are permitted.
Mathematical reading
Attainment and superposition versus mixture. For nonempty X, orthogonal , a positive , and matrix dimensions , let and attach a classical label X to the incoherent mixture. Then
All finite-dimensional smooth extrema are attained.
Calculus.
Reusable trace-entropy calculus: superadditivity, subadditivity, classical conditioning.
Formal statement
src/entropy/tr/def.v: addnng_tr; src/utils/mx/def.v: tensor_prod_split; src/entropy/tr/smooth.v: smooth_hmin_conditional_superadditive, smooth_hmin_conditional_strong_subadditive, smooth_hmin_conditional_classical
Definition addnng_tr (x y : {nonneg R}) : {nonneg R} := ((x%:num + y%:num)%:nng : {nonneg R}).
Definition tensor_prod_split (A : 'M[C](m * n)) (B : 'M[C](m' * n') ) : 'M[C]_( (m * m') * (n * n') ) := perm_conj (split_perm m n m' n') (castmx_sq (mulnACA m n m' n') (A * t B)).
Lemma smooth_hmin_conditional_superadditive {a b a' b' : nat} (eps' : {nonneg R}) (rho_AB : 'M[C](a * b)) (rho_A'B' : 'M[C](a' * b')) : rho_AB \is psdmx -> rho_A'B' \is psdmx -> Htr_min^(addnng_tr eps eps') (tensor_prod_split rho_AB rho_A'B' | ^ (b * b')) >= Htr_min^eps(rho_AB | ^ b) + Htr_min^eps'(rho_A'B' | ^ b').
Lemma smooth_hmin_conditional_strong_subadditive {a b c : nat} (rho_ABC : 'M[C]_(a * b * c)) : Htr_min^eps(castmx (esym (mulnA a b c), esym (mulnA a b c)) rho_ABC | ^ (b * c)) ↪ <= Htr_min^eps(ptrace2 rho_ABC | ^ b).
Lemma smooth_hmin_conditional_classical {a b z : nat} (rho_ABz : 'I_z -> 'M[C]_(a * b)) : let rho_ABZ := \sum_i (rho_ABz i * t delta_mx i i) in rho_ABZ \is denlmx -> (forall i, rho_ABz i \is psdmx) -> (forall i, rho_ABz i != 0) -> let rhob i := ((@complex.Re R (\tr (rho_ABz i)))^-1)%:C * : ↪ rho_ABz i in Htr_min^eps(castmx (esym (mulnA a b z), esym (mulnA a b z)) rho_ABZ | ^ (b * z)) ↪ >= ereal_inf [set h | exists i, h = Htr_min^eps(rhob i | ^ b)].
Mathematical reading
Smooth conditional min-entropy laws. The calculus contains tensor superadditivity, strong subadditivity, classical conditioning, the chain rule, and classical-product data processing. In particular,
Reusable trace-entropy calculus: chain rule and data processing.
Formal statement
src/entropy/tr/smooth.v: smooth_hmin_conditional_chain, smooth_hmin_conditional_data_processing, smooth_hmin_calculus
Lemma smooth_hmin_conditional_chain {a b c : nat} (rho_ABC : 'M[C]_(a * b * c)) : rho_ABC \is psdmx -> rho_ABC != 0 -> Htr_min^eps(rho_ABC | ^ c) <= Htr_min^eps(castmx (esym (mulnA a b c), esym (mulnA a b c)) rho_ABC | ^ (b * c)) + Htr_maxE(ptrace1 (trace2 rho_ABC)).
Theorem smooth_hmin_conditional_data_processing {a y c : nat} (rho_Ay : 'I_y -> 'M[C]_a) (rho_Cy : 'I_y -> 'M[C]_c) (HrhoA : forall i, rho_Ay i \is psdmx) (HrhoC : forall i, rho_Cy i \is psdmx) : let rho_YAC := \sum_i ((delta_mx i i) * t ((rho_Ay i) * t (rho_Cy ↪ i))) in let rho_YC := \sum_i (\tr (rho_Ay i)) * : (delta_mx i i) * t ↪ (rho_Cy i) in let rho_AY := \sum_i (\tr (rho_Cy i)) * : (rho_Ay i) * t ↪ (delta_mx i i) in let rho_Y := \sum_i (\tr (rho_Ay i)) * (\tr (rho_Cy i)) * : ↪ (delta_mx i i) in (Htr_min^eps(castmx (mulnA y a c, mulnA y a c) rho_YAC | ^ c) >= Htr_min^eps(rho_YC | ^ c) + Htr_min(rho_AY | rho_Y)) %E.
smooth_hmin_calculus conjoins these five reusable statements.
Mathematical reading
Chain rule and data processing.
- .
For the classical-product law, writing , data processing gives .
AEP.
Classical finite-block AEP.
Formal statement
src/entropy/tr/def.v: classical_Y_marginal_tr, classical_cond_prob_tr, classical_cond_surprisal_tr, classical_cond_entropy_tr; src/entropy/tr/prod.v: classical_aep
Definition classical_Y_marginal_tr P j := \sum_i P i j.
Definition classical_cond_prob_tr P i j :=
if P i j == 0 then 1 else P i j / classical_Y_marginal_tr P j.
Definition classical_cond_surprisal_tr P i j :=
- log2 (classical_cond_prob_tr P i j).
Definition classical_cond_entropy_tr P :=
\sum_j \sum_i P i j * classical_cond_surprisal_tr P i j.
Lemma classical_aep {x y : nat} (n : nat)
(P : 'I_x -> 'I_y -> R)
(HP_nonneg : forall i j, 0 <= P i j)
(HP_prob : \sum_i \sum_j P i j = 1) :
(0 < x) % N -> (0 < n) % N ->
forall eps : {nonneg R}, 0 < eps%:num -> eps%:num <= 1 ->
let rho_XY_n := \sum_(sy : n.-tuple 'I_y) \sum_(sx : n.-tuple
-> 'I_x)
((\prod_(k < n) P (tnth sx k) (tnth sy k)) % : C * :
(delta.mx (enum_rank sx) (enum_rank sx) * t
delta.mx (enum_rank sy) (enum_rank sy)) in
let rho_Y_n := \sum_(sy : n.-tuple 'I_y)
((\prod_(k < n) \sum_i P i (tnth sy k)) % : C * :
delta.mx (enum_rank sy) (enum_rank sy)) in
let delta := log2 (x% : R + 3% : R) *
Num.sqrt (2% : R * log2 (eps%:num^-1) / n% : R) in
let Hc := classical_cond_entropy_tr P in
(( (n% : R)^-1) % : E * Htr_maxE^eps(rho_XY_n | rho_Y_n) <=
(Hc + delta) % : E) % E /
(( (n% : R)^-1) % : E * Htr_min^eps(rho_XY_n | rho_Y_n) >=
(Hc - delta) % : E) % E.
Zero-weight pairs contribute zero to the conditional entropy.
Mathematical reading
Classical i.i.d. pairs. For a probability table , , and , , , where .
Non-identical classical-family AEP.
Formal statement
src/entropy/tr/prod.v: classical_aep_family
Lemma classical_aep_family {x y : nat} (n : nat)
(P : 'I_n -> 'I_x -> 'I_y -> R) :
(forall k i j, 0 <= P k i j) ->
(forall k, \sum_i \sum_j P k i j = 1) ->
(0 < x) % N -> (0 < n) % N ->
forall eps : {nonneg R}, 0 < eps%:num -> eps%:num <= 1 ->
let rho_XY_n := \sum_(sy : n.-tuple 'I_y)
\sum_(sx : n.-tuple 'I_x)
((\prod_(k < n) P k (tnth sx k) (tnth sy k)) % : C * :
(delta.mx (enum_rank sx) (enum_rank sx) * t
delta.mx (enum_rank sy) (enum_rank sy)) in
let rho_Y_n := \sum_(sy : n.-tuple 'I_y)
((\prod_(k < n) \sum_i P k i (tnth sy k)) % : C * :
delta.mx (enum_rank sy) (enum_rank sy)) in
let delta := log2 (x% : R + 3% : R) *
Num.sqrt (2% : R * log2 (eps%:num^-1) / n% : R) in
let Hcs := \sum_(k < n) classical_cond_entropy_tr (P k) in
(( (n% : R)^-1) % : E * Htr_maxE^eps(rho_XY_n | rho_Y_n) <=
(n% : R^-1 * Hcs + delta) % : E) % E /
(( (n% : R)^-1) % : E * Htr_min^eps(rho_XY_n | rho_Y_n) >=
(n% : R^-1 * Hcs - delta) % : E) % E.
This extends the finite-block pair bound to independent families.
Mathematical reading
Independent non-identical pairs. For under the same finite-block domain, , .
Finite-block quantum product AEP.
Formal statement
src/utils/mx/def.v: bigten; src/entropy/tr/prod.v: smooth_min_entropy_of_product_entropy_rank, smooth_min_entropy_of_product_classical_entropy_rank
Theorem smooth_min_entropy_of_product_entropy_rank (a b n : nat) (rho_AB : 'M[C]_(a * b)) (sigma_B : 'M[C]_b) (eps : {nonneg R}) : (0 < n) %N -> 0 < eps%:num -> eps%:num <= 2%:R -> rho_AB \is denlmx -> sigma_B \is psdmx -> \tr sigma_B = 1 -> (\rank sigma_B = b) %N -> 4%:R * log2 (2%:R / eps%:num) <= n%:R -> let gamma := (\rank (ptrace2 rho_AB)) %:R + @complex.Re R (\tr (rho_AB *m rho_AB *m invmx ((1%:M : 'M[C]_a) *t sigma_B))) in let delta := 2%:R * log2 (gamma + 2) * Num.sqrt (log2 (eps%:num^-1) / n%:R + 1) in let rho_AB_n := castmx_sq (esym (mulln ((a * b) ^ n) %N)) (bigten rho_AB n) in let sigma_B_n := bigten ((1%:M : 'M[C]_a) *t sigma_B) n in ((n%:R^-1) %:E * Htr_min^eps(rho_AB_n | sigma_B_n) >= (H(rho_AB) - H(ptracel rho_AB) - fine (D(ptracel rho_AB || sigma_B)) - delta) %:E) %E.
Corollary smooth_min_entropy_of_product_classical_entropy_rank (x b n : nat) (rho_Bx : 'I_x -> 'M[C]_b) (eps : {nonneg R}) : let rho_XB := \sum_i (delta_mx i i *t rho_Bx i) in let rho_B := ptracel rho_XB in let rho_X := ptrace2 rho_XB in (0 < n) %N -> 0 < eps%:num -> eps%:num <= 2%:R -> rho_XB \is denlmx -> (forall i, rho_Bx i \is psdmx) -> (\rank rho_B = b) %N -> (2 <= \rank rho_X) %N -> 4%:R * log2 (2%:R / eps%:num) <= n%:R -> let delta := (2%:R * Htr_maxR(rho_X) + 3%:R) * Num.sqrt (log2 (eps%:num^-1) / n%:R + 1) in let rho_XB_n := castmx_sq (esym (mulln ((x * b) ^ n) %N)) (bigten rho_XB n) in let rho_B_n := bigten ((1%:M : 'M[C]_x) *t rho_B) n in ((n%:R^-1) %:E * Htr_min^eps(rho_XB_n | rho_B_n) >= (H(rho_XB) - H(rho_B) - delta) %:E) %E.
The theorem states the finite-block threshold and rank premises explicitly.
Mathematical reading
Quantum product states. For a density operator and a full-rank density operator , assume , , and . Then
,
where and . The cq specialization sets and assumes rank and rank .
D. Uncertainty
- Measurements: Bases and overlaps.
Measurement objects used by the entropic uncertainty relation.
Formal statement
src/eur/def.v: xbasis_vec2, x_projective_povm2 Definition xbasis_vec2 (x : 'I_2) : 'cV[C]_2 := \col_z xbasis_sign2 x z. Definition x_projective_povm2 (x : 'I_2) : 'M[C]_2 := (( (2%:R) ^-1) %:C) *: (xbasis_vec2 x *m (xbasis_vec2 x) ^*t). src/eur/def.v: overlap_mx, q_of_mx, rho_XB, rho_ZC, eur_rho_XB, eur_rho_ZC
Definition overlap_mx (M : 'I_nx -> 'M[C]na) (N : 'I_nz -> 'M[C]na) : R := \big[maxr/0](x < nx) \big[maxr/0](z < nz) (@complex.Re R (i2norm (sqrttx (M x) *m sqrttx (N z)))) ^ 2. Definition q_of_mx (M : 'I_nx -> 'M[C]_na) (N : 'I_nz -> 'M[C]_na) : R :=
- log2 (overlap_mx M N). Definition rho_XB (M : 'I_nx -> 'M[C]na) (rhoABC : 'M[C](na * nb * nc)) : 'M[C](nx * nb) := \sum(x < nx) (delta_mx x x *t ptracel (ptrace2
Mathematical reading
Two-dimensional basis. For , and .
Measurement overlap and post-measurement states. For POVMs and , c(M, N) = \max_{x,z} \|\sqrt{M_x} \sqrt{N_z}\|_^\infty, .
The cq operands are , and analogously with and trace over .
((sqrtmx (M x) * t 1%:M * t 1%:M) * m rhoABC * m (sqrtmx (M x) * t 1%:M * t 1%:M))). Definition rho_ZC (N : 'I_nz -> 'M[C]na) (rhoABC : 'M[C](na * nb * nc)) : 'M[C](nz * nc) := \sum(z < nz) (delta_mx z z * t ptracel ((sqrtmx (N z) * t 1%:M * t 1%:M) * m rhoABC * m (sqrtmx (N z) * t 1%:M * t 1%:M))). Definition eur_rho_XB disXB rhoSrc M dim_eq : 'F[HL](X : |: B) := let Q := castmx (tenv_dim disXB, erefl) env_mxU in let eq_prod := etrans dim_eq (tenv_dim disXB) in mx2h (castmx (esym (tenv_dim disXB), esym (tenv_dim disXB)) (Q * m castmx (eq_prod, eq_prod) (rho_XB M rhoSrc) * m Q^*t)). Definition eur_rho_ZC disZC rhoSrc N dim_eq : 'F[HL](Z : |: C0) → := let Q := castmx (tenv_dim disZC, erefl) env_mxU in let eq_prod := etrans dim_eq (tenv_dim disZC) in mx2h (castmx (esym (tenv_dim disZC), esym (tenv_dim disZC)) (Q * m castmx (eq_prod, eq_prod) (rho_ZC N rhoSrc) * m Q^*t)). The eur_rho_XB and eur_rho_ZC adapters transport the matrix states into labelled registers using the displayed dimension equalities.
2 ) Main Relation: Generic theorem.
Generic entropic uncertainty relation.
Formal statement
src/eur/eur.v: entropic_uncertainty_relation Theorem entropic_uncertainty_relation (L : finType) (HL : L -> chsType) (X B Z C0 : {set L}) (disXB : [disjoint X & B]) (disZC : [disjoint Z & C0]) (na nb nc nx nz : nat) (eps : R) (rhoABC : 'M[C]_(na * nb * nc)) (M : 'I_nx -> 'M[C]na) (N : 'I_nz -> 'M[C]na) (dimXB : nx * nb = dim ('H[HL](X : |: B))) (dimZC : nz * nc = dim ('H[HL](Z : |: C0))) (dim_X : nx = dim ('H[HL]_X)) (dim_B : nb = dim ('H[HL]_B)) (dim_Z : nz = dim ('H[HL]_Z)) (dim_C : nc = dim ('H[HL]_C0)) : rhoABC \is denmx -> is_povm_mx M -> is_povm_mx N -> 0 <= eps -> eps < Num.sqrt (@complex.Re R (\tr rhoABC)) -> smooth_hmin B eps (eur_rho_XB disXB rhoABC M dimXB) + smooth_hmax C0 eps (eur_rho_ZC disZC rhoABC N dimZC) >= q_of_mx M N. Remark. The declaration makes density, POVM, dimension, and the strict smoothing domain explicit. The measurement objects are expanded in Table VI.
BB84 specialization.
BB84 entropic uncertainty endpoint.
Formal statement
src/qkd/bb84/model.v: entropic_uncertainty_relation_bb84 Corollary entropic_uncertainty_relation_bb84 (S0 E0 Zkey B : {set → L}) (disSE0 : [disjoint S0 & E0]) (disZB : [disjoint Zkey & B]) (n_key : nat) (eps' q : R) (na nb nc nx nz : nat) (rhoSrc : 'M[C]_(na * nb * nc)) (M : 'I_nx -> 'M[C]na) (N : 'I_nz -> 'M[C]na) (dimSE : nx * nb = dim ('H[HL](S0 : |: E0))) (dimZB : nz * nc = dim ('H[HL](Zkey : |: B))) (dim_S : nx = dim ('H[HL]_S0))
Mathematical reading
Generic entropic uncertainty relation. For disjoint output/side-information registers and dimensions satisfying with , and , let be subnormalized, let be POVMs, and require . Then
Entropic uncertainty relation (Theorem 3). For disjoint register pairs assume For a subnormalized , POVMs , and , require . Then
(dim_E : nb = dim ('H[HL]_E0)) (dim_Zk : nz = dim ('H[HL]_Zkey)) (dim_B : nc = dim ('H[HL]_B)) : rhoSrc \is denmx -> 0 <= eps' -> eps' < Num.sqrt (@complex.Re R (\tr rhoSrc)) -> is_povm_mx M -> is_povm_mx N -> n_key%:R * q <= q_of_mx M N -> smooth_hmin E0 eps' (eur_rho_XB disSE0 rhoSrc M dimSE) + smooth_hmax B eps' (eur_rho_ZC disZB rhoSrc N dimZB)
= n_key%:R * q.
Remark. The generic theorem in Table VI concludes a one-block q_of_mx bound; this corollary is the paper's nq form and makes the overlap lower bound explicit. The predicate is_povm_mx is expanded in Table VI. The extension and purification/DPI bridges used by the generic endpoint are expanded in Table VI.
3 ) Entropy Bridges: Extensions and purification
Reusable EUR extension and purification bridges.
Formal statement
Mathematical reading
src/entropy/pur/def.v: hmax_mx, smooth_hmax_mx;
src/eur/def.v: purif_reshape_eq, purif_reshape;
src/eur/prop.v: eur_ii, smooth_hmax_mx_rho_ZC_purif_dpi
Definition hmax_mx (rho : 'M[C](na * nb) ) : R :=
sup [set v : R | exists sigma : 'M[C]nb,
sigma \is denlmx /
elog2 (na%:R *
(gfidelity rho (mmix_mx na *t sigma)) ^+ 2) = v%:E].
Definition smooth_hmax_mx (eps : R)
(rho : 'M[C](na * nb) ) : R :=
inf [set v : R | exists tau : 'M[C](na * nb),
((tau \is denmx) && (0 < @complex.Re R (\tr tau)) &&
(pur_dist_mx tau rho <= eps) /\ v = hmax_mx tau].
Definition purif_reshape_eq (na nb nc nd : nat) :
(na * nb * nc * nd = na * nb * (nc * nd) %N :=
esym (mulnA (na * nb) nc nd).
Definition purif_reshape rho :=
castmx (purif_reshape_eq na nb nc nd,
purif_reshape_eq na nb nc nd) rho.
Lemma eur_ii (eps : R) (rhoA : 'M[C]na)
(rhoAB : 'M[C](na * nb)) (tauA : 'M[C]na) :
rhoAB \is denmx -> rhoAB != 0 ->
ptrace2 rhoAB = rhoA ->
(tauA \is denmx) &&
(Num.sqrt (1 - (gfidelity tauA rhoA)^2) <= eps) ->
(exists tauAB : 'M[C](na * nb),
tauAB \is denmx /\ ptrace2 tauAB = tauA /
pur_dist_mx rhoAB tauAB <= eps) /
(\rank rhoAB = 1%N -> (\rank tauA <= nb) %N ->
tauA != 0 -> exists tauAB : 'M[C](na * nb),
tauAB \is denmx /\ \rank tauAB = 1%N /
ptrace2 tauAB = tauA /\ pur_dist_mx rhoAB tauAB <= eps).
Lemma smooth_hmax_mx_rho_ZC_purif_dpi
(eps : R) (N : 'I_nz -> 'M[C]na)
(rhoABC : 'M[C](na * nb * nc))
(rhoABCD : 'M[C](na * nb * nc * nd)) :
rhoABCD \is denmx -> rhoABCD != 0 ->
ptrace2 rhoABCD = rhoABC -> is_povm_mx N ->
0 <= eps -> eps < Num.sqrt (@complex.Re R (\tr rhoABCD)) ->
smooth_hmax_mx eps (rho_ZC N (purif_reshape rhoABCD)) <=
smooth_hmax_mx eps (rho_ZC N rhoABC).
Here gfidelity and pur_dist_mx are expanded in Table VI, while rho_ZC is
expanded in Table VI and mmix_mx in Table VI.
Close-extension lifting and mixed-state data processing. If extends and , there is an extension with . If is pure and rank , the extension may be pure. For a purification of ,
E. Hashing and Sampling
- Hash Families: Construction and composition.
Reusable hash-family constructions.
Formal statement
src/lhl/construction.v: allfun_hash, allfun_collision_cardM, allfun_two_univ, reindex_delta_almost_two_univ, two_univ_transport
Definition allfun_hash (f : {ffun X -> Z}) (x : X) : Z := f x.
Lemma allfun_collision_cardM (x x' : X) : x != x' -> (# | [set f : {ffun X -> Z} | f x == f x'] | * #|Z|) % N = # | {ffun X -> Z} | .
Theorem allfun_two_univ : (0 < #|Z|) % N -> @two_univ R [the finType of {ffun X -> Z}] X Z allfun_hash.
Lemma reindex_delta_almost_two_univ (e : Gidx -> Fidx) (F : Fidx -> X -> Z) (d : R) : bijective e -> delta_almost_two_univ (R := R) F d -> delta_almost_two_univ (R := R) (fun i x => F (e i) x) d.
Lemma two_univ_transport (Fidx Fidx' X X' Z Z' : finType) (F : Fidx -> X -> Z) (e : Fidx' -> Fidx) (hX : X' -> X) (gZ : Z -> Z') : bijective e -> injective hX -> bijective gZ -> two_univ (R := R) F -> two_univ (R := R) (fun f' x' => gZ (F (e f') (hX x'))) ).
The all-functions construction is an exact, reusable baseline; its seed is generally exponential in the input description.
src/lhl/def.v: hash_comp; src/lhl/prop.v: hash_comp_delta_almost_two_univ
Definition hash_comp (F1 : Flidx -> X -> Y) (F2 : F2idx -> Y -> Z) (fg : (Flidx * F2idx) % type) (x : X) : Z := F2 fg.2 (F1 fg.1 x).
Lemma hash_comp_delta_almost_two_univ (F1 : Flidx -> X -> Y) (F2 : F2idx -> Y -> Z) (delta1 delta2 : R) : 0 <= delta1 -> 0 <= delta2 -> delta_almost_two_univ F1 delta1 -> delta_almost_two_univ F2 delta2 -> delta_almost_two_univ (hash_comp F1 F2) (delta1 + delta2).
This is a generic TCS-facing composition theorem, independent of BB84 and of the quantum leftover-hash proof.
Mathematical reading
All-functions family and representation transport. For nonempty Z, taking the seed to be a function gives collision probability exactly for distinct inputs. Bijections of seeds, injective input relabellings, and bijective output relabellings preserve two-universality.
Composition of almost-two-universal families. If is -almost two-universal and is -almost two-universal with , their independently seeded composition is -almost two-universal.
2 ) Leftover Hash Lemma: Main bound.
Hashing and sampling endpoints.
Formal statement
src/lhl/lhl.v: two_universal_hashing
Theorem two_universal_hashing (Fh : 'Idx[HL]_F1 -> 'Idx[HL]_X -> 'Idx[HL]Z1) (eps : R) (rhoXE : 'F[HL](X : |: E)) : rhoXE \is psdlf -> @complex.Re R (\Tr rhoXE) <= 1 -> is_cq_state rhoXE -> @two_univ R ____ Fh -> 0 <= eps -> let rhoZFE := post_hash_state disXE Fh rhoXE in dist_from_uniform rhoZFE <= eps + (2%:R)^-1 * Num.sqrt (expR ((log2 (dim 'H[HL]_Z1) % : R - smooth_hmin E eps rhoXE) * ln 2%:R)).
Remark. The hypotheses state positivity, sub-normalization, classicality, and register disjointness; expR expresses the same base-two power.
Mathematical reading
Quantum Leftover Hash Lemma (Theorem 5). The smoothed endpoint is
- Sampling Bounds: Subsets and permutations.
Reusable Serfling objects and bounds.
Formal statement
src/utils/prob.v: Pr_cond, uniform_perm_mu, perm_pair_holdout_count, perm_pair_holdout_err, perm_pair_deviation_event, perm_pair_total_count, perm_pair_total_err, serfling_bound, serfling_uniform_perm_pair_deviation_tail
Definition Pr_cond (mu : T -> R) (A B : {set T}) : R := if Pr_event mu B == 0 then 0 else Pr_event mu (A : &: B) / Pr_event mu B.
Definition uniform_perm_mu (N : nat) (pi : 'S_N') : R := (# | { : 'S_N' | %: R) ^ -1.
Definition perm_pair_holdout_count (z z' : bitstr N) (pi : 'S_N') : nat := d_ham (perm_pair_holdout z pi) (perm_pair_holdout z' pi).
Definition perm_pair_holdout_err (z z' : bitstr N) (pi : 'S_N') : R := (perm_pair_holdout_count z z' pi) % : R / n % : R.
Definition perm_pair_deviation_event (z z' : bitstr N) (mu : R) : {set 'S_N'} := [set pi : 'S_N | perm_pair_holdout_err z z' pi >= perm_pair_sample_err z z' pi + mu].
Definition perm_pair_total_count (z z' : bitstr N) : nat := d_ham z z'.
Definition perm_pair_total_err (z z' : bitstr N) (_ : 'S_N') : R := (perm_pair_total_count z z') % : R / N % : R.
Lemma serfling_bound (z z' : bitstr N) (errtot delta : R) : (0 < n) % N -> (0 < k) % N -> 0 <= delta -> Pr_cond (fun pi : 'S_(k + n) => @uniform_perm_mu (k + n) pi) [set pi : 'S_(k + n) | @perm_pair_holdout_err n k z z' pi >= errtot + delta] % SET [set pi : 'S_(k + n) | @perm_pair_total_err n k z z' pi == errtot] % SET <= expR (- (2% : R * n % : R * (n + k) % : R / (k + 1) % : R * delta^2)).
Lemma serfling_uniform_perm_pair_deviation_tail (z z' : bitstr N) (mu : R) : (0 < n) % N -> (0 < k) % N -> 0 <= mu -> Pr_event (fun pi : 'S_N => @uniform_perm_mu N pi) (perm_pair_deviation_event z z' mu) <= expR (- 2 % : R * ((k * n) % : R / N % : R) * (k % : R / k . + 1 % : R) * mu ^ + 2)).
The second declaration exposes the unconditional deviation event and bound used by the aggregate BB84 sampling proof.
Mathematical reading
Serfling sampling bound (proof step in Theorem 6). For the uniform distribution on , set
, , ,
For , . The unconditional deviation form used downstream is
4) Extractor Lemmas: Collision bounds.
Reusable middle lemmas in the extractor proof
Formal statement
src/lhl/def.v: collision_ent; src/lhl/util.v: hoelder, coll_from_dmax, min_coll_bound
Definition collision_ent (rhoAB : 'F[HL]_(A : |: B)) (sigmaB : 'F[HL]_B) : R := let sigma_inv_half := (\1 : 'F_A) \O pinvlf (sqrtH sigmaB) in @complex.Re R (\Tr (sigma_inv_half \o rhoAB \o sigma_inv_half \o rhoAB)).
Lemma hoelder {m1 m2 m3 m4 : nat} (A : 'M[C](m1, m2)) (B : 'M[C](m2, m3)) (C0 : 'M[C]_(m3, m4)) (r s t : R) : (0 < r) % R -> (0 < s) % R -> (0 < t) % R -> (r^-1 + s^-1 + t^-1 = 1) % R -> trnorm (A * m B * m C0) <= schnorm r A * schnorm s B * schnorm t C0.
Lemma coll_from_dmax (rhoXE : 'F[HL]_S_XE)
Mathematical reading
Schatten and collision-entropy core. For conjugate exponents, . If , then ; for a subnormalized state , there exists a normalized with .
(sigmaE : 'F[HL]_E) (c : R) :
rhoXE \is psdlf -> sigmaE \is psdlf -> 0 <= c ->
rhoXE <= c%:C * : ((\1 : 'F_X) \O sigmaE) ->
collision_ent rhoXE sigmaE <= c * @complex.Re R (\Tr rhoXE).
Lemma min_coll_bound (rhoXE : 'F[HL]_S_XE) :
rhoXE \is psdlf -> @complex.Re R (\Tr rhoXE) <= 1 ->
exists (sigmaE : 'F[HL]_E),
sigmaE \is denllf /
(supph (ptrace_castl disXE rhoXE) <= supph sigmaE)%HS /
collision_ent rhoXE sigmaE <=
expR (- hmin E rhoXE * ln 2%:R).
Remark. coll_from_dmax is the operator implication, and min_coll_bound supplies its optimized collision-entropy witness.
Reusable middle lemmas in the extractor proof (continued).
| Formal statement | Mathematical reading |
|---|---|
| src/lhl/util.v: cq_smoothing; src/lhl/post_hash.v: pd_mono_post_hash; src/lhl/prop.v: dist_uniform_pd_triangle; src/utils/dist/pd.v: pd_mono_cptp | Cq-preserving smoothing and hashing transport. An optimal smooth-min witness for a cq-state can remain cq. Every CPTP map contracts purified distance, |
| Lemma cq_smoothing (eps : R) (rhoXE : 'F[HL]_S_XE) : rhoXE \is psdlf -> @complex.Re R (\Tr rhoXE) <= 1 -> 0 <= eps -> eps < Num.sqrt (@complex.Re R (\Tr rhoXE)) -> is_cq_state rhoXE -> exists tauXE, eps_ball eps rhoXE tauXE / \ is_cq_state tauXE / \ smooth_hminE E eps rhoXE = hminE E tauXE. | so post-hashing contracts purified distance. Distance from uniform obeys the mixed triangle bound $d_{\mathrm{u}}(\rho) \le P(\rho, \tau) + d_{\mathrm{u}}(\tau). |
| Lemma pd_mono_post_hash Fh (rhoXE tauXE : 'F[HL]_S_XE) : rhoXE \is psdlf -> tauXE \is psdlf -> @complex.Re R (\Tr rhoXE) <= 1 -> @complex.Re R (\Tr tauXE) <= 1 -> pur_dist (post_hash_state disXE Fh rhoXE) (post_hash_state disXE Fh tauXE) <= pur_dist rhoXE tauXE. | |
| pd_mono_post_hash instantiates the generic pd_mono_cptp contraction theorem for post-hashing. |
Privacy amplification.
Collision privacy amplification and the extractor endpoint.
| Formal statement | Mathematical reading |
|---|---|
| src/lhl/prop.v: uniform_to_collision, privacy_amp | Uniform distance and collision privacy amplification. |
| Lemma uniform_to_collision (rhoAB : 'F[HL]_S_AB) (tauB : 'F[HL]_B) : rhoAB \is psdlf -> @complex.Re R (\Tr tauB) <= 1 -> (supph (ptrace_castl disAB rhoAB) <= supph tauB)\%HS -> let rhoB := ptrace_castl disAB rhoAB in let tau_inv_half := pinvlf (sqrtH tauB) in dist_from_uniform rhoAB <= (2\%:R)^-1 * Num.sqrt (dim 'H[HL]_A) \%:R * collision_ent rhoAB tauB - @complex.Re R (\Tr (rhoB \o tau_inv_half \o rhoB \o tau_inv_half))). Lemma privacy_amp (rhoXE : 'F[HL]_S_XE) (tauE : 'F[HL]_E) (Fh : 'Idx[HL]_F1 -> 'Idx[HL]_X -> 'Idx[HL]_Z1) | , and -almost-two-universality adds at most to collision entropy. |
(delta : R) : rhoXE \is psdlf -> @complex.Re R (\Tr rhoXE) <= 1 -> tauE \is psdlf -> is_cq_state rhoXE -> 0 <= delta -> delta_almost_two_univ Fh delta -> let rhoZFE := post_hash_state disXE Fh rhoXE in let rhoF_tauE := ((dim 'H[HL]_F1) % : R^-1) % : C * : ((\1 : 'F_F1) \O tauE) in let tau_inv_half := pinvlf (sqrtH tauE) in let rhoE := ptrace_castl disXE rhoXE in collision_ent rhoZFE rhoF_tauE <= collision_ent rhoXE tauE + delta * @complex.Re R (\Tr (rhoE \o tau_inv_half \o rhoE \o tau_inv_half)).
These declarations establish the displayed uniform-distance and collision privacy-amplification bounds.
src/lhl/lhl.v: almost_two_universal_hashing
Theorem almost_two_universal_hashing (Fh : 'Idx[HL]_F1 -> 'Idx[HL]_X -> 'Idx[HL]Z1) (delta eps eps_bar : R) (rhoXE : 'F[HL](X : |: E)) : rhoXE \is denllf -> is_cq_state rhoXE -> 0 <= delta -> delta_almost_two_univ Fh delta -> 0 <= eps -> 0 < eps_bar -> let rhoZFE := post_hash_state disXE Fh rhoXE in let printed_bound : R := eps + eps_bar + (2% : R)^-1 * Num.sqrt ( (dim 'H[HL]_Z1) % : R * delta - 1 + expR ((log2 (dim 'H[HL]_Z1) % : R - smooth_hmin E eps rhoXE) * ln 2% : R)
- (2% : R * eps_bar^-2 + 1)) in dist_from_uniform rhoZFE <= printed_bound.
The theorem conditions min-entropy on the adversary register E.
-almost-two-universal LHL. For a normalized cq-state,
.
- Seed Averaging: Average bounds.
Fixed-seed average extractor bounds.
Formal statement
src/lhl/def.v: post_hash_seed_state, post_hash_seed_average_dist; src/lhl/lhl.v: two_universal_seed_average_hmin, almost_two_universal_seed_average_hmin, quant
Definition post_hash_seed_state Fh f rhoXE : 'F[HL]_(Z1 : |: E) := \sum_z [> deltav z ; deltav z <] \O (\sum_x | Fh f x == z) cq_block disXE x rhoXE).
Definition post_hash_seed_average_dist Fh rhoXE : R := (dim 'H[HL]_F1) % : R^-1 * \sum_f dist_from_uniform (post_hash_seed_state disXE Fh f → rhoXE).
Theorem two_universal_seed_average_hmin Fh rhoXE : rhoXE \is denllf -> is_cq_state rhoXE -> @two_univ R _ _ _ Fh → post_hash_seed_average_dist disXE Fh rhoXE <= (2% : R)^-1 * Num.sqrt (expR ( (log2 (dim 'H[HL]_Z1) % : R - hmin E rhoXE) * ln 2% : R)).
Theorem almost_two_universal_seed_average_hmin Fh delta eps_bar rhoXE : rhoXE \is denllf -> is_cq_state rhoXE -> 0 <= delta -> delta_almost_two_univ Fh delta -> 0 < eps_bar -> post_hash_seed_average_dist disXE Fh rhoXE <= eps_bar + (2% : R)^-1 * Num.sqrt ( (dim 'H[HL]_Z1) % : R * delta - 1 + expR ((log2 (dim 'H[HL]_Z1) % : R - hmin E rhoXE) * ln 2% : R) * (2% : R * eps_bar^-2 + 1)).
Theorem quant Fh delta rhoXE : rhoXE \is denllf -> is_cq_state rhoXE -> 0 <= delta -> delta_almost_two_univ Fh delta -> post_hash_seed_average_dist disXE Fh rhoXE <= inf [set Delta : R | exists eps_bar : R,
Mathematical reading
Published-seed states and average LHL. For a fixed seed f,
, .
Two-universal hashing yields
.
The -almost-two-universal bound optimizes the corresponding -dependent expression.
0 < eps_bar / \ Delta = eps_bar + (2%:R)^-1 * Num.sqrt (
(dim 'H[HL]_Z1)%:R * delta - 1 +
expR ((log2 (dim 'H[HL]_Z1)%:R - hmin E rhoXE) * ln 2%:R)
← *
(2%:R * eps_bar^-2 + 1)) ] /
(delta <= ((dim 'H[HL]_Z1)%:R)^-1 ->
post_hash_seed_average_dist disXE Fh rhoXE <=
(2%:R)^-1 * Num.sqrt (expR (
(log2 (dim 'H[HL]_Z1)%:R - hmin E rhoXE) * ln 2%:R))).
The final conjunct of quant is the two-universal specialization.
- Short Seeds: Construction.
Polynomial short-seed construction.
Formal statement
src/lhl/construction.v: binary_field_dim, binary_field_card, binary_field_coord_project, binary_field_coord_output_card, binary_field_coord_project_diff_compat, binary_field_coord_project_surj, field_mult_project_hash, field_mult_project_hash_two_univ, polynomial_hash_poly, polynomial_hash_paper, polynomial_hash_paper_delta_almost_two_univ; src/lhl/prop.v: hash_comp_delta_almost_two_univ
Definition binary_field_dim : nat := \dim {: K : vectType 'F_2}. Definition binary_field_coord_project (ell : nat) (Hell : (ell <= binary_field_dim)%N) (x : K) : 'rV['F_2']_ell ← := \row_i coord (vbasis {: K}) (widen_ord Hell i) x. Lemma binary_field_card : #|K| = (2 ^ binary_field_dim)%N. Lemma binary_field_coord_output_card ell : #|'rV['F_2']_ell| = (2 ^ ell)%N. Lemma binary_field_coord_project_diff_compat ell Hell : forall u v : K, (binary_field_coord_project Hell u == binary_field_coord_project Hell v) = (binary_field_coord_project Hell (u - v) == binary_field_coord_project Hell 0). Lemma binary_field_coord_project_surj ell Hell : forall z : 'rV['F_2']ell, exists t : K, binary_field_coord_project Hell t = z. Definition field_mult_project_hash (Z : finType) (pi : K -> Z) (alpha x : K) : Z := pi (x * alpha). Theorem field_mult_project_hash_two_univ (Z : finType) (pi : K -> ← Z) : (forall u v, (pi u == pi v) = (pi (u - v) == pi 0)) -> (forall z, exists t, pi t = z) -> two_univ (R := R) (field_mult_project_hash pi). Definition polynomial_hash_poly (x : r.-tuple K) : {poly K} := \poly(i < r) nth 0 x i. Definition polynomial_hash_paper (alpha : K) (x : r.-tuple K) : K ← := (polynomial_hash_poly [tuple tnth x (rev_ord i) | i < ← r]).[alpha]. Theorem polynomial_hash_paper_delta_almost_two_univ : delta_almost_two_univ (R := R) polynomial_hash_paper (r.-1%:R / #|K|%:R). The component composition is hash_comp_delta_almost_two_univ.
Mathematical reading
Polynomial and finite-field families. Over , evaluation of a degree- polynomial at a uniform point has collision probability at most . For , the coordinate projection is surjective and
The multiply-and-project family is two-universal, and composition gives .
Extractor.
Polynomial short-seed extractor theorem.
Formal statement
src/lhl/lhl.v: almost_two_universal
Theorem almost_two_universal (n_bits ell : nat) (eps : R) (rhoXE : 'F[HL]_(X : |: E)) : let target := ell%:R + log2 ((n_bits%:R : R) / ell%:R) + log2 (eps^-2) - 1 in
let k_bits := Num.truncn target in
let r := ^ |Num.ceil ((n_bits%:R : R) / (k_bits%:R : R)) | %N in rhoXE \is den1lf -> is_cq_state rhoXE -> 0 < eps -> (0 < n_bits) %N -> (0 < ell) %N -> (ell <= k_bits) %N -> dim 'H[HL]_F1 = (2 ^ (2 * k_bits)) %N -> dim 'H[HL]_X = (2 ^ n_bits) %N -> dim 'H[HL]_Z1 = (2 ^ ell) %N -> let delta := r.-1%:R / (2%:R ^+ k_bits) + ((2%:R ^+ ell)^-1) %R in
exists Fh : 'Idx[HL]_F1 -> 'Idx[HL]_X -> 'Idx[HL]_Z1,
delta_almost_two_univ Fh delta /
log2 ((dim 'H[HL]_F1) %:R : R) = 2%:R * k_bits%:R /
log2 ((dim 'H[HL]_F1) %:R : R) = 2%:R * ((floor target) %:~R : R) /
log2 ((dim 'H[HL]_X) %:R : R) = n_bits%:R /
log2 ((dim 'H[HL]_Z1) %:R : R) = ell%:R /
delta <= (1 + 4%:R * eps ^+ 2) / (2%:R ^+ ell) /
let printed_bound := 3%:R * eps + (2%:R)^-1 * Num.sqrt (
expR ((log2 (dim 'H[HL]_Z1) %:R - smooth_hmin E eps rhoXE) *
ln 2%:R) * (2%:R * eps^-2 + 1)) in
dist_from_uniform (post_hash_state disXE Fh rhoXE) <= → printed_bound.
The theorem exposes positivity, , register dimensions, and the floor convention used by the construction.
Mathematical reading
Short-seed endpoint. Set
The constructed family satisfies
F. BB84 Proof
- Parameter Estimation: Bad-pass mass.
Reusable bad-pass mass and Hamming-ball bounds.
Formal statement
src/qkd/bb84/model.v: bb84_pass_bad_weight, bb84_pass_bad_weight_le, bb84_pass_bad_weight_le_pass; src/utils/bitstr.v: hamming_ball_count_max_entropy_bound, hamming_ball_count_max_entropy_bound_total
Definition bb84_pass_bad_weight (P : bb84_protocol) (G : bb84_zsource P) (eps : R) : R := \sum_(z : 'I_(bb84_full_string_count P)) \sum_(z' : 'I_(bb84_full_string_count P)) bb84_W G z z' * Pr_event (fun S0 : {set 'I_(bb84_total_rounds P)} => @subset_uniform_mu R (bb84_n P) (bb84_k P) S0) ([set S0 : {set 'I_(bb84_total_rounds P)} | @subset_sorted_rep (bb84_n P) (bb84_k P) S0 \in @perm_pair_sample_le_event R (bb84_n P) (bb84_k P) (ord_to_bitstring z) (ord_to_bitstring z') (bb84_Qtol P)] :&: [set S0 : {set 'I_(bb84_total_rounds P)} | @subset_sorted_rep (bb84_n P) (bb84_k P) S0 \in @perm_pair_deviation_event R (bb84_n P) (bb84_k P) (ord_to_bitstring z) (ord_to_bitstring z') (bb84_mu (bb84_n P) (bb84_k P) eps)]).
Lemma bb84_pass_bad_weight_le (P : bb84_protocol) (G : bb84_zsource P) (eps : R) : (0 < bb84_n P) %N -> (0 < bb84_k P) %N -> 0 < eps -> bb84_pass_bad_weight G eps <= eps ^+ 2.
Lemma bb84_pass_bad_weight_le_pass (P : bb84_protocol) (G : bb84_zsource P) (eps : R) : bb84_pass_bad_weight G eps <= bb84_p_pass_tot G.
Mathematical reading
Pass intersected with excessive holdout error. Let be the pass event and the event that the holdout error exceeds the sampled error by at least . The reusable weighted mass is
,
with the two independent bounds
For and ,
and the totalized theorem covers every .
Lemma hamming_ball_count_max_entropy_bound (n : nat) (delta : R) ← : (0 < n) %N -> 0 < delta -> delta < 1 / 2 -> log2 (@relative_hamming_ball_count_max n delta) %:R <= n%:R * h_bin delta.
Lemma hamming_ball_count_max_entropy_bound_total (n : nat) (delta : R) : (0 < n) %N -> delta <= 1 / 2 -> log2 (@relative_hamming_ball_count_max n delta) %:R <= n%:R * h_bin delta.
The pass-state weights and canonical subset sampler are expanded in Table VI; the deviation event is expanded with the Serfling objects in Table VI. The total theorem extends the interior Hamming bound to every .
Entropy bound
Finite-key sampling aggregate consumed by BB84.
Formal statement
src/qkd/bb84/model.v: bb84_total_rounds, bb84_full_string_count, bb84_zsource, bb84_bbkey; src/qkd/bb84/prop.v: stat
Definition bb84_total_rounds (P : bb84_protocol) : nat := bb84_k P + bb84_n P.
Definition bb84_full_string_count (P : bb84_protocol) : nat := 2 ^ bb84_total_rounds P.
Record bb84_zsource (P : bb84_protocol) := BB84ZSource { bb84_zsrc_nb : nat; bb84_zsrc_rho : 'M[C]_(bb84_full_string_count P * bb84_zsrc_nb * bb84_full_string_count P); bb84_zsrc_den1 : bb84_zsrc_rho \is denlmx }.
Lemma bb84_bbkey (n k : nat) (z z' : bitstr (k + n)) (Qtol eps : R) : (0 < n) %N -> (0 < k) %N -> 0 < eps -> let mu := bb84_mu n k eps in let pass_event : {set 'S_(k + n)} := [set pi | perm_pair_sample_err z z' pi <= Qtol] in let p_pass := Pr_event (fun pi : 'S_(k + n) => uniform_perm_mu pi) pass_event in 0 < p_pass -> Pr_cond (fun pi : 'S_(k + n) => uniform_perm_mu pi) (perm_pair_deviation_event z z' mu) pass_event <= eps ^+ 2 / p_pass.
Lemma stat (Zkey B : {set L}) (disZB : [disjoint Zkey & B]) (P : @bb84_protocol R) (G : bb84_zsource P) (eps : R) (dim_Zk : (2 ^ bb84_n P) %N = dim ('H[HL]_Zkey)) (dim_B : (2 ^ bb84_n P) %N = dim ('H[HL]_B)) : (0 < bb84_n P) %N -> (0 < bb84_k P) %N -> 0 < eps -> 0 < bb84_p_pass_tot G -> let eps' := eps / Num.sqrt (bb84_p_pass_tot G) in eps' < 1 -> let h_trunc := bb84_h_trunc (bb84_Qtol P + bb84_mu (bb84_n P) (bb84_k P) eps) in smooth_hmax B eps' (bb84_rhoZZ_pass_mixH disZB G dim_Zk dim_B) <= (bb84_n P) %:R * h_trunc.
bb84_bbkey states the displayed conditional bound, and stat provides the aggregate smooth max-entropy endpoint. The full-string aggregate route uses the two bad-pass bounds in Table VI inside stat to bound bb84_rhoZZ_pass_mixH; its probability and state definitions are expanded in Table VI. The bb84_secret proof invokes stat after transporting the delayed measurement through the EUR and derives the smooth-min-entropy bound by subtracting the resulting smooth-max bound from the EUR.
Mathematical reading
Sampling to smooth max-entropy (steps 1 and 4 of the secrecy chain in Appendix B). Conditioning the Serfling deviation event on passing gives probability at most and hence
- Entropy Transfer: Measurement and leakage.
Delayed measurement and leakage bridges.
Formal statement
src/qkd/bb84/def.v: bb84_delayed_measurement_condition; src/qkd/bb84/bb84.v: bb84_delayed_measurement_hmax; src/qkd/bb84/prop.v: chain_rule_class, chain_rule_class_leak_bound
Record bb84_delayed_measurement_condition (BobZ : 'QC[HL](Bq, Zp)) (rhoZB : 'F[HL](Zkey : |: Bq)) (rhoZZp : 'F[HL](Zkey : |: Zp)) := { bb84_dmc_full : 'F[HL](Zkey : |: Bq : |: finset.set0); bb84_dmc_full_den1 : bb84_dmc_full \is den1lf; bb84_dmc_source : ptrace_cast3C (disjointX0 Zkey) (disjointX0 Bq) bb84_dmc_full = rhoZB; bb84_dmc_target : ptrace_cast3C (disjointX0 Zkey) (disjointX0 Zp) ((\1 : 'SO[HL]Zkey) : ⊗ (BobZ : 'SO[HL](Bq, Zp)) ) : ⊗ (\1 : 'SO[HL]_finset.set0) bb84_dmc_full) = rhoZZp }.
Lemma bb84_delayed_measurement_hmax (eps0 : R) (BobZ : 'QC[HL](Bq, Zp)) (rhoZB : 'F[HL](Zkey : |: Bq)) (rhoZZp : 'F[HL]_(Zkey : |: Zp)) : 0 <= eps0 -> eps0 < Num.sqrt (@complex.Re R (\Tr rhoZB)) -> bb84_delayed_measurement_condition BobZ rhoZB rhoZZp -> smooth_hmax Bq eps0 rhoZB <= smooth_hmax Zp eps0 rhoZZp.
Lemma chain_rule_class (C : {set L}) (disSC : [disjoint S & C]) (disEC : [disjoint E & C]) (disC_SE : [disjoint C & (S : |: E)]) (eps' : R) (rho : 'F[HL](C : |: (S : |: E))) : rho \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> (forall x x' : 'Idx[HL]C, x' != x -> ((> deltav x ; deltav x <] \0 (\1 : 'F(S : |: E))) \o rho \o ([> deltav x' ; deltav x' <] \0 (\1 : 'F(S : |: E)))) = 0) → -> 0 <= eps' < Num.sqrt (@complex.Re R (\Tr rho)) -> (smooth_hminE E eps' (ptrace_castl disC_SE rho) - (log2 (dim 'H[HL]_C) %:R) %:E <= smooth_hminE (E : |: C) eps' rho) %E.
Lemma chain_rule_class_leak_bound (C : {set L}) (disSC : [disjoint S & C]) (disEC : [disjoint E & C]) (disC_SE : [disjoint C & (S : |: E)]) (eps' leak : R) (rho : 'F[HL](C : |: (S : |: E))) : rho \is psdlf -> @complex.Re R (\Tr rho) <= 1 -> (forall x x' : 'Idx[HL]C, x' != x -> ((> deltav x ; deltav x <] \0 (\1 : 'F(S : |: E))) \o rho \o ([> deltav x' ; deltav x' <] \0 (\1 : 'F(S : |: E)))) = 0) → -> 0 <= eps' < Num.sqrt (@complex.Re R (\Tr rho)) -> log2 (dim 'H[HL]_C) %:R <= leak -> (smooth_hminE E eps' (ptrace_castl disC_SE rho) - leak%:E <= smooth_hminE (E : |: C) eps' rho) %E.
The chain-rule declarations specialize the reusable class_bounds_2_min_lower row in Table VI.
Mathematical reading
Delayed measurement and public classical leakage (steps 3 and 5). A CPTP delayed measurement gives . For a transcript C classical in the key basis, , or the same bound with any certified leakage upper bound.
Projectors.
Reusable good-projector lemmas.
Formal statement
src/entropy/pur/def.v: mmix_mx, hmax_mx, smooth_hmax_mx; src/utils/bitstr.v: relative_hamming_ball; src/qkd/bb84/model.v: bb84_pair_projector, bb84_good_projector, bb84_good_projector_pass_mass; src/qkd/bb84/prop.v: bb84_hmax_good_projector_bound, bb84_smooth_hmax_good_projector_mass
Definition mmix_mx (n : nat) : 'M[C]_n := (n% : R^-1) % : C * : 1% : M.
Definition hmax_mx (rho : 'M[C]_(na * nb)) : R :=
sup [set v : R | exists sigma : 'M[C]_nb,
sigma \is denlmx /
elog2 (na% : R *
(gfidelity rho (mmix_mx na *t sigma)) ^+ 2) = v% : E].
Definition smooth_hmax_mx (eps : R) (rho : 'M[C](na * nb)) : R ↔ := inf [set v : R | exists tau : 'M[C](na * nb), ((tau \is denmx) && (0 < @complex.Re R (\tr tau))) && (pur_dist_mx tau rho <= eps) / \ v = hmax_mx tau].
Definition relative_hamming_ball (n : nat) (delta : R) (x x' : 'I_(2 ^ n)) : bool := (( (d_ham (ord_to_bitstring x) (ord_to_bitstring x')) % : R / n% : R) < delta) % R.
Definition bb84_good_projector (n : nat) (delta : R) := \sum_ (x : 'I_(2 ^ n)) \sum_ (x' : 'I_(2 ^ n) | relative_hamming_ball delta x x') bb84_pair_projector x x'.
Lemma bb84_hmax_good_projector_bound (n_key : nat) (delta : R) (rho : 'M[C]_(2 ^ n_key) * (2 ^ n_key)) : (0 < n_key) % N -> 0 < delta -> rho \is psdmx -> @complex.Re R (\tr rho) = 1 -> rho *m bb84_good_projector n_key delta = rho -> hmax_mx rho <= n_key% : R * bb84_h_trunc delta.
Lemma bb84_good_projector_pass_mass (P : bb84_protocol) (G : bb84_zsource P) (eps : R) : (0 < bb84_n P) % N -> 0 < bb84_p_pass_tot G -> let delta := bb84_Qtol P + bb84_mu (bb84_n P) (bb84_k P) eps in 1 - bb84_pass_bad_weight G eps / bb84_p_pass_tot G <= @complex.Re R (\tr (bb84_good_projector (bb84_n P) delta *m bb84_rhoZZ_pass_mix G *m bb84_good_projector (bb84_n P) delta)).
Lemma bb84_smooth_hmax_good_projector_mass (n_key : nat) (delta eps0 : R) (rho : 'M[C]_(2 ^ n_key) * (2 ^ n_key)) : (0 < n_key) % N -> rho \is psdmx -> @complex.Re R (\tr rho) = 1 -> 0 <= eps0 -> eps0 < 1 -> 1 - eps0 ^+ 2 <= @complex.Re R (\tr (@bb84_good_projector R n_key delta *m rho *m @bb84_good_projector R n_key delta)) -> smooth_hmax_mx eps0 rho <= n_key% : R * bb84_h_trunc delta.
Mathematical reading
Good-subspace mass to smooth max-entropy. Let project onto key pairs with relative Hamming distance strictly below . For a normalized state supported on that subspace,
For the pass mixture with , parameter estimation supplies
For any normalized state with good-subspace mass at least , , the reusable smoothing step yields
The basis-pair projector used in bb84_good_projector is expanded in Table VI. The Hamming-distance and ordinal encodings in relative_hamming_ball are expanded in Table VI; gfidelity and pur_dist_mx, used by hmax_mx and smooth_hmax_mx, are expanded in Table VI. These lemmas isolate the coding-theoretic projector bound, its smoothing step, and the pass-event probability accounting used by the labelled endpoint.
Readout.
Computational-basis readout.
Formal statement
src/qkd/bb84/model.v: bb84_pair_basis_readout; src/qkd/bb84/bb84.v: bb84_bob_z_basis_readout_hmax
Definition bb84_pair_basis_readout (n : nat) (rho : 'M[C](2 ^ n) * (2 ^ n)) : 'M[C](2 ^ n) * (2 ^ n)) := \sum_(z : 'I_(2 ^ n)) \sum_(b : 'I_(2 ^ n)) rho (mxtens_index (z, b)) (mxtens_index (z, b)) * : @bb84_pair_projector n z b.
Lemma bb84_bob_z_basis_readout_hmax (P : bb84_protocol) (ne : nat) (eps0 : R) (dim_Zk_key : (2 ^ bb84_n P) %N = dim ('H[HL]_Zkey)) (dim_Bq_key : (2 ^ bb84_n P) %N = dim ('H[HL]_Bq)) (dim_Zp_key : (2 ^ bb84_n P) %N = dim ('H[HL]Zp)) (rho : 'M[C](2 ^ bb84_n P) * ne * (2 ^ bb84_n P)) : rho \is denlmx -> 0 <= eps0 -> eps0 < 1 -> let dimZBq := bb84_register_pair_dim disZBq dim_Zk_key dim_Bq_key in let rhoZB := eur_rho_ZC disZBq rho (@std_projective_povm R (2 ^ bb84_n P)) dimZBq in let rhoZZp := biprod_of.mx disZZp (castmx (f_equal2 muln dim_Zk_key dim_Zp_key, f_equal2 muln dim_Zk_key dim_Zp_key) (@bb84_pair_basis_readout R (bb84_n P) (rho_ZC (@std_projective_povm R (2 ^ bb84_n P)) rho))) in smooth_hmax Bq eps0 rhoZB <= smooth_hmax Zp eps0 rhoZZp.
The state constructors rho_ZC and eur_rho_ZC are expanded in Table VI; bb84_pair_projector is expanded in Table VI. This is the dephasing map used by the readout data-processing theorem.
Mathematical reading
Dephasing readout and max-entropy data processing. The basis-pair readout is
.
For Bob's computational-basis readout,
.
- Privacy Amplification: Leakage arithmetic.
Privacy amplification and the optimized witness.
Formal statement
src/qkd/bb84/model.v: privacy_amplification; src/qkd/bb84/bb84.v: bb84_public_leakage_pa_hmin_diff, bb84_delta_from_hmin_diff, bb84_delta_from_public_leakage
Corollary privacy_amplification (Fh : 'Idx[HL]_F1 -> 'Idx[HL]_S -> 'Idx[HL]Z1) (eps' : R) (rhoXE : 'F[HL](S : |: E)) : rhoXE \is psdlf -> @complex.Re R (\Tr rhoXE) <= 1 -> is_cq_state rhoXE -> @two_univ R _ _ _ Fh -> 0 <= eps' -> dist_from_uniform (post_hash_state disSE Fh rhoXE) <= eps' + (2%:R)^-1 * Num.sqrt (expR ((log2 (dim 'H[HL]_Z1) %:R - smooth_hmin E eps' rhoXE) * ln 2%:R)).
Lemma bb84_public_leakage_pa_hmin_diff (Ppub : {set L}) (rhoXE : 'F[HL]_(S : |: E)) (leak eps' base tail logZ : R) (pub : bb84_public_leakage Ppub rhoXE leak) : 0 <= eps' < Num.sqrt (@complex.Re R (\Tr (bb84_public_state pub))) -> base <= smooth_hmin E eps' rhoXE -> logZ <= base + tail - leak -> let eq_pub_assoc := bb84_public_assoc S E Ppub in logZ - smooth_hmin (E : |: Ppub) eps' (castlf (eq_pub_assoc, eq_pub_assoc) (bb84_public_state pub)) <= tail.
Lemma bb84_delta_from_hmin_diff (Epub : {set L}) (Fh : 'Idx[HL]_F1 -> 'Idx[HL]_S -> -> 'Idx[HL]Z1) (eps' ebar : R) (rhoXEpub : 'F[HL](S : |: Epub)) : rhoXEpub \is psdlf -> @complex.Re R (\Tr rhoXEpub) <= 1 -> is_cq_state rhoXEpub -> @two_univ R _ _ _ Fh -> 0 <= eps' -> 0 < ebar -> log2 (dim 'H[HL]_Z1) %:R - smooth_hmin Epub eps' rhoXEpub
Mathematical reading
Privacy amplification and leakage arithmetic (steps 6–8). The LHL permits taking
as an upper bound; the key-length premise yields , and the non-abort factor yields secrecy. The reusable leakage rearrangement is
, .
<= 2%:R * log2 (2%:R * ebar) -> delta_secret (post_hash_state disSEpub Fh rhoXEpub) (eps' + -> ebar).
Lemma bb84_delta_from_public_leakage (Ppub : {set L}) (rhoXE : 'F[HL]_(S : |: E)) (leak eps' ebar base : R) (pub : bb84_public_leakage Ppub rhoXE leak) (Fh : 'Idx[HL]_F1 -> 'Idx[HL]_S -> 'Idx[HL]_Z1) : 0 <= eps' < Num.sqrt (@complex.Re R (\Tr (bb84_public_state pub))) -> base <= smooth_hmin E eps' rhoXE -> log2 (dim 'H[HL]_Z1) %:R <= base + 2%:R * log2 (2%:R * ebar) - leak -> @two_univ R __ __ Fh -> 0 < ebar -> let eq_pub_assoc := bb84_public_assoc S E Ppub in delta_secret (post_hash_state disSEpub Fh (castlf (eq_pub_assoc, eq_pub_assoc) (bb84_public_state pub))) (eps' + ebar).
The last declaration packages public leakage and the raw privacy-amplification distance bound. The EUR-plus-statistics subtraction is derived inside bb84_secret; the same theorem carries that bound through public leakage, accepted-state postselection, and privacy amplification.
4 ) Key Length: Optimized witness.
Optimized key-length witnesses.
Formal statement
src/qkd/bb84/prop.v: bb84_key_length_has_sup, bb84_key_length_sup_witness
Lemma bb84_key_length_has_sup
(P : @bb84_protocol R) (q eps_s : R) :
0 < eps_s -> eps_s <= 1 ->
has_sup (fun M : R =>
exists eps ebar : R,
0 < eps / \ eps < 1 / \ 0 < ebar / \ eps + ebar <= eps_s /
M = ((floor (bb84_key_length_ub
(bb84_n P) (bb84_k P) q (bb84_Qtol P)
eps ebar (bb84_leak_EC P) (bb84_eps_c P))) %:~R : R)).
Lemma bb84_key_length_sup_witness
(P : @bb84_protocol R) (q eps_s target : R) :
0 < eps_s -> eps_s <= 1 -> target \is a int_num ->
target <= sup (fun M : R =>
exists eps ebar : R,
0 < eps / \ eps < 1 / \ 0 < ebar / \ eps + ebar <= eps_s /
M = ((floor (bb84_key_length_ub
(bb84_n P) (bb84_k P) q (bb84_Qtol P)
eps ebar (bb84_leak_EC P) (bb84_eps_c P))) %:~R : R)) ->
exists eps ebar,
0 < eps / \ eps < 1 / \ 0 < ebar / \ eps + ebar <= eps_s /
target <=
((floor (bb84_key_length_ub
(bb84_n P) (bb84_k P) q (bb84_Qtol P)
eps ebar (bb84_leak_EC P) (bb84_eps_c P))) %:~R : R).
These declarations provide the real-supremum and integer-rounding witnesses for the optimized key-length premise.
Mathematical reading
Optimized parameter witness. For , the feasible floored key-length set is nonempty and bounded above. Consequently, an integer key target below its supremum admits concrete satisfying positivity, secrecy budget, and the floored key-length inequality.
Pass split.
The smoothing-domain and low-pass branches.
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/bb84/model.v: bb84_entropy_domain, bb84_eps_lt_sqrt_pass; src/qkd/bb84/bb84.v: bb84_secretDefinition bb84_entropy_domain (eps p_pass : R) : Prop := 0 < eps / \ eps < Num.sqrt p_pass.Lemma bb84_eps_lt_sqrt_pass eps p_pass : bb84_entropy_domain eps p_pass -> eps < Num.sqrt p_pass.bb84_secret contains the case split, low-pass arithmetic, and distance bound; bb84_eps_lt_sqrt_pass provides the smoothing-domain conversion. | EUR-valid versus high-abort split (Section VII-A). If , then , so the rescaled smoothing radius lies in the EUR domain. In the complementary branch , the abort/pass relation and give ; the universal distance bound closes secrecy without invoking the EUR. |
G. Semantics
- Well-Formedness: Command algebra.
Sequencing and command well-formedness.
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/protocol/syntax.v: cmd_wf, seq_cmd, for_cmd, cmd_seqA, cmd_seq_skip_l, cmd_seq_skip_r, cmd_wf_seq_cmd, cmd_wf_for_cmdFixpoint cmd_wf (c : qkd_cmd) : Prop := match c with | Cskip => True | Cassign _ _ => True | Csample _ mu => forall v, 0 <= mu s v) / \ \sum_v mu s v = 1 | Cinit Q rho => [disjoint Q & qA] / \ forall s, rho s \is denllf | Cmeasure _ Q M => [disjoint Q & qA] / \ forall s, \sum_v ((M s v)^A \o (M s v)) = \1 | Cattack Q => [disjoint Q & qA] | Cif _ c1 c2 => cmd_wf c1 / \ cmd_wf c2 | Cseq c1 c2 => cmd_wf c1 / \ cmd_wf c2 end.Lemma cmd_seqA : associative seq_cmd.Lemma cmd_seq_skip_l : left_id Cskip seq_cmd.Lemma cmd_seq_skip_r : right_id Cskip seq_cmd.Lemma cmd_wf_seq_cmd (c1 c2 : qkd_cmd) : cmd_wf c1 -> cmd_wf c2 -> cmd_wf (seq_cmd c1 c2).Lemma cmd_wf_for_cmd {limit} (body : 'I_limit -> qkd_cmd) : (forall i, cmd_wf (body i)) -> cmd_wf (for_cmd body).The definitions seq_cmd and for_cmd appear in Table VI; this row gives cmd_wf and the associated laws. | Sequencing and well-formedness. Sequencing forms a monoid, and skip; ; skip. A sampling distribution is nonnegative and sums to one; initialized states have unit trace; measurements are complete; initialized, measured, and attacked registers are disjoint from the adversary workspace. Well-formedness is closed under sequencing and finite loops. |
- Denotation: Linearity and healthiness.
Reusable denotational metatheory.
| Formal statement | Mathematical reading |
|---|---|
| Decomposition, linearity, and healthiness. Every cq-state decomposes into singleton states, andMoreover,,and, when wf(c) and every block is positive semidefinite,Finally, wf(c) ∧ wf(ξ) implies wf(\left[\left[c\right]\right](\xi)). |
Lemma denote_singleton_decomp (c : qkd_cmd) (xi : cq_state) : denote c xi = \sum_s denote_singleton c s (xi s).
Lemma denote_psd (c : qkd_cmd) (xi : cq_state) : cmd_wf c -> (forall s, xi s \is psdlf) -> forall s, denote c xi s \is psdlf.
Lemma denote_mass (c : qkd_cmd) (xi : cq_state) : cmd_wf c -> (forall s, xi s \is psdlf) -> cq_mass (denote c xi) = cq_mass xi.
Lemma denote_cq_wf (c : qkd_cmd) (xi : cq_state) : cmd_wf c -> cq_wf xi -> cq_wf (denote c xi).
All project-defined objects in these laws are expanded in Table VI.
- Classical Transport: Marginal preservation.
| Classical-tail marginal transport. | Mathematical reading |
|---|---|
| Formal statement | |
| src/qkd/example/run.v: classical_cmd, denote_classical_ptraceso_eq | Classical programs preserve quantum-marginal equality. For a command with no initialization, measurement, or adversarial quantum action, |
| Fixpoint classical_cmd (c : qkd_cmd) : Prop := match c with | Cskip => True | Cassign _ _ => True | Csample _ _ => True | Cinit _ _ => False | Cmeasure _ _ => False | Cattack _ => False | Cif _ cl c2 => classical_cmd cl /\ classical_cmd c2 | Cseq cl c2 => classical_cmd cl /\ classical_cmd c2 end. | |
| Lemma denote_classical_ptraceso_eq (qA : {set L}) (EA : @adversary R L HL V qA) (Qsa : {set L}) (c : @qkd_cmd R L HL Cv V) (xil xi2 : @cq_state R L HL Cv V) : classical_cmd c -> (forall u, ptraceso Qsa (xil u) = ptraceso Qsa (xi2 u)) -> forall u, ptraceso Qsa (@denote R L HL Cv V qA Pvar EA c xil u) = ptraceso Qsa (@denote R L HL Cv V qA Pvar EA c xi2 u). | |
| This generic noninterference-style lemma transports the per-round PM/EB equality through announcement, parameter estimation, error correction, abort branches, and privacy amplification. |
H. Instance
- Source and Device: Ideal source.
| Concrete full-string source state and measurements. | Mathematical reading |
|---|---|
| Formal statement | |
| src/qkd/example/instantiation.v: ex_source_dim, ex_source_zero, ex_source_rho, ex_source_M, ex_source_N, ex_source_quality | Concrete ideal full-string source state and POVMs. The source state and its two POVMs are |
| Definition ex_source_dim : nat := ((2 ^ nn) * 1 * (2 ^ nn)) % N. | |
| Definition ex_source_zero : 'I_ex_source_dim. | |
| Definition ex_source_rho : 'M[C]_ex_source_dim := delta.mx ex_source_zero ex_source_zero. | |
| Definition ex_source_M : 'I_(2 ^ nn) -> 'M[C]_(2 ^ nn) := @x_projective_povm R nn. | with the overlap certificate at . |
| Definition ex_source_N : 'I_(2 ^ nn) -> 'M[C]_(2 ^ nn) := @std_projective_povm R (2 ^ nn). | |
| Definition ex_source_quality : (bb84_n Pex) %: R * (1 : R) <= q_of.mx ex_source_M ex_source_N. | |
| The projective POVMs and overlap functional are expanded in Table VI. The shared operands nn and Pex are expanded in Table VI. |
Source certificate.
Concrete full-string source certificate.
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/example/instantiation.v: ex_source_modelDefinition ex_source_model : bb84_source_model Pex (1 : R).Proof.refine (@BB84SourceModel R Pex 1(2 ^ nn) %N 1%N (2 ^ nn) %N (2 ^ nn) %N (2 ^ nn) %N ex_source_rho ex_source_M ex_source_N ____ ____ ____ ).- apply/denlmxP; split.+ exact: delta.mx_ii_psdmx.+ by rewrite tr_delta.mx_ii.- exact: x_projective_povm_is_povm.- exact: std_projective_povm_is_povm.- exact: ex_source_quality.- by [].- by []].Defined.The target record is expanded in Table VI; its state, POVMs, and quality witness are expanded in Table VI. The constructor body displays every semantic field and certificate. | Certified source record. The record uses dimensions , carries the quality at , and identifies its -outcome and /Bob dimensions with . |
Round interface.
| Concrete preparation and measurement operands. | Mathematical reading |
|---|---|
| Formal statement | Concrete preparation and measurement interface. The per-round qubit interface is |
| The source adapters certify dimensions , a nonzero Bob register, and the standard- overlap lower bound . |
Definition ex_source_dim_A :
bb84_src_na ex_source_model = (2 ^ bb84_n Pex) %N.
Definition ex_source_dim_X :
bb84_src_nx ex_source_model = (2 ^ bb84_n Pex) %N.
Definition ex_source_nb_pos : (0 < bb84_src_nb
← ex_source_model) %N.
Definition ex_source_overlap_standard_z :
(bb84_n Pex) %:R * (1 : R) <= q_of.mx
(bb84_source_x_povm ex_source_dim_A ex_source_dim_X)
(@std_projective_povm R (2 ^ bb84_n Pex)).
The concrete source and generic device record are expanded in Table VI; the standard projectors are expanded in Table VI.
Entangled source
Coherent pair and preparation pointer.
| Formal statement | Mathematical reading |
|---|---|
| src/qkd/example/instantiation.v: ex_bb84_x_prep_ket, ex_bb84_x_prep_ket_norm, ex_bb84_x_prep_ket_rho, ex_bb84_x_prep_ket_z_superposition, ex_bb84_x_prep_ket_z_rho, ex_bb84_pure_pair, ex_bb84_pure_pair_den1, ex_prep_ptr, ex_prep_ptr_complete, ex_cd_meas_Z | Coherent BB84 pair and Alice’s pointer. Writing , the EB pair is the canonical purification of , . Alice’s pointer uses computational projectors in the branch and Hadamard-conjugated projectors in the branch. |
| Definition ex_bb84_x_prep_ket (bit : bool) : 'cV[C]_2 := (@hadamard.mx2 R)^*t *m delta.mx (ex_bit_ord bit) (0 : 'I_1).Lemma ex_bb84_x_prep_ket_norm (bit : bool) : (ex_bb84_x_prep_ket bit)^*t *m ex_bb84_x_prep_ket bit = 1\%:M.Lemma ex_bb84_x_prep_ket_rho (bit : bool) : cd_rho ex_device BasisX bit = ex_bb84_x_prep_ket bit *m (ex_bb84_x_prep_ket bit)^*t.Lemma ex_bb84_x_prep_ket_z_superposition (zbit : bool) : ((((Num.sqrt (2\%:R))^-1)\%R)\%:C) *: (ex_bb84_x_prep_ket false + bb84_eb_z_sign R zbit *: ex_bb84_x_prep_ket true) = delta.mx (ex_bit_ord zbit) (0 : 'I_1).Lemma ex_bb84_x_prep_ket_z_rho (zbit : bool) : cd_rho ex_device BasisZ zbit = ((2\%:R)^-1)\%:C *: ((ex_bb84_x_prep_ket false + bb84_eb_z_sign R zbit *: ex_bb84_x_prep_ket true) *m (ex_bb84_x_prep_ket false + bb84_eb_z_sign R zbit *: ex_bb84_x_prep_ket true)^*t).Definition ex_bb84_pure_pair : 'M[C]_(4 * 2) := bb84_eb_pair_of_pure (ex_bb84_x_prep_ket false) (ex_bb84_x_prep_ket true).Lemma ex_bb84_pure_pair_den1 : ex_bb84_pure_pair \is denlmx.Definition ex_prep_ptr (basis : bb84_basis) (b : bool) : 'M[C]_4 ↔ := match basis with | BasisX => bitlift.mx bb84_src_ptr_slot (delta.mx (bito b) (bito b)) | BasisZ => bitlift.mx bb84_src_ptr_slot (hadamard.mx2 *m delta.mx (bito b) (bito b) *m ↔ hadamard.mx2^*t) end.Lemma ex_prep_ptr_complete (basis : bb84_basis) : (ex_prep_ptr basis false)^*t *m ex_prep_ptr basis false + (ex_prep_ptr basis true)^*t *m ex_prep_ptr basis true = 1\%:M.Lemma ex_cd_meas_Z (b : bool) : cd_meas ex_device BasisZ (Some b) = delta.mx (ex_bit_ord b) (ex_bit_ord b).The standard projectors, coherent-pair constructor, and pointer lift are expanded in Table VI. | |
2 ) Classical Components: Field hashing
Concrete reconciliation and hash operands.
| Formal statement | Mathematical reading |
|---|---|
| src/lhl/construction.v: binary_field_dim, binary_field_coord_project, binary_field_coord_output_card; src/qkd/example/instantiation.v: ex_ir_bits, ex_ir_pub, ex_ir_dec, ex_ir_leak, ex_hash_field_sig, ex_hash_K, ex_hash_char2, ex_hash_card, ex_hash_dim_nn, ex_field_of_ord, ex_field_of_ord_bij, ex_ord_of_bits, ex_ord_of_bits_bij, ex_field_hash, ex_field_hash_two_univ, ex_verify_seed_count, ex_tag_count, ex_verify_hash, ex_verify_hash_two_univ, ex_pa_seed_count, ex_pa_hash, ex_pa_hash_two_univDefinition ex_ir_bits : nat := 0. | Zero-bit reconciliation and the two concrete field hashes. The instance uses , , . Let , let , and let retain the first binary coordinates. For , . |
The verification family has seeds and tags; the PA family has seeds and outputs. Both are two-universal.
Definition ex_ir_pub ( _ _ : 'I_(2 ^ nn) ) : 'I_(2 ^ ex_ir_bits) := → ord0. Definition ex_ir_dec ( _ : 'I_(2 ^ ex_ir_bits) ) (xb : 'I_(2 ^ nn) ) → := xb. Definition ex_ir_leak : (ex_ir_bits) %:R <= bb84_leak_EC Pex.
Definition binary_field_dim : nat := \dim { : K : vectType 'F_2}. Definition binary_field_coord_project (ell : nat) (Hell : (ell <= binary_field_dim) %N) (x : K) : 'rV['F_2']_ell → := \row_i coord (vbasis { : K}) (widen_ord Hell i) x. Lemma binary_field_coord_output_card (ell : nat) : #| 'rV['F_2']_ell| = (2 ^ ell) %N.
Definition ex_hash_field_sig : {K0 : finFieldType | 2 \in [pchar K0] & #|K0| = (2 ^ nn) %N}. Definition ex_hash_K : finFieldType := s2val ex_hash_field_sig. Definition ex_hash_char2 : 2 \in [pchar ex_hash_K] := s2valP ex_hash_field_sig. Definition ex_hash_card : #|ex_hash_K| = (2 ^ nn) %N := s2valP' ex_hash_field_sig. Local Notation ex_hash_F := (pPrimeCharType ex_hash_char2). Lemma ex_hash_dim_nn : binary_field_dim ex_hash_char2 = nn. Lemma ex_hash_F_card : #|ex_hash_F| = (2 ^ nn) %N. Definition ex_field_of_ord (x : 'I_(2 ^ nn) ) : ex_hash_F := enum_val (cast_ord (esym ex_hash_F_card) x). Lemma ex_field_of_ord_bij : bijective ex_field_of_ord. Definition ex_ord_of_bits (l : nat) (z : 'rV['Z_2']l) : 'I(2 ^ → l) := cast_ord (binary_field_coord_output_card l) (enum_rank z). Lemma ex_ord_of_bits_bij (l : nat) : bijective (@ex_ord_of_bits → l). Definition ex_field_hash (l : nat) (Hl : (l <= binary_field_dim ex_hash_char2) %N) (i x : 'I_(2 ^ nn) ) : 'I_(2 ^ l) := ex_ord_of_bits (field_mult_project_hash (binary_field_coord_project Hl) (ex_field_of_ord i) (ex_field_of_ord x)). Lemma ex_field_hash_two_univ (l : nat) (Hl : (l <= binary_field_dim ex_hash_char2) %N) : @two_univ R _ _ _ (ex_field_hash Hl).
Concrete reconciliation and hash operands (continued).
Formal statement
Mathematical reading
src/qkd/example/instantiation.v: ex_verify_seed_count, ex_tag_count, ex_verify_hash, ex_verify_hash_two_univ, ex_pa_seed_count, ex_pa_hash, ex_pa_hash_two_univ
Definition ex_verify_seed_count : nat := (2 ^ nn) %N. Definition ex_tag_count : nat := 2 ^ ex_tag_bits. Lemma ex_tag_bits_le_dim : (ex_tag_bits <= binary_field_dim ex_hash_char2) %N. Definition ex_verify_hash : 'I_ex_verify_seed_count -> 'I_(2 ^ nn) -> 'I_(2 ^ → ex_tag_bits) := ex_field_hash ex_tag_bits_le_dim. Definition ex_verify_seed_pos : (0 < ex_verify_seed_count) %N. Definition ex_tag_pos : (0 < ex_tag_count) %N. Definition ex_tag_le : ((ex_tag_count%:R : R)^-1 <= bb84_eps_c → Pex) %R. Definition ex_tag_bits_bound : log2 (ex_tag_count%:R : R) <= log2 (2%:R / bb84_eps_c Pex). Definition ex_verify_hash_two_univ : @two_univ R _ _ _ ex_verify_hash.
Definition ex_pa_seed_count : nat := (2 ^ nn) %N. Lemma exlen_le_dim : (exlen <= binary_field_dim ex_hash_char2) %N. Definition ex_pa_hash : 'I_ex_pa_seed_count -> 'I_(2 ^ nn) -> 'I_(2 ^ exlen) := ex_field_hash exlen_le_dim. Definition ex_pa_seed_pos : (0 < ex_pa_seed_count) %N. Definition ex_pa_hash_two_univ : @two_univ R _ _ _ ex_pa_hash.
The multiplication family and transport theorem are expanded in Table VI; the generic two-universal predicate in Table VI. The dependent finite-field witness, coordinate basis, ordinal casts, and their bijectivity proofs are displayed here because the two concrete maps use them. The numeric operands nn, Pex, ex_tag_bits, and exlen are expanded in Table VI; the shared log2 dependency is expanded in Table VI.
3 ) Device Package: Certified package
Concrete device packaging and witness adversary.
Formal statement
src/qkd/example/instantiation.v: ex_device_of, ex_device, ex_bb84_z_readout, ex_bb84_ptr_standard, ex_bb84_pure_xz_source, ex_source_x_povm, ex_device_projective_xz, ex_identity_adversary
Definition ex_device_of (entangled : bool) : bb84_certified_device Pex (1 : R).
Proof.
refine (@BB84CertifiedDevice R Pex 1 ex_source_model ex_source_dim_A ex_source_dim_X → ex_source_nb_pos ex_source_overlap_standard_z ex_prepare_state ex_prepare_state_den1 ex_measurement_operator ex_measurement_complete → ex_detect_basis_indep entangled ex_bb84_pure_pair ex_bb84_pure_pair_den1 ex_prep_ptr ex_prep_ptr_complete ex_ir_bits ex_ir_pub ex_ir_dec ex_ir_leak ex_verify_seed_count ex_verify_seed_pos ex_tag_count ex_verify_hash ex_verify_hash_two_univ ex_tag_pos ex_tag_le ex_tag_bits_bound ex_pa_seed_count ex_pa_seed_pos ex_pa_hash → ex_pa_hash_two_univ).
Defined.
Definition ex_device : bb84_certified_device Pex (1 : R) := ex_device_of false.
Lemma ex_bb84_z_readout : @bb84_projective_z_readout R Pex 1 → ex_device.
Proof.
move=> b.
have Hbo : ex_bit_ord b = bito b by apply/val_inj; case: b. by rewrite ex_cd_meas_Z Hbo (@bb84_M_click_sqrt_lossless R Pex 1 ex_device (ltac: (by → []))) mulmx1.
Qed.
Lemma ex_bb84_ptr_standard : @bb84_eb_ptr_standard R Pex 1 → ex_device.
Definition ex_bb84_pure_xz_source : @bb84_pure_xz_source R Pex 1 ex_device := @BB84PureXZSource R Pex 1 ex_device ex_bb84_x_prep_ket ex_bb84_x_prep_ket_norm ex_bb84_x_prep_ket_rho ex_bb84_x_prep_ket_z_rho.
Lemma ex_source_x_povm (x : 'I_(2 ^ bb84_n Pex)) : @bb84_source_x_povm R Pex 1 (@cd_src R Pex 1 ex_device) (@cd_src_dim_A R Pex 1 ex_device) (@cd_src_dim_X R Pex 1 ex_device) x = @x_projective_povm R (bb84_n Pex) x.
Definition ex_device_projective_xz : @bb84_projective_xz_device R Pex 1 ex_device := @BB84ProjectiveXZDevice R Pex 1 ex_device ex_bb84_pure_xz_source ex_bb84_z_readout ex_bb84_ptr_standard (ltac: (by [])) ex_source_x_povm.
Definition ex_identity_adversary : @adversary R L HL V Eve := fun Q _ => let QE := Q : |: Eve in QChannel_Build (@idso_qc R (@hstensor.Hs R L HL QE)).
Every certified-device constructor operand is expanded in Table VI; the target record and structural class in Table VI, and the adversary interface in Table VI. The protocol operand Pex is expanded in Table VI. QChannel_Build, idso_qc, and labelled-space construction are CoqQ representation primitives.
Mathematical reading
The record instance and positive-pass adversary. The shipped device is the prepare-and-measure specialization
dev = CertifiedDevice( ρ_src, M, N, ρ, K, ρ_pair, P, IR, h^{(34)}, h^{(2000)}), entangled = false.
Together with the coherent source and pointer above, it carries the projective-X/Z certificate
The liveness witness uses the identity attack on the attacked registers and Eve's register:
.
- Run Witness: Concrete history.
Concrete device and positive-pass witness.
Formal statement
src/qkd/example/instantiation.v: ex_initial_store, ex_initial_lf, ex_initial_state, ex_initial_state_cq_wf, ex_key_sample_set, ex_test_set, ex_pass_choice, ex_pass_trace, ex_vseed0, ex_paseed0, ex_key_sample_value, ex_vseed_value, ex_paseed_value, ex_reach_trace, ex_reach_key, ex_reach_vseed, ex_reach_paseed, ex_reach_history
Definition ex_initial_store : store := [ffun _ => bb84_bot_val]. Definition ex_initial_lf : 'F[HL]_setT := (( (dim 'H[HL]setT) % : R) ^ -1) % : C * : (\1%VF : 'F[HL]setT). Definition ex_initial_state : state := cq_single ex_initial_store ex_initial_lf. Lemma ex_initial_state_cq_wf : cq_wf ex_initial_state. Definition ex_key_sample_set : {set 'I_M} := [set i : 'I_M | (nat_of_ord i < nn) %N]. Definition ex_test_set : {set 'I_M} := [set i : 'I_M | (nn <= nat_of_ord i < nn + nn) %N]. Local Definition ex_pass_choice (i : 'I_M) : round_choice := if i \in ex_test_set then ((bb84_basis_bool_val true, bb84_bit_val false), (bb84_basis_bool_val true, bb84_outcome_val (Some false))) else if i \in ex_key_sample_set then ((bb84_basis_bool_val false, bb84_bit_val false), (bb84_basis_bool_val false, bb84_outcome_val (Some false))) else ((bb84_basis_bool_val false, bb84_bit_val false), (bb84_basis_bool_val true, bb84_outcome_val (Some false))). Local Definition ex_pass_trace : round_trace := [ffun i => ex_pass_choice i]. Definition ex_vseed0 : 'I(cd_vseed_count ex_device) := Ordinal (cd_vseed_pos ex_device). Definition ex_paseed0 : 'I(cd_paseed_count ex_device) := Ordinal (cd_paseed_pos ex_device). Definition ex_key_sample_value : V := bb84_set_val → ex_key_sample_set. Definition ex_vseed_value : V := bb84_vseed_val (Some ex_vseed0). Definition ex_paseed_value : V := bb84_paseed_val (Some → ex_paseed0). Definition ex_reach_trace : round_trace := ex_pass_trace. Definition ex_reach_key : V := ex_key_sample_value. Definition ex_reach_vseed : V := ex_vseed_value. Definition ex_reach_paseed : V := ex_paseed_value. Definition ex_reach_history : run_history := (ex_reach_trace, ((ex_reach_key, ex_reach_vseed), → ex_reach_paseed)). The concrete certificate and structural-class package is expanded in Table VI; the history shape is expanded in Table VI; store in Table VI; cq_single/cq_wf in Table VI; and nn in Table VI.
Mathematical reading
Certified ideal device and an error-free detected history. The concrete certificate fixes and the prepare-and-measure source flag, then proves membership in the projective class. For liveness, the first rounds form the key set, the next form the test set, every selected round is detected with bit 0, and valid verification/PA seeds are chosen. The singleton initial cq-state is maximally mixed on the quantum registers and is well formed.
Reachability.
Reusable positive-pass reachability theorem.
Formal statement
src/qkd/example/run.v: run_pass_prob_reachable Lemma run_pass_prob_reachable (qA : {set L}) (EA : @adversary R L HL V qA) (xi : @cq_state R L HL Cv V) (h0 : @run_history V M) (s0 : store) : (forall s, xi s \is psdlf) -> (forall (i : 'I_M) (a y : V), dev_rho i a y \is psdlf) -> (0 < M) %N -> 0 <= Qtol -> (forall p y, idec p y = y) -> 0 < @complex.Re R (\Tr (hist_so empty_transcript dev_rho dev_meas EA h0 (xi → s0))) -> (forall i : 'I_M, choice_y' (h0.1 i) != outEmpty) -> (n <= #|@trace_key_set V M basisX outEmpty h0.1|) %N ->
Mathematical reading
Reachable history implies positive pass mass. For a history with positive quantum trace, detected rounds, sufficiently large key and test sets, zero selected bits, and positive round/subset/seed weights,
\land \text{reachable_positive}(h_0) \implies p_{\text{pass}} > 0.
This theorem is generic in the adversary and run operands; the concrete identity-adversary witness discharges its premises separately.
(k <= #|@trace_test_set V M basisZ outEmpty h0.1|)%N -> (forall i : 'I_M, vread (choice_y (h0.1 i)) = Some false) -> (forall i : 'I_M, vread (choice_y' (h0.1 i)) = Some false) -> (forall (i : 'I_M) (s : store), 0 < round_choice_weight R n k basisX basisZ vbit (h0.1 i) s) -> 0 < unif_nsubset_mass n (@trace_key_set V M basisX outEmpty h0.1) h0.2.1.1 -> (forall s : store, 0 < unif_vseed s h0.2.1.2) -> (forall s : store, 0 < unif_pseed s h0.2.2) -> 0 < run_pass_prob abortv vbool (@bb84_eval_scheme R L HL Cv V n k l leakEC M Qtol a_y_b_y'_d_Q Xv Zv Kv XA XB ZA ZB lamv pECv Xhatv gv tAv tBv fv Sv Shv abortv Pvar basisX basisZ outEmpty bot empty_transcript vbool vbit vset vset_of vrat dev_rho dev_meas Qsrc dev_pair dev_ptr tr_app_rounds tr_app_pe tr_app_ec → tr_app_pa bits_on test_bits_on err_count err_of unif_nsubset_mass ir_pub ir_dec unif_vseed verify_hash unif_pseed → privacy_hash qA EA xi).
The run probability, evaluator, history selectors, and witness history are expanded in Table VI.
5 ) Result: Concrete parameters
Concrete numeric key-length witness.
Formal statement
src/qkd/example/instantiation.v: nn, exlen, ex_round_limit, ex_tag_bits, ex_ec_bits, ex_eps_c, ex_eps, ex_ebar, ex_eps_s, ex_leak_EC, Pex, ex_key_length_ub_ge2625, ex_key_length_sup
Definition nn : nat := 10 ^ 4.
Definition exlen : nat := 2000.
Definition ex_round_limit : nat := 100 * (nn + nn).
Definition ex_tag_bits : nat := 34.
Definition ex_ec_bits : nat := 1024.
Definition ex_eps_c : R := ((2 ^ ex_tag_bits) % : R) ^ -1.
Definition ex_eps : R := ex_eps_c.
Definition ex_ebar : R := ex_eps_c.
Definition ex_eps_s : R := ex_eps_c * + 2.
Definition ex_leak_EC : R := ex_ec_bits % : R.
Definition Pex : @bb84_protocol R :=
@BB84Protocol R nn nn ex_round_limit exlen
(100% : R) ^ -1 ex_eps_c ex_leak_EC.
Lemma ex_key_length_ub_ge2625 :
(2625% : R : R) <= bb84_key_length_ub
(bb84_n Pex) (bb84_k Pex) (1 : R) (bb84_Qtol Pex)
ex_eps ex_ebar (bb84_leak_EC Pex) (bb84_eps_c Pex).
Lemma ex_key_length_sup (ec : R) (Hec_pos : 0 < ec)
(Htag_le : ((cd_tag_count ex_device) % : R : R) ^ -1 <= ec) % R) :
(bb84_l Pex) % : R <=
sup (fun m : R =>
exists eps ebar : R,
0 < eps / \ eps < 1 / \ 0 < ebar / \ eps + ebar <= ex_eps_s
→ /
m = ((floor (bb84_key_length_ub (bb84_n Pex) (bb84_k Pex)
(1 : R) (bb84_Qtol Pex) eps ebar (bb84_leak_EC Pex)
ec)) % : ~R : R)).
The bb84_protocol record used by Pex and the key-length functional are expanded in Table VI; the concrete ex_device operand in the optimized witness is expanded in Table VI.
Mathematical reading
Concrete BB84 parameters and optimized key length. For q = 1, n = k = 10^4, Q_tol = 10^−2, leak_EC = 1024, ε = ε̄ = ε_c = 2^−34, ε_s = 2^−33,
The fixed round budget is M = 100(n + k) = 2,000,000. The certified instance has ℓ = 2000. The checked fixed-parameter expression is at least 2625, and its optimized witness proves the 2000-bit key-length premise for each admissible e_c.
Security theorem.
Concrete security and liveness export.
Formal statement
src/qkd/example/instantiation.v: bb84_secure_example
Theorem bb84_secure_example (entangled : bool) : 0 < @run_pass_prob R L HL (bb84_cvar M) V (@BVabort M) → bb84_bool_val (@bb84_eval_mode R (Pex R) 1 (ex_device R) LE HE entangled (ex_identity_adversary HE) (ex_initial_state HE))
/
(forall (EA : @adversary R L HL V Eve) (xi_init : state),
cq_wf xi_init ->
let xi_out := @bb84_eval_mode R (Pex R) 1 (ex_device R) LE HE
entangled EA xi_init in
let p_abort :=
@run_abort_prob R L HL (bb84_cvar M) V (@BVabort M)
bb84_bool_val xi_out in
let p_pass :=
@run_pass_prob R L HL (bb84_cvar M) V (@BVabort M)
bb84_bool_val xi_out in
let p_mismatch :=
@run_output_mismatch_prob R L HL (bb84_cvar M) V
(@BVS M) (@BVSh M) (@BVabort M) bb84_bool_val xi_out in
[\ (forall (h : @run_history V M) (s : store),
@bb84_branch_shape R (Pex R) 1 (ex_device R) h s),
p_abort + p_pass = 1
& @eps_secure R L HL Zl (F1 : |: (Ereg : |: Ppub))
p_mismatch (bb84_eps_c (Pex R))
(@rhoZFEpub_eval_mode R (Pex R) 1 (ex_device R) LE HE
entangled EA xi_init)
(ex_eps_s R) p_abort
(bb84_eps_c (Pex R) + ex_eps_s R)]).
Remark. bb84_secure_example combines the fixed positive-pass witness with security for every adversary and well-formed initial state. The positive-pass conjunct uses ex_identity_adversary and ex_initial_state, whose well-formedness is proved by ex_initial_state_cq_wf. Its proof constructs ex_reach_history and discharges the generic run_pass_prob_reachable premises inline, while ex_key_length_sup supplies the optimized 2000-bit numeric witness. The numeric parameters and key-length witness are expanded in Table VI; the device and class certificate in Table VI; the concrete initial state and history construction in Table VI; and the generic positive-pass theorem in Table VI. The theorem uses the protocol's fixed bb84_eps_c (Pex R), while ex_device supplies ex_tag_le and ex_tag_bits_bound.
Mathematical reading
Concrete BB84 instance and reachability (Theorem 11). For each source mode and the fixed parameters in Table VI,
and, for every and well-formed ,
Secure \rho_{\mathrm{ZFE}_{\mathrm{pub}}}^b, 2^{-33}, p_{\mathrm{abort}}^b, 3 \cdot 2^{-34}\right).
Here is the normalized accepted readout from the mode- evaluator.