Simple and Rigorous Proof Method for the Security of Practical Quantum Key Distribution in the Single-Qubit Regime Using Mismatched Basis Measurements

Quantum key distribution (QKD) protocols aim at allowing two parties to generate a secret shared key. While many QKD protocols have been proven unconditionally secure in theory, practical security analyses of experimental QKD implementations typically do not take into account all possible loopholes, and practical devices are still not fully characterized for obtaining tight and realistic key rates. We present a simple method of computing secure key rates for any practical implementation of discrete-variable QKD (which can also apply to measurement-device-independent QKD), initially in the single-qubit lossless regime, and we rigorously prove its unconditional security against any possible attack. We hope our method becomes one of the standard tools used for analysing, benchmarking, and standardizing all practical realizations of QKD.


Introduction
The purpose of quantum key distribution (QKD) is to allow two legitimate parties, typically named Alice and Bob, to generate an information-theoretically secure key [1]. Most QKD protocols have been proven secure even if the adversary Eve is allowed to apply any theoretical attack allowed by the laws of quantum theory. However, despite enormous progress in recent years, unconditional security of practical implementations of QKD has remained elusive.
The difficulty of achieving practical security stems from the fact that practical implementations deviate from the theoretical protocols in many important aspects. The theoretical models of the preparation devices, the transmitted quantum systems, the quantum channels, and the measurement devices differ enormously from any experimental realization, and these differences open up loopholes and weaknesses that Eve may be able to exploit (see, e.g., [2,3]).
Most security weaknesses of the measurement devices can be closed using measurement-deviceindependent (MDI) QKD [4][5][6][7]. However, MDI QKD still requires us to trust the preparation devices of Alice and Bob, and deviations of the actually prepared quantum states from the theoretical states still pose a significant security threat. Alternatively, in (fully) device-independent (DI) QKD [8][9][10], Alice's and Bob's devices are completely uncharacterized, and violations of Bell's inequality prove the secrecy of the final key. This method, while promising and theoretically solid, still achieves far worse secret key rates than standard QKD (including MDI QKD) in realistic experimental settings [11][12][13]; in addition, it still requires assumptions, including the assumption that Alice's and Bob's uncharacterized devices are never allowed to communicate with each other or with Eve. Therefore, while we believe that both DI QKD and standard (especially MDI) QKD are important directions that can lead to practical security (perhaps in different levels of security), in this paper, we focus on standard and MDI QKD protocols, where the most pressing practical security problem that has no fully available solution is imperfectly generated quantum states.
We suggest a simple and systematic method for analysing source imperfections and proving unconditional security of a large variety of QKD protocols. Our method (similarly to the "loss tolerant" QKD protocol [14][15][16][17]) assumes that the quantum source can only emit three possible quantum states (instead of the four states used by BB84), and it uses a mismatched-basis analysis (see, e.g., [18]) for deriving the key rate in the finite-key regime. Our analysis method is vastly simplified and rigorous, takes into account many subtle points that are often omitted in other security proofs, and gives an explicit key rate formula in the finite-key regime. We further suggest a practical step-by-step process for analysing experimental implementations of QKD, and we verify that the restriction to three states is indeed essential for practical security.
Our method currently applies only to the qubit regime (in the generalized sense: namely, we require the three emitted quantum states to be linearly dependent and, therefore, lie inside a twodimensional Hilbert subspace), it does not support losses, and it does not support decoy states [19][20][21]. We believe that the analysis of losses and decoy states will work within our framework (see, e.g., [22][23][24]), but we leave their rigorous and precise analysis for future research. We also believe that our analysis can prove security for practical implementations of MDI QKD using the reduction techniques introduced by [4,6], but we leave a detailed analysis of this direction for future research.
In Section 2, we explain how the security of practical implementations of QKD should be rigorously analysed and proved. In Section 3, we fully define the analysed QKD protocol, and in Section 4, we prove its security; our final security result (the key rate) is presented as Corollary 9. In Section 5, we explain why four source states are likely too many (in the qubit and two-basis regime) and why we must restrict our protocol to three states.

2.
Step-by-Step Analysis of Practical Implementations of QKD Nowadays, despite the enormous progress made on practical security analysis, a comprehensive method for proving security is still lacking. In many descriptions of practical implementations of QKD, while the theoretical model suggested for analysis is close to the practical implementation, it is naturally not identical, and the reduction from the practical implementation to the theoretical protocol sometimes uses hand wavy arguments instead of fully rigorous mathematical modelling and analysis.
For rigorously proving the security of a practical implementation in the case of a measurementdevice-independent (MDI) protocol, we suggest the following way: 1.
The implementation should be evaluated and tested. In particular, the emitted quantum states must be repeatedly measured in all aspects, including determining the modes-frequency spectrum (which includes wavelengths and their relative phases), polarization, timing and location of emission, direction of propagation (wave vector), and their degrees of mutual coherence-and performing a full tomography for each mode, thereby discovering the resulting quantum states. Each resulting quantum state (for each basis choice and data choice) must be reconstructed and explicitly written; this reconstruction is essential for the security analysis.

2.
The quantum states must be given as inputs to the security proof. The security proof then gives us a key rate formula and security parameters.

