# Qubit-Based Clock Synchronization for QKD Systems Using a Bayesian Approach
## 2 Qubit-Based Synchronization Algorithm
#### Synchronization Probability  
Here we will use the strings of [PERSON] and [PERSON]'s data. A string of [PERSON]'s data consists of the results of each of his detectors at each sampling bin. Typically, [PERSON]'s strings are very sparse because there are many sampling bins in which he registers no detections. A string of [PERSON]'s data consists of her published information at each sampling bin. If the communication time bin width is greater than the sampling time bin width, [PERSON] will have multiple string entries for each state she sends, each corresponding to what she is sending at that part of her duty cycle. Determining the synchronization probability consists of comparing different strings of [PERSON]'s data (starting at different temporal offsets) to strings of [PERSON]'s data and calculating which of [PERSON]'s strings \(D\) is most likely to be the one generated by [PERSON]'s corresponding string. We determine, for a particular string of [PERSON]'s, the probability that it could have been generated by [PERSON]'s published string. Mathematically, we phrase this as the likelihood \(p(D|S)\) of generating [PERSON]'s string \(D\) given the assumption that its generating string is the one [PERSON] has published, denoted by \(S\). The uninformed assumption, which we will denote as \(\tilde{S}\), is that [PERSON]'s string \(D\) has been generated by a random string other than [PERSON]'s published string (from some other portion of [PERSON]'s sent data), with the stipulation that the other string is also periodic. This mathematical framework will consider a subset of [PERSON]'s data of \(N\) sampling bin widths compared against a subset of [PERSON]'s data of \(N+M\) sampling bin widths, meaning there will be \(M\) possible offsets to consider. To begin in our protocol formalism, we note that \(D\) is a string of length \(M+N\) of [PERSON]'s measurements at each sampling bin (including sampling bins where no detectionswere received). Each measurement \(B_{i}\) in [PERSON]'s string consists of the click or no-click results at all of [PERSON]'s detectors. [PERSON]'s string \(D\) can be written as  
\[D=\{B_{1},...,B_{M+N}\}, \tag{2}\]  
which we can rewrite as  
\[D=\{B_{1},D^{\prime}\}, \tag{3}\]  
where  
\[D^{\prime}=\{B_{2},...,B_{M+N}\}. \tag{4}\]  
We prefer to write the likelihood \(p(D|S)\) in terms of known quantities such as the \(p(B_{1}|S)\), the conditional probability of a time bin measurement \(B_{1}\) given \(S\). Using this notation, \(p(D|S)\) is given by  
\[p(D|S)=p(B_{1},D^{\prime}|S)=p(B_{1}|D^{\prime},S)p(D^{\prime}|S), \tag{5}\]  
where the final equality is a result of the product rule. Because we have assumed that \(B_{1}\) is generated from [PERSON]'s string, knowing \(D^{\prime}\) gives us no additional information about \(B_{1}\). At best, it informs us whether \(S\) is true, which is already assumed; the bits are otherwise independent because [PERSON]'s sequence is random. Using these observations, we obtain  
\[p(B_{1}|D^{\prime},S)=p(B_{1}|S), \tag{6}\]  
and, by extension,  
\[p(D|S)=\prod_{i=1}^{N+M}p(B_{i}|S), \tag{7}\]  
allowing us to write the likelihood as the product of the measurement probabilities at each sampling bin. We note that even in the example where [PERSON] only sends one state in the monitoring basis, [PERSON] must still measure both states in each basis to detect potential eavesdropper attacks [5; 6]. For computational ease, we also determine each sampling bin measurement probability as the product of the probabilities of the outcomes at the four different detectors \(b_{\ell}\), which are given by  
\[p(B_{i}|S)=\prod_{\ell=1}^{4}p(b_{\ell}|S) \tag{8}\]  
Again, because the detectors' events are assumed to be generated by independent random processes, these probabilities can be considered independent when the generating string is known. When the generating string is not known (under the uninformed assumption \(\tilde{S}\)), the detection probabilities can be approximated as independent when the received mean photon number is low.