SlowGuess/NeurIPS_2023_OCR huggingface dataset:
The terms involving one of the  $\epsilon$  and  $\eta$  were all zero and were omitted. Given that  $n$  is a function of  $m$ , we omit it when writing the  $W_{j,P(m)}^{(m)}$ ’s. Define  $\sigma_{P(m)}^{(m)} \triangleq \sqrt{\operatorname{Var}_{P(m)}[T_1^{(m)} \mid \mathcal{D}_{tr}^{(m)}]}$  and see that
$$
\begin{array}{l} \mathbb {E} _ {P} \left[ \varphi_ {\alpha} ^ {\mathrm {G C M}} \left(\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}\right) \right] = \\ = \mathbb {P} _ {P} \left[ p \left(\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}\right) \leq \alpha \right] \\ = \mathbb {P} _ {P} \left[ 1 - \Phi (\Gamma^ {(n, m)}) \leq \alpha / 2 \right] \\ = \mathbb {P} _ {P} \left[ \Gamma^ {(n, m)} \geq \tau_ {\alpha / 2} \right] \\ = \mathbb {P} _ {P} \left[ \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\hat {\sigma} ^ {(n , m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\hat {\sigma} ^ {(n , m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\hat {\sigma} ^ {(n , m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\hat {\sigma} ^ {(n , m)}} + \frac {\sqrt {n} \Omega_ {P (m)} ^ {\mathrm {G C M}}}{\hat {\sigma} ^ {(n , m)}} \leq - \tau_ {\alpha / 2} \right] + \\ + \mathbb {P} _ {P} \left[ \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\hat {\sigma} ^ {(n , m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\hat {\sigma} ^ {(n , m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\hat {\sigma} ^ {(n , m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\hat {\sigma} ^ {(n , m)}} + \frac {\sqrt {n} \Omega_ {P (m)} ^ {\mathrm {G C M}}}{\hat {\sigma} ^ {(n , m)}} \geq \tau_ {\alpha / 2} \right] \\ = \mathbb {P} _ {P} \left[ \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\tilde {\sigma} ^ {(n , m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} \tau_ {\alpha / 2} - \tau_ {\alpha / 2} \leq - \tau_ {\alpha / 2} - \frac {\sqrt {n} \Omega_ {P (m)} ^ {\mathrm {G C M}}}{\sigma_ {P (m)}} \right] + \\ + \mathbb {P} _ {P} \left[ \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} - \frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} \tau_ {\alpha / 2} + \tau_ {\alpha / 2} \geq \tau_ {\alpha / 2} - \frac {\sqrt {n} \Omega_ {P (m)} ^ {\mathrm {G C M}}}{\sigma_ {P (m)}} \right] \\ = 1 - \Phi \left(\tau_ {\alpha / 2} - \sqrt {\frac {n}{\sigma_ {P (m)} ^ {2}}} \Omega_ {P (m)} ^ {\mathrm {G C M}}\right) + \Phi \left(- \tau_ {\alpha / 2} - \sqrt {\frac {n}{\sigma_ {P (m)} ^ {2}}} \Omega_ {P (m)} ^ {\mathrm {G C M}}\right) + o (1) \tag {B.2} \\ \end{array}
$$
$$
\sup  _ {P \in \mathcal {P}} \left| \mathbb {E} _ {P} \left[ \varphi_ {\alpha} ^ {\mathrm {G C M}} \left(\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}\right)\right] - 1 + \Phi \left(\tau_ {\alpha / 2} - \sqrt {\frac {n}{\sigma_ {P} ^ {2}}} \Omega_ {P} ^ {\mathrm {G C M}}\right) - \Phi \left(- \tau_ {\alpha / 2} - \sqrt {\frac {n}{\sigma_ {P} ^ {2}}} \Omega_ {P} ^ {\mathrm {G C M}}\right)\right| = o (1) \text {a s} m \rightarrow \infty
$$
Justifying step B.2. First, from a central limit theorem for triangular arrays [6, Corollary 9.5.11], we have that
$$
\sqrt {n} \left(\frac {W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}}\right) = \sqrt {n} \left(\frac {\bar {T} ^ {(n , m)} - \mathbb {E} _ {P ^ {(m)}} \left[ T _ {1} ^ {(m)} \mid \mathcal {D} _ {t r} ^ {(m)} \right]}{\sigma_ {P ^ {(m)}} ^ {(m)}}\right) = \frac {1}{\sqrt {n}} \sum_ {i = 1} ^ {n} \left(\frac {T _ {i} ^ {(m)} - \mathbb {E} _ {P ^ {(m)}} \left[ T _ {1} ^ {(m)} \mid \mathcal {D} _ {t r} ^ {(m)} \right]}{\sigma_ {P ^ {(m)}} ^ {(m)}}\right) \Rightarrow N (0, 1)
$$
The conditions for the central limit theorem [6, Corollary 9.5.11] can be proven to hold like in Theorem 3.4's proof.
$$
\begin{array}{l} \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} - \left(\frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} - \tau_ {\alpha / 2} + \tau_ {\alpha / 2} \frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}}\right) = \\ = \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \left(1 - \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}}\right) - \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} - \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} - \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \\ + \tau_ {\alpha / 2} \left(1 - \frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P ^ {(m)}} ^ {(m)}}\right) \left(\frac {\sigma_ {P ^ {(m)}} ^ {(m)}}{\sigma_ {P ^ {(m)}}} - 1\right) + \tau_ {\alpha / 2} \left(1 - \frac {\sigma_ {P ^ {(m)}} ^ {(m)}}{\sigma_ {P ^ {(m)}}}\right) + \tau_ {\alpha / 2} \left(1 - \frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P ^ {(m)}} ^ {(m)}}\right) \\ = o _ {p} (1) \text {a s} m \rightarrow \infty \\ \end{array}
$$
$$
\begin{array}{l} \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} - \left(\frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \tau_ {\alpha / 2} - \tau_ {\alpha / 2} \frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}}\right) = \\ = \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \left(1 - \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}}\right) - \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} - \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} - \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \\ \end{array}
$$
$$
\begin{array}{l} + \tau_ {\alpha / 2} \left(\frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P ^ {(m)}} ^ {(m)}} - 1\right) \left(\frac {\sigma_ {P ^ {(m)}} ^ {(m)}}{\sigma_ {P ^ {(m)}}} - 1\right) + \tau_ {\alpha / 2} \left(\frac {\sigma_ {P ^ {(m)}} ^ {(m)}}{\sigma_ {P ^ {(m)}}} - 1\right) + \tau_ {\alpha / 2} \left(\frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P ^ {(m)}} ^ {(m)}} - 1\right) \\ = o _ {p} (1) \text {a s} m \rightarrow \infty \\ \end{array}
$$
To see why the random quantities above converge to zero in probability, see that because of Assumption 3.3, Lemma<sup>19</sup> B.1, and continuous mapping theorem, we have that
Additionally, because of Assumptions A.3, 3.3, Cauchy-Schwarz inequality, and condition  $n = o(m^{\gamma})$ , we have that
$$
\begin{array}{l} \left| \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} \right| = \left| \frac {\sqrt {n} \mathbb {E} _ {P (m)} \left[ \left(\hat {g} _ {1} ^ {(m)} (Z _ {1}) - g _ {1 , P (m)} ^ {*} (Z _ {1})\right) \left(\hat {g} _ {2} ^ {(m)} (Z _ {1}) - g _ {2 , P (m)} ^ {*} (Z _ {1})\right) \mid \mathcal {D} _ {t r} ^ {(m)} \right]}{\sigma_ {P (m)}} \right| \\ \leq \frac {\sqrt {n \mathbb {E} _ {P ^ {(m)}} [ (\hat {g} _ {1} ^ {(m)} (Z _ {1}) - g _ {1 , P ^ {(m)}} ^ {*} (Z _ {1})) ^ {2} \mid \mathcal {D} _ {t r} ^ {(m)} ] \mathbb {E} _ {P ^ {(m)}} [ (\hat {g} _ {2} ^ {(m)} (Z _ {1}) - g _ {2 , P ^ {(m)}} ^ {*} (Z _ {1})) ^ {2} \mid \mathcal {D} _ {t r} ^ {(m)} ]}}{\inf  _ {P \in \mathcal {P}} \sigma_ {P}} \\ = \frac {\sqrt {o (m ^ {\gamma}) \mathcal {O} _ {p} \left(m ^ {- 2 \gamma}\right)}}{\inf  _ {P \in \mathcal {P}} \sigma_ {P}} \\ = o _ {p} (1) \\ \end{array}
$$
$$
\begin{array}{l} \left| \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} \right| = \left| \frac {\sqrt {n} \mathbb {E} _ {P (m)} \left[ \left(\hat {g} _ {1} ^ {(m)} (Z _ {1}) - g _ {1 , P (m)} ^ {*} (Z _ {1})\right) \delta_ {2 , P (m)} (Z _ {1}) \mid \mathcal {D} _ {t r} ^ {(m)} \right]}{\sigma_ {P (m)}} \right| \\ \leq \frac {\sqrt {n \mathbb {E} _ {P ^ {(m)}} \left[ \left(\hat {g} _ {1} ^ {(m)} (Z _ {1}) - g _ {1 , P ^ {(m)}} ^ {*} (Z _ {1})\right) ^ {2} \mid \mathcal {D} _ {t r} ^ {(m)} \right] \mathbb {E} _ {P ^ {(m)}} \left[ \left(\delta_ {2 , P ^ {(m)}} (Z _ {1})\right) ^ {2} \right]}}{\inf  _ {P \in \mathcal {P}} \sigma_ {P}} \\ = \frac {\sqrt {o (m ^ {\gamma}) \mathcal {O} _ {p} (m ^ {- \gamma})}}{\inf  _ {P \in \mathcal {P}} \sigma_ {P}} \\ = o _ {p} (1) \\ \end{array}
$$
$$
\begin{array}{l} \left| \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} \right| = \left| \frac {\sqrt {n} \mathbb {E} _ {P (m)} \left[ \left(\hat {g} _ {2} ^ {(m)} (Z _ {1}) - g _ {2 , P (m)} ^ {*} (Z _ {1})\right) \delta_ {1 , P (m)} (Z _ {1}) \mid \mathcal {D} _ {t r} ^ {(m)} \right]}{\sigma_ {P (m)}} \right| \\ \leq \frac {\sqrt {n \mathbb {E} _ {P ^ {(m)}} \left[ \left(\hat {g} _ {2} ^ {(m)} (Z _ {1}) - g _ {2 , P ^ {(m)}} ^ {*} (Z _ {1})\right) ^ {2} \mid \mathcal {D} _ {t r} ^ {(m)} \right] \mathbb {E} _ {P ^ {(m)}} \left[ \left(\delta_ {1 , P ^ {(m)}} (Z _ {1})\right) ^ {2} \right]}}{\inf  _ {P \in \mathcal {P}} \sigma_ {P}} \\ = \frac {\sqrt {o (m ^ {\gamma}) \mathcal {O} _ {p} (m ^ {- \gamma})}}{\inf  _ {P \in \mathcal {P}} \sigma_ {P}} \\ = o _ {p} (1) \\ \end{array}
$$
<sup>19</sup>We can apply this STFR's lemma because it still holds when we consider GCM's test statistic.
$$
\begin{array}{l} \left(\frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} - \tau_ {\alpha / 2} + \tau_ {\alpha / 2} \frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}}\right) = \\ = \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} - \left[ \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} - \left(\frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} - \tau_ {\alpha / 2} + \tau_ {\alpha / 2} \frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P (m)}}\right) \right] \\ = \frac {\sqrt {n} W _ {1 , P ^ {(m)}} ^ {(m)}}{\sigma_ {P ^ {(m)}} ^ {(m)}} + o _ {p} (1) \Rightarrow N (0, 1) \\ \end{array}
$$
$$
\begin{array}{l} \left(\frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \tau_ {\alpha / 2} - \tau_ {\alpha / 2} \frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}}\right) = \\ = \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} - \left[ \frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} - \left(\frac {\sqrt {n} W _ {1 , P (m)} ^ {(m)}}{\sigma_ {P (m)} ^ {(m)}} \frac {\sigma_ {P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {2 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {3 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \frac {\sqrt {n} W _ {4 , P (m)} ^ {(m)}}{\sigma_ {P (m)}} + \tau_ {\alpha / 2} - \tau_ {\alpha / 2} \frac {\hat {\sigma} ^ {(n , m)}}{\sigma_ {P (m)}}\right) \right] \\ = \frac {\sqrt {n} W _ {1 , P ^ {(m)}} ^ {(m)}}{\sigma_ {P ^ {(m)}} ^ {(m)}} + o _ {p} (1) \Rightarrow N (0, 1) \\ \end{array}
$$
by Slutsky's theorem. Because  $N(0,1)$  is a continuous distribution, we have uniform convergence of the distribution function [27][Chapter 8, Exercise 5] and we do not have to worry about the fact that  $\tau_{\alpha /2} - \sqrt{\frac{n}{\sigma_{P(m)}^2}}\Omega_{P(m)}^{\mathrm{GCM}}$  or  $-\tau_{\alpha /2} - \sqrt{\frac{n}{\sigma_{P(m)}^2}}\Omega_{P(m)}^{\mathrm{GCM}}$  depends on  $m$ .
B.3 RESIT
Lemma B.2. Let  $P_{U,V}$  and  $P_{U,V}^{\prime}$  be two distributions on  $(\mathcal{U} \times \mathcal{V}, \mathcal{B}(\mathcal{U} \times \mathcal{V}))$ ,  $\mathcal{U} \times \mathcal{V} \subseteq \mathbb{R}^{d_U \times d_V}$ , with  $d_U, d_V \geq 1$ . Assume  $P_U$  and  $P_U^{\prime}$  are dominated by a common  $\sigma$ -finite measure  $\mu$  and that  $P_{V|U=u} = P_{V|U=u}^{\prime}$  is dominated by a  $\sigma$ -finite measure  $\nu_u$ , for all  $u \in \mathbb{R}^{d_U}$ . Then,
$$
d _ {\mathrm {T V}} \left(P _ {U, V}, P _ {U, V} ^ {\prime}\right) = d _ {\mathrm {T V}} \left(P _ {U}, P _ {U} ^ {\prime}\right)
$$
where  $d_{TV}$  denotes the total variation distance between two probability measures.
Proof. Let  $p_U$  and  $p_U'$  denote the densities of  $P_U$  and  $P_U'$  w.r.t.  $\mu$ , and let  $p_{V|U}(\cdot | u)$  denote the density of  $P_{V|U=u} = P_{V|U=u}'$  w.r.t.  $\nu_u$ . From Scheffe's theorem [36][Lemma 2.1], we have that:
$$
\begin{array}{l} d _ {\mathrm {T V}} \left(P _ {U, V}, P _ {U, V} ^ {\prime}\right) = \frac {1}{2} \iint | p _ {U} (u) p _ {V \mid U} (v \mid u) - p _ {U} ^ {\prime} (u) p _ {V \mid U} (v \mid u) | d \nu_ {u} (v) d \mu (u) \\ = \frac {1}{2} \int \left(\int | p _ {V | U} (v \mid u) | d \nu_ {u} (v)\right) | p _ {U} (u) - p _ {U} ^ {\prime} (u) | d \mu (u) \\ = \frac {1}{2} \int \left(\int p _ {V | U} (v \mid u) d \nu_ {u} (v)\right) \left| p _ {U} (u) - p _ {U} ^ {\prime} (u) \right| d \mu (u) \\ = \frac {1}{2} \int | p _ {U} (u) - p _ {U} ^ {\prime} (u) | d \mu (u) \\ = d _ {\mathrm {T V}} \left(P _ {U}, P _ {U} ^ {\prime}\right) \\ \end{array}
$$
Lemma B.3. For all  $i\in [n]$  ,consider
$$
(\hat {\epsilon} _ {i}, \hat {\eta} _ {i})   |   \mathcal {D} _ {t r} ^ {(m)} \sim P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, (\epsilon_ {i}, \hat {\eta} _ {i})   |   \mathcal {D} _ {t r} ^ {(m)} \sim P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}}, (\hat {\epsilon} _ {i}, \eta_ {i})   |   \mathcal {D} _ {t r} ^ {(m)} \sim P _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}},
$$
where  $\hat{c}_i = \epsilon_i - \delta_{1,P}(Z_i) - \left(\hat{g}_1^{(m)}(Z_i) - g_{1,P}^* (Z_i)\right)$  and  $\hat{\eta}_i = \eta_i - \delta_{2,P}(Z_i) - \left(\hat{g}_2^{(m)}(Z_i) - g_{2,P}^* (Z_i)\right)$ .
Under Assumption A.7 and  $H_0:X\perp Y\mid Z$  , we have that
$$
\mathbb {E} _ {P} [ \varphi_ {\alpha} ^ {\mathrm {R E S I T}} (\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}) | \mathcal {D} _ {t r} ^ {(m)} ] \leq \alpha + \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\}
$$
Proof. Let us represent the stacked residuals (in matrix form) as  $(\hat{\epsilon},\hat{\eta}) = \{(\hat{\epsilon}_i,\hat{\eta}_i)\}_{i = 1}^n$ . See that
$$
\left(\left(\hat {\boldsymbol {\epsilon}}, \hat {\boldsymbol {\eta}}\right) ^ {(1)}, \dots , \left(\hat {\boldsymbol {\epsilon}}, \hat {\boldsymbol {\eta}}\right) ^ {(B)} \mid \left(\hat {\boldsymbol {\epsilon}}, \hat {\boldsymbol {\eta}}\right) = (\bar {\boldsymbol {\epsilon}}, \bar {\boldsymbol {\eta}}), \mathcal {D} _ {t r} ^ {(m)}\right) \stackrel {{d}} {{=}} \left(\left(\boldsymbol {\epsilon}, \hat {\boldsymbol {\eta}}\right) ^ {(1)}, \dots , \left(\boldsymbol {\epsilon}, \hat {\boldsymbol {\eta}}\right) ^ {(B)} \mid \left(\boldsymbol {\epsilon}, \hat {\boldsymbol {\eta}}\right) = (\bar {\boldsymbol {\epsilon}}, \bar {\boldsymbol {\eta}}), \mathcal {D} _ {t r} ^ {(m)}\right)
$$
Then, because the random quantities above are conditionally discrete, their distribution is dominated by a counting measure depending on  $(\bar{\epsilon},\bar{\eta})$ . Because the distribution of  $(\epsilon ,\eta)$  is absolutely continuous with respect to the Lebesgue measure,  $(\hat{\epsilon},\hat{\eta})\mid \mathcal{D}_{tr}^{(m)}$  and  $(\epsilon ,\hat{\eta})\mid \mathcal{D}_{tr}^{(m)}$  are also absolutely continuous20 for every training set configuration, and then we can apply Lemma B.2 to get that
$$
d _ {\mathrm {T V}} \bigg ((\hat {\pmb {\epsilon}}, \hat {\pmb {\eta}}), (\hat {\pmb {\epsilon}}, \hat {\pmb {\eta}}) ^ {(1)}, \dots , (\hat {\pmb {\epsilon}}, \hat {\pmb {\eta}}) ^ {(B)}) \mid \mathcal {D} _ {t r} ^ {(m)}, ((\pmb {\epsilon}, \hat {\pmb {\eta}}), (\pmb {\epsilon}, \hat {\pmb {\eta}}) ^ {(1)}, \dots , (\pmb {\epsilon}, \hat {\pmb {\eta}}) ^ {(B)}) \mid \mathcal {D} _ {t r} ^ {(m)} \bigg) = d _ {\mathrm {T V}} \bigg ((\hat {\pmb {\epsilon}}, \hat {\pmb {\eta}}) \mid \mathcal {D} _ {t r} ^ {(m)}, (\pmb {\epsilon}, \hat {\pmb {\eta}}) \mid \mathcal {D} _ {t r} ^ {(m)} \bigg).
$$
In the last step, we abuse TV distance notation: by the TV distance of two random variables, we mean the TV distance of their distributions.
Now, define the event
$$
A _ {\alpha} \triangleq \left\{\left((\boldsymbol {e}, \boldsymbol {h}), (\boldsymbol {e}, \boldsymbol {h}) ^ {(1)}, \dots , (\boldsymbol {e}, \boldsymbol {h}) ^ {(B)}\right): \frac {1 + \sum_ {b = 1} ^ {B} \mathbb {1} \left[ \Psi ((\boldsymbol {e} , \boldsymbol {h}) ^ {(b)}) \geq \Psi ((\boldsymbol {e} , \boldsymbol {h})) \right]}{1 + B} \leq \alpha \right\}
$$
By the definition of the TV distance, we have that (under  $H_0$ ):
$$
\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) \mid \mathcal {D} _ {t r} ^ {(m)} \right] = \mathbb {P} _ {P} \left(\left(\left(\hat {\boldsymbol {\epsilon}}, \hat {\boldsymbol {\eta}}\right), \left(\hat {\boldsymbol {\epsilon}}, \hat {\boldsymbol {\eta}}\right) ^ {(1)}, \dots , \left(\hat {\boldsymbol {\epsilon}}, \hat {\boldsymbol {\eta}}\right) ^ {(B)}\right) \in A _ {\alpha} \mid \mathcal {D} _ {t r} ^ {(m)}\right) \\ \leq \mathbb {P} _ {P} \left(\left((\boldsymbol {\epsilon}, \hat {\boldsymbol {\eta}}), (\boldsymbol {\epsilon}, \hat {\boldsymbol {\eta}}) ^ {(1)}, \dots , (\boldsymbol {\epsilon}, \hat {\boldsymbol {\eta}}) ^ {(B)}\right) \in A _ {\alpha} \mid \mathcal {D} _ {t r} ^ {(m)}\right) + d _ {\mathrm {T V}} \left(\left(\hat {\boldsymbol {\epsilon}}, \hat {\boldsymbol {\eta}}\right) \mid \mathcal {D} _ {t r} ^ {(m)}, (\boldsymbol {\epsilon}, \hat {\boldsymbol {\eta}}) \mid \mathcal {D} _ {t r} ^ {(m)}\right) \\ \leq \alpha + d _ {\mathrm {T V}} \left(\left(\hat {\boldsymbol {\epsilon}}, \hat {\boldsymbol {\eta}}\right) \mid \mathcal {D} _ {t r} ^ {(m)}, \left(\boldsymbol {\epsilon}, \hat {\boldsymbol {\eta}}\right) \mid \mathcal {D} _ {t r} ^ {(m)}\right) \\ = \alpha + 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) \\ \end{array}
$$
where the last equality holds from the fact that, given the training set, rows of  $(\hat{\epsilon},\hat{\eta})$  and  $(\epsilon ,\hat{\eta})$  are i.i.d.. See that  $\mathbb{P}_P\left((\pmb {\epsilon},\hat{\pmb{\eta}}),(\pmb {\epsilon},\hat{\pmb{\eta}})^{(1)},\dots ,(\pmb {\epsilon},\hat{\pmb{\eta}})^{(B)}\right)\in A_\alpha \mid \mathcal{D}_{tr}^{(m)})\leq \alpha$  because  $H_{0}$  holds and therefore  $\epsilon_i\perp \hat{\eta}_i\mid \mathcal{D}_{tr}^{(m)}$  (making the permuted samples exchangeable).
Using symmetry, we have that
$$
\mathbb {E} _ {P} [ \varphi_ {\alpha} ^ {\mathrm {R E S I T}} (\mathcal {D} _ {t e} ^ {(n)}, \mathcal {D} _ {t r} ^ {(m)}) | \mathcal {D} _ {t r} ^ {(m)} ] \leq \alpha + \min  \left\{d _ {\mathrm {T V}} \left(P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} ^ {n}, 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\}
$$
Lemma B.4. For any  $i\in [n]$  , consider that
$$
\left(\hat {\epsilon} _ {i}, \hat {\eta} _ {i}\right) \mid \mathcal {D} _ {t r} ^ {(m)} \sim P _ {\hat {\epsilon}, \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)},} \left(\epsilon_ {i}, \hat {\eta} _ {i}\right) \mid \mathcal {D} _ {t r} ^ {(m)} \sim P _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)},} \left(\hat {\epsilon} _ {i}, \eta_ {i}\right) \mid \mathcal {D} _ {t r} ^ {(m)} \sim P _ {\hat {\epsilon}, \eta | \mathcal {D} _ {t r} ^ {(m)}}
$$
$$
\left(\epsilon_ {i} ^ {*}, \eta_ {i} ^ {*}\right) \sim P _ {\epsilon^ {*}, \eta^ {*}}, \left(\epsilon_ {i}, \eta_ {i} ^ {*}\right) \sim P _ {\epsilon , \eta^ {*}}, \left(\epsilon_ {i} ^ {*}, \eta_ {i}\right) \sim P _ {\epsilon^ {*}, \eta}
$$
where  $\hat{\epsilon}_i = \epsilon_i - \delta_{1,P}(Z_i) - \left(\hat{g}_1^{(m)}(Z_i) - g_{1,P}^* (Z_i)\right),\epsilon_i^* = \epsilon_i - \delta_{1,P}(Z_i),\hat{\eta}_i = \eta_i - \delta_{2,P}(Z_i) -$ $\left(\hat{g}_2^{(m)}(Z_i) - g_{2,P}^* (Z_i)\right)$  , and  $\eta_i^* = \eta_i - \delta_{2,P}(Z_i)$  . Then, under  $H_0:X\perp Y\mid Z$  and Assumptions
20Given any training set configuration, the vectors  $(\hat{\epsilon}_i,\hat{\eta}_i)$ $(\epsilon_{i},\hat{\eta}_{i})$ $(\hat{\epsilon}_i,\eta_i)$  are given by the sum of two independent random vectors where at least one of them is continuous because of Assumption A.7 and therefore the sum must be continuous, e.g.,  $(\hat{\epsilon}_i,\hat{\eta}_i) = (\epsilon_i,\eta_i) + (g_{1,P}^* (Z_i) - \hat{g}_1^{(m)}(Z_i) - \delta_{1,P}(Z_i),g_{2,P}^* (Z_i) - \hat{g}_2^{(m)}(Z_i) - \delta_{2,P}(Z_i))$  . See Lemma B.4 for a proof.
A.6 and A.7, all six distributions are absolutely continuous with respect to the Lebesgue measure and their densities are 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]
$$
$$
p _ {\epsilon , \hat {\eta} | \mathcal {D} _ {t r} ^ {(m)}} (e, h | \mathcal {D} _ {t r} ^ {(m)}) = p _ {\epsilon} (e) \cdot \mathbb {E} _ {P} \left[ p _ {\eta} \left(h + \delta_ {2, P} (Z) + \hat {g} _ {2} ^ {(m)} (Z) - g _ {2, P} ^ {*} (Z)\right) | \mathcal {D} _ {t r} ^ {(m)} \right]
$$
$$
p _ {\hat {\epsilon}, \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) \mid \mathcal {D} _ {t r} ^ {(m)} \right] \cdot p _ {\eta} (h)
$$
$$
p _ {\epsilon^ {*}, \eta^ {*}} (e, h) = \mathbb {E} _ {P} \left[ p _ {\epsilon} \left(e + \delta_ {1, P} (Z)\right) p _ {\eta} \left(h + \delta_ {2, P} (Z)\right) \right]
$$
$$
p _ {\epsilon , \eta^ {*}} (e, h) = p _ {\epsilon} (e) \cdot \mathbb {E} _ {P} \left[ p _ {\eta} \left(h + \delta_ {2, P} (Z)\right) \right]
$$
$$
p _ {\epsilon^ {*}, \eta} (e, h) = \mathbb {E} _ {P} \left[ p _ {\epsilon} \left(e + \delta_ {1, P} (Z)\right) \right] \cdot p _ {\eta} (h)
$$
Additionally, we have that
$$
\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})
$$
$$
\sup  _ {(e, h) \in \mathbb {R} ^ {d _ {X}} \times d _ {Y}} \left(p _ {\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})
$$