SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Case 1 Assume  $D_B \pmb{f}_i(\pmb{z}_0) \neq \mathbf{0}$ . By continuity of  $D_B \pmb{f}_i$ , there exists an open neighborhood of  $\pmb{z}_0$ ,  $U$ , s.t. for all  $\pmb{z} \in U$ ,  $D_B \pmb{f}_i(\pmb{z}) \neq \mathbf{0}$ . By compositionality, this means that, for all  $\pmb{z} \in U$ ,  $D_{B^c} \pmb{f}_i(\pmb{z}) = \mathbf{0}$ . When a function is zero on an open set, its derivative must also be zero, hence  $DD_{B^c} \pmb{f}_i(\pmb{z}_0) = \mathbf{0}$ . Because  $\pmb{f}$  is  $C^2$ , the Hessian is symmetric so that we also have  $D_{B^c}D\pmb{f}_i(\pmb{z}_0) = \mathbf{0}$ . We can thus conclude that the Hessian  $D^{2}\pmb{f}_{i}(\pmb{z}_{0})$  is such that all entries are zero except possibly for  $D^{2}\pmb{f}_{i}(\pmb{z}_{0})_{B,B}$ . Hence,  $D^{2}\pmb{f}_{i}(\pmb{z}_{0})$  is block diagonal with blocks in  $B$ .
Case 2: Assume  $D_B \pmb{f}_i(\pmb{z}_0) = \mathbf{0}$ . This means the whole row of the Jacobian is zero, i.e.  $D\pmb{f}_i(\pmb{z}_0) = \mathbf{0}$ . By continuity of  $D\pmb{f}_i$ , we have that the set  $V := (D\pmb{f}_i)^{-1}(\{0\})$  is closed. Thus this set decomposes as  $V = V^{\circ} \cup \partial V$  where  $V^{\circ}$  and  $\partial V$  are the interior and boundary of  $V$ , respectively.
Case 2.1: Suppose  $\mathbf{z}_0 \in V^\circ$ . Then we can take a derivative so that  $D^2 \mathbf{f}_i(\mathbf{z}_0) = \mathbf{0}$ , which of course means that  $D^2 \mathbf{f}_i(\mathbf{z}_0)$  is diagonal.
Case 2.2: Suppose  $\mathbf{z}_0 \in \partial V$ . By the definition of boundary, for all open set  $U$  containing  $\mathbf{z}_0$ ,  $U$  intersects with the complement of  $V$ , i.e.  $(D\mathbf{f}_i)^{-1}(\mathbb{R}^{d_z} \setminus \{0\})$ . This means we can construct a sequence  $\{z_k\}_{k=1}^{\infty} \subseteq V^c$  which converges to  $\mathbf{z}_0$ . By Case 1, we have that for all  $k \geq 1$ ,  $D^2\mathbf{f}_i(\mathbf{z}_k)$  is block diagonal. This means that  $\lim_{k \to \infty} D^2\mathbf{f}_i(\mathbf{z}_k)$  is block diagonal. Moreover, by continuity of  $D^2\mathbf{f}_i$ , we have that  $\lim_{k \to \infty} D^2\mathbf{f}_i(\mathbf{z}_k) = D^2\mathbf{f}_i(\mathbf{z}_0)$ . Hence  $D^2\mathbf{f}_i(\mathbf{z}_0)$  is block diagonal.
We showed that for all  $\mathbf{z}_0 \in \mathbb{R}^{d_z}$ ,  $D^2\mathbf{f}_i(\mathbf{z}_0)$  is block diagonal. Hence,  $\mathbf{f}$  is additive by Proposition 7.
A.4 Examples of local but non-global disentanglement
In this section, we provide examples of mapping  $\pmb{v} : \hat{\mathcal{Z}}^{\mathrm{train}} \to \mathcal{Z}^{\mathrm{train}}$  that satisfy the local disentanglement property of Definition 4, but not the global disentanglement property of Definition 3. Note that these notions are defined for pairs of decoders  $\pmb{f}$  and  $\hat{\pmb{f}}$ , but here we construct directly the function  $\pmb{v}$  which is usually defined as  $f^{-1} \circ \hat{f}$ . However, given  $\pmb{v}$  we can always define  $\pmb{f}$  and  $\hat{\pmb{f}}$  to be such that  $f^{-1} \circ \hat{f} = \pmb{v}$ : Simply take  $\pmb{f}(\pmb{z}) := [z_1, \dots, z_{d_z}, 0, \dots, 0]^\top \in \mathbb{R}^{d_x}$  and  $\hat{\pmb{f}} := \pmb{f} \circ \pmb{v}$ . This construction however yields a decoder  $\pmb{f}$  that is not sufficiently nonlinear (Assumption 2). Clearly the mappings  $\pmb{v}$  that we provide in the following examples cannot be written as compositions of decoders  $f^{-1} \circ \hat{f}$  where  $\pmb{f}$  and  $\hat{\pmb{f}}$  satisfy all assumptions of Theorem 2, as this would contradict the theorem. In Examples 5 & 6, the path-connected assumption of Theorem 2 is violated. In Example 7, it is less obvious to see which assumptions would be violated.
Example 5 (Disconnected support with changing permutation). Let  $\pmb{v}:\hat{\mathcal{Z}}\to \mathbb{R}^2$  s.t.  $\hat{\mathcal{Z}} = \hat{\mathcal{Z}}^{(1)}\cup$ $\hat{\mathcal{Z}}^{(2)}\subseteq \mathbb{R}^2$  where  $\hat{\mathcal{Z}}^{(1)} = \{z\in \mathbb{R}^2\mid z_1\leq 0$  and  $z_{2}\leq 0\}$  and  $\hat{\mathcal{Z}}^{(2)} = \{z\in \mathbb{R}^2\mid z_1\geq 1$  and  $z_{2}\geq$  1}. Assume
$$
\boldsymbol {v} (\boldsymbol {z}) := \left\{ \begin{array}{l l} \left(\boldsymbol {z} _ {1}, \boldsymbol {z} _ {2}\right), & i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(1)} \\ \left(\boldsymbol {z} _ {2}, \boldsymbol {z} _ {1}\right), & i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(2)} \end{array} . \right. \tag {31}
$$
Step 1:  $\pmb{v}$  is a diffeomorphism. Note that  $\pmb{v}$  is its own inverse. Indeed,
$$
\boldsymbol {v} (\boldsymbol {v} (\boldsymbol {z})) = \left\{ \begin{array}{l l} \boldsymbol {v} (\boldsymbol {z} _ {1}, \boldsymbol {z} _ {2}) = (\boldsymbol {z} _ {1}, \boldsymbol {z} _ {2}), & i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(1)} \\ \boldsymbol {v} (\boldsymbol {z} _ {2}, \boldsymbol {z} _ {1}) = (\boldsymbol {z} _ {1}, \boldsymbol {z} _ {2}), & i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(2)} \end{array} \right..
$$
Thus,  $\pmb{v}$  is bijective on its image. Clearly,  $\pmb{v}$  is  $C^2$ , thus  $\pmb{v}^{-1} = \pmb{v}$  is also  $C^2$ . Hence,  $\pmb{v}$  is a  $C^2$ -diffeomorphism.
Step 2:  $\pmb{v}$  is locally disentangled. The Jacobian of  $\pmb{v}$  is given by
$$
D \boldsymbol {v} (\boldsymbol {z}) := \left\{ \begin{array}{l l} \left[ \begin{array}{l l} 1 & 0 \\ 0 & 1 \end{array} \right], & i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(1)} \\ \left[ \begin{array}{l l} 0 & 1 \\ 1 & 0 \end{array} \right], & i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(2)} \end{array} , \right. \tag {32}
$$
Figure 6: Illustration of  $\hat{\mathcal{Z}} = \hat{\mathcal{Z}}^{(b)}\cup \hat{\mathcal{Z}}^{(o)}$  in Example 7 where  $\hat{\mathcal{Z}}^{(b)}$  is the blue region and  $\hat{\mathcal{Z}}^{(o)}$  is the orange region. The two black dots correspond to  $(-1 / 2, - 1 / 2)$  and  $(1 / 2, - 1 / 2)$ , where the function  $v_{2}(z_{1},z_{2})$  is evaluated to show that it is not constant in  $z_{1}$ .
which is everywhere a permutation matrix, hence  $\pmb{v}$  is locally disentangled.
Step 3:  $\mathbf{v}$  is not globally disentangled. That is because  $\mathbf{v}_1(\mathbf{z}_1, \mathbf{z}_2)$  depends on both  $\mathbf{z}_1$  and  $\mathbf{z}_2$ . Indeed, if  $\mathbf{z}_2 = 0$ , we have that  $\mathbf{v}_1(-1, 0) = -1 \neq 0 = \mathbf{v}_1(0, 0)$ . Also, if  $\mathbf{z}_1 = 1$ , we have that  $\mathbf{v}_1(1, 1) = 1 \neq 2 = \mathbf{v}_1(1, 2)$ .
Example 6 (Disconnected support with fixed permutation). Let  $\pmb{v}:\hat{\mathcal{Z}}\to \mathbb{R}^2$  s.t.  $\hat{\mathcal{Z}} = \hat{\mathcal{Z}}^{(1)}\cup$ $\hat{\mathcal{Z}}^{(2)}\subseteq \mathbb{R}^2$  where  $\hat{\mathcal{Z}}^{(1)} = \{\pmb {z}\in \mathbb{R}^2\mid z_2\leq 0\}$  and  $\hat{\mathcal{Z}}^{(2)} = \{\pmb {z}\in \mathbb{R}^2\mid z_2\geq 1\}$ . Assume  $\pmb {v}(\pmb {z}):= \pmb {z} + \mathbb{1}(\pmb {z}\in \hat{\mathcal{Z}}^{(2)})$
Step 1:  $\pmb{v}$  is a diffeomorphism. The image of  $\pmb{v}$  is the union of the following two sets:  $\mathcal{Z}^{(1)} := \pmb{v}(\hat{\mathcal{Z}}^{(1)}) = \hat{\mathcal{Z}}^{(1)}$  and  $\mathcal{Z}^{(2)} := \pmb{v}(\hat{\mathcal{Z}}^{(2)}) = \{z \in \mathbb{R}^2 \mid z_2 \geq 2\}$ . Consider the map  $\pmb{w}: \mathcal{Z}^{(1)} \cup \mathcal{Z}^{(2)} \to \hat{\mathcal{Z}}$  defined as  $\pmb{w}(\pmb{z}) := \pmb{z} - \mathbb{1}(\pmb{z} \in \mathcal{Z}^{(2)})$ . We now show that  $\pmb{w}$  is the inverse of  $\pmb{v}$ :
$$
\begin{array}{l} \boldsymbol {w} (\boldsymbol {v} (\boldsymbol {z})) = \boldsymbol {v} (\boldsymbol {z}) - \mathbb {1} (\boldsymbol {v} (\boldsymbol {z}) \in \mathcal {Z} ^ {(2)}) (33) \\ = \boldsymbol {z} + \mathbb {1} (\boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(2)}) - \mathbb {1} (\boldsymbol {z} + \mathbb {1} (\boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(2)}) \in \mathcal {Z} ^ {(2)}). (34) \\ \end{array}
$$
If  $\mathbf{z} \in \hat{\mathcal{Z}}^{(2)}$ , we have
$$
\begin{array}{l} \boldsymbol {w} (\boldsymbol {v} (\boldsymbol {z})) = \boldsymbol {z} + \mathbb {1} - \mathbb {1} (\boldsymbol {z} + \mathbb {1} \in \mathcal {Z} ^ {(2)}) (35) \\ = z + \mathbb {1} - \mathbb {1} (z \in \hat {\mathcal {Z}} ^ {(2)}) = z. (36) \\ \end{array}
$$
If  $\mathbf{z} \in \hat{\mathcal{Z}}^{(1)}$ , we have
$$
\boldsymbol {w} (\boldsymbol {v} (\boldsymbol {z})) = \boldsymbol {z} - \mathbb {1} (\boldsymbol {z} \in \mathcal {Z} ^ {(2)}) = \boldsymbol {z}. \tag {37}
$$
A similar argument can be made to show that  $\pmb{v}(\pmb{w}(\pmb{z})) = \pmb{z}$ . Thus  $\pmb{w}$  is the inverse of  $\pmb{v}$ . Both  $\pmb{v}$  and its inverse  $\pmb{w}$  are  $C^2$ , thus  $\pmb{v}$  is a  $C^2$ -diffeomorphism on its image.
Step 2:  $v$  is locally disentangled. This is clear since  $Dv(z) = I$  everywhere.
Step 3:  $\pmb{v}$  is not globally disentangled. Indeed, the function  $v_{1}(z_{1},z_{2}) = z_{1} + \mathbb{1}(z\in \hat{\mathcal{Z}}^{(2)})$  is not constant in  $z_{2}$ .
Example 7 (Connected support). Let  $\mathbf{v}:\hat{\mathcal{Z}}\to \mathbb{R}^2$  s.t.  $\hat{\mathcal{Z}} = \hat{\mathcal{Z}}^{(b)}\cup \hat{\mathcal{Z}}^{(o)}$  where  $\hat{\mathcal{Z}}^{(b)}$  and  $\hat{\mathcal{Z}}^{(o)}$  are respectively the blue and orange regions of Figure 6. Both regions contain their boundaries. The function  $\mathbf{v}$  is defined as follows:
$$
\boldsymbol {v} _ {1} (\boldsymbol {z}) := \boldsymbol {z} _ {1} \tag {38}
$$
$$
\boldsymbol {v} _ {2} (\boldsymbol {z}) := \left\{ \begin{array}{l l} \frac {\left(\boldsymbol {z} _ {2} + 1\right) ^ {2} + 1}{2}, & i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(b)} \\ e ^ {\boldsymbol {z} _ {2}}, & i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(o)} \end{array} . \right. \tag {39}
$$
Step 1:  $\pmb{v}$  is a diffeomorphism. Clearly,  $\pmb{v}_1$  is  $C^2$ . To show that  $\pmb{v}_2$  also is, we must verify that  $\pmb{v}_2(\pmb{z})$  is  $C^2$  at the frontier between  $\hat{\mathcal{Z}}^{(b)}$  and  $\hat{\mathcal{Z}}^{(o)}$ , i.e. when  $\pmb{z} \in [1/4, 1] \times \{0\}$ .
$v_{2}(z)$  is continuous since
$$
\left. \frac {\left(z _ {2} + 1\right) ^ {2} + 1}{2} \right| _ {z _ {2} = 0} = 1 = \left. e ^ {z _ {2}} \right| _ {z _ {2} = 0}. \tag {40}
$$
$\pmb{v}_2(\pmb{z})$  is  $C^1$  since
$$
\left. \left(\frac {\left(z _ {2} + 1\right) ^ {2} + 1}{2}\right) ^ {\prime} \right| _ {z _ {2} = 0} = \left(z _ {2} + 1\right) | _ {z _ {2} = 0} = 1 = e ^ {z _ {2}} | _ {z _ {2} = 0} = \left(e ^ {z _ {2}}\right) ^ {\prime} | _ {z _ {2} = 0}. \tag {41}
$$
$\pmb{v}_2(\pmb{z})$  is  $C^2$  since
$$
\left. \left(\frac {\left(z _ {2} + 1\right) ^ {2} + 1}{2}\right) ^ {\prime \prime} \right| _ {z _ {2} = 0} = 1 | _ {z _ {2} = 0} = 1 = e ^ {z _ {2}} | _ {z _ {2} = 0} = \left(e ^ {z _ {2}}\right) ^ {\prime \prime} | _ {z _ {2} = 0}. \tag {42}
$$
We will now find an explicit expression for the inverse of  $\pmb{v}$ . Define
$$
\boldsymbol {w} _ {1} (\boldsymbol {z}) := \boldsymbol {z} _ {1} \tag {43}
$$
$$
\boldsymbol {w} _ {2} (\boldsymbol {z}) := \left\{ \begin{array}{l l} \sqrt {2 \boldsymbol {z} _ {2} - 1} - 1, & i f \boldsymbol {z} \in \boldsymbol {v} \left(\hat {\mathcal {Z}} ^ {(b)}\right) \\ \log \left(\boldsymbol {z} _ {2}\right), & i f \boldsymbol {z} \in \boldsymbol {v} \left(\hat {\mathcal {Z}} ^ {(o)}\right) \end{array} . \right. \tag {44}
$$
It is straightforward to see that  $\pmb{w}(\pmb{v}(\pmb{z})) = \pmb{z}$  for all  $\pmb{z} \in \hat{\mathcal{Z}}$ . One can also show that  $\pmb{w}$  is  $C^2$  at the boundary between both regions  $\pmb{v}(\hat{\mathcal{Z}}^{(b)})$  and  $\pmb{v}(\hat{\mathcal{Z}}^{(o)})$ , i.e. when  $\pmb{z} \in [1/4, 1] \times \{1\}$ .
Since both  $\mathbf{v}$  and its inverse  $\mathbf{w}$  are  $C^2$ ,  $\mathbf{v}$  is a  $C^2$ -diffeomorphism.
Step 2:  $\pmb{v}$  is locally disentangled. The Jacobian of  $\pmb{v}$  is
$$
D \boldsymbol {v} (\boldsymbol {z}) := \left\{ \begin{array}{l l} \left[ \begin{array}{c c} 1 & 0 \\ 0 & \boldsymbol {z} _ {2} + 1 \end{array} \right], i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(b)} \\ \left[ \begin{array}{c c} 1 & 0 \\ 0 & e ^ {\boldsymbol {z} _ {2}} \end{array} \right], i f \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {(o)} \end{array} , \right. \tag {45}
$$
which is a permutation-scaling matrix everywhere on  $\hat{\mathcal{Z}}$ . Thus local disentanglement holds.
Step 3:  $\pmb{v}$  is not globally disentangled. However,  $\pmb{v}_2(\pmb{z}_1, \pmb{z}_2)$  is not constant in  $\pmb{z}_1$ . Indeed,
$$
\left. \boldsymbol {v} _ {2} \left(- \frac {1}{2}, - \frac {1}{2}\right) = \frac {\left(z _ {2} + 1\right) ^ {2} + 1}{2} \right| _ {\boldsymbol {z} _ {2} = - 1 / 2} = \frac {5}{8} \neq e ^ {- 1 / 2} = \boldsymbol {v} _ {2} \left(\frac {1}{2}, - \frac {1}{2}\right). \tag {46}
$$
Thus global disentanglement does not hold.
A.5 Proof of Theorem 1
Proposition 9. Suppose that the data-generating process satisfies Assumption 1, that the learned decoder  $\hat{\pmb{f}}:\mathbb{R}^{d_z}\to \mathbb{R}^{d_x}$  is a  $C^2$ -diffeomorphism onto its image and that the encoder  $\hat{\pmb{g}}:\mathbb{R}^{d_x}\to \mathbb{R}^{d_z}$  is continuous. Then, if  $\hat{\pmb{f}}$  and  $\hat{\pmb{g}}$  solve the reconstruction problem on the training distribution, i.e.  $\mathbb{E}^{\mathrm{train}}||\pmb {x} - \hat{\pmb{f}} (\hat{\pmb{g}} (\pmb {x}))||^2 = 0$ , we have that  $\pmb {f}(\mathcal{Z}^{\mathrm{train}}) = \hat{\pmb{f}} (\hat{\mathcal{Z}}^{\mathrm{train}})$  and the map  $\pmb {v}\coloneqq \pmb{f}^{-1}\circ \hat{\pmb{f}}$  is a  $C^2$ -diffeomorphism from  $\hat{\mathcal{Z}}^{\mathrm{train}}$  to  $\mathcal{Z}^{\mathrm{train}}$ .
Proof. First note that
$$
\mathbb {E} ^ {\text {t r a i n}} \left\| \boldsymbol {x} - \hat {\boldsymbol {f}} (\hat {\boldsymbol {g}} (\boldsymbol {x})) \right\| ^ {2} = \mathbb {E} ^ {\text {t r a i n}} \left\| \boldsymbol {f} (\boldsymbol {z}) - \hat {\boldsymbol {f}} (\hat {\boldsymbol {g}} (\boldsymbol {f} (\boldsymbol {z}))) \right\| ^ {2} = 0, \tag {47}
$$
which implies that, for  $\mathbb{P}_{z}^{\mathrm{train}}$ -almost every  $z \in \mathcal{Z}^{\mathrm{train}}$
$$
\boldsymbol {f} (\boldsymbol {z}) = \hat {\boldsymbol {f}} (\hat {\boldsymbol {g}} (\boldsymbol {f} (\boldsymbol {z}))).
$$
But since the functions on both sides of the equations are continuous, the equality holds for all  $z \in \mathcal{Z}^{\mathrm{train}}$ . This implies that  $f(\mathcal{Z}^{\mathrm{train}}) = \hat{f} \circ \hat{g} \circ f(\mathcal{Z}^{\mathrm{train}}) = \hat{f} (\hat{\mathcal{Z}}^{\mathrm{train}})$ .
By Remark 3, the restrictions  $\pmb{f} : \mathcal{Z}^{\mathrm{train}} \to \pmb{f}(\mathcal{Z}^{\mathrm{train}})$  and  $\hat{\pmb{f}} : \hat{\mathcal{Z}}^{\mathrm{train}} \to \hat{\pmb{f}}(\hat{\mathcal{Z}}^{\mathrm{train}})$  are  $C^2$ -diffeomorphisms and, because  $\pmb{f}(\mathcal{Z}^{\mathrm{train}}) = \hat{\pmb{f}}(\hat{\mathcal{Z}}^{\mathrm{train}})$ , their composition  $\pmb{v} \coloneqq \pmb{f}^{-1} \circ \hat{\pmb{f}} : \hat{\mathcal{Z}}^{\mathrm{train}} \to \mathcal{Z}^{\mathrm{train}}$  is a well defined  $C^2$ -diffeomorphism (since  $C^2$ -diffeomorphisms are closed under composition).
Proof. We can apply Proposition 9 and have that the map  $\pmb{v} \coloneqq \pmb{f}^{-1} \circ \hat{\pmb{f}}$  is a  $C^2$ -diffeomorphism from  $\hat{\mathcal{Z}}^{\mathrm{train}}$  to  $\mathcal{Z}^{\mathrm{train}}$ . This allows one to write
$$
\boldsymbol {f} \circ \boldsymbol {v} (\boldsymbol {z}) = \hat {\boldsymbol {f}} (\boldsymbol {z}) \forall \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {\text {t r a i n}} \tag {48}
$$
$$
\sum_ {B \in \mathcal {B}} \boldsymbol {f} ^ {(B)} (\boldsymbol {v} _ {B} (\boldsymbol {z})) = \sum_ {B \in \mathcal {B}} \hat {\boldsymbol {f}} ^ {(B)} (\boldsymbol {z} _ {B}) \forall \boldsymbol {z} \in \hat {\mathcal {Z}} ^ {\text {t r a i n}}. \tag {49}
$$
Since  $\mathcal{Z}^{\mathrm{train}}$  is regularly closed and is diffeomorphic to  $\hat{\mathcal{Z}}^{\mathrm{train}}$ , by Lemma 4, we must have that  $\hat{\mathcal{Z}}^{\mathrm{train}} \subseteq (\hat{\mathcal{Z}}^{\mathrm{train}})^\circ$ . Moreover, the left and right hand side of (49) are  $C^2$ , which means they have uniquely defined first and second derivatives on  $(\hat{\mathcal{Z}}^{\mathrm{train}})^\circ$  by Lemma 6. This means the derivatives are uniquely defined on  $\hat{\mathcal{Z}}^{\mathrm{train}}$ .
Let  $\mathbf{z} \in \hat{\mathcal{Z}}^{\mathrm{train}}$ . Choose some  $J \in \mathcal{B}$  and some  $j \in J$ . Differentiate both sides of the above equation with respect to  $\mathbf{z}_j$ , which yields:
$$
\sum_ {B \in \mathcal {B}} \sum_ {i \in B} D _ {i} \boldsymbol {f} ^ {(B)} \left(\boldsymbol {v} _ {B} (\boldsymbol {z})\right) D _ {j} \boldsymbol {v} _ {i} (\boldsymbol {z}) = D _ {j} \hat {\boldsymbol {f}} ^ {(J)} \left(\boldsymbol {z} _ {J}\right). \tag {50}
$$
Choose  $J' \in \mathcal{B} \setminus \{J\}$  and  $j' \in J'$ . Differentiating the above w.r.t.  $\mathbf{z}_{j'}$  yields
$$
\sum_ {B \in \mathcal {B}} \sum_ {i \in B} \left[ D _ {i} \boldsymbol {f} ^ {(B)} (\boldsymbol {v} _ {B} (\boldsymbol {z})) D _ {j, j ^ {\prime}} ^ {2} \boldsymbol {v} _ {i} (\boldsymbol {z}) + \sum_ {i ^ {\prime} \in B} D _ {i, i ^ {\prime}} ^ {2} \boldsymbol {f} ^ {(B)} (\boldsymbol {v} _ {B} (\boldsymbol {z})) D _ {j ^ {\prime}} \boldsymbol {v} _ {i ^ {\prime}} (\boldsymbol {z}) D _ {j} \boldsymbol {v} _ {i} (\boldsymbol {z}) \right] = 0
$$
$$
\sum_ {B \in \mathcal {B}} \left[ \sum_ {i \in B} \left[ D _ {i} \pmb {f} ^ {(B)} (\pmb {v} _ {B} (\pmb {z})) D _ {j, j ^ {\prime}} ^ {2} \pmb {v} _ {i} (\pmb {z}) + D _ {i, i} ^ {2} \pmb {f} ^ {(B)} (\pmb {v} _ {B} (\pmb {z})) D _ {j ^ {\prime}} \pmb {v} _ {i} (\pmb {z}) D _ {j} \pmb {v} _ {i} (\pmb {z}) \right] + \right.
$$
$$
\left. \sum_ {(i, i ^ {\prime}) \in B _ {<  } ^ {2}} D _ {i, i ^ {\prime}} ^ {2} \boldsymbol {f} ^ {(B)} (\boldsymbol {v} _ {B} (\boldsymbol {z})) \left(D _ {j ^ {\prime}} \boldsymbol {v} _ {i ^ {\prime}} (\boldsymbol {z}) D _ {j} \boldsymbol {v} _ {i} (\boldsymbol {z}) + D _ {j ^ {\prime}} \boldsymbol {v} _ {i} (\boldsymbol {z}) D _ {j} \boldsymbol {v} _ {i ^ {\prime}} (\boldsymbol {z})\right) \right] = 0, \tag {51}
$$
where  $B_{<}^{2} \coloneqq B^{2} \cap \{(i, i') \mid i' < i\}$ . For the sake of notational conciseness, we are going to refer to  $S_{\mathcal{B}}$  and  $S_{\mathcal{B}}^{c}$  as  $S$  and  $S^{c}$  (Definition 11). Also, define
$$
S _ {<  } := \bigcup_ {B \in \mathcal {B}} B _ {<  } ^ {2}. \tag {52}
$$
Let us define the vectors
$$
\forall i \in \{1, \dots d _ {z} \}, \vec {a} _ {i} (\boldsymbol {z}) := \left(D _ {j, j ^ {\prime}} ^ {2} \boldsymbol {v} _ {i} (\boldsymbol {z})\right) _ {(j, j ^ {\prime}) \in S ^ {c}} \tag {53}
$$
$$
\forall i \in \{1, \dots d _ {z} \}, \vec {b} _ {i} (\boldsymbol {z}) := \left(D _ {j ^ {\prime}} \boldsymbol {v} _ {i} (\boldsymbol {z}) D _ {j} \boldsymbol {v} _ {i} (\boldsymbol {z})\right) _ {(j, j ^ {\prime}) \in S ^ {c}} \tag {54}
$$
$$
\forall B \in \mathcal {B}, \forall (i, i ^ {\prime}) \in B _ {<  } ^ {2}, \vec {c} _ {i, i ^ {\prime}} (\boldsymbol {z}) := \left(D _ {j ^ {\prime}} \boldsymbol {v} _ {i ^ {\prime}} (\boldsymbol {z}) D _ {j} \boldsymbol {v} _ {i} (\boldsymbol {z}) + D _ {j ^ {\prime}} \boldsymbol {v} _ {i} (\boldsymbol {z}) D _ {j} \boldsymbol {v} _ {i ^ {\prime}} (\boldsymbol {z})\right) _ {(j, j ^ {\prime}) \in S ^ {c}} \tag {55}
$$
This allows us to rewrite, for all  $k \in \{1, \dots, d_x\}$
$$
\sum_ {B \in \mathcal {B}} \left[ \sum_ {i \in B} \left[ D _ {i} \boldsymbol {f} _ {k} ^ {(B)} \left(\boldsymbol {v} _ {B} (\boldsymbol {z})\right) \vec {a} _ {i} (\boldsymbol {z}) + D _ {i, i} ^ {2} \boldsymbol {f} _ {k} ^ {(B)} \left(\boldsymbol {v} _ {B} (\boldsymbol {z})\right) \vec {b} _ {i} (\boldsymbol {z}) \right] + \sum_ {\left(i, i ^ {\prime}\right) \in B _ {<  } ^ {2}} D _ {i, i ^ {\prime}} ^ {2} \boldsymbol {f} _ {k} ^ {(B)} \left(\boldsymbol {v} _ {B} (\boldsymbol {z})\right) \vec {c} _ {i, i ^ {\prime}} (\boldsymbol {z}) \right] = 0. \tag {56}
$$
We define
$$
\boldsymbol {w} (\boldsymbol {z}, k) := \left(\left(D _ {i} \boldsymbol {f} _ {k} ^ {(B)} (\boldsymbol {z} _ {B})\right) _ {i \in B}, \left(D _ {i, i} ^ {2} \boldsymbol {f} _ {k} ^ {(B)} (\boldsymbol {z} _ {B})\right) _ {i \in B}, \left(D _ {i, i ^ {\prime}} ^ {2} \boldsymbol {f} _ {k} ^ {(B)} (\boldsymbol {z} _ {B})\right) _ {(i, i ^ {\prime}) \in B _ {<  } ^ {2}}\right) _ {B \in \mathcal {B}} \tag {57}
$$
$$
\boldsymbol {M} (\boldsymbol {z}) := \left[ \left[ \vec {a} _ {i} (\boldsymbol {z}) \right] _ {i \in B}, \left[ \vec {b} _ {i} (\boldsymbol {z}) \right] _ {i \in B}, \left[ \vec {c} _ {i, i ^ {\prime}} (\boldsymbol {z}) \right] _ {(i, i ^ {\prime}) \in B _ {<  } ^ {2}} \right] _ {B \in \mathcal {B}}, \tag {58}
$$
which allows us to write, for all  $k \in \{1, \dots, d_z\}$
$$
\boldsymbol {M} (\boldsymbol {z}) \boldsymbol {w} (\boldsymbol {v} (\boldsymbol {z}), k) = 0. \tag {59}
$$
We can now recognize that the matrix  $W(\pmb{v}(\pmb{z}))$  of Assumption 2 is given by
$$
\boldsymbol {W} (\boldsymbol {v} (\boldsymbol {z})) ^ {\top} = \left[ \boldsymbol {w} (\boldsymbol {v} (\boldsymbol {z}), 1) \dots \boldsymbol {w} (\boldsymbol {v} (\boldsymbol {z}), d _ {x}) \right] \tag {60}
$$
which allows us to write
$$
\boldsymbol {M} (\boldsymbol {z}) \boldsymbol {W} (\boldsymbol {v} (\boldsymbol {z})) ^ {\top} = 0 \tag {61}
$$
$$
\boldsymbol {W} (\boldsymbol {v} (\boldsymbol {z})) \boldsymbol {M} (\boldsymbol {z}) ^ {\top} = 0 \tag {62}
$$
Since  $W(\pmb{v}(\pmb{z}))$  has full column-rank (by Assumption 2 and the fact that  $\pmb{v}(\pmb{z}) \in \mathcal{Z}^{\mathrm{train}}$ ), there exists  $q$  rows that are linearly independent. Let  $K$  be the index set of these rows. This means  $W(\pmb{v}(\pmb{z}))_{K,'}$  is an invertible matrix. We can thus write
$$
\boldsymbol {W} (\boldsymbol {v} (\boldsymbol {z})) _ {K, \cdot} \boldsymbol {M} (\boldsymbol {z}) ^ {\top} = 0 \tag {63}
$$
$$
\left(\boldsymbol {W} (\boldsymbol {v} (\boldsymbol {z})) _ {K, \cdot}\right) ^ {- 1} \boldsymbol {W} (\boldsymbol {v} (\boldsymbol {z})) _ {K, \cdot} \boldsymbol {M} (\boldsymbol {z}) ^ {\top} = \left(\boldsymbol {W} (\boldsymbol {v} (\boldsymbol {z})) _ {K, \cdot}\right) ^ {- 1} 0 \tag {64}
$$
$$
\boldsymbol {M} (\boldsymbol {z}) ^ {\top} = 0, \tag {65}
$$
which means, in particular, that,  $\forall i\in \{1,\ldots ,d_z\}$ $\vec{b}_i(z) = 0$  , i.e.,
$$
\forall i \in \{1, \dots , d _ {z} \}, \forall (j, j ^ {\prime}) \in S ^ {c}, D _ {j} \boldsymbol {v} _ {i} (\boldsymbol {z}) D _ {j ^ {\prime}} \boldsymbol {v} _ {i} (\boldsymbol {z}) = 0 \tag {66}
$$
Since the  $\pmb{v}$  is a diffeomorphism, its Jacobian matrix  $D\pmb{v}(\pmb{z})$  is invertible everywhere. By Lemma 5, this means there exists a permutation  $\pi$  such that, for all  $j$ ,  $D_{j}\pmb{v}_{\pi(j)}(\pmb{z}) \neq 0$ . This and (66) imply that
$$
\forall (j, j ^ {\prime}) \in S ^ {c}, D _ {j} \boldsymbol {v} _ {\pi \left(j ^ {\prime}\right)} (\boldsymbol {z}) \underbrace {D _ {j ^ {\prime}} \boldsymbol {v} _ {\pi \left(j ^ {\prime}\right)} (\boldsymbol {z})} _ {\neq 0} = 0, \tag {67}
$$
$$
\Rightarrow \forall (j, j ^ {\prime}) \in S ^ {c}, D _ {j} \mathbf {v} _ {\pi \left(j ^ {\prime}\right)} (\mathbf {z}) = 0. \tag {68}
$$
To show that  $D\pmb{v}(\pmb{z})$  is a  $\mathcal{B}$ -block permutation matrix, the only thing left to show is that  $\pi$  respects  $\mathcal{B}$ . For this, we use the fact that,  $\forall B \in \mathcal{B}, \forall (i,i') \in B_{<}^{2}, \vec{c}_{i,i'}(\pmb{z}) = 0$  (recall  $M(\pmb{z}) = 0$ ). Because  $\vec{c}_{i,i'}(\pmb{z}) = \vec{c}_{i',i}(\pmb{z})$ , we can write
$$
\forall (i, i ^ {\prime}) \in S \text {s . t .} i \neq i ^ {\prime}, \forall (j, j ^ {\prime}) \in S ^ {c}, D _ {j ^ {\prime}} \boldsymbol {v} _ {i ^ {\prime}} (\boldsymbol {z}) D _ {j} \boldsymbol {v} _ {i} (\boldsymbol {z}) + D _ {j ^ {\prime}} \boldsymbol {v} _ {i} (\boldsymbol {z}) D _ {j} \boldsymbol {v} _ {i ^ {\prime}} (\boldsymbol {z}) = 0. \tag {69}
$$
We now show that if  $(j,j') \in S^c$  (indices belong to different blocks), then  $(\pi(j), \pi(j')) \in S^c$  (they also belong to different blocks). Assume this is false, i.e. there exists  $(j_0, j_0') \in S^c$  such that  $(\pi(j_0), \pi(j_0')) \in S$ . Then we can apply (69) (with  $i := \pi(j_0)$  and  $i' := \pi(j_0')$ ) and get