3.
The key rate and security parameters can now be compared to the security definition. The result of this comparison decides whether security of the practical implementation has been proved.
• Three normalized quantum states {|γ 0 ⟩ B i , |γ 1 ⟩ B i , |γ + ⟩ B i } (identical between all rounds i) that can reside in any arbitrary Hilbert space but must be linearly dependent (and, therefore, must span a two-dimensional Hilbert subspace). Specifically, we denote where a, b ∈ C. We require |a| 2 + |b| 2 > 1 2 or, equivalently, Bob's generalized measurement operators for each round i: , which we name "measurement in the standard basis" or "measurement in the z basis", and , which we name "measurement in the conjugate basis" or "measurement in the x basis".
which are defined similarly to [22]. We note that Bob's measurement operators can be arbitrary and are not required to be perfectly implemented or perfectly known. However, they influence the measurement results and the error rate, which influence the protocol's success probability and key rate. • The number m of all rounds (all quantum states sent by Alice to Bob). • The probabilities that Alice chooses each "preparation basis": p A z represents the probability that Alice prepares either |γ 0 ⟩ B i or |γ 1 ⟩ B i (each of which she chooses with an equal probability, p A z 2 ), and p A x represents the probability that Alice prepares |γ + ⟩ B i . We require The probabilities that Bob chooses to measure in each measurement basis: p B z (for choosing to measure in the "z basis") and p B x (for choosing to measure in the "x basis"), respectively, such that The numbers k 1 , k 2 , k 3 , k 4 of TEST bits required for each pair of basis choices of Alice and Bob (Z-Z, Z-X, X-Z, and X-X, respectively, where the first letter (Z or X) represents Alice's basis choice, and the second letter represents Bob's basis choice) and the number n 1 of required INFO bits corresponding to basis choices of Z-Z. We require The error rate threshold δ (maximal allowed noise in TEST-Z-Z and TEST-X-X bits). • The zero rate threshold δ mismatch (maximal allowed rate of "+" or "0" results measured by Bob in TEST-Z-X and TEST-X-Z bits, respectively). • The error correction and privacy amplification parameters described in [22], including, in particular, the final key length ℓ.

2.
Alice randomly chooses a string Φ A ∈ {0, 1} m of basis choices: she chooses each bit independently to have value 0 with probability p A z or value 1 with probability p A x . Bob randomly chooses a string Φ B ∈ {0, 1} m of basis choices: he chooses each bit independently to have value 0 with probability p B z or value 1 with probability p B x . In addition, Alice chooses a uniformly random string R ∈ {0, 1} m of the raw bits she prepares and sends (it is only used for rounds where Alice's basis choice is 0). All strings are kept secret.

3.
For each round i ∈ {1, 2, . . . , m} of the protocol, Alice prepares the state dictated by (Φ A ) i and R i -namely: Alice sends the prepared state to Bob via the quantum channel. Bob measures each obtained state in the basis dictated by (Φ B ) i (the "z basis" if (Φ B ) i = 0, or the "x basis" if (Φ B ) i = 1) and puts the measurement result in the string U ∈ {0, 1} m , which is kept secret.

4.
Bob publicly sends to Alice his basis choice string Φ B .

5.
Alice verifies that the set Σ ≜ {1, 2, . . . , m} includes at least n 1 + k 1 rounds where Alice chose z and Bob chose z (named "Z-Z rounds"), at least k 2 "Z-X rounds", at least k 3 "X-Z rounds", and at least k 4 "X-X rounds". If verified, Alice sets the flag F min = ✓; otherwise, she sets the flag F min = / 0 and aborts the protocol. 6.
Alice randomly chooses four subsets Π 1 , Π 2 , Π 3 , Π 4 ⊆ Σ of test rounds: • |Π 1 | = k 1 is randomly chosen out of all "Z-Z rounds" in Σ, and it consists of k 1 rounds we define as the "TEST-Z-Z rounds"; • |Π 2 | = k 2 is randomly chosen out of all "Z-X rounds" in Σ, and it consists of k 2 rounds we define as the "TEST-Z-X rounds"; • |Π 3 | = k 3 is randomly chosen out of all "X-Z rounds" in Σ, and it consists of k 3 rounds we define as the "TEST-X-Z rounds"; • |Π 4 | = k 4 is randomly chosen out of all "X-X rounds" in Σ, and it consists of k 4 rounds we define as the "TEST-X-X rounds", and one subset Σ 1 ⊆ Σ of information rounds: • |Σ 1 | = n 1 is randomly chosen out of all "Z-Z rounds" in Σ \ Π 1 , and it consists of n 1 rounds we define as the "INFO rounds".
Each one of Alice and Bob produces five substrings of their respective bit strings R,U: • V 1 and W 1 are the substrings corresponding to Π 1 (the TEST-Z-Z rounds) of Alice and Bob, respectively; • V 2 and W 2 are the substrings corresponding to Π 2 (the TEST-Z-X rounds) of Alice and Bob, respectively; • V 3 and W 3 are the substrings corresponding to Π 3 (the TEST-X-Z rounds) of Alice and Bob, respectively; • V 4 and W 4 are the substrings corresponding to Π 4 (the TEST-X-X rounds) of Alice and Bob, respectively; • X 1 and Y 1 are the substrings corresponding to Σ 1 (the INFO rounds) of Alice and Bob, respectively.

8.
Alice sends V 1 ,V 4 to Bob, and Bob compares them to his W 1 ,W 4 and computes the error rates. If the error rate in either the TEST-Z-Z rounds or the TEST-X-X rounds exceeds δ , Bob sets F pe = / 0 and aborts the protocol. In addition, Bob evaluates his bit strings W 2 ,W 3 and computes their zero rates (namely, the percentages of his "+" or "0" measurement results, respectively). If the zero rate in either the TEST-Z-X rounds or the TEST-X-Z rounds exceeds δ mismatch , Bob sets F pe = / 0 and aborts the protocol. If both tests pass, Bob sets F pe = ✓, and the protocol proceeds. 9.
Alice and Bob perform error correction and privacy amplification to their secret INFO bits X 1 ,Y 1 in the standard way for BB84 protocols (described, e.g., in [22]) to obtain their final secret keys. We note that Alice and Bob generate another flag, F ec , and they abort the protocol if F ec = / 0 (see details in [22]); however, if F ec = ✓, the protocol succeeds, and Alice's and Bob's final secret keys are denoted by K A , K B ∈ {0, 1} ℓ , respectively.
We point out that this is a very general protocol in the lossless qubit regime because Alice's emitted states {|γ 0 ⟩ B i , |γ 1 ⟩ B i , |γ + ⟩ B i } can be any states (assuming they are linearly dependent and satisfy |a| 2 + |b| 2 > 1 2 ), even if they lie inside a very general Hilbert space (which may be infinitedimensional or even continuous). Thus, for this security proof to apply, Alice and Bob must first test their devices, perform a full quantum tomography of their emitted states, and input the resulting states |γ 0 ⟩ B i , |γ 1 ⟩ B i , |γ + ⟩ B i to the security proof, as described in Section 2.
Using pure states |γ 0 ⟩ B i , |γ 1 ⟩ B i , |γ + ⟩ B i does not hurt generality because if Alice sends a mixed state, we can always assume that she also sends the purifying system (which Eve intercepts and uses): this assumption is only beneficial to Eve, so it makes our security proof stronger.

Security Proof
Our security proof is a generalized version of the rigorous, mostly self-contained security proof presented by [22] for BB84-based protocols. That security proof uses entropic uncertainty relations to derive a key rate formula in the finite-key regime, showing a reduction from the prepare-and-measure protocol to an entanglement-based protocol. Here, we generalize this approach to apply to our practical protocol (in the qubit regime) described in Section 3.

Equivalent Modified Entanglement-Based Protocol
We begin our security proof by performing a reduction to the following modified entanglementbased protocol. We point out that this protocol does not strictly adhere to standard definitions of "entanglement-based" protocols because it requires Alice to prepare a specific entangled state, measure some portions of it, and send other portions to Bob (which Eve can attack). Therefore, it is similar to prepare-and-measure protocols. Nevertheless, this protocol is entanglement-based in the narrowest sense because it allows Alice to delay her measurements (on some portions of her state) and relies on the resulting entanglement for proving security.
Therefore, we call it a "modified entanglement-based protocol", and it is defined as follows: 1.
Alice and Bob publicly agree on the parameters of the protocol: between all rounds i) that can reside in any arbitrary Hilbert space but must be linearly dependent (and, therefore, must span a two-dimensional Hilbert subspace). Specifically, we denote where a, b ∈ C. We require |a| 2 + |b| 2 > 1 2 or, equivalently, ℜ(a ⋆ b⟨γ 0 |γ 1 ⟩ B i ) < 1 4 . We also denote the following parameter T : (so T > 1 2 , or 2T − 1 > 0), and a resulting fourth quantum state |γ − ⟩ B i : Proof.
two orthonormal quantum states (using the same a, b ∈ C and T as above): leading to two orthonormal measurement bases (representing standard, projective quantum measurements) of Alice for each round i: which we name "the standard basis" or "the z basis", and (b) {|ξ + ⟩ A i , |ξ − ⟩ A i }, which we name "the conjugate basis" or "the x basis".
• Bob's generalized measurement operators for each round i: 1} , which we name "measurement in the standard basis" or "measurement in the z basis", and (b) {M X,t B i } t∈{0,1} , which we name "measurement in the conjugate basis" or "measurement in the x basis".
which are defined similarly to [22]. We note that Bob's measurement operators can be arbitrary and are not required to be perfectly implemented or perfectly known. However, they influence the measurement results and the error rate, which influence the protocol's success probability and key rate. • The number M ′ of all rounds (all quantum states sent by Alice to Bob). • The required number m of rounds where Alice does not tell Bob to discard (see Step 3). • The probabilities that Alice chooses to measure in each measurement basis: p ′A z (for choosing to measure in the "z basis") and p ′A x (for choosing to measure in the "x basis"), respectively, such that p ′A The probabilities that Bob chooses to measure in each measurement basis: p ′B z (for choosing to measure in the "z basis") and p ′B x (for choosing to measure in the "x basis"), respectively, such that p ′B The numbers k 1 , k 2 , k 3 , k 4 of TEST bits required for each pair of basis choices of Alice and Bob (Z-Z, Z-X, X-Z, and X-X, respectively, where the first letter (Z or X) represents Alice's basis choice, and the second letter represents Bob's basis choice) and the number n 1 of required INFO bits corresponding to basis choices of Z-Z. We require The error rate threshold δ (maximal allowed noise in TEST-Z-Z and TEST-X-X bits). • The zero rate threshold δ mismatch (maximal allowed rate of "+" or "0" results measured by Bob in TEST-Z-X and TEST-X-Z bits, respectively). • The error correction and privacy amplification parameters described in [22], including, in particular, the final key length ℓ.

