SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
\tau_ {f ^ {\prime} \left(\uparrow_ {\mathcal {Z} _ {s + 1}} \left(u ^ {\prime}\right)\right), f ^ {\prime} \left(u ^ {\prime}\right)} \left(\mathcal {Z} _ {s + 1}, u ^ {\prime}\right) = \tau_ {f ^ {\prime} \left(u ^ {\prime \prime}\right), f ^ {\prime} \left(u ^ {\prime}\right)} \left(\mathcal {Z} _ {s + 1}, u ^ {\prime}\right) = \llbracket f ^ {\prime} \left(u ^ {\prime \prime}\right) = f (n \left(x _ {s + 1}\right)) \rrbracket \tag {37}
$$
Since, by the construction of  $\mathcal{Z}_{s+1}$ , we have  $\uparrow_{\mathcal{Z}_{s+1}}(u'') = \uparrow_{\mathcal{Z}_s}(u')$  and (as above) we have  $d(u'') = d(u')$ , we also have:
$$
\tau_ {f ^ {\prime} \left(\uparrow_ {\mathcal {Z} _ {s + 1}} \left(u ^ {\prime \prime}\right)\right), f ^ {\prime} \left(u ^ {\prime \prime}\right)} \left(\mathcal {Z} _ {s + 1}, u ^ {\prime \prime}\right) = \tau_ {f ^ {\prime} \left(\uparrow_ {\mathcal {Z} _ {s}} \left(u ^ {\prime}\right)\right), f ^ {\prime} \left(u ^ {\prime \prime}\right)} \left(\mathcal {Z} _ {s}, u ^ {\prime}\right) \tag {38}
$$
Since  $f'(u^*) = f(x_{s+1})$  and  $\uparrow_{\mathcal{Z}_{s+1}}(u^*) = u''$  we have:
$$
\tau_ {f ^ {\prime} \left(\uparrow_ {\mathcal {Z} _ {s + 1}} \left(u ^ {*}\right)\right), f ^ {\prime} \left(u ^ {*}\right)} \left(\mathcal {Z} _ {s + 1}, u ^ {*}\right) = \tau_ {f ^ {\prime} \left(u ^ {\prime \prime}\right), f \left(x _ {s + 1}\right)} \left(\mathcal {Z} _ {s + 1}, u ^ {*}\right) \tag {39}
$$
Now let:
$$
\zeta^ {*} := \tau_ {f (n (x _ {s + 1})), f (x _ {s + 1})} (\mathcal {Z} _ {s + 1}, u ^ {*}); \quad \zeta^ {\prime} := \tau_ {f ^ {\prime} (\uparrow_ {\mathcal {Z} _ {s}} (u ^ {\prime})), f (n (x _ {s + 1}))} (\mathcal {Z} _ {s}, u ^ {\prime})
$$
$$
g \left(f ^ {\prime}\right) := \prod_ {u \in \mathcal {Z} _ {s} \backslash \{r \left(\mathcal {Z} _ {s}\right) \}} \tau_ {f ^ {\prime} \left(\uparrow_ {\mathcal {Z} _ {s}} (u)\right), f ^ {\prime} (u)} \left(\mathcal {Z} _ {s}, u\right)
$$
$$
g ^ {\prime} \left(f ^ {\prime}\right) := \prod_ {u \in \mathcal {Z} _ {s + 1} \backslash \{r \left(\mathcal {Z} _ {s + 1}\right) \}} \tau_ {f ^ {\prime} \left(\uparrow_ {\mathcal {Z} _ {s + 1}} (u)\right), f ^ {\prime} (u)} \left(\mathcal {Z} _ {s + 1}, u\right)
$$
Combining equations (37), (38) and (39) gives us:
$$
\prod_ {u \in \{u ^ {*}, u ^ {\prime}, u ^ {\prime \prime} \}} \tau_ {f ^ {\prime} (\uparrow_ {\mathcal {Z} _ {s + 1}} (u)), f ^ {\prime} (u)} \left(\mathcal {Z} _ {s + 1}, u\right) = \llbracket f ^ {\prime} (u ^ {\prime \prime}) = f (n \left(x _ {s + 1}\right)) \rrbracket \zeta^ {*} \zeta^ {\prime} \tag {40}
$$
For all  $u \in \mathcal{Z}_{s+1} \setminus \{u^*, u', u''\}$  we have  $\uparrow_{\mathcal{Z}_{s+1}}(u) = \uparrow_{\mathcal{Z}_s}(u)$  so that:
$$
\tau_ {f ^ {\prime} \left(\uparrow_ {\mathcal {Z} _ {s + 1}} (u)\right), f ^ {\prime} (u)} \left(\mathcal {Z} _ {s + 1}, u\right) = \tau_ {f ^ {\prime} \left(\uparrow_ {\mathcal {Z} _ {s}} (u)\right), f ^ {\prime} (u)} \left(\mathcal {Z} _ {s}, u\right)
$$
and hence, since  $f(n(x_{s + 1})) = f'(u')$ , we have:
$$
g ^ {\prime} \left(f ^ {\prime}\right) = \frac {g \left(f ^ {\prime}\right)}{\zeta^ {\prime}} \prod_ {u \in \left\{u ^ {*}, u ^ {\prime}, u ^ {\prime \prime} \right\}} \tau_ {f ^ {\prime} \left(\uparrow_ {\mathcal {Z} _ {s + 1}} (u)\right), f ^ {\prime} (u)} \left(\mathcal {Z} _ {s + 1}, u\right)
$$
Substituting in Equation (40) gives us:
$$
g ^ {\prime} \left(f ^ {\prime}\right) = g \left(f ^ {\prime}\right) \llbracket f ^ {\prime} \left(u ^ {\prime \prime}\right) = f \left(n \left(x _ {s + 1}\right)\right) \rrbracket \zeta^ {*} \tag {41}
$$
We have  $\tilde{\kappa}_{f^{\prime}(u^{\prime \prime})}(\mathcal{Z}_{s + 1},\hat{\lambda}_{s + 1},u^{\prime \prime}) = 1$  and for all  $u\in \mathcal{Z}_s$  we have  $\tilde{\kappa}_{f^{\prime}(u)}(\mathcal{Z}_{s + 1},\hat{\lambda}_{s + 1},u) = \tilde{\kappa}_{f^{\prime}(u)}(\mathcal{Z}_s,\hat{\lambda}_s,u)$ . Substituting into Equation (41) gives us:
$$
\begin{array}{l} g ^ {\prime} (f ^ {\prime}) \prod_ {u \in \mathcal {Z} _ {s + 1}} \tilde {\kappa} _ {f ^ {\prime} (u)} (\mathcal {Z} _ {s + 1}, \hat {\lambda} _ {s + 1}, u) \\ = \llbracket f ^ {\prime} (u ^ {\prime \prime}) = f (n (x _ {s + 1})) \rrbracket \tilde {\kappa} _ {f ^ {\prime} (u ^ {*})} (\mathcal {Z} _ {s + 1}, \hat {\lambda} _ {s + 1}, u ^ {*}) \zeta^ {*} g (f ^ {\prime}) \prod_ {u \in \mathcal {Z} _ {s}} \tilde {\kappa} _ {f ^ {\prime} (u)} (\mathcal {Z} _ {s}, \hat {\lambda} _ {s}, u) \\ \end{array}
$$
Summing over all  $f' \in \mathcal{N}(f)$  and noting that  $f'(u^*) = f(x_{s+1})$  and that:
$$
\tilde {\kappa} _ {f ^ {\prime} (r (\mathcal {Z} _ {s + 1}))} (\mathcal {Z} _ {s + 1}, \hat {\lambda} _ {s + 1}, r (\mathcal {Z} _ {s + 1})) = 1 = \tilde {\kappa} _ {f ^ {\prime} (r (\mathcal {Z} _ {s}))} (\mathcal {Z} _ {s}, \hat {\lambda} _ {s}, r (\mathcal {Z} _ {s}))
$$
givess:
$$
\hat {\nu} (f) = \tilde {\kappa} _ {f (x _ {s + 1})} (\mathcal {Z} _ {s + 1}, \hat {\lambda} _ {s + 1}, u ^ {*}) \zeta^ {*} \hat {\nu} (f ^ {*})
$$
By the inductive hypothesis we then have:
$$
\hat {\nu} (f) = \tilde {\kappa} _ {f (x _ {s + 1})} (\mathcal {Z} _ {s + 1}, \hat {\lambda} _ {s + 1}, u ^ {*}) \zeta^ {*} \hat {w} (f ^ {*})
$$
which, by Equation (36), is equal to  $\hat{w}(f)$ . We have hence shown that if the inductive hypothesis holds for  $t = s$  then it holds for  $t = s + 1$  also. An identical argument shows that the inductive hypothesis holds for  $t = 2$ . We have hence shown that the inductive hypothesis holds for all  $t \in [T] \setminus \{1\}$ .
We now define a bijection  $\mathcal{G}:\{0,1\}^{\mathcal{X}}\to 2^{\mathcal{X}}$  by:
$$
\mathcal {G} (f) := \{x \in \mathcal {X} \mid f (x) = 1 \} \quad \forall f \in \{0, 1 \} ^ {\mathcal {X}}
$$
Note that for all  $f: \mathcal{X} \to \{0,1\}$  and all  $x \in \mathcal{X} \setminus \{x_1\}$  we have:
$$
\sigma (x, \mathcal {G} (f)) \epsilon + (1 - \sigma (x, \mathcal {G} (f))) (1 - \epsilon) = [   [ f (x) \neq f (n (x)) ]   ] \epsilon + [   [ f (x) = f (n (x)) ]   ] (1 - \epsilon)
$$
$$
\prod_ {x \in \mathcal {G} (f)} \lambda^ {\prime} (x) = \prod_ {t ^ {\prime} \in [ T ]: f \left(x _ {t ^ {\prime}}\right) = 1} \lambda^ {\prime} \left(x _ {t}\right)
$$
$$
\tilde {w} (\mathcal {J}, \lambda , \mathcal {G} (f)) = \hat {w} (f)
$$
and hence, by Lemma E.2, we have:
$$
\tilde {w} (\mathcal {J}, \lambda , \mathcal {G} (f)) = \hat {\nu} (f)
$$
$$
\sum_ {\mathcal {S} \in 2 ^ {\mathcal {X}}} [   [ \gamma (\hat {u}) \in \mathcal {S} ]   ] \tilde {w} (\lambda , \epsilon , \mathcal {S}) = \sum_ {f \in \{0, 1 \} ^ {\mathcal {X}}} [   [ f (\gamma (\hat {u})) = 1 ]   ] \hat {\nu} (f) \tag {42}
$$
Since:
$$
\bigcup \left\{\mathcal {N} (f) \mid f \in \{0, 1 \} ^ {\mathcal {X}}, f (\gamma (\hat {u})) = 1 \right\} = \left\{f ^ {\prime} \in \{0, 1 \} ^ {\mathcal {Z} _ {T}} \mid f ^ {\prime} (\hat {u}) = 1 \right\}
$$
and all sets in this union are disjoint, the right hand side of Equation (42) is equal to:
$$
\sum_ {f ^ {\prime} \in \{0, 1 \} ^ {\mathcal {Z} _ {T}}} [   [ f ^ {\prime} (\hat {u}) = 1 ]   ] \prod_ {u \in \mathcal {Z} _ {T} \backslash \{r (\mathcal {Z} _ {T}) \}} \tau_ {f ^ {\prime} (\uparrow_ {\mathcal {Z} _ {T}} (u)), f ^ {\prime} (u)} (\mathcal {Z} _ {T}, u) \tilde {\kappa} _ {f ^ {\prime} (u)} (\mathcal {Z} _ {T}, \hat {\lambda} _ {T}, u) \tag {43}
$$
Given a vertex  $u\in \mathcal{Z}_T\setminus \{r(\mathcal{Z}_T)\}$  define:
$$
\mathcal {H} (u) := \Downarrow_ {\mathcal {Z} _ {T}} (u) \cup \{\uparrow_ {\mathcal {Z} _ {T}} (u) \}
$$
and for all  $f:\mathcal{H}(u)\to \{0,1\}$  define:
$$
\hat {\zeta} (u, f) := \prod_ {u ^ {\prime} \in \Downarrow \mathcal {Z} _ {T} (u)} \tau_ {f (\uparrow_ {\mathcal {Z} _ {T}} (u ^ {\prime})), f (u ^ {\prime})} (\mathcal {Z} _ {T}, u ^ {\prime})
$$
Lemma E.3. Given a vertex  $u^{\prime}\in \mathcal{Z}_{T}\setminus \{r(\mathcal{Z}_{T})\}$  and an index  $i\in \{0,1\}$  we have:
$$
\sum_ {f \in \{0, 1 \} ^ {\mathcal {H} (u ^ {\prime})}} [   [ f (\uparrow_ {\mathcal {Z} _ {T}} (u ^ {\prime})) = i ]   ] \hat {\zeta} (u ^ {\prime}, f) = 1
$$
Proof. We prove by induction on the height of  $\Downarrow_{\mathcal{Z}_T}(u')$ . If this height is equal to zero then  $\mathcal{H}(u') = \{u', \uparrow_{\mathcal{Z}_T}(u')\}$  and for all  $f: \mathcal{H}(u) \to \{0, 1\}$  we have:
$$
\hat {\zeta} (u ^ {\prime}, f) = \tau_ {f (\uparrow_ {\mathcal {Z} _ {T}} (u ^ {\prime})), f (u ^ {\prime})} (\mathcal {Z} _ {T}, u ^ {\prime})
$$
$$
\tau_ {i, 0} \left(\mathcal {Z} _ {T}, u ^ {\prime}\right) + \tau_ {i, 1} \left(\mathcal {Z} _ {T}, u ^ {\prime}\right) = 1 \tag {44}
$$
we immediately have the result for the case that the height of  $\Downarrow_{\mathcal{Z}_T}(u')$  is zero. Now suppose that the result holds whenever the height of  $\Downarrow_{\mathcal{Z}_T}(u')$  is equal to  $j$  (for some  $j \in \mathbb{N}$ ). We will now show that it holds whenever the height of  $\Downarrow_{\mathcal{Z}_T}(u')$  is equal to  $j + 1$  which will prove that the result holds always. By the inductive hypothesis we have, for all  $i' \in \{0,1\}$ , that:
$$
\sum_ {f \in \{0, 1 \} ^ {\mathcal {H} (\triangleleft (u ^ {\prime}))}} [   [ f (u ^ {\prime}) = i ^ {\prime} ]   ] \hat {\zeta} (\triangleleft (u ^ {\prime}), f) = 1
$$
$$
\sum_ {f \in \{0, 1 \} ^ {\mathcal {H} (\triangleright (u ^ {\prime}))}} [   [ f (u ^ {\prime}) = i ^ {\prime} ]   ] \hat {\zeta} (\triangleright (u ^ {\prime}), f) = 1
$$
so:
$$
\sum_ {f \in \{0, 1 \} ^ {\mathcal {H} (u ^ {\prime})}} [   [ f (\uparrow_ {\mathcal {Z} _ {T}} (u ^ {\prime})) = i ]   ] [   [ f (u ^ {\prime}) = i ^ {\prime} ]   ] \hat {\zeta} (\triangleleft (u ^ {\prime}), f) \hat {\zeta} (\triangleright (u ^ {\prime}), f) = 1
$$
and hence:
$$
\sum_ {f \in \{0, 1 \} ^ {\mathcal {H} (u ^ {\prime})}} [   [ f (\uparrow_ {\mathcal {Z} _ {T}} (u ^ {\prime})) = i ]   ] [   [ f (u ^ {\prime}) = i ^ {\prime} ]   ] \hat {\zeta} (u ^ {\prime}, f) = \tau_ {i, i ^ {\prime}} (\mathcal {Z} _ {T}, u)
$$
Summing over  $i' \in \{0,1\}$  and noting Equation (44) then shows us the result holds for this case and hence, by induction, holds always.
Given  $u', u'' \in \mathcal{Z}_T$  with  $u'' \in \Downarrow_{\mathcal{Z}_T}(u')$  we define  $\hat{\mathcal{H}}(u', u'')$  to be the maximal subtree of  $\mathcal{Z}_T$  which has  $u'$  and  $u''$  as leaves. Given, in addition,  $f: \hat{\mathcal{H}}(u', u'') \to \{0,1\}$  we define:
$$
\tilde {\zeta} (u ^ {\prime}, u ^ {\prime \prime}, f) := \prod_ {u \in \hat {\mathcal {H}} (u ^ {\prime}, u ^ {\prime \prime}) \backslash \{u ^ {\prime} \}} \tau_ {f (\uparrow_ {\mathcal {Z} _ {T}} (u)), f (u)} (\mathcal {Z} _ {T}, u)
$$
$$
\delta \left(u ^ {\prime}, u ^ {\prime \prime}\right) := d \left(u ^ {\prime \prime}\right) - d \left(u ^ {\prime}\right)
$$
We now have the following lemma.
Lemma E.4. Given  $u^{\prime},u^{\prime \prime}\in \mathcal{Z}_{T}$  with  $u^{\prime \prime}\in \Downarrow_{\mathcal{Z}_t}(u')\setminus \{u'\}$  and indices  $i^{\prime},i^{\prime \prime}\in \{0,1\}$  we have that:
$$
\sum_ {f \in \{0, 1 \} ^ {\tilde {\mathcal {H}} (u ^ {\prime}, u ^ {\prime \prime})}} [   [ f (u ^ {\prime}) = i ^ {\prime} ]   ] [   [ f (u ^ {\prime \prime}) = i ^ {\prime \prime} ]   ] \tilde {\zeta} (u ^ {\prime}, u ^ {\prime \prime}, f)
$$
$$
\llbracket i ^ {\prime} \neq i ^ {\prime \prime} \rrbracket \phi_ {\delta (u ^ {\prime}, u ^ {\prime \prime})} + \llbracket i ^ {\prime} = i ^ {\prime \prime} \rrbracket (1 - \phi_ {\delta (u ^ {\prime}, u ^ {\prime \prime})})
$$
Proof. We prove by induction on the distance from  $u'$  to  $u''$  in  $\mathcal{Z}_T$ . If this distance is one then we have  $u' = \uparrow_{\mathcal{Z}_T}(u'')$  and  $\hat{\mathcal{H}}(u', u'') = \{u', u''\}$  so we have:
$$
\sum_ {f \in \{0, 1 \} ^ {\mathcal {H} (u ^ {\prime}, u ^ {\prime \prime})}} [   [ f (u ^ {\prime}) = i ^ {\prime} ]   ] [   [ f (u ^ {\prime \prime}) = i ^ {\prime \prime} ]   ] \tilde {\zeta} (u ^ {\prime}, u ^ {\prime \prime}, f) = \tau_ {i ^ {\prime}, i ^ {\prime \prime}} (\mathcal {Z} _ {T}, u ^ {\prime \prime})
$$
which immediately implies that the inductive hypothesis holds in this case. Now suppose that the inductive hypothesis holds whenever the distance from  $u'$  to  $u''$  is  $j$ . We now consider the case
that the distance from  $u'$  to  $u''$  is  $j + 1$ . Let  $u^*$  be the child of  $u'$  that lies in  $\hat{\mathcal{H}}(u', u'')$ . Without loss of generality assume that  $u''$  is a descendant of  $\triangleleft(u^*)$ . Now choose any  $i^* \in \{0,1\}$ . Given  $f: \hat{\mathcal{H}}(u', u'') \to \{0,1\}$  let:
$$
h \left(i ^ {*}, f\right) = \llbracket f \left(u ^ {\prime}\right) = i ^ {\prime} \rrbracket \llbracket f \left(u ^ {\prime \prime}\right) = i ^ {\prime \prime} \rrbracket \llbracket f \left(u ^ {*}\right) = i ^ {*} \rrbracket
$$
and let  $f'$  and  $f''$  be the restriction of  $f$  onto the sets  $\tilde{\mathcal{H}}(u^*, u'')$  and  $\mathcal{H}(\triangleright(u^*))$  respectively. Note that
$$
\tilde {\zeta} \left(u ^ {\prime}, u ^ {\prime \prime}, f\right) = \tau_ {f \left(u ^ {\prime}\right), f \left(u ^ {*}\right)} \left(\mathcal {Z} _ {T}, u ^ {*}\right) \tilde {\zeta} \left(u ^ {*}, u ^ {\prime \prime}, f ^ {\prime}\right) \hat {\zeta} \left(\triangleright \left(u ^ {*}\right), f ^ {\prime \prime}\right)
$$
By Lemma E.3 and the inductive hypothesis we then have that the quantity:
$$
\sum_ {f \in \{0, 1 \} ^ {\tilde {\mathcal {H}} (u ^ {\prime}, u ^ {\prime \prime})}} h (i ^ {*}, f) \tilde {\zeta} (u ^ {\prime}, u ^ {\prime \prime}, f)
$$
is equal to the quantity:
$$
\tau_ {i ^ {\prime}, i ^ {*}} \left(\mathcal {Z} _ {T}, u ^ {*}\right) \left(\llbracket i ^ {*} \neq i ^ {\prime \prime} \rrbracket \phi_ {\delta \left(u ^ {*}, u ^ {\prime \prime}\right)} + \llbracket i ^ {*} = i ^ {\prime \prime} \rrbracket \left(1 - \phi_ {\delta \left(u ^ {*}, u ^ {\prime \prime}\right)}\right)\right)
$$
Summing over  $i^{*} \in \{0,1\}$  gives us the result. We have hence proved the result in general.
Suppose we have some  $f:\mathcal{J}\to \{0,1\}$  .Let:
$$
\hat {\mathcal {F}} (f) := \left\{f ^ {\prime} \in \{0, 1 \} ^ {\mathcal {Z} _ {T}} \mid \forall u \in \mathcal {J}, f ^ {\prime} (u) = f (u) \right\}
$$
Given  $u\in \mathcal{I}$  we have that:
$$
\llbracket f (\uparrow_ {\mathcal {J}} (u)) \neq f (u) \rrbracket \phi_ {\delta (\uparrow_ {\mathcal {J}} (u), u)} + \llbracket f (\uparrow_ {\mathcal {J}} (u)) = f (u) \rrbracket (1 - \phi_ {\delta (\uparrow_ {\mathcal {J}} (u), u)})
$$
is equal to  $\tau_{f(\uparrow_{\mathcal{I}}(u)),f(u)}(\mathcal{J},u)$  and hence Lemma E.4 implies that:
$$
\sum_ {f ^ {\prime} \in \tilde {\mathcal {H}} (\uparrow_ {\mathcal {J}} (u), u)} [   [ f ^ {\prime} (\uparrow_ {\mathcal {J}} (u)) = f (\uparrow_ {\mathcal {J}} (u)) ]   ] [   [ f ^ {\prime} (u) = f (u) ]   ] \tilde {\zeta} (\uparrow_ {\mathcal {J}} (u), u, f ^ {\prime}) = \tau_ {f (\uparrow_ {\mathcal {J}} (u)), f (u)} (\mathcal {J}, u)
$$
so since, by the definition of a contraction, the edge sets of the subtrees in  $\{\hat{\mathcal{H}} (\uparrow_{\mathcal{I}}(u),u)\mid u\in \mathcal{J}\setminus \{r(\mathcal{I})\} \}$  partition the edge set of  $\mathcal{Z}_T$  we have, by definition of  $\tilde{\zeta}$ , that:
$$
\sum_ {f ^ {\prime} \in \hat {\mathcal {F}} (f)} \prod_ {u \in \mathcal {Z} _ {T} \backslash \{r (\mathcal {Z} _ {T}) \}} \tau_ {f ^ {\prime} (\uparrow_ {\mathcal {Z} _ {T}} (u)), f ^ {\prime} (u)} (\mathcal {Z} _ {T}, u) = \prod_ {u \in \mathcal {J} \backslash \{r (\mathcal {J}) \}} \tau_ {f (\uparrow_ {\mathcal {J}} (u)), f (u)} (\mathcal {J}, u)
$$
Since for all  $f' \in \hat{\mathcal{F}}(f)$  and for all  $u \in \mathcal{Z}_T \setminus \mathcal{J}$  we have  $\tilde{\kappa}_{f'(u)}(\mathcal{Z}_T, \hat{\lambda}_T, u) = 1$  we have now shown that the quantity:
$$
\sum_ {f ^ {\prime} \in \hat {\mathcal {F}} (f)} \prod_ {u \in \mathcal {Z} _ {T} \backslash \{r (\mathcal {Z} _ {T}) \}} \tau_ {f ^ {\prime} (\uparrow_ {\mathcal {Z} _ {T}} (u)), f ^ {\prime} (u)} (\mathcal {Z} _ {T}, u) \tilde {\kappa} _ {f ^ {\prime} (u)} (\mathcal {Z} _ {T}, \hat {\lambda} _ {T}, u)
$$
$$
\prod_ {u \in \mathcal {J} \backslash \{r (\mathcal {J}) \}} \tau_ {f (\uparrow_ {\mathcal {J}} (u)), f (u)} (\mathcal {J}, u) \tilde {\kappa} _ {f (u)} (\mathcal {Z} _ {T}, \hat {\lambda} _ {T}, u)
$$
Summing over all  $f\in \mathcal{F}(\mathcal{I},\hat{u})$  and noting Equations (42) and (43) gives us the result.
E.7 Theorem D.1
Lemma E.5. Given  $u, u' \in \mathcal{Z}_t$  the algorithm for computing  $\nu(u, u')$  is correct.
Proof. If  $u = u'$  then the proof is trivial. Otherwise we consider the following cases:
- Consider first the case that  $\hat{s} \neq \nabla(s^{*})$ . Without loss of generality assume  $\hat{s} = \triangleleft(s^{*})$ . Then we have  $u \in \downarrow (\triangleleft(\xi(s^{*}))$  and since  $\hat{s}' \neq \triangleleft(s^{*})$  we have  $u' \notin \downarrow (\triangleleft(\xi(s^{*})))$ . Hence  $u' \notin \downarrow(u)$  so  $\nu(u, u') = \triangleleft$  as required.
- If  $u = \xi(s^*)$  then  $\hat{s} = \nabla(s^*)$  so either  $\hat{s}' = \triangleleft(s^*)$  or  $\hat{s}' = \triangleright(s^*)$ . In the former case we have  $u' \in \Downarrow(\triangleleft(\xi(s^*)) = \Downarrow(\triangleleft(u))$  so that  $\nu(u, u') = \triangleleft$  and similarly in the later case we have  $\nu(u, u') = \triangleright$  as required.
- If  $\hat{s} = \nabla(s^{*})$  and  $u \neq \xi(s^{*})$  then we invoke the process. Consider the vertex  $s$  at any stage in the process. By induction we have that if  $s \in \mathcal{E}^{\bullet}$  then  $u' \in \Downarrow(\mu'(s))$ . This is because if  $s \in \mathcal{E}^{\bullet}$  then  $\mu'(s)$  is an ancestor of  $\mu'(\uparrow_{\mathcal{E}}(s))$ . This further implies that when  $s \neq \hat{s}$  we have  $u' \in \Downarrow(\mu'(\uparrow_{\mathcal{E}}(s)))$ . Now suppose that  $s \in \mathcal{E}^{\circ}$  and without loss of generality assume  $s = \triangleleft(\uparrow_{\mathcal{E}}(s))$ . Then  $u \in \Downarrow(\triangleleft(\xi(\uparrow_{\mathcal{E}}(s))))$  and  $\mu'(\uparrow_{\mathcal{E}}(s)) \in \Downarrow(\triangleright(\xi(\uparrow_{\mathcal{E}}(s))))$  so that, since  $u' \in \Downarrow(\mu'(\uparrow_{\mathcal{E}}(s)))$ , we have  $u' \notin \Downarrow(u)$  and hence  $\nu(u, u') = \triangleleft$  as required. Suppose now that  $s \in \mathcal{E}^{\bullet}$  and that  $u = \xi(s)$ . If  $\triangleleft(s) \in \mathcal{E}^{\bullet}$  then we have  $\mu'(s) \in \Downarrow(\triangleleft(\xi(s))) = \Downarrow(\triangleleft(u))$  so that, by above,  $u' \in \Downarrow(\triangleleft(u))$  and hence  $\nu(u, u') = \triangleleft$  as required. Similarly, if  $\triangleright(s) \in \mathcal{E}^{\bullet}$  then  $\nu(u, u') = \triangleright$  as required. This completes the proof.
Lemma E.6. The algorithm correctly finds  $\hat{u}$ .
Proof. By induction on the depth of  $s$  we have, for all vertices  $s$  in the constructed path, that:
- If  $s \in \mathcal{D}^\circ$  then  $u_t$  lies in the maximal subtree of  $\mathcal{Z}_t$  containing  $\mu(s)$  and having  $\uparrow_{\mathcal{I}}(\mu(s))$  as a leaf.
- If  $s \in \mathcal{D}^{\bullet}$  then  $u_{t}$  lies in the maximal subtree of  $\mathcal{Z}_{t}$  with  $\uparrow_{\mathcal{J}}(\mu(s))$  and  $\mu'(s)$  as leaves.
Let  $s'$  be the unique leaf of  $\mathcal{D}$  that is on the constructed path. If  $s' \in \mathcal{D}^\circ$  then  $\mu(s')$  is a leaf of  $\mathcal{J}$  and hence also a leaf of  $\mathcal{Z}_t$ . So by above we have that  $u_t$  lies in the maximal subtree of  $\mathcal{Z}_t$  with  $\uparrow_{\mathcal{J}}(\mu(s'))$  and  $\mu(s')$  as leaves. If, on the other hand,  $s' \in \mathcal{D}^\bullet$  then since  $s'$  is a leaf of  $\mathcal{D}$  we have that  $\mu(s') = \mu'(s')$  and hence, by above, we have that  $u_t$  lies in the maximal subtree of  $\mathcal{Z}_t$  with  $\uparrow_{\mathcal{J}}(\mu(s'))$  and  $\mu(s')$  as leaves. In either case we have  $\hat{u} = \mu(s')$  as required.
Lemma E.7. The algorithm correctly finds  $u^{*}$ .
- If  $s \in \mathcal{E}^\circ$  then  $\Gamma_{\mathcal{Z}_t}(u_t, \hat{u})$  lies in  $\downarrow_{\mathcal{Z}_t}(\mu(s))$ .
- If  $s \in \mathcal{E}^{\bullet}$  then  $\Gamma_{\mathcal{Z}_t}(u_t, \hat{u})$  lies in the maximal subtree of  $\mathcal{Z}_t$  with  $\mu(s)$  and  $\mu'(s)$  as leaves.
Let  $s'$  be the unique leaf of  $\mathcal{E}$  that is on the constructed path. If  $s' \in \mathcal{E}^\circ$  then  $\mu(s')$  is a leaf of  $\mathcal{Z}_t$  and hence, by above,  $\Gamma_{\mathcal{Z}_t}(u_t, \hat{u}) = \mu(s')$  as required. If  $s \in \mathcal{E}^\bullet$  then  $\mu(s) = \mu'(s)$  and hence, by above,  $\Gamma_{\mathcal{Z}_t}(u_t, \hat{u}) = \mu(s')$  as required.