SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Let  $N_{1}$  denote the number of nodes  $v_{1}^{\prime} \in V(G)$  such that  $(G, u_{1}, v_{1}^{\prime}) \models \phi^{\prime}$  and  $N_{2}$  denote the number of nodes  $v_{2}^{\prime} \in V(H)$  such that  $(H, u_{2}, v_{2}^{\prime}) \models \phi^{\prime}$ . Let's compare values of  $N_{1}$  and  $N_{2}$ . First, by induction, since we have  $CLS_{G}(u_{1}) = CLS_{H}(u_{2})$  from precondition, so for any  $v_{1}^{\prime} \in V(G), v_{2}^{\prime} \in V(H)$ , which satisfies  $CLS_{G}(v_{1}^{\prime}) = CLS_{H}(v_{2}^{\prime}), \phi^{\prime}(x,y)$  can't distinguish  $(u_{1}, v_{1}^{\prime})$  and  $(u_{2}, v_{2}^{\prime})$ . Second, isomorphism tells us  $\phi^{\prime}$  can't distinguish node pairs from the same graph if they share the same  $CLS$  values. Combining these two facts, there has to be a subset  $S \subseteq \{1, 2, 3\}$ , such that  $N_{1} = \sum_{a \in S} N_{G}(a)$  and  $N_{2} = \sum_{a \in S} N_{H}(a)$ , where  $N_{G}(a)$  denotes the number of nodes  $u$  on  $G$  such that  $CLS_{G}(u) = a$ ,  $(N_{H}(a)$  is defined similarly).
It's easy to see that  $N_G(1) = N_H(1) = 1$ , and  $N_G(a), N_H(a) > m$  for  $a \in \{2,3\}$ . Therefore, at least one of  $N_1 = N_2$  and  $m < \min \{N_1, N_2\}$  holds. In neither case  $\exists^{\geq N} y \phi'(x,y), N \leq m$  can distinguish  $(u_1, v_1)$  and  $(u_2, v_2)$ .
Note that in the above proof our graph class  $\{G(n), H(n) | n \in \mathbb{N}\}$  is actually a simple graph class, so we can actually get the following stronger argument.
Corollary 24.1.  $R^2$ -GNN  $\nsubseteq$ $\mathcal{FOC}_2$  on some simple graph class.
C Proof of Theorem 4
Proof. We just need to show  $\mathcal{FOC}_2 \subseteq \mathbb{R}^2$ -GNN on any simple graph class, and the second part can be just concluded from Corollary 24.1. By Lemma 22,  $\mathcal{FOC}_2 = \mathcal{RSFOC}_2$ , so it suffices to show  $\mathcal{RSFOC}_2 \subseteq 0/1$ -GNN. By Lemma 19,  $0/1$ -GNN is closed under  $\wedge, \vee, \neg$ , so we can only focus on formulas in  $\mathcal{RSFOC}_2$  of form  $\varphi(x) = \exists^{\geq n}y(\varphi_S(x,y) \wedge \varphi'(y)), S \subseteq P_2$ . If we can construct an equivalent  $0/1$ -GNN  $\mathcal{A}$  for all formulas of above form, then we can capture all formulas in  $\mathcal{RSFOC}_2$  since other generating rules  $\wedge, \vee, \neg$  is closed under  $0/1$ -GNN. In particular, for the setting of single-edge graph class,  $\varphi$  is meaningful only when  $|S| \leq 1$ . That's because  $|S| > 2$  implies that  $\varphi$  is just the trivial  $\perp$  in any single-edge graph class  $\mathcal{G}_s$ .
Do induction over quantifier depth  $k$  of  $\varphi(x)$ . In the base case where  $k = 0$ , the result trivially holds since in this situation, the only possible formulas that needs to consider are unary predicates  $A(x)$ , where  $A \in P_1$ , which can be captured by the initial one-hot feature. Next, assume our result holds for all formulas with quantifier depth  $k$  no more than  $m$ , it suffices to prove the result when quantifier depth of  $\varphi(x) = \exists^{\geq n} y(\varphi_S(x,y) \land \varphi'(y))$  is  $m + 1$ . It follows that quantifier depth of  $\varphi'(y)$  is no more than  $m$ .
By induction, there is a 0/1-GNN model  $\mathcal{A}'$  such that  $\mathcal{A}' = \varphi'$  on single-edge graph class. To construct  $\mathcal{A}$ , we only need to append another layer on  $\mathcal{A}'$ . This layer  $L + 1$  has dimension 1, whose parameters  $C^{(L + 1)}, (A_j^{(L + 1)})_{j = 1}^K, R^{(L + 1)}, b^{(L + 1)}$  are set as follows:
1. When  $|S| = 1$ : Suppose  $S = \{j\}$ , set  $A_{j,(1,1)}^{L + 1} = 1, b^{L + 1} = 1 - n$ , where  $A_{j,(1,1)}^{L + 1}$  denotes the element on the first row and first column of matrix  $A_{j}^{(L + 1)}$ . Other parameters in this layer are 0. This construction represents  $\mathbf{x}_v^{(L + 1)} = \max (0, \min ((\sum_{u \in \mathcal{N}_{G,j}(v)} \mathbf{x}_u^{(L)}) - (n - 1), 1))$ . Since  $\mathbf{x}_u^{(L)}$  is classification result outputted by  $\mathcal{A}'$  which is equivalent to  $\varphi'$ ,  $\sum_{u \in \mathcal{N}_{G,j}(v)} \mathbf{x}_u^{(L)}$  counts the number of  $j$ -type neighbors  $u$  of  $v$  that satisfies  $\varphi'(u)$ . Therefore  $\mathbf{x}_v^{(L + 1)} = 1$  if and only if there exists at least  $n$ $j$ -type neighbors satisfying the condition  $\varphi'$ , which is exactly what  $\varphi(x)$  means.
2. When  $|S| = 0$ : Let  $K = |P_2|$ , for all  $j \in [K]$ , set  $A_{j,(1,1)}^{L+1} = -1$ ,  $R_{1,1}^{(L+1)} = 1$ ,  $b^{L+1} = 1 - n$  and all other parameters 0. This construction represents  $\mathbf{x}_v^{(L+1)} = \max(0, \min((\sum_{u \in V(G)} \mathbf{x}_u^{(L)}) - (\sum_{j=1}^K \sum_{u \in \mathcal{N}_{G,j}(v)} \mathbf{x}_u^{(L)}) - (n-1), 1))$ . Since we only
consider single-edge graph,  $(\sum_{u\in V(G)}\mathbf{x}_u^{(L)}) - (\sum_{j = 1}^K\sum_{u\in \mathcal{N}_{G,j}(v)}\mathbf{x}_u^{(L)})$  exactly counts the number of nodes  $u$  that satisfies  $\varphi '(y)$  and doesn't have any relation with  $v$ . It's easy to see that  $\mathbf{x}_v^{(L + 1)} = 1$  iff there exists at least  $n$  such nodes  $u$ , which is exactly what  $\varphi (x)$  means.
Hence, we finish the proof for Theorem 4 - for each  $\mathcal{FOC}_2$  formula over the single-edge graph class, we can construct an  $\mathbb{R}^2$ -GNN to capture it.
D Proof of Theorem 5 and Theorem 6
Theorem 6. For any bounded graph class  $\mathcal{G}_b$ . Suppose any  $G \in \mathcal{G}_b$  has no more than  $N$  nodes, and  $\mathcal{G}_b$  has unary predicate set  $P_1$  and relation (binary predicate) set  $P_2$ . Let  $m_1 := |P_1|, m_2 := |P_2|$ , then for any node classifier  $c$ , suppose  $c$  can be represented as an  $R^2$ -GNN with depth (layer number)  $L$ , then by Theorem 5 there is a  $\mathcal{FOC}_2$  classifier  $\varphi$  equivalent to  $c$  over  $\mathcal{G}_b$ . Moreover, the followings hold:
1. The quantifier depth of  $\varphi$  is no more than  $L$ .
2. The size of  $\varphi$  (quantified by the number of nodes of  $\varphi$ 's parse tree) is no more than  $2^{2f(L)}$ , where  $f(L) := 2^{2^{(N+1)f(L-1)}}, f(0) = O(2^{2^{(m_1 + m_2))})$ .
For Theorem 5, we just need to show  $\mathbf{R}^2$ -GNN  $\subseteq \mathcal{FOC}_2$  on any bounded graph class. The second part can then be shown by the fact that the graph class  $\{G_1,G_2\}$  in Figure 1 is a bounded graph class but  $\mathcal{FOC}_2 \nsubseteq \mathbf{R}^2$ -GNN still holds. In the following proof, we also show how to get the complexity upper bound claimed in Theorem 6. If we want to prove  $\mathbf{R}^2$ -GNN  $\subseteq \mathcal{FOC}_2$ , it suffices to show that for any  $\mathbf{R}^2$ -GNN  $\mathcal{A}$ , there exists an equivalent  $\mathcal{FOC}_2$  formula  $\varphi$  on any bounded graph class  $\mathcal{G}_b$ . It implies that for two graphs  $G_1,G_2$  and their nodes  $a,b$ , if they are classified differently by  $\mathcal{A}$ , there exists some  $\mathcal{FOC}_2$  formula  $\varphi$  that can distinguish them. Conversely, if  $a,b$  can't be distinguished by any  $\mathcal{FOC}_2$  formula, then they can't be distinguished by any  $\mathbf{R}^2$ -GNN as well.
Definition 25. For a set of classifiers  $\Psi = \{\psi_1,\dots,\psi_m\}$ , a  $\Psi$ -truth-table  $T$  is a 0/1 string of length  $m$ .  $T$  can be seen as a classifier, which classifies a node  $v$  to be true if and only if for any  $1\leq i\leq m$ , the classification result of  $\psi_{i}$  on  $v$  equals to  $T_{i}$ , where  $T_{i}$  denotes the  $i$ -th bit of string  $T$ . We define  $\mathcal{T}(\Psi)\coloneqq \{0,1\} ^m$  as the set of all  $\Psi$ -truth-tables. We have that for any graph  $G$  and its node  $v$ ,  $v$  satisfies exactly one truth-table  $T$ .
Proposition 26. Let  $\mathcal{FOC}_2(n)$  denote the set of formulas of  $\mathcal{FOC}_2$  with quantifier depth no more than  $n$ . For any bounded graph class  $\mathcal{G}_b$  and  $n$ , only finitely many intrinsically different node classifiers on  $\mathcal{G}_b$  can be represented by  $\mathcal{FOC}_2(n)$ . Furthermore, define  $N,m_1,m_2$  as in Theorem 6, the number of intrinsically different  $\mathcal{FOC}_2(n)$  node classifiers on  $\mathcal{G}_b$  and their parse tree sizes are all upper bounded by  $f(n)$  as defined in Theorem 6.
Proof. Suppose all graphs in  $\mathcal{G}_b$  have no more than  $N$  constants, then for any natural number  $m > N$ , formulas of form  $\exists^{\geq m}y(\varphi (x,y))$  are always false. Therefore, it's sufficient only to consider  $\mathcal{FOC}_2$  logical classifiers with threshold numbers no more than  $N$  on  $\mathcal{G}_b$ .
There are only  $m_{1} + m_{2}$  predicates, and each boolean combination of unary predicates using  $\land, \lor, \neg$  can be rewritten in the form of Disjunctive Normal Form (DNF) (Davey and Priestley [2002]). So there are only at most  $f(0) = 2^{2(m_{1} + m_{2})}$  intrinsically different formulas in  $\mathcal{FOC}_2$  with quantifier depth 0. Note that  $2(m_{1} + m_{2})$  is the number of terms,  $2^{2(m_{1} + m_{2})}$  is the number of different truth-table conjunctions on these terms, and  $2^{2(m_{1} + m_{2})}$  is the number of different DNFs on these conjunctions. Each DNF has parse tree of size at most  $1 + 2^{2(m_{1} + m_{2})}(1 + 2m_{1} + 2m_{2}) \leq 1000 \cdot 2^{2(m_{1} + m_{2})}$ . Therefore, define  $f(0) = 1000 \cdot 2^{2(m_{1} + m_{2})} = O(2^{2(m_{1} + m_{2})})$ , we know the number of different  $\mathcal{FOC}_2$  formulas with quantifier depth 0 and parse tree size of these formulas can both be upper bounded by  $f(0)$ .
By induction, suppose there are only  $f(k)$  intrinsically different  $\mathcal{FOC}_2(k)$  formulas on  $\mathcal{G}_b$ , and each meaningful  $\mathcal{FOC}_2(k + 1)$  formula is generated by the following grammar
$$
\varphi_ {1} \wedge \varphi_ {2}, \varphi_ {1} \vee \varphi_ {2}, \neg \varphi_ {2}, \exists^ {\geq m} y \left(\varphi^ {\prime} (x, y)\right), m \leq N \tag {18}
$$
where  $\varphi_{1},\varphi_{2}$  are  $\mathcal{FOC}_2(k + 1)$  formulas and  $\varphi^{\prime}$  is  $\mathcal{FOC}_2(k)$  formulas.
Given that only the rule  $\exists^{\geq m}y(\varphi'(x,y))$  can increase the quantifier depth from  $k$  to  $k + 1$ ,  $m \leq N$ , and there are only  $f(k)$  intrinsically different  $\varphi'(x,y) \in \mathcal{FOC}_2(k)$  on  $\mathcal{G}_b$  by induction. Therefore, there are only  $(2N + 2)f(k)$  intrinsically different  $\mathcal{FOC}_2(k + 1)$  formulas of form  $\exists^{\geq m}y(\varphi'(x,y)), \exists^{\geq m}x(\varphi'(x,y))$  or in  $\mathcal{FOC}_2(k)$  on  $\mathcal{G}_b$ . Moreover, their boolean combination using  $\land, \lor, \neg$  can be always rewritten in the DNF form, So there are also finitely many intrinsically different  $\mathcal{FOC}_2(k + 1)$  logical classifiers on  $\mathcal{G}_b$ . Similarly, we can bound the number of different DNF by  $f(k + 1) = 2^{2^{(N + 1)f(k)}}$ , where  $2(N + 1)f(k)$  is the number of "building blocks" which are sub-formulas with smaller quantifier depth or outermost symbol  $\exists$ ,  $2^{2(N + 1)f(k)}$  is the number of different conjunctions on these building blocks, and  $f(k + 1) = 2^{2^{(N + 1)f(k)}}$  is the number of different DNFs on these conjunctions. Parse tree size of each of these DNFs is at most  $1 + 2^{2(N + 1)f(k)}(1 + 2(N + 1)f(k)(1 + f(k))) \leq 2^{2^{2(N + 1)f(k)}} = f(k + 1)$ . The LHS is from the inductive assumption that each  $\mathcal{FOC}_2(k)$  formula has a equivalent representation within  $f(k)$  parse tree size. The inequality is because we know  $f(k) \geq 1000$ . Thus, we can upper bound the number of intrinsically different  $\mathcal{FOC}_2(k + 1)$  formulas on  $\mathcal{G}_b$  and their parse tree size both by  $f(k + 1)$ .
Lemma 27. For any two pairs  $(G_1, v_1)$  and  $(G_2, v_2)$ , where  $G_1$  and  $G_2$  are two bounded graphs from  $\mathcal{G}_b$  and  $v_1$  and  $v_2$  are two nodes in  $G_1$  and  $G_2$ , respectively. If all logical classifiers in  $\mathcal{FOC}_2(L)$  can't distinguish  $v_1, v_2$ , then any  $R^2$ -GNN with layer no more than  $L$  can't distinguish them as well.
Proof. By one-hot feature initialization function of  $\mathbb{R}^2$ -GNN,  $\mathcal{FOC}_2(0)$  can distinguish all different one-hot initial features, so the lemma trivially holds for the base case ( $L = 0$ ).
For the inductive step, we suppose Lemma 27 holds for all  $L \leq k$ , then we can assume  $v_{1}, v_{2}$  can't be distinguished by  $\mathcal{FOC}_2(k + 1)$ . Let  $N = k + 1$
$G_{1}$  and  $G_{2}$  are bounded graphs from  $\mathcal{G}_b$ , so  $\mathcal{FOC}_2(N)$  has finitely many intrinsically different classifiers according to Proposition 26. Let  $\mathcal{T}\mathcal{T}_N(v)$  denote the  $\mathcal{FOC}_2(N)$ -truth-table satisfied by  $v$ . According to Definition 25, we know that for any  $T \in \mathcal{T}(\mathcal{FOC}_2(N))$ , there exists a  $\mathcal{FOC}_2(N)$  classifier  $\varphi_T$  such that for any node  $v$  on  $G_i$ , where  $i \in 1, 2$ ,  $\mathcal{T}\mathcal{T}_N(v) = T \Leftrightarrow (G_i, v) \models \varphi_T$ .
Assume there is an  $\mathbf{R}^2$ -GNN  $\mathcal{A}$  that distinguishes  $v_{1}, v_{2}$  with layer  $L = k + 1$ . Let  $\widehat{\mathcal{A}}$  denote its first  $k$  layers. By update rule of  $\mathbf{R}^2$ -GNN illustrated in Equation 2, output of  $\mathcal{A}$  on node  $v$  of graph  $G$ ,  $\mathbf{x}_v^{(k + 1)}$  only dependent on the following three things:
- output of  $\widehat{\mathcal{A}}$  on  $v, \mathbf{x}_v^{(k)}$
- multiset of outputs of  $\widehat{\mathcal{A}}$  on  $r$ -type neighbors of  $v$  for each  $r \in P_2$ ,  $\{\mathbf{x}_u^{(k)}|u \in \mathcal{N}_{G,r}(v)\}$
- multiset of outputs of  $\widehat{\mathcal{A}}$  on all nodes in the graph,  $\{\mathbf{x}_u^{(k)}|u\in \mathcal{N}_{G,r}(v)\}$
By induction, since  $v_{1}, v_{2}$  can't be distinguished by  $\mathcal{FOC}_2(k)$ , they have same feature outputted by  $\widehat{\mathcal{A}}$ . Then there are two remaining possibilities.
-  $\{\{\mathcal{T}\mathcal{T}_k(u)|u\in \mathcal{N}_{G_1,r}(v_1)\} \} \neq \{\{\mathcal{T}\mathcal{T}_k(u)|u\in \mathcal{N}_{G_2,r}(v_2)\} \}$  for some binary predicate  $r$ . Therefore, there exists a  $\mathcal{FOC}_2(k)$ -truth-table  $T$ , such that  $v_{1},v_{2}$  have differently many  $r$ -type neighbors that satisfies  $\varphi_T$ . Without loss of generality, suppose  $v_{1},v_{2}$  have  $n_1,n_2(n_1 < n_2)$  such neighbors respectively. we can write a  $\mathcal{FOC}_2(k + 1)$  formula  $\exists^{\geq n_2}y(r(x,y)\wedge \varphi_T(y))$  that distinguishes  $v_{1}$  and  $v_{2}$ , which contradicts the precondition that they can't be distinguished by  $\mathcal{FOC}_2(k + 1)$  classifiers.
-  $\{\{\mathcal{T}\mathcal{T}_k(u)|u\in V(G_1)\} \} \neq \{\{\mathcal{T}\mathcal{T}_k(u)|u\in V(G_2)\} \}$ . Therefore, there exists a  $\mathcal{FOC}_2(k)$ -truth-table  $T$ , such that  $G_{1},G_{2}$  have differently many nodes that satisfies  $\varphi_T$ . Without loss of generality, suppose  $G_{1},G_{2}$  have  $n_1,n_2(n_1 < n_2)$  such nodes respectively. we can write
a  $\mathcal{FOC}_2(k + 1)$  formula  $\exists^{\geq n_2}y\varphi_T(y)$  that distinguishes  $v_{1}$  and  $v_{2}$ , which contradicts the precondition that they can't be distinguished by  $\mathcal{FOC}_2(k + 1)$  classifiers.
Since all possibilities contradict the precondition that  $v_{1}, v_{2}$  can't be distinguished by  $\mathcal{FOC}_2(k + 1)$ , such an  $\mathcal{A}$  that distinguishes  $v_{1}, v_{2}$  doesn't exist.
We can now gather all of these to prove Theorem 5 and Theorem 6.
Proof. For any  $\mathbb{R}^2$ -GNN  $\mathcal{A}$ , suppose it has  $L$  layers. For any graph  $G \in \mathcal{G}_b$  and its node  $v$ , let  $\mathcal{T}\mathcal{T}_L(v)$  denote the  $\mathcal{FOC}_2(L)$ -truth-table satisfied by  $v$ . For any  $T \in \mathcal{T}(\mathcal{FOC}_2(L))$ , since  $\mathcal{G}_b$  is a bounded graph class, using Proposition 26, there exists a  $\mathcal{FOC}_2(L)$  classifier  $\varphi_T$  such that for any node  $v$  in graph  $G \in \mathcal{G}_b$ ,  $\mathcal{T}\mathcal{T}_L(v) = T \Leftrightarrow (G,v) \models \varphi_T$ . Moreover, by Proposition 26, since  $T$  is a truth table on at most  $f(L)$  formulas,  $\varphi_T$  can be written as a conjunction over  $f(L)$  literals, which means  $\varphi_T$  has parse tree size at most  $1 + f(L)^2$  since by Proposition 26, every formula in  $\mathcal{FOC}_2(L)$  is equivalent to some  $\mathcal{FOC}_2$  formula with parse tree size at most  $f(L)$ .
By Lemma 27, If two nodes  $v_{1}, v_{2}$  have same  $\mathcal{FOC}_2(L)$ -truth-table  $(\mathcal{T}\mathcal{T}_L(v_1) = \mathcal{T}\mathcal{T}_L(v_2))$ , they can't be distinguished by  $\mathcal{A}$ . Let  $S$  denote the subset of  $\mathcal{T}(\mathcal{FOC}_2(L))$  that satisfies  $\mathcal{A}$ . By Proposition 26 and Definition 25,  $\Phi := \{\varphi_T | T \in S\}$  is a finite set with  $|\Phi| \leq 2^{f(L)}$ , then disjunction of formulas in  $\Phi$ ,  $(\bigvee_{T \in S} \varphi_T)$  is a  $\mathcal{FOC}_2$  classifier that equals to  $\mathcal{A}$  under bounded graph class  $\mathcal{G}_b$ . Furthermore, by the above upper bound of parse tree size of any  $\varphi_T$ ,  $(\bigvee_{T \in S} \varphi_T)$  has parse tree size no more than  $1 + 2^{f(L)} (1 + f(L)^2) \leq 2^{2f(L)}$ , where the inequality is from  $f(L) \geq 1000$ . We complete the proof.
E Proof of Theorem 9
Theorem 9.  $R^2$ -GNN  $\subseteq R^2$ -GNN  $\circ F$  on any universal graph class  $\mathcal{G}_u$ .
Proof. Assume that we have a predicate set  $P = P_{1} \cup P_{2}$ ,  $K = |P_{2}|$  and let  $P' = P \cup \{\text{primal,aux1,aux2}\}$  denote the predicate set after transformation  $F$ . For any  $\mathbb{R}^2$ -GNN  $\mathcal{A}$  under  $P$ , we want to construct another  $\mathbb{R}^2$ -GNN  $\mathcal{A}'$  under  $P'$ , such that for any graph  $G$  under  $P$  and its node  $v$ ,  $v$  has the same feature outputted by  $\mathcal{A}(G,v)$  and  $\mathcal{A}'(F(G),v)$ . Let  $L$  denote the layer number of  $\mathcal{A}$ .
We prove this theorem by induction over the number of layers  $L$ . In the base  $(L = 0)$ , our result trivially holds since the one-hot initialization over  $P'$  contains all unary predicate information in  $P$ . Now suppose the result holds for  $L \leq k$ , so it suffices to prove it when  $L = k + 1$ .
For the transformed graph  $F(G)$ ,  $\text{primal}(\mathbf{v})$  is true if and only if  $v$  is the node in the original graph  $G$ . Without loss of generality, if we use one-hot feature initialization on  $P'$ , we can always keep an additional dimension in the node feature vector  $\mathbf{x}_v$  to show whether  $\text{primal}(\mathbf{v})$  is true, its value is always 0/1, in the proof below when we use  $\mathbf{x}$  to denote the feature vectors, we omit this special dimension for simplicity. But keep in mind that this dimension always keeps so we can distinguish original nodes and added nodes.
Recall that an  $\mathbb{R}^2$ -GNN is defined by  $\{C^{(i)}, (A_j^{(i)})_{i=1}^K, R^{(i)}\}_{i=1}^L$ . By induction, let  $\widehat{\mathcal{A}}$  denote the first  $k$  layers of  $\mathcal{A}$ , and let  $\widehat{\mathcal{A}}'$  denote the  $\mathbb{R}^2$ -GNN equivalent with  $\widehat{\mathcal{A}}$  on  $F$  transformation such that  $\widehat{\mathcal{A}} = \widehat{\mathcal{A}}' \circ F$ . We will append three layers to  $\widehat{\mathcal{A}}'$  to construct  $\mathcal{A}'$  that is equivalent to  $\mathcal{A}$ . Without loss of generality, we can assume all layers in  $\mathcal{A}$  have same dimension length  $d$ . Suppose  $L'$  is the layer number of  $\widehat{\mathcal{A}}'$ , so we will append layer  $L' + 1, L' + 2, L' + 3$ . For all  $l \in \{L' + 1, L' + 2, L' + 3\}$ , let  $\{C^{a,(l)}, C^{p,(l)}, (A_j^{*,(l)})_{j=1}^K, A_{aux1}^{*,(l)}, A_{aux2}^{*,(l)}, R^{*,(l)}\}$  denote the parameters in  $l$ -th layer of  $\mathcal{A}$ . Here,  $A_{aux1}^{*,(l)}, A_{aux2}^{*,(l)}$  denotes the aggregation function corresponding to two new predicates aux1,aux2, added in transformation  $F$ , and  $C^{p,(l)}, C^{a,(l)}$  are different combination functions that used for primal nodes and non-primal nodes. Note that with the help of the special dimension mentioned above, we can distinguish primal nodes and non-primal nodes. Therefore, It's safe to use different combination functions for these two kinds of nodes. Note that here since we add two predicates aux1,aux2, the input for combination function should be in the form  $C^p (\mathbf{x}_0, (\mathbf{x}_j))_{j=1}^K, \mathbf{x}_{aux1}, \mathbf{x}_{aux2}, \mathbf{x}_g)$  where  $\mathbf{x}_0$  is the feature vector of the former layer, and  $\mathbf{x}_j, 1 \leq j \leq K$  denote the output of aggregation function
$A_{j}^{*,(l)}$ ,  $\mathbf{x}_{aux1}, \mathbf{x}_{aux2}$  denote the output of aggregation function  $A_{aux1}^{*,(l)}, A_{aux2}^{*,(l)}$ , and  $\mathbf{x}_g$  denotes the feature outputted by global readout function  $R^{*,(l)}$ . For aggregation function and global readout function, their inputs are denoted by  $\mathbf{X}$ , meaning a multiset of feature vector. Note that all aggregation functions and readout functions won't change the feature dimension, only combination functions  $C^{p,(l)}, C^{a,(l)}$  will transform  $d_{l-1}$  dimension features to  $d_l$  dimension features.
1). layer  $L' + 1$ : input dimension is  $d$ , output dimension is  $d' = Kd$ . For feature vector  $\mathbf{x}$  with length  $d'$ , let  $\mathbf{x}^{(i)}, i \in \{1, \dots, K\}$  denote its  $i$ -th slice in dimension  $[(i - 1)d + 1,id]$ . Let  $[\mathbf{x}_1, \dots, \mathbf{x}_m]$  denote concatenation of  $\mathbf{x}_1, \dots, \mathbf{x}_m$ , and let  $[\mathbf{x}]^n$  denote concatenation of  $n$  copies of  $\mathbf{x}$ ,  $\mathbf{0}^n$  denote zero vectors of length  $n$ . parameters for this layer are defined below:
$$
C ^ {p, \left(L ^ {\prime} + 1\right)} \left(\mathbf {x} _ {0}, \left(\mathbf {x} _ {j}\right) _ {j = 1} ^ {K}, \mathbf {x} _ {a u x 1}, \mathbf {x} _ {a u x 2}, \mathbf {x} _ {g}\right) = \left[ \mathbf {x} _ {0}, \boldsymbol {\theta} ^ {d ^ {\prime} - d} \right] \tag {19}
$$
$$
C ^ {a, \left(L ^ {\prime} + 1\right)} \left(\mathbf {x} _ {0}, \left(\mathbf {x} _ {j}\right) _ {j = 1} ^ {K}, \mathbf {x} _ {a u x 1}, \mathbf {x} _ {a u x 2}, \mathbf {x} _ {g}\right) = \left[ \mathbf {x} _ {a u x 1} \right] ^ {K} \tag {20}
$$
$$
A _ {a u x 1} ^ {*, (L ^ {\prime} + 1)} (\mathbf {X}) = \sum_ {\mathbf {x} \in \mathbf {X}} \mathbf {x} \tag {21}
$$
Other parameters in this layer are set to functions that always output zero-vector.
We can see here that the layer  $L' + 1$  do the following thing:
For all primal nodes  $a$  and its non-primal neighbor  $e_{ab}$ , pass concatenation of  $K$  copies of  $\mathbf{x}_a$  to  $\mathbf{x}_{e_{ab}}$ , and remains the feature of primal nodes unchanged.
2). layer  $L' + 2$ , also has dimension  $d' = Kd$ , has following parameters.
$$
C ^ {p, (L ^ {\prime} + 2)} \left(\mathbf {x} _ {0}, \left(\mathbf {x} _ {j}\right) _ {j = 1} ^ {K}, \mathbf {x} _ {a u x 1}, \mathbf {x} _ {a u x 2}, \mathbf {x} _ {g}\right) = \mathbf {x} _ {0} \tag {22}
$$
$$
C ^ {a, (L ^ {\prime} + 2)} \left(\mathbf {x} _ {0}, \left(\mathbf {x} _ {j}\right) _ {j = 1} ^ {K}, \mathbf {x} _ {a u x 1}, \mathbf {x} _ {a u x 2}, \mathbf {x} _ {g}\right) = \sum_ {j = 1} ^ {K} \mathbf {x} _ {j} \tag {23}
$$
$$
\forall j \in [ 1, K ], A _ {j} ^ {*}, \left(L ^ {\prime} + 2\right) (\mathbf {X}) = \left[ \mathbf {0} ^ {(j - 1) d}, \sum_ {\mathbf {x} \in \mathbf {X}} \mathbf {x} ^ {(j)}, \mathbf {0} ^ {(K - j) d} \right] \tag {24}
$$
All other parameters in this layer are set to function that always outputs zero vectors. This layer do the following thing:
For all primal nodes, keep the feature unchanged, for all added node pair  $e_{ab}, e_{ba}$ . Switch their feature, but for all  $r_i \in P_2$ , if there is no  $r_i$  relation between  $a, b$ , the  $i$ -th slice of  $\mathbf{x}_{e_{ab}}$  and  $\mathbf{x}_{e_{ba}}$  will be set to 0.
3). layer  $L' + 3$ , has dimension  $d$ , and following parameters.