SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
\sup  _ {(e, h) \in \mathbb {R} ^ {d _ {X}} \times d _ {Y}} \left(p _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}} (e, h \mid \mathcal {D} _ {t r} ^ {(m)}) - p _ {\epsilon^ {*}, \eta} (e, h)\right) ^ {2} = \mathcal {O} _ {\mathcal {P} _ {0}} (m ^ {- \gamma})
$$
Proof. Assume we are under  $H_0$ . In order to show that  $P_{\hat{\epsilon},\hat{\eta} | \mathcal{D}_{tr}^{(m)}}$  is absolutely continuous w.r.t. Lebesgue measure (for each training set configuration) and that its density is given by
$$
p _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} (e, h \mid \mathcal {D} _ {t r} ^ {(m)}) = \mathbb {E} _ {P} \left[ p _ {\epsilon} \left(e + \delta_ {1, P} (Z) + \hat {g} _ {1} ^ {(m)} (Z) - g _ {1, P} ^ {*} (Z)\right) p _ {\eta} \left(h + \delta_ {2, P} (Z) + \hat {g} _ {2} ^ {(m)} (Z) - g _ {2, P} ^ {*} (Z)\right) \mid \mathcal {D} _ {t r} ^ {(m)} \right],
$$
it suffices to show that
$$
\begin{array}{l} \mathbb {P} _ {P} \left(\left(\hat {\epsilon}, \hat {\eta}\right) \in A \mid \mathcal {D} _ {t r} ^ {(m)}\right) = \\ = \int \mathbb {1} _ {A} (u, v) \mathbb {E} _ {P} \left[ p _ {\epsilon} \left(u + \delta_ {1, P} (Z) + \hat {g} _ {1} ^ {(m)} (Z) - g _ {1, P} ^ {*} (Z)\right) p _ {\eta} \left(v + \delta_ {2, P} (Z) + \hat {g} _ {2} ^ {(m)} (Z) - g _ {2, P} ^ {*} (Z)\right) | \mathcal {D} _ {t r} ^ {(m)} \right] d (u, v) \\ \end{array}
$$
for any measurable set  $A$ .
Using Fubini's theorem, we get
$$
\begin{array}{l} \mathbb {P} _ {P} \left(\left(\hat {\epsilon}, \hat {\eta}\right) \in A \mid \mathcal {D} _ {t r} ^ {(m)}\right) = \\ = \mathbb {E} _ {P} \left[ \mathbb {1} _ {A} \left(\epsilon - \delta_ {1, P} (Z) - \hat {g} _ {1} ^ {(m)} (Z) + g _ {1, P} ^ {*} (Z), \eta - \delta_ {2, P} (Z) - \hat {g} _ {2} ^ {(m)} (Z) + g _ {2, P} ^ {*} (Z)\right) \mid \mathcal {D} _ {t r} ^ {(m)} \right] \\ = \mathbb {E} _ {P} \left[ \int \mathbb {1} _ {A} (e - \delta_ {1, P} (Z) - \hat {g} _ {1} ^ {(m)} (Z) + g _ {1, P} ^ {*} (Z), h - \delta_ {2, P} (Z) - \hat {g} _ {2} ^ {(m)} (Z) + g _ {2, P} ^ {*} (Z)) p _ {\epsilon , \eta} (e, h) d (e, h) \mid \mathcal {D} _ {t r} ^ {(m)} \right] \\ = \mathbb {E} _ {P} \left[ \int \mathbb {1} _ {A} (e - \delta_ {1, P} (Z) - \hat {g} _ {1} ^ {(m)} (Z) + g _ {1, P} ^ {*} (Z), h - \delta_ {2, P} (Z) - \hat {g} _ {2} ^ {(m)} (Z) + g _ {2, P} ^ {*} (Z)) p _ {\epsilon} (e) p _ {\eta} (h) d (e, h) \mid \mathcal {D} _ {t r} ^ {(m)} \right] \\ = \mathbb {E} _ {P} \left[ \int \mathbb {1} _ {A} (u, v) p _ {\epsilon} \left(u + \delta_ {1, P} (Z) + \hat {g} _ {1} ^ {(m)} (Z) - g _ {1, P} ^ {*} (Z)\right) p _ {\eta} \left(v + \delta_ {2, P} (Z) + \hat {g} _ {2} ^ {(m)} (Z) - g _ {2, P} ^ {*} (Z)\right) d (u, v) \mid \mathcal {D} _ {t r} ^ {(m)} \right] \\ = \int \mathbb {1} _ {A} (u, v) \mathbb {E} _ {P} \left[ p _ {\epsilon} \left(u + \delta_ {1, P} (Z) + \hat {g} _ {1} ^ {(m)} (Z) - g _ {1, P} ^ {*} (Z)\right) p _ {\eta} \left(v + \delta_ {2, P} (Z) + \hat {g} _ {2} ^ {(m)} (Z) - g _ {2, P} ^ {*} (Z)\right) | \mathcal {D} _ {t r} ^ {(m)} \right] d (u, v) \\ \end{array}
$$
The proof is analogous to the other distributions.
Now, we proceed with the second part of the lemma. Using Assumptions A.6 and A.7, we get
$$
\begin{array}{l} \left(p _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} (e, h \mid \mathcal {D} _ {t r} ^ {(m)}) - p _ {\epsilon^ {*}, \eta^ {*}} (e, h)\right) ^ {2} = \\ = \left(\mathbb {E} _ {P} \left[ p _ {\epsilon} \left(e + \delta_ {1, P} (Z) + \hat {g} _ {1} ^ {(m)} (Z) - g _ {1, P} ^ {*} (Z)\right) p _ {\eta} \left(h + \delta_ {2, P} (Z) + \hat {g} _ {2} ^ {(m)} (Z) - g _ {2, P} ^ {*} (Z)\right) \right. \right. \\ \left. \left. - p _ {\epsilon} \left(e + \delta_ {1, P} (Z)\right) p _ {\eta} \left(h + \delta_ {2, P} (Z)\right) \mid \mathcal {D} _ {t r} ^ {(m)} \right]\right) ^ {2} \\ \leq L ^ {2} \left(\mathbb {E} _ {P} \left[ \left\| \left(\hat {g} _ {1} ^ {(m)} (Z) - g _ {1} ^ {*} (Z), \hat {g} _ {2} ^ {(m)} (Z) - g _ {2} ^ {*} (Z)\right) \right\| _ {2} \mid \mathcal {D} _ {t r} ^ {(m)} \right]\right) ^ {2} \\ \leq L ^ {2} \left(\mathbb {E} _ {P} \left[ \left\| \left(\hat {g} _ {1} ^ {(m)} (Z) - g _ {1} ^ {*} (Z), \hat {g} _ {2} ^ {(m)} (Z) - g _ {2} ^ {*} (Z)\right) \right\| _ {2} ^ {2} \mid \mathcal {D} _ {t r} ^ {(m)} \right]\right) \\ = L ^ {2} \mathbb {E} _ {P} \left[ \left\| \hat {g} _ {1} ^ {(m)} (Z) - g _ {1, P} ^ {*} (Z) \right\| _ {2} ^ {2} \mid \mathcal {D} _ {t r} ^ {(m)} \right] + L ^ {2} \mathbb {E} _ {P} \left[ \left\| \hat {g} _ {2} ^ {(m)} (Z) - g _ {2, P} ^ {*} (Z) \right\| _ {2} ^ {2} \mid \mathcal {D} _ {t r} ^ {(m)} \right] \\ = \mathcal {O} _ {\mathcal {P} _ {0}} (m ^ {- \gamma}) \\ \end{array}
$$
where the last inequality is obtained via Jensen's inequality. Because the upper bound obtained through Lipschitzness does not depend on  $(e,h)$ , we get
$$
\sup _ {(e, h) \in \mathbb {R} ^ {d} X \times d _ {Y}} \left(p _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} (e, h \mid \mathcal {D} _ {t r} ^ {(m)}) - p _ {\epsilon^ {*}, \eta^ {*}} (e, h)\right) ^ {2} = \mathcal {O} _ {\mathcal {P} _ {0}} (m ^ {- \gamma})
$$
The results for the other converging quantities are obtained in the same manner.
$$
\mathbb {E} _ {P} \left[ \varphi_ {\alpha} ^ {\text {R E S I T}} \left(\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}\right) \right] \leq \alpha + \min  \left\{d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right), d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}\right) \right\} + o (1)
$$
Proof. We are trying to prove that
$$
\sup _ {P \in \mathcal {P} _ {0}} \left[ \mathbb {E} _ {P} [ \varphi_ {\alpha} ^ {\mathrm {R E S I T}} (\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}) ] - \alpha - \min  \{d _ {\mathrm {T V}} (P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}), d _ {\mathrm {T V}} (P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}) \} \right] \leq o (1) \text {a s} m \to \infty
$$
First, see that using Lemma B.3 we get
$$
\begin{array}{l} \mathbb {E} _ {P} \left[ \varphi_ {\alpha} ^ {\text {R E S I T}} \left(\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}\right) \right] = \\ = \mathbb {E} _ {P} \left[ \mathbb {E} _ {P} \left[ \varphi_ {\alpha} ^ {\text {R E S I T}} \left(\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}\right) \mid \mathcal {D} _ {t r} ^ {(m)} \right] \right] \\ \leq \alpha + \mathbb {E} _ {P} \left[ \min  \left\{d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right), d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right\} \right] \\ \leq \alpha + \min  \left\{\mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right], \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] \right\} \\ \leq \alpha + \min  \left\{\mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] - d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right) + d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right), \right. \\ \left. \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) - d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}\right) + d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}\right) \right] \right\} \\ \leq \alpha + \min  \left\{\left| \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] - d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right) \right| + d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right), \right. \\ \left. \left| \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) - d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}\right) \right\rvert + d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}\right) \right] \right\} \\ \end{array}
$$
$$
\sup  _ {P \in \mathcal {P} _ {0}} \left[ \mathbb {E} _ {P} \left[ \varphi_ {\alpha} ^ {\text {R E S I T}} \left(\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}\right) \right] - \alpha - \min  \left\{d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right), d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}\right) \right\} \right] \leq \sup  _ {P \in \mathcal {P} _ {0}} \Delta_ {P} ^ {(m)} \tag {B.3}
$$
$$
\begin{array}{l} \Delta_ {P} ^ {(m)} \triangleq \min  \left\{\left| \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] - d _ {\mathrm {T V}} (P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}) \right| + d _ {\mathrm {T V}} (P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}), \right. \\ \left. \left| \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] - d _ {\mathrm {T V}} (P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}) \right| + d _ {\mathrm {T V}} (P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}) \right\} \\ - \min  \left\{d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right), d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}\right) \right\} \\ \end{array}
$$
It suffices to show that  $\sup_{P\in \mathcal{P}_0}\Delta_P^{(m)} = o(1)$  as  $m\to \infty$ . Next step is to show that
$$
\sup  _ {P \in \mathcal {P} _ {0}} \left| \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] - d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right) \right| = o (1)
$$
$$
\sup  _ {P \in \mathcal {P} _ {0}} \left| \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] - d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}\right) \right| = o (1)
$$
as  $m\to \infty$  . Given the symmetry, we focus on the first problem.
By the triangle inequality, we obtain
$$
\mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] \leq \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}\right) \right] + d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right) + \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\epsilon , \eta^ {*}} ^ {n}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right]
$$
$$
\begin{array}{l} \sup  _ {P \in \mathcal {P} _ {0}} \left| \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] - d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right) \right| \\ \leq \underbrace {\sup  _ {P \in \mathcal {P} _ {0}} \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon} , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)} , P _ {\epsilon^ {*}} , \eta^ {*}} ^ {n}\right) \right]} _ {\text {I}} + \underbrace {\sup  _ {P \in \mathcal {P} _ {0}} \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)} , P _ {\epsilon , \eta^ {*}} ^ {n}\right) \right]} _ {\text {I I}} \\ \end{array}
$$
We treat these terms separately.
(I) Consider a sequence of probability distributions  $(P^{(m)})_{m\in \mathbb{N}}$  in  $\mathcal{P}_0$  such that
$$
\sup  _ {P \in \mathcal {P} _ {0}} \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}, P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}\right) \right] \leq \mathbb {E} _ {P ^ {(m)}} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}, P ^ {(m)} _ {\epsilon^ {*}, \eta^ {*}} ^ {n}\right) \right] + \frac {1}{m}
$$
Here, the distributions  $P$  and  $P^{(m)}$  determine not only the distribution associated with  $\mathcal{D}_{tr}^{(m)}$  but also the distribution of  $(\hat{\epsilon},\hat{\eta},\epsilon^{*},\eta^{*})$ . Because we have that
$$
\begin{array}{l} d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}\right) \leq \\ \leq n \cdot d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon^ {*}, \eta^ {*}}\right) \quad (\text {S u b a d d i t i v i t y o f T V d i s t a n c e}) \\ = \frac {n}{2} \int \left| p _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} (e, h \mid \mathcal {D} _ {t r} ^ {(m)}) - p _ {\epsilon^ {*}, \eta^ {*}} (e, h) \right| d (u, v) \quad \text {(S c h e f f e ' s t h e o r e m [ 3 6 ] [ L e m m a 2 . 1 ])} \\ \leq \frac {n V}{2} \sup  _ {(u, v) \in \mathbb {R} ^ {d _ {X}} \times d _ {Y}} \left| p _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} (e, h \mid \mathcal {D} _ {t r} ^ {(m)}) - p _ {\epsilon^ {*}, \eta^ {*}} (e, h) \right| \quad (\text {A s s u m p t i o n A . 8}) \\ = \left(\frac {n ^ {2} V ^ {2}}{4} \sup  _ {(u, v) \in \mathbb {R} ^ {d} X \times d _ {Y}} \left| p _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} (e, h \mid \mathcal {D} _ {t r} ^ {(m)}) - p _ {\epsilon^ {*}, \eta^ {*}} (e, h) \right| ^ {2}\right) ^ {1 / 2} \\ = \left(o \left(m ^ {\gamma}\right) \mathcal {O} _ {\mathcal {P} _ {0}} \left(m ^ {- \gamma}\right)\right) ^ {1 / 2} \tag {Lemma B.4} \\ = o _ {\mathcal {P} _ {0}} (1) \\ \end{array}
$$
where  $V$  is the volume of a ball containing the support of the RVs (existence of that ball is due to Assumption A.8), we also have that  $d_{\mathrm{TV}}\left(P^{(m)}{}_{\hat{\epsilon},\hat{\eta} |\mathcal{D}_{tr}^{(m)}}^n,P^{(m)}{}_{\epsilon^*,\eta^*}\right) = o_p(1)$ , when  $\mathcal{D}_{tr}^{(m)}$  samples come from the sequence  $(P^{(m)})_{m\in \mathbb{N}}$ . By the Dominated Convergence Theorem (DCT) [27, Corollary 6.3.2], we have
$$
\sup  _ {P \in \mathcal {P} _ {0}} \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}, P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}\right) \right] \leq \mathbb {E} _ {P ^ {(m)}} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}, P _ {\epsilon^ {*}, \eta^ {*}} ^ {(m)}\right) \right] + \frac {1}{m} = o (1)
$$
To see why we can use the DCT here, realize that when samples come from  $P^{(m)}$ ,  $W^{(m)} = d_{\mathrm{TV}}\left(P^{(m)\hat{n}_{\hat{\epsilon},\hat{\eta} | \mathcal{D}_{tr}^{(m)}}},P^{(m)\hat{n}_{\epsilon^*,\eta^*}}\right)$  can be seen as a measurable function going from an original probability space to some other space. Different distributions  $\{P^{(m)}\}$  are due to different random variables while the original probability measure is fixed. Because of that,
$$
\mathbb {E} _ {P ^ {(m)}} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}, P ^ {(m)} _ {\epsilon^ {*}, \eta^ {*}} ^ {n}\right) \right] = \mathbb {E} \left[ W ^ {(m)} \right]
$$
for the bounded random variable  $W^{(m)}$ , where the last expectation is taken in the original probability space. We apply the DCT in  $\mathbb{E}\left[W^{(m)}\right]$ .
(II) Following the same steps as in part (I), we obtain
$$
\sup _ {P \in \mathcal {P} _ {0}} \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon , \eta^ {*}} ^ {n}\right) \right] = o (1)
$$
Going back to step B.3, consider another sequence of probability distributions  $(Q^{(m)})_{m\in \mathbb{N}}$  in  $\mathcal{P}_0$  such that
$$
\sup _ {P \in \mathcal {P} _ {0}} \Delta_ {P} ^ {(m)} \leq \Delta_ {Q ^ {(m)}} ^ {(m)} + \frac {1}{m}
$$
$$
\begin{array}{l} \Delta_ {Q ^ {(m)}} ^ {(m)} = \min  \left\{ \right.\left| \mathbb {E} _ {Q ^ {(m)}} \left[ d _ {\mathrm {T V}} \left(Q _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}, Q _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {(m)}\right)\right] - d _ {\mathrm {T V}} (Q _ {\epsilon^ {*}, \eta^ {*}} ^ {(m) n}, Q _ {\epsilon , \eta^ {*}} ^ {(m) n}) \right| + d _ {\mathrm {T V}} (Q _ {\epsilon^ {*}, \eta^ {*}} ^ {(m) n}, Q _ {\epsilon , \eta^ {*}} ^ {(m) n}), \\ \left. \left| \mathbb {E} _ {Q ^ {(m)}} \left[ d _ {\mathrm {T V}} \left(Q _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}, Q _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}} ^ {(m)}\right) - d _ {\mathrm {T V}} (Q _ {\epsilon^ {*}, \eta^ {*}} ^ {(m) n}, Q _ {\epsilon^ {*}, \eta} ^ {(m) n}) \right\rvert + d _ {\mathrm {T V}} (Q _ {\epsilon^ {*}, \eta^ {*}} ^ {(m) n}, Q _ {\epsilon^ {*}, \eta} ^ {(m) n}) \right] \right\} \\ - \min  \left\{d _ {\mathrm {T V}} \left(Q ^ {(m)} \right. _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, Q ^ {(m)} \right. _ {\epsilon , \eta^ {*}} ^ {n}), d _ {\mathrm {T V}} \left(Q ^ {(m)} \right. _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, Q ^ {(m)} \left. \right. _ {\epsilon^ {*}, \eta} ^ {n}) \} \\ \end{array}
$$
Because of continuity of min and
$$
\sup  _ {P \in \mathcal {P} _ {0}} \left| \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] - d _ {\mathrm {T V}} (P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}) \right| = o (1)
$$
$$
\sup _ {P \in \mathcal {P} _ {0}} \left| \mathbb {E} _ {P} \left[ d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, P _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}\right) \right] - d _ {\mathrm {T V}} (P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}) \right| = o (1)
$$
$$
\begin{array}{l} \Delta_ {Q ^ {(m)}} ^ {(m)} = \\ = \min  \left\{d _ {\mathrm {T V}} \left(Q ^ {(m) _ {\epsilon^ {*}, \eta^ {*}}}, Q ^ {(m) _ {\epsilon , \eta^ {*}}} ^ {n}\right) + o (1), d _ {\mathrm {T V}} \left(Q ^ {(m) _ {\epsilon^ {*}, \eta^ {*}}}, Q ^ {(m) _ {\epsilon^ {*}, \eta} ^ {n}}\right) + o (1) \right\} \\ - \min  \left\{d _ {\mathrm {T V}} \left(Q ^ {(m) n} _ {\epsilon^ {*}, \eta^ {*}}, Q ^ {(m) n} _ {\epsilon , \eta^ {*}}\right), d _ {\mathrm {T V}} \left(Q ^ {(m) n} _ {\epsilon^ {*}, \eta^ {*}}, Q ^ {(m) n} _ {\epsilon^ {*}, \eta}\right) \right\} \\ = \min  \{d _ {\mathrm {T V}} (Q ^ {(m) ^ {n}} _ {\epsilon^ {*}, \eta^ {*}}, Q ^ {(m) ^ {n}} _ {\epsilon , \eta^ {*}}), d _ {\mathrm {T V}} (Q ^ {(m) ^ {n}} _ {\epsilon^ {*}, \eta^ {*}}, Q ^ {(m) ^ {n}} _ {\epsilon^ {*}, \eta})) \} \\ - \min \{d _ {\mathrm {T V}} (Q _ {\epsilon^ {*}, \eta^ {*}} ^ {(m) ^ {n}}, Q _ {\epsilon , \eta^ {*}} ^ {(m) ^ {n}}), d _ {\mathrm {T V}} (Q _ {\epsilon^ {*}, \eta^ {*}} ^ {(m) ^ {n}}, Q _ {\epsilon^ {*}, \eta} ^ {(m) ^ {n}}) \} + o (1) \\ = o (1) \\ \end{array}
$$
Finally implying, from step B.3,
$$
\sup  _ {P \in \mathcal {P} _ {0}} \left[ \mathbb {E} _ {P} \left[ \varphi_ {\alpha} ^ {\text {R E S I T}} \left(\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}\right)\right] - \alpha - \min  \left\{d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon , \eta^ {*}} ^ {n}\right), d _ {\mathrm {T V}} \left(P _ {\epsilon^ {*}, \eta^ {*}} ^ {n}, P _ {\epsilon^ {*}, \eta} ^ {n}\right)\right\}\right] \leq o (1) \text {a s} m \rightarrow \infty
$$
B.4 RBPT
Theorem 4.4. Suppose that Assumptions 4.1, 4.2, 4.3, 3.2, and 3.3 hold. If  $n$  is a function of  $m$  such that  $n \to \infty$  and  $n = o(m^{\gamma})$  as  $m \to \infty$ , then
$$
\mathbb {E} _ {P} \left[ \varphi_ {\alpha} ^ {\text {R B P T}} \left(\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}\right) \right] = 1 - \Phi \left(\tau_ {\alpha} - \sqrt {\frac {n}{\sigma_ {P} ^ {2}}} \Omega_ {P} ^ {\text {R B P T}}\right) + o (1)
$$
$$
\Omega_ {P} ^ {\mathrm {R B P T}} = \Omega_ {P, 1} ^ {\mathrm {R B P T}} - \Omega_ {P, 2} ^ {\mathrm {R B P T}}
$$
$$
\Omega_ {P, 1} ^ {\mathrm {R B P T}} \triangleq \mathbb {E} _ {P} \left[ \ell \left(\int g _ {P} ^ {*} (x, Z) d Q _ {X | Z} ^ {*} (x), Y\right) - \ell \left(\int g _ {P} ^ {*} (x, Z) d P _ {X | Z} (x), Y\right) \right]
$$
$$
\underbrace {\Omega_ {P , 2} ^ {\mathrm {R B P T}}} _ {\text {J e n s e n ' s g a p}} \triangleq \mathbb {E} _ {P} \left[ \ell \left(g _ {P} ^ {*} (X, Z), Y\right) - \ell \left(\int g _ {P} ^ {*} (x, Z) d P _ {X | Z} (x), Y\right) \right]
$$
Proof. First, note that there must be a sequence of probability measures in  $\mathcal{P}$ ,  $(P^{(m)})_{m\in \mathbb{N}}$ , such that
$$
\sup _ {P \in \mathcal {P}} \left| \mathbb {E} _ {P} [ \varphi_ {\alpha} ^ {\mathrm {R B P T}} (\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}) ] - 1 + \Phi \left(\tau_ {\alpha} - \sqrt {\frac {n}{\sigma_ {P} ^ {2}}} \Omega_ {P} ^ {\mathrm {R B P T}}\right) \right| \leq \left| \mathbb {E} _ {P ^ {(m)}} [ \varphi_ {\alpha} ^ {\mathrm {R B P T}} (\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}) ] - 1 + \Phi \left(\tau_ {\alpha} - \sqrt {\frac {n}{\sigma_ {P ^ {(m)}} ^ {2}}} \Omega_ {P ^ {(m)}} ^ {\mathrm {R B P T}}\right) \right| + \frac {1}{m}
$$
Now, let us first decompose the test statistic  $\Xi^{(n,m)}$  in the following way: