SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
P _ {L} | 0 \rangle^ {\otimes b} = \sum_ {j = 0} ^ {2 ^ {b} - 1} c _ {j} | j \rangle ,
$$
$$
P _ {R} | 0 \rangle^ {\otimes b} = \sum_ {j = 0} ^ {2 ^ {b} - 1} d _ {j} | j \rangle ,
$$
$$
\sum_ {j = 0} ^ {m - 1} \left| \beta c _ {j} ^ {*} d _ {j} - y _ {j} \right| \leq \epsilon
$$
and for  $j \in [2^b]$ ,  $j \geq m$ , we require  $c_j^* d_j = 0$ .
We now state a theorem about linear combination of unitary operators, introduced by Berry et al. [5] and Childs and Wiebe [15]. The following form is from Gilyén et al. [20]. Again we restrict ourselves to the case of real linear combinations.
Theorem D.6 (Linear Combination of Unitaries, Lemma 29 of Gilyén et al. [20]). Let  $\epsilon$  be a positive real number and  $y \in \mathbb{R}^n$  be a vector as in Definition D.5 with  $(\beta, \epsilon_1)$  state preparation pair  $(P_L, P_R)$ . Let  $\{A_j\}_{j=0}^{m-1}$  be a set of linear operators on  $s$  qubits, and for all  $j$ , we have  $U_j$  as an  $(\alpha, \epsilon_2)$ -block-encoding of  $A_j$  acting on  $a + s$  qubits. Let
$$
W = \left(\sum_ {j = 0} ^ {m - 1} | j \rangle \langle j | \otimes U _ {j}\right) + \left(I - \sum_ {j = 0} ^ {m - 1} | j \rangle \langle j |\right) \otimes I _ {a + s},
$$
Then we can implement a  $(\alpha \beta, \alpha \varepsilon_1 + \alpha \beta \varepsilon_2)$ -block-encoding of  $A = \sum_{j=0}^{m-1} y_j A_j$ , with one query from  $P_L^\dagger$ ,  $P_R$ , and  $W$ .
Theorem D.7 (Eigenvalue transformation, Theorem 31 of Gilyén et al. [20]). Suppose  $U$  is an  $(\alpha, \epsilon)$ -block-encoding of an Hermitian operator  $A$ . For every  $\delta > 0$  and real polynomial  $P \in \mathbb{R}[x]$  of degree  $d$  such that  $|P(x)| \leq 1/2$  for all  $x \in [-1,1]$ , there is an efficiently computable quantum circuit  $\tilde{U}$ , which is a  $(1,4d\sqrt{\epsilon/\alpha} + \delta)$ -block-encoding of  $P(A/\alpha)$ , using  $O(d)$  queries to  $U$ .
Finally, for quantum amplitude amplification without knowing the exact value of the amplitude, we need the following theorem:
Theorem D.8 (Quantum amplitude amplification, Theorem 3 of Brassard et al. [9]). Suppose  $U$  is a unitary operator such that
where  $p \in [0,1]$  is unknown and  $|\phi_0\rangle$  and  $|\phi_1\rangle$  are normalized pure quantum states. There is a quantum algorithm that outputs  $|0\rangle_A|\phi_0\rangle_B$  with probability  $\geq 0.99$ , using  $O\big(1 / \sqrt{p}\big)$  queries to  $U$ .
D.2 Main Proof
We generalize Theorem 4.2 as follows.
Theorem D.9. Algorithm 4 will produce  $k$  independent and identical distributed samples from a distribution that is  $\epsilon_{\mathrm{G}}$ -close to  $\mathcal{O}_u^{\mathrm{Gibbs}}$  in total variation distance, in quantum time  $\widetilde{O}\Big(\beta \sqrt{nk}\Big)$ .
It is immediate to show Theorem 4.2 from Theorem D.9 by constructing a  $\beta$ -amplitude-encoding  $V$  of  $\mathbf{A}z$ . To see this, let  $u = \mathbf{A}z$ , then  $u_{i} = (\mathbf{A}z)_{i}\in [0,\beta ]$ . By Theorem D.2, we can implement a unitary operator  $U_{z}^{\mathrm{QRAM}}$  such that
$$
U _ {z} ^ {\mathrm {Q R A M}} \colon | 0 \rangle_ {C} | 0 \rangle_ {B} \mapsto | 0 \rangle_ {C} \sum_ {j \in [ n ]} \sqrt {\frac {z _ {j}}{\beta}} | j \rangle_ {B} + | 1 \rangle_ {C} | \phi \rangle_ {B}.
$$
Using two queries to  $\mathcal{O}_{\mathbf{A}}$ , we can construct a unitary operator  $\mathcal{O}_{\mathbf{A}}^{\prime}$  such that
$$
\mathcal {O} _ {\mathbf {A}} ^ {\prime}: | 0 \rangle_ {E} | i \rangle_ {A} | j \rangle_ {B} \mapsto \left(\sqrt {A _ {i , j}} | 0 \rangle_ {E} + \sqrt {1 - A _ {i , j}} | 1 \rangle_ {E}\right) | i \rangle_ {A} | j \rangle_ {B}.
$$
$$
V = \left(| 0 \rangle_ {C} \langle 0 | \otimes \mathcal {O} _ {\mathbf {A}} ^ {\prime} + | 1 \rangle_ {C} \langle 1 | \otimes I _ {E A B}\right) \left(U _ {z} ^ {\mathrm {Q R A M}} \otimes I _ {E A}\right). \tag {11}
$$
It can be verified (see Proposition D.10) that
$$
\langle 0 | _ {C} \langle 0 | _ {E} V | 0 \rangle_ {C} | 0 \rangle_ {E} | i \rangle_ {A} | 0 \rangle_ {B} = \sum_ {j \in [ n ]} \sqrt {\frac {A _ {i , j} z _ {j}}{\beta}} | i \rangle_ {A} | j \rangle_ {B},
$$
and thus  $\langle 0|_{C}\langle 0|_{E}V|0\rangle_{C}|0\rangle_{E}|i\rangle_{A}|0\rangle_{B} = \sqrt{u_{i} / \beta|i\rangle_{A}|\psi_{i}\rangle_{B}}$  for some  $|\psi_i\rangle$ . Therefore,  $V$  is a  $\beta$ -amplitude-encoding of  $\mathbf{A}z$ .
Now, we will show Theorem D.9 in the following.
Proof of Theorem D.9. Now we start to describe our algorithm. By our consistent quantum amplitude estimation (Theorem C.3), we choose an  $O(r)$ -bit random string  $s$ , then we can obtain a quantum algorithm  $\mathcal{O}_{\hat{u}}$  such that, with probability  $1 - O(\exp(-r))$ , for every  $i \in [n]$ , it computes  $f^{*}(s, u_{i} / \beta)$  with  $\widetilde{O}(\delta^{-1}) \cdot \mathrm{poly}(r)$  queries to  $V$ , where  $f^{*}(s, p)$  is a function that only depends on  $s$  and  $p$ , and it holds that
$$
| f ^ {*} (s, p) - p | \leq \delta
$$
for every  $p \in [-1, 1]$ . Here,  $r, \delta$  are parameters to be determined. Note that
$$
\frac {u _ {i}}{\beta} = | | \langle 0 | _ {C} V | 0 \rangle_ {C} | i \rangle_ {A} | 0 \rangle_ {B} | ^ {2},
$$
so when applying consistent quantum amplitude estimation, we just use a controlled-XOR gate conditioned on the index and with  $A$  the target system, before every query to  $V$ .
By quantum  $k$ -maximum finding algorithm (Theorem D.3), we can find a set  $S \subseteq [n]$  with  $|S| = k$  such that  $f^{*}(s, u_{i} / \beta) \geq f^{*}(s, u_{j} / \beta)$  for every  $i \in S$  and  $j \notin S$  with probability  $0.99 - O\left(\sqrt{nk}\exp (-r)\right)$ , using  $O\left(\sqrt{nk}\right)$  queries to  $\mathcal{O}_{\hat{u}}$ . To obtain a constant probability, it is sufficient to choose  $r = \Theta (\log (n))$ .
For each  $i \in S$ , again applying our consistent quantum amplitude estimation (Theorem C.3), we can obtain the value of  $f^{*}(s, u_{i} / \beta)$  with probability  $1 - O(\exp(-r))$ , using  $\widetilde{O}(\delta^{-1}) \cdot \mathrm{poly}(r)$  queries to  $V$ ; then we set
$$
\hat {u} _ {i} = \beta f ^ {*} \left(s, \frac {u _ {i}}{\beta}\right)
$$
for all  $i \in S$ , with success probability  $1 - O(k\exp (-r))$  and using  $\widetilde{O}\bigl (k\delta^{-1}\bigr)\cdot \mathrm{poly}(r)$  queries to  $V$  in total. It can be seen that  $|\hat{u}_i - u_i| \leq \beta \delta$  for every  $i \in S$ .
Let  $\tilde{u}_i = \hat{u}_i + \beta \delta$ , and then we store  $\tilde{u}_i$  for all  $i \in S$  in the data structure as in Theorem D.2 (which costs  $O(k)$  QRAM operations). Then, we calculate
$$
W = (n - k) \exp (\tilde {u} ^ {*}) + \sum_ {i \in S} \exp (\tilde {u} _ {i})
$$
by classical computation in  $\widetilde{O}(k)$  time, where
$$
\tilde{u}^{*} = \min_{i\in S}\tilde{u}_{i}.
$$
By Theorem D.2, we can prepare the quantum state
$$
\left| u _ {\mathrm {g u e s s}} \right\rangle = \sum_ {i \in S} \sqrt {\frac {\exp (\tilde {u} _ {i})}{W}} | i \rangle + \sum_ {i \notin S} \sqrt {\frac {\exp (\tilde {u} ^ {*})}{W}} | i \rangle
$$
in  $\tilde{O}(1)$  time.
Now we introduce another system  $D$ , and then let
$$
U _ {u} = (V _ {C A B} ^ {\dagger} \otimes I _ {D}) (V _ {D A B} \otimes I _ {C}).
$$
It can be shown (see Proposition D.11) that  $U_{u}$  is a  $(1,0)$ -block-encoding of  $\mathrm{diag}(u) / \beta$ . By QRAM access to  $\tilde{u}_i$ , we can implement a unitary operator
$$
V _ {\tilde {u}} \colon | i \rangle_ {A} | 0 \rangle_ {B} \mapsto | i \rangle_ {A} \left(\sqrt {\frac {\max \{\tilde {u} _ {i} , \tilde {u} ^ {*} \}}{2 \beta}} | 0 \rangle_ {B} + \sqrt {1 - \frac {\max \{\tilde {u} _ {i} , \tilde {u} ^ {*} \}}{2 \beta}} | 1 \rangle_ {B}\right)
$$
in  $\widetilde{O}(1)$  time by noting that  $\max\{\tilde{u}_i, \tilde{u}^*\} = \tilde{u}_i$  if  $i \in S$  and  $\tilde{u}^*$  otherwise. We introduce one-qubit system  $C$ , and let
$$
U _ {\tilde {u}} ^ {\max } = \left(V _ {\tilde {u}} ^ {\dagger} \otimes I _ {C}\right) \left(\mathbf {S W A P} _ {B C} \otimes I _ {A}\right) \left(V _ {\tilde {u}} \otimes I _ {C}\right).
$$
It can be shown that  $U_{\tilde{u}}^{\mathrm{max}}$  is a  $(1,0)$ -block-encoding of  $\mathrm{diag}(\max \{\tilde{u},\tilde{u}^{*}\}) / 2\beta$ . Applying the LCU technique (Theorem D.6), we can obtain a unitary operator  $U^{-}$  that is a  $(1,0)$ -block-encoding of  $\mathrm{diag}(u - \max \{\tilde{u},\tilde{u}^{*}\}) / 4\beta$ , using  $O(1)$  queries to  $U_{u}$  and  $U_{\tilde{u}}^{\mathrm{max}}$ . By the QSVT technique (Theorem D.7 and Lemma 4.1), we can construct a unitary operator  $U^{\mathrm{exp}}$  that is a  $(1,0)$ -block-encoding of  $P_{2\beta}(\mathrm{diag}(u - \max \{\tilde{u},\tilde{u}^{*}\}) / 4\beta)$ , using  $O(\beta \log (\epsilon_P^{-1}))$  queries to  $U^{-}$ , where
$$
\left| P _ {2 \beta} (x) - \frac {1}{4} \exp (2 \beta x) \right| \leq \epsilon_ {P}
$$
for every  $x \in [-1,0]$  and  $\epsilon_{P} \in (0,1/2)$  is to be determined. Suppose  $U^{\mathrm{exp}}$  has an  $a$ -qubit ancilla system, and let  $|\tilde{u}_{\mathrm{post}}\rangle = \langle 0|^{\otimes a}U^{\mathrm{exp}}|u_{\mathrm{guess}}\rangle |0\rangle^{\otimes a}$ . Note that
$$
| \tilde {u} _ {\mathrm {p o s t}} \rangle = \sum_ {i \in S} P _ {2 \beta} \left(\frac {u _ {i} - \tilde {u} _ {i}}{4 \beta}\right) \sqrt {\frac {\exp (\tilde {u} _ {i})}{W}} | i \rangle + \sum_ {i \notin S} P _ {2 \beta} \left(\frac {u _ {i} - \tilde {u} ^ {*}}{4 \beta}\right) \sqrt {\frac {\exp (\tilde {u} ^ {*})}{W}} | i \rangle .
$$
It can be shown (Proposition D.12) that  $||\tilde{u}_{\mathrm{post}}\rangle ||^2 \geq \Theta (k / n)$ ; thus by quantum amplitude amplification (Theorem D.8), we can obtain
$$
\left| \tilde {u} _ {\text {G i b b s}} \right\rangle = \frac {\left| \tilde {u} _ {\text {p o s t}} \right\rangle}{\left\| \left| \tilde {u} _ {\text {p o s t}} \right\rangle \right\|}
$$
using  $O(\sqrt{n / k})$  queries to  $U^{\mathrm{exp}}$ . By measuring  $|\tilde{u}_{\mathrm{Gibbs}}\rangle$  on the computational basis, we return the outcome as a sample from the distribution  $\tilde{u}_{\mathrm{Gibbs}}$ ; it can be shown (Proposition D.13) that the total variation distance between  $\tilde{u}_{\mathrm{Gibbs}}$  and  $\mathcal{O}_u^{\mathrm{Gibbs}}$  is bounded by
$$
d _ {\mathrm {T V}} \left(\tilde {u} _ {\text {G i b b s}}, \mathcal {O} _ {u} ^ {\text {G i b b s}}\right) \leq \sqrt {\frac {8 8 n \epsilon_ {P}}{k \exp (- 2 \beta \delta)}}.
$$
By taking  $\delta = 1 / 2\beta$  and  $\epsilon_{P} = k\epsilon_{\mathrm{G}}^{2} / 300n$ , we can produce one sample from  $\tilde{u}_{\mathrm{Gibbs}}$ , using  $\widetilde{O} (\beta \sqrt{n / k})$  queries to  $U_{u}$  and  $U_{\tilde{u}}^{\max}$ , with  $\widetilde{O} (\beta \sqrt{nk})$ -time precomputation.
Finally, by applying  $k$  times the above procedure (with the precomputation processed only once), we can produce  $k$  independent and identically distributed samples from  $\tilde{u}_{\mathrm{Gibbs}}$  that is  $\epsilon_{\mathrm{Gibbs}}$ -close to the Gibbs distribution  $\mathcal{O}_u^{\mathrm{Gibbs}}$ , with total time complexity
$$
\widetilde {O} \left(\beta \sqrt {n k}\right) + k \cdot \widetilde {O} \left(\beta \sqrt {\frac {n}{k}}\right) = \widetilde {O} \left(\beta \sqrt {n k}\right).
$$
D.3 Technical Lemmas
Proposition D.10. Let  $V$  defined by Equation (11), we have
$$
\langle 0 | _ {C} \langle 0 | _ {D} V | 0 \rangle_ {C} | 0 \rangle_ {D} | i \rangle_ {A} | 0 \rangle_ {B} = \sum_ {j \in [ n ]} \sqrt {\frac {A _ {i , j} z _ {j}}{\beta}} | i \rangle_ {A} | j \rangle_ {B}.
$$
$$
\begin{array}{l} V | 0 \rangle_ {C} | 0 \rangle_ {D} | i \rangle_ {A} | 0 \rangle_ {B} \\ = \left(| 0 \rangle_ {C} \langle 0 | \otimes \mathcal {O} _ {\mathbf {A}} ^ {\prime} + | 1 \rangle_ {C} \langle 1 | \otimes I _ {A B}\right) \left(| 0 \rangle_ {C} | 0 \rangle_ {D} | i \rangle_ {A} \sum_ {j \in [ n ]} \sqrt {\frac {z _ {j}}{\beta}} | j \rangle_ {B} + | 1 \rangle_ {C} | 0 \rangle_ {D} | i \rangle_ {A} | \phi \rangle_ {B}\right) \\ = | 0 \rangle_ {C} \sum_ {j \in [ n ]} \left(\sqrt {A _ {i , j}} | 0 \rangle_ {D} + \sqrt {1 - A _ {i , j}} | 1 \rangle_ {D}\right) \sqrt {\frac {z _ {j}}{\beta}} | i \rangle_ {A} | j \rangle_ {B} + | 1 \rangle_ {C} | 0 \rangle_ {D} | i \rangle_ {A} | \phi \rangle_ {B} \\ = | 0 \rangle_ {C} | 0 \rangle_ {D} \sum_ {j \in [ n ]} \sqrt {\frac {A _ {i , j} z _ {j}}{\beta}} | i \rangle_ {A} | j \rangle_ {B} + | 0 \rangle_ {C} | 1 \rangle_ {D} \sum_ {j \in [ n ]} \sqrt {\frac {(1 - A _ {i , j}) z _ {j}}{\beta}} | i \rangle_ {A} | j \rangle_ {B} + | 1 \rangle_ {C} | 0 \rangle_ {D} | i \rangle_ {A} | \phi \rangle_ {B}. \\ \end{array}
$$
Proposition D.11. In the proof of Theorem D.9,  $U_{u}$  is a  $(1,0)$ -block-encoding of  $\mathrm{diag}(u) / \beta$ .
Proof. To see this, for every  $i,j\in [n]$
$$
\begin{array}{l} \langle 0 | _ {C} \langle 0 | _ {D} \langle j | _ {A} \langle 0 | _ {B} U _ {u} | 0 \rangle_ {C} | 0 \rangle_ {D} | i \rangle_ {A} | 0 \rangle_ {B} \\ = \langle 0 | _ {C} \langle 0 | _ {D} \langle j | _ {A} \langle 0 | _ {B} \left(V _ {C A B} ^ {\dagger} \otimes I _ {D}\right) \left(V _ {D A B} \otimes I _ {C}\right) | 0 \rangle_ {C} | 0 \rangle_ {D} | i \rangle_ {A} | 0 \rangle_ {B} \\ = \left(\sqrt {u _ {j} / \beta} \langle 0 | _ {C} \langle 0 | _ {D} \langle j | _ {A} \langle \psi_ {j} | _ {B} + \langle 1 | _ {C} \langle 0 | _ {D} \langle g _ {j} | _ {A B}\right) \left(\sqrt {u _ {i} / \beta} | 0 \rangle_ {C} | 0 \rangle_ {D} | i \rangle_ {A} | \psi_ {i} \rangle_ {B} + | 0 \rangle_ {C} | 1 \rangle_ {D} | g _ {i} \rangle_ {A B}\right) \\ = \langle j | i \rangle_ {A} \frac {u _ {i}}{\beta}. \\ \end{array}
$$
Proposition D.12. In the proof of Theorem D.9, if  $\delta = 1 / 2\beta$ ,  $E = \sum_{j \in [n]} \exp(u_j)$ , and  $\epsilon_P = k\epsilon_G^2 / 300n$ , then
$$
\Theta \left(\frac {k}{n}\right) \leq \frac {E}{1 6 W} - 2 \epsilon_ {P} \leq \| | u _ {\text {p o s t}} \rangle \| ^ {2} \leq \frac {E}{1 6 W} + 3 \epsilon_ {P}.
$$
Proof. We first give an upper bound for  $W$  in terms of  $u_{i}$  and  $\tilde{u}^{*}$ . Notice that  $\tilde{u}_i\leq u_i + 2\beta \delta$  for all  $i\in S$ , we have:
$$
W = (n - k) \exp (\tilde {u} ^ {*}) + \sum_ {i \in S} \exp (\tilde {u} _ {i}) \leq \exp (2 \beta \delta) \left((n - k) \exp (u ^ {*}) + \sum_ {i \in S} \exp (u _ {i})\right).
$$
$$
\frac {(n - k) \exp (u ^ {*}) + \sum_ {i \in S} \exp (u _ {i})}{\sum_ {i \in [ n ]} \exp (u _ {i})} \leq \frac {n - k}{k} + 1 = \frac {n}{k},
$$
$$
\frac {E}{W} \geq \sum_ {i \in [ n ]} \frac {\exp \left(u _ {i}\right)}{\exp (2 \beta \delta) ((n - k) \exp \left(u ^ {*}\right) + \sum_ {i \in S} \exp \left(u _ {i}\right))} \geq \frac {k}{n} \exp (- 2 \beta \delta). \tag {12}
$$
With this, noting that  $(a - b)^2 \geq a^2 - 2ab$  for any real  $a$  and  $b$ , we have
$$
\begin{array}{l} \| | u _ {\mathrm {p o s t}} \rangle \| ^ {2} = \sum_ {i \in S} \left(P _ {2 \beta} \left(\frac {u _ {i} - \tilde {u} _ {i}}{4 \beta}\right)\right) ^ {2} \frac {\exp (\tilde {u} _ {i})}{W} + \sum_ {i \notin S} \left(P _ {2 \beta} \left(\frac {u _ {i} - \tilde {u} ^ {*}}{4 \beta}\right)\right) ^ {2} \frac {\exp (\tilde {u} ^ {*})}{W} \\ \geq \sum_ {i \in S} \left(\left(\frac {1}{4} \exp \left(\frac {u _ {i} - \tilde {u} _ {i}}{2}\right)\right) ^ {2} - 2 \epsilon_ {P}\right) \frac {\exp (\tilde {u} _ {i})}{W} \\ + \sum_ {i \notin S} \left(\left(\frac {1}{4} \exp \left(\frac {u _ {i} - \tilde {u} ^ {*}}{2}\right)\right) ^ {2} - 2 \epsilon_ {P}\right) \frac {\exp (\tilde {u} ^ {*})}{W} \\ = \frac {1}{1 6} \left(\sum_ {i \in S} \exp \left(u _ {i} - \tilde {u} _ {i}\right) \frac {\exp \left(\tilde {u} _ {i}\right)}{W} + \sum_ {i \notin S} \exp \left(u _ {i} - \tilde {u} ^ {*}\right) \frac {\exp \left(\tilde {u} ^ {*}\right)}{W}\right) \\ - 2 \epsilon_ {P} \left(\sum_ {i \in S} \frac {\exp (\tilde {u} _ {i})}{W} + \sum_ {i \notin S} \frac {\exp (\tilde {u} ^ {*})}{W}\right) \\ \geq \frac {E}{1 6 W} - 2 \epsilon_ {P} \\ \geq \Theta \left(\frac {k}{n}\right). \\ \end{array}
$$
On the other hand, a similar argument using the inequality  $(a + b)^2 \leq a^2 + 3ab$  for positive real  $a \geq b$  gives
$$
\left\| \left| u _ {\text {p o s t}} \right\rangle \right\| ^ {2} \leq \frac {E}{1 6 W} + 3 \epsilon_ {P}.
$$
These yield the proof.
Proposition D.13. In the proof of Theorem D.9, the total variation distance between the two distributions  $\tilde{u}_{Gibbs}$  and  $\mathcal{O}_u^{\mathrm{Gibbs}}$  is bounded by
$$
d _ {T V} \left(\tilde {u} _ {\text {G i b b s}}, \mathcal {O} _ {u} ^ {\text {G i b b s}}\right) \leq \sqrt {\frac {8 8 n \epsilon_ {P}}{k \exp (- 2 \beta \delta)}}.
$$
Proof. Define  $E = \sum_{j\in [n]}\exp \bigl (u_j\bigr)$ . Let
$$
\left| u _ {\text {G i b b s}} \right\rangle = \sum_ {i \in [ n ]} \sqrt {\frac {\exp (u _ {i})}{E}} | i \rangle
$$
be the intended quantum state with amplitudes the same as the Gibbs distribution  $\mathcal{O}_u^{\mathrm{Gibbs}}$ . The inner product between  $|\tilde{u}_{\mathrm{post}}\rangle$  and  $|u_{\mathrm{Gibbs}}\rangle$  can be bounded by:
$$
\begin{array}{l} \langle \tilde {u} _ {\mathrm {p o s t}} | u _ {\mathrm {G i b b s}} \rangle = \sum_ {i \in S} P _ {2 \beta} \left(\frac {u _ {i} - \tilde {u} _ {i}}{4 \beta}\right) \sqrt {\frac {\exp (\tilde {u} _ {i})}{W}} \sqrt {\frac {\exp (u _ {i})}{E}} \\ + \sum_ {i \notin S} P _ {2 \beta} \left(\frac {u _ {i} - \tilde {u} ^ {*}}{4 \beta}\right) \sqrt {\frac {\exp (\tilde {u} ^ {*})}{W}} \sqrt {\frac {\exp (u _ {i})}{E}} \\ \geq \sum_ {i \in S} \left(\frac {1}{4} \exp \left(\frac {u _ {i} - \tilde {u} _ {i}}{2}\right) - \epsilon_ {P}\right) \sqrt {\frac {\exp (\tilde {u} _ {i})}{W}} \sqrt {\frac {\exp (u _ {i})}{E}} \\ + \sum_ {i \notin S} \left(\frac {1}{4} \exp \left(\frac {u _ {i} - \tilde {u} _ {i}}{2}\right) - \epsilon_ {P}\right) \sqrt {\frac {\exp (\tilde {u} ^ {*})}{W}} \sqrt {\frac {\exp (u _ {i})}{E}} \\ \geq \frac {1}{4 \sqrt {W E}} \left(\sum_ {i \in [ n ]} \exp (u _ {i})\right) - \epsilon_ {P}. \\ \end{array}
$$
The last step is by Cauchy's inequality. By Proposition D.12 and Equation (12), we have
$$
\begin{array}{l} \left| \langle \tilde {u} _ {\mathrm {G i b b s}} | u _ {\mathrm {G i b b s}} \rangle \right| ^ {2} = \frac {\left| \langle \tilde {u} _ {\mathrm {p o s t}} | u _ {\mathrm {G i b b s}} \rangle \right| ^ {2}}{\left\| \left| \tilde {u} _ {\mathrm {p o s t}} \right\rangle \right\| ^ {2}} \geq \frac {E}{1 6 W \left\| \left| \tilde {u} _ {\mathrm {p o s t}} \right\rangle \right\| ^ {2}} - \frac {\epsilon_ {P}}{2 \left\| \left| \tilde {u} _ {\mathrm {p o s t}} \right\rangle \right\| ^ {2}} \\ \geq \frac {E}{1 6 W \left(\frac {E}{1 6 W} + 3 \epsilon_ {P}\right)} - \frac {\epsilon_ {P}}{2 \left\| \left| \tilde {u} _ {\text {p o s t}} \right\rangle \right\| ^ {2}} \\ \geq 1 - \frac {4 8 \epsilon_ {P}}{E / W} - \frac {8 \epsilon_ {P}}{E / W - 3 2 \epsilon_ {P}} \\ \geq 1 - \frac {4 8 n \epsilon_ {P}}{k \exp (- 2 \beta \delta)} - \frac {8 n \epsilon_ {P}}{k \exp (- 2 \beta \delta) - 3 2 n \epsilon_ {P}} \\ \geq 1 - \frac {8 8 n \epsilon_ {P}}{k \exp (- 2 \beta \delta)}. \\ \end{array}
$$
$$
\begin{array}{l} d _ {\mathrm {T V}} \left(\tilde {u} _ {\text {G i b b s}}, \mathcal {O} _ {u} ^ {\text {G i b b s}}\right) \leq \frac {1}{2} \operatorname {t r} \left(\left| | \tilde {u} _ {\text {G i b b s}} \rangle \langle \tilde {u} _ {\text {G i b b s}} | - | u _ {\text {G i b b s}} \rangle \langle u _ {\text {G i b b s}} | \right|\right) \\ = \sqrt {1 - | \langle \tilde {u} _ {\mathrm {G i b b s}} | u _ {\mathrm {G i b b s}} \rangle | ^ {2}} \\ \leq \sqrt {\frac {8 8 n \epsilon_ {P}}{k \exp (- 2 \beta \delta)}}, \\ \end{array}
$$
which is bounded by  $\epsilon_{\mathrm{G}}$  by the choice of  $\epsilon_P$ .