2.
Alice randomly chooses a string Φ A ∈ {0, 1} M ′ of basis choices: she chooses each bit independently to have value 0 with probability p ′A z or value 1 with probability p ′A x . Bob randomly chooses a string Φ B ∈ {0, 1} M ′ of basis choices: he chooses each bit independently to have value 0 with probability p ′B z or value 1 with probability p ′B x . Both strings are kept secret.

3.
For each round i ∈ {1, 2, . . . , M ′ } of the protocol, Alice generates the following entangled state: (this equality between its two representations can be proven algebraically). In other words, Alice generates the state consisting of the M ′ quantum systems A 1 , A 2 , . . . , A M ′ (one system for each round i).
Step 8.) Alice then defines the following bit string D ∈ {0, 1} M ′ : Alice publicly sends to Bob the string D. This means that for each round i, Alice tells Bob (and Eve) whether she obtained the measurement result "ξ − "; however, if she did not obtain the measurement result "ξ − ", she does not expose the measurement result (if any) or the chosen basis. Alice and Bob discard and ignore all rounds where D i = 1, which we name the "discarded rounds". However, for all the "non-discarded rounds" (rounds where D i = 0), Alice sends to Bob the subsystem B i via the quantum channel, which can be attacked by Eve.

4.
Bob publicly sends to Alice his basis choice string Φ B .

5.
Alice denotes the set of rounds that were not discarded by her as Ω ⊆ {1, 2, . . . , M ′ } (namely, Alice verifies that at least m rounds appear in Ω, in which case she sets the flag F sift ′ = ✓ and publishes the set Σ ⊆ Ω consisting of the first m rounds appearing in Ω (which are the first m non-discarded rounds). Otherwise (if fewer than m rounds appear in Ω), Alice sets the flag F sift ′ = / 0 and aborts the protocol. The two next steps are completely identical to Steps 5 and 6 of the original prepare-and-measure protocol described in Section 3: 6.
Alice verifies that Σ includes at least n 1 + k 1 rounds where Alice chose z and Bob chose z (named "Z-Z rounds"), at least k 2 "Z-X rounds", at least k 3 "X-Z rounds", and at least k 4 "X-X rounds". If verified, Alice sets the flag F min = ✓; otherwise, she sets the flag F min = / 0 and aborts the protocol. 7.
Alice randomly chooses four subsets Π 1 , Π 2 , Π 3 , Π 4 ⊆ Σ of test rounds: • |Π 1 | = k 1 is randomly chosen out of all "Z-Z rounds" in Σ, and it consists of k 1 rounds we define as the "TEST-Z-Z rounds"; • |Π 2 | = k 2 is randomly chosen out of all "Z-X rounds" in Σ, and it consists of k 2 rounds we define as the "TEST-Z-X rounds"; • |Π 3 | = k 3 is randomly chosen out of all "X-Z rounds" in Σ, and it consists of k 3 rounds we define as the "TEST-X-Z rounds"; • |Π 4 | = k 4 is randomly chosen out of all "X-X rounds" in Σ, and it consists of k 4 rounds we define as the "TEST-X-X rounds", and one subset Σ 1 ⊆ Σ of information rounds: • |Σ 1 | = n 1 is randomly chosen out of all "Z-Z rounds" in Σ \ Π 1 , and it consists of n 1 rounds we define as the "INFO rounds".
She publicly sends the five disjoint sets Π 1 , She puts all her measurement results (from both this step and Step 3) in the string R ∈ {0, 1} M ′ , which is kept secret.

9.
Bob measures all his non-discarded quantum systems in the bases dictated by Φ B (the "z basis" if (Φ B ) i = 0, or the "x basis" if (Φ B ) i = 1) and puts his measurement results in the string U ∈ {0, 1} M ′ , which is kept secret. The rest of the protocol is completely identical to the last steps of the original prepare-andmeasure protocol described in Section 3 (in its Steps 7-9): 10. Each one of Alice and Bob produces five substrings of their respective bit strings R,U: • V 1 and W 1 are the substrings corresponding to Π 1 (the TEST-Z-Z rounds) of Alice and Bob, respectively; • V 2 and W 2 are the substrings corresponding to Π 2 (the TEST-Z-X rounds) of Alice and Bob, respectively; • V 3 and W 3 are the substrings corresponding to Π 3 (the TEST-X-Z rounds) of Alice and Bob, respectively; • V 4 and W 4 are the substrings corresponding to Π 4 (the TEST-X-X rounds) of Alice and Bob, respectively; • X 1 and Y 1 are the substrings corresponding to Σ 1 (the INFO rounds) of Alice and Bob, respectively.
11. Alice sends V 1 ,V 4 to Bob, and Bob compares them to his W 1 ,W 4 and computes the error rates.
If the error rate in either the TEST-Z-Z rounds or the TEST-X-X rounds exceeds δ , Bob sets F pe = / 0 and aborts the protocol. In addition, Bob evaluates his bit strings W 2 ,W 3 and computes their zero rates (namely, the percentages of his "+" or "0" measurement results, respectively). If the zero rate in either the TEST-Z-X rounds or the TEST-X-Z rounds exceeds δ mismatch , Bob sets F pe = / 0 and aborts the protocol. If both tests pass, Bob sets F pe = ✓, and the protocol proceeds.
12. Alice and Bob perform error correction and privacy amplification to their secret INFO bits X 1 ,Y 1 in the standard way for BB84 protocols (described, e.g., in [22]) to obtain their final secret keys. We note that Alice and Bob generate another flag, F ec , and they abort the protocol if F ec = / 0 (see details in [22]); however, if F ec = ✓, the protocol succeeds, and Alice's and Bob's final secret keys are denoted by K A , K B ∈ {0, 1} ℓ , respectively.
In Subsection 4.2, we prove security of this protocol, and in Subsection 4.3, we prove the reduction to be correct-namely, we prove that security of the above protocol implies security of the original protocol.

Security Proof for the Modified Entanglement-Based Protocol
Our security proof is a generalization of Section 6 of [22] (which proves security of an entanglement-based version of BB84 [1,25,26]), requiring a few modifications of their proof.
The proof of [22] is based on an entropic uncertainty relation which, roughly speaking, links two quantities: the smooth min-entropy of Alice's data conditioned on Eve's data (denoted H ε min (A|E)) and the smooth max-entropy of Alice's data conditioned on Bob's data (denoted H ε max (A|B)). Generally speaking, these entropies are measures of uncertainty: they capture the number of bits in Alice's system A that are unknown to either Eve or Bob, respectively. Intuitively (and imprecisely), the smooth min-entropy H ε min (A|E) describes the number of secret bits that can be extracted from Alice's system A and will be completely secret even from Eve (or from anyone that has Eve's system E), while the smooth max-entropy H ε max (A|B) describes the number of extra information bits that Bob will have to receive from Alice if he wants to have full information on her system A (which is roughly equivalent to asking how much information Alice would need to send to Bob during the error correction procedure).
Roughly speaking, the entropic uncertainty relation used by [22] shows a lower bound on H ε min (A|E) + H ε max (A|B). Then, their proof upper-bounds H ε max (A|B) by bounding the error rate between Alice and Bob using a law of large numbers, which shows it is unlikely that the error rate on TEST bits is less than δ while the error rate on INFO bits is more than δ + ν. (Intuitively, the smoothness parameter ε means that we do not necessarily use the original quantum state given as an input to the entropy, but we may use any quantum state up to distance ε from it. In our case, for example, ε 2 represents the maximal probability that the law of large numbers is violated-namely, the maximal probability that the true error rate in the INFO bits is much higher than the error rate observed in the TEST bits. Using the smooth min-and max-entropy allows us to upper-bound the impact of this unwanted possibility.) The combination of these two results implies a lower bound on H ε min (A|E), and this lower bound immediately gives us the protocol's key rate using the Leftover Hashing Lemma [27] (which intuitively says that roughly H ε min (A|E) bits, known to Alice and completely secret from Eve, can be extracted from Alice's system using a standard procedure of privacy amplification).
We mainly modify the first two parts of [22]'s proof: the entropic uncertainty relation and the use of the law of large numbers. In addition, we need to justify security of our sifting step.

The Sifting Step
The sifting step of our modified entanglement-based protocol does not appear in the entanglementbased protocol of [22]. Therefore, we must prove that it does not hurt security by showing that it keeps Alice's and Bob's basis choice strings Φ A , Φ B independent of the other systems.
Each bit of Φ A , Φ B is chosen independently (with probabilities p ′A z , p ′A x , p ′B z , and p ′B x , respectively). Moreover, the state that Alice generates for each round is as follows: so we observe that if (Φ A ) i = 0 (namely, if Alice chooses the "z basis"), Alice obtains the "0" and "1" results with equal conditional probabilities ( 1 2 ); and if (Φ A ) i = 1 (namely, if Alice chooses the "x basis"), Alice obtains the "ξ + " result with conditional probability 1 2T and obtains the "ξ − " result with conditional probability 2T −1 2T . We conclude the following: To justify the sifting step, we notice that this probabilistic process can equivalently be described as the following two-stage process: 1.
First, for each round i, Alice determines whether round i is discarded (D i = 1) or not (D i = 0). The round is discarded if and only if Alice measures "ξ − "; therefore, Remember that we define Ω ≜ {1 ≤ i ≤ M ′ | D i = 0} as the set of non-discarded rounds.

2.
Then, for each round i in Ω (each non-discarded round), Alice determines the basis: These probabilities are independent between the rounds: namely, the basis is determined independently for each non-discarded round.
Note that this equivalence is only correct with respect to the probability distribution; the above process does not describe a physical process, but a virtual process that cannot be applied in practice and only gives the same probability distribution over Φ A and R. (This point can be counter-intuitive: from a quantum theory's point of view, the choice of discarded and non-discarded rounds obviously depends on the basis chosen for measurement, yet from a probabilistic point of view, the process can be divided to the two above stages and still give us an identical probability distribution. ) We notice that both the flag F sift ′ (which notes whether there are at least m rounds in Ωnamely, whether at least m rounds were not discarded) and the set Σ (which represents the first m rounds in Ω) only depend on stage 1: namely, from the probabilistic point of view, both the passing of the sifting test (F sift ′ ) and the choice of the m relevant rounds (Σ) depend only on the choice of discarded rounds in stage 1, and they are both completely independent of the bases Φ A chosen for the non-discarded rounds in stage 2. The bases of the non-discarded rounds are chosen independently with the predetermined probabilities computed in Equations (18) and (19).
For this reason, in the rest of the analysis, we can treat Φ A and Φ B (more precisely, their restrictions to the m non-discarded rounds in Σ) as completely independent of Eve's attack. In other words, Eve's attack is applied independently of Alice's and Bob's chosen bases (or their actually used bases) because Eve is only given access to the discarding string D which is completely independent of the bases in the non-discarded rounds. This result is crucial for the application of the law of large numbers to hypothetical protocols in Subsubsection 4.2.3.
Furthermore, we notice that our modified entanglement-based protocol actually acts in the following way regarding the choice of bases and TEST and INFO bits inside Σ:

1.
In stage 2 (included in Step 2 of the protocol), Alice and Bob determine the bases of the m non-discarded rounds in Σ, chosen randomly and independently for each round in Σ.

In
Step 6 of the protocol, Alice verifies that Σ has sufficient numbers of rounds corresponding to each pair of bases (namely, at least n 1 + k 1 "Z-Z rounds", at least k 2 "Z-X rounds", at least k 3 "X-Z rounds", and at least k 4 "X-X rounds"). For simplicity, let us denote the "Z-Z rounds" by Σ Z,Z , the "Z-X rounds" by Σ Z,X , the "X-Z rounds" by Σ X,Z , and the "X-X rounds" by Σ X,X ; here, Alice verifies that |Σ Z,Z | ≥ n 1 + k 1 , |Σ Z,X | ≥ k 2 , |Σ X,Z | ≥ k 3 , and |Σ X,X | ≥ k 4 . We condition on passing this verification-namely, we evaluate the conditional probabilities on F min = ✓.

3.
In Step 7 of the protocol, Alice uniformly and randomly chooses the corresponding disjoint subsets Σ 1 , Π 1 ⊆ Σ Z,Z , Π 2 ⊆ Σ Z,X , Π 3 ⊆ Σ X,Z , and Π 4 ⊆ Σ X,X (of sizes n 1 , k 1 , k 2 , k 3 , and k 4 , respectively). This effectively discards the other m − n , because their basis choices and measurement results are completely ignored by the rest of the protocol.
Combining these three steps and conditioning on F min = ✓ (namely, conditioning on passing the verification of the second step), this process is equivalent from the probabilistic point of view to uniformly and randomly choosing five disjoint subsets Σ 1 , Π 1 , Π 2 , Π 3 , Π 4 ⊆ Σ of sizes n 1 , k 1 , k 2 , k 3 , and k 4 , respectively (out of the m-sized set Σ), and letting this uniform choice dictate the choice of measurement probabilities (Z-Z, Z-Z, Z-X, X-Z, and X-X, respectively). This equivalence results from the complete symmetry of the above three steps, which have no dependence whatsoever on the identifying number of each round inside Σ. This observation, too, is crucial for the application of the law of large numbers in Subsubsection 4.2.3.

Entropic Uncertainty Relation
The security proof in [22] uses the uncertainty relation described in Proposition 4 of [22], which is equivalent to Corollary 7.4 of [28]. This uncertainty relation uses the symmetry of the BB84 protocol with respect to the chosen basis of the INFO bits: namely, it uses the property that each INFO bit in BB84 is measured in a uniformly random basis, independently of the TEST bits' results and bases. Since a similar property does not apply to our protocol (because all our INFO bits are measured in the "z basis"), we must use a different uncertainty relation.
Adopting an approach similar to [29], we use Theorem 7.2 of [28] as the generalized entropic uncertainty relation (using slightly different notations compared to [28]): σ ′ satisfy the following inequality (uncertainty relation): where: Proof. Proved in Subsection 7.3.2 of [28] as Theorem 7.2.
The next proposition will give us a similar result to Corollary 5 of [22] (namely, roughly speaking, a lower bound on the sum H ε min (A|E) + H ε max (A|B)), with one important difference: the first term H ε min (A|E) will still refer to the real QKD protocol (the modified entanglement-based protocol described in Subsection 4.1), but the second term H ε max (A|B) will now refer to a hypothetical QKD protocol (still entanglement-based) where both Alice and Bob measure the INFO bits in the conjugate ("x") basis. Formally: Proposition 3. For the modified entanglement-based protocol described in Subsection 4.1, for ε ≥ 0, the state σ X 1 Y 1 VWΠΦ A Φ B F sift ′ F min F pe E held by Alice, Bob, and Eve after Step 11 of the real protocol, and the state σ ′ held by Alice, Bob, and Eve after Step 11 of the hypothetical protocol defined below, it holds that Proof. This proof combines modified versions of the proofs of Corollary 7.4 in Subsection 7.4.2 of [28] and Corollary 5 in Subsection 6.2 of [22].
We choose the measurement operators , the tensor product of n 1 copies of the "z basis") and M 2 = {| j⟩ A ⟨ j| A | j ∈ {ξ + , ξ − } n 1 } (i.e., the tensor product of n 1 copies of the "x basis") and the projective measurement It is easy to verify (see, e.g., [28]) that c P of Theorem 2 is equal to c n 1 , where c was defined in our proposition Then, we apply Theorem 2 to the state after Alice's and Bob's measurements of all TEST bits, before Alice's and Bob's measurements of the INFO bits (here, it is important that our modified entanglement-based protocol delays to its Step 8 all Alice's measurements in the "z basis", which include all measurements of the INFO bits), conditioned on the first two tests passing (F sift ′ = F min = ✓), and requiring the third test to pass (F pe = ✓): (the difference between "conditioning" and "requiring" in this context is analogous to the difference between a "conditional probability" and a "joint probability", respectively; see [22] for the precise definitions) and by choosing the systems P = ΠΦ A Φ B , R = VWE , S = B for Theorem 2, we obtain the following: where X 1 and X ′1 represent the measurement results of Alice's INFO bits in the "z basis" and in the "x basis", respectively. Performing a measurement of Bob's INFO bits in subsystem B in the "x basis" (yielding the bit string Y ′1 ) and discarding the classical information systems, ΠΦ A Φ B are two quantum operations (CPTP) operated exclusively on subsystems BΠΦ A Φ B . According to the data processing inequality (see, e.g., [22,27]), such operations can only increase the max-entropy: which gives us the desired result:

The Law of Large Numbers
Intuitively, the proof of [22] uses a law of large numbers (Lemma 6 of [22]) to upper-bound the max-entropy H ε max (X|Y)-namely, the max-entropy of Alice's raw key conditioned on Bob's raw key in the real protocol. However, in our proof, we need to bound H ε max (X ′1 |Y ′1 )-namely, the max-entropy of Alice's raw key conditioned on Bob's raw key in a hypothetical protocol where Alice and Bob measure the INFO bits in the conjugate ("x") basis. For obtaining this bound, we need to apply the law of large numbers twice to two different hypothetical protocols: 1.
In the X-X hypothetical protocol (where both Alice and Bob measure the INFO bits in the "x basis"), we can compare the TEST-X-X bits (where the only non-discarded rounds are those where Alice measured "ξ + ") to the INFO bits. This way, we can discover the error rate on the "ξ + " bits.

2.
For finding the error rate on the "ξ − " bits, we use the Z-X hypothetical protocol, where Alice measures the INFO bits in the "z basis" while Bob measures them in the "x basis". The following intuitive formula will give us the needed bound: This formula is intuitively trivial because it follows from the following formula: Formally, it follows from the independence of Alice's and Bob's operations, as elaborated in the "bounding the fourth probability" portion of the proof of Proposition 6 below. This idea can be compared with [30]'s analysis of the "loss tolerant" protocol (improving on the usual analysis which involves matrix computations [14][15][16][17]), but their analysis is more complicated and has several free parameters. Here, we present a full and precise analysis, leading to an explicit key rate formula in the single-qubit regime.
Formally, we use the following law of large numbers (Lemma 6 of [22]): Proof. Proved in Subsection 6.3 of [22] as Lemma 6.
We also use another law of large numbers, proved in Section 2 of [31] as Theorem 1: Lemma 5. Let Z 1 , . . . , Z N be independent random variables with finite first and second moments, such that 0 ≤ Z i ≤ 1 for all 1 ≤ i ≤ N. If Z ≜ Z 1 +...+Z N N is their average and µ ≜ E[Z] is the expected value of Z, then for any ν > 0, Using these Lemmas, we prove the following (a modified version of Proposition 8 of [22]): Proposition 6. For the modified entanglement-based protocol described in Subsection 4.1, for the state σ ′ defined in Proposition 3, and for error rate threshold δ and zero rate threshold δ mismatch , if we define for any 0 < ν ≤ 1 2 − δ : then, for any Proof. Let us define the following event: We need to prove the following probability to be exponentially small: Let us remember that V 2 and W 2 are Alice's and Bob's substrings corresponding to Π 2 (the k 2 TEST-Z-X rounds); V 4 and W 4 are Alice's and Bob's substrings corresponding to Π 4 (the k 4 TEST-X-X rounds); and X ′1 and Y ′1 are Alice's and Bob's substrings corresponding to Σ 1 (the n 1 INFO rounds) in the X-X hypothetical protocol-namely, assuming that both Alice and Bob measured the INFO bits in the "x basis" in Steps 8 and 9 of the protocol, respectively. Let us also denote Alice's "ξ + rate" (the percentage of INFO bits which Alice measures as "ξ + ") in the X-X hypothetical protocol by R ′ + -namely, R ′ Thus, the probability Pr F pe = ✓ ∧ Ω 0 | F sift ′ = F min = ✓ is bounded by the sum of four probabilities: We now bound each of these four probabilities: Bounding the first probability: We need to bound where R ′ + is the "ξ + " measurement rate of Alice among the INFO bits in the X-X hypothetical protocol. We notice that this rate is only dictated by identical quantum actions performed by Alice: because Alice measures all INFO bits in the "x basis" in the hypothetical protocol, her measurement results are obtained independently for all rounds and her probability of measuring "ξ + " is always 1 2T . Namely, Alice's measurement results are n 1 independent random variables {Z i } n 1 i=1 (with all probabilities conditioned on F sift ′ = F min = ✓) such that for each i: Therefore, the expected value of each Z i is E[Z i ] = 1 − 1 2T . We can thus apply Lemma 5 (which applies to N independent random variables) to the random variables {Z i } n 1 i=1 with parameters N = n 1 and µ = E[Z] = 1 − 1 2T . We note that Z = 1 − R ′ + . Therefore, we obtain the following result: Bounding the second probability: We need to bound where V 4 and W 4 are Alice's and Bob's substrings corresponding to Π 4 (the k 4 TEST-X-X rounds); X ′1 and Y ′1 are Alice's and Bob's substrings corresponding to Σ 1 (the n 1 INFO rounds) in the X-X hypothetical protocol; and R ′ + is the "ξ + " measurement rate of Alice among the INFO bits in the X-X hypothetical protocol. We notice that the TEST-X-X rounds in Π 4 consist only of rounds where Alice measured "ξ + " (the other rounds are discarded), so her recorded bit must be 0; therefore, the error event V 4 i ̸ = W 4 i is actually equivalent to V 4 i = 0 ∧ W 4 i = 1, and the probability is actually We notice that all rates are evaluated in the X-X hypothetical protocol; that in all rounds, both Alice and Bob measure in the "x basis"; and that in all rounds taken into account, Alice obtains the "ξ + " result. We thus notice that the quantum behaviour of Alice, Bob, and Eve is identical on all these rounds in the X-X hypothetical protocol (in particular, D i = 0 for all these rounds, and while the timing of Alice's measurements may differ between the rounds, this timing is meaningless from the quantum point of view). Therefore, we can apply Lemma 4 using the following parameters: the random variables Z = (Z 1 , Z 2 , . . . , Z N ) represent the condition that Alice's bit is 0 and Bob's bit is 1 (namely, Z i represents the evaluation of the condition V 4 respectively); the sampled subset Π includes the a = k 4 TEST-X-X rounds in the Π 4 subset chosen by the protocol, and the rest Π includes the b = n 1 R ′ + INFO rounds in the Σ 1 subset chosen by the protocol where Alice obtains the "ξ + " measurement result. The sampled susbet Π is completely independent of Bob's measurement results (that are dictated solely by Eve's transmitted states and Alice's results in the "x basis") because we showed in Subsubsection 4.2.1 that Σ 1 and Π 4 can be seen as uniformly and randomly chosen subsets of Σ, conditioning on F sift ′ = F min = ✓.
We remark that this is not a straightforward application of Lemma 4 because the number b = n 1 R ′ + of rounds in Π is a random variable and not a parameter. Therefore, the computation is slightly more complicated because all possible values of R ′ + = r ′ + need to be evaluated. Nevertheless, using the condition R ′ + ≥ 1 2T − ν and applying Lemma 4 for any possible value of R ′ + , we are able to bound this probability and prove it exponentially small.
Using the formulation of Lemma 4, we obtain We can now bound this conditional probability, for each value of j ∈ n 1 · 1 2T − ν , n 1 : where the last inequality results from the fact that j ≥ n 1 · 1 2T − ν . Substituting Equation (45) into Equation (44), we have Bounding the third probability: We need to bound where W 2 is Bob's substring corresponding to Π 2 (the k 2 TEST-Z-X rounds) and Y ′1 is Bob's substring corresponding to Σ 1 (the n 1 INFO rounds) in the X-X hypothetical protocol. Let us now define X ′′1 and Y ′′1 as Alice's and Bob's substrings corresponding to Σ 1 (the n 1 INFO rounds) in the Z-X hypothetical protocol-namely, assuming that Alice measured the INFO bits in the "z basis", and Bob measured the INFO bits in the "x basis". We can notice that Y ′1 is completely identical to Y ′′1 , because Bob's quantum operations (and Eve's attack) are completely independent of Alice's basis choice for the INFO bits (remembering that D i = 0 for all INFO bits-namely, they are never discarded). Therefore, Y ′1 = Y ′′1 , and the probability is = Pr We notice that all rates are evaluated in the Z-X hypothetical protocol; that in all rounds, Bob measures in the "x basis" (and Alice measures in the "z basis"); and that Alice's measurement results are completely unconstrained (namely, no discarding is possible, because D i = 0 for all rounds where Alice measures in the "z basis"). We thus notice that the quantum behaviour of Alice, Bob, and Eve is identical on all these rounds in the Z-X hypothetical protocol. Therefore, we can apply Lemma 4 using the following parameters: the random variables Z = (Z 1 , Z 2 , . . . , Z N ) represent the condition that Bob's bit is 0 (namely, Z i is the value of 1 −W 2 i or 1 −Y ′′1 i , respectively); the sampled subset Π includes the a = k 2 TEST-Z-X rounds in the Π 2 subset chosen by the protocol, and the rest Π includes the b = n 1 INFO rounds in the Σ 1 subset chosen by the protocol (note that Bob measures them in the "x basis"). The sampled susbet Π is completely independent of Bob's measurement results (that are dictated solely by Eve's transmitted states and Alice's non-discarding of the rounds) because we showed in Subsubsection 4.2.1 that Σ 1 and Π 2 can be seen as uniformly and randomly chosen subsets of Σ, conditioning on F sift ′ = F min = ✓. Using the formulation of Lemma 4, we obtain the following: Bounding the fourth probability: We need to bound where X ′1 and Y ′1 are Alice's and Bob's substrings corresponding to Σ 1 (the n 1 INFO rounds) in the X-X hypothetical protocol, and R ′ + is the "ξ + " measurement rate of Alice among the INFO bits in the X-X hypothetical protocol. We prove this probability to be zero; namely, we prove that these four conditions contradict each other and cannot be all true.
Indeed, assume by contradiction that all four conditions hold: We can upper-bound ∑ i } (which represents the total error rate on the INFO bits in the X-X hypothetical protocol) using the first three conditions, as well as the two following definitions: which strictly contradicts the fourth condition. (In the last inequality, we also used the condition ν ≤ 1 2 − δ , which means that 1 − 2δ − 2ν ≥ 0.) Therefore, our probability is 0.

Summary of the proof:
Combining our four bounds, we obtain the following inequality: The rest of the proof is identical to the proof of Proposition 8 in Subsection 6.3 of [22], using our parameters ε(ν), X ′1 ,Y ′1 , n 1 , Ω 0 , δ ′ (ν) and conditioning all probabilities and entropies on F sift ′ = F min = ✓. (A small algebraic difference is that our set Ω 0 requires the strong inequal- while Ω's definition in [22] only requires a weak inequality (1{∑ n i=1 1{X i ̸ = Y i } ≥ n · (δ + ν)}), but the proof still holds.) Therefore, we obtain the following: as we wanted.

Security Theorem for the Modified Entanglement-Based Protocol
Applying the entire proof described in Section 6 of [22] to our modified entanglement-based protocol described in Subsection 4.1, with the modifications described in Subsubsections 4.2.1-4.2.3, yields the following security result: Corollary 7. For the modified entanglement-based protocol described in Subsection 4.1, we denote the final state as ω K A K B SCFE , where K A is the final key generated by Alice and K B is the final key generated by Bob (both consisting of ℓ bits), E is Eve's ancillary quantum system, and S, C, F consist of information published by Alice and Bob (where H ec , H pa , Z, T , F ec , r,t are used in the error correction and privacy amplification steps elaborated in [22]): We also denote ω U ≜ 1 2 ℓ ∑ k∈{0,1} ℓ |k⟩ K A ⟨k| K A ⊗ |k⟩ K B ⟨k| K B (an ideal key: a uniformly random final key, identical for Alice and Bob) and ω SCFE ≜ tr K A K B (ω K A K B SCFE ). It then holds that for any possible attack by Eve, where we define This result is similar to Theorems 2-3 in Section 5 of [22] but has different parameters. According to standard definitions of composable security for QKD (e.g., [27]), this proves security of the modified entanglement-based protocol and gives a tight finite-key rate.

Reduction of the Original Protocol to the Modified Entanglement-Based Protocol
Intuitively, to prove security of our original prepare-and-measure protocol from Section 3, we perform a reduction to the entanglement-based protocol: namely, we show that the modified entanglement-based protocol includes the prepare-and-measure protocol as a special case. More precisely, for any possible attack of Eve on the prepare-and-measure protocol, we need to show that there exists an equivalent attack on the modified entanglement-based protocol leading to the same output for both protocols.
The proof intuitively works as follows: in the prepare-and-measure protocol, instead of generating one of the states {|γ 0 ⟩ B i , |γ 1 ⟩ B i , |γ + ⟩ B i }, Alice can instead generate the following entangled state: where the equality between the two expressions in Equation (65) can be shown algebraically using (k 2 +n 1 )(k 2 +1) ,

Necessity of the Restriction to Three Source States
In our protocol, similarly to the "loss tolerant" protocol [14][15][16][17], only three source states are used. This restriction is necessary in the imperfect-generation regime, as we briefly explain below.
Let us assume that our protocol emits four input states (similarly to BB84), denoted |γ 0 ⟩, |γ 1 ⟩, |γ + ⟩, |γ − ⟩. For standard security analysis to work, the following conditions is required for some 0 < p < 1 and 0 < q < 1: which means that Alice sends to Bob identical mixed states in each round of the protocol, independently of the chosen basis. (Otherwise, Eve may gain information on the basis and attack differently on each basis, which refutes the crucial possibility of comparing her attack's influence on different bases.) For meeting the above condition, we obviously need |γ + ⟩ and |γ − ⟩ to be in the two-dimensional Hilbert subspace spanned by |γ 0 ⟩ and |γ 1 ⟩. Therefore, we require (for some a, b, c, d ∈ C): |γ + ⟩ = a|γ 0 ⟩ + b|γ 1 ⟩ , |γ − ⟩ = c|γ 0 ⟩ + d|γ 1 ⟩.
We thus obtain the following conditions for equality between Equations (83) and (85): q · |b| 2 + (1 − q) · |d| 2 = 1 − p, The two last equations are the complex conjugates of one another, so one of them is sufficient. Therefore, for standard security proofs to work, we require very stringent conditions on a, b, c, d. In particular, according to Equation (89), we require and for q to be real (and satisfy 0 < q < 1), the complex phases of c ⋆ d and a ⋆ b must be opposite (namely, they must differ by ±π, which is equivalent to having opposite signs). This requirement seriously restricts the possible values on |γ 0 ⟩, |γ 1 ⟩, |γ + ⟩, |γ − ⟩. In particular, if we assume (without loss of generality) that a and c are real and non-negative, it requires b and d to have opposite phases. Namely, |γ + ⟩ = |a||γ 0 ⟩ + |b|e iφ |γ 1 ⟩ , |γ − ⟩ = |c||γ 0 ⟩ − |d|e iφ |γ 1 ⟩, where |c| and |d| are dictated by |a| and |b|, respectively (see Equations (86) and (87)). The above analysis means that |γ − ⟩ is, in fact, completely determined by the choice of |γ 0 ⟩, |γ 1 ⟩, |γ + ⟩ (because |c|, |d|, and φ can all be inferred from |γ + ⟩). From a realistic point of view, this means that a four-state protocol measured with two bases could be practically insecure whenever a slight deviation of |γ − ⟩ (or of the states |γ 0 ⟩, |γ 1 ⟩, |γ + ⟩ which determine it) causes the protocol to violate the conditions of Equations (86)-(89). Essentially, this means that in the presence of source imperfections, the use of at most three states (or, alternatively, measurements in three or more bases, which we do not explore here) is required for practical security, and the use of four states could lead to practical security issues.

Conclusions
To sum up, we have found a new way to analyse the security of practical QKD protocols by generalizing the results of [22] to more practical protocols (using a modified entropic uncertainty relation and a refined analysis of finite-key statistics). Our proof, compared with other proofs, is rigorous, careful, and simple, aiming to make it easy-to-use in the lossless qubit regime (its extension to losses and decoy states is left for future research because they present specific hurdles in this analysis regime: in particular, losses would need to be declared by Eve in the modified entanglementbased protocol, which could complicate the analysis). We believe that our suggested tools can contribute to benchmarking and certifying the security of practical implementations of QKD.  Data Availability Statement: No new data were created or analysed in this study. Data sharing is not applicable to this article.